:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-2: #efe9df;
  --ink: #16181c;
  --ink-2: #4a4f57;
  --ink-3: #6b7079;
  --line: #e2dbcf;
  --accent: #d24f22;
  --accent-ink: #ffffff;
  --sky: #2b5d7d;
  --food: #c2410c;
  --fuel: #1d4ed8;
  --stay: #6d28d9;
  --sight: #0f766e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 8px 24px rgba(20, 20, 20, .08);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .08), 0 20px 50px rgba(0, 0, 0, .16);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --top: 60px;
  --gutter: 16px;
  --maxw: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d22;
    --surface-2: #22262c;
    --ink: #f2efe9;
    --ink-2: #c4c7cc;
    --ink-3: #9aa0a8;
    --line: #2d3238;
    --accent: #f06a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 760px) { :root { --gutter: 28px; } }

/* ---------- Top bar (chrome) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  height: var(--top); padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--top) + env(safe-area-inset-top));
  background: rgba(20, 22, 26, .78);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  color: #fff;
}
@media (prefers-reduced-transparency: reduce) { .topbar { background: #14161a; } }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; white-space: nowrap; min-height: 44px; color: #fff; }
.brand svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand b { color: #ffb08f; font-weight: 700; }
@media (max-width: 520px) { .brand span { display: none; } }
.daynav {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; flex: 1; padding: 8px 0; margin-left: auto;
  mask-image: linear-gradient(90deg, #000 90%, transparent);
}
@media (min-width: 1100px) { .daynav { justify-content: flex-end; mask-image: none; } }
.daynav::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; min-height: 44px; padding: 4px 10px; border-radius: 12px;
  text-decoration: none; color: rgba(255, 255, 255, .82); font-size: .8125rem; line-height: 1.15;
  border: 1px solid transparent;
}
.chip b { font-size: .9375rem; font-weight: 700; color: #fff; }
.chip small { font-size: .6875rem; opacity: .75; }
.chip:hover { background: rgba(255, 255, 255, .1); }
.chip[aria-current="page"] { background: #fff; color: #16181c; }
.chip[aria-current="page"] b { color: #16181c; }
.chip.ride::after { content: ''; width: 18px; height: 3px; border-radius: 2px; background: var(--c, var(--accent)); margin-top: 3px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: min(78vh, 720px); display: flex; align-items: flex-end;
  color: #fff; overflow: hidden; background: #222;
}
.hero.day { min-height: min(62vh, 560px); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.35) 60%, rgba(0,0,0,.78) 100%);
}
.hero .wrap { position: relative; z-index: 1; width: 100%; padding-bottom: 36px; }
.eyebrow { font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.hero h1 {
  font: 700 clamp(2.4rem, 7vw, 4.6rem)/1.02 var(--serif); margin: 8px 0 10px; letter-spacing: -.01em;
  text-wrap: balance;
}
.hero p.lede { font-size: clamp(1.0625rem, 2.2vw, 1.3rem); max-width: 40ch; margin: 0; opacity: .95; text-wrap: pretty; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); font-size: .875rem; font-weight: 500;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.credit-tag { position: absolute; right: 10px; bottom: 8px; z-index: 1; font-size: .6875rem; opacity: .7; color: #fff; }

/* ---------- Sections ---------- */
section.wrap { padding-top: 40px; padding-bottom: 40px; }
@media (max-width: 759px) { section.wrap { padding-top: 28px; padding-bottom: 28px; } }
h2.sec { font: 700 clamp(1.6rem, 3.6vw, 2.2rem)/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -.005em; }
.sub { color: var(--ink-2); margin: 0 0 20px; max-width: 62ch; }
.intro { font-size: 1.1875rem; color: var(--ink-2); max-width: 62ch; margin: 0; text-wrap: pretty; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Overview map */
.map-shell { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface-2); }
.map { width: 100%; height: 62vh; min-height: 340px; max-height: 640px; }
.overview .map { height: 70vh; max-height: 680px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.legend a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; font-size: .9375rem; font-weight: 500;
}
.legend i { width: 18px; height: 4px; border-radius: 3px; background: var(--c); }

/* Day cards */
.days { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .days { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .days { grid-template-columns: repeat(3, 1fr); } }
.daycard { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; }
.daycard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) { .daycard, .daycard:hover { transition: none; transform: none; } }
.daycard .ph { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); }
.daycard .ph img { width: 100%; height: 100%; object-fit: cover; }
.daycard .badge {
  position: absolute; left: 12px; top: 12px; padding: 5px 10px; border-radius: 999px;
  background: rgba(0,0,0,.6); color: #fff; font-size: .8125rem; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.daycard .badge i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.daycard .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.daycard h3 { font: 700 1.3rem/1.2 var(--serif); margin: 0; }
.daycard p { margin: 0; color: var(--ink-2); font-size: .9375rem; }
.daycard .meta { margin-top: auto; padding-top: 8px; display: flex; gap: 14px; color: var(--ink-3); font-size: .875rem; font-weight: 500; }

/* ---------- Day page ---------- */
.stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-top: -34px; position: relative; z-index: 2;
}
@media (min-width: 700px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface); padding: 14px 16px; }
.stat span { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.stat b { display: block; font: 700 1.25rem/1.25 var(--sans); margin-top: 2px; }
.highlights { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.highlights span { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: .875rem; font-weight: 500; color: var(--ink-2); }

.daygrid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 1000px) {
  .daygrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  .daygrid .mapcol { position: sticky; top: calc(var(--top) + 16px); order: 2; }
  .daygrid .mapcol .map { height: calc(100vh - var(--top) - 250px); min-height: 380px; max-height: none; }
}

/* Map controls */
.map-toolbar {
  position: absolute; left: 10px; top: 10px; z-index: 3; display: flex; gap: 8px; flex-wrap: wrap;
}
.seg { display: inline-flex; background: rgba(255,255,255,.92); border-radius: 12px; box-shadow: var(--shadow); padding: 3px; }
.seg button {
  border: 0; background: transparent; min-height: 38px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  font-size: .875rem; font-weight: 600; color: #333;
}
.seg button[aria-pressed="true"] { background: #16181c; color: #fff; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: .9375rem; text-decoration: none; cursor: pointer; box-shadow: var(--shadow);
}
.btn:hover { border-color: var(--ink-3); }
.map-toolbar .btn[hidden] { display: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn svg { width: 18px; height: 18px; flex: none; }
.map-toolbar .btn { min-height: 44px; background: rgba(255,255,255,.94); color: #16181c; border-color: transparent; }
.map-toolbar .btn.primary { background: var(--accent); color: #fff; }

.fly-hud {
  position: absolute; left: 10px; right: 10px; bottom: 34px; z-index: 4; display: none;
  align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(20,22,26,.8); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.fly-hud.on { display: flex; }
.fly-hud .txt { flex: 1; min-width: 0; font-size: .875rem; line-height: 1.3; }
.fly-hud .txt b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fly-hud .bar { height: 4px; background: rgba(255,255,255,.25); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.fly-hud .bar i { display: block; height: 100%; width: 0; background: #ffb08f; }
.fly-hud button { min-width: 44px; min-height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.16); color: #fff; font-weight: 600; cursor: pointer; padding: 0 12px; }

/* Markers */
.pin {
  width: 30px; height: 30px; border-radius: 50%; background: var(--k, var(--sight)); color: #fff;
  display: grid; place-items: center; font: 700 .8125rem/1 var(--sans); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer;
}
.pin.food { --k: var(--food); } .pin.fuel { --k: var(--fuel); } .pin.stay { --k: var(--stay); }
.pin.active { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(210,79,34,.35), 0 2px 6px rgba(0,0,0,.35); }
.town { padding: 4px 9px; border-radius: 999px; background: #16181c; color: #fff; font: 600 .75rem/1.2 var(--sans); box-shadow: 0 2px 6px rgba(0,0,0,.3); white-space: nowrap; }
.maplibregl-popup-content { border-radius: 14px; padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); font-family: var(--sans); color: #16181c; }
.pop { width: 230px; }
.pop img { width: 100%; height: 120px; object-fit: cover; }
.pop div { padding: 10px 12px 12px; }
.pop small { color: #6b7079; font-weight: 600; }
.pop b { display: block; font-size: .9375rem; line-height: 1.25; margin-top: 2px; }
.maplibregl-popup-close-button { width: 32px; height: 32px; font-size: 20px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

/* Elevation */
.elev { padding: 14px 14px 8px; margin-top: 12px; }
.elev header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 6px; }
.elev h3 { margin: 0; font-size: .9375rem; }
.elev .readout { font-size: .875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.elev svg { width: 100%; height: 130px; display: block; touch-action: pan-y; cursor: crosshair; }
.elev .area { fill: url(#eg); }
.elev .ln { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.elev .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.elev .axis { font-size: 11px; fill: var(--ink-3); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.help { font-size: .875rem; color: var(--ink-3); margin: 10px 2px 0; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl { position: relative; padding-left: 58px; margin-bottom: 18px; }
.tl .dot {
  position: absolute; left: 6px; top: 2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); color: var(--ink-3);
  font: 700 .8125rem/1 var(--sans);
}
.tl.food .dot { border-color: var(--food); color: var(--food); }
.tl.fuel .dot { border-color: var(--fuel); color: var(--fuel); }
.tl.stay .dot { border-color: var(--stay); color: var(--stay); }
.tl.sight .dot { border-color: var(--sight); color: var(--sight); }
.tl .time { font-size: .8125rem; font-weight: 700; letter-spacing: .02em; color: var(--accent); text-transform: uppercase; }
.tl h3 { margin: 2px 0 4px; font: 700 1.2rem/1.25 var(--serif); }
.tl p { margin: 0; color: var(--ink-2); }
.tl .photo { margin-top: 12px; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.tl .photo img { width: 100%; height: 100%; object-fit: cover; }
.tl .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.linkbtn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--surface-2); border: 0; cursor: pointer; font-size: .875rem; font-weight: 600; text-decoration: none; color: var(--ink);
}
.linkbtn:hover { background: var(--line); }
.linkbtn svg { width: 16px; height: 16px; }
.tl.active h3 { color: var(--accent); }

.notes { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .notes { grid-template-columns: 1fr 1fr; } }
.note { padding: 20px 22px; }
.note h3 { margin: 0 0 10px; font: 700 1.2rem/1.2 var(--serif); display: flex; gap: 10px; align-items: center; }
.note ul { margin: 0; padding-left: 20px; color: var(--ink-2); }
.note li + li { margin-top: 8px; }
.note p { margin: 0; color: var(--ink-2); }
.note.plan { background: linear-gradient(135deg, #fff7ed, #fdf2e9); }
@media (prefers-color-scheme: dark) { .note.plan { background: linear-gradient(135deg, #2a1f18, #231b16); } }
.sleep { display: flex; align-items: center; gap: 12px; padding: 16px 20px; margin-top: 16px; }
.sleep svg { width: 26px; height: 26px; color: var(--stay); flex: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { padding: 16px 18px; text-decoration: none; min-height: 44px; }
.pager a small { color: var(--ink-3); font-weight: 600; font-size: .8125rem; }
.pager a b { display: block; font: 700 1.1rem/1.25 var(--serif); margin-top: 2px; }
.pager a.next { text-align: right; grid-column: 2; }

/* Rest days */
.photos { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .photos { grid-template-columns: repeat(4, 1fr); } }
.photos figure { margin: 0; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4 / 3; }
.photos img { width: 100%; height: 100%; object-fit: cover; }

/* Footer */
.footer { padding: 40px var(--gutter) calc(40px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: .875rem; border-top: 1px solid var(--line); margin-top: 40px; }
.footer .wrap { padding: 0; }
.footer details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--ink-2); }
.footer ul { columns: 1; padding-left: 18px; }
@media (min-width: 760px) { .footer ul { columns: 2; } }
.footer li { break-inside: avoid; margin-bottom: 6px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.maplibregl-ctrl-attrib { font-size: 10px; }
