/* ==========================================================================
   everybox.io — landing page
   ========================================================================== */

/* ---------- Story (pinned WebGL) ---------- */
.story { position: relative; height: 608vh; --col: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))); }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; isolation: isolate; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: 0; transition: opacity 1.6s var(--ease); }
#scene.ready { opacity: calc(1 - var(--film, 0)); transition: opacity .25s linear; }
/* Pre-rendered film of the story (film.js) on top of the live scene; --film fades between the two. */
#film { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: var(--film, 0); pointer-events: none; }
.stage::before { /* shown until (or without) WebGL */
  content: ""; position: absolute; inset: 0; z-index: -3;
  background:
    radial-gradient(40% 50% at 70% 40%, rgba(var(--lime-rgb), .12), transparent 70%),
    radial-gradient(40% 50% at 78% 70%, rgba(var(--violet-rgb), .12), transparent 70%);
}
/* Light effects over the film (magic.js): motes, the cursor's light, bursts as each shape lands. */
#magic { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.stage-vignette { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    /* Darkest under the text column wherever it sits, so on wide screens the film never shows
       through the headline. */
    linear-gradient(90deg, rgba(var(--bg-rgb), .94) 0, rgba(var(--bg-rgb), .86) calc(var(--col) + 380px), rgba(var(--bg-rgb), .35) calc(var(--col) + 600px), transparent calc(var(--col) + 760px)),
    linear-gradient(0deg, var(--bg) 0%, transparent 22%);
}

.cap { position: absolute; left: var(--col); z-index: 2; pointer-events: none; }
.cap.show { pointer-events: auto; }
.cap-hero { bottom: max(9vh, 64px); max-width: min(820px, 62vw); transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s; }
.cap-hero.away { opacity: 0; transform: translateY(-40px); filter: blur(8px); pointer-events: none; }
/* Wide screens: centre the headline vertically, level with the film beside it. */
@media (min-width: 900px) and (min-aspect-ratio: 105/100) {
  .cap-hero { bottom: auto; top: 50%; transform: translateY(-46%); }
  .cap-hero.away { transform: translateY(calc(-46% - 40px)); }
}
.cap-hero .pill { opacity: 0; transform: translateY(12px); transition: opacity 1s .2s var(--ease), transform 1s .2s var(--ease); }
.display { font-size: clamp(64px, 10vw, 150px); line-height: .88; letter-spacing: -0.065em; font-weight: 500; margin: 26px 0 30px; }
.display .ln { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.display .ln > span { display: block; transform: translateY(105%); transition: transform 1.4s var(--ease); }
.display .ln:nth-child(2) > span { transition-delay: .12s; }
.hero-sub { font-size: clamp(16px, 1.35vw, 19px); color: var(--muted); max-width: 520px; opacity: 0; transform: translateY(14px); transition: opacity 1.2s .45s var(--ease), transform 1.2s .45s var(--ease); }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.cap-hero .ctas { opacity: 0; transform: translateY(14px); transition: opacity 1.2s .6s var(--ease), transform 1.2s .6s var(--ease); }
.ctas.center { justify-content: center; }
.is-loaded .cap-hero .pill, .is-loaded .hero-sub, .is-loaded .cap-hero .ctas { opacity: 1; transform: none; }
.is-loaded .display .ln > span { transform: none; }

.cap-phase { top: 50%; max-width: 500px; transform: translateY(-50%); }
.cap-phase:not(.show) { pointer-events: none; }
/* One caption at a time: the outgoing one leaves fast (default rules), the next one waits for it
   and then comes in slowly (.show rules). */
.cap-phase .phase-big {
  display: block; margin: 0 0 14px -0.04em; pointer-events: none;
  font: 600 clamp(84px, 9vw, 150px)/.8 var(--font); letter-spacing: -0.07em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(var(--fg-rgb), .14);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .22), transparent 75%); -webkit-background-clip: text; background-clip: text;
  opacity: 0; transform: translateY(-30px); transition: opacity .3s ease-in, transform .35s ease-in;
}
.cap-phase.show .phase-big { opacity: 1; transform: none; transition: opacity 1s var(--ease) .3s, transform 1.4s var(--ease) .3s; }
.phase-n { font: 500 13px/1 var(--mono); color: var(--accent); letter-spacing: .08em; margin-bottom: 20px; opacity: 0; transform: translateX(-24px); transition: opacity .25s ease-in, transform .3s ease-in; }
.phase-n span { color: var(--dim); }
.cap-phase.show .phase-n { opacity: 1; transform: none; transition: opacity .7s var(--ease) .4s, transform .9s var(--ease) .4s; }
.cap-phase h2 { font-size: clamp(34px, 4vw, 60px); line-height: 1.04; letter-spacing: -0.045em; margin-bottom: 20px; }
.cap-phase h2 em { font-family: var(--serif); background: none; color: transparent; padding-right: .06em; } /* each word carries the gradient */
.cap-phase .wd { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.cap-phase .wd > span { display: inline-block; transform: translateY(-110%); transform-origin: 0 100%; transition: transform .35s cubic-bezier(.5, 0, .75, 0); transition-delay: calc(var(--i) * 12ms); }
.cap-phase em .wd > span { background: var(--text-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cap-phase:not(.show):not(.past) .wd > span { transform: translateY(110%) rotate(6deg); }
.cap-phase.show .wd > span { transform: none; transition: transform .9s var(--ease); transition-delay: calc(.4s + var(--i) * 45ms); }
.cap-phase p:last-child { color: var(--muted); font-size: 17px; opacity: 0; transform: translateY(-12px); filter: blur(4px); transition: opacity .25s ease-in, transform .3s ease-in, filter .25s; }
.cap-phase:not(.show):not(.past) p:last-child { transform: translateY(18px); }
.cap-phase.show p:last-child { opacity: 1; transform: none; filter: none; transition: opacity .9s var(--ease) .7s, transform 1s var(--ease) .7s, filter .9s .7s; }

/* Phase checklist: a row under the captions, with a progress bar beneath it */
.rail { position: absolute; left: var(--col); bottom: max(6vh, 40px); list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; z-index: 2; opacity: 0; transform: translateY(12px); transition: opacity .6s, transform .8s var(--ease); }
.rail.show { opacity: 1; transform: none; }
.rail li { display: flex; align-items: center; gap: 10px; font: 500 12px/1 var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .12em; transition: color .4s; }
.rail li.cur { color: var(--text); }
.rail li.on { color: var(--muted); }
.rail-cb { position: relative; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-2); transition: all .4s var(--ease); }
.rail li.cur .rail-cb { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.rail li.on .rail-cb { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 14px rgba(var(--lime-rgb), .5); }
.rail li.on .rail-cb::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid var(--ink-on-lime); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.rail::before, .rail::after { content: ""; position: absolute; left: 0; bottom: -14px; height: 2px; border-radius: 2px; }
.rail::before { right: 0; background: var(--line); }
.rail::after { width: calc(100% * var(--rp, 0)); background: linear-gradient(90deg, var(--lime), var(--blue), var(--violet)); box-shadow: 0 0 10px rgba(var(--lime-rgb), .45); }

.scroll-hint { position: absolute; right: var(--gutter); bottom: 32px; display: flex; align-items: center; gap: 12px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .16em; color: var(--dim); transition: opacity .5s; }
.scroll-hint span { position: relative; width: 1px; height: 44px; background: var(--line-2); overflow: hidden; }
.scroll-hint span::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--accent); animation: hint 2s var(--ease) infinite; }
@keyframes hint { to { top: 100%; } }
.scroll-hint.away { opacity: 0; }

/* ---------- Sections ---------- */
.section { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(80px, 10vw, 130px) var(--gutter); }
.sec-head { display: grid; gap: 22px; margin-bottom: clamp(36px, 5vw, 60px); }
.sec-head.center { justify-items: center; text-align: center; }
.sec-head.center .lede { text-align: center; }

.rv { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.rv.in { opacity: 1; transform: none; }

/* What you get */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  --c: var(--lime-rgb);
  position: relative; overflow: hidden; padding: 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .6s var(--ease), border-color .4s;
}
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 70% at 0% 0%, rgba(var(--c), .14), transparent 60%); }
.card:hover { transform: translateY(-4px); border-color: rgba(var(--c), .45); }
.card.c-blue { --c: var(--blue-rgb); }
.card.c-violet { --c: var(--violet-rgb); }
.card-icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; margin-bottom: 40px; background: rgba(var(--c), .16); border: 1px solid rgba(var(--c), .4); }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: rgb(var(--c)); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card.c-lime .card-icon svg { stroke: var(--text); }
.card h3 { position: relative; font-size: 26px; margin-bottom: 10px; }
.card p { position: relative; color: var(--muted); }

/* Boxes */
.tick-grid { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 1000px; }
.tick-grid li {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 16px;
  transition: color .5s, border-color .5s, background-color .5s;
}
.tick-grid li.on { color: var(--text); border-color: rgba(var(--lime-rgb), .45); }

/* Lab */
.lab-band {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center;
  padding: clamp(28px, 5vw, 64px); border-radius: 32px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.lab-band::before { content: ""; position: absolute; inset: 0; z-index: -1; background:
  radial-gradient(60% 80% at 100% 0%, rgba(var(--violet-rgb), .16), transparent 60%),
  radial-gradient(50% 70% at 100% 100%, rgba(var(--blue-rgb), .12), transparent 60%); }
.lab-copy { display: grid; gap: 22px; justify-items: start; }
.lab-copy .btn { margin-top: 8px; }
.mini-browser { border-radius: 18px; border: 1px solid var(--line-2); background: var(--bg); overflow: hidden; box-shadow: var(--shadow); }
.mb-bar { display: flex; align-items: center; gap: 6px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.mb-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(var(--fg-rgb), .14); }
.mb-bar span { margin-left: 10px; font: 400 12px var(--mono); color: var(--dim); }
.mb-row { display: flex; align-items: center; gap: 12px; padding: 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.mb-row:last-child { border-bottom: 0; color: var(--dim); }
.mb-row small { margin-left: auto; font: 400 12px var(--mono); color: var(--dim); }

/* Final CTA */
.final { position: relative; text-align: center; padding: clamp(110px, 14vw, 200px) var(--gutter); overflow: hidden; isolation: isolate; display: grid; justify-items: center; gap: 26px; }
.final-glow { position: absolute; z-index: -1; left: 50%; bottom: -45%; width: 1300px; height: 800px; max-width: 220vw; transform: translateX(-50%); filter: blur(30px);
  background: radial-gradient(closest-side at 35% 50%, rgba(var(--lime-rgb), .2), transparent), radial-gradient(closest-side at 65% 50%, rgba(var(--violet-rgb), .22), transparent); }
.final-title { font-size: clamp(56px, 10vw, 160px); line-height: .9; letter-spacing: -0.065em; font-weight: 500; }
.final .lede { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr; }
  .tick-grid { grid-template-columns: repeat(2, 1fr); }
  .lab-band { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .story { height: 532vh; }
  /* Light effects over the film (magic.js): motes, the cursor's light, bursts as each shape lands. */
#magic { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.stage-vignette { background: linear-gradient(0deg, rgba(var(--bg-rgb), .96) 0%, rgba(var(--bg-rgb), .72) 38%, transparent 62%); }
  .cap-hero { max-width: none; right: var(--gutter); bottom: max(5vh, 32px); }
  .display { margin: 18px 0; }
  .cap-phase { top: auto; bottom: max(7vh, 40px); right: var(--gutter); max-width: none; transform: none; }
  .cap-phase .phase-big { font-size: 72px; margin-bottom: 10px; }
  .cap-phase h2 { margin-bottom: 12px; }
  .cap-phase p:last-child { font-size: 15.5px; }
  .rail { top: 84px; bottom: auto; left: var(--gutter); gap: 14px; }
  .rail.show { transform: none; }
  .rail::before, .rail::after { display: none; }
  .rail li { font-size: 0; gap: 0; }
  .rail li .rail-cb { width: 14px; height: 14px; }
  .rail li.on .rail-cb::after { left: 3.5px; top: 1px; }
  .scroll-hint { display: none; }
}
@media (max-width: 560px) {
  .tick-grid { grid-template-columns: 1fr; }
  .ctas .btn { flex: 1 1 100%; }
  .card { padding: 24px; }
  .card-icon { margin-bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .display .ln > span, .hero-sub, .cap-hero .ctas, .cap-hero .pill, .rv { opacity: 1; transform: none; }
  .cap-phase { opacity: 0; }
  .cap-phase.show { opacity: 1; }
}

/* A check mark that draws itself after "Ticked." once the headline is in. */
.hero-tick { display: inline-block; width: .62em; height: .62em; margin-inline-start: .08em; vertical-align: -.02em; overflow: visible; }
.hero-tick path { fill: none; stroke: var(--lime); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 .12em rgba(var(--lime-rgb), .6)); }
.is-loaded .hero-tick path { stroke-dashoffset: 0; transition: stroke-dashoffset .9s cubic-bezier(.65, 0, .35, 1) 1.5s; }
:root[data-theme="light"] .hero-tick path { filter: none; }
@media (prefers-reduced-motion: reduce) { .hero-tick path { stroke-dashoffset: 0; transition: none; } }
