/*
 * theme.css
 * 世界観（お祭り装飾）のスタイル
 *
 * 方針：
 *   - 賑やかな装飾は「文字が乗らない場所」で全開にする
 *   - 動きはすべて transform / opacity のみ（GPU合成で軽い）
 *   - @keyframes 本体は animations.css に定義。ここでは適用のみ行う
 *   - PCで盛り、スマホでは間引く（パフォーマンスと可読性を優先）
 *   - 読み込み順は最後（components.css / layout.css の装飾上書きを担当）
 */


/* ════════════════════════════════════════════════════════════════
   ヘッダーまわりの祭り装飾
   ════════════════════════════════════════════════════════════════ */

/* ── ヘッダー上端の紅白ストライプ ─────────────────
   PC（site-header）・SP（nav-mobile）共通。
   斜めの紅白でテント・屋台の天幕を想起させる。
 ─────────────────────────────────────────────── */
.site-header::before,
.nav-mobile::before {
    content: '';
    display: block;
    height: 5px;
    background: repeating-linear-gradient(
        -45deg,
        var(--festival-red)  0 12px,
        #FFFDF0 12px 24px
    );
}


/* ── ロゴ：ホバーで首を振る ─────────────────────── */
.site-logo__img,
.nav-mobile__logo-img {
    transform-origin: center bottom;
}


/* ── グローバルナビ：縁日カラーの「札」化 ─────────────────
   項目ごとのアクセント色を CSS 変数で付け、PCでは絵文字入りの
   お祭り札（ふだ）風チップに。SPドロワーでは色縁として使う。
 ─────────────────────────────────────────────── */
.global-nav__item:nth-child(1) { --nav-accent: #E2543A; }  /* 朱：ホーム */
.global-nav__item:nth-child(2) { --nav-accent: #3BA5D8; }  /* 空色：おでかけ・体験 */
.global-nav__item:nth-child(3) { --nav-accent: #E8A93A; }  /* 山吹：おかしな逸品 */
.global-nav__item:nth-child(4) { --nav-accent: #4CAF7D; }  /* 緑：うまいもん横丁 */
.global-nav__item:nth-child(5) { --nav-accent: #9C6BB3; }  /* 紫：特集一覧 */

@media (min-width: 1024px) {
    /* サイトロゴバナー廃止に伴い、ナビをヘッダー中央に寄せる */
    .header-inner { justify-content: center; }

    .global-nav__list { gap: 10px; }

    /* 絵文字アイコンを表示して楽しく（layout.css の display:none を上書き） */
    .global-nav__icon {
        display: block;
        font-size: 1.5rem;
        line-height: 1;
    }

    .global-nav__link {
        background: #FFFDF0;
        color: #3a2c22;
        border: 2px solid var(--nav-accent, #E2543A);
        border-bottom-width: 4px;
        border-radius: 12px;
        padding: 0.45em 1em 0.35em;
        box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    }
    .global-nav__link:hover {
        color: #1c1109;
        border-bottom-color: var(--nav-accent, #E2543A);
        transform: translateY(-3px);
        box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
    }
    .global-nav__link.is-active {
        background: var(--nav-accent, #E2543A);
        color: #fff;
        border-bottom-color: var(--nav-accent, #E2543A);
    }
}

/* SPドロワー：項目ごとの色縁で縁日感を出す */
@media (max-width: 1023.98px) {
    .global-nav__link { border-left: 6px solid var(--nav-accent, #E2543A); }
}


/* （旧・TOPのPR表記SP出し分けルールは廃止。全デバイスでグロメニュー直下に表示） */


/* ── TOP「へぇ〜タイムライン」見出しの装飾ボックス ─────────
   モノづくり／工場イラスト（images/ui/timeline_head_bg.png）を背景に敷き、
   その画像がゆっくり上下にパンする。金属フレーム風の縁でメカっぽく。
   文字は中央・白抜き＋濃い縁取りで、カラフルな背景の上でも目立たせる。
 ─────────────────────────────────────────────── */
.timeline-head {
    position: relative;
    height: 130px;                 /* 縦幅は据え置き（約130px） */
    margin-bottom: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 1rem;
    border-radius: 12px;
    /* 金属フレーム風：スチール色の縁＋内側のハイライト。影は濃いめに */
    border: 3px solid #37475a;
    box-shadow: inset 0 0 0 3px #b9cfe2, 0 8px 22px rgba(0, 0, 0, 0.38);
    background: #dceaf6;            /* 画像読込前のフォールバック */
    overflow: hidden;
}
/* トグル配置版：左に見出し／右にトグル（横並び） */
.timeline-head--toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 1rem;
    padding: 0 1.4rem 0 2.4rem;  /* 左をほんの少し広げて見出しを右へ寄せる */
}
.timeline-head__text {
    position: relative;
    z-index: 1;
}
.timeline-head--toggle .heee-filter-toggle {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
.timeline-head--toggle .section__heading::after { left: 0; transform: none; } /* 下線を左端起点に */
@media (max-width: 600px) {
    /* スマホは縦積み（トグルを下に） */
    .timeline-head--toggle { flex-direction: column; justify-content: center; gap: 0.4rem; }
}
/* 動く背景レイヤー（工場イラスト）。上下に少し大きくして translateY でパン */
.timeline-head::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    /* 上下を大きくはみ出させ、背景画像（760×415＝縦長め）をより広く見せる */
    top: -120px; bottom: -120px;
    z-index: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)),
        url('../../images/ui/timeline_head_bg.png') center center / cover no-repeat;
    /* ゆっくり上下にパンさせる（動きすぎると文字が読みにくくなるため） */
    animation: timelineHeadPan 14s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes timelineHeadPan {
    /* 上下の移動幅を大きくして、画像の上のほう〜下のほうまで映す */
    from { transform: translateY(-105px); }
    to   { transform: translateY(105px); }
}
/* 見出し・サブテキストを前面へ。白抜き＋濃い縁取りで可読性を確保 */
/* 背景が動くぶん、文字のフチは太めにして可読性を確保する。
   text-shadow を8方向（斜め＋上下左右）に置くことで輪郭が途切れない */
.timeline-head .section__heading,
.timeline-head .section__subtext {
    position: relative;
    z-index: 1;
    color: #fff;
    text-shadow:
        -3px -3px 0 #24405e,  0px -3px 0 #24405e,  3px -3px 0 #24405e,
        -3px  0px 0 #24405e,                       3px  0px 0 #24405e,
        -3px  3px 0 #24405e,  0px  3px 0 #24405e,  3px  3px 0 #24405e,
         0    4px 8px rgba(0, 0, 0, 0.55);
}
.timeline-head .section__heading {
    /* 下段の汎用 .section__heading（left:50%/translateX）を打ち消す。
       中央寄せは親の flex(align-items:center) に任せ、transform はアニメ専用にする */
    left: 0;
    transform: none;
    margin: 0;
    padding-bottom: 0;
    display: block;
    /* ★大きく・太く・目立たせる */
    font-size: clamp(1.8rem, 5.5vw, 3.1rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.1;
    /* 見出しはさらに太いフチ（8方向・4px） */
    text-shadow:
        -4px -4px 0 #24405e,  0px -4px 0 #24405e,  4px -4px 0 #24405e,
        -4px  0px 0 #24405e,                       4px  0px 0 #24405e,
        -4px  4px 0 #24405e,  0px  4px 0 #24405e,  4px  4px 0 #24405e,
         0    5px 10px rgba(0, 0, 0, 0.6);
    /* 文字がぷるんと弾むアニメ */
    animation: timelineTitlePop 2.6s ease-in-out infinite;
}
/* 見出し下の装飾下線はここでは不要（工場フレームで完結させる） */
.timeline-head .section__heading::after { display: none; }
.timeline-head .section__subtext {
    margin: 0.35rem 0 0;
    /* 副題も大きめ・太字・白抜き＋縁取りでしっかり読ませる */
    font-size: clamp(1rem, 2.8vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
}

/* 副題のうしろに置く笑顔イラスト（暗い線画なので白フチを足して背景から浮かせる） */
.timeline-head__face {
    display: inline-block;  /* reset.css の img{display:block} を打ち消し、文と同じ行に置く */
    height: 1.5em;
    width: auto;
    vertical-align: middle;
    margin-left: 0.45em;
    margin-top: -0.15em;   /* 文字の中心とだいたい揃える */
    filter:
        drop-shadow( 1px  0 0 #fff) drop-shadow(-1px 0 0 #fff)
        drop-shadow(0  1px 0 #fff) drop-shadow(0 -1px 0 #fff);
}

@keyframes timelineTitlePop {
    0%, 100% { transform: scale(1)    rotate(0deg); }
    45%      { transform: scale(1.05) rotate(-1deg); }
    70%      { transform: scale(1.02) rotate(1deg); }
}

@media (max-width: 600px) {
    .timeline-head { height: 108px; }
}

/* 動きを減らす設定では背景パン・文字アニメを止める */
@media (prefers-reduced-motion: reduce) {
    .timeline-head::before,
    .timeline-head .section__heading { animation: none; }
}

.site-logo:hover .site-logo__img {
    animation: logoWiggle 0.45s ease;
}

/* ── グローバルナビ：ホバーでアイコンがぴょこんと跳ねる（PCのみ）── */
@media (min-width: 1024px) {
    .global-nav__link:hover .global-nav__icon {
        animation: pyokon 0.45s ease both;
    }
}

/* ── シーンナビ：チップを縁日カラーに ─────────────
   6シーンに祭りカラーの下地を順番に割り当てる。
   文字は白のまま（紺地×半透明カラーでコントラスト確保）。
 ─────────────────────────────────────────────── */
.scene-nav__list a {
    transition: background-color var(--transition), transform var(--transition-fast);
}

.scene-nav__list li:nth-child(6n+1) a { background-color: rgba(255, 65, 54, 0.30); }  /* red */
.scene-nav__list li:nth-child(6n+2) a { background-color: rgba(255, 133, 27, 0.30); } /* orange */
.scene-nav__list li:nth-child(6n+3) a { background-color: rgba(255, 105, 180, 0.30); }/* pink */
.scene-nav__list li:nth-child(6n+4) a { background-color: rgba(0, 116, 217, 0.35); }  /* blue */
.scene-nav__list li:nth-child(6n+5) a { background-color: rgba(46, 204, 64, 0.30); }  /* green */
.scene-nav__list li:nth-child(6n+6) a { background-color: rgba(255, 220, 0, 0.25); }  /* yellow */

.scene-nav__list a:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.08) rotate(-2deg);   /* くじ引きの札がはねる感じ */
}


/* ════════════════════════════════════════════════════════════════
   TOPヒーローの演出オーバーレイ（home.php の .hero-fx）
   本実装はインラインSVGヒーローに移行予定。それまでの仮演出。
   ════════════════════════════════════════════════════════════════ */

/* 太鼓（衝撃波リング）の位置はヒーロー画像の構図に合わせてここで調整する */
.home-hero {
    --taiko-x: 9%;    /* 左からの位置 */
    --taiko-y: 12%;   /* 下からの位置 */
}

/* ドンの鼓動：画像全体がかすかに脈打つ（リングと同じ2.4s周期で同期） */
.home-hero__picture {
    animation: taikoPulse 2.4s ease-in-out infinite;
}

/* オーバーレイ容器：クリックを邪魔しない・はみ出しはヒーロー側で切られる */
.hero-fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ── 紙吹雪 ──
   10枚を nth-child で散らす（位置・色・周期・遅延をばらけさせる） */
.hero-fx__confetti {
    position: absolute;
    top: -20px;
    width: 8px;
    height: 13px;
    border-radius: 2px;
    opacity: 0;
    animation: confettiFall 5s linear infinite;
}

.hero-fx__confetti:nth-child(1)  { left: 4%;  background: var(--festival-red);    animation-duration: 4.6s; animation-delay: 0s;   }
.hero-fx__confetti:nth-child(2)  { left: 14%; background: var(--festival-yellow); animation-duration: 5.8s; animation-delay: 1.2s; }
.hero-fx__confetti:nth-child(3)  { left: 24%; background: var(--festival-blue);   animation-duration: 4.2s; animation-delay: 2.4s; width: 6px; height: 10px; }
.hero-fx__confetti:nth-child(4)  { left: 34%; background: var(--festival-pink);   animation-duration: 6.2s; animation-delay: 0.7s; }
.hero-fx__confetti:nth-child(5)  { left: 45%; background: var(--festival-green);  animation-duration: 4.9s; animation-delay: 3.1s; }
.hero-fx__confetti:nth-child(6)  { left: 56%; background: var(--festival-orange); animation-duration: 5.4s; animation-delay: 1.8s; width: 6px; height: 10px; }
.hero-fx__confetti:nth-child(7)  { left: 66%; background: var(--festival-yellow); animation-duration: 4.4s; animation-delay: 4.0s; }
.hero-fx__confetti:nth-child(8)  { left: 76%; background: var(--festival-red);    animation-duration: 6.0s; animation-delay: 2.0s; }
.hero-fx__confetti:nth-child(9)  { left: 86%; background: var(--festival-purple); animation-duration: 5.1s; animation-delay: 0.4s; width: 6px; height: 10px; }
.hero-fx__confetti:nth-child(10) { left: 95%; background: var(--festival-blue);   animation-duration: 4.8s; animation-delay: 3.6s; }

/* ── 太鼓の衝撃波リング ──
   ドン！のタイミングで金色の円が広がって消える。2本を半周期ずらす */
.hero-fx__ring {
    position: absolute;
    left: var(--taiko-x);
    bottom: var(--taiko-y);
    width: 64px;
    height: 64px;
    border: 3px solid var(--festival-yellow);
    border-radius: 50%;
    opacity: 0;
    animation: taikoRing 2.4s ease-out infinite;
}

.hero-fx__ring--2 {
    animation-delay: 1.2s;
    border-color: var(--festival-orange);
}


/* ════════════════════════════════════════════════════════════════
   コンテンツの祭りポップ強化
   ════════════════════════════════════════════════════════════════ */

/* ── カード：持ち上がりながらわずかに傾く ─────────
   components.css の translateY(-3px) を上書きして遊びを足す
 ─────────────────────────────────────────────── */
.product-card:hover,
.feature-card:hover {
    transform: translateY(-5px) rotate(-0.6deg);
    box-shadow: var(--shadow-card-hover);
}

/* ── ボタン：ホバーで浮き、押すとへこむ ─────────── */
.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px) scale(0.97);
}

/* ── 商品カードのホバーアクセント（PCのみ金のボーダー）── */
@media (min-width: 1024px) {
    .product-card:hover {
        border-color: var(--color-festival-gold);
    }
}


/* ════════════════════════════════════════════════════════════════
   既存の世界観装飾（旧 theme.css から引き継ぎ・変数バグ修正済み）
   ════════════════════════════════════════════════════════════════ */

/* ── ヒーローエリアの装飾 ─────────────────────────
   グラデーションで祭り感を出す（画像差し替えを想定）
 ─────────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    /* 旧版は未定義変数 --color-festival-cream を参照していたため修正 */
    background: linear-gradient(
        135deg,
        var(--bg-base) 0%,
        #FFF0D5 50%,
        var(--bg-base) 100%
    );
}

/* PC：ヒーローに装飾エフェクト（スマホでは省略） */
@media (min-width: 1024px) {
    .hero::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image:
            /* 右上に金のアクセント円 */
            radial-gradient(circle at 90% 10%, rgba(232, 163, 32, 0.2) 0%, transparent 40%),
            /* 左下に赤のアクセント円 */
            radial-gradient(circle at 10% 90%, rgba(217, 54, 27, 0.15) 0%, transparent 40%);
        pointer-events: none;
    }
}

/* ── セクション見出しの装飾（赤→金の下線）─────── */
.section__heading {
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: var(--space-sm);
}

.section__heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;  /* .section__heading は inline-block（＝文字幅）なので、下線が文字数にぴったり沿う */
    height: 3px;
    background: linear-gradient(to right, var(--color-festival-red), var(--color-festival-gold));
    border-radius: var(--radius-full);
}

/* ── ページヒーローの装飾（紺地に金のアクセント）── */
.page-hero {
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .page-hero::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image:
            radial-gradient(circle at 80% 50%, rgba(232, 163, 32, 0.15) 0%, transparent 50%);
        pointer-events: none;
    }
}

/* ── フッターの装飾ライン（上部に金のライン）───── */
.site-footer {
    border-top: 3px solid var(--color-festival-gold);
}


/* ════════════════════════════════════════════════════════════════
   アクセシビリティ：動きを減らす設定を尊重
   animations.css の全体抑制に加え、装飾そのものを隠す
   （アニメ停止状態で固まった紙吹雪・リングが残らないように）
   ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .hero-fx {
        display: none;
    }
}
