/* Canonical design tokens (best-in-class-ux spine, UX-8a). Source of truth is
   design-system/tokens.json; `cd design-system && npm run build` emits this
   tokens.css INTO site/ (the Cloudflare Pages web root) so the @import resolves
   on the deployed site. Same-dir path — never reach above the web root. */
@import url("tokens.css");

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* ===== THEME TOKENS (semantic vars mapped onto canonical tokens — no raw hex) ===== */
:root, [data-theme="light"] {
  --bg: var(--color-base-paper);
  --bg-2: var(--color-base-shell);
  --surface: var(--color-base-veil);
  --text: var(--color-base-ink);
  --accent: var(--color-brand-primary);
  --accent-light: var(--color-brand-accent);
  --dim: var(--color-base-muted);
  --line: var(--color-base-line);
  --bar-bg: var(--color-base-ink);
  --bar-text: var(--color-base-paper);
  --inv-bg: var(--color-base-ink);
  --inv-text: var(--color-base-paper);
  --inv-dim: rgba(245, 243, 238, 0.65);
  --inv-line: rgba(245, 243, 238, 0.12);
  --r-card: var(--radius-card);
  --r-panel: var(--radius-panel);
  --r-pill: var(--radius-full);
}
[data-theme="dark"] {
  --bg: var(--color-base-paper-dark);
  --bg-2: var(--color-base-surface-dark);
  --surface: var(--color-base-surface-dark);
  --text: var(--color-base-ink-dark);
  --accent: var(--color-brand-accent);
  --accent-light: var(--color-brand-accent);
  --dim: rgba(232, 230, 225, 0.55);
  --line: rgba(232, 230, 225, 0.10);
  --bar-bg: rgba(14, 14, 13, 0.92);
  --bar-text: var(--color-base-ink-dark);
  --inv-bg: var(--color-base-paper);
  --inv-text: var(--color-base-ink);
  --inv-dim: rgba(24, 26, 23, 0.65);
  --inv-line: rgba(24, 26, 23, 0.12);
  --r-card: var(--radius-card);
  --r-panel: var(--radius-panel);
  --r-pill: var(--radius-full);
}

/* ===== THEME CONDITIONALS ===== */
[data-theme="light"] .when-dark { display: none !important; }
[data-theme="dark"] .when-light { display: none !important; }

/* ===== TYPOGRAPHY ===== */
body {
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.display { font-weight: 500; letter-spacing: -0.035em; }
.accent-serif {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ===== LAYOUT ===== */
.container { max-width: 1320px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }

/* ===== NAV ===== */
.nav-wrap { padding: 0; }
.nav-inner {
  max-width: 1320px; margin: 0 auto;
  padding: 24px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
}
.nav-logo {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--bg);
  border-radius: 50%;
}
.nav-brand-name { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.nav-brand-name .dot { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-link {
  font-size: 14px; color: var(--text); text-decoration: none; opacity: 0.75;
  transition: opacity 0.15s;
}
.nav-link:hover { opacity: 1; }
.nav-link-active { opacity: 1; }
.nav-cta-btn {
  display: inline-block; padding: 10px 18px;
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  color: var(--bg); background: var(--text);
  border-radius: var(--r-pill);
  transition: opacity 0.15s;
}
.nav-cta-btn:hover { opacity: 0.88; }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: transparent; color: var(--dim);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { background: var(--line); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .sun-icon { display: none; }
[data-theme="light"] .theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* ===== TRANSITIONS ===== */
body, section, .nav-wrap, footer, .btn-primary, .btn-secondary, .nav-cta-btn {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

/* ===== MOBILE NAV ===== */
.nav-hamburger {
  display: none; background: none; border: none;
  font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--text); padding: 6px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.mobile-nav-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-nav-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 280px; max-width: 85vw;
  background: var(--surface); border-left: 1px solid var(--line);
  z-index: 1000; transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex; flex-direction: column;
  padding: 20px 24px; overflow-y: auto;
}
.mobile-nav-drawer.open { transform: translateX(0); }
.mobile-nav-header {
  display: flex; justify-content: flex-end; margin-bottom: 8px;
}
.mobile-nav-close {
  background: none; border: none;
  font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--text); padding: 6px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-links { display: flex; flex-direction: column; }
.mobile-nav-link {
  font-size: 16px; text-decoration: none; color: var(--text);
  padding: 16px 0; border-bottom: 1px solid var(--line); display: block;
}
.mobile-nav-link:first-child { border-top: 1px solid var(--line); }
.mobile-nav-link:hover, .mobile-nav-link:active { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .mobile-nav-overlay, .mobile-nav-drawer { transition: none; }
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 18px 28px; font-size: 15px; font-weight: 500;
  text-decoration: none;
  background: var(--text); color: var(--bg);
  border-radius: var(--r-pill);
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 24px; font-size: 14px; font-weight: 500;
  text-decoration: none;
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  transition: opacity 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--text); color: var(--bg); }

/* ===== HERO BADGE ===== */
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: rgba(61, 93, 73, 0.06);
  border: 1px solid rgba(61, 93, 73, 0.15);
  border-radius: var(--radius-full);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--accent);
  margin-bottom: 28px;
}
.hero-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===== LEAD CAPTURE POPUP ===== */
.lead-popup-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(24, 26, 23, 0.55);
  z-index: 200; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.3s ease;
}
.lead-popup-overlay.open { display: flex; opacity: 1; }
.lead-popup {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 36px;
  max-width: 420px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  transform: scale(0.96); opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.lead-popup-overlay.open .lead-popup { transform: scale(1); opacity: 1; }
.lead-popup-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--dim); line-height: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background 0.15s;
}
.lead-popup-close:hover { background: var(--bg-2); }
.lead-popup-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px;
}
.lead-popup-title {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.2;
  margin-bottom: 6px;
}
.lead-popup-sub {
  font-size: 14px; color: var(--dim);
  line-height: 1.5; margin-bottom: 24px;
}
.lead-popup .lp-group { margin-bottom: 14px; }
.lead-popup .lp-label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 4px;
}
.lead-popup .lp-label .lp-req { color: var(--accent); }
.lead-popup .lp-label .lp-opt { color: var(--dim); font-weight: 400; font-size: 12px; }
.lead-popup .lp-input,
.lead-popup .lp-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif; font-size: 14px;
  background: var(--bg); color: var(--text);
  outline: none; transition: border-color 0.2s;
}
.lead-popup .lp-input:focus,
.lead-popup .lp-select:focus { border-color: var(--accent); }
.lead-popup .lp-consent {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 18px 0 6px; cursor: pointer;
}
.lead-popup .lp-consent input[type="checkbox"] {
  margin-top: 3px; flex-shrink: 0;
  accent-color: var(--accent);
  width: 16px; height: 16px;
}
.lead-popup .lp-consent-text {
  font-size: 11px; color: var(--dim); line-height: 1.45;
}
.lead-popup .lp-submit {
  width: 100%; padding: 14px;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s;
  margin-top: 8px;
}
.lead-popup .lp-submit:hover { opacity: 0.9; }
.lead-popup .lp-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.lead-popup .lp-error {
  display: none; margin-top: 10px; padding: 10px 14px;
  background: rgba(220, 60, 60, 0.08);
  border: 1px solid rgba(220, 60, 60, 0.2);
  border-radius: var(--radius-md); font-size: 13px;
  color: var(--color-feedback-danger); line-height: 1.4;
}
.lead-popup .lp-error.visible { display: block; }
.lead-popup .lp-success {
  display: none; text-align: center; padding: 32px 16px;
}
.lead-popup .lp-success.visible { display: block; }
.lead-popup .lp-success h3 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px; color: var(--accent);
}
.lead-popup .lp-success p {
  font-size: 14px; color: var(--dim); line-height: 1.5;
}

/* Mobile bottom sheet */
@media (max-width: 640px) {
  .lead-popup-overlay { align-items: flex-end; padding: 0; }
  .lead-popup {
    max-width: 100%; border-radius: 16px 16px 0 0;
    padding: 28px 20px 32px;
    max-height: 85vh;
    transform: translateY(100%);
  }
  .lead-popup-overlay.open .lead-popup {
    transform: translateY(0);
  }
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--inv-bg); color: var(--inv-text);
  padding: 40px 32px;
}
.footer-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.footer-left { display: flex; align-items: center; gap: 14px; }
.footer-logo {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-light); color: var(--inv-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.footer-brand { font-size: 15px; font-weight: 500; }
.footer-tagline { font-size: 12px; opacity: 0.55; margin-left: 8px; }
.footer-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; opacity: 0.55; letter-spacing: 0.05em;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) {
  .hero-badge .dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* ===== RESPONSIVE — SHARED ===== */
@media (max-width: 767px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .nav-inner { padding: 16px; }
  .nav-links .nav-link { display: none; }
  .nav-cta-btn { display: none; }
  .nav-hamburger { display: block; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-left { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .lead-popup-overlay { transition: none; }
  .lead-popup { transition: none; }
}
