/* ============================================================
   trains.im — main stylesheet
   ============================================================ */

/* ── Reset & design tokens ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #1a0a2e;
  --bg-2:    #231040;
  --bg-3:    #2d1854;
  --surface: #221038;
  --border:  rgba(255,255,255,0.08);
  --text:    #ede8f5;
  --muted:   #9b8ab8;
  --green:   #4ade80;
  --amber:   #fbbf24;
  --red:     #f87171;
  --accent:  #a78bfa;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  padding-top: 56px;
}

/* ── Nav ────────────────────────────────────────────────────── */
.ti-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(26,10,46,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.ti-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

/*
 * AIGA rail pictogram is 314 × 472px (portrait ~2:3).
 * Constrain by height only, width auto — preserves natural aspect ratio.
 */
.ti-brand-icon {
  height: 28px;
  width: auto;
  opacity: 0.85;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.ti-brand-word {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.ti-brand-word span { color: var(--accent); }

.ti-nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
}

.ti-nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.ti-nav-links a:hover   { color: var(--text); background: rgba(255,255,255,0.06); }
.ti-nav-links a.ti-active { color: var(--text); background: rgba(255,255,255,0.09); }

/* ── Page wrapper ───────────────────────────────────────────── */
.ti-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 3rem 4rem;
  width: 100%;
}

@media (max-width: 900px) {
  .ti-page { padding-left: 2rem; padding-right: 2rem; }
}

/* ── Typography ─────────────────────────────────────────────── */
.ti-eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.ti-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.3rem;
  color: #ffffff;
}

.ti-subheading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
}

.ti-date  { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.75rem; }
.ti-body  { font-size: 0.875rem; color: var(--muted); line-height: 1.6; margin-bottom: 0.5rem; }
.ti-note  { font-size: 0.7rem; color: var(--muted); line-height: 1.5; }

/* ── Switcher ───────────────────────────────────────────────── */
.ti-switcher-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.ti-switcher {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ti-switcher a,
.ti-switcher-btn {
  display: block;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  transition: background 0.15s, color 0.15s;
}

.ti-switcher a:hover,
.ti-switcher-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.ti-switcher a.ti-on,
.ti-switcher-btn.ti-on { background: var(--accent); color: #1a0a2e; font-weight: 600; }

.ti-sep { color: var(--muted); font-size: 0.75rem; padding: 0 0.1rem; align-self: center; }

.ti-switcher-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.ti-switcher-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* ── Key / legend ───────────────────────────────────────────── */
.ti-key { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.ti-key-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.ti-key-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ── Hero card ──────────────────────────────────────────────── */
.ti-hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 1rem;
}

.ti-big-pct {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ti-big-label   { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem; }
.ti-hero-meta   { display: flex; flex-direction: column; gap: 0.6rem; }
.ti-hero-tagline { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 600; }
.ti-hero-stats  { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.ti-stat-pill   { display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--muted); }
.ti-stat-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Master bar ─────────────────────────────────────────────── */
.ti-master-bar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.ti-bar-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.5rem; }

.ti-bar {
  height: 7px;
  border-radius: 99px;
  background: var(--bg-3);
  overflow: hidden;
  display: flex;
}

.ti-bar-seg { height: 100%; transition: width 1s cubic-bezier(0.16,1,0.3,1); }
.ti-bar-seg + .ti-bar-seg { margin-left: 2px; }

/* ── Section label ──────────────────────────────────────────── */
.ti-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

/* ── Operator grid ──────────────────────────────────────────── */
.ti-op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.ti-op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  display: block;
  transition: border-color 0.2s, transform 0.15s;
}

.ti-op-card:hover   { border-color: rgba(167,139,250,0.4); transform: translateY(-1px); }
.ti-op-header       { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; }
.ti-op-name         { font-family: 'Space Grotesk', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ti-op-pct          { font-family: 'Space Grotesk', sans-serif; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ti-op-bar          { margin-bottom: 0.5rem; }
.ti-op-footer       { display: flex; gap: 0.9rem; }
.ti-op-stat         { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ti-op-stat strong  { color: var(--text); font-weight: 500; }

/* ── Service list ───────────────────────────────────────────── */
.ti-service-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 2rem; }

.ti-service-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr 180px 60px;
  gap: 1rem;
  align-items: center;
  text-decoration: none;
  transition: border-color 0.2s;
}

.ti-service-row:hover { border-color: rgba(167,139,250,0.4); }
.ti-service-name { font-family: 'Space Grotesk', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ti-service-pct  { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* ── Stat cards ─────────────────────────────────────────────── */
.ti-stat-row        { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.65rem; margin-bottom: 1.5rem; }
.ti-stat-card       { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1.1rem; }
.ti-stat-card-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.3rem; }
.ti-stat-card-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ti-stat-card-sub   { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }

/* ── Chart ──────────────────────────────────────────────────── */
.ti-chart-card   { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.4rem 1.5rem; margin-bottom: 1.5rem; position: relative; }
.ti-chart-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.1rem; gap: 1rem; }
.ti-chart-title  { font-family: 'Space Grotesk', sans-serif; font-size: 0.875rem; font-weight: 600; color: var(--text); }
.ti-chart-sub    { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.ti-chart-legend { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.ti-legend-item  { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; color: var(--muted); }
.ti-legend-line  { width: 16px; height: 2px; border-radius: 2px; }
svg.ti-line-chart { width: 100%; height: 220px; overflow: visible; display: block; }

/* ── Tooltip ────────────────────────────────────────────────── */
.ti-tooltip  { position: absolute; background: var(--bg-2); border: 1px solid rgba(167,139,250,0.2); border-radius: 8px; padding: 0.55rem 0.85rem; font-size: 0.76rem; pointer-events: none; opacity: 0; transition: opacity 0.12s; z-index: 20; white-space: nowrap; }
.ti-tooltip.ti-vis { opacity: 1; }
.ti-tip-date { color: var(--muted); margin-bottom: 0.25rem; font-size: 0.68rem; }
.ti-tip-row  { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.1rem; }
.ti-tip-dot  { width: 6px; height: 6px; border-radius: 50%; }

/* ── History table ──────────────────────────────────────────── */
.ti-hist-table { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 1.5rem; }
.ti-hist-head  { display: grid; grid-template-columns: 110px 1fr 64px 64px 80px; padding: 0.65rem 1.2rem; border-bottom: 1px solid var(--border); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.ti-hist-row   { display: grid; grid-template-columns: 110px 1fr 64px 64px 80px; padding: 0.6rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.04); align-items: center; transition: background 0.1s; }
.ti-hist-row:last-child { border-bottom: none; }
.ti-hist-row:hover      { background: rgba(255,255,255,0.03); }
.ti-hist-date    { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ti-hist-bar-wrap { padding-right: 1rem; }
.ti-hist-pct     { font-family: 'Space Grotesk', sans-serif; font-size: 0.875rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ti-hist-small   { font-size: 0.75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ── Monthly grid ───────────────────────────────────────────── */
.ti-month-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.65rem; margin-bottom: 2rem; }
.ti-month-card   { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1.1rem; transition: border-color 0.2s; }
.ti-month-card:hover { border-color: rgba(167,139,250,0.35); }
.ti-month-name   { font-family: 'Space Grotesk', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
.ti-month-pct    { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-bottom: 0.45rem; }
.ti-month-trains { font-size: 0.68rem; color: var(--muted); }

/* ── Back link ──────────────────────────────────────────────── */
.ti-back { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); text-decoration: none; margin-bottom: 1.75rem; transition: color 0.15s; }
.ti-back:hover { color: var(--text); }

/* ── HSP form ───────────────────────────────────────────────── */
.ti-field-label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 0.4rem; }
.ti-field { width: 100%; background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.875rem; padding: 0.55rem 0.75rem; outline: none; transition: border-color 0.15s; }
.ti-field:focus { border-color: var(--accent); }
.ti-radio-btn { display: flex; align-items: center; padding: 0.4rem 0.9rem; font-size: 0.8rem; font-weight: 500; color: var(--muted); cursor: pointer; gap: 0.4rem; }
.ti-radio-btn input { display: none; }
.ti-radio-btn:has(input:checked) { background: var(--accent); color: #1a0a2e; font-weight: 600; }
.ti-btn-primary { background: var(--accent); color: #1a0a2e; border: none; border-radius: 8px; font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem; font-weight: 700; padding: 0.65rem 1.25rem; cursor: pointer; transition: opacity 0.15s; }
.ti-btn-primary:hover { opacity: 0.88; }

/* ── HSP autocomplete ───────────────────────────────────────── */
.hsp-ac-wrap { position: relative; }
.hsp-ac-input.hsp-confirmed { border-color: var(--green); }
.hsp-ac-wrap .hsp-check { position: absolute; right: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--green); font-size: 0.9rem; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.hsp-ac-wrap.hsp-ok .hsp-check { opacity: 1; }
.hsp-ac-dropdown { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-2); border: 1px solid rgba(167,139,250,0.25); border-radius: 8px; overflow: hidden; z-index: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.5); max-height: 220px; overflow-y: auto; }
.hsp-ac-dropdown.open { display: block; }
.hsp-ac-item { padding: 0.5rem 0.85rem; cursor: pointer; transition: background 0.1s; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.hsp-ac-item:hover, .hsp-ac-item.hsp-focused { background: rgba(167,139,250,0.12); }
.hsp-ac-item-name { font-size: 0.85rem; color: var(--text); font-weight: 500; }
.hsp-ac-item-name mark { background: none; color: var(--accent); font-weight: 700; }
.hsp-ac-item-crs { font-size: 0.72rem; font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; flex-shrink: 0; }
.hsp-ac-empty { padding: 0.65rem 0.85rem; font-size: 0.82rem; color: var(--muted); }

/* ── HSP results table ──────────────────────────────────────── */
.hsp-table  { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 2rem; }
.hsp-thead  { display: grid; grid-template-columns: 52px 52px 1fr 48px 1fr 64px; padding: 0.65rem 1.2rem; border-bottom: 1px solid var(--border); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.hsp-row    { display: grid; grid-template-columns: 52px 52px 1fr 48px 1fr 64px; padding: 0.6rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.04); align-items: center; transition: background 0.1s; }
.hsp-row:last-child { border-bottom: none; }
.hsp-row:hover      { background: rgba(255,255,255,0.03); }
.hsp-time   { font-family: 'Space Grotesk', sans-serif; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.hsp-time.muted { color: var(--muted); font-weight: 400; }
.hsp-toc    { font-size: 0.78rem; color: var(--muted); }
.hsp-small  { font-size: 0.75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.hsp-bar-col { padding: 0 1rem; }
.hsp-pct    { font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Colour utilities ───────────────────────────────────────── */
.ti-green    { color: var(--green); }
.ti-amber    { color: var(--amber); }
.ti-red      { color: var(--red); }
.ti-bg-green { background: var(--green); }
.ti-bg-amber { background: var(--amber); }
.ti-bg-red   { background: var(--red); }

/* ── Footer ─────────────────────────────────────────────────── */
.ti-footer   { border-top: 1px solid var(--border); padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--muted); max-width: 1100px; margin: 0 auto; }
.ti-footer a { color: var(--muted); text-decoration: underline; }

/* ── National map page ──────────────────────────────────────── */

/* Full-screen map sits below the fixed nav */
.map-page body { overflow: hidden; }

#map {
  position: fixed;
  top: 56px; bottom: 0; left: 0; right: 0;
}

/* Search box */
.map-search {
  position: absolute;
  top: 1rem; left: 1rem;
  z-index: 100;
  width: 280px;
}

.map-search-inner {
  background: rgba(26,10,46,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.map-search-input-wrap {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  gap: 0.5rem;
}

.map-search-icon { color: var(--muted); flex-shrink: 0; font-size: 1rem; }

.map-search-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  padding: 0.7rem 0;
}

.map-search-input::placeholder { color: var(--muted); }

.map-search-results {
  display: none;
  border-top: 1px solid var(--border);
  max-height: 260px;
  overflow-y: auto;
}

.map-search-results.open { display: block; }

.map-search-result {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
}

.map-search-result:hover           { background: rgba(167,139,250,0.12); }
.map-search-result-name            { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.map-search-result-meta            { font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }

/* Legend */
.map-legend {
  position: absolute;
  bottom: 2rem; left: 1rem;
  z-index: 100;
  background: rgba(26,10,46,0.88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.map-legend-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.map-legend-item:last-child { margin-bottom: 0; }

.map-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Station count badge */
.map-count {
  position: absolute;
  top: 1rem; right: 1rem;
  z-index: 100;
  background: rgba(26,10,46,0.88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.map-count strong { color: var(--text); font-family: 'Space Grotesk', sans-serif; }

/* Loading overlay */
#map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 150;
  gap: 0.75rem;
  transition: opacity 0.4s;
}

#map-loading.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(167,139,250,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  color: var(--muted);
}

/* MapLibre popup overrides */
.maplibregl-popup-content {
  background: var(--bg-2) !important;
  color: var(--text) !important;
  border: 1px solid rgba(167,139,250,0.2) !important;
  border-radius: 10px !important;
  padding: 0 !important;
  font-family: 'Inter', sans-serif !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  min-width: 200px;
}

.maplibregl-popup-tip             { border-top-color: var(--bg-2) !important; }
.maplibregl-popup-close-button    { color: var(--muted) !important; font-size: 1.1rem !important; top: 0.4rem !important; right: 0.5rem !important; background: none !important; }

.popup-inner   { padding: 1rem 1.1rem 0.9rem; }
.popup-name    { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; padding-right: 1.2rem; }
.popup-crs     { font-size: 0.72rem; font-family: 'Space Grotesk', sans-serif; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.5rem; }
.popup-country { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.75rem; text-transform: capitalize; }
.popup-link    { display: block; text-align: center; background: rgba(167,139,250,0.15); border: 1px solid rgba(167,139,250,0.25); border-radius: 6px; color: var(--accent); text-decoration: none; font-size: 0.8rem; font-weight: 500; padding: 0.4rem 0.75rem; transition: background 0.15s; }
.popup-link:hover { background: rgba(167,139,250,0.25); }

/* MapLibre control positioning */
.maplibregl-ctrl-top-right    { top: 4rem !important; }
.maplibregl-ctrl-bottom-right { bottom: 2rem !important; right: 1rem !important; }

.maplibregl-ctrl-group {
  background: rgba(26,10,46,0.9) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 8px !important;
  backdrop-filter: blur(10px);
}

.maplibregl-ctrl-group button              { background: none !important; color: var(--muted) !important; border-bottom: 1px solid rgba(255,255,255,0.08) !important; }
.maplibregl-ctrl-group button:last-child   { border-bottom: none !important; }
.maplibregl-ctrl-group button:hover        { background: rgba(255,255,255,0.06) !important; color: var(--text) !important; }

@media (max-width: 480px) {
  .map-search { width: calc(100vw - 2rem); }
  .map-legend { bottom: 1rem; }
  .map-count  { display: none; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ti-page { padding: 1.5rem 1rem 3rem; }
  .ti-hero-card { grid-template-columns: 1fr; gap: 1rem; }
  .ti-hist-head, .ti-hist-row { grid-template-columns: 88px 1fr 52px 52px; }
  .ti-hist-head > *:last-child, .ti-hist-row > *:last-child { display: none; }
  .ti-op-grid { grid-template-columns: 1fr; }
  .ti-service-row { grid-template-columns: 1fr 60px; }
  .ti-service-row > *:nth-child(2) { display: none; }
  .ti-footer { flex-direction: column; gap: 0.5rem; text-align: center; }
  .hsp-thead, .hsp-row { grid-template-columns: 48px 48px 1fr 52px; }
  .hsp-thead > *:nth-child(4), .hsp-row > *:nth-child(4),
  .hsp-thead > *:nth-child(5), .hsp-row > *:nth-child(5) { display: none; }
}
