/* Infinite Road — example-drives demo pages.
   The flagship marketing surface: a paper-and-ink map product, shown in
   paper and ink. Type: Playfair Display (display), Spectral (reading),
   DM Sans (UI). Palette mirrors the app's drive screen. */

:root {
  --paper: #F7F5E6;        /* the map's own paper — pages sit on the same sheet */
  --paper-deep: #F0EBD6;   /* slightly toasted paper for wells/footer */
  --card: #FCFAF0;         /* raised card */
  --ink: #1A2F23;          /* app label ink (deep forest) */
  --ink-soft: #4A544A;
  --ink-faint: #8A8F82;
  --rule: #DDD6BE;
  --orange: #D4622A;       /* the route ribbon */
  --orange-deep: #B84E1E;
  --shadow: 0 1px 2px rgba(38, 46, 36, 0.06), 0 8px 28px rgba(38, 46, 36, 0.09);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body.demo {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.demo a { color: inherit; text-decoration: none; }

/* paper tooth over everything except the map (the map brings its own) */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  opacity: 0.045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: relative; z-index: 30;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 26px clamp(20px, 5vw, 56px) 0;
}
.wordmark {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 21px; letter-spacing: 0.01em;
}
.topbar nav { display: flex; gap: 26px; font-size: 14px; color: var(--ink-soft); }
.topbar nav a:hover { color: var(--orange-deep); }
.topbar nav .here { color: var(--ink); border-bottom: 1.5px solid var(--orange); padding-bottom: 2px; }

/* ── index hero ──────────────────────────────────────────────────────── */
/* hero spans the same width as the map below it (same side margins) so the
   page reads as one column, not a narrow text block over a wide map */
.index-hero {
  position: relative; z-index: 30;
  padding: clamp(34px, 7vh, 76px) clamp(20px, 5vw, 56px) 26px;
}
.index-hero h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: clamp(34px, 5.2vw, 58px);
  line-height: 1.06;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.index-hero p {
  font-size: clamp(15px, 1.6vw, 17.5px);
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
}
.index-hero p strong { color: var(--ink); font-weight: 500; }

/* ── index map ───────────────────────────────────────────────────────── */
.index-map-wrap {
  position: relative;
  margin: 26px clamp(20px, 5vw, 56px) 0;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#map.index-map { height: min(72vh, 720px); }
.map-hint {
  position: absolute; left: 14px; bottom: 14px; z-index: 5;
  background: rgba(252, 250, 240, 0.92);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px; color: var(--ink-soft);
  backdrop-filter: blur(3px);
}
.region-jump {
  position: absolute; right: 14px; top: 14px; z-index: 5;
  display: flex; gap: 6px;
}
.region-jump button {
  font: 500 12.5px 'DM Sans', sans-serif;
  color: var(--ink-soft);
  background: rgba(252, 250, 240, 0.92);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  backdrop-filter: blur(3px);
}
.region-jump button:hover { color: var(--orange-deep); border-color: var(--orange); }
.region-jump button.active { color: var(--card); background: var(--ink); border-color: var(--ink); }

/* route hover card on the index map */
.route-tip {
  position: absolute; z-index: 6; pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  white-space: nowrap;
  opacity: 0; transition: opacity 120ms ease;
}
.route-tip.show { opacity: 1; }
.route-tip .t { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 15px; }
.route-tip .s { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ── route directory (crawlable) ─────────────────────────────────────── */
.directory {
  position: relative; z-index: 30;
  padding: 44px clamp(20px, 5vw, 56px) 30px;
}
.directory h2, .stories h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 22px;
  margin: 0 0 6px;
}
.directory .dir-sub { font-size: 14px; color: var(--ink-soft); margin: 0 0 22px; }
.dir-region { margin: 26px 0 10px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.dir-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}
/* Cards fill their grid row (uniform height per row) and the chip row pins
   to the bottom so a ragged mix of 1- and 2-chip cards still lines up. */
.dir-grid li { display: flex; }
.dir-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 20px 16px;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.dir-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #CFC6A8; }
.dir-card .t { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 17.5px; line-height: 1.25; }
.dir-card .s { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-top: 5px; }
.dir-card .m { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 12px; }
.chip {
  display: inline-block;
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--paper);
}
.chip.mission { color: var(--orange-deep); border-color: rgba(212, 98, 42, 0.35); }

/* ── narrators (in-app persona carousel, mirrored) ──────────────────── */
.narrators {
  position: relative; z-index: 30;
  padding: 44px clamp(20px, 5vw, 56px) 6px;
}
.narrators h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 22px;
  margin: 0 0 6px;
}
.narrator-grid {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.narrator-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 18px 16px;
  text-align: center;
}
.narrator-card img {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--rule);
  background: var(--paper);
}
.narrator-card .n-name {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 17px;
  margin-top: 12px;
}
.narrator-card .n-tag {
  font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--orange-deep);
  margin-top: 4px;
}
.narrator-card .n-desc {
  font-size: 13px; color: var(--ink-soft); line-height: 1.55;
  margin-top: 10px;
}

/* ── route page hero ─────────────────────────────────────────────────── */
.route-hero {
  position: relative; z-index: 30;
  padding: clamp(26px, 5vh, 52px) clamp(20px, 5vw, 56px) 22px;
}
.crumb { font-size: 14.5px; color: var(--ink-faint); margin-bottom: 14px; display: inline-block; }
.crumb:hover { color: var(--orange-deep); }
.route-hero h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1.08; letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.route-hero h1 .arrow { color: var(--orange); font-weight: 500; padding: 0 0.12em; }
.route-hero .sub { font-size: clamp(14.5px, 1.5vw, 16.5px); color: var(--ink-soft); margin: 0 0 16px; max-width: 640px; line-height: 1.6; }
.route-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.route-meta .chip { font-size: 12px; padding: 5px 12px; }
.route-meta .stat { font-size: 13px; color: var(--ink-faint); margin-left: 6px; }

/* ── route map ───────────────────────────────────────────────────────── */
.route-map-wrap {
  position: relative;
  margin: 4px clamp(20px, 5vw, 56px) 0;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#map.route-map { height: min(74vh, 760px); }

/* explainer strip for visitors who land on a route page cold */
.explainer {
  position: relative; z-index: 30;
  margin: 30px clamp(20px, 5vw, 56px) 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--orange);
  border-radius: 10px;
  padding: 16px 22px;
  max-width: 880px;
}
.explainer p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--ink-soft); }
.explainer strong { color: var(--ink); font-weight: 500; }

/* sources block — featured, not a footnote */
.sources {
  position: relative; z-index: 30;
  padding: 8px clamp(20px, 5vw, 56px) 40px;
  max-width: 880px;
}
.sources h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 22px;
  margin: 0 0 10px;
}
.sources p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); max-width: 68ch; }

/* story popup card on the map */
.mapboxgl-popup.story-pop .mapboxgl-popup-content {
  font-family: 'DM Sans', sans-serif;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
  max-width: 290px;
}
.mapboxgl-popup.story-pop .mapboxgl-popup-tip { border-top-color: var(--card); }
.story-pop .p { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 5px; }
.story-pop .t { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 16px; line-height: 1.3; margin-bottom: 10px; }
.story-pop .row { display: flex; align-items: center; gap: 10px; }
.story-pop .goto { font-size: 12.5px; color: var(--orange-deep); cursor: pointer; }
.story-pop .goto:hover { text-decoration: underline; }

/* ── play button (shared: popup + story list) ────────────────────────── */
.play {
  --d: 40px;
  width: var(--d); height: var(--d);
  flex: 0 0 var(--d);
  border-radius: 50%;
  border: 1.5px solid var(--orange);
  background: transparent;
  color: var(--orange-deep);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 140ms ease, transform 140ms ease;
}
.play:hover { background: rgba(212, 98, 42, 0.09); transform: scale(1.04); }
.play svg { width: 15px; height: 15px; display: block; }
.play .ico-pause { display: none; }
.play.playing { background: var(--orange); color: #FCFAF0; }
.play.playing .ico-play { display: none; }
.play.playing .ico-pause { display: block; }
.play.loading { opacity: 0.55; pointer-events: none; }
.play[data-noaudio] { border-color: var(--rule); color: var(--ink-faint); pointer-events: none; }

/* The timer is absolutely positioned so its per-second width changes never
   re-flow the row (in-flow it nudged the title back and forth as digits
   changed width). The playing card reserves the vertical room instead. */
.play-col { position: relative; flex: 0 0 auto; display: flex; }
.play-time {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
  pointer-events: none;
}
.story.playing .story-head { padding-bottom: 18px; }

/* ── stories list ────────────────────────────────────────────────────── */
.stories {
  position: relative; z-index: 30;
  padding: 46px clamp(20px, 5vw, 56px) 34px;
  max-width: 880px;
}
.stories .note { font-size: 14px; color: var(--ink-soft); line-height: 1.6; margin: 0 0 30px; max-width: 640px; }
.story-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.story {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 22px 16px;
  scroll-margin-top: 90px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.story.playing { border-color: rgba(212, 98, 42, 0.55); box-shadow: var(--shadow); }
.story-head { display: flex; align-items: center; gap: 16px; }
.story-no {
  font-family: 'Playfair Display', serif;
  font-size: 14px; font-weight: 600;
  color: var(--ink-faint);
  min-width: 22px; text-align: right;
}
.story-head .meta { flex: 1; min-width: 0; }
.story-place { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 4px; }
.story-head h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: 19px; line-height: 1.3;
  margin: 0;
}
.transcript { margin: 14px 0 0 38px; }
.transcript summary {
  font-size: 13px; color: var(--ink-faint);
  cursor: pointer; user-select: none;
  list-style: none; display: inline-flex; align-items: center; gap: 7px;
}
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 140ms ease; margin-top: -2px; }
.transcript[open] summary::before { transform: rotate(45deg); margin-top: -5px; }
.transcript summary:hover { color: var(--orange-deep); }
.transcript .tx {
  font-family: 'Spectral', Georgia, serif;
  font-size: 15.5px; line-height: 1.78;
  color: #33402F;
  margin: 12px 0 4px;
  max-width: 66ch;
}
.transcript .tx p { margin: 0 0 1em; }
.transcript .tx p:last-child { margin-bottom: 0; }
.seg-mark { font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); margin: 18px 0 10px; }

/* ── footer ──────────────────────────────────────────────────────────── */
.demo-footer {
  position: relative; z-index: 30;
  margin-top: 26px;
  background: var(--paper-deep);
  border-top: 1px solid var(--rule);
  padding: 40px clamp(20px, 5vw, 56px) 46px;
}
.demo-footer .cta {
  font-family: 'Playfair Display', serif;
  font-weight: 600; font-size: clamp(21px, 2.6vw, 28px);
  margin: 0 0 8px;
}
.demo-footer .cta-sub { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 26px; max-width: 560px; line-height: 1.6; }
.demo-footer .fineprint {
  font-size: 12.5px; color: var(--ink-faint); line-height: 1.65;
  border-top: 1px solid var(--rule);
  padding-top: 18px; margin-top: 8px;
  max-width: 720px;
}
.demo-footer .legal { margin-top: 14px; font-size: 12.5px; color: var(--ink-faint); display: flex; gap: 14px; }
.demo-footer .legal a:hover { color: var(--orange-deep); }

/* mapbox chrome, tuned to the paper */
.mapboxgl-ctrl-attrib { font-size: 10.5px; background: rgba(247, 245, 230, 0.75) !important; }
.mapboxgl-ctrl-logo { opacity: 0.65; }
.mapboxgl-canvas:focus { outline: none; }

@media (max-width: 640px) {
  #map.route-map { height: 56vh; }
  #map.index-map { height: 58vh; }
  .story { padding: 15px 16px 13px; }
  .transcript { margin-left: 0; }
  .topbar nav { gap: 16px; }
}
