/* ============ Wayfare design tokens ============ */
:root {
  /* Soft Accessible (default) */
  --bg: #FBF7EE;
  --bg-alt: #F2EADB;
  --surface: #FFFFFF;
  --surface-warm: #FFFBF0;
  --ink: #1A1A1A;
  --ink-soft: #2B2B2B;
  --muted: #6B756F;
  --muted-2: #97968F;
  --line: #E6DFCE;
  --line-strong: #1A1A1A;

  --primary: #1F4D3F;
  --primary-deep: #0F2E25;
  --primary-soft: #DBE9DF;
  --accent: #F4A261;
  --accent-deep: #D87E3C;
  --emergency: #C4302B;
  --emergency-soft: #FAE3E0;
  --success: #4F8C5E;
  --warn: #E0A11B;

  --score-A: #2F7D4A;
  --score-B: #6BAA45;
  --score-C: #D9A300;
  --score-D: #C26A1F;
  --score-F: #B0382E;

  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-serif: "Newsreader", "Source Serif Pro", Georgia, serif;
  --font-sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --shadow-1: 0 1px 0 rgba(20, 30, 25, 0.04), 0 4px 12px rgba(20, 30, 25, 0.06);
  --shadow-2: 0 2px 0 rgba(20, 30, 25, 0.05), 0 18px 40px -10px rgba(20, 30, 25, 0.18);
  --shadow-inset: inset 0 0 0 1px var(--line);

  --container: 1240px;
  --max-text: 64ch;

  --motion-fast: 160ms;
  --motion: 280ms;
  --easing: cubic-bezier(0.2, 0.7, 0.2, 1);

  --font-scale: 1; /* a11y toolbar */
}

/* Theme: Sage Calm */
[data-theme="sage"] {
  --bg: #F4F1E8;
  --bg-alt: #E8E2D0;
  --surface: #FFFFFF;
  --surface-warm: #FAF6EA;
  --ink: #1F2622;
  --primary: #2C5A48;
  --primary-deep: #163026;
  --primary-soft: #D0DFCF;
  --accent: #C68B59;
  --accent-deep: #A4663A;
  --line: #DCD3BB;
}

/* Theme: High Contrast (a11y) */
[data-theme="contrast"] {
  --bg: #FFFFFF;
  --bg-alt: #F4F4F4;
  --surface: #FFFFFF;
  --surface-warm: #FFFFFF;
  --ink: #000000;
  --ink-soft: #000000;
  --muted: #333333;
  --muted-2: #555555;
  --line: #000000;
  --line-strong: #000000;
  --primary: #0B3B2B;
  --primary-deep: #000000;
  --primary-soft: #FFE873;
  --accent: #FFD600;
  --accent-deep: #C9A800;
  --emergency: #B00020;
  --emergency-soft: #FFE3E1;
  --shadow-1: 0 0 0 1.5px #000000;
  --shadow-2: 0 0 0 2px #000000;
  --shadow-inset: inset 0 0 0 2px #000000;
}

/* Theme: Deep Night */
[data-theme="night"] {
  --bg: #0E1410;
  --bg-alt: #161E18;
  --surface: #1B2520;
  --surface-warm: #202C26;
  --ink: #ECE8DD;
  --ink-soft: #D8D2C2;
  --muted: #93A099;
  --muted-2: #6A766F;
  --line: #2A3631;
  --line-strong: #ECE8DD;
  --primary: #BFE3B7;
  --primary-deep: #84C28A;
  --primary-soft: #2B3A32;
  --accent: #F4A261;
  --accent-deep: #FFB97D;
  --emergency: #FF6B6B;
  --emergency-soft: #3A1F1E;
}

/* ============ Reset ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
[data-reduce-motion="true"] *, [data-reduce-motion="true"] *::before, [data-reduce-motion="true"] *::after {
  transition-duration: 0.01ms !important; animation-duration: 0.01ms !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: calc(17px * var(--font-scale));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* Focus rings — always visible (a11y) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 1000;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { top: 16px; }

/* Typography */
.h-display {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.02;
  font-size: clamp(44px, 7.2vw, 104px);
  color: var(--ink);
  margin: 0;
}
.h-display em { font-style: italic; color: var(--primary); font-weight: 500; }

.h-section {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(34px, 4.5vw, 64px);
  margin: 0;
}
.h-section em { font-style: italic; color: var(--primary); }

.h-card {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: var(--primary);
}

.lede {
  font-size: clamp(17px, 1.3vw, 21px);
  line-height: 1.55;
  color: var(--muted);
  max-width: 56ch;
}

/* ============ Layout helpers ============ */
.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(20px, 4vw, 56px); }
.section { padding-block: clamp(72px, 9vw, 140px); position: relative; }
.section--alt { background: var(--bg-alt); }
.section--ink { background: var(--ink); color: var(--bg); }
.section--ink .h-section,
.section--ink .lede { color: inherit; }
.section--ink .eyebrow { color: var(--accent); }
.section--ink .eyebrow::before { background: var(--accent); }

.grid { display: grid; gap: clamp(20px, 2.4vw, 32px); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 15.5px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: transform var(--motion-fast) var(--easing), background var(--motion-fast) var(--easing), box-shadow var(--motion-fast) var(--easing);
  white-space: nowrap;
}
.btn:hover { background: var(--primary-deep); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }
.btn--accent { background: var(--accent); color: var(--ink); }
.btn--accent:hover { background: var(--accent-deep); }
.btn--sm { padding: 9px 16px; font-size: 13.5px; }
.btn--lg { padding: 18px 30px; font-size: 17px; }
.btn--icon { padding: 12px; border-radius: 999px; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 2vw, 28px);
}
.card--warm { background: var(--surface-warm); }
.card--ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============ Lighthouse score badge ============ */
.score {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 700;
  font-size: 14px;
}
.score__num {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: var(--score-A);
  color: #fff;
  display: grid; place-items: center;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.score__grade-A .score__num { background: var(--score-A); }
.score__grade-B .score__num { background: var(--score-B); }
.score__grade-C .score__num { background: var(--score-C); }
.score__grade-D .score__num { background: var(--score-D); }
.score__grade-F .score__num { background: var(--score-F); }

/* ============ Tags / chips ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--motion-fast) var(--easing);
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ============ Animations ============ */
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(196, 48, 43, 0.5); }
  100% { box-shadow: 0 0 0 16px rgba(196, 48, 43, 0); }
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 600ms var(--easing) both; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
}
.nav__brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}
.nav__brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary);
  display: grid; place-items: center;
  color: var(--bg);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 18px;
}
.nav__links {
  display: flex; align-items: center; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav__links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-soft);
}
.nav__links a:hover { background: var(--bg-alt); }
.nav__cta { display: flex; align-items: center; gap: 10px; }

@media (max-width: 920px) {
  .nav__links { display: none; }
}

/* ============ Emergency button (persistent) ============ */
.emergency-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 14px 14px;
  border-radius: 999px;
  background: var(--emergency);
  color: #fff;
  border: 2px solid #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 30px -8px rgba(196, 48, 43, 0.55), 0 0 0 1px rgba(0,0,0,0.05);
  animation: pulseRing 1.8s infinite;
}
.emergency-fab__dot {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: #fff;
  color: var(--emergency);
  display: grid; place-items: center;
  font-size: 16px;
  font-weight: 800;
}

/* ============ Camera AI button (persistent, mirrors Emergency) ============ */
.camera-fab {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 14px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid var(--bg);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  box-shadow: 0 12px 30px -8px rgba(15, 25, 20, 0.45), 0 0 0 1px rgba(0,0,0,0.05);
  transition: transform var(--motion-fast) var(--easing), background var(--motion-fast) var(--easing);
}
.camera-fab:hover { transform: translateY(-1px); background: var(--primary-deep); }
.camera-fab__dot {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  display: grid; place-items: center;
}
@media (max-width: 560px) {
  .camera-fab {
    padding: 10px 14px 10px 10px;
    font-size: 12.5px;
  }
  .camera-fab__dot { width: 24px; height: 24px; }
}

/* ============ A11y toolbar ============ */
.a11y-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
}
.a11y-bar button {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.a11y-bar button[aria-pressed="true"], .a11y-bar button.is-active {
  background: var(--ink); color: var(--bg);
}

/* ============ Voice waveform ============ */
.wave {
  display: inline-flex; align-items: center; gap: 4px; height: 28px;
}
.wave span {
  width: 3px; height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transform-origin: center;
  animation: wave 900ms ease-in-out infinite;
}
.wave span:nth-child(2) { animation-delay: 120ms; }
.wave span:nth-child(3) { animation-delay: 240ms; }
.wave span:nth-child(4) { animation-delay: 360ms; }
.wave span:nth-child(5) { animation-delay: 480ms; }
.wave span:nth-child(6) { animation-delay: 600ms; }

/* ============ App preview frame ============ */
.phone {
  width: 100%;
  max-width: 380px;
  margin-inline: auto;
  border-radius: 40px;
  background: var(--ink);
  padding: 14px;
  box-shadow: var(--shadow-2);
  position: relative;
}
.phone__notch {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 26px; background: var(--ink); border-radius: 999px; z-index: 2;
}
.phone__screen {
  background: var(--bg);
  border-radius: 28px;
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  position: relative;
}

/* ============ Marquee strip ============ */
.marquee {
  display: flex; align-items: center; gap: 40px;
  white-space: nowrap;
  overflow: hidden;
  border-block: 1.5px solid var(--ink);
  background: var(--accent);
  padding: 16px 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 32px);
}
.marquee__track {
  display: inline-flex; gap: 40px; align-items: center;
  animation: scroll 30s linear infinite;
}
@keyframes scroll { to { transform: translateX(-50%); } }
.marquee__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ink); display: inline-block; }

/* ============ Utility ============ */
.divider { height: 1.5px; background: var(--line); border: 0; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }
.tag-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--success); display: inline-block; }

/* ============ Responsive 2-column layouts ============ */
.col-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
}
.col-2--end { align-items: flex-end; }
.col-2--start { align-items: flex-start; }
.col-2--wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.col-2--wide-left  { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.col-2--hero       { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.col-2--detail     { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.col-2--camera     { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

@media (max-width: 880px) {
  .col-2,
  .col-2--wide-right,
  .col-2--wide-left,
  .col-2--hero,
  .col-2--detail,
  .col-2--camera {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

/* Mobile typography & spacing tweaks */
@media (max-width: 720px) {
  body { font-size: calc(16px * var(--font-scale)); }
  .h-display { font-size: clamp(38px, 11vw, 60px); }
  .h-section { font-size: clamp(28px, 8vw, 40px); }
  .lede { font-size: 15.5px; }
  .section { padding-block: clamp(54px, 12vw, 80px); }
  .wrap { padding-inline: 20px; }
}

/* Nav: collapse a11y bar text and CTAs on small screens */
@media (max-width: 880px) {
  .nav__cta { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 560px) {
  .nav__inner { gap: 8px; padding: 10px 0; }
  .nav__brand { font-size: 18px; }
  .nav__brand-mark { width: 26px; height: 26px; font-size: 14px; }
  .a11y-bar { display: none; }
  .nav__cta .btn { padding: 8px 12px; font-size: 12.5px; }
}

/* Emergency FAB tightens on mobile */
@media (max-width: 560px) {
  .emergency-fab {
    padding: 10px 14px 10px 10px;
    font-size: 12.5px;
  }
  .emergency-fab__dot { width: 24px; height: 24px; font-size: 14px; }
}

/* Marquee */
@media (max-width: 720px) {
  .marquee { font-size: clamp(18px, 5.5vw, 24px); padding: 12px 0; }
}

/* Phone preview shrinks gracefully */
@media (max-width: 540px) {
  .phone { max-width: 320px; padding: 10px; }
  .phone__screen { border-radius: 22px; }
}

/* Photo placeholder */
.photo {
  position: relative;
  background: linear-gradient(135deg, var(--primary-soft), var(--bg-alt));
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
}
.photo::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4), transparent 60%);
}
.photo__label {
  position: absolute; bottom: 12px; left: 12px;
  background: var(--surface); color: var(--ink);
  padding: 6px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--ink);
}
