:root {
  --paper: #f4efe6;
  --sea: #e9e4d8;
  --land: #ddd3bf;
  --land-visited: #d9b99a;
  --border: #f4efe6;
  --ink: #26221d;
  --muted: #6d655a;
  --accent: #b5402b;
  --card: rgba(250, 247, 240, 0.94);
  --u: 1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  line-height: 1.55;
}

.nav {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(var(--paper), rgba(244, 239, 230, 0));
}
.nav__title { background: var(--paper); padding: 4px 10px; border-radius: 6px; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.nav__stops { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav__stops button {
  font: inherit; font-size: 13px; color: var(--ink);
  background: transparent; border: 1px solid rgba(38, 34, 29, .25);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.nav__stops button:hover, .nav__stops button.is-active { background: var(--ink); color: var(--paper); }

.story { position: relative; display: grid; grid-template-columns: minmax(300px, 38%) 1fr; }

.stage { position: sticky; top: 0; height: 100vh; height: 100dvh; grid-column: 2; grid-row: 1; background: var(--sea); overflow: hidden; }
.map { width: 100%; height: 100%; display: block; }

.panels { grid-column: 1; grid-row: 1; position: relative; z-index: 5; pointer-events: none; }
.panel { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; padding: 80px 32px 40px; }
.panel__inner { pointer-events: auto; max-width: 420px; }
.panel__kicker { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.panel h2 { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; font-weight: 500; margin: 0 0 8px; }
.panel__dates { color: var(--muted); font-size: 14px; margin: 0 0 14px; font-style: italic; }
.panel p.panel__body { margin: 0 0 14px; font-size: 17px; }
.panel__pins { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.panel__pins button {
  font: inherit; font-size: 13px; color: var(--ink); background: transparent;
  border: 1px solid rgba(38, 34, 29, .3); border-radius: 999px; padding: 3px 10px; cursor: pointer;
}
.panel__pins button:hover { background: var(--ink); color: var(--paper); }
.panel__hint {
  font-size: 15px; font-weight: 500; color: var(--accent); letter-spacing: .02em;
  margin-top: 22px; text-align: center;
  animation: hint-bounce 1.8s ease-in-out infinite;
}

/* map */
.province { fill: var(--land); stroke: var(--border); stroke-width: calc(var(--u) * 1px); stroke-linejoin: round; transition: fill .4s; }
.province.is-visited { fill: var(--land-visited); }
.province.is-active { fill: #d2a681; }

.route-ghost { fill: none; stroke: rgba(38, 34, 29, .28); stroke-width: calc(var(--u) * 1.5px); stroke-dasharray: calc(var(--u) * 3px) calc(var(--u) * 5px); stroke-linecap: round; }
.route-drawn { fill: none; stroke: var(--accent); stroke-width: calc(var(--u) * 3px); stroke-linecap: round; }

.stop { cursor: pointer; outline: none; }
.stop__dot { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.stop__label { font-size: 13px; fill: var(--ink); font-family: inherit; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; letter-spacing: .02em; text-anchor: middle; transition: opacity .15s; }
.stop:hover .stop__dot { fill: var(--accent); }
.stop:focus-visible .stop__dot { stroke: var(--accent); stroke-width: 3; }

.pin { cursor: pointer; transition: opacity .3s; outline: none; }
.pin__dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.pin__label { opacity: 0; transition: opacity .15s; pointer-events: none; font-size: 12px; fill: var(--ink); font-family: inherit; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; text-anchor: middle; }
.pin:hover .pin__dot, .pin.is-hot .pin__dot { fill: var(--ink); }
.pin:hover .pin__label, .pin.is-hot .pin__label { opacity: 1; }
.pin:focus-visible .pin__dot { stroke: var(--ink); stroke-width: 3; }
.pin:focus-visible .pin__label { opacity: 1; }
.pin.is-dimmed .pin__label { opacity: 0; }

.marker__dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2.5; pointer-events: none; }
.marker__pulse { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .5; transform-box: fill-box; transform-origin: center; animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .7; } to { transform: scale(2.2); opacity: 0; } }
@keyframes hint-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* photo card */
.card {
  position: absolute; z-index: 10; right: 20px; bottom: 20px; width: min(440px, calc(100% - 40px));
  max-height: calc(100% - 40px); overflow-y: auto;
  background: var(--card); backdrop-filter: blur(6px); border-radius: 10px; padding: 12px 12px 14px;
  box-shadow: 0 6px 30px rgba(38, 34, 29, .2);
}
.card[hidden] { display: none; }
.card h3 { margin: 10px 0 2px; font-weight: 500; font-size: 19px; }
.card p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.panel__body a, .card p a { color: var(--accent); text-decoration-color: rgba(181, 64, 43, .4); }
.panel__body a:hover, .card p a:hover { text-decoration-color: var(--accent); }
.card__photo { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; background: var(--land); overflow: hidden; display: grid; place-items: center; font-size: 13px; color: rgba(38, 34, 29, .55); touch-action: pan-y; }
.card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__close { position: absolute; top: 6px; right: 8px; z-index: 2; border: 0; background: rgba(250, 247, 240, .8); border-radius: 50%; width: 28px; height: 28px; font-size: 18px; line-height: 1; cursor: pointer; }

.card__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(250, 247, 240, .85); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.card__nav:hover { background: var(--paper); }
.card__nav--prev { left: 6px; }
.card__nav--next { right: 6px; }
.card__count {
  position: absolute; bottom: 6px; right: 8px; z-index: 1;
  background: rgba(38, 34, 29, .55); color: var(--paper);
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
}

/* lightbox */
.card__photo img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 17, 14, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: min(92vw, 1400px); max-height: 88vh; object-fit: contain; border-radius: 4px; }
.lightbox__close {
  position: absolute; top: 18px; right: 22px; z-index: 2;
  border: 0; background: rgba(250, 247, 240, .15); color: var(--paper);
  width: 38px; height: 38px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer;
}
.lightbox__close:hover { background: rgba(250, 247, 240, .3); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(250, 247, 240, .15); color: var(--paper);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox__nav:hover { background: rgba(250, 247, 240, .3); }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }
.lightbox__count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: var(--paper); font-size: 13px; background: rgba(250, 247, 240, .15); padding: 3px 10px; border-radius: 999px;
}

/* narrow screens: map fills the screen behind the text */
@media (max-width: 800px) {
  .story { display: block; }
  .stage { position: fixed; inset: 0; z-index: 0; }
  .panels { position: relative; z-index: 5; }
  .panel { align-items: flex-end; padding: 80px 14px 24px; }
  .panel__inner { background: var(--card); backdrop-filter: blur(6px); padding: 16px 18px; border-radius: 12px; max-width: none; width: 100%; }
  .panel h2 { font-size: 30px; }
  .nav__title { display: none; }
  .nav { justify-content: center; }
  .card { top: 70px; bottom: auto; right: 14px; max-height: calc(100% - 90px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marker__pulse { animation: none; }
  .panel__hint { animation: none; }
}
