/* Kahle.AI — "Signal from Noise" redesign.
   Single-green (#a4d47c) on near-black (#121212). Self-contained: no CDNs,
   no external requests, no trackers. See docs/superpowers/design-system/. */

/* ---- fonts (self-hosted, OFL) -------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-500.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-700.woff2") format("woff2");
}

/* ---- tokens --------------------------------------------------------- */
:root {
  /* Locked brand palette */
  --brand-green: #a4d47c;
  --brand-black: #121212;
  --brand-white: #ffffff;

  /* Derived dark surfaces (restrained, no gradients) */
  --bg: #121212;
  --surface: #181818;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #e7e7e7;
  --text-strong: #ffffff;
  --muted: #9a9a9a;
  --accent: var(--brand-green);
  --accent-soft: rgba(164, 212, 124, 0.14);
  --accent-line: rgba(164, 212, 124, 0.30);

  /* Type */
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;

  /* Spacing (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  --maxw: 960px;
  --measure: 62ch;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* ---- reset & base --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-snap-type: y mandatory;   /* deliberate: each panel locks to the screen */
  scroll-padding-top: 72px;        /* keep snapped panel tops clear of the sticky header */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text-strong);
  line-height: 1.15;
  margin: 0 0 var(--s-4);
  font-weight: 700;
}
h1 { font-size: clamp(2.05rem, 4.4vw, 2.95rem); letter-spacing: -0.02em; }
h2.section-h { font-size: clamp(1.6rem, 3.5vw, 2.1rem); letter-spacing: -0.015em; font-weight: 500; }
h3 { font-size: 1.375rem; letter-spacing: -0.01em; font-weight: 500; margin-bottom: var(--s-2); }
p { margin: 0 0 var(--s-4); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { color: var(--text-strong); font-weight: 600; }
em { color: var(--text-strong); font-style: italic; }

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

img { max-width: 100%; height: auto; display: block; }

/* ---- layout --------------------------------------------------------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
main > section { padding-block: clamp(64px, 9vw, 112px); position: relative; }
.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--text); }
.prose .lead { color: var(--muted); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s-3);
}
.lead { color: var(--muted); font-size: 1.1875rem; line-height: 1.55; }

/* ---- orbit divider (motif) ----------------------------------------- */
.orbit-divider {
  height: 1px; border: 0; margin: 0; width: 100%;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1.5px);
  background-size: 10px 1px; background-repeat: repeat-x;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}

/* ---- buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  cursor: pointer; font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); padding: 13px 22px;
  border: 1px solid transparent;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
  min-height: 44px; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 9px 16px; min-height: 0; font-size: 0.95rem; }
.btn-primary { background: var(--brand-green); color: var(--brand-black); }
.btn-primary:hover { background: #b6e090; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--brand-green); border-color: var(--accent-line); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--brand-green); }

/* ---- header --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 14px;
}
.brand { display: inline-flex; align-items: center; }
.wordmark { height: 24px; width: auto; display: block; }

/* Header CTA: hidden while the hero chat is on screen, revealed on scroll (JS only). */
html.js .site-header .header-cta {
  opacity: 0; transform: translateY(-6px); visibility: hidden;
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
html.js .site-header.show-cta .header-cta {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity .25s ease, transform .25s ease, visibility 0s;
}

/* ---- section dot navigation ---------------------------------------- */
.dotnav {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 14px;
}
.dot { position: relative; display: block; width: 14px; height: 14px; }
.dot::before {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  background: var(--muted); opacity: 0.45;
  transition: opacity .2s ease, background-color .2s ease, transform .2s ease;
}
.dot:hover::before, .dot:focus-visible::before { opacity: 1; background: var(--brand-green); }
.dot.active::before { opacity: 1; background: var(--brand-green); transform: scale(1.4); }
.dot-label {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: 0.78rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.dot:hover .dot-label, .dot:focus-visible .dot-label { opacity: 1; }
@media (max-width: 600px) {
  .dotnav { right: 8px; gap: 11px; }
  .dot { width: 12px; height: 12px; }
  .dot-label { display: none; }
}

/* ---- full-viewport panels + snap ----------------------------------- */
.panel {
  min-height: calc(100svh - 72px);
  scroll-snap-align: start;
  display: flex; flex-direction: column; justify-content: center;
  padding-block: var(--s-6);
}
/* second block inside a merged panel gets breathing room */
.panel .note-block { margin-top: var(--s-6); }
.about-block { margin-top: var(--s-6); }

/* ---- hero (emblem centerpiece, fills viewport above the fold) ------ */
.hero {
  overflow: hidden;
  min-height: calc(100svh - 72px);
  scroll-snap-align: start;
  display: flex; align-items: center;
  padding-block: var(--s-4);
}
.hero-content {
  position: relative; z-index: 1; max-width: 760px; margin-inline: auto;
  text-align: center; display: flex; flex-direction: column; align-items: center;
}
.hero-emblem { width: auto; height: clamp(200px, min(42vh, 84vw), 400px); margin-bottom: var(--s-4); }
.hero h1 { margin-bottom: var(--s-6); }

/* mock chat input (non-typing; click → SMS on phones, intake form on desktop) */
.chatbox {
  display: flex; align-items: center; gap: var(--s-3);
  width: min(520px, 100%); margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 10px 10px 10px 20px;
  text-align: left; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.chatbox:hover { border-color: var(--accent-line); transform: translateY(-1px); text-decoration: none; }
.chatbox-text { flex: 1 1 auto; color: var(--muted); font-size: 1.05rem; }
.chatbox-send {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-green); color: var(--brand-black);
  transition: background-color .18s ease;
}
.chatbox:hover .chatbox-send { background: #b6e090; }
.cta-note { color: var(--muted); font-size: 0.95rem; max-width: 40ch; }
.hero .cta-note { margin: var(--s-3) auto 0; }

/* ---- the problem ---------------------------------------------------- */
.pains { list-style: none; padding: 0; margin: 0 0 var(--s-5); display: grid; gap: var(--s-2); }
.pains li { position: relative; padding-left: 28px; color: var(--text); }
.pains li::before {
  content: ""; position: absolute; left: 4px; top: 0.65em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-green); opacity: 0.85;
}
.callout {
  margin: 0; padding: var(--s-4); border-left: 2px solid var(--brand-green);
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-strong); font-size: 1.05rem;
}

/* ---- ladder --------------------------------------------------------- */
.ladder { list-style: none; padding: 0; margin: var(--s-5) 0 var(--s-4); display: grid; gap: var(--s-3); }
.rung {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-4) var(--s-5) var(--s-4) var(--s-6);
}
.rung::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-green); border-radius: var(--radius) 0 0 var(--radius);
}
.rung .step {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--s-2);
}
.rung p { margin: 0; color: var(--text); }
.rung.optional { background: transparent; }
.rung.optional::before { opacity: 0.4; }
.rung.optional h3 { color: var(--muted); }
.ladder-note { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ---- security points ------------------------------------------------ */
.points { list-style: none; padding: 0; margin: var(--s-4) 0 0; display: grid; gap: var(--s-4); }
.points li { position: relative; padding-left: 30px; }
.points li::before {
  content: ""; position: absolute; left: 2px; top: 0.35em;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--brand-green); background: var(--accent-soft);
}

/* ---- meta-demo (understated) --------------------------------------- */
.note-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-6);
}
.note-block h2 { font-size: 1.5rem; }

/* ---- example -------------------------------------------------------- */
.example {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-6); max-width: none;
}
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: var(--s-4);
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); margin-top: var(--s-5); }
.split .k {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2);
}
.split > div { color: var(--text-strong); }

/* ---- form ----------------------------------------------------------- */
.contact .lead { margin-bottom: var(--s-4); }
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-5); box-shadow: var(--shadow);
  max-width: 620px;
}
.field { margin-bottom: var(--s-3); }
.field label { display: block; margin-bottom: 6px; color: var(--text-strong); font-weight: 500; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text-strong);
  background: var(--brand-black); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 14px; min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-4); }
.reassure { color: var(--muted); font-size: 0.9rem; max-width: 40ch; }
.form-status { margin: var(--s-4) 0 0; font-size: 0.95rem; min-height: 1.2em; }
.form-status.ok { color: var(--brand-green); }
.form-status.err { color: #e8896b; }
/* two-column fields on wider screens so the contact panel fits one screen */
@media (min-width: 640px) {
  #intake { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-4); }
  #intake .field-wide,
  #intake .form-foot,
  #intake .form-status { grid-column: 1 / -1; }
}

/* ---- footer (dark sign-off) ---------------------------------------- */
.site-footer { background: var(--bg); color: var(--text); padding-block: var(--s-7); border-top: 1px solid var(--border); }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  justify-content: space-between; align-items: center;
}
.footer-brand { display: flex; flex-direction: column; gap: var(--s-3); }
.wordmark-foot { height: 22px; }
.footer-brand p { margin: 0; color: var(--text); }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 2px; }
.privacy { color: var(--muted); font-size: 0.85rem; max-width: 42ch; text-align: right; margin: 0; }

/* ---- scroll reveal (progressive enhancement, motion-safe) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease-out, transform .5s ease-out; }
  html.js .reveal.is-visible { opacity: 1; transform: none; }
}

/* ---- responsive ----------------------------------------------------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wordmark { height: 16px; }
  .site-header .wrap { padding-inline: 16px; }
  .split { grid-template-columns: 1fr; }
  .cta-note { max-width: none; }
  .privacy { text-align: left; }
  .site-footer .wrap { flex-direction: column; }
}
