/*
Theme Name: Salome 4th Anniversary
Description: HyakumantenbaraSalome 4th Anniversary カスタムテーマ
Version: 1.0.0
*/

/* ============================================================
   CSS変数
   ============================================================ */
:root {
    --color-primary:    #b03070;   /* ピンク */
    --color-secondary:  #6b3a8b;   /* パープル */
    --color-accent:     #c8960c;   /* ゴールド */
    --color-bg:         #2a1a35;   /* 本棚ダークパープル */
    --color-bg-light:   #3d2550;
    --color-text:       #f5e6f0;
    --color-text-dark:  #1a0a20;

    /* --site-width: 70%; */
    --site-width: 870px;
    --font-main: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
    --font-title: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;

    --book-page-height: 700px;
}

/* ============================================================
   リセット・ベース
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    background-image: url('assets/img/common/bg.png');
    background-repeat: repeat;
}

body {
    font-family: var(--font-main);
    /* background-color: var(--color-bg); */
    color: var(--color-text);
    min-height: 100vh;
    overflow: hidden;
    background-image: url('assets/img/common/bg.png');
    background-repeat: repeat;
}

/* ページトランジション（左からスライド） */
#page-transition {
    position: fixed;
    inset: 0;
    background: url('assets/img/common/bg01.png') center / cover no-repeat;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); /* スライドアウト（遷移後） */
}

/* 右へ退場（ページ読み込み後） */
#page-transition.is-hidden {
    transform: translateX(100%);
}

/* 左端に待機（遷移前の初期位置） */
#page-transition.is-offscreen-left {
    transform: translateX(-100%);
    transition: none;
}

/* bfcache復元時：トランジションなしで中央に戻す */
#page-transition.is-no-transition {
    transition: none !important;
}

/* スライドイン（遷移時・ゆっくり） */
#page-transition.is-sliding-in {
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition__gif {
    width: 280px;
    height: auto;
}

/* body.home,
body.blog,
body.wp-theme-salome4th {
    background-image: url('assets/img/common/bg.png');
    background-repeat: repeat;
} */

body.page-yumeshousetsu {
    background-image: url('assets/img/yumeshousetsu/bg.png'); /* 夢小説専用背景 */
    background-repeat: repeat;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   レイアウト共通
   ============================================================ */
.site-wrapper {
    width: var(--site-width);
    margin: 0 auto;
    position: relative;
}

/* サイド装飾（本棚の柱） */
.site-wrapper::before,
.site-wrapper::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - var(--site-width)) / 2);
    /* background-color: var(--color-bg-light); */
    z-index: -1;
}
.site-wrapper::before { left: 0; }
.site-wrapper::after  { right: 0; }

/* ============================================================
   メインコンテンツ（TOPページ以外）
   ============================================================ */
.site-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* padding: 40px 0; */
}

/* TOPページはそのまま */
.home .site-main {
    display: block;
    min-height: unset;
    padding: 0;
}

/* 夢小説ページ：全幅レイアウト */
.post-type-archive-yumeshousetsu .site-wrapper {
    width: 100vw;
    max-width: none;
}
.post-type-archive-yumeshousetsu .site-wrapper::before,
.post-type-archive-yumeshousetsu .site-wrapper::after {
    display: none;
}
.post-type-archive-yumeshousetsu .site-main {
    display: block;
    min-height: unset;
    padding: 0;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.site-header {
    width: 100%;
    /* background-color: var(--color-bg-light); */
    border-bottom: 2px solid var(--color-accent);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
}

.site-title {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--color-text);
    line-height: 1.3;
}

.site-title span {
    display: block;
    font-size: 1rem;
    color: var(--color-primary);
}

/* ============================================================
   ナビゲーション（本棚の板）
   ============================================================ */
.site-nav {
    background-color: #4a2a1a;
    border-top: 3px solid var(--color-accent);
    border-bottom: 3px solid var(--color-accent);
    padding: 6px 12px;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    justify-content: center;
}

.site-nav li a {
    display: block;
    padding: 4px 16px;
    font-size: 0.85rem;
    color: var(--color-text);
    border: 1px solid var(--color-accent);
    transition: background-color 0.2s;
}

.site-nav li a:hover {
    background-color: var(--color-accent);
    color: var(--color-text-dark);
}

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
    width: 100%;
    /* background-color: var(--color-bg-light); */
    border-top: 2px solid var(--color-accent);
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    color: var(--color-text);
    opacity: 0.7;
}

/* ============================================================
   本の見開きUI（共通）
   ============================================================ */
.book-spread {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    min-height: var(--book-page-height);
    border: 3px solid var(--color-accent);
    background-color: #f5ecd8;
    color: var(--color-text-dark);
    position: relative;
}

.js-book {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.book-page {
    padding: 50px 20px 50px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: var(--book-page-height);
}

/* 上下装飾（ですわボタン・推し活ページ共通、年表除く） */
.book-page:not(.nenpyou-book .book-page, .desuwa-book .book-page)::before,
.book-page:not(.nenpyou-book .book-page, .desuwa-book .book-page)::after {
    content: '';
    display: block;
    width: 100%;
    height: 48px;
    background-size: 100% auto;
    background-repeat: no-repeat;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.book-page:not(.nenpyou-book .book-page, .desuwa-book .book-page)::before {
    top: 0;
    background-position: top center;
    width: 400px;
}

.book-page:not(.nenpyou-book .book-page, .desuwa-book .book-page)::after {
    bottom: 0;
    background-position: bottom center;
    width: 400px;
}

.book-page--left {
    width: 350px;
    left: 55px;
}

.book-page--right {
}

/* 上下装飾 */
.common-deco {
    width: 100%;
    height: 48px;
    background-size: 100% auto;
    background-repeat: no-repeat;
}

/* ============================================================
   年表
   ============================================================ */
.nenpyou-header {
    text-align: center;
    padding: 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid #c0a880;
    margin-bottom: 12px;
    min-height: 80px;  /* 上部1/4エリア（文字列表示予定） */
}

.nenpyou-timeline {
    list-style: none;
    padding: 0;
}

.nenpyou-timeline__item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #c0a880;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nenpyou-timeline__item:hover {
    background-color: rgba(176, 48, 112, 0.1);
}

.nenpyou-timeline__date {
    font-size: 0.75rem;
    color: var(--color-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.nenpyou-timeline__title {
    font-size: 0.85rem;
}

/* 年表 右ページ詳細 */
.nenpyou-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nenpyou-detail__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.5;
    font-size: 0.85rem;
}

/* ============================================================
   モーダル（スマホ用）
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.is-open {
    display: flex;
}

.modal-content {
    background: #f5ecd8;
    color: var(--color-text-dark);
    padding: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid var(--color-accent);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--color-text-dark);
}

/* ============================================================
   turn.js ラッパー（推し活・お祝いメッセージ・編集後記）
   ============================================================ */
.book-turnjs-wrapper {
    width: 100%;
    overflow: hidden;
    background-color: #f5ecd8;
    color: var(--color-text-dark);
    /* border: 3px solid var(--color-accent); */
}

#book-turnjs {
    width: 100%;
    height: auto;
}

.turnjs-page {
    /* background-color: #f5ecd8; */
    color: var(--color-text-dark);
    /* padding: 24px 20px; */
    /* border: 2px solid var(--color-accent); */
    height: 100%;
    overflow-y: auto;
    position: relative;
}

/* 本のページ紙面（推し活・お祝いメッセージ・編集後記 共通） */
.paper-spread {
    background-image: url('assets/img/common/book_paper.png');
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

/* turnjs-page 内の綴じ目（見開き中央線） */
.turnjs-page::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    background: linear-gradient(to right, #ccc, #fff, #ccc);
    box-shadow: 0 0 6px rgba(0,0,0,0.3);
    pointer-events: none;
}

/* ============================================================
   推し活カード（4分割）
   ============================================================ */
.oshikatsu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 100%;
}

.oshikatsu-card {
    border: 1px solid #c0a880;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.oshikatsu-card__image {
    flex: 1;
    overflow: hidden;
}

.oshikatsu-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oshikatsu-card__author {
    font-size: 0.7rem;
    padding: 4px 6px;
    text-align: right;
    border-top: 1px solid #c0a880;
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media screen and (max-width: 720px) {
    :root {
        --site-width: 100vw;
    }

    .site-wrapper::before,
    .site-wrapper::after {
        display: none;
    }

    .book-spread {
        grid-template-columns: 1fr;
    }

    /* 年表: スマホは右ページを非表示、モーダルで代替 */
    .nenpyou-detail-page {
        display: none;
    }

    .oshikatsu-grid {
        grid-template-columns: 1fr 1fr;
    }

    .henshukoki-card {
        width: 100%;
    }
}

/* ============================================================
   ページめくりヒント矢印（turn.js 共通）
   ============================================================ */
@keyframes book-hint-float {
    0%, 100% { opacity: 0.45; transform: translateY(-50%) translateX(0); }
    50%       { opacity: 0.9;  transform: translateY(-50%) translateX(4px); }
}

@keyframes book-hint-float-prev {
    0%, 100% { opacity: 0.45; transform: translateY(-50%) translateX(0); }
    50%       { opacity: 0.9;  transform: translateY(-50%) translateX(-4px); }
}

.book-turn-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    background: rgba(192, 168, 128, 0.55);
    border: none;
    color: #fff;
    width: 28px;
    height: 56px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    pointer-events: auto;
}

.book-turn-hint--prev {
    left: 0;
    border-radius: 0 6px 6px 0;
    animation: book-hint-float-prev 2.2s ease-in-out infinite;
}

.book-turn-hint--next {
    right: 0;
    border-radius: 6px 0 0 6px;
    animation: book-hint-float 2.2s ease-in-out infinite;
    animation-delay: 0.4s;
}

.book-turn-hint:hover {
    background: rgba(192, 168, 128, 0.9);
}

.book-turn-hint.is-hidden {
    display: none;
}

@media screen and (max-width: 768px) {
    .page-transition__gif {
        width: 180px;
    }
}

/* ============================================================
   シークバー（turn.js 共通）
   ============================================================ */
.book-seekbar {
    width: 900px;
    display: flex;
    align-items: center;
    padding: 18px 58px;
    box-sizing: border-box;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

/* ツールチップ（バー上部に浮かぶサムネイル） */
.book-seekbar__tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    top: auto;
    left: var(--seekbar-tooltip-left, 50%);
    transform: translateX(-50%);
    background: rgba(40, 40, 40, 0.88);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    line-height: 0;
}

.book-seekbar:hover .book-seekbar__tooltip,
.book-seekbar__range:active ~ .book-seekbar__tooltip {
    opacity: 1;
}

/* トラック */
.book-seekbar__range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 1px;
    background: rgba(180, 180, 180, 0.35);
    outline: none;
    cursor: pointer;
}

/* Thumb（横長バー・幅は JS で --thumb-w を設定） — WebKit */
.book-seekbar__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--thumb-w, 24px);
    height: 8px;
    border-radius: 2px;
    background: #555;
    cursor: grab;
    transition: background 0.15s ease;
}

.book-seekbar__range:hover::-webkit-slider-thumb {
    background: #333;
}

.book-seekbar__range:active::-webkit-slider-thumb {
    background: #222;
    cursor: grabbing;
}

/* Thumb（横長バー） — Firefox */
.book-seekbar__range::-moz-range-thumb {
    width: var(--thumb-w, 24px);
    height: 8px;
    border-radius: 2px;
    background: #555;
    border: none;
    cursor: grab;
    transition: background 0.15s ease;
}

.book-seekbar__range:hover::-moz-range-thumb {
    background: #333;
}

.book-seekbar__range:active::-moz-range-thumb {
    background: #222;
    cursor: grabbing;
}

@media screen and (max-width: 768px) {
    .book-seekbar {
        width: 100%;
        left: 0;
        transform: none;
        bottom: 16px;
        padding: 8px 75px; /* 左右均等でセンター配置、右はhomeボタン（65px）との重なりを避ける */
    }

    .site-main {
        /* justify-content: flex-start;
        align-items: flex-start; */
        /* padding-top: 30px; */
        justify-content: center;
        align-items: center;
        min-height: 100svh;
    }
}

