/* ========================================
   OC Page Styles
   ======================================== */

/* OCページ */
.oc-content {
    margin-bottom: 60px;
}

.character-container {
    position: relative;
    min-height: 350px;
    margin-bottom: 50px;
    overflow: visible;
}

/* スライドインアニメーション用の初期状態 */
.character-container.slide-initial .character-card {
    transform: translateX(-50%);
    opacity: 0;
}

/* スライドインアニメーション */
.character-card {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 画像右配置時のレイアウト調整 */
.character-card[data-image-position="right"] {
    grid-template-columns: 1fr 250px;
    gap: 40px;
}

.character-card[data-image-position="right"] .character-image {
    justify-self: end;
}

.character-card[data-image-position="right"] .character-info {
    margin-left: 40px;
}

.character-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 300px;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
    padding: 25px;
    background-color: #ffffff;
    border: 2px solid #DDCDBF;
    transition: all 0.4s ease;
}

/* アクティブなカード - 前面に表示 */
.character-card.active {
    transform: translateX(0) translateY(0);
    opacity: 1;
    z-index: 10;
    position: relative;
}

/* キャラクターカードの背景画像設定（CSS変数を使用） */
.character-card.active[data-aspect="front"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: no-repeat;
    z-index: 0;
    opacity: 0.1;
    pointer-events: none;
    background-image: var(--bg-image-front);
    background-position: var(--bg-position-front, center);
    background-size: var(--bg-size-front, cover);
}

.character-card.active[data-aspect="back"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: no-repeat;
    z-index: 0;
    opacity: 0.1;
    pointer-events: none;
    background-image: var(--bg-image-back);
    background-position: var(--bg-position-back, center);
    background-size: var(--bg-size-back, cover);
}

/* 非アクティブなカード - 重なり効果で常に表示 */
.character-card:not(.active) {
    transform: translateX(20px) translateY(20px);
    opacity: 0.8;
    z-index: 5;
}

/* ホバー効果 - 重なりデザインに適した調整 */
.character-container:hover .character-card.active {
    transform: translateX(0) translateY(-5px);
}

.character-container:hover .character-card:not(.active) {
    transform: translateX(25px) translateY(25px);
    opacity: 0.2;
}

/* キャラクターヘッダー */
.character-header {
    margin-bottom: 15px;
}

.character-name {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    color: #333333;
    border-bottom: 1px solid #333333;
    padding-bottom: 5px;
    text-shadow: 
        -1px -1px 0 #ffffff,
        1px -1px 0 #ffffff,
        -1px 1px 0 #ffffff,
        1px 1px 0 #ffffff;
}

.character-english-name {
    display: inline;
    font-size: var(--min-font-size, 1.125rem);
    font-weight: 300;
    margin-left: 10px;
    color: #666666;
    text-shadow: 
        -1px -1px 0 #ffffff,
        1px -1px 0 #ffffff,
        -1px 1px 0 #ffffff,
        1px 1px 0 #ffffff;
}

.character-description {
    font-size: var(--min-font-size, 1.125rem);
    font-weight: 300;
    line-height: 1.6;
    color: #333333;
}

.character-description p {
    margin-bottom: 8px;
}

.character-description p:last-child {
    margin-bottom: 0;
}

.character-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 250px;
    height: 400px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.character-illustration {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.character-placeholder {
    width: 100%;
    max-width: 250px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(221, 205, 191, 0.2);
    border: 2px dashed #DDCDBF;
    color: #999999;
    font-size: 1rem;
    font-weight: 300;
}

/* 画像位置によるorder設定 */
.character-image[data-order="1"] {
    order: 1;
}

.character-image[data-order="2"] {
    order: 2;
}

.character-info[data-order="1"] {
    order: 1;
}

.character-info[data-order="2"] {
    order: 2;
}

/* レスポンシブ対応の背景画像サイズ調整 */
@media (max-width: 768px) {
    .character-card.active[data-aspect="front"]::before {
        background-size: var(--bg-size-front-mobile, var(--bg-size-front, cover));
    }
    
    .character-card.active[data-aspect="back"]::before {
        background-size: var(--bg-size-back-mobile, var(--bg-size-back, cover));
    }

    .character-container {
        min-height: 350px;
        height: 350px;
        overflow: visible;
        margin-bottom: 25px;
    }

    .character-card {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        min-height: auto;
        transition: all 0.3s ease;
    }

    .character-card[data-image-position="right"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .character-card[data-image-position="right"] .character-image {
        order: 1 !important;
        justify-self: center !important;
    }

    .character-card[data-image-position="right"] .character-info {
        order: 2 !important;
        margin-left: 0 !important;
    }

    .character-card.active {
        transform: translateX(0) translateY(0);
        opacity: 1;
        z-index: 10;
    }

    .character-card:not(.active) {
        transform: translateX(10px) translateY(10px);
        opacity: 0.7;
        z-index: 5;
    }

    .character-header {
        margin-bottom: 10px;
    }

    .character-image {
        order: 1;
        width: 100%;
        height: 350px;
    }

    .character-info {
        order: 2;
    }

    .character-illustration {
        height: 350px;
        width: auto;
    }

    .character-name {
        font-size: 1.2rem;
        text-align: left;
        margin-bottom: 2px;
        text-shadow: 
            -1px -1px 0 #ffffff,
            1px -1px 0 #ffffff,
            -1px 1px 0 #ffffff,
            1px 1px 0 #ffffff;
    }

    .character-english-name {
        display: inline;
        font-size: var(--min-font-size, 1.125rem);
        text-align: left;
        margin-left: 8px;
        text-shadow: 
            -1px -1px 0 #ffffff,
            1px -1px 0 #ffffff,
            -1px 1px 0 #ffffff,
            1px 1px 0 #ffffff;
    }

    .character-description {
        text-align: left;
    }

    .character-image {
        width: 100%;
        height: 300px;
    }

    .character-illustration {
        height: 300px;
        width: auto;
    }

    .character-placeholder {
        width: 100%;
        max-width: 250px;
        height: 300px;
        font-size: var(--min-font-size, 1.125rem);
    }
}

/* 小画面対応の背景画像サイズ調整 */
@media (max-width: 575px) {
    .character-card.active[data-aspect="front"]::before {
        background-size: var(--bg-size-front-mobile, var(--bg-size-front, cover));
    }
    
    .character-card.active[data-aspect="back"]::before {
        background-size: var(--bg-size-back-mobile, var(--bg-size-back, cover));
    }
}
