:root {
  /* palette taken from the logo: deep navy ground, sky-blue accent, white ink */
  --bg: #0a1a2b;
  --panel: #0d2034;        /* matches the logo artwork background */
  --ink: #eef4fa;
  --muted: #90a6bd;
  --accent: #29c5f9;       /* logo sky blue */
  --border: #274a67;
  --bright: #5ad4fb;
  --pop: #ffd15a;
  --detail-bg: #10283f;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 80px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.site-header .tag { color: var(--muted); font-size: 13px; flex: none; white-space: nowrap; }
.site-header .hd-search { margin-left: auto; }

/* logo art already carries the navy ground, so it sits straight on the header */
.brand { display: inline-flex; align-items: center; flex: none; }
.brand img { display: block; width: auto; height: 60px; }

.layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  height: calc(100vh - 81px);
}
.layout.solo { grid-template-columns: 1fr; }
.layout.compact { height: calc(100vh - 81px); }  /* detail-bar header */

.panel {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 16px 18px;
}

/* airport page: destinations on top, hovered-route detail on the bottom half */
.panel.split { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.panel.split .panel-top { flex: 1 1 35%; overflow-y: auto; padding: 0 18px 16px; }
.panel.split .panel-top h2 { margin-top: 16px; }
.panel.split .panel-detail {
  position: relative;
  flex: 1 1 65%;
  overflow-y: auto;
  padding: 14px 18px 18px;
  background: var(--detail-bg);
  border-top: 2px solid var(--bright);
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.panel .totals { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.map { width: 100%; height: 100%; }

/* map column + floating filter bar (airport page) */
.map-wrap { position: relative; height: 100%; min-width: 0; }
.map-filters {
  position: absolute; z-index: 5; top: 10px; left: 10px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding: 8px 10px;
  background: rgba(13, 32, 52, .93);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  max-width: calc(100% - 78px);
}
.map-filters label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.map-filters select {
  font-family: inherit; font-size: 12px;
  max-width: 190px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 6px; cursor: pointer;
}
.map-filters select:focus { outline: none; border-color: var(--accent); }
.map-filters #f-clear {
  font-family: inherit; font-size: 11px; cursor: pointer;
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); border-radius: 5px; padding: 5px 9px;
}
.map-filters #f-clear:hover { border-color: var(--accent); }
.map-filters .f-count {
  font-size: 11px; color: var(--muted); padding-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

/* trip-dates: cog + Book cluster in the detail pane, panel overlays it */
.d-actions {
  position: absolute; top: 12px; right: 16px; z-index: 2;
  display: flex; align-items: center; gap: 6px;
}
.d-cog {
  width: 26px; height: 26px; padding: 5px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; cursor: pointer;
}
.d-cog:hover { color: var(--accent); border-color: var(--accent); }
.d-cog svg { width: 100%; height: 100%; }
.trip-panel {
  position: absolute; z-index: 6; top: 8px; right: 8px;
  width: 220px; max-width: calc(100% - 16px);
  padding: 12px 14px 14px;
  background: rgba(13, 32, 52, .98);
  border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.trip-panel.flash { animation: trip-flash .9s ease-out 2; }
@keyframes trip-flash {
  0%, 100% { border-color: var(--border); }
  50% { border-color: var(--pop); box-shadow: 0 0 0 3px rgba(255, 209, 90, .25), 0 12px 32px rgba(0, 0, 0, .5); }
}
.trip-panel-h { display: flex; align-items: center; justify-content: space-between; }
.trip-panel-h strong { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--bright); }
.trip-panel-h button {
  background: none; border: none; color: var(--muted); font-size: 18px;
  line-height: 1; cursor: pointer; padding: 0 2px;
}
.trip-panel-h button:hover { color: var(--ink); }
.trip-hint { margin: 4px 0 10px; font-size: 11px; color: var(--muted); }
.trip-panel label {
  display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.trip-panel input[type="date"], .trip-panel select {
  font-family: inherit; font-size: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 5px; padding: 5px 6px;
  color-scheme: dark;
}
.trip-panel select { cursor: pointer; }
.trip-panel input[type="date"]:focus,
.trip-panel select:focus { outline: none; border-color: var(--accent); }
.trip-panel .trip-ow {
  flex-direction: row; align-items: center; gap: 6px; margin: 2px 0 0;
  text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11px;
  cursor: pointer;
}
.trip-panel .trip-ow input { cursor: pointer; }

/* Book button in the route-detail pane (sits right of the cog) */
.d-book {
  font-family: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  color: #0b1118; background: var(--pop);
  border: none; border-radius: 5px; padding: 5px 11px;
}
.d-book:hover { background: #ffdd80; }

/* dimmed (filtered-out) destination rows */
table.routes tbody tr.is-dim { opacity: .3; }
table.routes tbody tr.is-dim:hover { opacity: .65; }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.rank .code { font-weight: 600; }
.rank .city { color: var(--muted); font-size: 13px; }
.rank .num { color: var(--muted); font-variant-numeric: tabular-nums; }

/* compact one-line header on the airport page */
.detail-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 80px; box-sizing: border-box;
  padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.hd-id { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 auto; }

/* split-flap / Vestaboard-style airport code */
.split-flap { display: inline-flex; gap: 3px; flex: none; }
.flap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 42px;
  font-family: var(--mono);
  font-size: 25px; font-weight: 700; line-height: 1;
  color: #f2ecdc;                     /* warm vintage off-white */
  text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  background: linear-gradient(#2b2f34 0%, #202429 49%,
                              #0b0d10 51%, #1c2025 100%);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05),
              0 1px 3px rgba(0, 0, 0, .5);
  position: relative;
}
.flap::after {                        /* the seam where the two flaps meet */
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; transform: translateY(-1px);
  background: rgba(0, 0, 0, .55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04);
}
.hd-ap {
  color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* header airport search (sits where the airport name used to) */
.hd-search { position: relative; min-width: 0; flex: 1 1 560px; max-width: 760px; }
.hd-search-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.hd-search input {
  width: 100%; box-sizing: border-box;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--ink); font-size: 13px; padding: 8px 36px 8px 12px;
  text-overflow: ellipsis;
  outline: none;
}
.hd-search input::placeholder { color: var(--muted); opacity: 1; }
.hd-search input:focus { border-color: var(--accent); background: rgba(41, 197, 249, .06); }
.hd-search:focus-within .hd-search-icon { color: var(--accent); }
.hd-search-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); max-height: 60vh; overflow-y: auto;
}
.hd-search-menu li {
  display: grid; grid-template-columns: 3.4em 1fr auto; gap: 8px; align-items: baseline;
  padding: 6px 8px; border-radius: 5px; cursor: pointer;
}
.hd-search-menu li:hover, .hd-search-menu li.is-active { background: rgba(41, 197, 249, .14); }
.hd-search-menu .c { font-family: var(--mono); font-weight: 700; color: var(--bright); }
.hd-search-menu .nm { color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-search-menu .dp { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hd-title { text-align: right; line-height: 1.3; white-space: nowrap; flex: none; }
.hd-title strong { display: block; font-size: 13px; color: var(--ink); }
.hd-title .sub { font-size: 11px; color: var(--muted); }
.hd-title .sub a { color: var(--accent); }
.hd-title .note { color: #ff9f4a; }

table.routes { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.routes th, table.routes td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.routes th:first-child, table.routes td:first-child,
table.routes th:nth-child(2), table.routes td:nth-child(2) { text-align: left; }
table.routes td.city { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
table.routes td:first-child a { font-family: var(--mono); font-weight: 700; letter-spacing: .5px; }
table.routes th {
  position: sticky; top: 0; z-index: 3;
  background: var(--panel); color: var(--muted); font-weight: 600;
  border-bottom: none; box-shadow: inset 0 -1px 0 var(--border);
}
table.routes tbody tr:hover { background: rgba(41,197,249,.10); }
table.routes tbody tr.is-active {
  background: rgba(41,197,249,.16);
  box-shadow: inset 3px 0 0 var(--bright);
}
.badge { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }

.panel .hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

/* --- small map popup: route + city + miles only --- */
.maplibregl-popup-content {
  background: #08192a;
  color: var(--ink);
  border: 1px solid var(--bright);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
}
.maplibregl-popup-content b { color: #fff; }
.maplibregl-popup-tip { border-top-color: var(--bright) !important; border-bottom-color: var(--bright) !important; }
.pp-h { font-size: 13px; margin-bottom: 1px; }
.pp-h b { color: var(--bright); }
.pp-sub { color: var(--muted); }
.pp-tag { font-size: 10px; border: 1px solid #ff9f4a; border-radius: 9px;
  padding: 0 5px; color: #ff9f4a; }

/* --- route detail in the sidebar bottom half --- */
.panel-detail .d-empty { color: var(--muted); font-size: 12px; font-style: italic; padding-right: 40px; }
.d-h {
  font-size: 17px; font-weight: 700; color: var(--bright);
  letter-spacing: .3px; margin-bottom: 2px; padding-right: 104px;
}
.d-sub { color: var(--ink); font-size: 12px; margin-bottom: 2px; padding-right: 104px; }
.d-line { color: var(--pop); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.d-lbl {
  color: var(--bright); text-transform: uppercase; letter-spacing: .08em;
  font-size: 10px; font-weight: 700; margin: 10px 0 5px;
}
.d-car-list { display: flex; flex-direction: column; gap: 8px; }
.d-car-row { padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; }
.d-car-row:first-child { padding-top: 0; border-top: none; }
.d-car-row--dim { opacity: .34; }
.d-car-row--dim:hover { opacity: .7; }
.d-car-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.d-car-logo {
  flex: none; width: 34px; height: 20px; object-fit: contain;
  background: #fff; border-radius: 3px; padding: 1px;
}
.d-car-logo--none { background: transparent; }
.d-car-name { color: #fff; font-weight: 600; }
.d-car-for {
  font-size: 10px; color: var(--accent); white-space: nowrap;
  border: 1px solid var(--border); border-radius: 9px; padding: 0 6px;
}
.d-car-top-badge {
  font-size: 10px; color: #0b1118; white-space: nowrap; font-weight: 700;
  background: var(--pop); border-radius: 9px; padding: 0 6px;
}
.d-car-op { color: var(--muted); font-size: 11px; margin-top: 2px; }
.d-car-freq { color: var(--pop); font-size: 11px; margin-top: 2px; }
.d-car-times { color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.d-car-planes { color: var(--muted); font-size: 11px; margin-top: 2px; }
.d-plain { color: var(--ink); font-size: 12px; }
