/* ============================================================
   KEEL: dev-infra landing page
   Design system: dark-mode-first, high-contrast, teal accent,
   Geist (sans) + Geist Mono (technical accents)
   ============================================================ */

:root {
  /* Surfaces (cool charcoal, lifted off pure black) */
  --bg:        #161c1e;
  --bg-1:      #1d2527;   /* elevated cards */
  --bg-2:      #243032;   /* inputs / nested */
  --line:      rgba(190, 214, 212, 0.11);
  --line-2:    rgba(190, 214, 212, 0.19);

  /* Ink */
  --text:      #e9efee;
  --dim:       #9eadab;
  --faint:     #6f7c7a;

  /* Accent (tweakable) */
  --accent:    #22d3ee;
  --accent-ink:#042521;            /* text on accent fills */
  --accent-soft: color-mix(in oklab, var(--accent) 15%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 38%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 22%, transparent);

  /* Warn (depeg / exit) */
  --warn:      #e0a44a;

  /* Metrics */
  --maxw: 1120px;
  --pad: clamp(20px, 5vw, 48px);
  --radius: 14px;
  --section-y: clamp(76px, 11vw, 132px);

  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "cv01", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---- ambient background: faint grid + top glow ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 70% -8%, var(--accent-soft), transparent 60%);
  opacity: 0.6;
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(1100px 760px at 50% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(1100px 760px at 50% 0%, #000 0%, transparent 72%);
  opacity: 0.5;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   Layout primitives
   ============================================================ */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.section { padding-block: var(--section-y); position: relative; }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent-line);
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.022em; line-height: 1.05; text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.18rem; letter-spacing: -0.012em; }

.lede { color: var(--dim); font-size: clamp(1.02rem, 1.5vw, 1.2rem); line-height: 1.55; max-width: 54ch; text-wrap: pretty; }
.section-head { max-width: 60ch; margin-bottom: clamp(34px, 5vw, 56px); }
.section-head h2 { margin-top: 16px; }
.section-head .lede { margin-top: 18px; }

/* ============================================================
   Buttons + form
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding-inline: 22px;
  border-radius: 10px;
  font-size: 0.96rem; font-weight: 500;
  border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 0 color-mix(in oklab, #fff 30%, transparent) inset, 0 8px 28px -12px var(--accent-glow);
  font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 color-mix(in oklab,#fff 30%,transparent) inset, 0 14px 34px -12px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }
.btn:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

/* signup form */
.signup { display: flex; gap: 10px; flex-wrap: wrap; max-width: 480px; }
.signup .field { flex: 1 1 240px; min-width: 0; position: relative; }
.signup input[type="email"] {
  width: 100%; height: 48px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--text);
  padding: 0 14px;
  font-size: 0.96rem; font-family: var(--font-sans);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.signup input::placeholder { color: var(--faint); }
.signup input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.signup.invalid input { border-color: color-mix(in oklab, var(--warn) 60%, var(--line-2)); }
.form-msg { font-family: var(--font-mono); font-size: 0.76rem; margin-top: 10px; min-height: 1.1em; color: var(--faint); }
.form-msg.error { color: var(--warn); }
.form-msg.ok { color: var(--accent); }
.signup.done { gap: 0; }

.note { font-family: var(--font-mono); font-size: 0.76rem; color: var(--faint); display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
@media (prefers-reduced-motion: no-preference) { .dot { animation: pulse 2.4s ease-in-out infinite; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px var(--accent-soft);} 50% { box-shadow: 0 0 0 6px transparent; } }

/* ============================================================
   Header
   ============================================================ */
.site-head {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.site-head.scrolled { border-bottom-color: var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 600; letter-spacing: -0.01em; font-size: 1.06rem; }
.brand .mark { width: 26px; height: 26px; flex: none; }
.head-actions { display: flex; align-items: center; gap: 18px; }
.pill {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 11px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; }
.head-link { font-size: 0.92rem; color: var(--dim); transition: color .15s; }
.head-link:hover { color: var(--text); }
@media (max-width: 620px){ .head-actions .pill, .head-actions .head-link.hide-sm { display: none; } }

/* ============================================================
   Hero
   ============================================================ */
.hero { padding-top: clamp(54px, 8vw, 92px); padding-bottom: var(--section-y); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(40px, 6vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(2.35rem, 5.4vw, 4.15rem); margin: 20px 0 0; }
.hero .lede { margin-top: 22px; }
.hero-cta { margin-top: 34px; }
.hero .note { margin-top: 18px; }
@media (max-width: 900px){ .hero .wrap { grid-template-columns: 1fr; } .hero-visual { order: 2; } }

/* ---- peg monitor (hero + differentiator share .monitor) ---- */
.monitor {
  background: linear-gradient(180deg, var(--bg-1), color-mix(in oklab, var(--bg-1) 70%, var(--bg)));
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 40px 80px -50px #000;
}
.monitor-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.monitor-top .label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.status {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--accent-line); color: var(--accent); background: var(--accent-soft);
  transition: all .3s ease;
}
.status .dot { background: var(--accent); }
.status.breach { color: var(--warn); border-color: color-mix(in oklab,var(--warn) 50%, transparent); background: color-mix(in oklab,var(--warn) 13%, transparent); }
.status.breach .dot { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in oklab,var(--warn) 22%, transparent); }
.status.exited { color: #8fb4ff; border-color: color-mix(in oklab,#8fb4ff 45%, transparent); background: color-mix(in oklab,#8fb4ff 12%, transparent); }
.status.exited .dot { background: #8fb4ff; box-shadow: none; }

.peg-readout { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.peg-readout .price { font-family: var(--font-mono); font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 500; letter-spacing: -0.02em; }
.peg-readout .unit { font-family: var(--font-mono); color: var(--faint); font-size: 0.82rem; }

/* track */
.track { position: relative; height: 132px; margin-top: 14px; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.track .band {            /* guardrail threshold band */
  position: absolute; left: 0; right: 0; top: 34%; height: 32%;
  background: color-mix(in oklab, var(--accent) 9%, transparent);
  border-top: 1px dashed var(--accent-line); border-bottom: 1px dashed var(--accent-line);
}
.track .midline { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.track .band-tag { position: absolute; right: 8px; top: calc(34% + 4px); font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; color: var(--accent); opacity: 0.8; }
.track svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.track .needle-dot { fill: var(--accent); transition: fill .3s; }

.monitor-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint); }
.monitor-foot b { color: var(--dim); font-weight: 500; }

/* ============================================================
   Problem: two cards resolved by Keel
   ============================================================ */
.tradeoff { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px){ .tradeoff { grid-template-columns: 1fr; } }
.card {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 3vw, 30px);
}
.card .klabel { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.card h3 { margin: 12px 0 8px; }
.card p { color: var(--dim); font-size: 0.96rem; }
.card .tag { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; font-family: var(--font-mono); font-size: 0.74rem; }
.tag.bad { color: var(--warn); } .tag.bad::before { content: "—"; }
.tag.flat { color: var(--faint); } .tag.flat::before { content: "0"; font-weight: 600; }
.resolve { margin-top: 22px; text-align: center; font-size: clamp(1.1rem, 2vw, 1.4rem); color: var(--text); font-weight: 500; letter-spacing: -0.01em; }
.resolve b { color: var(--accent); font-weight: 600; }

/* ============================================================
   How it works: 3-step flow
   ============================================================ */
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; position: relative; }
@media (max-width: 820px){ .flow { grid-template-columns: 1fr; } }
.step { padding: 28px; position: relative; }
.flow .step:not(:last-child)::after {           /* connector */
  content: ""; position: absolute; top: 52px; right: -1px; width: 2px; height: calc(100% - 24px);
}
.step-num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); letter-spacing: 0.06em; }
.step-icon { width: 46px; height: 46px; margin: 16px 0 18px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 11px; background: var(--bg-1); color: var(--accent); }
.step h3 { margin-bottom: 8px; }
.step p { color: var(--dim); font-size: 0.94rem; }
.step .meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint); margin-top: 14px; }
.flow-diagram { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--bg-1), var(--bg)); overflow: hidden; }
.flow-rail { height: 1px; background: var(--line); position: relative; margin: 0 28px; }
.flow-rail .pip { position: absolute; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 2px var(--accent-glow); }
@media (prefers-reduced-motion: no-preference){ .flow-rail .pip { animation: flow 4.2s cubic-bezier(.7,0,.3,1) infinite; } }
@keyframes flow { 0% { left: 4%; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { left: 96%; opacity: 0; } }

/* ============================================================
   Differentiator: interactive guardrail
   ============================================================ */
.guardrail { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
@media (max-width: 900px){ .guardrail { grid-template-columns: 1fr; } }
.guardrail .lede { margin-top: 18px; }
.guard-list { list-style: none; margin-top: 26px; display: grid; gap: 16px; }
.guard-list li { display: grid; grid-template-columns: 22px 1fr; gap: 14px; color: var(--dim); font-size: 0.96rem; }
.guard-list .ix { font-family: var(--font-mono); color: var(--accent); font-size: 0.82rem; }
.guard-list b { color: var(--text); font-weight: 600; }
.sim-row { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.sim-hint { font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint); }

/* ============================================================
   Yield + Trust
   ============================================================ */
.yield-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px,5vw,56px); align-items: start; }
@media (max-width: 820px){ .yield-grid { grid-template-columns: 1fr; } }
.yield-grid p { color: var(--dim); font-size: 1.04rem; line-height: 1.65; }
.yield-grid p + p { margin-top: 16px; }
.source-list { display: grid; gap: 14px; }
.source {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--bg-1);
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
}
.source .k { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.source .d { color: var(--dim); font-size: 0.92rem; }
.source .n { font-family: var(--font-mono); color: var(--faint); font-size: 1.4rem; opacity: 0.5; }

.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px){ .trust-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px){ .trust-grid { grid-template-columns: 1fr; } }
.trust {
  border: 1px solid var(--line); border-radius: 12px; padding: 22px; background: var(--bg-1);
  min-height: 148px; display: flex; flex-direction: column;
}
.trust .ic { color: var(--accent); margin-bottom: 16px; }
.trust h3 { font-size: 1.02rem; margin-bottom: 7px; }
.trust p { color: var(--dim); font-size: 0.88rem; margin-top: auto; }

/* ============================================================
   FAQ
   ============================================================ */
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 24px 4px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  font-size: clamp(1.02rem, 1.8vw, 1.18rem); font-weight: 500; letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { flex: none; width: 22px; height: 22px; position: relative; transition: transform .25s ease; color: var(--accent); }
.faq summary .ico::before, .faq summary .ico::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.faq summary .ico::before { top: 10px; left: 3px; right: 3px; height: 2px; }
.faq summary .ico::after { left: 10px; top: 3px; bottom: 3px; width: 2px; transition: transform .25s ease; }
.faq details[open] summary .ico::after { transform: scaleY(0); }
.faq .answer { overflow: hidden; }
.faq .answer-inner { padding: 0 4px 26px; color: var(--dim); font-size: 0.98rem; line-height: 1.65; max-width: 68ch; }
.faq .answer-inner code { font-family: var(--font-mono); font-size: 0.86em; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--text); }

/* ============================================================
   Final CTA + footer
   ============================================================ */
.final { text-align: center; }
.final-card {
  background:
    radial-gradient(700px 300px at 50% -20%, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--bg-1), var(--bg));
  border: 1px solid var(--line-2); border-radius: 20px;
  padding: clamp(40px, 6vw, 72px) var(--pad);
}
.final h2 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
.final .lede { margin: 18px auto 0; }
.final .signup { margin: 32px auto 0; justify-content: center; }
.final .form-row { display: flex; flex-direction: column; align-items: center; }
.final .alt { margin-top: 16px; font-size: 0.92rem; color: var(--dim); }
.final .alt a { color: var(--accent); border-bottom: 1px solid var(--accent-line); padding-bottom: 1px; }

.disclaimer {
  max-width: 760px; margin: 40px auto 0; padding: 18px 22px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-1);
  font-family: var(--font-mono); font-size: 0.74rem; line-height: 1.7; color: var(--faint); text-align: left;
}
.disclaimer b { color: var(--dim); font-weight: 500; }

.site-foot { border-top: 1px solid var(--line); padding-block: 40px; }
.site-foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-foot .brand { font-size: 0.98rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 14px 22px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--faint); }
.foot-links a { white-space: nowrap; }
.foot-links a:hover { color: var(--text); }
.foot-links a.social { display: inline-flex; align-items: center; }
.foot-links a.social svg { display: block; transition: color .15s ease; }

/* visually-hidden but accessible to screen readers */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.foot-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--faint); }

/* footer stacks cleanly on small screens (no clipped email / broken link wraps) */
@media (max-width: 640px) {
  .site-foot .wrap { flex-direction: column; align-items: flex-start; gap: 22px; }
  .foot-links { gap: 12px 18px; }
}
@media (max-width: 380px) {
  .foot-links { gap: 10px 14px; }
  .foot-links a, .foot-meta { font-size: 0.7rem; }
}

/* ============================================================
   Scroll reveal: gated on .reveal-ready (added by JS only when
   motion is allowed). Reduced-motion / no-JS = always visible.
   ============================================================ */
.reveal-ready .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal-ready .reveal.in { opacity: 1; transform: none; }
.reveal-ready .reveal.d1 { transition-delay: .07s; }
.reveal-ready .reveal.d2 { transition-delay: .14s; }
.reveal-ready .reveal.d3 { transition-delay: .21s; }

/* motion kill-switch (Tweaks) */
.no-motion *, .no-motion *::before, .no-motion *::after { animation: none !important; transition: none !important; }

/* skip link */
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { left: 12px; }
