:root {
  --bg: #faf8f5;
  --bg-subtle: #f0ede8;
  --panel: #ffffff;
  --ink: #1a1a2e;
  --ink-soft: #4a5568;
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --primary-light: #d8f3dc;
  --accent: #e9a820;
  --accent-light: #fef3c7;
  --danger: #8d1f1f;
  --border: #d4d8d0;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 10px 32px rgba(26, 26, 46, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

/* --- Nav --- */

.site-nav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.nav-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* --- Main shell --- */

.shell {
  width: min(920px, 92vw);
  margin: 2rem auto 0;
  display: grid;
  gap: 1.25rem;
}

/* --- Hero --- */

.hero {
  padding: 1.5rem 0.2rem 0.5rem;
}

.brand {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.75rem;
}

h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.1;
  color: var(--ink);
}

.lede {
  margin: 0;
  color: var(--ink-soft);
  max-width: 60ch;
  font-size: 1.05rem;
  line-height: 1.55;
}

/* --- Cards --- */

.card,
.ad-slot,
.notice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card,
.notice {
  padding: 1.25rem;
}

.notice p {
  margin: 0;
}

/* --- Form --- */

.grid {
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field > span {
  font-weight: 700;
  font-size: 0.95rem;
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

input,
select,
button {
  font: inherit;
}

input::placeholder {
  color: #8e9aab;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  background: #fff;
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.actions {
  margin-top: 1rem;
}

button[type="submit"] {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

button[type="submit"]:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:focus-visible {
  outline: 3px solid rgba(45, 106, 79, 0.3);
  outline-offset: 2px;
}

.error {
  margin: 0.65rem 0 0;
  color: var(--danger);
  min-height: 1.25rem;
}

/* --- Autocomplete --- */

.autocomplete {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 15;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
}

.suggestion-option {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 0.62rem 0.72rem;
  cursor: pointer;
  border-bottom: 1px solid #edf0f2;
  transition: background var(--transition);
}

.suggestion-option:last-child {
  border-bottom: 0;
}

.suggestion-option:hover,
.suggestion-option.active {
  background: var(--primary-light);
}

.suggestion-label {
  font-weight: 700;
  font-size: 0.93rem;
  display: block;
}

.suggestion-meta {
  color: var(--ink-soft);
  font-size: 0.82rem;
  display: block;
  margin-top: 0.1rem;
}

/* --- Result --- */

.result {
  animation: fadeSlideIn 0.4s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--bg-subtle);
  padding-bottom: 0;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  border-radius: 0;
}

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

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.result h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.8vw, 2.2rem);
}

.result.walk-wins h2 {
  color: var(--primary);
}

.result.drive-wins h2 {
  color: var(--ink);
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* --- Comparison bars --- */

.comparison-bars {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.bar-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.bar-track {
  height: 28px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.bar-fill.driving {
  background: linear-gradient(90deg, #e76f51, #c1440e);
}

.bar-fill.walking {
  background: linear-gradient(90deg, var(--primary), #40916c);
}

.bar-value {
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

/* --- Breakdown --- */

details {
  margin-top: 0.9rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
  transition: color var(--transition);
}

summary:hover {
  color: var(--primary);
}

.breakdown {
  margin: 0.7rem 0 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.8rem;
}

.breakdown dt {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.breakdown dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.93rem;
}

.breakdown .section-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--bg-subtle);
  margin: 0.3rem 0;
}

.breakdown .total dt {
  font-weight: 700;
  color: var(--ink);
}

/* --- Info tooltips --- */

.info-tip {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.75rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline dotted;
  font-weight: 500;
}

.info-tip:hover {
  color: var(--primary-dark);
}

.info-bubble {
  display: none;
  grid-column: 1 / -1;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin: 0.1rem 0 0.3rem;
}

.info-bubble.open {
  display: block;
}

.info-bubble a {
  color: var(--primary-dark);
  font-weight: 600;
}

/* --- Content highlights (home page) --- */

.content-highlights {
  margin-top: 0.5rem;
}

.highlight-grid {
  display: grid;
  gap: 1rem;
}

.highlight-card {
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}

.highlight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.highlight-card h3 {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.highlight-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.5;
}

/* --- Content pages --- */

.content-page {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 1rem;
}

.content-page h1 {
  margin-bottom: 0.5rem;
}

.content-page h2 {
  margin: 2rem 0 0.5rem;
  color: var(--primary-dark);
  font-size: 1.35rem;
}

.content-page p {
  margin: 0 0 1rem;
  line-height: 1.7;
}

.content-page ul {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
  line-height: 1.7;
}

.content-page li {
  margin-bottom: 0.4rem;
}

.content-page code {
  background: var(--bg-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.cta-link {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
}

.cta-link a {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* --- Assumptions --- */

.assumptions ul {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

/* --- Ad slot --- */

.ad-slot {
  padding: 0.85rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* --- Footer --- */

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 1rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color var(--transition);
}

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

.footer-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* --- Desktop --- */

@media (min-width: 760px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 1.4rem;
  }

  .highlight-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* --- Mobile --- */

@media (max-width: 759px) {
  .shell {
    width: min(920px, 92vw);
    margin: 1rem auto 0;
    gap: 1rem;
  }

  .hero {
    padding: 1rem 0.2rem 0.25rem;
  }

  h1 {
    font-size: clamp(1.8rem, 9vw, 2.2rem);
  }

  .lede {
    font-size: 0.98rem;
  }

  .card {
    padding: 1rem;
  }

  input,
  select {
    padding: 0.76rem 0.78rem;
    font-size: 1rem;
  }

  .suggestions {
    max-height: 220px;
  }

  .actions {
    margin-top: 0.95rem;
  }

  button[type="submit"] {
    width: 100%;
    padding: 0.82rem 1rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-direction: column;
    padding: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .bar-row {
    grid-template-columns: 60px 1fr auto;
  }

  .bar-label {
    font-size: 0.78rem;
  }

  .highlight-grid {
    grid-template-columns: 1fr;
  }

  .ad-slot {
    font-size: 0.82rem;
    padding: 0.75rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.4rem;
  }
}
