:root {
  --forest-dark: #1a5c38;
  --forest-light: #4a9b6f;
  --accent-bg: #eaf6ee;
  --accent-bg-strong: #d4ebd9;
  --accent-orange: #c1592e;
  --accent-orange-light: #f3e0d5;
  --white: #ffffff;
  --text-dark: #16351f;
  --text-muted: #4d5c53;
  --border: #d9e8dd;
  --osm-gray: #9297a0;
  --osm-gray-text: #565b62;
  --shadow: 0 12px 30px -14px rgba(26, 92, 56, 0.35);
  --radius: 14px;
  --font-heading: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--forest-dark);
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--forest-dark);
}

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

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--forest-dark);
  color: var(--white);
  padding: 12px 20px;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn--primary {
  background: var(--forest-dark);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn--primary:hover {
  background: var(--forest-light);
  transform: translateY(-1px);
}

.btn--outline {
  background: transparent;
  color: var(--forest-dark);
  border: 2px solid var(--forest-dark);
}

.btn--outline:hover {
  background: var(--accent-bg);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand__name {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--forest-dark);
  font-size: 1.05rem;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  text-decoration: none;
  font-weight: 600;
  color: var(--text-dark);
}

.nav a:hover {
  color: var(--forest-light);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--forest-dark);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Video hero */
.video-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 560px;
  max-height: 960px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.video-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 30, 18, 0.45) 0%, rgba(10, 30, 18, 0.35) 50%, rgba(10, 30, 18, 0.65) 100%);
  z-index: 1;
}

.video-hero__content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
  color: var(--white);
}

.video-hero__wordmark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0 0 18px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.video-hero__wordmark span {
  display: block;
}

.video-hero__wordmark span:nth-child(2) {
  color: var(--accent-orange);
}

.video-hero__tagline {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 28px;
}

.video-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.btn--outline-inverse {
  border-color: var(--white);
  color: var(--white);
}

.btn--outline-inverse:hover {
  background: rgba(255, 255, 255, 0.15);
}

.video-hero__scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  color: var(--white);
  text-decoration: none;
  font-size: 1.1rem;
  animation: hero-scroll-cue 2s ease-in-out infinite;
}

.video-hero__scroll-cue:hover {
  background: rgba(255, 255, 255, 0.15);
}

@keyframes hero-scroll-cue {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* Map section */
.map-section {
  position: relative;
  width: 100%;
  padding: 0 64px;
}

.trail-map--section {
  height: clamp(600px, 92vh, 920px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--forest-light);
  margin-bottom: 10px;
}

/* Sections */
.section {
  padding: 88px 0;
}

.section__heading {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section__heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

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

/* Map */
.trail-map {
  width: 100%;
}

.map-status {
  background: rgba(255, 255, 255, 0.95);
  border-left: 4px solid var(--forest-light);
  padding: 12px 16px;
  margin: 16px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.map-status--error {
  border-left-color: #b3452f;
}

/* Verified Airtable amenity/town marker — kept visually distinct (large green
   branded pin) from the small gray OSM community-data dots below. */
/* No `position` set here on purpose: Mapbox GL JS uses this exact element as
   the marker root and positions it via `position: absolute` + a CSS
   transform. Overriding `position` (even to `relative`) breaks that
   anchoring, since our stylesheet loads after mapbox-gl.css and wins the
   cascade tie at equal specificity. Center the inner dot with flexbox
   instead of absolute positioning to avoid touching `position` at all. */
.trail-marker {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  background: var(--forest-dark);
  border: 3px solid var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: rotate(-45deg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trail-marker::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--white);
}

.trail-marker--selected {
  background: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(193, 89, 46, 0.3), 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* OSM Overpass "community data" marker — small, muted, unbranded */
.osm-poi-marker {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.osm-poi-marker__dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--osm-gray);
  border: 1.5px solid var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.osm-poi-marker__label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--osm-gray-text);
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-popup {
  font-family: var(--font-body);
  max-width: 260px;
}

.map-popup h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.map-popup__photo {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.map-popup p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.map-popup__amenities-label {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--forest-light);
  font-weight: 700;
  margin-bottom: 4px;
}

.map-popup__list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 140px;
  overflow-y: auto;
}

.map-popup__list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.map-popup__list li span {
  color: var(--forest-light);
  font-weight: 600;
  white-space: nowrap;
}

.map-popup__empty {
  font-style: italic;
  font-size: 0.85rem;
}

.amenity-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.amenity-icons__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-bg);
}

.amenity-icons__item img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.map-popup__link {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.map-popup__ride-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1.5px solid var(--forest-dark);
  background: var(--white);
  color: var(--forest-dark);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.map-popup__ride-btn:hover {
  background: var(--accent-bg);
}

.map-popup__ride-btn--active {
  background: var(--forest-dark);
  color: var(--white);
}

.map-popup__ride-btn--active:hover {
  background: var(--forest-light);
}

.mapboxgl-popup-content {
  border-radius: 10px !important;
  padding: 16px !important;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Trail towns */
.towns-section {
  background: var(--accent-bg);
}

.towns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.towns-grid__message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.town-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.town-card__media {
  position: relative;
  height: 150px;
  background: linear-gradient(135deg, var(--forest-dark), var(--forest-light));
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.town-card__initial {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.town-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--forest-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.town-card__badge--trail-ready {
  background: var(--forest-dark);
  color: var(--white);
}

.town-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.town-card__niche {
  color: var(--forest-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.town-card__link {
  margin-top: auto;
  font-weight: 600;
  text-decoration: none;
}

/* Plan your ride */
.plan-section {
  background: var(--white);
}

.ride-hint {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  margin: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--forest-dark);
}

.ride-popup {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  width: 320px;
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.ride-popup__header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  margin-bottom: 12px;
}

.ride-popup__header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.ride-popup__mini-summary {
  display: none;
  flex: 1;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--forest-dark);
}

.ride-popup__minimize {
  flex-shrink: 0;
  margin-left: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--forest-dark);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ride-popup__minimize:hover {
  background: var(--accent-bg);
}

.ride-popup--minimized {
  padding: 10px 14px;
  border-radius: 999px;
  max-height: none;
  overflow: visible;
}

.ride-popup--minimized .ride-popup__header {
  margin-bottom: 0;
}

.ride-popup--minimized .ride-popup__mini-summary {
  display: block;
}

.ride-popup--minimized .ride-popup__body {
  display: none;
}

.ride-planner__stops {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ride-planner__empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.88rem;
}

.ride-planner__stop {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ride-planner__stop--selected {
  border-color: var(--forest-dark);
  color: var(--forest-dark);
  background: var(--white);
}

.ride-planner__stop-badge {
  background: var(--accent-orange);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
}

.ride-planner__stop-remove {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent-bg-strong);
  color: var(--forest-dark);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ride-planner__stop-remove:hover {
  background: var(--forest-dark);
  color: var(--white);
}

.ride-planner__summary {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ride-planner__stat {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.ride-planner__stat-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--forest-dark);
}

.ride-planner__stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ride-popup__amenities {
  margin-bottom: 16px;
}

.ride-popup__amenities .amenity-icons {
  margin-bottom: 8px;
}

.ride-popup__amenity-list li span {
  white-space: normal;
  text-align: right;
}

.ride-popup__amenity-list {
  max-height: 200px;
}

.ride-planner__amenities-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ride-planner__clear {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.85rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.plan-card {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.plan-card h3 {
  font-size: 1.1rem;
}

.plan-card p {
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  background: var(--forest-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 40px 0;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.site-footer__brand {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
}

.site-footer__tagline {
  margin-bottom: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.7);
}

.site-footer__links {
  display: flex;
  gap: 20px;
}

.site-footer__links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 600;
}

.site-footer__links a:hover {
  color: var(--white);
}

.site-footer__credit {
  width: 100%;
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

/* Responsive */
@media (max-width: 720px) {
  .ride-hint,
  .ride-popup {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
    max-width: none;
  }

  .ride-popup {
    max-height: 42vh;
    padding: 16px;
  }

  .ride-popup--minimized {
    padding: 10px 14px;
    max-height: none;
  }

  .ride-popup__amenity-list {
    max-height: 130px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--white);
    padding: 16px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    display: none;
  }

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

  .nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .section {
    padding: 60px 0;
  }

  .map-section {
    padding: 0 16px;
  }

  .trail-map--section {
    height: clamp(520px, 90vh, 800px);
  }

  .video-hero {
    height: 100svh;
    min-height: 480px;
  }

  .video-hero__scroll-cue {
    display: none;
  }

}
