/* ==========================================================================
   Legend — across the world and beyond.

   Dark by design: a travel map reads best as a lit object on a black table,
   and the night basemap sets the palette for everything else. No web fonts,
   no icon set, no framework — the only thing this page fetches from anyone
   else is Leaflet and the tiles.
   ========================================================================== */

:root {
  --ink:     #05070f;
  --ink-2:   #080d1a;
  --card:    rgba(255, 255, 255, 0.035);
  --card-2:  rgba(255, 255, 255, 0.06);
  --line:    rgba(255, 255, 255, 0.09);
  --line-2:  rgba(255, 255, 255, 0.16);
  --text:    #e9eef8;
  --dim:     #8a97b4;
  --dimmer:  #5c6884;

  --go:      #5eead4;   /* visited, routes, the accent that means "been" */
  --go-deep: #14b8a6;
  --home:    #fbbf24;   /* home base */
  --beyond:  #a78bfa;   /* off Earth */
  --fav:     #f472b6;

  --shadow:  0 24px 60px rgba(0, 0, 0, 0.55);
  --radius:  16px;
  --wrap:    1180px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* `hidden` is how the dialog and the conditional form fields are toggled, and
   several of them also carry a display rule (.dialog is a grid, .field is a
   block). Without this the attribute is silently overridden and an invisible
   dialog goes on swallowing every click on the page. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 78px; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--go); color: #041210; padding: 10px 16px; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; color: #041210; }

/* ---------------------------------------------------------------- header */

.head {
  position: sticky; top: 0; z-index: 60;
  background: rgba(5, 7, 15, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.head__in {
  max-width: var(--wrap); margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #fff 0 8%, transparent 9%),
    conic-gradient(from 220deg, var(--go), var(--beyond), var(--home), var(--go));
  box-shadow: 0 0 0 1px var(--line-2), 0 0 22px rgba(94, 234, 212, 0.45);
}
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__text strong { font-size: 15px; letter-spacing: 0.22em; }
.brand__text em { font-style: normal; font-size: 10.5px; color: var(--dim); letter-spacing: 0.18em; text-transform: uppercase; margin-top: 3px; }

.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--dim); font-size: 13px;
  padding: 7px 11px; border-radius: 999px; transition: color .18s, background .18s;
}
.nav a:hover { color: var(--text); background: var(--card-2); }
.nav a.is-here { color: var(--go); background: rgba(94, 234, 212, 0.1); }

/* ---------------------------------------------------------------- buttons */

.btn, .ctl, .mini {
  font: inherit; color: var(--text); cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.btn:hover, .ctl:hover, .mini:hover { background: rgba(255,255,255,.1); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn--go {
  background: linear-gradient(180deg, var(--go), var(--go-deep));
  color: #032220; border-color: transparent; font-weight: 650;
  box-shadow: 0 6px 22px rgba(20, 184, 166, 0.32);
}
.btn--go:hover { background: linear-gradient(180deg, #7ff3e0, #16c4b0); }
.btn--quiet { background: transparent; color: var(--dim); }
.btn--danger { background: transparent; color: #fb7185; border-color: rgba(251, 113, 133, .35); }
.btn--danger:hover { background: rgba(251, 113, 133, .12); }
.btn--file { display: inline-block; }

.mini { font-size: 12.5px; padding: 5px 11px; border-radius: 8px; }
.mini--danger { color: #fb7185; }
.mini.is-armed { background: var(--go); color: #032220; border-color: transparent; }

.ctl { font-size: 13px; padding: 7px 13px; border-radius: 10px; }
.ctl.is-on { background: rgba(94, 234, 212, .16); border-color: rgba(94,234,212,.4); color: var(--go); }
.ctl.is-off { color: var(--dimmer); }
.ctl--input { min-width: 220px; }
.ctl-group { display: inline-flex; gap: 4px; background: var(--card); padding: 3px; border-radius: 12px; border: 1px solid var(--line); }
.ctl-group .ctl { border: 0; background: transparent; }

select.ctl { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 14px, calc(100% - 11px) 14px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.ctl option { background: var(--ink-2); }

/* ---------------------------------------------------------------- hero */

.hero { position: relative; overflow: hidden; padding: 74px 20px 40px; }
.hero__glow {
  position: absolute; inset: -40% -20% auto -20%; height: 620px; pointer-events: none;
  background:
    radial-gradient(closest-side at 22% 45%, rgba(94, 234, 212, .20), transparent),
    radial-gradient(closest-side at 68% 30%, rgba(167, 139, 250, .20), transparent),
    radial-gradient(closest-side at 48% 70%, rgba(251, 191, 36, .10), transparent);
  filter: blur(28px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.12); }
}
.hero__in { position: relative; max-width: var(--wrap); margin: 0 auto; }
.hero__top {
  display: grid; gap: 22px 40px; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
}
.hero__globe { position: relative; justify-self: center; width: min(100%, 400px); }
#globe {
  display: block; width: 100%; aspect-ratio: 1; cursor: grab; touch-action: none;
  /* The sphere throws its own light onto the page behind it. */
  filter: drop-shadow(0 18px 50px rgba(20, 184, 166, .18));
}
#globe.is-over { cursor: pointer; }
#globe.is-dragging { cursor: grabbing; }
.hero__hint {
  text-align: center; margin-top: 6px; font-size: 11px; color: var(--dimmer);
  letter-spacing: .12em; text-transform: uppercase;
}
.hero__kicker { color: var(--dim); letter-spacing: .34em; text-transform: uppercase; font-size: 11px; }
.hero__name {
  /* Sized to sit on one line beside the globe at full width; the hero goes
     single-column below 900px, where the vw term takes over. */
  font-size: clamp(38px, 6.2vw, 74px); font-weight: 800; margin: 10px 0 4px;
  text-wrap: balance;
  background: linear-gradient(180deg, #ffffff 20%, #9fb3d6 115%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__tag { color: var(--dim); font-size: clamp(15px, 2.4vw, 20px); letter-spacing: .02em; }
.hero__tag span { color: var(--beyond); }

/* ---------------------------------------------------------------- stats */

.stats {
  margin-top: 34px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 20px;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto auto 0; height: 1px; width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
}
.stat__n {
  display: block; font-family: var(--mono); font-size: clamp(30px, 4.4vw, 42px);
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1;
  color: #fff; text-shadow: 0 0 26px rgba(94, 234, 212, .28);
}
.stat__label { display: block; margin-top: 9px; font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.stat__sub { display: block; margin-top: 3px; font-size: 12px; color: var(--dimmer); }
.stat--bar::before {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--fill, 0%);
  background: linear-gradient(90deg, var(--go-deep), var(--go));
  box-shadow: 0 0 14px rgba(94, 234, 212, .7);
  transition: width 1s cubic-bezier(.2, .8, .2, 1);
}

/* ---------------------------------------------------------------- sections */

.section { max-width: var(--wrap); margin: 0 auto; padding: 54px 20px; }
.section__head { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 20px; margin-bottom: 22px; }
.section__head h2 { font-size: clamp(24px, 3.6vw, 34px); }
.section__sub { color: var(--dim); font-size: 14px; flex: 1 1 260px; }
.controls { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint { margin-top: 14px; color: var(--dimmer); font-size: 13px; }
.empty { color: var(--dimmer); padding: 26px 0; }

/* ---------------------------------------------------------------- map */

.mapwrap {
  position: relative; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: #0a0f1c;
}
#map { height: min(66vh, 620px); min-height: 380px; background: #0a0f1c; }
#map.is-picking { cursor: crosshair; }

/* Esri's Dark Gray Canvas base is a neutral mid-grey, not the near-black
   the "Night" style is named for. sepia+hue-rotate is the standard trick
   for tinting a greyscale image, since a true grey has no hue for
   hue-rotate alone to shift. Only the base tiles get this — the label
   overlay is added as its own layer precisely so place names stay crisp
   instead of tinted along with the ground underneath them. */
.map-night-base { filter: brightness(.5) sepia(.35) hue-rotate(180deg) saturate(2.2) contrast(1.08); }

.maplegend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  display: flex; flex-wrap: wrap; gap: 12px;
  background: rgba(5, 8, 18, .74); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  font-size: 11.5px; color: var(--dim);
}
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--visit  { background: var(--go);     box-shadow: 0 0 9px var(--go); }
.dot--home   { background: var(--home);   box-shadow: 0 0 9px var(--home); }
.dot--beyond { background: var(--beyond); box-shadow: 0 0 9px var(--beyond); }
.dot--fav    { background: var(--fav);    box-shadow: 0 0 9px var(--fav); }

.ctl--play { font-variant-numeric: tabular-nums; }
.ctl--play.is-on { background: rgba(244, 114, 182, .18); border-color: rgba(244,114,182,.5); color: var(--fav); }

/* The playback band. Sits inside the map frame, above the panes and below
   the controls, and carries its own progress bar along the bottom edge. */
.cap {
  position: absolute; z-index: 900; left: 12px; right: 12px; top: 12px;
  margin: 0 auto; max-width: 520px; overflow: hidden;
  background: rgba(6, 10, 20, .88); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 14px;
  padding: 12px 16px 14px; pointer-events: none; text-align: center;
  animation: capIn .35s ease-out;
}
@keyframes capIn { from { opacity: 0; transform: translateY(-6px); } }
.cap__where { display: block; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--go); }
.cap__name { display: block; font-size: 19px; margin: 3px 0 4px; }
.cap__meta { display: block; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cap__bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: var(--p, 0%);
  background: linear-gradient(90deg, var(--go-deep), var(--go));
  box-shadow: 0 0 10px rgba(94,234,212,.8);
  transition: width .4s linear;
}

/* Shown only when the tile layer has failed and the vector world is doing
   the work. Above Leaflet's panes, below its controls, and never in the way. */
.tileless { display: none; }
#map.is-tileless .tileless {
  display: block; position: absolute; z-index: 900;
  left: 12px; right: 12px; top: 12px; margin: 0 auto; max-width: 460px;
  background: rgba(10, 15, 28, .86); backdrop-filter: blur(8px);
  border: 1px solid var(--line-2); border-radius: 12px;
  padding: 9px 13px; font-size: 12px; color: var(--dim); text-align: center;
  pointer-events: none;
}

/* Leaflet, restyled for the dark shell. */
.leaflet-container { background: #0a0f1c; font: inherit; }
.leaflet-control-attribution {
  background: rgba(5, 8, 18, .7) !important; color: var(--dimmer) !important; font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--dim) !important; }
.leaflet-bar a {
  background: rgba(10, 15, 28, .92) !important; color: var(--text) !important;
  border-color: var(--line) !important;
}
.leaflet-bar a:hover { background: rgba(255,255,255,.12) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: rgba(10, 15, 28, .96); color: var(--text);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-close-button { color: var(--dim) !important; }

.pop__img { width: 100%; border-radius: 9px; margin-bottom: 9px; display: block; }
.pop__title { font-size: 15.5px; }
.pop__star { color: var(--fav); }
.pop__where { color: var(--go); font-size: 12px; margin-top: 3px; }
.pop__date { color: var(--dim); font-size: 12px; }
.pop__notes { color: var(--text); font-size: 13px; margin-top: 7px; opacity: .88; }

/* Pins are ours, so they can glow and breathe. */
.pin-wrap { background: none !important; border: 0 !important; }
.pin { position: relative; display: block; width: 22px; height: 22px; }
.pin i {
  position: absolute; inset: 6px; border-radius: 50%;
  background: var(--go); box-shadow: 0 0 12px var(--go), 0 0 3px #fff inset;
}
.pin::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--go); opacity: .5;
  animation: pulse 2.8s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(.55); opacity: .75; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
.pin--home i { background: var(--home); box-shadow: 0 0 14px var(--home), 0 0 3px #fff inset; }
.pin--home::before { border-color: var(--home); }
.pin--beyond i { background: var(--beyond); box-shadow: 0 0 14px var(--beyond), 0 0 3px #fff inset; }
.pin--beyond::before { border-color: var(--beyond); }
.pin--fav i { background: var(--fav); box-shadow: 0 0 16px var(--fav), 0 0 3px #fff inset; }
.pin--fav::before { border-color: var(--fav); }
.pin--pick i { background: #fff; box-shadow: 0 0 16px #fff; }
.pin--pick::before { border-color: #fff; }

/* A permanent name tag on every pin, not just the ones near a city the
   basemap happens to label. Leaflet's own tooltip chrome (white box, arrow)
   is reset first so this reads as part of the map, not a browser widget. */
.leaflet-tooltip.pin-label {
  background: rgba(5, 7, 15, 0.82);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: none;
  white-space: nowrap;
  pointer-events: none;
}
.leaflet-tooltip.pin-label::before { display: none; }
.leaflet-tooltip.pin-label.pin-label--fav { border-color: var(--fav); color: var(--fav); }

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

/* ---------------------------------------------------------------- continents */

.continents {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}
.continent {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: center; transition: border-color .2s, transform .2s, background .2s;
}
.continent.is-visited { border-color: rgba(94, 234, 212, .34); background: rgba(94, 234, 212, .06); }
.continent:hover { transform: translateY(-2px); }
.continent__ring {
  width: 66px; height: 66px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--go) calc(var(--p) * 1%), rgba(255,255,255,.07) 0);
  position: relative;
}
.continent__ring::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #0b1120;
}
.continent__glyph { position: relative; z-index: 1; font-size: 19px; color: var(--dim); }
.continent.is-visited .continent__glyph { color: var(--go); }
.continent__name { font-size: 14px; margin-bottom: 4px; }
.continent__count { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.continent__flag { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-top: 6px; color: var(--dimmer); }
.continent.is-visited .continent__flag { color: var(--go); }

/* ---------------------------------------------------------------- countries */

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 26px 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--go-deep); width: 16px; height: 16px; }

.cgroup { margin-bottom: 26px; }
.cgroup__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
}
.cgroup__n { font-family: var(--mono); letter-spacing: 0; color: var(--go); }

.cgrid { display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
.country {
  display: flex; align-items: center; gap: 8px; text-align: left;
  font: inherit; font-size: 13px; color: var(--dim); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; transition: all .16s;
}
.country:hover { border-color: var(--line-2); color: var(--text); transform: translateY(-1px); }
.country.is-visited {
  color: var(--text); background: rgba(94, 234, 212, .1); border-color: rgba(94, 234, 212, .38);
  box-shadow: 0 0 18px rgba(94, 234, 212, .1);
}
.country.is-territory .country__name { font-style: italic; }
.country__flag { font-size: 15px; filter: saturate(.4) opacity(.6); }
.country.is-visited .country__flag { filter: none; }
.country__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country__n {
  font-family: var(--mono); font-size: 11px; color: var(--go);
  background: rgba(94, 234, 212, .14); border-radius: 6px; padding: 1px 5px;
}

/* ---------------------------------------------------------------- states */

.stategrid {
  display: grid; gap: 6px;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  grid-template-rows: repeat(8, auto);
  max-width: 780px;
}
.state {
  position: relative; aspect-ratio: 1; display: grid; place-items: center;
  font: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  color: var(--dimmer); transition: all .16s;
}
.state:hover { transform: translateY(-2px) scale(1.04); color: var(--text); border-color: var(--line-2); z-index: 2; }
.state.is-visited {
  background: linear-gradient(160deg, rgba(94, 234, 212, .28), rgba(20, 184, 166, .12));
  border-color: rgba(94, 234, 212, .55); color: #eafffb;
  box-shadow: 0 0 20px rgba(94, 234, 212, .16);
}
.state__code { font-family: var(--mono); font-size: clamp(9px, 1.4vw, 13px); letter-spacing: .02em; }
.state__n {
  position: absolute; top: 3px; right: 4px; font-family: var(--mono);
  font-size: 9px; color: var(--go);
}

/* The geographic view of the same fifty. */

.stateshapes {
  max-width: 940px;
  background:
    radial-gradient(closest-side at 50% 45%, rgba(94, 234, 212, .05), transparent);
}
.usmap { width: 100%; height: auto; display: block; overflow: visible; }

.usstate, .usdc {
  fill: rgba(255, 255, 255, .045);
  stroke: rgba(255, 255, 255, .18);
  stroke-width: 0.7;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill .18s, stroke .18s;
}
.usstate:hover, .usdc:hover {
  fill: rgba(255, 255, 255, .13);
  stroke: rgba(255, 255, 255, .5);
}
.usstate:focus-visible, .usdc:focus-visible {
  outline: none; stroke: #fff; stroke-width: 1.6;
}
.usstate.is-visited, .usdc.is-visited {
  fill: rgba(45, 212, 191, .42);
  stroke: rgba(126, 245, 226, .85);
  stroke-width: 0.9;
  /* The glow is what makes a filled state read as lit rather than painted.
     A drop-shadow filter on every path would be expensive to animate, so it
     is a static one on the group's fill colour instead. */
  filter: drop-shadow(0 0 5px rgba(94, 234, 212, .5));
}
.usstate.is-visited:hover, .usdc.is-visited:hover {
  fill: rgba(94, 234, 212, .62);
  stroke: #d8fff8;
}
.usdc { stroke-dasharray: 2 2; }
.usdc.is-visited { stroke-dasharray: none; }

.uslabel {
  fill: #eafffb; font-family: var(--mono); font-size: 12px; font-weight: 600;
  text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(3, 20, 20, .75); stroke-width: 2.6;
}

/* ---------------------------------------------------------------- beyond */

.section--beyond {
  background:
    radial-gradient(closest-side at 78% 0%, rgba(167, 139, 250, .12), transparent),
    radial-gradient(closest-side at 10% 100%, rgba(94, 234, 212, .07), transparent);
}
.realms { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.realm {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.realm.is-visited { border-color: rgba(167, 139, 250, .42); background: rgba(167, 139, 250, .08); }
.realm__name { font-size: 17px; }
.realm__note { color: var(--dim); font-size: 13px; margin-top: 6px; }
.realm__empty { margin-top: 14px; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--dimmer); }
.realm__list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.realm__list button {
  width: 100%; text-align: left; font: inherit; font-size: 13.5px; cursor: pointer;
  background: rgba(167, 139, 250, .12); border: 1px solid rgba(167, 139, 250, .3);
  color: var(--text); border-radius: 9px; padding: 7px 10px;
}
.realm__list button span { color: var(--dim); font-size: 11.5px; }
.realm__list button:hover { background: rgba(167, 139, 250, .22); }

/* ---------------------------------------------------------------- timeline */

.tl__year {
  font-family: var(--mono); font-size: 12px; letter-spacing: .3em; color: var(--go);
  margin: 26px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.tl__year:first-child { margin-top: 0; }
.tl__items { display: grid; gap: 6px; }
.tl__item {
  display: flex; align-items: flex-start; gap: 14px; width: 100%; text-align: left;
  font: inherit; cursor: pointer; color: var(--text);
  background: var(--card); border: 1px solid transparent; border-radius: 12px;
  padding: 12px 14px; transition: all .16s;
}
.tl__item:hover { background: var(--card-2); border-color: var(--line-2); transform: translateX(3px); }
.tl__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--go); box-shadow: 0 0 10px var(--go); }
.tl__dot--home { background: var(--home); box-shadow: 0 0 10px var(--home); }
.tl__dot--beyond { background: var(--beyond); box-shadow: 0 0 10px var(--beyond); }
.tl__item.is-fav .tl__dot { background: var(--fav); box-shadow: 0 0 10px var(--fav); }
.tl__body { flex: 1; min-width: 0; }
.tl__name { display: block; font-size: 15px; }
.tl__where { display: block; font-size: 12.5px; color: var(--go); }
.tl__notes { display: block; font-size: 13px; color: var(--dim); margin-top: 4px; }
.tl__date { font-family: var(--mono); font-size: 12px; color: var(--dimmer); white-space: nowrap; }

/* ---------------------------------------------------------------- data */

.section--data { border-top: 1px solid var(--line); }
.notice {
  background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .32);
  color: #fde9b8; border-radius: 12px; padding: 14px 16px; font-size: 13.5px; margin-bottom: 18px;
}
.notice code { font-family: var(--mono); font-size: 12.5px; color: #fff; }
.dataacts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.rows { display: grid; gap: 4px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 14px;
}
.row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { font-family: var(--mono); font-size: 12px; color: var(--dimmer); }
.row__acts { display: flex; gap: 5px; }

.raw { margin-top: 22px; }
.raw summary { cursor: pointer; color: var(--dim); font-size: 13px; }
.json {
  width: 100%; height: 260px; margin-top: 10px; resize: vertical;
  background: #060a14; color: var(--dim); border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 12px; padding: 12px;
}

/* ---------------------------------------------------------------- dialog */

.dialog {
  position: fixed; inset: 0; z-index: 200; padding: 22px; overflow: auto;
  display: grid; place-items: center;
  background: rgba(3, 5, 12, .74); backdrop-filter: blur(8px);
}
.dialog__box {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #0d1424, #080d1a);
  border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow);
}
.dialog__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.dialog__head h2 { font-size: 18px; }
.x { background: none; border: 0; color: var(--dim); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--text); }

/* "Pick on map" shrinks the dialog into the corner and lets clicks through. */
.dialog.is-peek { background: transparent; backdrop-filter: none; pointer-events: none; }
.dialog.is-peek .dialog__box {
  pointer-events: auto; position: fixed; right: 16px; bottom: 16px;
  width: min(340px, calc(100% - 32px)); max-height: 46vh; overflow: auto;
  opacity: .97;
}

.form { padding: 18px 20px 22px; display: grid; gap: 14px; }
.field { display: block; }
.field__label { display: block; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.field__label em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--dimmer); }
.form input[type=text], .form input[type=url], .form input[type=date],
.form input[type=number], .form select, .form textarea {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.form select option, .form select optgroup { background: var(--ink-2); }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--go); box-shadow: 0 0 0 3px rgba(94, 234, 212, .15);
}
.form textarea { resize: vertical; }

/* Place typeahead: the dropdown floats over whatever is below it rather
   than pushing the form around as results come and go. */
.field--combo { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  margin: 0; padding: 4px; list-style: none;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto;
}
.suggest__item {
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; color: var(--text);
}
.suggest__item:hover, .suggest__item.is-active { background: rgba(94, 234, 212, .14); }

.seg { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; }
.seg legend { padding: 0 6px; }
.seg label { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 13.5px; color: var(--dim); cursor: pointer; }
.seg input { accent-color: var(--go-deep); }

.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coords__acts { display: flex; gap: 7px; margin-top: 8px; }
.form__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 30px 20px 46px;
  text-align: center; color: var(--dim); font-size: 13px;
}
.foot__small { color: var(--dimmer); font-size: 11px; margin-top: 6px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .hero__top { grid-template-columns: 1fr; }
  .hero__globe { width: min(100%, 320px); }
}

@media (max-width: 820px) {
  .nav { display: none; }
  .head__in { padding: 9px 14px; }
  .section { padding: 40px 14px; }
  .hero { padding: 46px 14px 26px; }
  #map { height: 62vh; }
  .maplegend { font-size: 10.5px; gap: 8px; padding: 6px 9px; }
  .tl__date { display: none; }
  .stategrid { gap: 3px; }
  .state { border-radius: 5px; }
  /* Pushed right, a wrapped control row reads as detached from its heading. */
  .section__head .controls { margin-left: 0; }
  /* Three buttons and a name don't fit on one phone-width line. */
  .row { flex-wrap: wrap; gap: 6px 10px; }
  .row__name { flex: 1 1 100%; }
  .row__acts { margin-left: auto; }
}

/* Shown in place of the map when Leaflet or the tiles can't be reached. */
.mapfail {
  display: grid; place-items: center; height: 100%;
  padding: 40px; text-align: center; color: var(--dim); font-size: 14px;
}

/* Only ever present in a --demo preview build (see tools/build-preview.mjs).
   A page full of invented trips should say so above the fold. */
.preview-flag {
  margin: 0; padding: 10px 20px; text-align: center; font-size: 13px;
  color: #0b1a18; background: linear-gradient(90deg, var(--go), var(--home));
  font-weight: 600;
}

.ctl:disabled { opacity: .4; cursor: not-allowed; }
.ctl:disabled:hover { background: var(--card-2); border-color: var(--line); }

/* ---------------------------------------------------------------- records */

.badges {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.badge {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 16px 18px; transition: border-color .2s, background .2s, transform .2s;
}
.badge__glyph {
  display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 10px;
  border-radius: 50%; font-size: 16px;
  background: rgba(255,255,255,.05); color: var(--dimmer);
  border: 1px solid var(--line);
}
.badge__name { font-size: 14.5px; }
.badge__note { font-size: 12.5px; color: var(--dimmer); margin-top: 5px; }
.badge__at {
  margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: .04em;
}
/* Earned badges are the only lit thing in the grid, so the row reads as a
   score at a glance rather than a list of rules. */
.badge.is-got {
  background: rgba(94, 234, 212, .07); border-color: rgba(94, 234, 212, .36);
}
.badge.is-got:hover { transform: translateY(-2px); }
.badge.is-got .badge__glyph {
  background: linear-gradient(160deg, rgba(94,234,212,.35), rgba(20,184,166,.14));
  color: #eafffb; border-color: rgba(94,234,212,.5);
  box-shadow: 0 0 18px rgba(94,234,212,.25);
}
.badge.is-got .badge__note { color: var(--dim); }

.supers {
  margin-top: 26px; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.sup {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px;
}
.sup__label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dimmer); flex: none; }
.sup__place {
  font: inherit; font-size: 13.5px; color: var(--text); text-align: right;
  background: none; border: 0; padding: 0; cursor: default;
}
button.sup__place { cursor: pointer; }
button.sup__place:hover { color: var(--go); }
.sup__place em { font-style: normal; color: var(--go); font-family: var(--mono); font-size: 12px; }

/* ---------------------------------------------------------------- passport */

.section--passport {
  background:
    radial-gradient(closest-side at 15% 0%, rgba(251, 191, 36, .07), transparent),
    radial-gradient(closest-side at 85% 100%, rgba(94, 234, 212, .06), transparent);
}
.stamps { display: flex; flex-wrap: wrap; gap: 18px 20px; padding: 6px 0; }

/* An inked rubber stamp: double rule, a little crooked, and only as saturated
   as ink on a page ever is. */
.stamp {
  position: relative; display: grid; place-items: center; gap: 2px;
  width: 148px; min-height: 108px; padding: 12px 10px;
  transform: rotate(var(--tilt, 0deg));
  background: transparent; cursor: pointer; font: inherit;
  border: 2px solid currentColor; border-radius: 10px;
  color: var(--go); opacity: .82;
  transition: transform .18s, opacity .18s;
}
.stamp::before {
  content: ""; position: absolute; inset: 3px; border: 1px solid currentColor;
  border-radius: 7px; opacity: .55;
}
button.stamp:hover { transform: rotate(0deg) scale(1.05); opacity: 1; }
.stamp__flag { font-size: 22px; line-height: 1; }
.stamp__name {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  text-align: center; color: inherit; max-width: 124px;
}
.stamp__date {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  color: inherit; opacity: .75;
}
/* Four inks, assigned by country code so a stamp keeps its colour. */
.stamp.ink-a { color: #5eead4; }
.stamp.ink-b { color: #a78bfa; }
.stamp.ink-c { color: #fbbf24; }
.stamp.ink-d { color: #f472b6; }
.stamp--beyond { color: var(--beyond); border-style: dashed; }

/* popup actions */
.pop__acts { display: flex; gap: 6px; margin-top: 10px; }
.pop__btn {
  font: inherit; font-size: 12px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-2); color: var(--dim);
  border-radius: 8px; padding: 4px 9px;
}
.pop__btn:hover { color: var(--text); border-color: var(--go); }

/* ---------------------------------------------------------------- photos */

.wall {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.wall__item {
  position: relative; display: block; padding: 0; border: 0; cursor: pointer;
  border-radius: 12px; overflow: hidden; background: var(--card);
  aspect-ratio: 4 / 3;
}
.wall__item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s ease, filter .3s ease;
  filter: saturate(.9) brightness(.92);
}
.wall__item:hover img { transform: scale(1.05); filter: none; }
.wall__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 9px;
  font-size: 12.5px; color: #fff; text-align: left;
  background: linear-gradient(180deg, transparent, rgba(3, 6, 14, .85));
}

.tl__shot { flex: none; width: 62px; height: 46px; border-radius: 8px; overflow: hidden; }
.tl__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------------------------------------------------------------- one place, its own page */

.section--place { padding-top: 8px; }
.place__back {
  display: inline-flex; align-items: center; gap: 6px; color: var(--dim);
  font-size: 13px; text-decoration: none; margin-bottom: 22px; cursor: pointer;
}
.place__back:hover { color: var(--text); }
.place__head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.place__flag { font-size: 40px; line-height: 1; }
#place-title { font-size: clamp(28px, 4.2vw, 44px); margin: 0 0 4px; }
.place__sub { color: var(--go); font-size: 14px; margin: 0; }
.place__date { color: var(--dim); font-size: 13px; margin: 10px 0 0; }
.place__notes {
  color: var(--text); font-size: 15px; line-height: 1.6; opacity: .9;
  margin: 14px 0 30px; max-width: 62ch;
}
.place__gallery {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.place__gallery .wall__item { aspect-ratio: 4 / 3; }

.pop__shots { display: flex; gap: 4px; margin-bottom: 9px; }
.pop__img {
  flex: 1; min-width: 0; height: 84px; object-fit: cover;
  border-radius: 8px; display: block; cursor: zoom-in;
}

.shots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.shots img {
  width: 58px; height: 44px; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--line);
}
.mini--file { display: inline-block; }
.field__note { font-size: 11.5px; color: var(--dimmer); flex: 1 1 100%; margin-top: 4px; }
.field__note code { font-family: var(--mono); font-size: 11px; color: var(--dim); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 300; display: grid;
  grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 24px; background: rgba(2, 4, 10, .93); backdrop-filter: blur(6px);
}
.lightbox__fig { margin: 0; display: grid; gap: 12px; justify-items: center; min-width: 0; }
.lightbox__fig img {
  max-width: 100%; max-height: 78vh; border-radius: 12px; display: block;
  box-shadow: var(--shadow);
}
.lightbox__fig figcaption { color: var(--dim); font-size: 13px; }
.lightbox__x {
  position: absolute; top: 16px; right: 18px; z-index: 2;
  background: none; border: 0; color: var(--dim); font-size: 30px; cursor: pointer;
}
.lightbox__x:hover { color: #fff; }
.lightbox__nav {
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  color: var(--text); font-size: 26px; line-height: 1; cursor: pointer;
  width: 44px; height: 64px; border-radius: 12px;
}
.lightbox__nav:hover { background: rgba(255,255,255,.14); }

/* ---------------------------------------------------------------- planned */

/* A planned trip is drawn hollow everywhere it appears: it hasn't happened,
   and it should never be mistaken at a glance for somewhere he has been. */
.dot--planned { background: transparent; border: 1.5px dashed var(--dim); box-shadow: none; }

.pin--planned i { background: transparent; border: 1.5px dashed #aab6cc; box-shadow: none; }
.pin--planned::before { border-color: #aab6cc; border-style: dashed; animation: none; opacity: .35; }

.country.is-planned {
  border-style: dashed; border-color: rgba(255,255,255,.28); color: var(--dim);
}
.tl__item.is-planned .tl__dot {
  background: transparent; border: 1.5px dashed var(--dim); box-shadow: none;
}
.tl__tag {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); border: 1px dashed var(--line-2); border-radius: 6px;
  padding: 1px 5px; margin-left: 6px; vertical-align: 2px;
}

/* ---------------------------------------------------------------- edit mode */

/* Everything that changes the list is hidden for visitors. The page is a
   travel map first; the editor is a mode you switch into with ?edit. */
body:not(.is-editing) #add,
body:not(.is-editing) #add-2,
body:not(.is-editing) #data,
body:not(.is-editing) .pop__btn[data-edit],
body:not(.is-editing) .row__acts [data-edit],
body:not(.is-editing) .row__acts [data-del] { display: none !important; }

.editbar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  justify-content: center; text-align: center;
  background: rgba(94, 234, 212, .12); border-bottom: 1px solid rgba(94,234,212,.3);
  color: var(--go); font-size: 12.5px; padding: 7px 16px;
}
.editbar a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
body:not(.is-editing) .nav a[href="#data"] { display: none; }

/* ---------------------------------------------------------------- sign in */

.editbar__btn {
  font: inherit; font-size: 12.5px; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px; padding: 3px 10px;
}
.editbar__btn:hover { background: rgba(255,255,255,.2); }

.linkish {
  font: inherit; font-size: 11px; color: var(--dimmer); background: none;
  border: 0; padding: 0; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.linkish:hover { color: var(--dim); }

.dialog__box--narrow { width: min(400px, 100%); }
.field__note.is-bad { color: #fb7185; }
.notice.is-bad {
  background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .35);
  color: #ffd7de;
}
