@import 'tokens.css';
@import 'components.css';

/* BioSonic shared core — Obsidian Vision monochrome glass */
:root {
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: var(--font-display);
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --bg: var(--bg-base);
  --bg-2: #111111;
  --bg-card: rgba(0,0,0,0.55);
  --bg-card-alt: rgba(0,0,0,0.65);
  --border: rgba(255,255,255,0.08);

  --teal: var(--accent-teal);
  --teal-light: var(--accent-teal-light);
  --red: var(--accent-red);
  --amber: var(--accent-gold);
  --blue: var(--accent-blue);
  --purple: var(--accent-purple);
  --orange: var(--accent-orange);

  --text: #f4f1eb;
  --text-muted: #b8b8b8;
  --text-dim: #888888;

  --accent-soft: var(--accent-soft);

  --maxw: 1280px;
  --pad-container: 32px;
  --pad-section: var(--space-section);
  --radius: 10px;
  --radius-lg: var(--r-card);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #0e0d0b;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(40,40,40,0.4), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(30,30,30,0.3), transparent 50%);
  color: #f4f1eb;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}
body > * { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad-container); }
.center { text-align: center; }
.answer-capsule {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  max-width: 56ch;
  margin: 12px auto 28px;
  text-align: center;
}
.compare-grid { display: grid; gap: 24px; margin: 40px 0; }
.compare-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 32px; transition: border-color 0.15s; }
.compare-card:hover { border-color: var(--teal); }
.compare-card h3 { font-family: var(--font-serif); font-weight: 500; font-size: 24px; margin: 0 0 8px; }
.compare-card h3 a { color: var(--text); text-decoration: none; }
.compare-card h3 a:hover { color: var(--teal); }
.compare-card p { color: var(--text-muted); font-size: 15px; line-height: 1.55; margin: 0; }
/* Top nav */
.nav {
  position: relative; z-index: 10;
  padding: 20px var(--pad-container) 0;
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-bottom: 22px; border-bottom: 1px solid var(--border);
  position: relative;
  min-height: 50px;
}
.nav-center {
  display: flex; align-items: center; gap: 28px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
.brand-logo { height: 28px; width: auto; }
.brand-mark { width: 26px; height: 26px; color: var(--teal); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-dropdown { position: relative; display: flex; gap: 20px; align-items: center; }
.nav-dropdown-label { position: absolute; top: -16px; left: 0; color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; cursor: default; line-height: 1; white-space: nowrap; }
.nav-dropdown-items { display: contents; }
.nav-dropdown-items a { font-size: 14px; }
.nav-center { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text-muted); font-size: 14px; transition: color .15s; min-width: max-content; white-space: nowrap; }
.nav-links a:hover, .nav-links a.on { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.link-muted { color: var(--text-muted); font-size: 14px; }
.link-muted:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  font-size: 14px; font-weight: 500; line-height: 1;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.btn-lg { padding: 14px 24px; font-size: 14.5px; }
.btn-primary { background: var(--teal); color: #0e0d0b; }
.btn-primary:hover { background: var(--teal-light); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }

/* Headings */
.serif-display {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(34px, 4.4vw, 58px); line-height: 1.05;
  letter-spacing: -0.02em; margin: 0 0 22px; text-wrap: balance;
}
.serif-display em { font-style: italic; font-weight: 300; color: var(--teal); }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--teal); letter-spacing: 0.18em; text-transform: uppercase;
  margin: 0 0 16px; font-weight: 500;
}
.eyebrow-muted {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted); letter-spacing: 0.18em; text-transform: uppercase;
  margin: 0 0 16px; font-weight: 500;
}
.eyebrow-line {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--teal); letter-spacing: 0.18em; text-transform: uppercase;
  margin: 0 0 16px; font-weight: 500;
}
.section-sub {
  color: var(--text-muted); font-size: 17px; max-width: 60ch; margin: 0 0 8px;
  line-height: 1.55;
}
.section-sub.center { margin-left: auto; margin-right: auto; }

/* Section spacing */
section { position: relative; }
.sect { padding: var(--pad-section) 0; }
.cta-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px 0 14px; }
.cta-foot { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin: 0; }

/* Cards */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--glass-radius);
  padding: 28px;
  box-shadow: var(--glass-shadow);
}

/* Toggle button row (e.g., map mode selector) */
.toggle-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.toggle-btn {
  padding: 8px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
}
.toggle-btn.on { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.25); color: #fff; }

/* Breadcrumb */
.breadcrumb { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.5px; color: var(--text-dim); padding: 16px var(--pad-container) 0; max-width: var(--maxw); margin: 0 auto; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal); }

/* Last updated */
.last-updated { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); text-align: center; padding: 24px var(--pad-container) 0; }

/* Site-wide footer */
.site-footer { border-top: 1px solid var(--border); padding: 48px var(--pad-container) 32px; margin-top: var(--pad-section); }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 32px; max-width: var(--maxw); margin: 0 auto; }
.footer-cols h3 { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin: 0 0 12px; }
.footer-cols a { display: block; font-size: 14px; color: var(--text-muted); text-decoration: none; padding: 3px 0; transition: color .15s; }
.footer-cols a:hover { color: var(--teal); }
.footer-meta { max-width: var(--maxw); margin: 32px auto 0; padding-top: 20px; border-top: 1px solid var(--border); }
.footer-meta small { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ── Snowfield light mode overrides ── */
[data-theme="light"] {
  --bg-2: #eae8e2;
  --bg-card: rgba(252,250,245,0.78);
  --bg-card-alt: rgba(240,238,232,0.8);
  --border: rgba(20,19,15,0.06);

  --text: #14130f;
  --text-muted: #504e47;
  --text-dim: #7a7770;
}
[data-theme="light"] body {
  background: #f5f3ee;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(220,218,210,0.4), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(230,228,220,0.3), transparent 50%);
  color: #14130f;
}
[data-theme="light"] body::before {
  opacity: 0.015;
}
[data-theme="light"] .btn-primary { color: #f5f3ee; }
[data-theme="light"] .btn-ghost { border-color: rgba(20,19,15,0.25); }
[data-theme="light"] .toggle-btn {
  border-color: rgba(20,19,15,0.15);
  color: #5a5850;
}
[data-theme="light"] .toggle-btn.on {
  background: rgba(20,19,15,0.1);
  border-color: rgba(20,19,15,0.25);
  color: #14130f;
}
[data-theme="light"] .eyebrow,
[data-theme="light"] .eyebrow-line,
[data-theme="light"] .brand-mark { color: #14130f; }
[data-theme="light"] .serif-display em { color: #3a3830; }
/* Quote card names + roles in light mode */
[data-theme="light"] .qcard figcaption strong { color: #14130f; }
[data-theme="light"] .qcard .who { color: #5a5850; }
[data-theme="light"] .qcard blockquote { color: #3a3830; }
/* Glass tile text in light mode */
[data-theme="light"] .glass-tile { color: #14130f; }
[data-theme="light"] .card { color: #14130f; }
[data-theme="light"] svg text[fill="#ffffff"] { fill: #14130f; }
[data-theme="light"] svg text[fill="#f4f1eb"] { fill: #14130f; }
[data-theme="light"] svg text[fill="#e0e0e0"] { fill: #3a3830; }
[data-theme="light"] svg text[fill="#cccccc"] { fill: #5a5850; }
[data-theme="light"] svg text[fill="#b0b0b0"] { fill: #6a675e; }
[data-theme="light"] svg text[fill="#aaaaaa"] { fill: #7a7870; }
[data-theme="light"] svg text[fill="#999999"] { fill: #8a8780; }
/* SVG group fill inversions for light mode */
[data-theme="light"] svg g[fill="#f4f1eb"] { fill: #14130f; }
[data-theme="light"] svg g[fill="#ffffff"] { fill: #14130f; }
/* SVG shape inversions for light mode */
[data-theme="light"] svg rect[fill="#ffffff"] { fill: #14130f; }
[data-theme="light"] svg circle[fill="#ffffff"] { fill: #14130f; }
[data-theme="light"] svg path[fill="#ffffff"] { fill: #14130f; }
[data-theme="light"] svg line[stroke="#ffffff"] { stroke: #14130f; }
[data-theme="light"] svg rect[stroke="#ffffff"] { stroke: #14130f; }
[data-theme="light"] svg circle[stroke="#ffffff"] { stroke: #14130f; }
/* SVG dark bg rects → light in light mode */
[data-theme="light"] svg rect[fill="#141414"] { fill: #eae8e2; }
[data-theme="light"] svg rect[fill="#0d0d0d"] { fill: #f0eee8; }
[data-theme="light"] svg rect[fill="#0e0e0e"] { fill: #eae8e2; }
[data-theme="light"] svg rect[fill="#0e0d0b"] { fill: #f5f3ee; }
[data-theme="light"] svg rect[stroke="#1a1a1a"] { stroke: rgba(20,19,15,0.1); }
[data-theme="light"] svg line[stroke="#1a1a1a"] { stroke: rgba(20,19,15,0.1); }
/* SVG avatar circles stay visible */
[data-theme="light"] svg circle[fill="#e0e0e0"] { fill: #5a5850; }
[data-theme="light"] svg circle[fill="#999999"] { fill: #8a8780; }
[data-theme="light"] svg circle[fill="#b0b0b0"] { fill: #6a675e; }
/* SVG strokes that were light → dark */
[data-theme="light"] svg line[stroke="#a0a0a0"] { stroke: #8a8780; }
[data-theme="light"] svg line[stroke="#b0b0b0"] { stroke: #6a675e; }
[data-theme="light"] svg g[stroke="#a0a0a0"] { stroke: #8a8780; }
[data-theme="light"] svg g[stroke="#b0b0b0"] { stroke: #6a675e; }
/* Text inside SVG circles (initials) */
[data-theme="light"] svg text[fill="#0e0d0b"] { fill: #f5f3ee; }
/* Muted text stays readable */
[data-theme="light"] svg text[fill="#666666"] { fill: #9a978e; }
[data-theme="light"] svg text[fill="#a0a0a0"] { fill: #6a675e; }
/* SVG slider track in light mode */
[data-theme="light"] svg line[stroke="#ffffff"] { stroke: #14130f; }
[data-theme="light"] svg circle[stroke="#0e0d0b"] { stroke: #f5f3ee; }
[data-theme="light"] svg path[stroke="#0e0d0b"] { stroke: #f5f3ee; }
/* SVG polygon arrows */
[data-theme="light"] svg polygon[fill="#ffffff"] { fill: #14130f; }
/* SVG dashed strokes */
[data-theme="light"] svg path[stroke="#ffffff"] { stroke: #14130f; }
/* SVG muted strokes */
[data-theme="light"] svg rect[stroke="#999999"] { stroke: #8a8780; }
[data-theme="light"] svg g[stroke="#b0b0b0"] { stroke: #6a675e; }
[data-theme="light"] svg text[fill="#b8b8b8"] { fill: #6a675e; }
[data-theme="light"] svg text[fill="#888888"] { fill: #9a978e; }
/* Logo swap: white logo → black logo in light mode (handled via JS) */
/* "Read full story" CTA pill in light mode */
[data-theme="light"] .qcard-cta,
[data-theme="light"] a[style*="rgba(255,255,255,0.12)"] {
  background: rgba(20,19,15,0.08) !important;
  border-color: rgba(20,19,15,0.15) !important;
  color: #14130f !important;
}

/* ── Theme toggle ── */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
[data-theme="light"] .theme-toggle {
  border: 1.5px solid rgba(20,19,15,0.2);
  background: rgba(252,250,245,0.85);
  box-shadow: 0 2px 8px rgba(20,19,15,0.12);
}
.theme-toggle:hover {
  transform: scale(1.08);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; color: #f4f1eb; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; color: #14130f; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; color: #f4f1eb; }

/* ---- Mobile navigation (hamburger + off-canvas drawer) ---- */
.nav-toggle { display: none; }
.nav-drawer, .nav-drawer-overlay { display: none; }

@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-left: 4px;
    background: none; border: none; color: var(--text);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .nav-cta { gap: 8px; }
  .nav-drawer-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0; visibility: hidden; transition: opacity .2s ease;
    z-index: 998;
  }
  .nav-drawer-overlay.open { opacity: 1; visibility: visible; }
  .nav-drawer {
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(84vw, 330px);
    background: var(--bg-base, #0e0d0b);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 40px rgba(0,0,0,.45);
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
    z-index: 999; padding: 16px 18px env(safe-area-inset-bottom, 18px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .nav-drawer.open { transform: translateX(0); }
}

.nav-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nav-drawer-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }
.nav-drawer-close {
  width: 44px; height: 44px; background: none; border: none;
  color: var(--text); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; margin-right: -8px;
}
.nav-drawer-list { display: flex; flex-direction: column; }
.nav-drawer-list a {
  display: block; padding: 15px 6px; font-size: 17px; font-weight: 500;
  color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.nav-drawer-list a:active { background: rgba(255,255,255,.06); }
.nav-drawer-list a.active { color: var(--teal); }
.nav-drawer-group-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 16px 6px 4px;
}
.nav-drawer-list a + .nav-drawer-group-label { margin-top: 6px; }
.nav-drawer-cta { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.nav-drawer-signin {
  display: block; text-align: center; padding: 13px; font-size: 15px;
  color: var(--text-muted); text-decoration: none;
  border: 1px solid var(--border); border-radius: 10px;
}
.nav-drawer-cta .btn { width: 100%; }
body.nav-open { overflow: hidden; }
