/* =========================================================================
   Tokens — "instrument / navigation" identity
   Cool paper + ink + one confident cobalt accent.
   Signature: Space Mono coordinate/index labels + left rail nav.
   ========================================================================= */
:root {
  --paper:      #F4F5F3;
  --paper-2:    #ECEEEA;
  --ink:        #16181D;
  --graphite:   #565B64;
  --line:       #D6D9D2;
  --accent:     #1B43C0;
  --accent-ink: #0F2C85;

  --font-display: "Newsreader", Georgia, serif;
  --font-body:    "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "Space Mono", ui-monospace, monospace;

  --wrap: 60rem;
  --rail: 8.5rem;
  --pad:  clamp(1.25rem, 4vw, 3rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.coord {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--graphite);
}

/* ---- shared left-aligned wrapper (not centered) ---- */
.wrap { width: 100%; max-width: var(--wrap); padding-left: var(--pad); padding-right: var(--pad); }

/* =========================================================================
   Header (stacked wordmark + coordinate, full-width rule) — matches sketch
   ========================================================================= */
.top { padding-top: 1.6rem; }
.wordmark {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark::before { content: "↳ "; color: var(--accent); }
.top .coord { display: block; margin-top: 0.35rem; }
.toprule { border: 0; border-top: 1px solid var(--ink); margin: 0.9rem 0 0; max-width: var(--wrap); }
.toprule.wrap { padding-right: var(--pad); }

/* =========================================================================
   Shell: left rail nav + vertical rule + content
   ========================================================================= */
.shell {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  padding-top: 2.2rem;
  padding-bottom: 4rem;
}
.rail { display: flex; flex-direction: column; gap: 0.7rem; padding-right: 1.4rem; }
.rail a {
  font-size: 1rem;
  color: var(--graphite);
  text-decoration: none;
  position: relative;
  width: max-content;
}
.rail a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.rail a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 1px; background: var(--accent); transition: right 0.25s ease;
}
.rail a:hover::after, .rail a[aria-current="page"]::after { right: 0; }
.rail .ext::before { content: ""; }
.rail .ext::after { bottom: 0; }

.content { border-left: 1px solid var(--line); padding-left: clamp(1.4rem, 4vw, 2.6rem); min-width: 0; }

/* =========================================================================
   Typography blocks
   ========================================================================= */
.eyebrow { display: block; margin-bottom: 1rem; }
h1.name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 1.2rem;
}
h1.name em { font-style: italic; color: var(--accent); }
.lede { font-size: 1.15rem; line-height: 1.55; max-width: 34rem; margin: 0 0 1rem; }
p { margin: 0 0 1rem; max-width: 34rem; }

a.link {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color 0.18s ease;
}
a.link:hover { border-bottom-color: var(--accent); }

.rule { border: 0; border-top: 1px solid var(--line); margin: 2.6rem 0 1.4rem; }
h2.section { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; letter-spacing: -0.01em; margin: 0 0 1rem; }

.btn {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em;
  text-decoration: none; color: var(--ink); border: 1px solid var(--ink);
  padding: 0.5rem 0.85rem; background: transparent; cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }

/* =========================================================================
   Toolbox grid (ungated)
   ========================================================================= */
.tools { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tool { background: var(--paper); padding: 1.25rem 1.35rem; display: flex; flex-direction: column; min-height: 8.5rem; }
.tool__id { margin-bottom: 0.55rem; }
.tool__title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; margin: 0 0 0.3rem; }
.tool__desc { font-size: 0.92rem; color: var(--graphite); margin: 0 0 0.9rem; flex: 1; }
.tool__open { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--accent); text-decoration: none; }
.tool__open::after { content: " →"; transition: margin-left 0.18s ease; }
.tool__open:hover::after { margin-left: 0.25rem; }

/* =========================================================================
   Travel
   ========================================================================= */
.filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.2rem; }
.filter button {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em;
  padding: 0.4rem 0.7rem; border: 1px solid var(--line); background: var(--paper);
  color: var(--graphite); cursor: pointer; transition: all 0.16s ease;
}
.filter button:hover { border-color: var(--ink); color: var(--ink); }
.filter button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }

#map { height: 27rem; width: 100%; border: 1px solid var(--line); margin: 0.4rem 0 1.6rem; background: var(--paper-2); }
.leaflet-container { font-family: var(--font-body); background: var(--paper-2); }
.plane-rot { display: block; line-height: 0; transition: none; will-change: transform; }
.apt-label { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; color: var(--ink); background: var(--paper); padding: 1px 4px; border: 1px solid var(--line); white-space: nowrap; }

.legs { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.leg { display: grid; grid-template-columns: 6rem 1fr auto; gap: 0.9rem; padding: 0.7rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.leg__date { font-family: var(--font-mono); font-size: 0.74rem; color: var(--graphite); letter-spacing: 0.04em; }
.leg__route { font-weight: 600; font-variant-numeric: tabular-nums; }
.leg__route .arr { color: var(--accent); margin: 0 0.35rem; }
.leg__miles { font-family: var(--font-mono); font-size: 0.8rem; color: var(--graphite); text-align: right; }
.leg--total { border-top: 1px solid var(--ink); }
.leg--total .leg__route { font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.leg--total .leg__miles { color: var(--accent); font-weight: 700; }
.legs__empty { color: var(--graphite); font-style: italic; padding: 1rem 0; }

/* =========================================================================
   Stats
   ========================================================================= */
/* Stats hub — one labeled group per category */
.statgroup { border-top: 1px solid var(--line); margin-top: 2.4rem; padding-top: 1.8rem; }
.statgroup .section { margin-top: 0.25rem; }
.statgroup__sub { display: block; margin: 0.2rem 0 0.6rem; }
.statgroup--soon { opacity: 0.62; }
.statgroup__note { margin: 0.3rem 0 0; color: var(--graphite); max-width: 26rem; }

.bignum { display: flex; flex-wrap: wrap; gap: 2.4rem; margin: 0.5rem 0 2rem; }
.bignum div { min-width: 7rem; }
.bignum .n { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3rem); line-height: 1; color: var(--accent); }
.bignum .k { display: block; margin-top: 0.5rem; }
.ytable { width: 100%; max-width: 30rem; border-collapse: collapse; }
.ytable th, .ytable td { text-align: left; padding: 0.6rem 0.6rem 0.6rem 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ytable th { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite); font-weight: 400; }
.ytable td:last-child, .ytable th:last-child { text-align: right; font-family: var(--font-mono); font-size: 0.85rem; }

/* =========================================================================
   Spots (recommendations)
   ========================================================================= */
.spots { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.spot { display: grid; grid-template-columns: 1.8rem 1fr; gap: 0.9rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.spot:last-child { border-bottom: 1px solid var(--line); }
.spot__num { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--accent); padding-top: 0.25rem; }
.spot__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.55rem; }
.spot__name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; margin: 0; }
.spot__type { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite); border: 1px solid var(--line); padding: 1px 6px; }
.spot__addr { color: var(--graphite); font-size: 0.95rem; margin: 0.25rem 0 0.55rem; }
.spot__link { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--accent); text-decoration: none; }
.spot__link::after { content: " →"; transition: margin-left 0.18s ease; }
.spot__link:hover::after { margin-left: 0.25rem; }
.spot-pin { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--accent); }

/* =========================================================================
   Listening (albums + podcasts)
   ========================================================================= */
.listen { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1.4rem; }
.lp { display: flex; flex-direction: column; }
.lp__art { position: relative; aspect-ratio: 1 / 1; background: var(--paper-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 0.7rem; }
.lp__ph { font-family: var(--font-display); font-size: 2.4rem; font-weight: 500; color: var(--accent); opacity: 0.5; letter-spacing: 0.02em; }
.lp__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp__kind { display: block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite); margin-bottom: 0.35rem; }
.lp__title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; line-height: 1.2; margin: 0; }
.lp__by { color: var(--graphite); font-size: 0.9rem; margin: 0.15rem 0 0.6rem; }
.lp__links { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; }
.lp__link { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.03em; text-decoration: none; color: var(--ink); border: 1px solid var(--line); padding: 0.3rem 0.5rem; transition: border-color 0.16s ease, color 0.16s ease; }
.lp__link:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Listening: tiles / shelf toggle (pill) ---- */
.seg { display: inline-flex; gap: 0.15rem; margin: 1.3rem 0 0; padding: 0.2rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; }
.seg__btn { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite); background: transparent; border: 0; border-radius: 999px; padding: 0.42rem 1rem; cursor: pointer; transition: background 0.18s ease, color 0.18s ease; }
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-on, .seg__btn.is-on:hover { background: var(--accent); color: #fff; }

/* ---- Listening: shelf concept (soft white case) ---- */
.shelf-view { margin-top: 1.4rem; }
.shelf-stage { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.bookcase { flex: 0 0 auto; width: min(340px, 100%); background: #ECEDE8; border: 9px solid #fff; border-radius: 16px; padding: 0 0.55rem; box-shadow: 0 12px 32px rgba(22,24,29,0.10), inset 0 0 0 1px rgba(22,24,29,0.06), inset 0 3px 12px rgba(22,24,29,0.07); }
.shelf { display: flex; gap: 2px; align-items: flex-end; min-height: 116px; padding: 0 4px; border-bottom: 7px solid #fff; box-shadow: 0 7px 7px -6px rgba(22,24,29,0.22); }
.shelf:last-child { border-bottom: 0; box-shadow: none; }
.shelf--decor { flex-wrap: nowrap; overflow: hidden; }

.spine { flex: 0 0 auto; width: var(--w, 22px); height: var(--h, 80px); background: var(--c, #F6F7F4); border: 1px solid rgba(22,24,29,0.10); border-bottom: 0; border-radius: 2px 2px 0 0; padding: 0; cursor: pointer; box-shadow: inset -3px 0 5px -3px rgba(22,24,29,0.20), inset 2px 0 0 rgba(255,255,255,0.55); transition: transform 0.34s ease, opacity 0.34s ease, width 0.26s ease, margin 0.26s ease, box-shadow 0.2s ease; }
.spine:hover, .spine:focus-visible { transform: translateY(-8px); outline: none; box-shadow: 0 8px 14px rgba(22,24,29,0.20); }
.spine.is-pulled { transform: translateY(-34px) rotate(-7deg); opacity: 0; pointer-events: none; }
.spine.is-collapsed { width: 0; margin-left: -2px; margin-right: -2px; opacity: 0; pointer-events: none; border-width: 0; }
.spine--decor { cursor: default; }
.spine--decor:hover { transform: none; box-shadow: inset -3px 0 5px -3px rgba(22,24,29,0.20), inset 2px 0 0 rgba(255,255,255,0.55); }

.bookend { flex: 0 0 auto; width: 22px; height: 26px; align-self: flex-end; background: #E7E5DC; border: 1px solid rgba(22,24,29,0.07); border-bottom: 0; border-radius: 9px 9px 0 0; box-shadow: inset -4px 0 7px -4px rgba(22,24,29,0.14), inset 3px 0 0 rgba(255,255,255,0.5); }
.bookend--l { margin-right: 3px; }
.bookend--r { margin-left: 3px; }

.shelf-side { flex: 1 1 11rem; min-width: 11rem; }
.shelf-hint { margin: 0; max-width: 12rem; font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.55; letter-spacing: 0.03em; color: var(--graphite); }
.shelf-card { position: relative; max-width: 13rem; opacity: 0; transform: translateY(16px); transition: opacity 0.3s ease, transform 0.3s ease; }
.shelf-card.is-in { opacity: 1; transform: none; }
.shelf-card .lp__art { aspect-ratio: 1 / 1; margin-bottom: 0.7rem; }
.shelf-card__close { display: none; }

/* Cursor-following name tooltip — soft, blurred, transparent */
.shelf-tip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; transform: translate(14px, 16px); padding: 0.34rem 0.62rem; background: rgba(244,245,243,0.52); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); border: 1px solid rgba(22,24,29,0.10); border-radius: 8px; box-shadow: 0 8px 22px rgba(22,24,29,0.14); max-width: 15rem; opacity: 0; transition: opacity 0.12s ease; }
.shelf-tip.is-on { opacity: 1; }
.shelf-tip__name { display: block; font-family: var(--font-display); font-size: 0.92rem; font-weight: 500; line-height: 1.2; color: var(--ink); }
.shelf-tip__by { display: block; font-family: var(--font-body); font-size: 0.74rem; color: var(--graphite); }
.shelf-tip__soon { display: block; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite); }

@keyframes spine-nudge { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-4px) rotate(-2deg); } 65% { transform: translateY(-2px) rotate(2deg); } }
.spine--decor.is-nudge { animation: spine-nudge 0.42s ease; }

/* Mobile: the detail takes over the screen, with a close button */
@media (max-width: 40rem) {
  .shelf-card.is-in { position: fixed; inset: 0; z-index: 60; margin: 0; max-width: none; padding: 4.5rem 1.5rem 2.5rem; background: var(--paper); overflow: auto; }
  .shelf-card.is-in .lp__art { max-width: 18rem; }
  .shelf-card__close { display: flex; align-items: center; justify-content: center; position: fixed; top: 1rem; right: 1rem; z-index: 61; width: 2.4rem; height: 2.4rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-2); color: var(--ink); font-family: var(--font-mono); font-size: 1rem; cursor: pointer; }
}

@media (prefers-reduced-motion: reduce) {
  .spine, .spine:hover, .spine:focus-visible, .spine.is-pulled, .shelf-card { transition: none; transform: none; }
  .spine.is-pulled { opacity: 0.2; }
  .spine--decor.is-nudge { animation: none; }
}

/* =========================================================================
   Causes
   ========================================================================= */
.causes { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.cause { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.cause:last-child { border-bottom: 1px solid var(--line); }
.cause__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; margin-bottom: 0.35rem; }
.cause__name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; margin: 0; }
.cause__tag { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite); border: 1px solid var(--line); padding: 1px 6px; }
.cause__desc { margin: 0 0 0.6rem; max-width: 40rem; }
.cause__link { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--accent); text-decoration: none; }
.cause__link::after { content: " →"; transition: margin-left 0.18s ease; }
.cause__link:hover::after { margin-left: 0.25rem; }

/* =========================================================================
   Footer
   ========================================================================= */
footer { padding-top: 1.6rem; padding-bottom: 3rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; max-width: var(--wrap); }
footer a { color: var(--graphite); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* =========================================================================
   Motion + responsive + a11y
   ========================================================================= */
.fade { opacity: 0; transform: translateY(8px); animation: fade 0.55s ease forwards; }
.fade:nth-child(2) { animation-delay: 0.05s; }
.fade:nth-child(3) { animation-delay: 0.1s; }
@keyframes fade { to { opacity: 1; transform: none; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 40rem) {
  .shell { grid-template-columns: 1fr; padding-top: 1.4rem; }
  .rail { flex-direction: row; flex-wrap: wrap; gap: 1rem; padding: 0 0 1.1rem; }
  .content { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 1.4rem; }
  .tools { grid-template-columns: 1fr; }
  .leg { grid-template-columns: 4.5rem 1fr auto; gap: 0.6rem; }
  #map { height: 20rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; opacity: 1; transform: none; }
  .rail a::after { transition: none; }
}
