/* =========================================================
   TOOLHOOD · home.css (SITE). Scroll story: fixed WebGL stage, 6 chapters over it, chapter rail, CA block.
   ========================================================= */
.page-home { background: var(--bg); }

/* ---------- stage: WORLD canvas + fallback + vignette ---------- */
.stage { position: fixed; inset: 0 0 auto; height: 100vh; height: 100lvh; z-index: 0; overflow: hidden; background: radial-gradient(120% 90% at 55% 42%, #10140B 0%, var(--bg) 62%); }
.world { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; outline: none; }
.world-fb { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s var(--ease); background-size: cover; background-position: center;
  background-image:
    radial-gradient(circle at 54% 44%, rgba(220, 255, 120, .95) 0, rgba(61, 255, 154, .55) 1.6%, rgba(125, 255, 58, .16) 7%, transparent 20%),
    linear-gradient(90deg, transparent 22%, rgba(61, 255, 154, .38) 50%, transparent 78%),
    radial-gradient(60% 18% at 54% 60%, rgba(125, 255, 58, .10), transparent 70%);
  background-repeat: no-repeat; background-size: 100% 100%, 100% 2px, 100% 100%; background-position: 0 0, 0 44%, 0 0; }
.world-fb.is-on { opacity: 1; }
.world-fb.has-img { background-size: cover; background-repeat: no-repeat; background-position: center; }
.vign { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 55% 45%, transparent 52%, rgba(5, 6, 4, .78) 100%),
    radial-gradient(34% 30% at 14% 84%, rgba(5, 10, 8, .62), rgba(5, 10, 8, 0) 100%),
    radial-gradient(30% 32% at 15% 50%, rgba(5, 10, 8, .5), rgba(5, 10, 8, 0) 100%),
    linear-gradient(90deg, rgba(5, 10, 8, .5) 0%, rgba(5, 10, 8, 0) 38%); }
.ch__sub { text-shadow: 0 0 12px rgba(5, 10, 8, .95), 0 0 2px rgba(5, 10, 8, .9); }
.vign::after { content: ''; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- client labels from world.labels (ch02) ---------- */
.wlabels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.wl { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; opacity: 0; transition: opacity .5s;
  font-family: var(--wide); font-stretch: var(--wide-stretch); font-size: 10px; font-weight: 300; letter-spacing: .16em; text-transform: uppercase; color: var(--pale); will-change: transform; }
.wl i { width: 14px; height: 1px; background: var(--neon); box-shadow: 0 0 8px rgba(61, 255, 154, .7); }
.wl.on { opacity: 1; }

/* ---------- story: 6 slots of one viewport; with JS the chapters sit fixed over the stage ---------- */
/* 7 viewports: 6 of scroll for 6 chapters (ch05 lands where the reference's does: 5400 px at 900 tall) */
.story { position: relative; z-index: 3; height: 700vh; height: 700svh; }
.ch { position: relative; height: 100vh; height: 100svh; }
html.js .page-home .ch { position: fixed; inset: 0; height: auto; visibility: hidden; pointer-events: none; }
html.js .page-home .ch.is-on { visibility: visible; }
.ch__in { position: absolute; left: var(--gut); width: min(395px, calc(100vw - 2 * var(--gut))); pointer-events: auto; }
.ch.is-out .ch__in { -webkit-mask-image: radial-gradient(circle, #000 var(--dot, 6px), transparent calc(var(--dot, 6px) + .6px)); mask-image: radial-gradient(circle, #000 var(--dot, 6px), transparent calc(var(--dot, 6px) + .6px));
  -webkit-mask-size: 5px 5px; mask-size: 5px 5px; }
.ch__t .l { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.ch__t .l > span { display: block; will-change: transform; }

/* chapter 00: hero bottom-left (headline, caps line, buttons, CA) */
.ch--0 .ch__in { bottom: max(62px, 7.2vh); width: min(470px, calc(100vw - 2 * var(--gut))); }
.ch--0 .ch__t { font-size: clamp(30px, 3.1vw, 58px); line-height: 1.08; letter-spacing: -.035em; text-shadow: 0 2px 30px rgba(5, 10, 8, .6); }
.ch__sub { margin-top: 16px; }
.ch--0 .ch__btns { margin-top: 28px; }
.ch--0 .ca { margin-top: 24px; }

/* chapters 01–04: left column, vertically centred */
.ch--side .ch__in, .ch--5 .ch__in { top: 50%; translate: 0 -50%; }
.ch--side .ch__t, .ch--5 .ch__t { font-size: clamp(22px, 2.2vw, 40px); line-height: 1.08; letter-spacing: -.035em; text-shadow: 0 2px 26px rgba(5, 10, 8, .7); }
.ch__lbl { margin-top: 16px; }
.ch__body { margin-top: 22px; color: #9DB4A6; font-size: 15px; line-height: 24px; text-shadow: 0 1px 16px rgba(5, 10, 8, .9); }

/* chapter 05: live status box (same frame as the CA box), headline, label, body, buttons */
.ch--5 .ch__in { width: min(459px, calc(100vw - 2 * var(--gut))); }
.ch--5 .ch__t { margin-top: 22px; }
.ch--5 .ch__btns { margin-top: 26px; }

/* ---------- CA block (hero only) + live box share one frame ---------- */
.ca__l { font-family: var(--wide); font-stretch: var(--wide-stretch); font-size: 10px; font-weight: 300; letter-spacing: .26em; text-transform: uppercase; color: #C6D6B8; margin-bottom: 7px; }
.ca__b, .live__b {
  display: flex; align-items: center; gap: 12px; min-height: 41px; width: 100%; max-width: 459px; padding: 10px 12px;
  border: 1px solid var(--line-s2); background: rgba(5, 10, 8, .62); transition: border-color .3s, background-color .3s;
}
.ca__b:hover, .live__b:hover { border-color: rgba(61, 255, 154, .38); }
.ca__addr { flex: 1 1 auto; min-width: 0; font: 400 13px/18px var(--mono); color: var(--pale); white-space: nowrap; letter-spacing: 0; user-select: all; }
.ca__soon { flex: 1 1 auto; font: 400 13px/18px var(--mono); color: var(--muted); letter-spacing: .02em; }
.ca__soon::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 10px; vertical-align: 1px; background: var(--neon); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.ca__copy { flex: none; margin-left: auto; }
.ca.has-ca .ca__b { border-color: rgba(61, 255, 154, .32); }
.live__b code { flex: 1 1 auto; min-width: 0; font: 400 12.5px/18px var(--mono); color: var(--pale); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live__b code em { font-style: normal; color: var(--neon); }
.live__b code i { font-style: normal; color: var(--dim); }
.live__b .chip { margin-left: auto; flex: none; }
.live__b .chip svg { width: 9px; height: 9px; }
.live .pill { margin-left: 8px; }

/* ---------- chapter rail ---------- */
.rail { position: fixed; z-index: 4; right: var(--gut); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; margin-top: -4px; }
.rail__n { font: 500 13px/17px var(--mono); letter-spacing: .08em; color: var(--pale); margin-bottom: 24px; white-space: nowrap; }
.rail__n span { margin-left: 6px; font-size: 11px; font-weight: 300; color: #839476; }
.rail ol { display: grid; gap: 14px; }
.rail button { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 2px 0; font: 300 10px/13px var(--mono); color: #6E7D61; letter-spacing: .04em; transition: color .3s; }
.rail button i { width: 9px; height: 1px; background: currentColor; transition: width .5s var(--ease), background-color .3s; }
.rail button:hover { color: var(--pale); }
.rail button.on { color: var(--pale); }
.rail button.on i { width: 22px; background: var(--neon); box-shadow: 0 0 6px rgba(61, 255, 154, .6); }
.rail__bar { position: absolute; right: -13px; top: 40px; bottom: 0; width: 1px; background: rgba(61, 255, 154, .12); }
.rail__bar i { position: absolute; left: 0; top: 0; width: 1px; height: 100%; background: var(--neon); transform-origin: top; transform: scaleY(0); box-shadow: 0 0 6px rgba(61, 255, 154, .5); }

/* ---------- SCROLL TO ENTER cue ---------- */
.cue { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 8px 13px; pointer-events: auto;
  font-family: var(--wide); font-stretch: var(--wide-stretch); font-size: 9px; font-weight: 300; letter-spacing: .3em; text-transform: uppercase; color: var(--pale); }
.cue span { display: block; margin-right: -.3em; }
.cue::before { animation: cue-a 2.4s var(--ease) infinite; }
.cue::after { animation: cue-b 2.4s var(--ease) infinite; }
@keyframes cue-a { 0%, 100% { transform: none; } 50% { transform: translate(-3px, -3px); } }
@keyframes cue-b { 0%, 100% { transform: none; } 50% { transform: translate(3px, 3px); } }
.cue i { position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; margin-top: 6px; background: linear-gradient(var(--neon), transparent); animation: cue-l 2.4s var(--ease) infinite; }
@keyframes cue-l { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* footer over the stage */
.page-home .foot { z-index: 5; }

/* ---------- responsive ---------- */
@media (max-width: 1099px) { .cue { display: none; } }
@media (max-width: 899px) { .rail { display: none; } }
@media (max-height: 700px) and (min-width: 760px) {
  .ch--0 .ch__in { bottom: 40px; }
  .ch--0 .ch__btns { margin-top: 22px; }
  .ch--0 .ca { margin-top: 18px; }
  .cue { display: none; }
}
@media (max-width: 759px) {
  .vign { background: linear-gradient(to top, rgba(5, 10, 8, .94) 0%, rgba(5, 10, 8, .72) 38%, rgba(5, 10, 8, 0) 62%), radial-gradient(140% 90% at 50% 30%, transparent 50%, rgba(5, 6, 4, .7) 100%); }
  .ch__in, .ch--0 .ch__in, .ch--5 .ch__in { left: var(--gut); right: var(--gut); width: auto; top: auto; bottom: max(30px, 4.5svh); translate: none; }
  .ch--side .ch__in, .ch--5 .ch__in { top: auto; translate: none; }
  .wlabels { display: none; }
  .ch--0 .ch__t { font-size: 30px; }
  .ch--side .ch__t, .ch--5 .ch__t { font-size: 24px; }
  .ch__sub { margin-top: 12px; }
  .ch--0 .ch__btns { margin-top: 20px; gap: 10px; }
  .ch--0 .ca { margin-top: 18px; }
  .ch__body { margin-top: 16px; font-size: 14px; line-height: 22px; }
  .ch--5 .ch__btns { margin-top: 18px; gap: 10px; }
  .ch .btn { padding: 15px 18px; }
  .ch .btn--ghost { padding: 14px 17px; }
}
@media (max-width: 420px) {
  .ca__b { min-height: 58px; align-items: center; }
  .ca__addr { white-space: normal; word-break: break-all; max-width: 22ch; font-size: 12.5px; line-height: 18px; }
  .ca__copy span { display: none; }
  .ca__copy svg { width: 16px; height: 16px; }
  .live__b code { font-size: 11.5px; white-space: normal; line-height: 17px; }
}
@media (max-width: 759px) and (max-height: 760px) {
  .ch--0 .ch__t { font-size: 27px; }
  .ch--0 .ch__btns { margin-top: 16px; }
  .ch--0 .ca { margin-top: 14px; }
  .ch .btn { padding: 13px 16px; }
  .ch .btn--ghost { padding: 12px 15px; }
}
@media (prefers-reduced-motion: reduce) { .ca__soon::before { animation: none; } }

/* first paint: hero text waits for home.js (which animates it in); if the script never runs it still shows after 2.5 s */
html.rv-on .page-home .ch--0:not(.is-in) .ch__in { opacity: 0; animation: th-late 0s 2.5s forwards; }
@keyframes th-late { to { opacity: 1; } }
