/* Tobey & Bun: The American Issue.
   Vintage magazine on a grainy gradient: Fraunces Soft headlines condensed the
   Apple Garamond way, EB Garamond body copy, Oswald for small tracked labels.
   Everything is slightly soft: glows, grain, no hairline-crisp edges. */

:root {
  --ink: #15101c;
  --ink-soft: rgba(21, 16, 28, 0.72);
  --ink-faint: rgba(21, 16, 28, 0.62);
  --rule: rgba(21, 16, 28, 0.16);
  --paper: #f5f0e7;
  --paper-2: #ece5d7;
  --paper-3: #e2d9c7;
  --cream: #f4efe6;
  --vermilion: #f24a1d;
  --vermilion-text: #b82e0d;
  --ember: #ff7a3d;
  --cobalt: #2536c9;
  --ultra: #1a228f;
  --peach: #f7a86f;
  --butter: #f3c766;
  --rose: #e8505a;
  --display: "Fraunces", "EB Garamond", Garamond, Georgia, serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
  --label: "Oswald", "Arial Narrow", sans-serif;
  --glow-cream: 0 0 1px rgba(255, 244, 228, 0.6), 0 0 18px rgba(255, 214, 170, 0.35);
  --shadow-panel: 0 30px 60px -20px rgba(20, 8, 28, 0.55), 0 8px 24px -8px rgba(20, 8, 28, 0.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #1a1022;
  color: var(--ink);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Condensed display type: the Apple Garamond move. */
.cond {
  display: inline-block;
  transform: scaleX(0.84);
  transform-origin: left top;
  width: calc(100% / 0.84);
}

/* ---------- Layers ---------- */
#bg, #stage, #land, #map, #grain { position: fixed; inset: 0; width: 100%; height: 100%; }
#bg { z-index: 0; filter: blur(0.4px) saturate(1.05); }
#stage { z-index: 2; }
#land {
  pointer-events: none;
  filter: drop-shadow(0 14px 22px rgba(18, 6, 26, 0.45)) drop-shadow(0 0 26px rgba(255, 226, 190, 0.28)) blur(0.35px);
}
#map { touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
#grain {
  z-index: 22;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-size: 180px 180px;
}

/* ---------- Map vectors ---------- */
.state-hit { fill: rgba(255, 255, 255, 0); stroke: none; cursor: pointer; }
#hover-outline { fill: none; stroke: rgba(21, 16, 28, 0.85); stroke-width: 1.6; vector-effect: non-scaling-stroke; pointer-events: none; }
#select-glow { fill: none; stroke: rgba(255, 150, 90, 0.55); stroke-width: 9; vector-effect: non-scaling-stroke; pointer-events: none; filter: blur(4px); }
#select-outline { fill: none; stroke: var(--ink); stroke-width: 2.2; vector-effect: non-scaling-stroke; pointer-events: none; }

.mk { cursor: pointer; }
.mk .hit { fill: transparent; }
.mk .halo { fill: url(#halo); pointer-events: none; }
.mk .cap { fill: rgba(255, 248, 236, 0.3); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.mk .cap-back { fill: none; stroke: rgba(255, 246, 232, 0.95); stroke-width: 5; stroke-linejoin: round; }
.mk .city { fill: url(#sparkle); stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.mk .city-back { fill: none; stroke: rgba(255, 246, 232, 0.95); stroke-width: 4; stroke-linejoin: round; }
.mk .land-dot { fill: var(--ink); stroke: rgba(255, 246, 232, 0.95); stroke-width: 2; }
.mk .land-glyph { color: var(--cream); }
.mk .ring-national { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 2 2.4; }
.mk .tobey-ring { fill: none; stroke: var(--vermilion); stroke-width: 2; animation: pulse 2.6s ease-out 6; transform-box: fill-box; transform-origin: center; }
.mk .stop-badge circle { fill: var(--cobalt); stroke: var(--cream); stroke-width: 1.6; }
.mk .stop-badge text { fill: var(--cream); font: 600 10px/1 var(--label); }
.mk .lens-ring { fill: none; stroke: var(--vermilion); stroke-width: 2.4; opacity: 0.95; }
.mk.dim { opacity: 0.28; }
.mk.selected .halo { fill: url(#halo-hot); }
.mk:hover .cap, .mk:focus-visible .cap, .mk:hover .city, .mk:focus-visible .city { stroke-width: 2.2; }
.mk:focus { outline: none; }
.mk:focus-visible .halo { fill: url(#halo-hot); }

@keyframes pulse {
  0% { transform: scale(0.7); opacity: 0.95; }
  80% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

.label {
  font-family: var(--label);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink);
  paint-order: stroke;
  stroke: rgba(250, 243, 231, 0.92);
  stroke-width: 3.2px;
  stroke-linejoin: round;
  pointer-events: none;
}
.label.cap-label { font-weight: 600; }
.label.tobey-label { fill: var(--vermilion-text); font-size: 10px; letter-spacing: 0.14em; }
.state-label {
  font-family: var(--display);
  font-style: italic;
  font-weight: 560;
  font-variation-settings: "SOFT" 100, "opsz" 36;
  fill: var(--ink);
  paint-order: stroke;
  stroke: rgba(250, 243, 231, 0.9);
  stroke-width: 3.6px;
  stroke-linejoin: round;
  pointer-events: none;
  letter-spacing: -0.01em;
}
.state-label.code { font-family: var(--label); font-style: normal; font-weight: 600; letter-spacing: 0.1em; }
.callout { cursor: pointer; }
.callout rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1; }
.callout text { font: 600 11px/1 var(--label); letter-spacing: 0.12em; fill: var(--ink); }
.callout line { stroke: rgba(21, 16, 28, 0.6); stroke-width: 1; }
#route path.leg { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1 7; }
body.tour-open #route path.leg { animation: march 1.4s linear infinite; }
#route path.leg-glow { fill: none; stroke: rgba(255, 238, 214, 0.85); stroke-width: 6; stroke-linecap: round; }
@keyframes march { to { stroke-dashoffset: -16; } }

/* ---------- Masthead ---------- */
#masthead {
  position: fixed;
  z-index: 20;
  top: calc(18px + var(--safe-t));
  left: max(26px, var(--safe-l));
  width: min(470px, 42vw);
  color: var(--cream);
  pointer-events: none;
  text-shadow: var(--glow-cream);
}
.kicker {
  margin: 0 0 8px;
  font: 500 11px/1.2 var(--label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.kicker .dot { opacity: 0.7; padding: 0 0.3em; }
#masthead .title {
  margin: 0;
  font-family: var(--display);
  font-weight: 470;
  font-variation-settings: "SOFT" 60, "opsz" 144;
  font-size: clamp(38px, 4.6vw, 70px);
  line-height: 0.9;
  letter-spacing: -0.035em;
}
#masthead .title em { font-style: normal; }
#masthead .standfirst {
  margin: 12px 0 0;
  max-width: 330px;
  font-family: var(--text);
  font-style: italic;
  font-size: 17px;
  line-height: 1.3;
  opacity: 0.92;
}

/* ---------- Search ---------- */
#search {
  position: fixed;
  z-index: 30;
  top: calc(20px + var(--safe-t));
  right: max(24px, var(--safe-r));
  width: 290px;
}
#search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  border: 1px solid rgba(21, 16, 28, 0.25);
  border-radius: 999px;
  background: rgba(245, 240, 231, 0.9) no-repeat 14px 50% / 17px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315101c' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='M15 15l5.5 5.5'/%3E%3C/svg%3E");
  font: italic 17px/1 var(--text);
  color: var(--ink);
  box-shadow: 0 10px 30px -12px rgba(20, 8, 28, 0.6), 0 0 22px rgba(255, 220, 180, 0.25);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#search-input::placeholder { color: var(--ink-faint); }
#search-input:focus { border-color: var(--ink); background-color: var(--paper); }
#search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
  max-height: min(60vh, 420px);
  overflow: auto;
}
#search-results li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 17px;
}
#search-results li small { font: 500 10px/1 var(--label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-left: auto; }
#search-results li[aria-selected="true"], #search-results li:hover { background: var(--paper-2); }

/* ---------- Index (lenses) ---------- */
#index {
  position: fixed;
  z-index: 20;
  left: 230px;
  right: 90px;
  bottom: calc(22px + var(--safe-b));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: right 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.panel-open #index { right: 500px; }
body.tour-open #index { left: 440px; }
@media (min-width: 761px) { #masthead { transition: opacity 0.3s; } body.tour-open #masthead { opacity: 0; } }
.index-label {
  font: 500 10px/1 var(--label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: var(--glow-cream);
  white-space: nowrap;
}
#lenses { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
#lenses::-webkit-scrollbar { display: none; }
.lens {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 10px;
  border: 1px solid rgba(21, 16, 28, 0.2);
  border-radius: 999px;
  background: rgba(245, 240, 231, 0.88);
  font: 500 11px/1 var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(20, 8, 28, 0.7);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.lens svg { width: 16px; height: 16px; flex: none; }
.lens[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(255, 122, 61, 0.55), 0 0 26px rgba(255, 122, 61, 0.55);
}
.lens .n { opacity: 0.8; font-weight: 400; }

/* ---------- Tools and key ---------- */
#map-tools {
  position: fixed;
  z-index: 20;
  right: max(24px, var(--safe-r));
  bottom: calc(22px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(21, 16, 28, 0.2);
  border-radius: 50%;
  background: rgba(245, 240, 231, 0.9);
  font: 400 22px/1 var(--display);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px -12px rgba(20, 8, 28, 0.8);
}
.tool svg { width: 20px; height: 20px; }
#key-toggle { font: 500 10px/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; }
#key {
  position: fixed;
  z-index: 25;
  right: 78px;
  bottom: calc(22px + var(--safe-b));
  width: 230px;
  padding: 16px 18px 14px;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
}
#key h2 { margin: 0 0 8px; font: 500 11px/1 var(--label); letter-spacing: 0.3em; text-transform: uppercase; }
#key ul { list-style: none; margin: 0; padding: 0; }
#key li { display: flex; align-items: center; gap: 10px; font-size: 16px; padding: 3px 0; }
#key svg { width: 24px; height: 24px; flex: none; overflow: visible; }
#key .k-cap { fill: none; stroke: var(--ink); stroke-width: 1.6; }
#key .k-city { fill: var(--ember); stroke: var(--ink); stroke-width: 1.2; }
#key .k-land { fill: var(--ink); }
#key .k-tobey { fill: none; stroke: var(--vermilion); stroke-width: 2; }
#key .k-stop { fill: var(--cobalt); }
#key .k-spot { fill: #0f8f8a; stroke: var(--cream); stroke-width: 1.5; }
#key .credits { font: 500 9px/1.4 var(--label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
#key text { fill: var(--cream); font: 600 9px var(--label); }
#key p { margin: 8px 0 0; font-style: italic; font-size: 14px; color: var(--ink-soft); }

/* ---------- Sheets (panel + tour) ---------- */
.sheet {
  position: fixed;
  z-index: 30;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}
.sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.6), rgba(236, 229, 215, 0) 40%);
  z-index: 0;
}
.sheet > * { position: relative; z-index: 1; }
.sheet-grip { display: none; }
.close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font: 300 30px/1 var(--display);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.close:hover { background: var(--paper-2); }

#panel {
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(460px, calc(100vw - 32px));
  border-radius: 22px;
  transform: translateX(calc(100% + 40px));
}
#panel[data-open="true"] { transform: none; }
.panel-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px 22px;
  border-bottom: 1px solid var(--rule);
}
.folio {
  margin: 0;
  flex: 1;
  font: 500 10.5px/1.3 var(--label);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back {
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 999px;
  height: 30px;
  padding: 0 12px 0 10px;
  font: 500 10.5px/1 var(--label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.back::before { content: "\2039"; font: 400 16px/0 var(--display); margin-right: 6px; position: relative; top: 1px; }
.panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 24px 40px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Article typography */
.art-photo { margin: 0 -24px; position: relative; background: var(--paper-3); }
.art-photo .img {
  aspect-ratio: 4 / 3;
  width: 100%;
  background-size: cover;
  background-position: center;
  filter: saturate(0.97) contrast(1.02);
  transition: opacity 0.6s;
}
.art-photo .img.loading {
  background-image: linear-gradient(115deg, var(--peach), var(--rose) 40%, var(--cobalt) 80%);
  animation: shimmer 2.2s ease-in-out infinite alternate;
}
@keyframes shimmer { from { filter: saturate(0.7) brightness(0.95); } to { filter: saturate(1.1) brightness(1.05); } }
.art-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 45%, transparent 62%, rgba(30, 12, 20, 0.18));
}
.art-photo figcaption {
  position: relative;
  padding: 10px 24px 0;
  text-align: center;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--paper);
}
.art-photo figcaption a { color: inherit; font: 500 9.5px/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; margin-left: 6px; }
.art-kicker {
  margin: 22px 0 6px;
  font: 500 10.5px/1.3 var(--label);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--vermilion-text);
}
.art-head {
  margin: 0;
  font-family: var(--display);
  font-weight: 480;
  font-variation-settings: "SOFT" 60, "opsz" 144;
  font-size: 58px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-shadow: 0 0 1px rgba(21, 16, 28, 0.25);
}
.art-dek {
  margin: 10px 0 0;
  font-style: italic;
  font-size: 21px;
  line-height: 1.22;
  color: var(--ink-soft);
}
.art-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 0; font: 500 10.5px/1.4 var(--label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.art-meta b { font-weight: 600; color: var(--ink); }
.badge-tobey { color: var(--vermilion-text); }
.art-intro {
  margin: 16px 0 0;
  font-size: 18.5px;
  line-height: 1.34;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.art-intro::first-letter {
  float: left;
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "opsz" 144;
  font-weight: 500;
  font-size: 64px;
  line-height: 0.8;
  padding: 6px 8px 0 0;
  color: var(--vermilion);
}
.cta-row { display: flex; gap: 10px; align-items: center; margin: 20px 0 6px; flex-wrap: wrap; }
.btn {
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: 500 12px/1 var(--label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  color: var(--ink);
  background: linear-gradient(100deg, var(--vermilion), var(--ember) 55%, var(--peach));
  box-shadow: 0 10px 26px -10px rgba(242, 74, 29, 0.9), 0 0 30px rgba(255, 122, 61, 0.35);
}
.btn.primary.on { color: #fff8ee; background: linear-gradient(100deg, var(--ultra), var(--cobalt)); box-shadow: 0 10px 26px -10px rgba(37, 54, 201, 0.9), 0 0 30px rgba(37, 54, 201, 0.3); }
.btn.ghost { background: transparent; border: 1px solid rgba(21, 16, 28, 0.28); }
.linkish { border: 0; background: none; padding: 0; cursor: pointer; font-style: italic; font-size: 16px; text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }

.section-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 12px;
  font: 500 10.5px/1 var(--label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.section-rule::after { content: ""; flex: 1; height: 1px; background: var(--ink); opacity: 0.8; }

.facts { columns: 2 180px; column-gap: 22px; column-rule: 1px solid var(--rule); }
.fact { break-inside: avoid; margin: 0 0 18px; }
.fact .cat {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 9.5px/1.2 var(--label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vermilion-text);
}
.fact .cat svg { width: 15px; height: 15px; flex: none; }
.fact[data-cat="baseball"] .cat { color: #a3182f; }
.fact[data-cat="pizza"] .cat { color: #a8440a; }
.fact[data-cat="punk"] .cat { color: #7b3fc4; }
.fact[data-cat="architecture"] .cat { color: var(--cobalt); }
.fact[data-cat="history"] .cat { color: #7a5a1a; }
.fact[data-cat="tech"] .cat { color: #0b6f6b; }
.fact h3 {
  margin: 5px 0 3px;
  font-family: var(--display);
  font-weight: 520;
  font-variation-settings: "SOFT" 50, "opsz" 36;
  font-size: 20px;
  line-height: 1.06;
  letter-spacing: -0.015em;
}
.fact p { margin: 0; font-size: 16.5px; line-height: 1.3; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 18px 0 0; border-top: 1px solid var(--ink); }
.stat { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule); }
.stat:nth-child(odd) { border-right: 1px solid var(--rule); }
.stat:nth-child(even) { padding-left: 12px; }
.stat dt { font: 500 9.5px/1.2 var(--label); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.stat dd { margin: 3px 0 0; font-size: 18px; line-height: 1.2; }
.stat.wide { grid-column: 1 / -1; border-right: 0; }

.flag-frame {
  margin: 22px 0 0;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: end;
}
.flag {
  width: 150px;
  aspect-ratio: 3 / 2;
  background: var(--paper-3) center / cover no-repeat;
  border-radius: 3px;
  box-shadow: 0 12px 24px -12px rgba(20, 8, 28, 0.7), 0 0 0 1px rgba(21, 16, 28, 0.12);
  position: relative;
  overflow: hidden;
  animation: flutter 5s ease-in-out 3;
  transform-origin: left center;
}
.flag::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.28) 38%, transparent 52%, rgba(0, 0, 0, 0.12) 70%, transparent 86%);
  background-size: 220% 100%;
}
#panel[data-open="true"] .flag::after { animation: sheen 5s ease-in-out 3; }
@keyframes flutter { 0%, 100% { transform: perspective(500px) rotateY(0deg) skewY(0deg); } 50% { transform: perspective(500px) rotateY(-9deg) skewY(-1deg); } }
@keyframes sheen { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }
.inks { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font: 500 9.5px/1.2 var(--label); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.inks i { width: 22px; height: 22px; border-radius: 3px; display: inline-block; background-image: radial-gradient(circle, rgba(255, 255, 255, 0.4) 1px, transparent 1.4px); background-size: 4px 4px; box-shadow: 0 0 0 1px rgba(21, 16, 28, 0.15); }
.highlights { list-style: none; padding: 0; margin: 0; }
.highlights li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 17px; line-height: 1.3; }
.highlights svg { width: 20px; height: 20px; margin-top: 2px; color: var(--vermilion); }
.place-list { display: flex; flex-wrap: wrap; gap: 8px; }
.place-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(21, 16, 28, 0.25);
  background: var(--paper);
  font-size: 17px;
  cursor: pointer;
}
.place-chip:hover { background: var(--butter); }
.place-chip svg { width: 16px; height: 16px; overflow: visible; }
.fine { margin: 26px 0 0; font-style: italic; font-size: 14px; color: var(--ink-faint); }

/* ---------- Tour ---------- */
#tour-fab {
  position: fixed;
  z-index: 25;
  left: max(24px, var(--safe-l));
  bottom: calc(22px + var(--safe-b));
  min-width: 170px;
  height: 58px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--cream);
  text-align: left;
  background: linear-gradient(110deg, var(--ink) 0, #2a1438 55%, var(--ultra));
  box-shadow: 0 16px 34px -14px rgba(10, 4, 20, 0.95), 0 0 34px rgba(37, 54, 201, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.fab-kicker { font: 500 9.5px/1 var(--label); letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.75; }
.fab-count { font-family: var(--display); font-variation-settings: "SOFT" 60, "opsz" 36; font-size: 19px; line-height: 1; letter-spacing: -0.01em; }
#tour-fab.bump { animation: bump 0.5s ease; }
@keyframes bump { 30% { transform: scale(1.08); } 60% { transform: scale(0.97); } }

#tour {
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: min(400px, calc(100vw - 32px));
  border-radius: 22px;
  transform: translateX(calc(-100% - 40px));
  background: var(--ink);
  color: var(--cream);
}
#tour::before { background: radial-gradient(120% 60% at 0% 0%, rgba(242, 74, 29, 0.28), transparent 60%), radial-gradient(100% 50% at 100% 100%, rgba(37, 54, 201, 0.35), transparent 60%); }
#tour[data-open="true"] { transform: none; }
.tour-head { padding: 20px 20px 12px 24px; }
.tour-head .kicker { color: var(--ember); }
.tour-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 480;
  font-variation-settings: "SOFT" 60, "opsz" 144;
  font-size: 50px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-shadow: 0 0 22px rgba(255, 170, 120, 0.35);
}
.tour-head .close { position: absolute; top: 12px; right: 12px; color: var(--cream); }
.tour-head .close:hover { background: rgba(255, 255, 255, 0.08); }
.tour-summary { margin: 10px 0 0; font: 500 10.5px/1.5 var(--label); letter-spacing: 0.2em; text-transform: uppercase; color: rgba(244, 239, 230, 0.75); }
.tour-start {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 24px;
  padding: 10px 0 12px;
  border-top: 1px solid rgba(244, 239, 230, 0.2);
  border-bottom: 1px solid rgba(244, 239, 230, 0.2);
  font: 500 10px/1 var(--label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.tour-start input, .who select {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(244, 239, 230, 0.3);
  background: rgba(244, 239, 230, 0.08);
  color: var(--cream);
  font: 16px var(--text);
  color-scheme: dark;
}
.tour-end { font: italic 15px/1.2 var(--text); letter-spacing: 0; text-transform: none; color: rgba(244, 239, 230, 0.75); }
.tour-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
#tour-list { list-style: none; margin: 0; padding: 8px 12px 4px 12px; }
.stop {
  display: grid;
  grid-template-columns: 30px 30px 1fr auto 36px;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 10px 2px;
  border-radius: 14px;
  background: rgba(244, 239, 230, 0.05);
  margin: 0 0 4px;
}
.stop.sortable-ghost { opacity: 0.25; }
.stop.sortable-chosen { background: rgba(255, 122, 61, 0.22); box-shadow: 0 0 0 1px rgba(255, 122, 61, 0.6), 0 16px 30px -12px rgba(0, 0, 0, 0.8); }
.stop.sortable-drag, .stop.sortable-fallback { background: #2a1438; color: var(--cream); }
.drag {
  width: 30px;
  height: 48px;
  border: 0;
  background: transparent;
  color: rgba(244, 239, 230, 0.55);
  cursor: grab;
  display: grid;
  place-items: center;
  touch-action: none;
}
.drag svg { width: 20px; height: 20px; }
.stop-num {
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "opsz" 144;
  font-weight: 460;
  font-size: 38px;
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: var(--ember);
  text-shadow: 0 0 18px rgba(255, 122, 61, 0.55);
  text-align: center;
}
.stop-main { min-width: 0; cursor: pointer; border: 0; background: none; color: inherit; padding: 4px 0; text-align: left; font: inherit; }
.stop-name {
  display: block;
  font-family: var(--display);
  font-variation-settings: "SOFT" 60, "opsz" 36;
  font-size: 20px;
  line-height: 1.02;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.stop-name small { font: 500 10px/1 var(--label); letter-spacing: 0.16em; opacity: 0.6; margin-left: 6px; }
.stop-dates { display: block; margin-top: 3px; font: italic 14px/1.2 var(--text); color: rgba(244, 239, 230, 0.7); }
.nights { display: flex; align-items: center; gap: 2px; }
.nights button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 230, 0.28);
  background: transparent;
  color: var(--cream);
  font: 400 18px/1 var(--display);
  cursor: pointer;
}
.nights button:hover { background: rgba(244, 239, 230, 0.1); }
.nights output { min-width: 38px; text-align: center; font: 500 10px/1.1 var(--label); letter-spacing: 0.12em; text-transform: uppercase; }
.nights output b { display: block; font: 500 20px/1 var(--display); letter-spacing: 0; text-transform: none; }
.hop {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px 44px;
  padding: 2px 0 6px;
  font: italic 14px/1.2 var(--text);
  color: rgba(244, 239, 230, 0.62);
}
.hop svg { width: 14px; height: 14px; flex: none; opacity: 0.8; }
.hop::before { content: ""; width: 1px; height: 18px; background: rgba(244, 239, 230, 0.3); margin-right: 4px; }
.stop-x {
  width: 36px; height: 36px; margin-left: 4px; border: 0; border-radius: 50%; background: transparent; color: rgba(244, 239, 230, 0.5); cursor: pointer; font: 300 22px/1 var(--display);
}
.stop-x:hover { color: var(--cream); background: rgba(244, 239, 230, 0.1); }
.tour-empty { padding: 26px 26px 10px; }
.tour-empty .big { margin: 0 0 8px; font-family: var(--display); font-variation-settings: "SOFT" 60, "opsz" 72; font-size: 30px; line-height: 1; letter-spacing: -0.03em; }
.tour-empty p { font-size: 17px; line-height: 1.35; color: rgba(244, 239, 230, 0.8); }
.tour-extras { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 24px 0; }
.extra { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 8px; border-radius: 999px; background: rgba(244, 239, 230, 0.08); font: 500 10px/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; }
.extra svg { width: 14px; height: 14px; color: var(--ember); }
.tour-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px calc(16px + var(--safe-b)); border-top: 1px solid rgba(244, 239, 230, 0.16); }
.tour-actions .btn.ghost { height: 34px; padding: 0 12px; font-size: 11px; color: var(--cream); border-color: rgba(244, 239, 230, 0.3); }
.tour-actions .btn.ghost:hover { background: rgba(244, 239, 230, 0.1); }
.tour-actions .btn.ghost.danger { color: #ff9a8a; border-color: rgba(255, 154, 138, 0.35); }
#tour[data-empty="true"] #tour-list, #tour[data-empty="true"] .tour-actions, #tour[data-empty="true"] .tour-start, #tour[data-empty="true"] .tour-extras { display: none; }
#tour[data-empty="false"] .tour-empty { display: none; }

/* ---------- Tooltip, toast, loading ---------- */
#tooltip {
  position: fixed;
  z-index: 35;
  pointer-events: none;
  padding: 7px 11px 8px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 10px 24px -10px rgba(20, 8, 28, 0.7);
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 14px));
}
#tooltip small { display: block; font: 500 9.5px/1.3 var(--label); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); }
#toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 17px;
  box-shadow: 0 16px 34px -14px rgba(10, 4, 20, 0.95), 0 0 30px rgba(255, 122, 61, 0.3);
  width: max-content;
  max-width: calc(100vw - 32px);
}
#toast button { border: 0; background: var(--cream); color: var(--ink); border-radius: 999px; height: 30px; padding: 0 12px; font: 500 10.5px/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; }
#loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--cream);
  background: radial-gradient(120% 90% at 20% 0%, #f24a1d 0, transparent 55%), radial-gradient(90% 90% at 90% 90%, #f7a86f 0, transparent 60%), linear-gradient(160deg, #140c1c, #2331c4);
  transition: opacity 0.8s ease, visibility 0.8s;
  text-shadow: var(--glow-cream);
}
#loading.done { opacity: 0; visibility: hidden; }
.loading-title { margin: 0; font-family: var(--display); font-variation-settings: "SOFT" 60, "opsz" 144; font-size: 44px; letter-spacing: -0.035em; }
.loading-title span { animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
#loading.error .loading-title { font-size: 30px; }

/* ---------- Small screens ---------- */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  #masthead { left: 16px; top: calc(12px + var(--safe-t)); width: calc(100vw - 32px); }
  #masthead .kicker { font-size: 9.5px; margin-bottom: 4px; }
  #masthead .title { font-size: clamp(27px, 8.2vw, 36px); width: min(100%, 330px); }
  #masthead .standfirst { display: none; }
  #search { top: auto; bottom: calc(86px + var(--safe-b)); left: 16px; right: 16px; width: auto; }
  #search-input { height: 40px; font-size: 16px; }
  #search-results { position: absolute; bottom: 48px; left: 0; right: 0; margin: 0; }
  #index { left: 16px; right: 16px; bottom: auto; top: calc(100px + var(--safe-t)); }
  .index-label { display: none; }
  #map-tools { right: 16px; flex-direction: row; }
  #zoom-in, #zoom-out { display: none; }
  #key { right: 16px; bottom: calc(136px + var(--safe-b)); max-height: calc(100dvh - 236px - var(--safe-b) - var(--safe-t)); overflow: auto; }
  .tool { width: 44px; height: 44px; }
  .close { width: 44px; height: 44px; }
  .back { height: 40px; }
  .lens { height: 40px; }
  .sheet-grip { height: 30px !important; }
  .place-chip { height: 42px; }
  #tour-fab { left: 16px; bottom: calc(18px + var(--safe-b)); height: 52px; min-width: 150px; }
  .fab-count { font-size: 17px; }
  .sheet { left: 0 !important; right: 0 !important; width: 100% !important; top: auto !important; bottom: 0 !important; border-radius: 22px 22px 0 0 !important; }
  #panel { height: 74vh; height: 74dvh; transform: translateY(105%); }
  #panel[data-expanded="true"] { height: 94vh; height: 94dvh; }
  #tour { height: 86vh; height: 86dvh; transform: translateY(105%); }
  .sheet-grip { display: block; width: 100%; flex: none; cursor: grab; touch-action: none; }
  .sheet-grip::after { content: ""; position: absolute; left: 50%; top: 9px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(21, 16, 28, 0.25); }
  #tour .sheet-grip::after { background: rgba(244, 239, 230, 0.3); }
  .panel-bar { padding-top: 0; }
  .panel-body { padding: 0 18px 40px; }
  .art-photo { margin: 0 -18px; }
  .art-head { font-size: 46px; }
  .facts { columns: 1; }
  .flag-frame { grid-template-columns: 120px 1fr; }
  .flag { width: 120px; }
  #toast { bottom: calc(84px + var(--safe-b)); }
  .tour-head h2 { font-size: 42px; }
}
@media (max-width: 380px) {
  .lens { padding: 0 10px 0 8px; }
  .stop { grid-template-columns: 28px 26px 1fr auto 36px; gap: 4px; }
  .stop-num { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 761px) and (max-height: 900px) {
  #masthead .standfirst { display: none; }
}

/* ---------- Specialist pins ---------- */
.mk .spot-dot { stroke: rgba(255, 246, 232, 0.95); stroke-width: 2; }
.mk-spot .land-glyph { color: #fff8ee; }
.mk .launch-ring { fill: none; stroke: #0f8f8a; stroke-width: 1.6; stroke-dasharray: 2 2.5; animation: spin 12s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.label.spot-label { font-weight: 400; font-size: 10.5px; letter-spacing: 0.06em; }
.spot-chip svg { color: var(--chip, var(--ink)); }
.art-noimg {
  margin: 0 -24px;
  aspect-ratio: 16 / 7;
  display: grid;
  place-items: center;
  color: #fff8ee;
  background: radial-gradient(90% 120% at 20% 0%, rgba(255, 255, 255, 0.25), transparent 60%), var(--chip, var(--ink));
}
.art-noimg svg { width: 72px; height: 72px; opacity: 0.9; }
.tip {
  margin: 18px 0 0;
  padding: 12px 14px 13px;
  border-left: 3px solid var(--vermilion);
  background: var(--paper-2);
  border-radius: 0 12px 12px 0;
  font-size: 17px;
  line-height: 1.3;
}
.tip-label { display: block; margin-bottom: 4px; font: 500 9.5px/1.2 var(--label); letter-spacing: 0.22em; text-transform: uppercase; color: var(--vermilion-text); }
.launches { display: grid; gap: 8px; }
.launch {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--cream);
}
.launch b { font-family: var(--display); font-weight: 500; font-variation-settings: "SOFT" 60, "opsz" 36; font-size: 18px; line-height: 1.1; letter-spacing: -0.01em; }
.launch small { grid-column: 1 / -1; font: 500 9.5px/1.3 var(--label); letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; }
.launch time { font: italic 15px/1.2 var(--text); text-align: right; white-space: nowrap; color: var(--ember); }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { .art-noimg { margin: 0 -18px; } }

/* ---------- Cover lines (phones, home view) ---------- */
#cover {
  position: fixed;
  z-index: 21;
  left: 20px;
  right: 20px;
  color: var(--cream);
  text-shadow: var(--glow-cream);
}
#cover .kicker { margin-bottom: 6px; opacity: 0.85; }
#cover button {
  display: block;
  width: 100%;
  padding: 5px 0 6px;
  border: 0;
  border-top: 1px solid rgba(244, 239, 230, 0.28);
  background: none;
  text-align: left;
  font: italic 17px/1.2 var(--text);
  color: inherit;
  cursor: pointer;
}
#cover button b {
  font: normal 500 19px/1 var(--display);
  font-variation-settings: "SOFT" 60, "opsz" 36;
  letter-spacing: -0.015em;
  margin-right: 4px;
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  body.panel-open #masthead, body.panel-open #index, body.tour-open #masthead, body.tour-open #index { opacity: 0; pointer-events: none; }
  #masthead, #index { transition: opacity 0.3s; }
}

/* ---------- Failure states ---------- */
.art-photo .img.failed {
  background: linear-gradient(115deg, var(--peach), var(--rose) 45%, var(--cobalt));
  display: grid;
  place-items: center;
}
.art-photo .img.failed::after {
  content: "Photo unavailable";
  font: italic 18px/1 var(--text);
  color: #fff8ee;
  text-shadow: 0 1px 8px rgba(20, 8, 28, 0.5);
}
.flag.failed { background: repeating-linear-gradient(135deg, var(--paper-3) 0 8px, var(--paper-2) 8px 16px); animation: none; }
.flag.failed::after { display: none; }

/* ---------- Landscape phones: side sheets ---------- */
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  #masthead { width: 46vw; }
  #masthead .kicker { display: none; }
  #masthead .title { font-size: 22px; }
  #index { top: calc(52px + var(--safe-t)); left: max(16px, var(--safe-l)); right: max(16px, var(--safe-r)); }
  #search { top: calc(10px + var(--safe-t)); bottom: auto; left: auto; right: max(16px, var(--safe-r)); width: 38vw; }
  #search-results { position: static; margin-top: 6px; }
  #cover { display: none; }
  #panel.sheet, #tour.sheet { top: 0 !important; bottom: 0 !important; height: auto !important; width: min(440px, 58vw) !important; }
  #panel.sheet { left: auto !important; right: 0 !important; border-radius: 18px 0 0 18px !important; transform: translateX(105%); }
  #tour.sheet { left: 0 !important; right: auto !important; border-radius: 0 18px 18px 0 !important; transform: translateX(-105%); }
  #panel[data-open="true"], #tour[data-open="true"] { transform: none; }
  .sheet-grip { display: none !important; }
}

/* ---------- Shared tour sync ---------- */
.sync-status { margin: 6px 0 0; font: italic 14px/1.3 var(--text); color: rgba(244, 239, 230, 0.72); }
.sync-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #4fd18b; box-shadow: 0 0 8px rgba(79, 209, 139, 0.8); vertical-align: 1px; }
.sync-status[data-state="saving"]::before { background: var(--butter); box-shadow: 0 0 8px rgba(243, 199, 102, 0.8); }
.sync-status[data-state="offline"]::before, .sync-status[data-state="local"]::before { background: var(--ember); box-shadow: 0 0 8px rgba(255, 122, 61, 0.8); }
.who { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.who select { padding: 0 8px; }
