:root {
  --bg: #f4f1ec;
  --card: rgba(255, 255, 255, 0.96);
  --ink: #1d2433;
  --muted: #5d6677;
  --line: #e4e0d8;
  --accent: #e4572e;   /* drive */
  --ferry: #2b7bd6;
  --hike: #1f9d6a;
  --flight: #1d2433;
  --tip-bg: #fff6e5;
  --tip-ink: #7a4b00;
  --shadow: 0 10px 40px rgba(20, 25, 40, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --card: rgba(24, 28, 38, 0.95); --ink: #eef0f4; --muted: #a3abbb;
    --line: #2e3443; --tip-bg: #3a2c12; --tip-ink: #ffd590; --flight: #dfe5f0;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #12151c; --card: rgba(24, 28, 38, 0.95); --ink: #eef0f4; --muted: #a3abbb;
  --line: #2e3443; --tip-bg: #3a2c12; --tip-ink: #ffd590; --flight: #dfe5f0;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#map { position: fixed; inset: 0; z-index: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,0));
  color: #fff; pointer-events: none;
}
.brand { font-family: Fraunces, serif; font-weight: 700; font-size: 20px; letter-spacing: .2px; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.brand span { color: #ffb199; }
.now { font-size: 14px; opacity: .95; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.toggle {
  margin-left: auto; pointer-events: auto; cursor: pointer;
  font: 500 13px "DM Sans", sans-serif; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  box-shadow: var(--shadow);
}
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 6; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* ---------- day nav ---------- */
.days {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; gap: 8px;
}
.days button {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; background: rgba(29,36,51,.55); color: #fff;
  font: 700 12px "DM Sans", sans-serif; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: transform .2s, background .2s;
}
.days button.done { background: var(--accent); }
.days button.active { transform: scale(1.25); background: var(--accent); }

/* ---------- story ---------- */
.story { position: relative; z-index: 2; width: min(440px, 100%); margin-left: 28px; pointer-events: none; }
.step { min-height: 135vh; display: flex; align-items: flex-start; padding: 22vh 0 0; }
.step:first-child { min-height: 110vh; padding-top: 18vh; }
.step:last-child { min-height: 100vh; }

.card {
  pointer-events: auto;
  position: sticky; top: 76px;
  width: 100%; overflow: hidden;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  opacity: .55; transform: translateY(8px) scale(.985);
  transition: opacity .35s, transform .35s;
}
.step.is-active .card { opacity: 1; transform: none; }

.photo { position: relative; aspect-ratio: 16 / 9; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .credit {
  position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: #fff;
  background: rgba(0,0,0,.45); padding: 1px 6px; border-radius: 6px; max-width: 80%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo .credit a { color: inherit; }

.body { padding: 18px 20px 20px; }
.meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 12px; color: #fff; padding: 3px 10px; border-radius: 999px; background: var(--accent);
}
.badge.ferry { background: var(--ferry); }
.badge.hike { background: var(--hike); }
.badge.flight { background: #1d2433; }
.kicker { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }

h1, h2 { font-family: Fraunces, serif; margin: 0 0 8px; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 40px; }
h2 { font-size: 25px; }
p { margin: 0 0 12px; }
.body a { color: var(--accent); font-weight: 500; text-underline-offset: 2px; }
.tip a { color: inherit; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 14px 0 4px; }
.fact { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.fact b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.fact span { font-size: 14px; font-weight: 500; }

.sleep { display: flex; gap: 8px; align-items: baseline; margin-top: 12px; font-size: 14px; }
.sleep::before { content: "🛏"; }
.tip { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--tip-bg); color: var(--tip-ink); font-size: 14px; }
.tip::before { content: "Tip · "; font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.legend .l-ferry i { border-top: 3px dashed var(--ferry); }
.legend .l-hike i { border-top: 3px dotted var(--hike); }
.legend .l-flight i { border-top: 2px dashed var(--flight); }
.scroll-hint { margin-top: 16px; font-size: 13px; color: var(--muted); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

.checklist { list-style: none; padding: 0; margin: 8px 0 0; }
.checklist li { padding: 8px 0 8px 28px; border-bottom: 1px solid var(--line); position: relative; font-size: 15px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 11px; width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 5px; }

/* ---------- map markers ---------- */
.vehicle {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.3);
  font-size: 20px; line-height: 1;
}
.vehicle.ferry { border-color: var(--ferry); }
.vehicle.hike { border-color: var(--hike); }
.vehicle.flight { border-color: #1d2433; background: #1d2433; }
.vehicle svg { width: 24px; height: 24px; }

.stop {
  display: flex; align-items: center; gap: 6px;
  background: #fff; color: #1d2433; border-radius: 999px; padding: 3px 10px 3px 4px;
  font: 700 12px "DM Sans", sans-serif; box-shadow: 0 3px 10px rgba(0,0,0,.25); white-space: nowrap;
  opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s;
}
.stop.show { opacity: 1; transform: none; }
.stop .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #f1ede6; }

.maplibregl-ctrl-attrib { font-size: 10px; }

/* ---------- mobile: map on top, cards slide over the bottom ---------- */
@media (max-width: 760px) {
  .story { width: auto; margin: 0 16px; }
  .step { min-height: 130vh; padding-top: 60vh; }
  .step:first-child { padding-top: 46vh; }
  .card { top: 50vh; max-height: calc(50vh - 12px); overflow-y: auto; overscroll-behavior: contain; }
  .photo { aspect-ratio: 21 / 9; }
  h1 { font-size: 32px; }
  h2 { font-size: 22px; }
  .days { display: none; }
  .brand { font-size: 17px; }
  .now { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .stop { transition: none; }
  .scroll-hint { animation: none; }
}
