/* Home: the film's story, act by act. Sticky stages are driven by C2SR.scene() in js/home.js. */

.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* 1 · opening */
.open { height: 250vh; }
.open .open-film { position: absolute; inset: 0; }
.open-dark { position: absolute; inset: 0; background: var(--k); opacity: var(--dark, .22); z-index: 1; }
.open .open-film::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(10,11,13,.55) 0%, rgba(10,11,13,0) 22%, rgba(10,11,13,0) 55%, rgba(10,11,13,.85) 100%); }
.open-top { position: absolute; top: calc(var(--hdr) + 22px); left: 0; right: 0; z-index: 3; }
.open-q { position: absolute; inset: 0; display: flex; align-items: center; z-index: 3; pointer-events: none; }
.open-q .q { font-size: clamp(64px, 15vw, 272px); letter-spacing: -.055em; line-height: .86; }
.open-q .w { display: inline-block; opacity: 0; transform: translateY(40px); will-change: transform, opacity; }
.open-low { position: absolute; left: 0; right: 0; bottom: clamp(28px, 6vh, 64px); z-index: 3; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.open-lead { max-width: 21em; font-size: clamp(20px, 1.9vw, 30px); font-weight: 300; line-height: 1.3; }
.open-act { display: flex; align-items: center; gap: 28px; flex: none; }
.scroll-cue { display: inline-flex; align-items: center; gap: 12px; }
.scroll-cue i { width: 1px; height: 40px; background: linear-gradient(var(--paper), transparent); display: block; transform-origin: top; animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* 2 · not on paper */
.paper { height: 260vh; }
.paper-film { position: absolute; inset: 0; }
.paper-film::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,11,13,.7) 0%, rgba(10,11,13,.1) 50%, rgba(10,11,13,0) 100%); }
.paper-words { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; z-index: 3; gap: 26px; }
.paper-words .h1 { display: grid; }
.pw { grid-area: 1 / 1; transition: opacity .6s var(--ease), transform .8s var(--ease-out), filter .6s var(--ease); }
.pw2 { opacity: 0; transform: translateY(30px); }
.paper.now .pw1 { opacity: 0; transform: translateY(-30px); }
.paper.now .pw2 { opacity: 1; transform: none; }

/* 3 · the four */
.four-list { list-style: none; margin: 0 0 clamp(120px, 18vh, 220px); padding: 0; border-top: 1px solid var(--line); }
.four-list li { display: grid; grid-template-columns: 80px 1fr minmax(220px, 34%); align-items: center; gap: var(--gut); padding: clamp(18px, 2.4vw, 34px) 0; border-bottom: 1px solid var(--line); }
.four-list .h1 { font-size: clamp(44px, 7.4vw, 132px); }
.four-img { margin: 0; aspect-ratio: 16 / 9; overflow: hidden; clip-path: inset(0 0 100% 0); transition: clip-path 1.2s var(--ease-out) .15s; background: #000; }
.four-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); transition: transform 1.8s var(--ease-out) .15s; }
.four-list li.in .four-img { clip-path: inset(0 0 0 0); }
.four-list li.in .four-img img { transform: none; }
.nation { max-width: 13em; }
.nation .ln { display: inline; }

/* 4 · one picture */
.picture { height: 380vh; }
.pic-words { position: absolute; top: 0; padding-top: calc(var(--hdr) + 5vh); padding-bottom: 9vh; left: 0; right: 0; z-index: 4; display: grid; gap: 18px; pointer-events: none; background: linear-gradient(180deg, rgba(10,11,13,.96) 0%, rgba(10,11,13,.9) 60%, rgba(10,11,13,0) 100%); }
.pic-words .h2 { grid-area: 2 / 1; max-width: 17em; transition: opacity .7s var(--ease), transform .9s var(--ease-out); }
.pic-b { opacity: 0; transform: translateY(24px); }
.picture.trust .pic-a { opacity: 0; transform: translateY(-20px); }
.picture.trust .pic-b { opacity: 1; transform: none; }
.pic-field { position: absolute; inset: 0; perspective: 1400px; display: flex; align-items: center; justify-content: center; }
.pic-frame { position: relative; width: min(76vw, 1240px); aspect-ratio: 16 / 9; margin-top: 9vh; transform-style: preserve-3d; will-change: transform; }
.tiles { position: absolute; inset: 0; transform-style: preserve-3d; }
.tile3 { position: absolute; width: 25%; height: 33.334%; transform-style: preserve-3d; will-change: transform, opacity; backface-visibility: hidden; }
.tile3 img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile3 .label { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--paper); text-shadow: 0 1px 8px rgba(0,0,0,.8); opacity: var(--lab, 1); }
.pic-room { position: absolute; inset: 0; opacity: 0; will-change: opacity; }

/* 5 · sources */
.sources { height: 230vh; }
.src-film { position: absolute; inset: 0; }
.src-words { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; gap: 40px; }
.src-list { list-style: none; margin: 0; padding: 0; font-size: clamp(42px, 6.2vw, 112px); }
.src-list li { color: rgba(245,245,243,.22); transition: color .5s var(--ease); }
.src-list li.on { color: var(--paper); }
.src-lead { max-width: 22em; opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease), transform .9s var(--ease-out); }
.sources.done .src-lead { opacity: 1; transform: none; }

/* 6 · ninety days */
.ninety .grid { align-items: center; row-gap: 48px; }
.n-film { grid-column: 1 / span 7; }
.n-film .media { aspect-ratio: 16 / 9; }
.n-text { grid-column: 8 / span 5; }
.ruler { position: relative; height: 120px; margin-top: clamp(72px, 10vh, 120px); }
.ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; display: flex; justify-content: space-between; align-items: flex-end; }
.ticks i { width: 1px; height: 10px; background: var(--line-2); }
.ticks i:nth-child(10n+1) { height: 26px; background: var(--steel); }
.ruler-fill { position: absolute; left: 0; bottom: 0; height: 26px; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, rgba(155,97,49,0), rgba(155,97,49,.32)); border-right: 1px solid var(--marron); }
.ruler-head { position: absolute; bottom: 40px; left: calc(var(--p, 0) * 100%); transform: translateX(-100%); display: flex; align-items: baseline; gap: 12px; padding-right: 2px; white-space: nowrap; }
.ruler-num { font-size: clamp(54px, 7vw, 120px); font-weight: 300; letter-spacing: -.04em; line-height: .9; color: var(--paper); }
.ruler-legend { display: flex; justify-content: space-between; gap: 16px; margin-top: 16px; }

/* 7 · decide */
.d-head { margin-bottom: clamp(48px, 7vh, 96px); }
.d-title span { display: block; }
.d-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 80px); align-items: start; }
.d-film { aspect-ratio: 16 / 9; border: 1px solid var(--line-2); }
.d-film video { position: absolute; inset: 0; transition: opacity .5s var(--ease); }
.d-go { opacity: 0; }
.decide.approved .d-go { opacity: 1; }
.decide.approved .d-prep { opacity: 0; }
.d-cap { margin-top: 14px; display: grid; }
.d-cap span { grid-area: 1 / 1; transition: opacity .4s; }
.d-cap-b, .decide.approved .d-cap-a { opacity: 0; }
.decide.approved .d-cap-b { opacity: 1; color: var(--marron-hi); }
.d-act { display: grid; gap: 28px; justify-items: start; }
.hold { position: relative; width: 168px; height: 168px; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; margin-top: 8px; }
.hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.hold-bg { fill: none; stroke: var(--line-2); stroke-width: 1.2; }
.hold-ring { fill: none; stroke: var(--marron); stroke-width: 3; stroke-dasharray: 351.86; stroke-dashoffset: calc(351.86 * (1 - var(--hp, 0))); }
.hold-in { position: absolute; inset: 12px; border-radius: 50%; display: grid; place-items: center; background: var(--graphite); border: 1px solid var(--line-2); transition: background .4s var(--ease), transform .3s var(--ease); }
.hold:active .hold-in, .hold.pressing .hold-in { transform: scale(.96); }
.hold-in > span { grid-area: 1 / 1; display: grid; justify-items: center; gap: 4px; font-family: var(--mono); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; transition: opacity .3s; }
.hold-in small { font-size: 11px; letter-spacing: .14em; color: var(--mist); }
.hold-bg { stroke: rgba(155,97,49,.35) !important; stroke-width: 3 !important; }
.hold:hover .hold-in { border-color: var(--marron); }
.hold-t2 { opacity: 0; }
.decide.approved .hold-in { background: var(--marron); }
.decide.approved .hold-t1 { opacity: 0; }
.decide.approved .hold-t2 { opacity: 1; }
#hold-help { display: grid; }
#hold-help span { grid-area: 1 / 1; transition: opacity .3s; }
.hold-help-b, .decide.approved .hold-help-a { opacity: 0; }
.decide.approved .hold-help-b { opacity: 1; }
.d-rule { border-top: 1px solid var(--line); padding-top: 24px; width: 100%; color: var(--mist); transition: color .5s; }
.decide.approved .d-rule { color: var(--paper); }
.d-reset { opacity: 0; pointer-events: none; transition: opacity .4s; text-decoration: underline; text-underline-offset: 4px; }
.decide.approved .d-reset { opacity: 1; pointer-events: auto; }

/* 8 · reveal */
.reveal { height: 520vh; background: #000; }
.reveal .stage { background: #000; }
.rv-steps { position: absolute; top: calc(var(--hdr) + 20px); left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; align-items: baseline; gap: 20px; transition: opacity .5s; }
.rv-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; }
.rv-list li { color: var(--steel-t); transition: color .35s; position: relative; padding-left: 14px; }
.rv-list li::before { content: ''; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; margin-top: -3px; border: 1px solid currentColor; }
.rv-list li.on { color: var(--paper); }
.rv-list li.on::before { background: var(--marron); border-color: var(--marron); }
.rv-screen-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(var(--hdr) + 64px) var(--m) 72px; }
.rv-screen { width: min(100%, calc((100vh - var(--hdr) - 150px) * 1600 / 908)); will-change: transform, opacity; }
.rv-name { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: center; gap: 18px; opacity: 0; pointer-events: none; }
.rv-name .display { font-size: clamp(56px, 10.5vw, 196px); display: flex; flex-wrap: wrap; align-items: baseline; gap: .22em .3em; }
.rv-mark svg { height: .74em; width: auto; color: var(--paper); transform: translateY(.02em); }
.rv-bar { position: absolute; left: var(--m); right: var(--m); bottom: 32px; height: 1px; background: var(--line); }
.rv-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); background: var(--marron); }

/* 9 · what */
.w-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-bottom: clamp(32px, 5vh, 56px); }
.w-tab { position: relative; text-align: left; padding: 20px 20px 22px 0; display: flex; gap: 16px; align-items: baseline; color: var(--steel-t); transition: color .3s; }
.w-tab .w-tl { font-size: clamp(16px, 1.3vw, 20px); }
.w-tab[aria-selected="true"] { color: var(--paper); }
.w-tab i { position: absolute; left: 0; top: -1px; height: 1px; width: 0; background: var(--marron); }
.w-tab[aria-selected="true"] i { width: calc(var(--t, 0) * 100%); }
.w-tab:hover { color: var(--paper); }
.w-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 72px); align-items: end; }
.w-film { aspect-ratio: 16 / 9; }
.w-film video { position: absolute; inset: 0; opacity: 0; transition: opacity .6s var(--ease); }
.w-film video.on { opacity: 1; }
.w-texts { display: grid; }
.w-text { grid-area: 1 / 1; display: grid; gap: 20px; align-content: end; opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease), transform .7s var(--ease-out); pointer-events: none; }
.w-text.on { opacity: 1; transform: none; pointer-events: auto; }
.w-text a { color: var(--paper); border-bottom: 1px solid var(--marron); padding-bottom: 2px; }

/* 10 · system */
.system { padding: clamp(80px, 10vh, 140px) 0; border-top: 1px solid var(--line); }
.sys-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(24px, 4vw, 80px); align-items: center; }
.sys-text { display: grid; gap: 28px; justify-items: start; }
.sys-3d { position: relative; aspect-ratio: 4 / 3; }
.sys-3d canvas { width: 100%; height: 100%; -webkit-mask-image: radial-gradient(ellipse 62% 62% at 50% 50%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 62% 62% at 50% 50%, #000 62%, transparent 100%); }

/* 11 · ending */
.end { min-height: 100vh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: clamp(40px, 6vh, 72px); overflow: hidden; }
.end-film { position: absolute; inset: 0; }
.end-film::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,11,13,.35), rgba(10,11,13,.1) 40%, rgba(10,11,13,.92)); }
.end-words { position: relative; z-index: 2; margin-bottom: clamp(40px, 7vh, 88px); }
.end-tiles { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }
.tile { position: relative; display: grid; gap: 10px; padding: clamp(24px, 3vw, 44px); min-height: 180px; align-content: end; background: rgba(28,31,34,.88); border: 1px solid var(--line-2); transition: background .35s var(--ease), color .35s; }
.tile .arr { position: absolute; top: clamp(24px, 3vw, 44px); right: clamp(24px, 3vw, 44px); width: 22px; height: 16px; transition: transform .4s var(--ease); }
.tile:hover .arr { transform: translateX(6px); }
.tile.solid { background: var(--paper); color: var(--k); border-color: var(--paper); }
.tile.solid .label { color: #4b5056; }
.tile.solid:hover { background: var(--marron); color: var(--paper); border-color: var(--marron); }
.tile.solid:hover .label { color: var(--tint); }
.tile:not(.solid):hover { background: var(--graphite); }

/* ---------- phones and tablets */
@media (max-width: 900px) {
  .br-d { display: none; }
  .open { height: 210vh; }
  .open-low { flex-direction: column; align-items: flex-start; }
  .open-act .scroll-cue { display: none; }
  .four-list li { grid-template-columns: 40px 1fr; row-gap: 14px; }
  .four-list .four-img { grid-column: 1 / -1; }
  .picture { height: 320vh; }
  .pic-frame { width: 92vw; margin-top: 16vh; }
  .n-film, .n-text { grid-column: 1 / -1; }
  .ruler-legend span:nth-child(2) { display: none; }
  .d-grid, .w-body, .sys-grid { grid-template-columns: 1fr; }
  .hold { width: 150px; height: 150px; }
  .rv-steps { flex-direction: column; gap: 14px; }
  .rv-list { flex-wrap: wrap; gap: 8px 18px; }
  .rv-screen-wrap { padding: calc(var(--hdr) + 120px) 16px 72px; }
  .rv-screen { width: 100%; }
  .w-tabs { grid-template-columns: 1fr; }
  .w-tab { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .w-tab i { top: auto; bottom: -1px; }
  .end-tiles { grid-template-columns: 1fr; }
  .sys-3d { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .open, .paper, .picture, .sources, .reveal { height: auto; }
  .stage { position: relative; height: 100vh; }
  .open-q .w { opacity: 1; transform: none; }
  .scroll-cue i { animation: none; }
}
