/* =========================================================================
   STREETSCAPE AI — ORGANIC / NATURAL DESIGN SYSTEM
   Wabi-sabi: warm, tactile, hand-shaped. There are no straight lines in nature.
   ========================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Earth-drawn palette */
  --bg: #FDFCF8;            /* rice paper */
  --fg: #2C2C24;            /* deep loam */
  --surface: #FEFEFA;       /* unbleached card */
  --primary: #5D7052;       /* moss green */
  --primary-fg: #F3F4F1;    /* pale mist */
  --secondary: #C18C5D;     /* terracotta clay */
  --secondary-fg: #FFFFFF;
  --accent: #E6DCCD;        /* sand */
  --accent-fg: #4A4A40;     /* bark */
  --muted: #F0EBE5;         /* stone */
  --muted-fg: #78786C;      /* dried grass */
  --border: #DED8CF;        /* raw timber */
  --destructive: #A85448;   /* burnt sienna */

  /* Tinted shadows — never pure black */
  --shadow-soft: 0 4px 20px -2px rgba(93, 112, 82, 0.15);
  --shadow-float: 0 10px 40px -10px rgba(193, 140, 93, 0.20);
  --shadow-lift: 0 20px 40px -10px rgba(93, 112, 82, 0.18);

  /* Radii — organic preference, no sharp corners */
  --r-sm: 0.75rem;
  --r-md: 1rem;
  --r-lg: 1.5rem;
  --r-xl: 2rem;
  --r-2xl: 2.5rem;
  --r-3xl: 3rem;
  --r-pill: 999px;

  /* Type */
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-sans: "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Motion */
  --t-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-amble: 700ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout caps — varied for visual rhythm */
  --w-7xl: 80rem;   /* hero, features */
  --w-6xl: 72rem;   /* how it works */
  --w-5xl: 64rem;   /* final CTA */
  --w-4xl: 56rem;   /* article body */
  --w-3xl: 48rem;
  --w-2xl: 42rem;
}

/* ---------- 2. Reset + base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--secondary);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(93, 112, 82, 0.35), 0 0 0 5px var(--bg);
  border-radius: var(--r-md);
}

/* ---------- 3. Grain texture (paper) ---------- */
/* Fixed, full-viewport, low-opacity noise. Multiply blend creates paper feel. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Ambient warm wash behind everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 12% -5%, rgba(193, 140, 93, 0.18), transparent 45%),
    radial-gradient(ellipse at 95% 8%, rgba(93, 112, 82, 0.15), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(230, 220, 205, 0.6), transparent 60%);
}

/* Make sure all real content sits above the texture/wash layers */
.page-shell,
.nav,
main,
footer {
  position: relative;
  z-index: 2;
}

/* ---------- 4. Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-variation-settings: "SOFT" 80, "WONK" 0, "opsz" 144;
  line-height: 1.1;
  color: var(--fg);
  margin: 0;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 600; }
h3 { font-size: clamp(1.4rem, 2vw, 1.75rem); font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }

p {
  margin: 0;
}

p + p {
  margin-top: 1rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary);
}

.lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--muted-fg);
}

.text-muted {
  color: var(--muted-fg);
}

/* ---------- 5. Layout ---------- */
.page-shell {
  width: 100%;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .page-shell { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .page-shell { padding: 0 2rem; }
}

.container {
  width: 100%;
  max-width: var(--w-7xl);
  margin: 0 auto;
}

.container--narrow { max-width: var(--w-6xl); }
.container--prose  { max-width: var(--w-4xl); }
.container--tight  { max-width: var(--w-2xl); }

.section {
  position: relative;
  padding: 5rem 0;
}

@media (min-width: 768px) {
  .section { padding: 7rem 0; }
}

.section--tight { padding: 3.5rem 0; }

.section--moss {
  background: linear-gradient(180deg, transparent, rgba(93, 112, 82, 0.04) 30%, rgba(93, 112, 82, 0.04) 70%, transparent);
}

.section--sand {
  background: linear-gradient(180deg, transparent, rgba(230, 220, 205, 0.4) 30%, rgba(230, 220, 205, 0.4) 70%, transparent);
}

.section--stone {
  background: linear-gradient(180deg, transparent, rgba(240, 235, 229, 0.55) 30%, rgba(240, 235, 229, 0.55) 70%, transparent);
}

.section-heading {
  max-width: 50rem;
  margin: 0 0 3rem;
}

.section-heading p {
  margin-top: 1rem;
  font-size: 1.05rem;
  color: var(--muted-fg);
}

.section-heading--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* ---------- 6. Blobs (organic ambient color washes) ---------- */
.blob {
  position: absolute;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.55;
  z-index: 0;
}

.blob--moss   { background: radial-gradient(circle, rgba(93, 112, 82, 0.45), transparent 65%); }
.blob--clay   { background: radial-gradient(circle, rgba(193, 140, 93, 0.45), transparent 65%); }
.blob--sand   { background: radial-gradient(circle, rgba(230, 220, 205, 0.85), transparent 65%); }
.blob--mist   { background: radial-gradient(circle, rgba(243, 244, 241, 0.85), transparent 65%); }

/* Six asymmetric blob shapes, cycle with --shape-N */
.blob--s1 { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
.blob--s2 { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
.blob--s3 { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
.blob--s4 { border-radius: 40% 60% 60% 40% / 70% 30% 70% 30%; }
.blob--s5 { border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%; }
.blob--s6 { border-radius: 70% 30% 30% 70% / 50% 50% 50% 50%; }

/* ---------- 7. Navigation ---------- */
.nav-wrap {
  position: sticky;
  top: 1rem;
  z-index: 50;
  padding: 0 1rem;
  margin-bottom: 1rem;
}

.nav {
  max-width: var(--w-7xl);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-soft);
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--fg);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
}

.nav-logo:hover { color: var(--primary); }

.nav-logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.nav-logo-icon svg { width: 1.15rem; height: 1.15rem; }

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-menu > li { position: relative; }

.nav-link,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.625rem 1rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
  transition: background var(--t-fast), color var(--t-fast);
}

.nav-link:hover,
.nav-trigger:hover,
.nav-link[aria-current="page"] {
  background: rgba(93, 112, 82, 0.10);
  color: var(--primary);
}

.nav-trigger svg.chev {
  width: 0.95rem;
  height: 0.95rem;
  transition: transform var(--t-fast);
}

.nav-dropdown:hover .nav-trigger svg.chev,
.nav-dropdown:focus-within .nav-trigger svg.chev {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 16rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility 0s linear var(--t-fast);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-md);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.nav-dropdown-menu a span.sub {
  display: block;
  margin-top: 0.15rem;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted-fg);
}

.nav-dropdown-menu a:hover {
  background: rgba(93, 112, 82, 0.08);
  color: var(--primary);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-soft);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.nav-cta:hover {
  color: var(--primary-fg);
  background: #4a5b41;
  transform: scale(1.04);
  box-shadow: 0 6px 24px -4px rgba(93, 112, 82, 0.30);
}

.nav-cta:active { transform: scale(0.97); }

.nav-cta svg { width: 1rem; height: 1rem; }

.nav-cta--ghost {
  background: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 1.5px var(--primary);
  font-weight: 600;
}

.nav-cta--ghost:hover {
  color: var(--primary-fg);
  background: var(--primary);
  box-shadow: inset 0 0 0 1.5px var(--primary), 0 6px 24px -4px rgba(93, 112, 82, 0.28);
}

/* Mobile nav: <details>-driven, no JS */
.nav-mobile { display: none; }

@media (max-width: 880px) {
  .nav-menu { display: none; }
  .nav-mobile { display: block; }

  .nav-mobile summary {
    list-style: none;
    cursor: pointer;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--r-pill);
    background: rgba(93, 112, 82, 0.10);
    display: grid;
    place-items: center;
    color: var(--primary);
    transition: background var(--t-fast);
  }
  .nav-mobile summary::-webkit-details-marker { display: none; }
  .nav-mobile summary:hover { background: rgba(93, 112, 82, 0.18); }
  .nav-mobile summary svg { width: 1.25rem; height: 1.25rem; }
  .nav-mobile[open] summary .icon-menu { display: none; }
  .nav-mobile:not([open]) summary .icon-x { display: none; }

  .nav-mobile-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(222, 216, 207, 0.6);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-float);
    padding: 0.75rem;
    display: grid;
    gap: 0.25rem;
  }

  .nav-mobile-panel a,
  .nav-mobile-panel summary {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--r-md);
    color: var(--fg);
    font-weight: 600;
    font-size: 0.98rem;
  }

  .nav-mobile-panel a:hover,
  .nav-mobile-panel summary:hover {
    background: rgba(93, 112, 82, 0.08);
    color: var(--primary);
  }

  .nav-mobile-sub {
    margin-left: 0.5rem;
    border-left: 2px solid rgba(222, 216, 207, 0.7);
    padding-left: 0.5rem;
  }

  .nav-mobile-sub a {
    font-size: 0.92rem;
    font-weight: 500;
  }

  .nav-mobile-panel .nav-cta {
    margin-top: 0.5rem;
    justify-content: center;
  }
}

/* ---------- 8. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 2rem;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-base), box-shadow var(--t-base), background var(--t-base), color var(--t-base);
}

.btn svg {
  width: 1.05rem;
  height: 1.05rem;
  transition: transform var(--t-base);
}

.btn:hover svg.arrow { transform: translateX(3px); }

.btn--primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: var(--shadow-soft);
}

.btn--primary:hover {
  color: var(--primary-fg);
  background: #4a5b41;
  transform: scale(1.04);
  box-shadow: 0 6px 24px -4px rgba(93, 112, 82, 0.30);
}

.btn--outline {
  background: transparent;
  color: var(--secondary);
  box-shadow: inset 0 0 0 2px var(--secondary);
}

.btn--outline:hover {
  color: var(--secondary-fg);
  background: var(--secondary);
  transform: scale(1.04);
  box-shadow: inset 0 0 0 2px var(--secondary), 0 6px 24px -4px rgba(193, 140, 93, 0.30);
}

.btn--ghost {
  color: var(--primary);
}

.btn--ghost:hover {
  background: rgba(93, 112, 82, 0.10);
  color: var(--primary);
}

.btn--lg {
  height: 3.5rem;
  padding: 0 2.5rem;
  font-size: 1.05rem;
}

.btn--sm {
  height: 2.5rem;
  padding: 0 1.5rem;
  font-size: 0.92rem;
}

.btn:active { transform: scale(0.96); }

/* ---------- 9. Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  transition: transform var(--t-base), box-shadow var(--t-base);
}

.card--hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.card--tilt:hover { transform: rotate(1deg) translateY(-2px); }

/* Asymmetric radii — cycle through 6 patterns when stacked in a grid */
.card--asym:nth-child(6n+1) { border-radius: 4rem 2rem 2rem 2rem; }
.card--asym:nth-child(6n+2) { border-radius: 2rem 4rem 2rem 2rem; }
.card--asym:nth-child(6n+3) { border-radius: 2rem 2rem 4rem 2rem; }
.card--asym:nth-child(6n+4) { border-radius: 2rem 2rem 2rem 4rem; }
.card--asym:nth-child(6n+5) { border-radius: 5rem 2rem 2rem 5rem; }
.card--asym:nth-child(6n+6) { border-radius: 2rem 5rem 5rem 2rem; }

.card-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--r-lg);
  background: rgba(93, 112, 82, 0.10);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  transition: background var(--t-base), color var(--t-base);
}

.card-icon svg { width: 1.6rem; height: 1.6rem; }

.card--hover:hover .card-icon {
  background: var(--primary);
  color: var(--primary-fg);
}

.card h3 { margin-bottom: 0.6rem; }
.card p { color: var(--muted-fg); }

.card .pipeline-label,
.card .feature-panel-tag {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-pill);
  background: rgba(193, 140, 93, 0.14);
  color: var(--secondary);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- 10. Hero ---------- */
.hero {
  position: relative;
  padding: 4rem 0 5rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero { padding: 6rem 0 7rem; }
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--w-4xl);
}

.hero-inner--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.75rem);
  margin: 0;
  letter-spacing: -0.02em;
}

.hero h1 em {
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  color: var(--primary);
}

.hero-text {
  margin: 1.5rem 0 0;
  max-width: 38rem;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--muted-fg);
}

.hero-inner--center .hero-text { margin-left: auto; margin-right: auto; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  margin-top: 2.25rem;
}

.hero-inner--center .hero-actions { justify-content: center; }

/* Hero blobs */
.hero .blob--a {
  width: 28rem; height: 28rem;
  top: -8rem; right: -6rem;
}
.hero .blob--b {
  width: 22rem; height: 22rem;
  bottom: -10rem; left: -8rem;
}

/* Video-backed hero (homepage opening scene) */
.hero--video {
  min-height: 78vh;
  margin-bottom: 2rem;
  border-radius: var(--r-2xl);
  overflow: hidden;
  display: flex;
  align-items: center;
  isolation: isolate;
  /* Fallback color before media loads or if it fails */
  background: linear-gradient(135deg, #5D7052 0%, #3f4f37 100%);
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(44, 44, 36, 0.55) 0%,
      rgba(44, 44, 36, 0.18) 35%,
      rgba(44, 44, 36, 0.70) 100%),
    linear-gradient(90deg,
      rgba(44, 44, 36, 0.55) 0%,
      rgba(44, 44, 36, 0.05) 55%);
}

.hero--video .container { position: relative; z-index: 2; }
.hero--video .hero-inner { padding: 4rem 0; }

/* Light-on-dark text overrides — only inside the video hero */
.hero--video .eyebrow { color: var(--accent); }
.hero--video h1 { color: var(--primary-fg); text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25); }
.hero--video h1 em { color: #D2DEC3; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.hero--video .hero-text { color: rgba(243, 244, 241, 0.92); }

.hero--video .btn--outline {
  color: var(--primary-fg);
  box-shadow: inset 0 0 0 2px rgba(243, 244, 241, 0.85);
  backdrop-filter: blur(4px);
  background: rgba(44, 44, 36, 0.18);
}
.hero--video .btn--outline:hover {
  color: var(--primary);
  background: var(--primary-fg);
  box-shadow: inset 0 0 0 2px var(--primary-fg);
}

/* Pause autoplay for reduced-motion users (visual fallback handled by poster) */
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
}

/* ---------- 11. Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: var(--w-5xl);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.stat {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: var(--r-xl);
  background: rgba(254, 254, 250, 0.6);
  border: 1px solid rgba(222, 216, 207, 0.5);
  transition: transform var(--t-base), box-shadow var(--t-base);
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

.stat-value {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: var(--primary);
  line-height: 1;
  transition: transform var(--t-base);
}

.stat:hover .stat-value { transform: scale(1.06); }

.stat-label {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted-fg);
  line-height: 1.4;
}

/* ---------- 12. Feature grid ---------- */
.grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.grid--4 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Two-column hero/benefit layouts */
.split {
  display: grid;
  gap: 3rem;
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4rem; }
  .split--reverse > :first-child { order: 2; }
}

/* Organic image masks */
.shape-mask {
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  overflow: hidden;
  background: var(--accent);
  transform: rotate(-2deg);
  border: 4px solid #fff;
  box-shadow: var(--shadow-float);
}

.shape-mask--alt {
  border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
  transform: rotate(1deg);
}

/* ---------- 13. Steps (How planners use this) ---------- */
.steps {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  position: relative;
}

@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem; }
}

.step {
  text-align: left;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
  position: relative;
  transition: transform var(--t-base), box-shadow var(--t-base);
}

.step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  background: var(--secondary);
  color: var(--secondary-fg);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1.2rem;
}

.step h3 { margin-bottom: 0.6rem; }
.step p { color: var(--muted-fg); }

/* ---------- 14. Final CTA ---------- */
.cta-card {
  position: relative;
  max-width: var(--w-5xl);
  margin: 0 auto;
  padding: 4rem 2rem;
  border-radius: var(--r-3xl);
  background: linear-gradient(135deg, var(--primary), #4a5b41);
  color: var(--primary-fg);
  text-align: center;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}

@media (min-width: 768px) {
  .cta-card { padding: 5rem 4rem; }
}

.cta-card h2 {
  color: var(--primary-fg);
  font-size: clamp(2rem, 4vw, 3rem);
}

.cta-card p {
  color: rgba(243, 244, 241, 0.85);
  margin-top: 1rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.cta-card .hero-actions { margin-top: 2.5rem; justify-content: center; }

.cta-card .btn--primary {
  background: var(--bg);
  color: var(--primary);
}
.cta-card .btn--primary:hover {
  background: #fff;
  color: var(--primary);
}

.cta-card .btn--outline {
  color: var(--primary-fg);
  box-shadow: inset 0 0 0 2px rgba(243, 244, 241, 0.7);
}
.cta-card .btn--outline:hover {
  color: var(--primary);
  background: var(--primary-fg);
  box-shadow: inset 0 0 0 2px var(--primary-fg);
}

.cta-card .blob {
  opacity: 0.45;
  filter: blur(70px);
}
.cta-card .blob--a {
  width: 22rem; height: 22rem;
  top: -10rem; left: -8rem;
  background: radial-gradient(circle, rgba(193, 140, 93, 0.8), transparent 65%);
}
.cta-card .blob--b {
  width: 18rem; height: 18rem;
  bottom: -8rem; right: -4rem;
  background: radial-gradient(circle, rgba(230, 220, 205, 0.9), transparent 65%);
}

/* ---------- 15. Forms ---------- */
.field {
  display: block;
  margin-bottom: 1rem;
}

.field-label,
.control-group label,
.control-group > span {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

select,
input[type="text"],
input[type="search"],
input[type="email"] {
  width: 100%;
  height: 3rem;
  padding: 0 1.25rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 0.95rem;
  color: var(--fg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235D7052' stroke-width='2'><polyline points='5 8 10 13 15 8'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1rem 1.1rem;
  padding-right: 2.75rem;
}

input[type="text"],
input[type="search"],
input[type="email"] {
  background-image: none;
  padding-right: 1.25rem;
}

select:focus-visible,
input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 112, 82, 0.20);
  outline: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--fg);
}

.toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.toggle:hover { color: var(--primary); }

/* ---------- 16. Explorer (map) page ---------- */
.explorer-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .explorer-layout { grid-template-columns: 18rem 1fr; }
}

.control-panel {
  align-self: start;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
}

.control-group + .control-group,
.control-group + .mini-summary,
.mini-summary + .legend { margin-top: 1.5rem; }

.mini-summary {
  padding: 1rem 1.15rem;
  border-radius: var(--r-lg);
  background: rgba(240, 235, 229, 0.7);
  border: 1px solid rgba(222, 216, 207, 0.5);
}

.mini-summary h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.mini-summary p {
  color: var(--muted-fg);
  font-size: 0.92rem;
  line-height: 1.55;
}

.legend {
  display: grid;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.legend > div {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.swatch-sidewalk    { background: var(--muted-fg); }
.swatch-intersection { background: var(--primary); }
.swatch-traffic     { background: var(--secondary); }
.swatch-stop        { background: var(--destructive); }
.swatch-cross-south  { background: #2a9d8f; }
.swatch-cross-middle { background: #e9c46a; }
.swatch-cross-upper  { background: #f4a261; }
.swatch-cross-uc     { background: #6a4c93; }

.legend-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--secondary);
}

.map-panel {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1280px) {
  .map-panel { grid-template-columns: minmax(0, 1fr) 18rem; }
}

#map,
#map-crossings,
.map-canvas {
  min-height: 32rem;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid rgba(222, 216, 207, 0.6);
  box-shadow: var(--shadow-soft);
}

@media (min-width: 1024px) {
  #map,
  #map-crossings,
  .map-canvas { min-height: 36rem; }
}

.feature-panel {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
  align-self: start;
}

.feature-panel h3 { margin-bottom: 0.5rem; }
.feature-panel > p { color: var(--muted-fg); font-size: 0.95rem; line-height: 1.6; }

.feature-meta {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.feature-meta-row {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(222, 216, 207, 0.6);
}

.feature-meta-row:last-child { border-bottom: 0; }

.feature-meta-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--secondary);
}

.feature-meta-value {
  display: block;
  margin-top: 0.3rem;
  color: var(--fg);
  font-weight: 600;
  line-height: 1.45;
}

.feature-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--r-pill);
  background: rgba(93, 112, 82, 0.10);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92rem;
  transition: background var(--t-fast), transform var(--t-fast);
}

.feature-link:hover {
  background: var(--primary);
  color: var(--primary-fg);
  transform: scale(1.04);
}

.feature-link::after {
  content: "→";
  transition: transform var(--t-fast);
}

.feature-link:hover::after { transform: translateX(3px); }

/* Leaflet skin overrides — soften the corners + popups */
.leaflet-container { font-family: var(--font-sans); }

.leaflet-popup-content-wrapper {
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(222, 216, 207, 0.7);
}

.leaflet-popup-tip { background: var(--surface); }

.leaflet-control-zoom a {
  border-radius: var(--r-md) !important;
  color: var(--primary) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(222, 216, 207, 0.7) !important;
}

.leaflet-control-zoom a:hover { background: var(--primary) !important; color: var(--primary-fg) !important; }

/* ---------- 17. Bar chart, width pill, history ---------- */
.bar-chart { display: grid; gap: 1rem; }

.bar-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr; gap: 0.5rem; }
}

.bar-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--fg);
}

.bar-track {
  position: relative;
  height: 2.25rem;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: rgba(240, 235, 229, 0.8);
  border: 1px solid rgba(222, 216, 207, 0.6);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--primary), #7e9070);
}

.bar-secondary {
  background: linear-gradient(90deg, var(--secondary), #d6a779);
}

.bar-value {
  position: absolute;
  inset: 0 1rem 0 auto;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--fg);
}

.width-summary { display: grid; gap: 0.85rem; }

.width-pill {
  padding: 0.85rem 1.15rem;
  border-radius: var(--r-lg);
  background: rgba(254, 254, 250, 0.8);
  border: 1px solid rgba(222, 216, 207, 0.6);
}

.width-pill strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.history-list { display: grid; gap: 0.65rem; }

.history-row {
  padding: 0.85rem 1.15rem;
  border-radius: var(--r-lg);
  background: rgba(254, 254, 250, 0.8);
  border: 1px solid rgba(222, 216, 207, 0.6);
}

.history-row strong {
  color: var(--primary);
  font-weight: 700;
}

/* ---------- 18. Educational pages (DL/YOLO/U-Net 101) ---------- */
.prose {
  max-width: var(--w-3xl);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--fg);
}

.prose h2 { margin: 3rem 0 1.25rem; font-size: clamp(1.75rem, 3vw, 2.25rem); }
.prose h3 { margin: 2.25rem 0 0.75rem; font-size: 1.4rem; }
.prose p { color: var(--fg); }
.prose p + p { margin-top: 1.1rem; }
.prose ul, .prose ol { margin: 1rem 0; padding-left: 1.4rem; color: var(--fg); }
.prose li { margin: 0.4rem 0; }
.prose strong { color: var(--primary); font-weight: 700; }

.callout {
  margin: 1.75rem 0;
  padding: 1.5rem 1.75rem;
  background: rgba(230, 220, 205, 0.4);
  border-left: 4px solid var(--secondary);
  border-radius: var(--r-lg);
}

.callout p { color: var(--accent-fg); font-style: italic; }

.callout--moss {
  background: rgba(93, 112, 82, 0.08);
  border-left-color: var(--primary);
}

/* TOC links between 101 pages */
.tile-links {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .tile-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tile {
  display: block;
  padding: 2.25rem;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
  color: var(--fg);
  transition: transform var(--t-base), box-shadow var(--t-base);
  position: relative;
  overflow: hidden;
}

.tile:nth-child(odd)  { border-radius: 4rem 2rem 2rem 2rem; }
.tile:nth-child(even) { border-radius: 2rem 4rem 2rem 2rem; }

.tile:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: var(--shadow-lift);
  color: var(--fg);
}

.tile-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--secondary);
}

.tile h3 { margin: 0.6rem 0 0.5rem; }
.tile p { color: var(--muted-fg); }

.tile-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.tile:hover .tile-arrow { color: var(--secondary); }

/* Diagram primitive — used on YOLO/U-Net pages */
.diagram {
  margin: 2.25rem 0;
  padding: 2rem;
  background: rgba(240, 235, 229, 0.45);
  border: 1px dashed rgba(193, 140, 93, 0.4);
  border-radius: var(--r-xl);
}

.diagram svg { width: 100%; height: auto; }

.diagram-caption {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted-fg);
  font-style: italic;
  text-align: center;
}

/* Illustration frame — for raster visuals (concept boards, screenshots) */
.illustration {
  margin: 1.5rem 0 0;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid rgba(222, 216, 207, 0.6);
  border-radius: 3rem 1.5rem 3rem 1.5rem;
  box-shadow: var(--shadow-float);
  transition: transform var(--t-base), box-shadow var(--t-base);
}

.illustration:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.illustration img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2.5rem 1rem 2.5rem 1rem;
}

.illustration-caption {
  margin: 1rem 0.5rem 0.25rem;
  font-size: 0.9rem;
  color: var(--muted-fg);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* ---------- 19. Footer ---------- */
.footer {
  margin-top: 4rem;
  padding: 3rem 0 2.5rem;
  border-top: 1px solid rgba(222, 216, 207, 0.5);
  font-size: 0.9rem;
  color: var(--muted-fg);
}

.footer-inner {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr auto auto;
    gap: 2rem;
    align-items: start;
  }
}

.footer-team {
  font-size: 0.9rem;
  color: var(--muted-fg);
  line-height: 1.7;
}

.footer-team-label {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 0.35rem;
}

.footer-brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  margin-bottom: 0.4rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--muted-fg);
  font-weight: 600;
}

.footer-links a:hover { color: var(--primary); }

/* ---------- 20. Misc utilities ---------- */
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-pill);
  background: rgba(230, 220, 205, 0.6);
  color: var(--accent-fg);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tag--moss { background: rgba(93, 112, 82, 0.12); color: var(--primary); }
.tag--clay { background: rgba(193, 140, 93, 0.16); color: var(--secondary); }

/* =========================================================================
   21. MOTION POLISH — reveal-on-scroll, hero entrance, ambient floats
   Activates once `.js-ready` is set on <html> by interactions.js.
   ========================================================================= */

/* Reveal-on-scroll primitive — JS adds .reveal then .is-revealed */
.js-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 800ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
    transform 800ms cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms);
  will-change: transform, opacity;
}

.js-ready .reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Hero entrance — staged cascade on first paint (homepage) */
.js-ready .hero .eyebrow,
.js-ready .hero h1,
.js-ready .hero .hero-text,
.js-ready .hero .hero-actions {
  opacity: 0;
  animation: heroIn 950ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--hero-delay, 0ms);
}
.js-ready .hero .eyebrow      { --hero-delay: 200ms; }
.js-ready .hero h1            { --hero-delay: 380ms; }
.js-ready .hero .hero-text    { --hero-delay: 720ms; }
.js-ready .hero .hero-actions { --hero-delay: 920ms; }

@keyframes heroIn {
  from { opacity: 0; transform: translateY(32px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* Continuous gentle floats for ambient blobs */
@keyframes floatA {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -18px; }
}
@keyframes floatB {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 14px; }
}

.hero:not(.hero--video) .blob--a { animation: floatA 9s ease-in-out infinite; }
.hero:not(.hero--video) .blob--b { animation: floatB 11s ease-in-out infinite; }
.cta-card .blob--a { animation: floatA 10s ease-in-out infinite; }
.cta-card .blob--b { animation: floatB 12s ease-in-out infinite; }

/* Step number — gentle wobble keeps the organic shape feeling alive */
.step-num { animation: stepWobble 5s ease-in-out infinite; transform-origin: center; }
@keyframes stepWobble {
  0%, 100% { rotate: -3deg; }
  50%      { rotate: 3deg; }
}

/* Illustration — slow zoom on hover */
.illustration img { transition: transform 700ms cubic-bezier(0.4, 0, 0.2, 1); }
.illustration:hover img { transform: scale(1.02); }

/* Stat number — subtle settle once it lands (counter handles the count itself) */
.stat-value { display: inline-block; transition: transform var(--t-base); }

/* Scroll hint — small badge near bottom of the video hero */
.scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.05rem;
  border-radius: var(--r-pill);
  background: rgba(44, 44, 36, 0.38);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: rgba(243, 244, 241, 0.92);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid rgba(243, 244, 241, 0.18);
  pointer-events: none;
  animation: scrollHint 2.4s ease-in-out infinite;
}
.scroll-hint svg { width: 0.85rem; height: 0.85rem; }
@keyframes scrollHint {
  0%, 100% { translate: -50% 0;  opacity: 0.7; }
  50%      { translate: -50% 8px; opacity: 1; }
}

/* Card lift — tighten the existing transition for a snappier hover feel */
.card { transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 450ms cubic-bezier(0.22, 1, 0.36, 1); }

/* Tile lift on hover — slight tilt + lift (already partially defined) */
.tile { transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 500ms cubic-bezier(0.22, 1, 0.36, 1); }

/* Lenis-driven smooth scroll: html overflow stays the same, but disable native smooth */
html.lenis, html.lenis body { height: auto; }
html.lenis-smooth { scroll-behavior: auto !important; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }

  .js-ready .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .js-ready .hero .eyebrow,
  .js-ready .hero h1,
  .js-ready .hero .hero-text,
  .js-ready .hero .hero-actions {
    opacity: 1 !important;
    animation: none !important;
  }
  .hero:not(.hero--video) .blob--a,
  .hero:not(.hero--video) .blob--b,
  .cta-card .blob--a,
  .cta-card .blob--b,
  .step-num,
  .scroll-hint {
    animation: none !important;
  }
}
