/* css/02-hero.css — きょうの えんない「なんの どうぶつですか？」（unit=gate-hero。SPEC §4 02 hero）
   雑誌の表紙のように: 当番3体の地の色が混ざる色面、テープで留めたポスター窓、台座に立つ当番、特大の多色の問い。
   原画とその祖先には「位置・回転・等倍の拡縮」と drop-shadow だけ（SPEC §0-1）。 */

.sec-hero {
  --c1: #FFE14A; --c2: #2BC3FF; --c3: #FF4B2B;
  --sky-a: #BFEFFF; --sky-b: #FFF3C4;
  position: relative;
  overflow: clip;
  min-height: 100svh;
  padding: calc(var(--header-h) + 64px) var(--gutter) var(--sp-9);
  isolation: auto;
}
@media (min-width: 900px) {
  .sec-hero { padding: calc(var(--header-h) + 56px) var(--gutter) var(--sp-9); }
}
.sec-hero::before { background: var(--paper-hi); }

/* ---------- 6-10 メッシュ（当番3体の地の色）＋ 6-32 空 ---------- */
.hero-bg {
  position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  transform: translate3d(0, calc(var(--sy-px, 0px) * var(--depth, 0)), 0);
}
.hero-bg .blob {
  position: absolute; width: 78vmax; height: 78vmax; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c) 0%, color-mix(in oklab, var(--c) 72%, transparent) 42%, color-mix(in oklab, var(--c) 22%, transparent) 72%, transparent 100%);
  will-change: transform;
}
.hero-bg .b1 { --c: var(--c1); left: -26vmax; top: -30vmax; animation: hero-drift-1 19s ease-in-out infinite alternate; }
.hero-bg .b2 { --c: var(--c2); right: -30vmax; top: -12vmax; animation: hero-drift-2 23s ease-in-out infinite alternate; }
.hero-bg .b3 { --c: var(--c3); left: 14vmax; bottom: -44vmax; animation: hero-drift-3 27s ease-in-out infinite alternate; }
@keyframes hero-drift-1 { to { transform: translate(14vmax, 9vmax) scale(1.08); } }
@keyframes hero-drift-2 { to { transform: translate(-12vmax, 12vmax) scale(.94); } }
@keyframes hero-drift-3 { to { transform: translate(10vmax, -12vmax) scale(1.1); } }
.hero-bg .hero-sky {
  position: absolute; inset: 0 0 auto 0; height: 46%;
  background: linear-gradient(180deg, var(--sky-a) 0%, color-mix(in oklab, var(--sky-b) 60%, transparent) 55%, transparent 100%);
  opacity: .75;
}
/* 背景の特大「??」（Animals?? の ??）と紙目 */
.hero-bg::before {
  content: '??'; position: absolute; right: -4vw; bottom: -18vw;
  font-family: var(--f-q); font-style: italic; font-weight: 700; font-size: 52vw; line-height: 1;
  color: transparent; -webkit-text-stroke: 3px rgba(28, 27, 51, .14);
  letter-spacing: -.06em;
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: var(--tex-paper); background-size: 240px 240px; opacity: .9;
}
.sec-hero[data-time="evening"] { --sky-a: #2A2850; --sky-b: #5e4a9e; }
.sec-hero[data-time="morning"] { --sky-a: #FFD9B0; --sky-b: #FFF3C4; }

/* ---------- 並び ---------- */
.hero-grid {
  position: relative; z-index: 2;
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  gap: var(--sp-6) var(--sp-5);
  align-items: center;
  min-height: calc(100svh - var(--header-h) - var(--sp-5) - var(--sp-9));
}
.hero-copy { position: relative; z-index: 3; min-width: 0; }
.hero-visual-col { position: relative; z-index: 2; min-width: 0; padding-top: var(--sp-5); }

/* 多層視差（2-10）。reduced では止める */
[data-depth] { will-change: transform; }
.poster-depth, .cast-depth, .floaters { transform: translate3d(0, calc(var(--sy-px, 0px) * var(--depth, 0)), 0); }

/* ---------- 6-32 あいさつ ---------- */
.greeting {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 var(--sp-4); padding: 6px 16px 6px 6px;
  background: var(--paper-hi); border: var(--line); border-radius: var(--r-pill); box-shadow: var(--sh-step);
  font-weight: 700; font-size: var(--fs-small); line-height: 1.3;
  transform: rotate(-2deg);
}
.greeting-sky {
  position: relative; display: inline-block; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--ink); overflow: hidden;
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b));
}
.greeting-sky i {
  position: absolute; left: 50%; top: 52%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%;
  background: var(--do); box-shadow: 0 0 0 3px rgba(255, 154, 31, .45);
}
.sec-hero[data-time="evening"] .greeting-sky i { background: var(--moon); box-shadow: -4px -2px 0 0 #2A2850 inset, 0 0 0 3px rgba(255, 243, 196, .3); }
.sec-hero[data-time="morning"] .greeting-sky i { top: 70%; background: #FF9A1F; }

/* ---------- ロゴ（1-16 色の波・6-45 公転・2-45 ドッキング） ---------- */
.logo-wrap { position: relative; display: inline-block; margin: 0 0 var(--sp-3); padding: 14px 18px 10px 4px; }
.hero-logo:focus:not(:focus-visible), .hero-logo:focus { outline: none; box-shadow: none; }
.hero-logo.poptitle {
  position: relative; z-index: 2;
  font-size: clamp(2rem, 4.4vw, 3.5rem); line-height: 1.1; margin: 0;
  transform-origin: 0 0; outline-offset: 6px;
}
.hero-logo .ch { --c0: var(--pop-1); }
.hero-logo .ch[data-c="2"] { --c0: var(--pop-2); } .hero-logo .ch[data-c="3"] { --c0: var(--pop-3); }
.hero-logo .ch[data-c="4"] { --c0: var(--pop-4); } .hero-logo .ch[data-c="5"] { --c0: var(--pop-5); } .hero-logo .ch[data-c="6"] { --c0: var(--pop-6); }
.hero-logo .ch { animation: hero-colorwave 4.2s linear infinite; animation-delay: calc(var(--i, 0) * .11s); }
@keyframes hero-colorwave {
  0%, 62% { color: var(--c0); }
  68% { color: var(--do); } 74% { color: var(--mi); } 80% { color: var(--so); }
  86%, 100% { color: var(--c0); }
}
.orbit { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.orbit .sat { position: absolute; left: 50%; top: 50%; width: 46px; margin: -23px 0 0 -23px; }
.orbit .sat.is-front { z-index: 3; }
.orbit .sat > img.chara, .orbit .sat > .frame-round { display: block; width: 100% !important; height: auto; }
.orbit .sat > .frame-round { box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 5px var(--ink); border-width: 2px; }
.sec-hero.is-docking .orbit { visibility: hidden; }

/* ---------- 特大の問い（2-14 verbatim の視差がかかる） ---------- */
.mp-hero-title.poptitle {
  position: relative; z-index: 4;
  font-size: min(var(--fs-hero), 6.3vw); line-height: 1.02; letter-spacing: 0;
  margin: 0 0 var(--sp-5);
  width: max-content; max-width: calc(100vw - 2 * var(--gutter));
}
.mp-hero-title .q-line { display: block; white-space: nowrap; }
.mp-hero-title .q-line:first-child { font-size: .78em; margin-left: .04em; }
.mp-hero-title .q-line:last-child .ch:last-child {
  color: var(--do); transform: rotate(12deg) scale(1.18); transform-origin: 30% 80%; margin-left: .06em;
}
.mp-hero-title .ch { -webkit-text-stroke: .075em var(--ink); text-shadow: .045em .055em 0 var(--ink); }

/* ---------- 1-21 ローテータ ---------- */
.rotator {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: .1em .3em;
  margin: 0 0 var(--sp-5); padding: .22em .5em .22em .6em;
  background: var(--paper-hi); border: var(--line); border-radius: var(--r-pill); box-shadow: var(--sh-step);
  font-family: var(--f-pop); font-size: clamp(1.25rem, 2.6vw, 2.1rem); line-height: 1.25;
}
.rot-fix { color: var(--ink); }
.rot-slot {
  display: inline-block; padding: .04em .3em .08em;
  background: var(--mi); border: var(--line); border-radius: var(--r-s); box-shadow: 0 3px 0 var(--ink);
  transform: rotate(-3deg); margin-block: -.15em;
}
.rotator + .mp-hero-sub { display: block; width: fit-content; }
.rot-words { display: inline-grid; overflow: hidden; vertical-align: bottom; padding: .06em .04em .12em; margin: -.06em 0 -.12em; }
.rot-words .word { grid-area: 1 / 1; white-space: nowrap; visibility: hidden; }
.rot-words .word.is-on, .rot-words .word.is-in, .rot-words .word.is-out { visibility: visible; }
.rotator .ch { display: inline-block; -webkit-text-stroke: .07em var(--ink); paint-order: stroke fill; text-shadow: .04em .05em 0 var(--ink); }

/* ---------- リード（1-2 語の波） ---------- */
.mp-hero-sub {
  position: relative; display: inline-block; max-width: 34em;
  margin: 0; padding: var(--sp-3) var(--sp-5);
  background: var(--paper-hi); border: var(--line); border-radius: var(--r-m); box-shadow: var(--sh-step);
  font-size: var(--fs-lead); font-weight: 700; line-height: 1.7;
}
.mp-hero-sub .w { display: inline-block; white-space: pre; }

/* ---------- ポスター窓（3-1 verbatim のケンバーンズは .mp-hero-visual） ---------- */
.poster-window {
  position: relative; margin: 0 0 0 auto; width: min(100%, 500px);
  padding: 12px 12px 10px; background: var(--paper-hi);
  border: var(--line); border-radius: 6px;
  box-shadow: var(--sh-step-lg), 0 30px 40px -24px var(--shadow);
  transform: rotate(3deg);
}
.poster-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper-deep); }
.poster-frame .mp-hero-visual { position: absolute; inset: 0; }
.poster-frame .hero-poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-cap { display: flex; align-items: baseline; gap: 10px; padding: 8px 4px 0; font-weight: 700; font-size: var(--fs-small); line-height: 1.3; }
.poster-cap-ep { color: var(--do); }
.poster-cap-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poster-cap-dur { color: var(--ink-soft); }
.tape {
  position: absolute; top: -14px; z-index: 2; width: 96px; height: 28px;
  background: repeating-linear-gradient(90deg, rgba(255, 225, 74, .88) 0 8px, rgba(255, 238, 150, .88) 8px 16px);
  border-left: 2px dashed rgba(28, 27, 51, .25); border-right: 2px dashed rgba(28, 27, 51, .25);
  box-shadow: 0 2px 0 rgba(28, 27, 51, .12);
}
.tape--l { left: 18px; transform: rotate(-9deg); }
.tape--r { right: 18px; transform: rotate(7deg); background: repeating-linear-gradient(90deg, rgba(43, 195, 255, .8) 0 8px, rgba(150, 225, 255, .8) 8px 16px); }

/* ---------- 当番3体（台座と接地影と札） ---------- */
.hero-cast { position: relative; margin-top: -58px; padding-top: 28px; }
.duty-ribbon {
  position: absolute; left: -2%; top: 8px; z-index: 6; margin: 0;
  transform: rotate(-6deg);
}
.duty-ribbon span {
  display: inline-block; padding: 4px 18px; background: var(--ink); color: var(--paper-hi);
  font-weight: 900; font-size: var(--fs-small); letter-spacing: .1em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%);
}
.duty-list { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; align-items: flex-end; gap: clamp(4px, 1.4vw, 22px); }
.duty-list > li { position: relative; flex: 0 1 auto; min-width: 0; display: flex; }
.duty {
  position: relative; display: grid; justify-items: center;
  padding: 0; margin: 0; border: 0; background: none; cursor: pointer; color: inherit;
  border-radius: var(--r-m);
}
.duty .chara-stand { z-index: var(--z-chara); }
.duty img.chara { display: block; height: clamp(150px, 17vw, 238px); width: auto; max-width: 100%; position: relative; z-index: 2; }
.duty .frame-round { width: clamp(130px, 13vw, 190px); }
.duty .ground { position: relative; z-index: 1; width: 78%; height: 16px; margin-top: -10px; }
.duty .pedestal { position: relative; z-index: 0; width: 92%; margin-top: -18px; height: 26px; }
.duty-list > li:nth-child(1) .pedestal { background: var(--do); box-shadow: 0 5px 0 #b8321b, 0 5px 0 3px var(--ink); }
.duty-list > li:nth-child(2) .pedestal { background: var(--mi); box-shadow: 0 5px 0 #c9a91c, 0 5px 0 3px var(--ink); }
.duty-list > li:nth-child(3) .pedestal { background: var(--so); box-shadow: 0 5px 0 #1a8fbd, 0 5px 0 3px var(--ink); }
.duty-list > li:nth-child(2) { margin-bottom: 18px; }
.duty-name {
  position: relative; z-index: 3; margin-top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px 3px 6px; background: var(--paper-hi);
  border: 2px solid var(--ink); border-radius: var(--r-pill); box-shadow: 0 3px 0 var(--ink);
  font-weight: 900; font-size: var(--fs-small); line-height: 1.3; white-space: nowrap;
}
.duty-name i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); flex: none; }
.duty.is-hidden .chara-stand > img.chara, .duty.is-hidden .chara-stand > .frame-round { visibility: hidden; }
@media (hover: hover) and (pointer: fine) {
  .duty:hover .duty-name { background: var(--mi); }
}

/* ---------- 1-11 入園スタンプ（円環） ---------- */
.hero-stamp {
  position: absolute; z-index: 7; left: -4%; top: -6px;
  width: clamp(112px, 10vw, 148px); aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 50%; color: var(--ink); text-decoration: none;
  transform: rotate(-10deg);
}
.stamp-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: hero-spin 22s linear infinite; }
.stamp-ring .ring-bg { fill: var(--mi); stroke: var(--ink); stroke-width: 4; }
.stamp-ring text { font-family: var(--f-body); font-weight: 900; font-size: 17px; fill: var(--ink); letter-spacing: .02em; }
@keyframes hero-spin { to { transform: rotate(360deg); } }
.stamp-core {
  position: relative; display: grid; place-items: center; width: 50%; aspect-ratio: 1; border-radius: 50%;
  background: var(--do); color: var(--paper-hi); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  transition: transform .3s var(--ease-spring);
}
.stamp-core .qq { font-size: clamp(1.3rem, 2.2vw, 1.9rem); line-height: .8; margin-top: 4px; }
.stamp-core svg { margin-top: -4px; }
@media (hover: hover) and (pointer: fine) {
  .hero-stamp:hover .stamp-core { transform: translateY(3px) scale(1.06); }
  .hero-stamp:hover .stamp-ring { animation-duration: 6s; }
}

/* ---------- 2-39 スクロールのヒント ---------- */
.scroll-hint {
  position: absolute; left: 50%; bottom: var(--sp-5); z-index: 4; transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 16px 4px; color: var(--ink); text-decoration: none;
  font-weight: 900; font-size: var(--fs-small); letter-spacing: .12em;
  background: var(--paper-hi); border: 2px solid var(--ink); border-radius: var(--r-pill); box-shadow: 0 3px 0 var(--ink);
  transition: opacity .4s, transform .4s var(--ease-soft);
}
.scroll-hint.is-gone { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.chev { display: grid; justify-items: center; height: 22px; }
.chev i { display: block; width: 10px; height: 10px; margin-top: -4px; border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); opacity: .2; animation: hero-chev 1.2s steps(4) infinite; }
.chev i:nth-child(1) { border-color: var(--do); }
.chev i:nth-child(2) { border-color: var(--mi); animation-delay: .15s; }
.chev i:nth-child(3) { border-color: var(--so); animation-delay: .3s; }
@keyframes hero-chev { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---------- 6-36 漂う子・5-12 トレイル ---------- */
.floaters { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.floaters .fl { position: absolute; left: 0; top: 0; width: var(--s, 60px); pointer-events: auto; cursor: pointer; }
.floaters .fl > img.chara, .floaters .fl > .frame-round { display: block; width: 100% !important; height: auto; }
.floaters .fl > .frame-round, .orbit .sat > .frame-round { box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 5px var(--ink); border-width: 2px; }
.trail { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.trail img.chara--tile {
  position: absolute; left: 0; top: 0; width: 72px; height: 72px;
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink);
  opacity: 0; will-change: transform;
}

/* ---------- 4-38 組み上げの前（gate が開く瞬間に付く） ---------- */
.sec-hero.is-assembling .hero-layer { will-change: transform, opacity; }

/* ---------- タブレット・スマホ ---------- */
@media (max-width: 899px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: var(--sp-5); }
  .hero-visual-col { padding-top: 0; }
  .poster-window { margin: 0 auto; width: min(100%, 520px); transform: rotate(2deg); }
  .mp-hero-title.poptitle { font-size: min(var(--fs-hero), 11.4vw); }
  .hero-stamp { left: auto; right: -6px; top: -34px; width: 104px; }
}
@media (max-width: 599px) {
  .sec-hero { padding: calc(var(--header-h) + 60px) 16px 96px; min-height: 0; }
  .rotator { border-radius: var(--r-l); }
  .logo-wrap { padding: 8px 8px 6px 0; }
  .hero-logo.poptitle { font-size: clamp(1.7rem, 8.2vw, 2.2rem); }
  .mp-hero-title.poptitle { font-size: clamp(2.3rem, 11.4vw, 3rem); margin-bottom: var(--sp-4); }
  .mp-hero-sub { font-size: 1rem; padding: var(--sp-2) var(--sp-4); }
  .rotator { font-size: clamp(1rem, 4.5vw, 1.3rem); }
  .hero-cast { margin-top: -22px; }
  .duty img.chara { height: auto; max-height: 132px; width: auto; max-width: 27vw; }
  .duty .frame-round { width: 26vw; }
  .duty-list > li { max-width: 31vw; }
  .duty-list > li:nth-child(2) { margin-bottom: 10px; }
  .duty-name { font-size: .875rem; padding: 2px 8px 2px 4px; }
  .duty-name i { width: 11px; height: 11px; }
  .orbit { display: none; }
  .trail { display: none; }
  .hero-stamp { width: 86px; top: -40px; right: 2px; }
  .hero-stamp .stamp-ring text { font-size: 16px; }
  .tape { width: 70px; height: 22px; top: -11px; }
}

/* ---------- reduced / うごき オフ ---------- */
html[data-reduced] [data-depth], html[data-reduced] .poster-depth, html[data-reduced] .cast-depth, html[data-reduced] .floaters, html[data-reduced] .hero-bg { transform: none; }
html[data-reduced] .hero-bg .blob, html[data-reduced] .hero-logo .ch, html[data-reduced] .stamp-ring, html[data-reduced] .chev i { animation: none; }
html[data-reduced] .chev i { opacity: 1; }
html[data-reduced] .trail { display: none; }
@media (prefers-reduced-motion: reduce) {
  .hero-bg .blob, .hero-logo .ch, .stamp-ring, .chev i { animation: none; }
  .poster-depth, .cast-depth, .floaters, .hero-bg { transform: none; }
}
/* 3-1 verbatim のケンバーンズも「うごき」オフで止める（スニペットの外からの上書き） */
html[data-motion="off"] [data-mp="hero"] .mp-hero-visual.mp-on-3-1 { animation-play-state: paused; }
