/* Advance Guide — site stylesheet
   Palette mirrors the iOS app (tokens.jsx canonicalLight/canonicalDark). */
:root {
  --bg: #F4EFE6;
  --surface: #FBF7EE;
  --primary: #1F4034;
  --primary-deep: #13261E;
  --accent: #A06A2C;
  --accent-soft: #E5C9A0;
  --text: #1A1714;
  --text-muted: #6B5F50;
  --text-faint: #9A8E7C;
  --rule: #D9CFBE;
  --rule-soft: #E8DFCE;
  --band-healthy: #3F6F4E;
  --band-watch: #A06A2C;
  --band-tight: #A33B2A;
  --shadow: 0 6px 22px -14px rgba(20, 15, 8, 0.25);
  --serif: 'Crimson Pro', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', 'Menlo', 'Monaco', 'Cascadia Mono', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}
[data-theme="dark"] {
  --bg: #14110D;
  --surface: #1F1B15;
  --primary: #7BB098;
  --primary-deep: #A8D2BD;
  --accent: #D9A766;
  --accent-soft: #5C4525;
  --text: #F1EADD;
  --text-muted: #B8AC97;
  --text-faint: #7A7060;
  --rule: #33291E;
  --rule-soft: #241F19;
  --band-healthy: #7BB098;
  --band-watch: #D9A766;
  --band-tight: #E18472;
  --shadow: 0 6px 22px -10px rgba(0, 0, 0, 0.55);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  transition: background 240ms ease, color 240ms ease;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Topbar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 0.5px solid var(--rule);
}
.topbar-inner {
  display: flex; align-items: center; gap: 16px;
  height: 60px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-family: var(--serif);
  font-weight: 700; font-size: 22px; letter-spacing: -0.4px;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand .name {
  color: var(--text);
  white-space: nowrap;
}
.brand .dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--accent);
  display: inline-block;
  align-self: center;
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}
.brand small {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px;
  color: var(--text-muted); text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .brand small { display: none; }
  .brand { font-size: 19px; }
}
.nav {
  display: flex; gap: 22px;
  font-family: var(--sans);
  font-size: 14px; font-weight: 500;
}
.nav a {
  color: var(--text-muted);
  transition: color 160ms ease;
  position: relative;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.cta {
  color: var(--bg);
  background: var(--primary);
  padding: 8px 14px; border-radius: 999px;
  font-weight: 600;
  transition: transform 160ms ease, background 160ms ease;
}
.nav a.cta:hover { transform: translateY(-1px); background: var(--primary-deep); }
.theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0.5px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  transition: transform 160ms ease;
}
.theme-toggle:hover { transform: rotate(15deg); }
.theme-toggle svg { width: 18px; height: 18px; color: var(--text); }
.menu-btn {
  display: none;
  width: 38px; height: 38px;
  border: 0.5px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}
.menu-btn svg { width: 18px; height: 18px; color: var(--text); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  padding: 64px 0 48px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(closest-side, var(--accent-soft) 0%, transparent 70%);
  opacity: 0.45;
  z-index: 0;
  pointer-events: none;
  animation: float 18s ease-in-out infinite alternate;
}
[data-theme="dark"] .hero::before { opacity: 0.3; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.02; letter-spacing: -1.2px;
  font-weight: 600;
  margin: 18px 0 22px;
}
.hero p.lead {
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 540px;
  margin-bottom: 30px;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 15px; font-weight: 600;
  border: none;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { color: var(--bg); background: var(--primary); }
.btn-primary:hover { background: var(--primary-deep); }
.btn-ghost { color: var(--text); background: var(--surface); border: 0.5px solid var(--rule); }
.btn .arr { transition: transform 160ms ease; }
.btn:hover .arr { transform: translateX(3px); }

/* Hero card — interactive APR mini-bench */
.bench-card {
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
}
.bench-card .row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.bench-card .big {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text);
}
.bench-card .units { font-size: 16px; color: var(--text-muted); margin-left: 6px; }
.band {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px; font-weight: 600;
  border: 0.5px solid;
}
.band .pip {
  width: 6px; height: 6px; border-radius: 999px;
}
.band-healthy { color: var(--band-healthy); background: color-mix(in srgb, var(--band-healthy) 12%, transparent); border-color: color-mix(in srgb, var(--band-healthy) 35%, transparent); }
.band-healthy .pip { background: var(--band-healthy); }
.band-watch { color: var(--band-watch); background: color-mix(in srgb, var(--band-watch) 12%, transparent); border-color: color-mix(in srgb, var(--band-watch) 35%, transparent); }
.band-watch .pip { background: var(--band-watch); }
.band-tight { color: var(--band-tight); background: color-mix(in srgb, var(--band-tight) 12%, transparent); border-color: color-mix(in srgb, var(--band-tight) 35%, transparent); }
.band-tight .pip { background: var(--band-tight); }
.bench-card .input-row {
  display: grid; gap: 6px;
  margin-top: 16px;
}
.bench-card .input-row label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bench-card input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--rule);
  border-radius: 999px;
  outline: none;
}
.bench-card input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.bench-card input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 999px;
  cursor: pointer;
}
.steppers {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px;
}
.stepper {
  display: flex; align-items: center;
  border: 0.5px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  height: 38px;
}
.stepper button {
  width: 38px; height: 38px;
  background: transparent; border: none;
  font-size: 18px; font-weight: 600; color: var(--text);
}
.stepper button:active { background: var(--rule-soft); }
.stepper .val {
  flex: 1; text-align: center;
  font-family: var(--mono);
  font-size: 14px; font-weight: 600;
  color: var(--text);
}
.formula {
  margin-top: 14px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--accent);
  word-break: break-word;
}

/* ── Sections ─────────────────────────────────────────────────────────── */
section {
  padding: 64px 0;
  border-top: 0.5px solid var(--rule);
}
section h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05; letter-spacing: -0.6px;
  font-weight: 600;
  margin: 14px 0 18px;
}
section p.intro {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 640px;
  margin: 0 0 36px;
}

/* Tabs grid (the four screens of the app) */
.tabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.tab-card {
  position: relative;
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 14px;
  padding: 22px;
  transition: transform 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
  overflow: hidden;
}
.tab-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 60%);
  opacity: 0; transition: opacity 240ms ease;
  pointer-events: none;
}
.tab-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.tab-card:hover::before { opacity: 1; }
.tab-card .num {
  font-family: var(--serif);
  font-size: 36px; font-weight: 600;
  color: var(--accent); line-height: 1;
}
.tab-card h3 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 600;
  margin: 8px 0 10px;
  letter-spacing: -0.3px;
}
.tab-card p {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5; margin: 0;
}
.tab-card .sigil {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--mono); font-size: 11px;
  color: var(--accent);
  background: var(--bg);
  padding: 4px 9px;
  border: 0.5px solid var(--rule);
  border-radius: 4px;
}

/* Concepts list */
.concepts-list { display: grid; gap: 10px; margin-top: 32px; }
.concept-row {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 18px; align-items: center;
  padding: 18px 22px;
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 12px;
  transition: border-color 200ms ease, transform 200ms ease;
}
.concept-row:hover { border-color: var(--accent); transform: translateX(3px); }
.concept-row .n {
  font-family: var(--serif); font-size: 28px; font-weight: 600;
  color: var(--accent); line-height: 1;
}
.concept-row .body { display: grid; gap: 4px; }
.concept-row h4 {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  margin: 0; letter-spacing: -0.2px;
}
.concept-row .desc { font-size: 14px; color: var(--text-muted); margin: 0; }
.concept-row .sigil {
  font-family: var(--mono); font-size: 11px;
  color: var(--accent);
  background: var(--bg);
  padding: 4px 9px;
  border: 0.5px solid var(--rule);
  border-radius: 4px;
  white-space: nowrap;
}

/* Stats / scope */
.scope-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 32px;
}
.scope-tile {
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 12px;
  padding: 18px;
}
.scope-tile .big {
  font-family: var(--serif); font-size: 36px; font-weight: 600;
  letter-spacing: -1px; color: var(--text); line-height: 1;
}
.scope-tile .lbl {
  font-size: 13px; color: var(--text-muted); margin-top: 4px;
}
.scope-tile .sub {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-faint); letter-spacing: 0.6px;
  text-transform: uppercase; margin-top: 4px;
}

/* Disclaimer / strip */
.disclaimer-strip {
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
  border: 0.5px solid var(--rule);
  border-radius: 12px;
  padding: 22px 26px;
  margin-top: 32px;
  display: flex; gap: 14px;
  align-items: flex-start;
}
.disclaimer-strip svg { flex-shrink: 0; color: var(--accent); width: 22px; height: 22px; margin-top: 2px; }
.disclaimer-strip p { margin: 0; color: var(--text); font-size: 14.5px; line-height: 1.55; }

/* Footer */
footer.foot {
  border-top: 0.5px solid var(--rule);
  padding: 32px 0 36px;
  font-size: 13px;
  color: var(--text-muted);
}
footer.foot .row {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
}
footer.foot a { color: var(--text-muted); }
footer.foot a:hover { color: var(--text); }
footer.foot .legal { display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Privacy / Terms / FAQ pages ──────────────────────────────────────── */
article.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 0 80px;
}
article.legal h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 52px);
  letter-spacing: -1px; line-height: 1.05;
  margin: 0 0 12px;
}
article.legal .meta {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 36px;
}
article.legal h2 {
  font-family: var(--serif); font-size: 24px; font-weight: 600;
  margin: 38px 0 12px;
}
article.legal h3 {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  margin: 22px 0 8px;
}
article.legal p {
  font-size: 16px; line-height: 1.65;
  color: var(--text);
  margin: 0 0 14px;
}
article.legal ul, article.legal ol {
  font-size: 16px; line-height: 1.65;
  color: var(--text);
  padding-left: 22px;
}
article.legal li { margin-bottom: 6px; }
article.legal blockquote {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 16px 20px;
  margin: 18px 0;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--text-muted);
}
article.legal hr {
  border: none;
  border-top: 0.5px solid var(--rule);
  margin: 32px 0;
}
.legal-toc {
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 24px 0 32px;
}
.legal-toc strong {
  display: block; font-size: 12px;
  font-family: var(--mono); letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.legal-toc ol {
  margin: 0; padding-left: 18px;
  font-size: 14px;
}
.legal-toc a { color: var(--text); }

/* ── FAQ + Contact form ───────────────────────────────────────────────── */
.faq-list { display: grid; gap: 10px; margin: 28px 0 48px; }
.faq-item {
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}
.faq-item summary {
  padding: 18px 22px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 17px; font-weight: 600;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 160ms ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-family: var(--mono);
  font-size: 22px; color: var(--accent);
  transition: transform 220ms ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: var(--rule-soft); }
.faq-item .faq-body {
  padding: 0 22px 18px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 15px;
}

.contact-form {
  background: var(--surface);
  border: 0.5px solid var(--rule);
  border-radius: 14px;
  padding: 28px;
}
.contact-form .grid { display: grid; gap: 14px; }
.contact-form label {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px; display: block;
}
.contact-form input, .contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--text);
  border: 0.5px solid var(--rule);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 15px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.contact-form input:focus, .contact-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.contact-form textarea { resize: vertical; min-height: 130px; }
.contact-form .submit-row {
  display: flex; gap: 12px; align-items: center;
  margin-top: 8px;
}
.form-status {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text-muted);
  min-height: 18px;
  transition: color 200ms ease;
}
.form-status.ok { color: var(--band-healthy); }
.form-status.err { color: var(--band-tight); }

/* ── Animations ───────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.6; }
}
@keyframes float {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-40px, 30px) rotate(8deg); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.reveal.in {
  opacity: 1; transform: translateY(0);
}
.count {
  font-variant-numeric: tabular-nums;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .scope-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .nav.open { display: flex; flex-direction: column; gap: 0; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg); border-bottom: 0.5px solid var(--rule); padding: 14px 24px; }
  .nav.open a { padding: 12px 0; border-bottom: 0.5px solid var(--rule-soft); }
  .nav.open a.cta { margin-top: 8px; text-align: center; border-bottom: none; }
  .hero { padding: 36px 0; }
  .container { padding: 0 18px; }
  section { padding: 40px 0; }
  .scope-grid { grid-template-columns: 1fr 1fr; }
  .concept-row { grid-template-columns: 36px 1fr; row-gap: 8px; }
  .concept-row .sigil { grid-column: 1 / -1; justify-self: start; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .hero::before { animation: none; }
  .reveal { opacity: 1; transform: none; }
}
