/* =========================================================
   ITSUKI — "One small light" cinematic hero
   ========================================================= */
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-italic.woff2") format("woff2"); font-style: italic; font-display: swap; }

/* the story uses native scroll (position: sticky), so the page wrapper must not clip */
body.has-story .mil-page-wrapper { height: auto; overflow: visible; overflow-x: clip; }
html:has(body.has-story) { overflow-x: clip; }
body.has-story #smooth-content { overflow-x: clip; }
body.has-story #globalBgCanvas { display: none; }

#story { position: relative; height: 860vh; background: #000; z-index: 1; }
#story .st-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
#story canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#story .st-poster { position: absolute; inset: 0; background: #000 center / cover no-repeat; opacity: 0; transition: opacity .8s ease; }
#story .st-vig { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.6) 20%, rgba(0,0,0,.22) 36%, transparent 50%), radial-gradient(ellipse 80% 75% at 50% 45%, transparent 50%, rgba(0,0,0,.8) 100%); }
#story .st-grain { position: absolute; inset: -50%; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); animation: st-grain 1s steps(6) infinite; }
@keyframes st-grain { 0% { transform: translate(0,0) } 25% { transform: translate(-3%,2%) } 50% { transform: translate(2%,-3%) } 75% { transform: translate(-2%,-1%) } 100% { transform: translate(0,0) } }
#story .lb { position: absolute; left: 0; right: 0; height: 50vh; background: #000; z-index: 8; transition: height 2.6s cubic-bezier(.7,0,.2,1) .3s; }
#story .lb.t { top: 0; } #story .lb.b { bottom: 0; }
#story.is-live .lb { height: 7vh; }

#story .st-scene { position: absolute; z-index: 6; left: 0; right: 0; bottom: 15vh; text-align: center; padding: 0 24px; pointer-events: none; }
#story .st-scene .ln { display: block; opacity: 0; filter: blur(12px); transform: translateY(18px); transition: opacity 1.1s ease, filter 1.1s ease, transform 1.1s ease; }
#story .st-scene.on { pointer-events: auto; }
#story .st-scene.on .ln { opacity: 1; filter: blur(0); transform: none; }
#story .st-scene.on .ln:nth-child(2) { transition-delay: .35s; }
#story .st-scene.on .ln:nth-child(3) { transition-delay: .8s; }
#story .st-scene.on .ln:nth-child(4) { transition-delay: 1.2s; }
#story .st-meta { font-size: 12px; font-weight: 600; letter-spacing: 4px; text-transform: uppercase; color: #f5821f; margin-bottom: 22px; }
#story .st-say { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; font-size: clamp(34px, 4.4vw, 66px); line-height: 1.08; letter-spacing: -.01em; color: #f1ede6; text-shadow: 0 2px 30px rgba(0,0,0,.85); }
#story .st-say b { font-weight: 400; color: #f5821f; }
#story .st-small { font-size: 16px; line-height: 1.7; color: rgba(241,237,230,.6); max-width: 620px; margin: 20px auto 0; }
#story .st-brand { font-family: "Anton", sans-serif; text-transform: uppercase; font-size: clamp(14px, 1.2vw, 16px); letter-spacing: 6px; color: rgba(241,237,230,.6); margin-bottom: 14px; }
#story .st-final { bottom: 10vh; }
#story .st-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
#story h1.st-say { margin: 0; }

#story .st-hud { position: absolute; z-index: 9; left: 44px; right: 44px; bottom: calc(3.5vh - 8px); display: flex; align-items: center; gap: 22px; font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; color: rgba(241,237,230,.6); }
#story .st-count b { color: #f1ede6; font-weight: 600; }
#story .st-progress { flex: 1; height: 1px; background: rgba(241,237,230,.16); position: relative; overflow: hidden; }
#story .st-progress i { position: absolute; inset: 0; background: #f5821f; transform-origin: left; transform: scaleX(0); }
#story .st-skip { color: #f1ede6; text-decoration: none; }
#story .st-hint { display: flex; align-items: center; gap: 10px; }
#story .st-hint span { width: 20px; height: 32px; border: 1px solid rgba(241,237,230,.4); border-radius: 12px; position: relative; }
#story .st-hint span:after { content: ""; position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; border-radius: 2px; background: #f5821f; transform: translateX(-50%); animation: st-wheel 1.6s ease-in-out infinite; }
@keyframes st-wheel { 0% { opacity: 0; transform: translate(-50%,0) } 30% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%,12px) } }

/* no WebGL: a single still frame with the closing line */
#story.st-static { height: 100vh; height: 100svh; }
#story.st-static .st-poster { opacity: 1; }
#story.st-static .lb, #story.st-static .st-hud, #story.st-static .st-scene:not(.st-final) { display: none; }
#story.st-static .st-final .ln { opacity: 1; filter: none; transform: none; }
#story.st-static .st-final { pointer-events: auto; }

@media (max-width: 900px) {
  #story .st-scene { bottom: 13vh; }
  #story .st-say { font-size: clamp(30px, 8.6vw, 40px); }
  #story .st-small { font-size: 15px; }
  #story .st-hud { left: 20px; right: 20px; }
  #story .st-hint { display: none; }
  #story .st-final { bottom: 8vh; }
  #story .st-final .st-brand { font-size: 10px; letter-spacing: 2px; }
  #story .st-dsk { display: none; }
  #story .st-cta { flex-direction: column; align-items: stretch; max-width: 320px; margin: 24px auto 0; }
  #story { height: 760vh; }
}
@media (prefers-reduced-motion: reduce) {
  #story .st-grain { animation: none; }
  #story .st-scene .ln { filter: none; transition-duration: .01s; }
}

/* sticky needs every ancestor un-clipped and un-filtered */
body.has-story .mil-transition-fade { overflow: visible; }
body.has-story .mil-transition-frame { filter: none !important; }
body.has-story .mil-transition-fade, body.has-story .mil-transition-frame, body.has-story #smooth-content { transform: none !important; }
body.has-story { overflow-x: clip; }
/* the site's h1 styling must not touch the story's opening line */
#story h1.st-say { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; text-transform: none; letter-spacing: -.01em; font-size: clamp(34px, 4.4vw, 66px); line-height: 1.08; color: #f1ede6; }
@media (max-width: 900px) { #story h1.st-say { font-size: clamp(30px, 8.6vw, 40px); } }

/* sound toggle (opt-in narration + score) */
#story .st-sound { display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 16px 0 13px; border-radius: 40px; border: 1px solid rgba(241,237,230,.22); background: rgba(10,10,10,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #f1ede6; font: inherit; font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; cursor: pointer; transition: border-color .4s, background .4s, box-shadow .4s; }
#story .st-sound:hover { border-color: rgba(245,130,31,.7); }
#story .st-sound:focus-visible { outline: 2px solid #f5821f; outline-offset: 3px; }
#story .st-sound.is-invite { border-color: rgba(245,130,31,.55); animation: st-invite 2.8s ease-in-out 3; }
@keyframes st-invite { 0%,100% { box-shadow: 0 0 0 0 rgba(245,130,31,0) } 50% { box-shadow: 0 0 22px 2px rgba(245,130,31,.28) } }
#story .st-sound .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
#story .st-sound .eq i { width: 2px; height: 3px; border-radius: 1px; background: #f5821f; transition: height .4s; }
#story .st-sound.is-on .eq i { animation: st-eq 1.1s ease-in-out infinite; }
#story .st-sound.is-on .eq i:nth-child(2) { animation-delay: -.35s; }
#story .st-sound.is-on .eq i:nth-child(3) { animation-delay: -.7s; }
#story .st-sound.is-on .eq i:nth-child(4) { animation-delay: -.2s; }
#story .st-sound.is-loading .eq i { animation: st-eq 1.4s ease-in-out infinite; opacity: .5; }
@keyframes st-eq { 0%,100% { height: 3px } 50% { height: 12px } }
@media (max-width: 900px) { #story .st-sound { height: 32px; padding: 0 13px 0 11px; font-size: 10px; letter-spacing: 1.8px; } }
@media (prefers-reduced-motion: reduce) { #story .st-sound .eq i, #story .st-sound.is-invite { animation: none !important; } }

/* ---------- mobile: smoother hero, scene-by-scene swiping ---------- */
#story.st-lost .st-poster { opacity: 1; }
#story.st-lost canvas { visibility: hidden; }
@media (max-width: 900px) {
  #story { height: 600vh; }
  /* lighter effects: no blur filters or animated grain on top of the 3D canvas */
  #story .st-scene .ln { filter: none; transform: translateY(12px); transition: opacity .8s ease, transform .8s ease; }
  #story .st-scene.on .ln { transform: none; }
  #story .st-grain { animation: none; opacity: .045; inset: 0; }
  #story .st-sound { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10,10,10,.82); }
  /* HUD: the progress line runs full width above a tidy row */
  #story .st-hud { bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); gap: 12px; justify-content: space-between; }
  #story .st-progress { position: absolute; left: 0; right: 0; top: -14px; flex: none; }
  #story .st-count { min-width: 52px; }
  #story .st-skip { min-width: 52px; text-align: right; padding: 8px 0; }
  #story .lb { will-change: height; }
}
@media (max-width: 900px) {
  #story .st-sound, #story .st-count, #story .st-skip { white-space: nowrap; }
  #story .st-meta { font-size: 11px; letter-spacing: 2.6px; margin-bottom: 16px; }
  /* finale: buttons side by side, clear of the bottom bar */
  #story .st-final { bottom: calc(env(safe-area-inset-bottom, 0px) + 74px); }
  #story .st-cta { flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: center; max-width: none; gap: 10px; margin: 22px auto 0; }
  #story .st-cta .its-btn { height: 46px; padding: 0 18px; font-size: 13px; white-space: nowrap; }
}
@media (max-width: 380px) {
  #story .st-hud { gap: 8px; left: 16px; right: 16px; }
  #story .st-count { min-width: 0; letter-spacing: 1px; }
  #story .st-skip { min-width: 0; letter-spacing: 1.5px; }
  #story .st-sound { padding: 0 11px 0 9px; gap: 7px; font-size: 9.5px; letter-spacing: 1.2px; }
  #story .st-cta .its-btn { padding: 0 14px; font-size: 12px; }
  #story .st-say, #story h1.st-say { font-size: clamp(27px, 8.4vw, 34px); }
}
/* when the site pre-roll runs, its curtain does the opening: the hero's bars start already open */
html.its-pre-on #story .lb, #story.is-live.pre-handoff .lb { transition: none; height: 7vh; }
/* if the 3D is still on its way, show the still frame instead of a black box */
#story:not(.is-ready) .st-poster { opacity: 1; }
