/* ─────────────────────────────────────────────────────────────
   Raven Sync — landing page
   Visual language: the house design system (semantic tokens + rules).
   Monospace-primary, teal workhorse + coral highlight, border-first depth.
   No web fonts: system monospace stack, exactly as the source brand ships it.
   ───────────────────────────────────────────────────────────── */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  /* light (default) */
  --bg:          #faf9f5;
  --surface:     #FFFEF8;
  --surface-ia:  #ffffff;
  --ui-surface:  #f7f6f0;
  --text:        #282728;
  --text-muted:  #5a585a;
  --border:      #e0d8c8;
  --primary:     #2e8896;
  --primary-rgb: 46, 136, 150;
  --accent:      #c76060;
  --error:       #b80037;
  --header-bg:   rgba(247, 246, 240, 0.88);
  --card-hover-bg: rgba(46, 136, 150, 0.03);

  --font-mono: ui-monospace, "SF Mono", "Consolas", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  --font-sans: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius: 6px;
  --border-w: 2px;
  --maxw: 860px;
  --pad-x: 32px;
}

/* dark tokens shared by explicit dark and system-in-dark */
:root[data-theme="dark"] {
  --bg:          #000000;
  --surface:     #0a0a09;
  --surface-ia:  #1c1b19;
  --ui-surface:  #000000;
  --text:        #eedfce;
  --text-muted:  #eedfce;
  --border:      #3f444a;
  --primary:     #4cbaba;
  --primary-rgb: 76, 186, 186;
  --accent:      #ea666b;
  --error:       #ff4d7d;
  --header-bg:   rgba(0, 0, 0, 0.85);
  --card-hover-bg: rgba(76, 186, 186, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg:          #000000;
    --surface:     #0a0a09;
    --surface-ia:  #1c1b19;
    --ui-surface:  #000000;
    --text:        #eedfce;
    --text-muted:  #eedfce;
    --border:      #3f444a;
    --primary:     #4cbaba;
    --primary-rgb: 76, 186, 186;
    --accent:      #ea666b;
    --error:       #ff4d7d;
    --header-bg:   rgba(0, 0, 0, 0.85);
    --card-hover-bg: rgba(76, 186, 186, 0.04);
  }
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Anchor targets clear the sticky header (60px + 2px border) when jumped to. */
[id] { scroll-margin-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 450;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

@media (max-width: 768px) {
  body { font-family: var(--font-sans); font-size: 17px; }
  /* the wordmark and terminal stay monospace even when body switches to sans */
  .logo-word, .terminal, code, .compare-name, .chip, .step-num { font-family: var(--font-mono); }
}

::selection { background: rgba(var(--primary-rgb), 0.25); color: var(--text); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--text-muted); }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }
h2 { font-size: 1.6em; line-height: 1.4; margin: 0 0 40px; }
h3 { font-size: 1em; margin: 0 0 8px; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(var(--primary-rgb), 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}
@media (max-width: 480px) { .container { padding: 0 16px; } }

.accent { color: var(--accent); }
.teal { color: var(--primary); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: var(--surface);
  padding: 8px 16px;
  z-index: 200;
}

/* Honeypot field: kept in the layout (NOT display:none, which some bots skip)
   but pushed offscreen so no human ever sees it. tabindex=-1 + aria-hidden keep
   it out of keyboard tab order and the accessibility tree. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ── Label (section pre-title) ─────────────────────────────── */
.label {
  font-size: 0.75em;
  font-weight: 450;
  color: var(--primary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.label::after {
  content: "\2588";
  display: inline-block;
  margin-left: 2px;
  animation: caret-blink 1s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
/* caret blink stays under reduced-motion by design (brand signature, no vestibular risk) */

/* ── Header / nav ──────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--border-w) solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
}
.logo:hover { color: var(--primary); }
.logo-mark { height: 1.5em; width: auto; color: var(--accent); flex-shrink: 0; }
/* Wordmark in text color (near-black on light, flips with the theme) — the Context Raven
   family treatment: colored bird, dark single-color name. Negative word-spacing tightens
   the monospace word gap to roughly half a character. */
.logo-word { font-family: var(--font-mono); font-size: 1.05em; color: var(--text); word-spacing: -0.35ch; }

.header-nav { display: flex; gap: 24px; margin-left: 12px; }
.header-link { font-weight: 700; font-size: 0.8em; color: var(--primary); }
.header-link:hover { color: var(--text-muted); }

.header-cta {
  margin-left: auto;
  background: var(--primary);
  color: var(--surface);
  border: var(--border-w) solid var(--primary);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.75em;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.header-cta:hover { color: var(--surface); opacity: 0.88; transform: translateY(-1px); }

.menu-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.4em;
  cursor: pointer;
  line-height: 1;
}
.mobile-nav { display: none; flex-direction: column; border-bottom: var(--border-w) solid var(--border); background: var(--ui-surface); }
.mobile-nav.open { display: flex; }
.mobile-nav .header-link { padding: 12px var(--pad-x); border-top: 1px solid var(--border); }

@media (max-width: 700px) {
  .header-nav { display: none; }
  .header-cta { margin-left: auto; }
  .menu-toggle { display: block; margin-left: 12px; }
}

/* ── Sections ──────────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-alt { background: var(--surface-ia); }
.section-lede { color: var(--text-muted); max-width: 60ch; margin: -20px 0 40px; }

@media (max-width: 768px) { .section { padding: 56px 0; } }
@media (max-width: 480px) { .section { padding: 44px 0; } }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { padding: 96px 0 80px; position: relative; overflow: hidden; }
@media (max-width: 768px) { .hero { padding: 56px 0 48px; } }
@media (max-width: 480px) { .hero { padding: 40px 0 36px; } }

/* Particle canvas sits behind hero content. pointer-events:none keeps the
   CTA/terminal fully clickable; the script listens for mousemove on .hero. */
.hero-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero > .container { position: relative; z-index: 1; }

.hero h1 { font-size: 2.2em; margin: 0 0 24px; max-width: 18ch; }
@media (max-width: 768px) { .hero h1 { font-size: 1.7em; } }
@media (max-width: 480px) { .hero h1 { font-size: 1.5em; } }

.hero-lede { font-size: 1.05em; color: var(--text); max-width: 58ch; margin: 0 0 16px; }
.hero-sub { color: var(--primary); font-size: 0.9em; margin: 0 0 32px; letter-spacing: 0.02em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }

.btn, .btn-ghost {
  display: inline-block;
  border-radius: var(--radius);
  padding: 14px 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9em;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn { background: var(--primary); color: var(--surface); border: var(--border-w) solid var(--primary); }
.btn:hover { color: var(--surface); opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--primary); border: var(--border-w) solid var(--border); }
.btn-ghost:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), 0.5); transform: translateY(-1px); }

@media (max-width: 520px) {
  .hero-actions { flex-direction: column; }
  .btn, .btn-ghost { width: 100%; text-align: center; }
}

/* ── Terminal block ────────────────────────────────────────── */
.terminal {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 16px;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: var(--border-w) solid var(--border);
  background: var(--surface-ia);
}
.terminal-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.terminal-title { margin-left: 8px; font-size: 0.7em; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.terminal-body {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8em;
  line-height: 1.7;
}
.terminal-body code { background: none; padding: 0; font-size: 1em; }
.t-prompt { color: var(--accent); font-weight: 700; }
.t-cmd { color: var(--text); }
.t-dim { color: var(--text-muted); }
.t-ok { color: var(--primary); font-weight: 700; }
/* assistant-conversation roles in the hero terminal */
.t-you { color: var(--accent); font-weight: 700; }
.t-agent { color: var(--primary); font-weight: 700; }
.t-say { color: var(--text); }

.hero-note { font-size: 0.75em; color: var(--text-muted); max-width: 60ch; }
/* hero story: the CEO's question between the knowledge-base window (beat 1)
   and the assistant conversation that answers it (beat 3) */
.hero-question {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 16px;
  margin: 20px 0;
  max-width: 62ch;
  font-size: 0.95em;
  font-weight: 700;
}
/* the big turn: the answer to the question above, leading into the demo */
.hero-answer { font-size: 1.6em; font-weight: 700; line-height: 1.3; margin: 24px 0; max-width: 28ch; }
.hero-answer-brand { color: var(--primary); }
.hero-answer-kb { color: var(--accent); }
@media (max-width: 768px) { .hero-answer { font-size: 1.3em; } }

/* ── Steps ─────────────────────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px 24px;
}
.step-num {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: var(--border-w) solid rgba(var(--primary-rgb), 0.25);
  background: rgba(var(--primary-rgb), 0.05);
  border-radius: var(--radius);
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 16px;
}
.step p { color: var(--text-muted); margin: 0; font-size: 0.9em; }
@media (max-width: 768px) { .steps { grid-template-columns: 1fr; } }

/* ── Vault data-flow scene ─────────────────────────────────── */
.flow-scene { margin: 0 0 48px; overflow-x: auto; }
#flow-svg {
  display: block;
  width: 100%;
  min-width: 600px;      /* narrower than this and the scene scrolls, labels stay legible */
  max-width: 780px;
  height: auto;
  margin: 0 auto;
  color: var(--text);
}
/* class selector on purpose: an #flow-svg id rule would out-rank every per-class
   text color below (.node-title teal, .tag-edit coral, ...) */
.flow-scene text { font-family: var(--font-mono); font-size: 15px; fill: var(--text); }
.flow-scene .wire { fill: none; stroke: var(--border); stroke-width: 2; }
.flow-scene .node rect { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.flow-scene .node-server rect { fill: var(--card-hover-bg); }
.flow-scene .node-title { fill: var(--primary); font-weight: 700; }
.flow-scene .node-sub { fill: var(--text-muted); font-size: 12px; }
.flow-scene .node-tree { fill: var(--text); font-size: 13px; }
.flow-scene .node-inner rect { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
/* read/edit rights as tag chips pinned to the member box's right edge (own opaque
   fill so the border line never shows through the label) */
.flow-scene .tag text { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.flow-scene .tag rect { fill: var(--surface); stroke-width: 1.5; }
.flow-scene .tag-edit rect { stroke: var(--accent); }
.flow-scene .tag-edit text { fill: var(--accent); }
.flow-scene .tag-read rect { stroke: var(--text-muted); }
.flow-scene .tag-read text { fill: var(--text-muted); }
.flow-scene .acl-lock rect { fill: var(--accent); }
.flow-scene .acl-lock .shackle { fill: none; stroke: var(--accent); stroke-width: 2; }
.flow-scene .acl-lock text { fill: var(--accent); font-size: 11px; font-weight: 700; }
/* dots are injected by js/vault-flow.js; colors follow the theme via CSS vars */
.flow-scene .dot-teal { fill: var(--primary); }
.flow-scene .dot-coral { fill: var(--accent); }
.flow-scene .merge-ring { fill: none; stroke: var(--primary); stroke-width: 2; }
.flow-caption { color: var(--text-muted); font-size: 0.78em; text-align: center; margin: 16px 0 0; }
/* the ACL lock is static-complete: its transform is hardcoded in the markup, so it is
   visible on the wire with JS off (no opacity gating, no flash-at-0,0 workaround). */

/* ── Feature grid ──────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px 24px;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: var(--card-hover-bg);
  transform: translateY(-2px);
}
.card p { color: var(--text-muted); margin: 0; font-size: 0.9em; }
.card code { font-size: 0.8em; }
@media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }

/* ── Compare rows ──────────────────────────────────────────── */
.compare { display: flex; flex-direction: column; gap: 16px; }
.compare-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: baseline;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.compare-row:hover { border-color: rgba(var(--primary-rgb), 0.5); transform: translateY(-2px); }
.compare-name { font-weight: 700; color: var(--primary); }
.compare-text { color: var(--text-muted); font-size: 0.9em; }
@media (max-width: 640px) {
  .compare-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ── Chips (works-with) ────────────────────────────────────── */
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }
/* Intro line of the file-types block: clear the (possibly wrapped) chips row above. */
.filetypes-lede { margin-top: 32px; }
.chip {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.85em;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.chip:hover { border-color: rgba(var(--primary-rgb), 0.5); color: var(--primary); }

/* ── Offer cards ───────────────────────────────────────────── */
.offer { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 40px; }
.offer-card {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px 24px;
}
.offer-card p { color: var(--text-muted); margin: 0; font-size: 0.9em; }
.offer-card .offer-cta { margin-top: 20px; cursor: pointer; }
@media (max-width: 640px) { .offer { grid-template-columns: 1fr; } }

/* ── Form ──────────────────────────────────────────────────── */
.access-form {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface); /* the section behind it is surface-ia (white) now */
  padding: 32px;
  position: relative;
}
.access-form::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.6;
  border-radius: var(--radius) var(--radius) 0 0;
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
/* min-width:0 lets each 1fr track shrink below the control's intrinsic width;
   without it a grid/flex item's default min-width:auto pins the track to the
   input's ~20ch intrinsic size and the last column overflows the form. */
.form-grid > .field { min-width: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .access-form { padding: 24px; } }

.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;              /* pair with the track fix so the control fills, never overflows */
  background: var(--surface-ia);
  color: var(--text);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
/* native select: strip the platform chrome, add a themed caret, match the inputs */
.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%), linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
@media (max-width: 768px) { .field input, .field textarea, .field select { font-family: var(--font-sans); } }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}
.field textarea { resize: vertical; }

.form-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.access-form button[type="submit"] {
  background: var(--primary);
  color: var(--surface);
  border: var(--border-w) solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9em;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.access-form button[type="submit"]:hover { opacity: 0.88; transform: translateY(-1px); }
.access-form button[type="submit"]:disabled { opacity: 0.5; cursor: default; transform: none; }
.form-note { font-size: 0.78em; color: var(--text-muted); margin: 0; }
.form-note.is-error { color: var(--error); }
.form-note.is-ok { color: var(--primary); }
.form-note a { color: var(--primary); text-decoration: underline; }
@media (max-width: 520px) { .access-form button[type="submit"] { width: 100%; } }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: var(--border-w) solid var(--border);
  background: var(--ui-surface);
  padding: 40px 0;
}
.footer-inner { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.footer-trust { color: var(--text-muted); font-size: 0.8em; margin: 0; }
.footer-meta { display: flex; align-items: center; gap: 16px; font-size: 0.75em; color: var(--text-muted); margin-top: 8px; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  color: var(--text-muted);
  font-size: 0.95em;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { border-color: rgba(var(--primary-rgb), 0.5); color: var(--primary); }

/* ── Reveal animations (curated reduce-motion: kept) ───────── */
.reveal { opacity: 0; transform: translateY(20px); animation: reveal-in 0.6s ease forwards; }
.reveal-d1 { animation-delay: 0.1s; }
.reveal-d2 { animation-delay: 0.25s; }
.reveal-d3 { animation-delay: 0.4s; }
.reveal-d4 { animation-delay: 0.55s; }
@keyframes reveal-in { to { opacity: 1; transform: translateY(0); } }

/* Hidden initial state is gated behind `.js` (set before paint by the head
   script): with JS off, sections are never hidden and stay fully visible. */
.section-reveal { transition: opacity 0.5s ease, transform 0.5s ease; }
.js .section-reveal { opacity: 0; transform: translateY(24px); }
.js .section-reveal.visible { opacity: 1; transform: translateY(0); }

/* No blanket reduce-motion kill. Reveals, hovers, theme swaps and the caret
   are all in the "keep" column per the curated reduce-motion policy. */
