/* ═══════════════════════════════════════════════════════════
   Web Based Army — motion ad
   One ad, three formats (16:9, 4:5 feed, 9:16 stories/reels).
   Every moving part reads its state from CSS variables written
   by script.js from one clock, so it scrubs and records exactly.
     per element   --e  enter progress   --x  exit progress
     stage tracks  --draw --wire --shift --code --fill --phone --rings --t
   Layout differences between formats live only in the .f-* blocks.
   ═══════════════════════════════════════════════════════════ */

:root {
  --green:  #006400;
  --green-2:#0b7a14;
  --neon:   #00ff38;
  --light:  #f7faff;
  --dark:   #1d1d27;
  --ink:    #13131a;
  --line:   rgba(247,250,255,.1);
  --mute:   #8d90a3;
  --sans:   "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: #0c0c11; overflow: hidden; }
body { font-family: var(--sans); color: var(--light); -webkit-font-smoothing: antialiased; }

/* ── stage ────────────────────────────────────────────────── */
.viewport { position: fixed; inset: 0; overflow: hidden; }

/* Centred by its own half-size offsets, then scaled about its centre.
   A grid/flex parent can't centre it: the 1920px layout box overflows
   the track, pins to the left edge, and the scale pulls it off-centre. */
.stage {
  /* landscape defaults — overridden per format below */
  --W: 1920px; --H: 1080px;

  --tpl-inset: 120px 160px; --tpl-cols: 4;
  --open-size: 148px;
  --cap-top: 118px; --cap-size: 82px; --cap-pad: 60px;

  --bw: 1100px; --bh: 640px; --btop: 286px;
  --pw: 390px;  --ph: 730px;
  --sx: -330px; --sy: 0px;

  --cl: 1238px; --ct: 286px; --cw: 600px; --ch: 640px; --cfs: 19px;
  --cix: 80px;  --ciy: 0px;

  --rings-top: 390px; --rings-scale: 1;
  --promise-size: 112px; --promise-pad: 80px; --sub-size: 34px;

  position: absolute; left: 50%; top: 50%;
  width: var(--W); height: var(--H);
  margin-left: calc(var(--W) / -2);
  margin-top: calc(var(--H) / -2);
  transform-origin: center;
  overflow: hidden; background: var(--dark);

  --e: 0; --x: 0;
  --draw: 0; --wire: 0; --shift: 0; --code: 0; --fill: 0; --phone: 0; --rings: 0; --t: 0;
}

/* 4:5 — Facebook / Instagram feed */
.stage.f-feed {
  --W: 1080px; --H: 1350px;
  --tpl-inset: 110px 60px; --tpl-cols: 4;
  --open-size: 122px;
  --cap-top: 150px; --cap-size: 74px; --cap-pad: 60px;
  --bw: 960px; --bh: 640px; --btop: 440px;
  --pw: 430px; --ph: 820px;
  --sx: -40px; --sy: -80px;
  --cl: 452px; --ct: 780px; --cw: 588px; --ch: 500px; --cfs: 17px;
  --cix: 0px; --ciy: 70px;
  --rings-top: 540px; --rings-scale: .8;
  --promise-size: 96px; --promise-pad: 60px; --sub-size: 30px;
}

/* 9:16 — Stories and Reels on both platforms */
.stage.f-story {
  --W: 1080px; --H: 1920px;
  --tpl-inset: 170px 60px; --tpl-cols: 2;
  --open-size: 136px;
  --cap-top: 270px; --cap-size: 96px; --cap-pad: 70px;
  --bw: 960px; --bh: 700px; --btop: 560px;
  --pw: 560px; --ph: 1060px;
  --sx: 0px; --sy: 0px;
  --cl: 60px; --ct: 1300px; --cw: 960px; --ch: 500px; --cfs: 19px;
  --cix: 0px; --ciy: 90px;
  --rings-top: 760px; --rings-scale: .82;
  --promise-size: 110px; --promise-pad: 70px; --sub-size: 36px;
}

/* anything timed: hidden outside its window, faded/lifted in, faded out */
[data-t] {
  opacity: calc(var(--e) * (1 - var(--x)));
  translate: 0 calc((1 - var(--e)) * 34px + var(--x) * -24px);
}

/* ── backdrop ─────────────────────────────────────────────── */
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(247,250,255,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(247,250,255,.045) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent 85%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent 85%);
}
/* echoes the camo-blob logo: two slow organic shapes in the brand green */
.bg-blob {
  position: absolute; width: 1100px; height: 1100px;
  left: -260px; top: -320px;
  rotate: calc(var(--t) * 4deg);
  filter: blur(70px); opacity: .55;
}
.bg-blob path { fill: var(--green); }
.bg-blob--2 {
  left: auto; right: -340px; top: auto; bottom: -420px;
  width: 980px; height: 980px; opacity: .35;
  rotate: calc(var(--t) * -5deg);
}
.bg-blob--2 path { fill: #0f8a1c; }

/* ── S1 ───────────────────────────────────────────────────── */
.templates {
  position: absolute; inset: var(--tpl-inset);
  display: grid; grid-template-columns: repeat(var(--tpl-cols), 1fr); gap: 28px;
  translate: 0 calc(var(--x) * 120px);
}
.templates i {
  border: 1px solid var(--line); border-radius: 18px;
  background:
    linear-gradient(rgba(247,250,255,.06) 0 0) 24px 24px / 60% 18px no-repeat,
    linear-gradient(rgba(247,250,255,.04) 0 0) 24px 56px / 40% 12px no-repeat,
    linear-gradient(rgba(247,250,255,.03) 0 0) 24px calc(100% - 24px) / calc(100% - 48px) 45% no-repeat,
    rgba(247,250,255,.015);
  opacity: .55;
}

.open {
  position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%;
  padding: 0 60px;
  text-align: center; font-weight: 900; font-size: var(--open-size);
  line-height: .98; letter-spacing: -.045em; color: var(--light);
}
.open .w { display: inline-block; }
.w--strike { position: relative; color: var(--mute); }
.w--strike::after {
  content: ""; position: absolute; left: -2%; top: 54%; height: 12px; width: 104%;
  background: var(--neon); border-radius: 6px;
  box-shadow: 0 0 30px rgba(0,255,56,.6);
  transform-origin: left; scale: var(--strike, 0) 1;
}

/* ── captions ─────────────────────────────────────────────── */
.cap {
  position: absolute; left: 0; right: 0; top: var(--cap-top);
  padding: 0 var(--cap-pad);
  text-align: center; font-weight: 800; font-size: var(--cap-size);
  letter-spacing: -.035em; line-height: 1.02; color: var(--light);
}
.cap em { font-style: normal; color: var(--neon); }

/* ── browser ──────────────────────────────────────────────── */
.browser {
  position: absolute; left: 50%; top: var(--btop);
  width:  calc(var(--bw) + (var(--pw) - var(--bw)) * var(--phone));
  height: calc(var(--bh) + (var(--ph) - var(--bh)) * var(--phone));
  translate:
    calc(-50% + var(--shift) * var(--sx))
    calc(var(--shift) * var(--sy) + (1 - var(--e)) * 40px + var(--x) * -30px);
  border-radius: calc(16px + var(--phone) * 30px);
  background: var(--ink);
  box-shadow: 0 50px 120px rgba(0,0,0,.55), 0 0 0 1px rgba(0,255,56,calc(.08 + var(--fill) * .14));
  overflow: hidden;
}
/* frame draws on from the top-left corner, then hands over to the wireframe */
.browser::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border: 2.5px solid var(--neon); border-radius: inherit;
  clip-path: inset(0 calc((1 - var(--draw)) * 100%) calc((1 - var(--draw)) * 100%) 0);
  opacity: calc(1 - var(--wire));
  box-shadow: inset 0 0 24px rgba(0,255,56,.18);
}
.browser__bar {
  display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: rgba(247,250,255,.03);
  opacity: calc(1 - var(--phone));
}
.browser__bar i { width: 12px; height: 12px; border-radius: 50%; background: rgba(247,250,255,.16); }
.browser__url {
  margin-left: 14px; padding: 5px 16px; border-radius: 99px;
  background: rgba(247,250,255,.06); color: var(--mute);
  font-size: 15px; letter-spacing: .02em;
}

.site { position: absolute; inset: calc(46px - var(--phone) * 22px) 0 0; overflow: hidden; }

/* wireframe */
.wire { position: absolute; inset: 0; padding: 26px 34px; display: grid; gap: 22px; grid-template-rows: auto 1fr auto; }
.wire > *, .wire__copy > *, .wire__cards > *, .wire__nav > * {
  opacity: clamp(0, calc(var(--wire) * 6 - var(--i, 0)), 1);
}
.wire__nav { display: flex; align-items: center; gap: 18px; }
.wire__nav b { width: 120px; height: 22px; border-radius: 6px; background: rgba(247,250,255,.16); margin-right: auto; }
.wire__nav span { width: 64px; height: 12px; border-radius: 6px; background: rgba(247,250,255,.1); }
.wire__hero { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.wire__copy { display: grid; gap: 14px; }
.wire__copy b { height: 42px; border-radius: 8px; background: rgba(247,250,255,.18); }
.wire__copy b.short { width: 70%; }
.wire__copy span { height: 14px; border-radius: 6px; background: rgba(247,250,255,.1); }
.wire__copy span.short { width: 60%; }
.wire__copy em { width: 170px; height: 46px; border-radius: 99px; border: 2px dashed rgba(0,255,56,.55); margin-top: 8px; }
.wire__img { height: 100%; min-height: 200px; border-radius: 14px; border: 2px dashed rgba(247,250,255,.18); }
.wire__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.wire__cards div { height: 92px; border-radius: 12px; border: 1px solid rgba(247,250,255,.14); }

/* finished site — revealed as a circle from the cursor's click */
.real {
  position: absolute; inset: 0; padding: 22px 34px;
  display: grid; gap: 20px; grid-template-rows: auto 1fr auto;
  background: #fbf7f1; color: #2a1d14;
  clip-path: circle(calc(var(--fill) * 150%) at 24% 38%);
}
.real__nav { display: flex; align-items: center; justify-content: space-between; }
.real__logo { font-weight: 900; font-size: 26px; letter-spacing: -.03em; }
.real__logo i { color: var(--green-2); font-style: normal; }
.real__links { display: flex; gap: 26px; font-size: 16px; font-weight: 600; color: #6b5a4c; }
.real__hero { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.real__copy h2 { font-size: 54px; line-height: 1; letter-spacing: -.045em; font-weight: 900; }
.real__copy p { margin: 16px 0 22px; font-size: 18px; line-height: 1.5; color: #6b5a4c; max-width: 26ch; }
.real__btn {
  display: inline-block; padding: 14px 28px; border-radius: 99px;
  background: #2a1d14; color: #fbf7f1; font-weight: 700; font-size: 16px;
}
.real__img {
  position: relative; height: 100%; min-height: 200px; border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(60% 55% at 35% 40%, #c88a52, transparent 70%),
    radial-gradient(50% 50% at 70% 70%, #6b3d1e, transparent 70%),
    linear-gradient(140deg, #8a5530, #3b2213);
}
/* a cup, drawn with gradients rather than shipped as an image */
.real__img span {
  position: absolute; left: 50%; top: 52%; translate: -50% -50%;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, #f3e3cf 0 34%, #b77b4a 35% 42%, #fbf7f1 43% 58%, transparent 59%);
  box-shadow: 0 30px 50px rgba(0,0,0,.35);
}
.real__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.real__cards div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px 24px; border-radius: 14px; background: #fff;
  border: 1px solid #eadfd2; font-size: 18px;
}
.real__cards b { font-weight: 800; }
.real__cards span { color: var(--green-2); font-weight: 700; }

/* mobile reflow — toggled by script once the morph is past halfway */
.browser.is-mobile .wire__hero,
.browser.is-mobile .real__hero { grid-template-columns: 1fr; }
.browser.is-mobile .wire__cards,
.browser.is-mobile .real__cards { grid-template-columns: 1fr; gap: 10px; }
.browser.is-mobile .real__links,
.browser.is-mobile .wire__nav span { display: none; }
.browser.is-mobile .real { padding: 18px 20px; }
.browser.is-mobile .real__copy h2 { font-size: 40px; }
.browser.is-mobile .real__img { min-height: 170px; }
.browser.is-mobile .real__cards div { padding: 14px 18px; }

/* the taller story phone has room for a bigger hero */
.f-story .browser.is-mobile .real__copy h2 { font-size: 52px; }
.f-story .browser.is-mobile .real__img { min-height: 260px; }
.f-story .browser.is-mobile .real__cards div { padding: 22px 22px; font-size: 20px; }

/* ── code panel ───────────────────────────────────────────── */
.code {
  position: absolute; left: var(--cl); top: var(--ct); width: var(--cw); height: var(--ch);
  border-radius: 16px; overflow: hidden;
  background: #0e0e14; border: 1px solid var(--line);
  box-shadow: 0 50px 120px rgba(0,0,0,.6);
  translate:
    calc((1 - var(--e)) * var(--cix) + var(--x) * var(--cix))
    calc((1 - var(--e)) * var(--ciy) + var(--x) * var(--ciy));
  z-index: 2;
}
.code__bar {
  display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 18px;
  border-bottom: 1px solid var(--line); color: var(--mute); font-size: 15px;
}
.code__bar i { width: 12px; height: 12px; border-radius: 50%; background: rgba(247,250,255,.16); }
.code__bar span { margin-left: 12px; font-family: var(--mono); }
.code__body {
  padding: 22px 26px; font-family: var(--mono); font-size: var(--cfs); line-height: 1.7;
  color: #c9cbd8; white-space: pre;
  font-variant-ligatures: none;   /* JetBrains turns <!-- into an arrow */
}
.code__body .ln {
  display: block;
  --r: clamp(0, calc(var(--code) * var(--n) - var(--i)), 1);
  clip-path: inset(0 calc((1 - var(--r)) * 100%) 0 0);
}
.tk-t { color: #7ee2a8; }
.tk-a { color: #9fb3ff; }
.tk-s { color: #ffd479; }
.tk-c { color: #5c6077; }
.tk-p { color: #00ff38; }

/* ── cursor ───────────────────────────────────────────────── */
/* offset so --cx/--cy land on the arrow's tip, not the box corner */
.cursor {
  position: absolute; left: -5px; top: -3px; width: 40px; height: 40px; z-index: 20;
  translate: var(--cx, 1500px) var(--cy, 900px);
  opacity: var(--co, 0);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
}
.cursor svg { width: 40px; height: 40px; }
.cursor path { fill: var(--neon); stroke: #0c2a12; stroke-width: 1.2; }
.cursor__ring {
  position: absolute; left: -30px; top: -32px; width: 70px; height: 70px; border-radius: 50%;
  border: 3px solid var(--neon);
  opacity: calc(var(--click, 0) * (1 - var(--click, 0)) * 4);
  scale: calc(.3 + var(--click, 0) * 1.4);
}

/* ── rings ────────────────────────────────────────────────── */
.rings {
  position: absolute; left: 0; right: 0; top: var(--rings-top);
  display: flex; justify-content: center; gap: 120px;
  scale: var(--rings-scale); transform-origin: top center;
}
.ring { position: relative; width: 320px; text-align: center; flex: none; }
.ring svg { width: 320px; height: 320px; rotate: -90deg; }
.ring circle { fill: none; stroke: rgba(247,250,255,.08); stroke-width: 10; }
.ring .ring__fill {
  stroke: var(--neon); stroke-linecap: round;
  stroke-dasharray: 440; stroke-dashoffset: calc(440 * (1 - var(--rings) * var(--v)));
  filter: drop-shadow(0 0 12px rgba(0,255,56,.45));
}
.ring b {
  position: absolute; left: 0; right: 0; top: 112px;
  font-size: 92px; font-weight: 900; letter-spacing: -.04em; line-height: 1;
}
.ring span {
  display: block; margin-top: 18px; font-size: 22px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--mute);
}

/* ── S7 ───────────────────────────────────────────────────── */
.promise-wrap {
  position: absolute; inset: 0; padding: 0 var(--promise-pad);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 40px; text-align: center;
}
.promise {
  font-size: var(--promise-size); font-weight: 900; letter-spacing: -.045em; line-height: 1.04;
}
.promise .line { display: block; }
.line--accent { color: var(--neon); }
.promise__sub { font-size: var(--sub-size); font-weight: 500; color: var(--mute); max-width: 30ch; }

.end {
  position: absolute; inset: 0; padding: 0 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.end__logo {
  width: 220px; height: 220px;
  scale: calc(.6 + var(--e) * .4);
  rotate: calc((1 - var(--e)) * -25deg);
  filter: drop-shadow(0 0 60px rgba(0,255,56,.25)) brightness(1.25);
}
.end__name { margin-top: 18px; font-size: 92px; font-weight: 900; letter-spacing: -.045em; line-height: 1; }
.end__line { margin-top: 18px; font-size: 34px; font-weight: 500; color: var(--mute); }
.end__cta {
  margin-top: 44px; padding: 26px 56px; border-radius: 99px;
  background: var(--neon); color: #052a0e;
  font-size: 36px; font-weight: 800; letter-spacing: -.01em;
  box-shadow: 0 0 0 calc(var(--pulse, 0) * 22px) rgba(0,255,56,calc(.35 - var(--pulse, 0) * .35)),
              0 20px 60px rgba(0,255,56,.25);
}
.end__cta span { display: inline-block; translate: calc(var(--pulse, 0) * 8px) 0; }
.end__mail { margin-top: 30px; font-size: 30px; font-weight: 600; color: var(--light); letter-spacing: .01em; }

.f-story .end__logo { width: 280px; height: 280px; }
.f-story .end__name { font-size: 104px; }
.f-story .end__line { font-size: 38px; max-width: 18ch; }

.corner {
  position: absolute; left: 70px; top: 52px;
  display: flex; align-items: center; gap: 14px;
  font-size: 22px; font-weight: 700; letter-spacing: -.01em;
}
.f-feed .corner { left: 60px; top: 56px; }
.f-story .corner { left: 60px; top: 110px; }   /* clear of the Stories progress bar and profile chip */
.corner img { width: 44px; height: 44px; filter: brightness(1.25); }

/* ── player controls ──────────────────────────────────────── */
.controls {
  position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 99px;
  background: rgba(19,19,26,.82); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity .4s; font-size: 13px; color: var(--mute);
}
.controls.is-idle { opacity: 0; }
.controls button {
  height: 34px; min-width: 34px; padding: 0 10px; border: 0; border-radius: 99px; cursor: pointer;
  background: rgba(247,250,255,.08); color: var(--light); font-size: 13px; font-family: var(--sans);
}
.controls button:hover, .controls button.on { background: var(--neon); color: #052a0e; }
.controls input { width: min(34vw, 340px); accent-color: var(--neon); }
.controls span { min-width: 44px; font-variant-numeric: tabular-nums; }
.fmt { display: flex; gap: 4px; padding-left: 6px; border-left: 1px solid var(--line); }
body.is-record .controls { display: none; }
