/* ─────────────────────────────────────────────────────────────────────────────
   Reson8 — marketing & docs site
   Design language: "Precision Instrument" (mirrors reson8_app/lib/ui/theme/).
   Rules: surfaces are lit, not flat · glow is reserved for live signal ·
   mint/amber/red mean tuning state and are never decorative.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Fonts (bundled, same faces the app ships) ─────────────────────────────── */
@font-face { font-family: 'Space Grotesk'; src: url('assets/fonts/SpaceGrotesk-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('assets/fonts/SpaceGrotesk-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('assets/fonts/SpaceGrotesk-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url('assets/fonts/InterTight-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url('assets/fonts/InterTight-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url('assets/fonts/InterTight-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url('assets/fonts/InterTight-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('assets/fonts/JetBrainsMono-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('assets/fonts/JetBrainsMono-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('assets/fonts/JetBrainsMono-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ── Tokens (R8) ───────────────────────────────────────────────────────────── */
:root {
  --bg: #06070A;
  --bg-raised: #0C0F15;
  --bg-sunken: #040508;
  --panel-hi: rgba(255, 255, 255, 0.043);
  --panel-lo: rgba(255, 255, 255, 0.012);
  --line: rgba(255, 255, 255, 0.075);
  --line-soft: rgba(255, 255, 255, 0.043);
  --edge: rgba(255, 255, 255, 0.07);
  --txt: #EAF0F7;
  --txt2: #8C97A8;
  --txt3: #586274;
  --good: #2EF2B3;
  --near: #FFB224;
  --bad: #FF5B6E;
  --ice: #5CC8FF;
  --violet: #8B7BFF;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --ui: 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --maxw: 1120px;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(92, 200, 255, 0.25); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Section kicker: the small machined label above every section title */
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--txt3);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.kicker::before { content: ''; width: 26px; height: 1px; background: var(--txt3); opacity: 0.6; }

.section { padding: 104px 0; }
.section-title { font-size: clamp(28px, 4.2vw, 42px); margin-bottom: 16px; }
.section-lede { color: var(--txt2); font-size: 17.5px; max-width: 640px; }

/* ── Panel: the milled-part surface ────────────────────────────────────────── */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel-lo)), var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.65);
}
.panel::before {
  /* 1px specular highlight along the top edge */
  content: '';
  position: absolute;
  inset: 0 10px auto 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--edge), transparent);
  pointer-events: none;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  padding: 13px 26px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ice); color: #04202F; }
.btn-primary:hover { background: #7dd4ff; }
.btn-ghost { border-color: var(--line); color: var(--txt); background: linear-gradient(180deg, var(--panel-hi), var(--panel-lo)); }
.btn-ghost:hover { border-color: rgba(92, 200, 255, 0.45); }
.btn-lg { padding: 16px 32px; font-size: 16px; }

/* ── Nav ───────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(6, 7, 10, 0.78);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--txt); }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: 0.14em; }
.nav-links { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.nav-links a { color: var(--txt2); font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--txt); text-decoration: none; }
.nav-links a.active { color: var(--txt); }
.nav-cta { margin-left: 8px; padding: 9px 18px; font-size: 14px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--txt); cursor: pointer; }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero { padding: 168px 0 96px; position: relative; overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: 64px;
  align-items: center;
}
.hero h1 { font-size: clamp(38px, 5.2vw, 58px); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 22px; }
.hero-sub { color: var(--txt2); font-size: 18px; max-width: 520px; margin-bottom: 34px; }
.hero-sub strong { color: var(--txt); font-weight: 600; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-platforms { margin-top: 22px; font-size: 13.5px; color: var(--txt3); }
.hero-platforms a { color: var(--txt3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(88, 98, 116, 0.5); }
.hero-platforms a:hover { color: var(--txt2); }

/* The live instrument panel in the hero */
.tuner { padding: 22px 22px 18px; }
.tuner-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.tuner-note { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; }
.tuner-note sub { font-size: 0.45em; font-weight: 600; color: var(--txt2); }
.tuner-freq { font-family: var(--mono); font-size: 15px; color: var(--txt2); }
.tuner-string { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--txt3); text-transform: uppercase; margin-bottom: 10px; }
.tuner-cents { font-family: var(--mono); font-weight: 700; font-size: 22px; text-align: center; margin-top: 10px; }
.tuner-status { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-align: center; color: var(--txt3); margin-top: 2px; text-transform: uppercase; }
#strobe { width: 100%; aspect-ratio: 1.55; }
#spectrum { width: 100%; height: 64px; margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }

/* ── Stats strip ───────────────────────────────────────────────────────────── */
.stats {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-sunken);
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0;
}
.stat-num { font-family: var(--mono); font-weight: 700; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.01em; }
.stat-label { color: var(--txt3); font-size: 13px; margin-top: 6px; line-height: 1.45; }

/* ── Feature grid ──────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card { padding: 26px; }
.card h3 { font-size: 19px; margin: 16px 0 10px; }
.card p { color: var(--txt2); font-size: 14.5px; line-height: 1.65; }
.card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-hi), transparent);
  display: flex; align-items: center; justify-content: center;
  color: var(--txt2);
}
.card-icon svg { width: 22px; height: 22px; }

/* ── Instrument rows ───────────────────────────────────────────────────────── */
.inst { padding: 30px 30px 26px; }
.inst h3 { font-size: 21px; margin-bottom: 10px; }
.inst p { color: var(--txt2); font-size: 15px; }
.inst-tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--txt3);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 8px; display: inline-block; margin-bottom: 14px;
}
.inst ul { list-style: none; margin-top: 14px; }
.inst li { color: var(--txt2); font-size: 14px; padding-left: 20px; position: relative; margin-bottom: 7px; }
.inst li::before { content: ''; position: absolute; left: 0; top: 9px; width: 8px; height: 1px; background: var(--txt3); }

/* ── Piano feature section ─────────────────────────────────────────────────── */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; align-items: start; }
.checklist { list-style: none; margin-top: 26px; }
.checklist li { display: flex; gap: 14px; margin-bottom: 18px; color: var(--txt2); font-size: 15px; }
.checklist li strong { color: var(--txt); display: block; font-weight: 600; margin-bottom: 2px; }
.checklist .tick {
  flex: none; width: 22px; height: 22px; margin-top: 2px;
  border-radius: 6px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--txt2);
}
.checklist .tick svg { width: 12px; height: 12px; }

/* Railsback figure */
.figure { padding: 24px; }
.figure-caption { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--txt3); margin-top: 14px; text-align: center; }

/* ── Design section ────────────────────────────────────────────────────────── */
.principles { counter-reset: p; margin-top: 8px; }
.principle { border-top: 1px solid var(--line-soft); padding: 26px 0; display: grid; grid-template-columns: 72px 220px 1fr; gap: 24px; align-items: baseline; }
.principle:last-child { border-bottom: 1px solid var(--line-soft); }
.principle-num { font-family: var(--mono); color: var(--txt3); font-size: 13px; }
.principle h3 { font-size: 18px; }
.principle p { color: var(--txt2); font-size: 15px; }

/* ── CTA band ──────────────────────────────────────────────────────────────── */
.cta-band { text-align: center; padding: 110px 0; }
.cta-band h2 { font-size: clamp(30px, 4.4vw, 46px); margin-bottom: 16px; }
.cta-band p { color: var(--txt2); font-size: 17px; margin-bottom: 34px; }
.cta-band .hero-ctas { justify-content: center; }

/* ── Store badges (download funnel) ────────────────────────────────────────── */
.store-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 34px; }
.store {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px;
  color: var(--txt);
  transition: border-color 0.15s ease;
}
a.store:hover { text-decoration: none; border-color: rgba(92, 200, 255, 0.5); }
.store-icon { flex: none; width: 40px; height: 40px; color: var(--txt2); }
.store-icon svg { width: 100%; height: 100%; }
.store-kicker { display: block; font-size: 12px; color: var(--txt3); letter-spacing: 0.04em; }
.store-name { display: block; font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 1.25; }
.store-note { display: block; font-family: var(--mono); font-size: 11px; color: var(--txt3); margin-top: 3px; }
.store.soon { opacity: 0.75; cursor: default; }
.store.soon .store-name { color: var(--txt2); }
.soon-flag {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--txt3); border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 8px; flex: none;
}
.detected {
  margin-top: 40px;
  padding: 28px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.detected-copy { flex: 1 1 300px; }
.detected-copy h3 { font-size: 20px; margin-bottom: 6px; }
.detected-copy p { color: var(--txt2); font-size: 14.5px; }

/* ── Docs layout ───────────────────────────────────────────────────────────── */
.docs-wrap {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  padding-top: 118px;
  padding-bottom: 96px;
}
.docs-sidebar { position: sticky; top: 98px; align-self: start; max-height: calc(100vh - 130px); overflow-y: auto; }
.docs-sidebar h4 {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--txt3);
  margin: 22px 0 10px;
}
.docs-sidebar h4:first-child { margin-top: 0; }
.docs-sidebar a { display: block; color: var(--txt2); font-size: 14px; padding: 5px 0 5px 12px; border-left: 1px solid var(--line-soft); }
.docs-sidebar a:hover { color: var(--txt); text-decoration: none; }
.docs-sidebar a.current { color: var(--ice); border-left-color: var(--ice); }

.docs-content h1 { font-size: 38px; margin-bottom: 14px; }
.docs-content .lede { color: var(--txt2); font-size: 17px; margin-bottom: 8px; }
.docs-content section { border-top: 1px solid var(--line-soft); margin-top: 44px; padding-top: 38px; }
.docs-content h2 { font-size: 26px; margin-bottom: 16px; }
.docs-content h3 { font-size: 18.5px; margin: 28px 0 10px; }
.docs-content p { color: var(--txt2); font-size: 15.5px; margin-bottom: 14px; max-width: 72ch; }
.docs-content p strong, .docs-content li strong { color: var(--txt); font-weight: 600; }
.docs-content ul, .docs-content ol { margin: 0 0 16px 22px; color: var(--txt2); font-size: 15.5px; }
.docs-content li { margin-bottom: 8px; max-width: 70ch; }
.docs-content code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 2px 6px;
  color: var(--txt);
}
.docs-content pre {
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 16px 18px; overflow-x: auto;
  margin-bottom: 16px;
}
.docs-content pre code { background: none; border: none; padding: 0; font-size: 13.5px; line-height: 1.6; color: var(--txt2); }
.docs-content table { border-collapse: collapse; width: 100%; margin-bottom: 16px; font-size: 14.5px; }
.docs-content th { text-align: left; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--txt3); font-weight: 500; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); }
.docs-content td { color: var(--txt2); padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.docs-content td:first-child { color: var(--txt); }
.callout {
  border: 1px solid var(--line); border-left: 2px solid var(--ice);
  border-radius: 10px; background: var(--bg-raised);
  padding: 16px 20px; margin: 20px 0; font-size: 14.5px; color: var(--txt2);
  max-width: 72ch;
}
.callout strong { color: var(--txt); }

/* Keyboard / state chips used in docs */
.state { font-family: var(--mono); font-size: 0.82em; font-weight: 700; letter-spacing: 0.06em; }
.state-good { color: var(--good); }
.state-near { color: var(--near); }
.state-bad { color: var(--bad); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line-soft); background: var(--bg-sunken); padding: 56px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 44px; }
.footer h4 { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--txt3); margin-bottom: 14px; }
.footer a { display: block; color: var(--txt2); font-size: 14px; margin-bottom: 9px; }
.footer a:hover { color: var(--txt); text-decoration: none; }
.footer-brand p { color: var(--txt3); font-size: 13.5px; max-width: 300px; margin-top: 14px; }
.footer-legal { border-top: 1px solid var(--line-soft); padding-top: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--txt3); font-size: 13px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero { padding-top: 130px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; gap: 40px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .principle { grid-template-columns: 48px 1fr; }
  .principle p { grid-column: 2; }
  .docs-wrap { grid-template-columns: 1fr; gap: 12px; }
  .docs-sidebar { position: static; max-height: none; border: 1px solid var(--line-soft); border-radius: 12px; padding: 18px 20px; margin-bottom: 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-links {
    display: none;
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 4px;
    background: rgba(6, 7, 10, 0.97);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; font-size: 16px; }
  .nav-cta { margin: 10px 0 0; }
  .nav-toggle { display: block; }
  .grid-3, .grid-2, .store-grid { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
