/* ══════════════════════════════════════════════════════════════
   The Long Way Round — vintage expedition stylesheet
   Palette: cream #F5ECD9 · teal #1D4E4A · rust #B4552D
            ochre #C8912F · ink #2A2320
   ══════════════════════════════════════════════════════════════ */

:root {
  --cream: #f5ecd9;
  --cream-deep: #ecdfc3;
  --teal: #1d4e4a;
  --teal-soft: #2e6b65;
  --rust: #b4552d;
  --rust-bright: #cf6a3d;
  --ochre: #c8912f;
  --ochre-soft: #d9ac59;
  --ink: #2a2320;
  --ink-soft: #55483f;
  --paper-line: rgba(42, 35, 32, 0.14);
  --card-shadow: 0 2px 6px rgba(42, 35, 32, 0.10), 0 12px 32px rgba(42, 35, 32, 0.12);
  --font-display: "Fraunces", "Georgia", serif;
  --font-text: "Newsreader", "Georgia", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--cream);
  background-image: url("../assets/generated/generated-paper-texture-001.png");
  background-size: 640px;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 19px;
  line-height: 1.55;
}

a { color: var(--rust); text-decoration-color: rgba(180, 85, 45, 0.4); text-underline-offset: 2px; }
a:hover { color: var(--rust-bright); }

/* ─────────── Hero ─────────── */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  border-bottom: 5px double var(--teal);
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 62%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(245, 236, 217, 0.10) 0%,
    rgba(245, 236, 217, 0.00) 34%,
    rgba(42, 35, 32, 0.42) 100%);
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 120px 24px 30px;
  display: flex;
  align-items: flex-end;
  gap: 22px;
}

.hero-badge {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(42, 35, 32, 0.45);
  border: 3px solid var(--cream);
  background: var(--cream);
  flex: 0 0 auto;
  transition: transform 1.2s cubic-bezier(.2, .9, .3, 1.3);
}
.hero-badge:hover { transform: rotate(360deg); }

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 6.4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(42, 35, 32, 0.55), 0 6px 26px rgba(42, 35, 32, 0.5);
}

.hero-tagline {
  margin: 10px 0 6px 2px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  color: var(--cream);
  text-shadow: 0 1px 0 rgba(42, 35, 32, 0.6), 0 4px 18px rgba(42, 35, 32, 0.55);
}

/* ─────────── Departure board ─────────── */

main { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

.board {
  margin: 44px auto 30px;
  max-width: 860px;
  text-align: center;
}

.board-lede {
  font-size: 1.22rem;
  line-height: 1.6;
  margin: 0 auto 30px;
  max-width: 640px;
}
.board-lede em { color: var(--rust); font-weight: 600; }

.controls {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
}

.field {
  position: relative;
  flex: 1 1 280px;
  max-width: 360px;
  text-align: left;
}

.field label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 2px 6px;
}

.field input {
  width: 100%;
  font-family: var(--font-text);
  font-size: 1.25rem;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 252, 243, 0.75);
  border: 2px solid var(--teal);
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(42, 35, 32, 0.07);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--rust);
  box-shadow: inset 0 2px 4px rgba(42,35,32,.07), 0 0 0 4px rgba(180, 85, 45, 0.16);
}

.picked {
  margin: 7px 2px 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-style: italic;
  min-height: 1.2em;
}
.picked b { color: var(--teal); font-style: normal; }

.ac-list {
  position: absolute;
  top: calc(100% - 2px);
  left: 0; right: 0;
  z-index: 40;
  background: #fffcf3;
  border: 2px solid var(--teal);
  border-radius: 0 0 12px 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: none;
}
.ac-list.open { display: block; }

.ac-item {
  padding: 9px 14px;
  cursor: pointer;
  border-top: 1px solid var(--paper-line);
  text-align: left;
}
.ac-item:first-child { border-top: none; }
.ac-item .ac-label { font-weight: 600; }
.ac-item .ac-desc { display: block; font-size: 0.85rem; color: var(--ink-soft); }
.ac-item:hover, .ac-item.active { background: rgba(200, 145, 47, 0.16); }

.swap {
  flex: 0 0 auto;
  align-self: center;
  margin-top: 22px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--cream);
  color: var(--teal);
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform .3s, background .15s;
}
.swap:hover { background: var(--teal); color: var(--cream); transform: rotate(180deg); }

.board-actions {
  margin-top: 26px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--teal);
  background: var(--cream);
  color: var(--teal);
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 0 rgba(42, 35, 32, 0.25);
  transition: transform .12s, box-shadow .12s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(42,35,32,.22); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(42,35,32,.3); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-go {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--cream);
  font-size: 1.18rem;
  padding: 13px 30px;
}
.btn-go:hover { background: var(--rust-bright); border-color: var(--rust-bright); }

.board-error {
  margin-top: 16px;
  color: var(--rust);
  font-weight: 600;
}

/* ─────────── Expedition (live search) ─────────── */

.expedition { margin: 40px 0 20px; }

.expedition-head { text-align: center; }

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  color: var(--teal);
  margin: 0 0 6px;
}

.ticker {
  font-style: italic;
  color: var(--ink-soft);
  min-height: 1.5em;
  transition: opacity .3s;
}

.constellation-wrap {
  position: relative;
  margin-top: 18px;
  border: 2px solid var(--teal);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 12% 88%, rgba(200,145,47,0.10), transparent 55%),
    radial-gradient(ellipse at 88% 12%, rgba(29,78,74,0.10), transparent 55%),
    #fbf5e6;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

#constellation { display: block; width: 100%; height: 460px; }

.constellation-legend {
  position: absolute;
  top: 12px; left: 16px;
  display: flex;
  gap: 18px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: rgba(251, 245, 230, 0.8);
  padding: 4px 10px;
  border-radius: 8px;
}
.leg { display: inline-flex; align-items: center; gap: 6px; }
.leg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leg-from i { background: var(--ochre); }
.leg-to i { background: var(--teal); }
.leg-meet i { background: var(--rust); }
.leg b { font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.constellation-stats {
  position: absolute;
  bottom: 10px; right: 16px;
  display: flex;
  gap: 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: rgba(251, 245, 230, 0.8);
  padding: 4px 10px;
  border-radius: 8px;
}
.constellation-stats b { color: var(--rust); font-variant-numeric: tabular-nums; }

.constellation-hint {
  position: absolute;
  bottom: 10px; left: 16px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  background: rgba(251, 245, 230, 0.8);
  padding: 4px 10px;
  border-radius: 8px;
  pointer-events: none;
}

/* node inspection popover (detail-on-demand) */
.kg-pop {
  position: absolute;
  z-index: 60;
  width: 276px;
  max-height: 88%;
  overflow-y: auto;
  background: #fffcf3;
  border: 2px solid var(--rust);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 12px 14px 12px;
  animation: pop-in .18s ease-out;
}
.kg-pop::-webkit-scrollbar { width: 8px; }
.kg-pop::-webkit-scrollbar-thumb { background: rgba(180,85,45,.35); border-radius: 4px; }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } }

.kg-pop-close {
  position: absolute;
  top: 4px; right: 8px;
  border: none; background: none;
  font-size: 1.25rem;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.kg-pop-close:hover { color: var(--rust); }

.kg-pop-img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--cream-deep);
  filter: sepia(0.22) saturate(0.94);
  margin-bottom: 8px;
}

.kg-pop-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.15;
}
.kg-pop-name a { color: var(--ink); text-decoration: none; }
.kg-pop-name a:hover { color: var(--rust); text-decoration: underline; }

.kg-pop-desc { font-size: 0.85rem; color: var(--ink-soft); margin: 3px 0 9px; }

.kg-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.kg-pop-actions button, .kg-pop-wiki {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--teal);
  background: var(--cream);
  color: var(--teal);
  cursor: pointer;
  text-decoration: none;
}
.kg-pop-actions button:hover, .kg-pop-wiki:hover { background: var(--teal); color: var(--cream); }
.kg-pop-wiki { border-color: var(--ochre); color: var(--ochre); }
.kg-pop-wiki:hover { background: var(--ochre); color: var(--cream); }

.kg-pop-neigh {
  margin-top: 11px;
  border-top: 1px dashed var(--paper-line);
  padding-top: 9px;
}
.kg-pop-neigh-head {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ochre);
  margin-bottom: 6px;
}
.kg-pop-neigh-list { display: flex; flex-direction: column; gap: 4px; }
.kg-neigh {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 1px;
  padding: 5px 9px;
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  background: rgba(245, 236, 217, 0.5);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.kg-neigh:hover { background: rgba(200, 145, 47, 0.16); border-color: var(--ochre); }
.kg-neigh-rel {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-soft);
}
.kg-neigh-name { font-size: 0.92rem; color: var(--ink); line-height: 1.15; }

/* alternate route chips */
.route-options { margin: 16px auto 0; max-width: 640px; }
.route-options-lead {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ochre);
  margin-right: 4px;
}
.route-chip {
  font-family: var(--font-text);
  font-size: 0.9rem;
  margin: 4px 3px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1.5px dashed var(--teal-soft);
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  transition: background .15s, border-style .15s;
}
.route-chip:hover { background: rgba(29, 78, 74, 0.08); }
.route-chip.active {
  border-style: solid;
  background: var(--teal);
  color: var(--cream);
  cursor: default;
}

/* constellation svg elements */
.c-link { stroke: rgba(42, 35, 32, 0.13); stroke-width: 0.8; }
.c-link.path-link { stroke: var(--rust); stroke-width: 3; stroke-dasharray: 1 7; stroke-linecap: round; }
.c-node { stroke: none; cursor: pointer; }
.c-node:hover { stroke: var(--rust); stroke-width: 2; }
.c-node.side-0 { fill: var(--ochre); }
.c-node.side-1 { fill: var(--teal-soft); }
.c-node.meet { fill: var(--rust); }
.c-node.path-node { stroke: var(--cream); stroke-width: 2; }
.c-label-g { pointer-events: none; }
.c-label-fg, .c-label-halo {
  font-family: var(--font-text);
  font-size: 11.5px;
}
.c-label-fg { fill: rgba(58, 48, 40, 0.92); }
.c-label-halo {
  fill: none;
  stroke: var(--cream);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  opacity: 0.85;
}
.c-label-fg.path-label, .c-label-halo.path-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}
.c-label-fg.path-label { fill: var(--ink); }
.c-label-halo.path-label { stroke: rgba(251, 245, 230, 0.95); stroke-width: 4px; opacity: 1; }
.dimmed { opacity: 0.16; transition: opacity .8s; }

/* ─────────── The Tale ─────────── */

.tale { margin: 54px 0 30px; }

.tale-head { text-align: center; max-width: 760px; margin: 0 auto 12px; }

.tale-kicker {
  font-family: var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ochre);
}
.tale-kicker::before, .tale-kicker::after { content: " ─── "; color: var(--paper-line); }

.tale-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 4.6vw, 3rem);
  line-height: 1.08;
  color: var(--teal);
  margin: 10px 0 14px;
}

.tale-intro { font-size: 1.18rem; font-style: italic; color: var(--ink-soft); margin: 0 auto; max-width: 620px; }

.shortcut-tease {
  margin: 16px auto 0;
  max-width: 560px;
  font-size: 0.98rem;
  color: var(--ink-soft);
  background: rgba(200, 145, 47, 0.13);
  border: 1px dashed var(--ochre);
  border-radius: 10px;
  padding: 9px 16px;
}
.shortcut-tease b { color: var(--rust); }

/* journey: winding road of stops */

.journey { position: relative; margin: 34px auto 8px; max-width: 900px; }

.journey-road {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.road-path {
  fill: none;
  stroke: var(--rust);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 0.1 11;
}
.road-under {
  fill: none;
  stroke: rgba(180, 85, 45, 0.13);
  stroke-width: 12;
  stroke-linecap: round;
}
.road-traveler { fill: var(--rust); stroke: var(--cream); stroke-width: 2; }

.journey-stops {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stop {
  display: flex;
  margin: 0 0 34px;
  opacity: 0;
  transform: translateY(24px);
  animation: stop-in .7s cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes stop-in { to { opacity: 1; transform: none; } }

.stop:nth-child(odd)  { justify-content: flex-start; }
.stop:nth-child(even) { justify-content: flex-end; }

.stop-card {
  position: relative;
  width: min(410px, 82%);
  background: #fffcf3;
  border: 2px solid var(--teal);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.stop:nth-child(even) .stop-card { border-color: var(--ochre); }
.stop.terminus .stop-card { border-color: var(--rust); border-width: 3px; }

.stop-hop {
  font-size: 1.02rem;
  padding: 13px 18px 11px;
  border-bottom: 1px solid var(--paper-line);
  background: rgba(245, 236, 217, 0.6);
}
.stop-hop .hop-rel {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--teal-soft);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 6px;
  text-decoration: none;
}
.stop:nth-child(even) .stop-hop .hop-rel { background: var(--ochre); }
a.hop-rel[href]:hover { background: var(--rust); color: var(--cream); }

.stop-avoid {
  float: right;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: 1px dashed rgba(85, 72, 63, 0.4);
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, color .15s, border-color .15s;
}
.stop-card:hover .stop-avoid { opacity: 1; }
.stop-avoid:hover { color: var(--rust); border-color: var(--rust); }

.stop-body { display: flex; gap: 14px; padding: 14px 18px 15px; align-items: flex-start; }

.stop-img {
  flex: 0 0 92px;
  width: 92px; height: 92px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--cream-deep);
  filter: sepia(0.22) saturate(0.94);
  background: var(--cream-deep);
}

.stop-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 4px;
}
.stop-name a { color: inherit; text-decoration: none; }
.stop-name a:hover { color: var(--rust); text-decoration: underline; text-decoration-color: var(--ochre); }

.stop-desc { font-size: 0.95rem; color: var(--ink-soft); margin: 0; }

.stop-num {
  position: absolute;
  top: -13px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--rust);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(42,35,32,.3);
  z-index: 2;
}
.stop:nth-child(odd) .stop-num { right: -13px; }
.stop:nth-child(even) .stop-num { left: -13px; }

.tale-outro {
  text-align: center;
  font-size: 1.15rem;
  font-style: italic;
  max-width: 640px;
  margin: 26px auto 8px;
  color: var(--ink-soft);
}

.tale-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}
.stat-chip {
  font-size: 0.88rem;
  color: var(--teal);
  border: 1px solid var(--teal-soft);
  border-radius: 999px;
  padding: 4px 14px;
  background: rgba(29, 78, 74, 0.06);
}
.stat-chip b { color: var(--rust); }

.tale-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0 10px;
}

/* ─────────── Lost / no route ─────────── */

.lost { text-align: center; margin: 60px auto; max-width: 620px; }

/* ─────────── Under the hood ─────────── */

.hood { margin: 60px auto 30px; max-width: 820px; }

.hood details {
  border: 2px solid var(--teal);
  border-radius: 14px;
  background: rgba(255, 252, 243, 0.6);
  overflow: hidden;
}

.hood summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--teal);
  padding: 14px 20px;
  list-style: none;
}
.hood summary::before { content: "✦ "; color: var(--ochre); }
.hood summary::-webkit-details-marker { display: none; }
.hood details[open] summary { border-bottom: 1px solid var(--paper-line); }

.hood-body { padding: 6px 24px 18px; font-size: 1.02rem; }
.hood-body li { margin-bottom: 8px; }

/* ─────────── Footer ─────────── */

.footer { margin-top: 70px; text-align: center; }

.footer-range {
  display: block;
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  object-position: center bottom;
  opacity: 0.9;
}

.footer p {
  margin: 0;
  padding: 18px 24px 30px;
  background: var(--teal);
  color: rgba(245, 236, 217, 0.85);
  font-size: 0.92rem;
}
.footer a { color: var(--ochre-soft); }

/* ─────────── Responsive ─────────── */

@media (max-width: 720px) {
  body { font-size: 17px; }
  .hero { min-height: 300px; }
  .hero-inner { padding-top: 80px; gap: 14px; }
  .hero-badge { width: 74px; height: 74px; }
  .swap { margin-top: 0; }
  .stop:nth-child(odd), .stop:nth-child(even) { justify-content: center; }
  .stop-card { width: 100%; }
  .stop:nth-child(odd) .stop-num { right: auto; left: -10px; }
  .journey-road { display: none; }
  #constellation { height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  .stop { animation-duration: .01s; }
  .hero-badge, .swap, .btn { transition: none; }
}
