/* ===== ScreenProof — styles ===== */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-sunk: #eceef2;
  --fg: #0b0d10;
  --fg-muted: #4f5866;
  --line: #d6dae1;
  --line-strong: #9aa3b2;
  --accent: #0b7a3e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 122, 62, 0.12);
  --danger: #d6262f;
  --danger-soft: rgba(214, 38, 47, 0.14);
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 40px -12px rgba(0,0,0,.18);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2,.7,.2,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --bg-elev: #12151a;
    --bg-sunk: #07090b;
    --fg: #eef1f5;
    --fg-muted: #9aa3b2;
    --line: #1f242c;
    --line-strong: #3a424f;
    --accent: #3df08b;
    --accent-ink: #04140b;
    --accent-soft: rgba(61, 240, 139, 0.14);
    --danger: #ff5c6a;
    --danger-soft: rgba(255, 92, 106, 0.18);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 48px -16px rgba(0,0,0,.7);
  }
}

/* ----- reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; font-weight: 650; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }

.mono { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.01em; }
.muted { color: var(--fg-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  padding: 8px 12px; background: var(--accent); color: var(--accent-ink); border-radius: 8px;
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ----- top bar ----- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { color: var(--accent); }
.top-nav { display: flex; align-items: center; gap: 22px; font-size: 0.92rem; }
.top-nav a:not(.btn) { text-decoration: none; color: var(--fg-muted); }
.top-nav a:not(.btn):hover { color: var(--fg); }
@media (max-width: 720px) {
  .top-nav a:not(.btn) { display: none; }
}

/* ----- buttons & inputs ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.9rem; }

.input {
  min-height: 48px; padding: 0 14px; min-width: 0; width: 100%;
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: 10px;
  font-family: var(--mono); font-size: 0.95rem;
}
.input::placeholder { color: var(--fg-muted); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--danger); }

.waitlist {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px;
  width: 100%; max-width: 520px;
}
.waitlist .form-status { grid-column: 1 / -1; min-height: 1.2em; color: var(--fg-muted); }
.waitlist .form-status.ok { color: var(--accent); }
.waitlist .form-status.err { color: var(--danger); }
@media (max-width: 440px) {
  .waitlist { grid-template-columns: 1fr; }
}
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ----- hero ----- */
.hero {
  position: relative; isolation: isolate;
  min-height: min(92svh, 860px);
  display: grid; align-items: center;
  padding: clamp(56px, 10vh, 120px) var(--gutter) clamp(48px, 8vh, 96px);
  overflow: clip;
  background:
    radial-gradient(1200px 600px at 80% 20%, var(--accent-soft), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}
.hero-canvas { position: absolute; inset: 0; z-index: -1; }
.hero-canvas canvas { width: 100% !important; height: 100% !important; display: block; }
.hero-canvas::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 38%, transparent 62%);
  pointer-events: none;
}
@media (max-width: 900px) {
  .hero-canvas { opacity: .45; }
  .hero-canvas::after { background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 60%, transparent), color-mix(in srgb, var(--bg) 70%, transparent)); }
}
.hero-inner { width: 100%; max-width: var(--maxw); margin: 0 auto; }
.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.1rem, 5.4vw, 4.6rem);
  margin: 18px 0 20px;
  text-wrap: balance;
}
.lede { max-width: 58ch; font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--fg-muted); }
.hero .lede { margin-bottom: 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; line-height: 1.4; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg-elev) 70%, transparent); }
.eyebrow .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px var(--accent-soft); } 50% { box-shadow: 0 0 0 7px transparent; } }

.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 28px; color: var(--fg-muted); }
.hero-facts li::before { content: "▸ "; color: var(--accent); }

/* ----- sections ----- */
.section { padding: clamp(64px, 10vw, 120px) var(--gutter); max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; }
.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head .lede { margin-top: 14px; }
.kicker { color: var(--accent); margin-bottom: 12px; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.6rem); text-wrap: balance; }
h3 { font-size: 1.15rem; margin-bottom: 8px; }

/* how */
.how-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
@media (max-width: 860px) { .how-grid { grid-template-columns: 1fr; } }
.diagram { margin: 0; max-width: 520px; width: 100%; justify-self: center; }
.diagram svg { width: 100%; height: auto; overflow: visible; }
.dg-ring { stroke: var(--line); }
.dg-ring-glow { stroke: var(--accent); stroke-dasharray: 18 82; stroke-linecap: round; opacity: .9; animation: orbit 6s linear infinite; }
@keyframes orbit { to { stroke-dashoffset: -100; } }
.dg-path { stroke: var(--line-strong); }
.dg-arrow { fill: var(--line-strong); }
.dg-node rect { fill: var(--bg-elev); stroke: var(--line-strong); stroke-width: 1.5; transition: stroke .3s, fill .3s; }
.dg-node .dg-num { font-family: var(--mono); font-size: 12px; fill: var(--accent); }
.dg-node .dg-label { font-family: var(--sans); font-size: 16px; font-weight: 650; fill: var(--fg); }
.dg-node.active rect { stroke: var(--accent); fill: var(--accent-soft); }
.dg-center rect { fill: var(--bg-sunk); stroke: var(--line-strong); stroke-width: 1.5; }
.dg-center .dg-defect { fill: var(--danger-soft); stroke: var(--danger); stroke-dasharray: 3 3; animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.dg-caption { font-family: var(--mono); font-size: 11px; fill: var(--fg-muted); }

.steps { display: grid; gap: 22px; counter-reset: step; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.step-num { color: var(--accent); padding-top: 4px; }
.step p { color: var(--fg-muted); }

/* catches */
.catch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 980px) { .catch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .catch-grid { grid-template-columns: 1fr; } }
.catch {
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); box-shadow: var(--shadow);
  transition: transform .3s var(--ease), border-color .3s var(--ease);
}
.catch:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.catch p { color: var(--fg-muted); font-size: 0.97rem; }

/* mini phone illustrations */
.mini { height: 120px; margin-bottom: 18px; display: grid; place-items: center; background: var(--bg-sunk); border-radius: 10px; overflow: hidden; position: relative; }
.mini-screen {
  position: relative; width: 56px; height: 96px; border-radius: 9px;
  background: var(--bg-elev); border: 2px solid var(--line-strong);
  display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; overflow: visible;
}
.mini-screen.narrow { width: 44px; }
.mini-screen.wide { width: 120px; height: 84px; flex-direction: row; }
.mini .blk { display: block; height: 10px; border-radius: 3px; background: var(--line-strong); }
.mini .blk.stretch { flex: 1; height: 100%; border-radius: 5px; }
.mini .txt { display: block; height: 6px; border-radius: 3px; background: var(--line-strong); width: 100%; }
.mini .txt.short { width: 70%; }

/* overflow: a wide block escapes the screen */
.mini-overflow .blk.wide { width: 80px; background: var(--danger); animation: ovf 2.4s var(--ease) infinite alternate; }
@keyframes ovf { from { width: 36px; background: var(--line-strong); } 40% { width: 36px; background: var(--line-strong); } to { width: 84px; background: var(--danger); } }

/* overlap: block b slides over a */
.mini-overlap .blk.a { height: 22px; }
.mini-overlap .blk.b { height: 14px; width: 70%; background: var(--danger); align-self: flex-end; animation: ovl 2.6s var(--ease) infinite alternate; }
@keyframes ovl { from { transform: translateY(0); background: var(--line-strong); } 40% { background: var(--line-strong); } to { transform: translateY(-22px); background: var(--danger); } }

/* truncate: last line gets cut with an ellipsis dot pattern */
.mini-truncate .txt.cut { width: 100%; position: relative; overflow: hidden; }
.mini-truncate .txt.cut::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 14px; background: var(--danger); animation: trunc 2.4s var(--ease) infinite alternate; }
@keyframes trunc { from { width: 0; } 40% { width: 0; } to { width: 18px; } }

/* clip: a notch covers the top block */
.mini-clip .notch { position: absolute; top: -2px; left: 50%; width: 26px; height: 9px; margin-left: -13px; background: var(--line-strong); border-radius: 0 0 6px 6px; }
.mini-clip .blk.top { margin-top: -5px; width: 60%; align-self: center; background: var(--danger); animation: clip 2.6s var(--ease) infinite alternate; }
@keyframes clip { from { transform: translateY(6px); background: var(--line-strong); } 40% { background: var(--line-strong); } to { transform: translateY(-4px); background: var(--danger); } }
.mini-clip .blk.bottom { margin-top: auto; }

/* small: fourth row squeezes out */
.mini-small .blk:last-child { background: var(--danger); animation: small 2.6s var(--ease) infinite alternate; }
@keyframes small { from { opacity: .3; transform: translateY(0); background: var(--line-strong); } 40% { background: var(--line-strong); } to { opacity: 1; transform: translateY(16px); background: var(--danger); } }

/* large: cards stretch */
.mini-large .blk.stretch:first-child { animation: large 2.6s var(--ease) infinite alternate; }
@keyframes large { from { flex: 1; } 40% { flex: 1; } to { flex: 4; background: var(--danger); } }

/* demo */
.demo-frame {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-sunk); box-shadow: var(--shadow);
}
.demo-sim {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg-sunk); color: var(--fg);
}
@media (max-width: 640px) { .demo-frame { aspect-ratio: 4 / 3; } }

.sim-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-elev); color: var(--fg-muted); font-size: .72rem; }
.sim-dots { display: inline-flex; gap: 5px; }
.sim-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); opacity: .7; }
.sim-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.sim-phase { display: inline-flex; gap: 4px; }
.sim-phase b { font-weight: 600; padding: 2px 7px; border-radius: 5px; border: 1px solid transparent; color: var(--fg-muted); transition: all .3s; }
.demo-sim[data-phase="run"] b[data-p="run"], .demo-sim[data-phase="detect"] b[data-p="detect"],
.demo-sim[data-phase="rfc"] b[data-p="rfc"], .demo-sim[data-phase="verify"] b[data-p="verify"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 640px) { .sim-phase b:not([data-p]) { display: none; } .sim-title { display: none; } }

.sim-body { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); min-height: 0; }
@media (max-width: 640px) { .sim-body { grid-template-columns: 1fr; } .sim-term { display: none; } }
.sim-term {
  margin: 0; padding: 14px 16px; overflow: hidden; border-right: 1px solid var(--line);
  font-size: clamp(.62rem, 1.1vw, .8rem); line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--fg-muted);
}
.sim-term .ln { display: block; opacity: 0; transform: translateY(4px); animation: lnin .35s var(--ease) forwards; }
@keyframes lnin { to { opacity: 1; transform: none; } }
.sim-term .ok { color: var(--accent); }
.sim-term .bad { color: var(--danger); }
.sim-term .cmd { color: var(--fg); }
.sim-term .dim { opacity: .6; }
.sim-term .cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }

.sim-stage { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: clamp(10px, 2vw, 22px); overflow: hidden;
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px; }
.sim-devices { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 22px); }
.sim-dev { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sim-label { font-size: .62rem; color: var(--fg-muted); }
.sim-screen {
  position: relative; display: flex; flex-direction: column; gap: 5%; padding: 9% 8%;
  background: var(--bg-elev); border: 2px solid var(--line-strong); border-radius: 10px; overflow: visible;
  height: clamp(110px, 20vw, 250px);
}
.sim-dev[data-dev="360"] .sim-screen { aspect-ratio: 360 / 800; }
.sim-dev[data-dev="390"] .sim-screen { aspect-ratio: 390 / 844; }
.sim-dev[data-dev="430"] .sim-screen { aspect-ratio: 430 / 932; }
.sim-dev[data-dev="768"] .sim-screen { aspect-ratio: 768 / 1024; }
.sim-screen i { display: block; border-radius: 3px; background: var(--line); border: 1px solid var(--line-strong); }
.s-hdr { height: 7%; }
.s-card { height: 22%; }
.s-row { height: 6%; }
.s-cta { height: 10%; margin-top: auto; }
.s-tile { height: 18%; width: 46%; }
.s-tile.s-b { align-self: flex-end; margin-top: -18%; transform: translateX(-30%); }
.s-scan { position: absolute; left: -4px; right: -4px; top: 0; height: 2px; border: 0; border-radius: 0; background: var(--accent); box-shadow: 0 0 10px 2px var(--accent-soft); opacity: 0; }
.s-flag { position: absolute; right: -6px; top: -10px; padding: 1px 6px; border-radius: 4px; background: var(--danger); color: #fff; font-size: .58rem; opacity: 0; transform: scale(.8); transition: all .3s var(--ease); }

/* phase: run → scan */
.demo-sim[data-phase="run"] .s-scan, .demo-sim[data-phase="verify"] .s-scan { opacity: 1; animation: sweep 2.2s var(--ease) infinite; }
.sim-dev:nth-child(2) .s-scan { animation-delay: .2s !important; }
.sim-dev:nth-child(3) .s-scan { animation-delay: .4s !important; }
.sim-dev:nth-child(4) .s-scan { animation-delay: .6s !important; }
@keyframes sweep { from { top: 0; } to { top: 100%; } }

/* phase: detect → defects turn red */
.demo-sim[data-phase="detect"] .s-defect, .demo-sim[data-phase="rfc"] .s-defect { background: var(--danger-soft); border-color: var(--danger); animation: blink 1.4s steps(2) infinite; }
.demo-sim[data-phase="detect"] .s-cta.s-defect, .demo-sim[data-phase="rfc"] .s-cta.s-defect { width: 124%; }
.demo-sim[data-phase="detect"] .s-flag, .demo-sim[data-phase="rfc"] .s-flag { opacity: 1; transform: none; }

/* phase: verify → defects fixed */
.demo-sim[data-phase="verify"] .s-defect { background: var(--accent-soft); border-color: var(--accent); }
.demo-sim[data-phase="verify"] .s-tile.s-b { transform: none; margin-top: -18%; }
.sim-screen i { transition: width .5s var(--ease), transform .5s var(--ease), background .3s, border-color .3s; }

/* RFC cards */
.sim-rfcs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; min-height: 0; }
.sim-rfc {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; width: min(100%, 230px);
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: 8px; font-size: .62rem; color: var(--fg-muted);
  opacity: 0; transform: translateY(10px); transition: opacity .4s var(--ease), transform .4s var(--ease), border-color .3s;
}
.sim-rfc b { color: var(--fg); font-weight: 650; }
.sim-rfc .sim-fix { color: var(--fg); }
.sim-rfc .sim-ok { display: none; color: var(--accent); }
.demo-sim[data-phase="rfc"] .sim-rfc, .demo-sim[data-phase="verify"] .sim-rfc { opacity: 1; transform: none; }
.demo-sim[data-phase="rfc"] .sim-rfc[data-rfc="2"] { transition-delay: .25s; }
.demo-sim[data-phase="verify"] .sim-rfc { border-color: var(--accent); }
.demo-sim[data-phase="verify"] .sim-rfc .sim-ok { display: block; }
@media (max-width: 640px) { .sim-rfc span:not(.sim-ok):not(.sim-fix) { display: none; } }
@media (max-height: 420px) and (max-width: 640px) { .sim-rfcs { display: none; } }

/* cta */
.cta-box {
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(600px 300px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--bg-elev);
  box-shadow: var(--shadow);
}
.cta-box h2 { margin-bottom: 14px; }
.cta-box .lede { margin-bottom: 26px; }
.fineprint { margin-top: 14px; color: var(--fg-muted); }

/* footer */
.foot { padding: 32px var(--gutter) 48px; border-top: 1px solid var(--line); max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; display: grid; gap: 14px; }
.foot-row { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
.foot a { color: var(--fg); }

/* ----- motion ----- */
.reveal { transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal:not(.in) { opacity: 0; transform: translateY(18px); }
.hero .reveal:nth-child(1) { transition-delay: .05s; }
.hero .reveal:nth-child(2) { transition-delay: .15s; }
.hero .reveal:nth-child(3) { transition-delay: .25s; }
.hero .reveal:nth-child(4) { transition-delay: .35s; }
.hero .reveal:nth-child(5) { transition-delay: .45s; }
.catch-grid .reveal:nth-child(2) { transition-delay: .08s; }
.catch-grid .reveal:nth-child(3) { transition-delay: .16s; }
.catch-grid .reveal:nth-child(4) { transition-delay: .08s; }
.catch-grid .reveal:nth-child(5) { transition-delay: .16s; }
.catch-grid .reveal:nth-child(6) { transition-delay: .24s; }
.steps .reveal:nth-child(2) { transition-delay: .1s; }
.steps .reveal:nth-child(3) { transition-delay: .2s; }
.steps .reveal:nth-child(4) { transition-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-canvas { display: none; }
}

/* 3D canvas fade-in */
.hero-canvas canvas { opacity: 0; transition: opacity 1.2s var(--ease); }
.hero-canvas.ready canvas { opacity: 1; }

@media (min-width: 901px) {
  .hero .lede { max-width: min(52ch, 56%); }
}
