/* Space APRS — one dark look, because the globe sits in space and the page is its frame. */
:root {
    --bg: #07090f;
    --panel: rgba(12, 16, 26, 0.78);
    --panel-solid: #0e1320;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #e6ebf5;
    --muted: #8b95ab;
    --faint: #5b6478;
    --amber: #f2b84b;
    --amber-dim: rgba(242, 184, 75, 0.35);
    --iss: #7fb4ff;
    --ok: #5fd39a;
    --warn: #f2b84b;
    --bad: #ff6b6b;
    --radius: 12px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow-x: hidden; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 var(--font);
    font-feature-settings: "tnum" 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { color: var(--iss); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--amber); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; }

/* Header */
.top {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(to bottom, rgba(7, 9, 15, 0.95), rgba(7, 9, 15, 0.75));
    backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; color: var(--amber); }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav a.on, .nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.powered-top { margin-left: auto; display: inline-flex; align-items: center; gap: 9px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid rgba(242, 184, 75, 0.35); background: rgba(242, 184, 75, 0.08); color: var(--text); font-size: 13.5px; }
.powered-top:hover { text-decoration: none; border-color: var(--amber); background: rgba(242, 184, 75, 0.14); }
.powered-top img { width: 26px; height: 26px; border-radius: 7px; }
.powered-top span { color: var(--muted); }
.powered-top b { color: var(--amber); font-weight: 650; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 0 transparent; }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 10px rgba(95, 211, 154, 0.6); }
.status.warn .dot { background: var(--warn); }
.status.bad .dot { background: var(--bad); }

/* Footer */
.foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 18px;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 12px;
    background: var(--bg);
    position: relative;
    z-index: 5;
}
.foot a { color: var(--muted); }
.legal { color: var(--faint); }
.legal a { color: var(--muted); }
.made-in { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.flag { width: 19px; height: 10px; border-radius: 1.5px; box-shadow: 0 0 0 1px rgba(255,255,255,0.12); }
.powered { color: var(--muted); }
.powered a { color: var(--amber); font-weight: 600; }

/* Live page: the globe fills the main area and cards float on it. */
body.live { height: 100vh; overflow: hidden; }
.live-main { position: relative; flex: 1; min-height: 0; }
.globe {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(40, 60, 110, 0.25), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(90, 50, 30, 0.14), transparent 55%),
        var(--bg);
}
.globe .maplibregl-canvas { outline: none; }
/* The OpenStreetMap credit lives on the map, as the licence asks: MapLibre's compact control,
   a small (i) that opens on tap, styled to the page. */
.maplibregl-ctrl-attrib { background: rgba(12, 16, 26, 0.85) !important; color: var(--muted); border-radius: 8px; font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: invert(0.8); }
.live .maplibregl-ctrl-bottom-right { right: 0; bottom: 0; z-index: 4; }
.live .ticker { margin-right: 30px; }
/* The zoom buttons sit just left of the right-hand panel, not under it. */
.live .maplibregl-ctrl-top-right { right: 352px; top: 16px; }
.live .maplibregl-ctrl-group { background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.live .maplibregl-ctrl-group button { background-color: transparent; }
.live .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.live .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(0.85); }
.hud { position: absolute; z-index: 3; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-left { top: 16px; left: 16px; width: 300px; }
.hud-right { top: 16px; right: 16px; width: 320px; bottom: 96px; }
.hud-bottom { left: 16px; right: 16px; bottom: 14px; flex-direction: row; align-items: flex-end; gap: 14px; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    backdrop-filter: blur(14px) saturate(1.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.card-head.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.card-head.row h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head.row .seg { flex-shrink: 0; }
.card h2 { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.platform-name { font-size: 17px; }
.freq { color: var(--muted); font-size: 12.5px; }
.iss-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.iss-facts div { display: flex; flex-direction: column; }
.iss-facts dt, .facts dt { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.iss-facts dd, .facts dd { margin: 0; font-size: 14px; }
.quiet { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(242, 184, 75, 0.1); color: var(--amber); font-size: 12.5px; border: 1px solid var(--amber-dim); }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 14px; }
.counts div { display: flex; flex-direction: column; }
.counts b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.counts span { color: var(--faint); font-size: 11px; }

.feed-card { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.stations { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; margin: 0 -8px; }
.stations li { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid var(--line); }
.stations li:hover { background: rgba(255, 255, 255, 0.04); }
.stations li.pass { border-left: 2px solid var(--amber); padding-left: 6px; }
.stations li.new { animation: flash 1.6s ease-out; }
.stations .call { font-family: var(--mono); font-weight: 600; font-size: 13.5px; color: var(--text); }
.stations .when { color: var(--muted); font-size: 12px; text-align: right; }
.stations .meta { grid-column: 1 / -1; color: var(--faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stations .n { color: var(--amber); }
.empty { color: var(--faint); text-align: center; padding: 20px 0; }
@keyframes flash { from { background: rgba(242, 184, 75, 0.25); } to { background: transparent; } }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 2px; backdrop-filter: blur(10px); }
.seg button { background: transparent; border: 0; padding: 5px 11px; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.seg button.on { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px; color: var(--muted); cursor: pointer; font-size: 12.5px; backdrop-filter: blur(10px); }
.btn:hover { color: var(--text); border-color: var(--line-strong); }
.btn[aria-pressed="true"] { color: var(--iss); border-color: rgba(127, 180, 255, 0.4); }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; backdrop-filter: blur(10px); cursor: pointer; }
.chk input { accent-color: var(--amber); margin: 0; }

.ticker { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; flex-direction: column-reverse; gap: 4px; max-width: 46vw; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.ticker li { min-width: 0; max-width: 100%; background: rgba(7, 9, 15, 0.7); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: slide 0.4s ease-out; }
.ticker li b { color: var(--amber); font-weight: 600; }
.ticker li.beacon b { color: var(--iss); }
.ticker li .t { color: var(--faint); margin-right: 8px; }
@keyframes slide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.maplibregl-popup-content { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: 12.5px/1.4 var(--font); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--panel-solid); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--panel-solid); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel-solid); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel-solid); }
.maplibregl-popup-close-button { color: var(--muted); font-size: 16px; padding: 2px 6px; }
.popup .call { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.popup .muted { color: var(--muted); }

/* Ordinary pages */
.page { width: min(1080px, 100% - 36px); margin: 0 auto; padding: 28px 0 40px; flex: 1; }
.page-head { margin-bottom: 20px; }
.crumb { color: var(--faint); font-size: 12.5px; margin: 0 0 6px; }
.crumb a { color: var(--muted); }
.page h1 { font-size: 26px; }
.page h1 small { color: var(--muted); font-weight: 400; font-size: 15px; }
.page h1 .call { font-family: var(--mono); }
.lede { color: var(--muted); margin: 6px 0 0; }
.links { display: flex; gap: 14px; margin: 8px 0 0; font-size: 13px; }
.page .card { margin-bottom: 16px; }
.page .card h2 { margin: 6px 0 10px; }
.station-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0 0 14px; }
.facts div { display: flex; flex-direction: column; }
.facts dd { font-size: 14px; }
.facts dd a { font-family: var(--mono); }
.map-card { padding: 0; overflow: hidden; }
.mini-map { height: 100%; min-height: 320px; background: var(--bg); }
.spark { width: 100%; height: 60px; display: block; }
.spark rect { fill: var(--amber); }
.spark line { stroke: var(--line-strong); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
td.num, th.num { text-align: right; }
td .call, .stations-table .call { font-family: var(--mono); font-weight: 600; }
.packets td:nth-child(1) { white-space: nowrap; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.packets td:nth-child(2) { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.packets td:nth-child(2) b { color: var(--amber); font-weight: 600; }
.packets td:nth-child(3) { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.filter { display: flex; gap: 8px; margin: 0 0 16px; }
.filter input { background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--text); border-radius: 9px; padding: 8px 10px; font: inherit; font-family: var(--mono); text-transform: uppercase; width: 220px; }
.pager { display: flex; gap: 14px; justify-content: flex-end; padding-top: 10px; }
.prose { max-width: 720px; }

/* Passes */
.passes-form { flex-wrap: wrap; }
.muted-line { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.choices { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.choices button { width: 100%; text-align: left; background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--text); border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.choices button:hover { border-color: var(--amber); }
.now-banner { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: rgba(127, 180, 255, 0.1); border: 1px solid rgba(127, 180, 255, 0.35); color: var(--iss); font-size: 13px; }
.passes td { font-size: 13.5px; }
.passes td b { font-weight: 600; font-family: var(--mono); }
.passes .dim { color: var(--muted); font-size: 12px; }
.q { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line-strong); color: var(--muted); }
.q-hi { color: var(--ok); border-color: rgba(95, 211, 154, 0.4); }
.q-mid { color: var(--amber); border-color: var(--amber-dim); }
.prose p { color: #c6cddb; line-height: 1.6; }
.prose h2 { font-size: 15px; margin: 22px 0 6px; color: var(--text); }

@media (max-width: 900px) {
    body.live { height: auto; overflow: auto; }
    .live-main { height: auto; }
    .globe { position: relative; height: 62vh; }
    .hud { position: static; width: auto; padding: 12px 12px 0; }
    .hud-right { bottom: auto; }
    .hud-bottom { flex-direction: column; align-items: stretch; padding-bottom: 12px; overflow: hidden; }
    .ticker { max-width: 100%; margin: 0; }
    .live-main, body.live { overflow-x: hidden; }
    .live .maplibregl-ctrl-top-right { right: 0; top: 0; }
    .powered-top { padding: 4px 8px 4px 4px; font-size: 12.5px; }
    .powered-top span { display: none; }
    .station-grid { grid-template-columns: 1fr; }
    /* Two rows: brand, the APRS Connect pill and the status light; then the nav. Nothing
       may push the header past the viewport, so everything can shrink and the row wraps. */
    .top { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
    .brand { font-size: 14px; min-width: 0; }
    .brand span { white-space: nowrap; }
    .nav { order: 3; flex-basis: 100%; gap: 0; margin: 0 -6px; }
    .nav a { padding: 5px 8px; font-size: 13px; }
    .powered-top { margin-left: auto; flex-shrink: 0; }
    .status { flex-shrink: 0; }
    .status .label { display: none; }
    .page { width: calc(100% - 24px); padding-top: 18px; }
    .card { padding: 12px; }
    td, th { padding: 6px 5px; }
    .passes th:last-child, .passes td:last-child { display: none; }
    .passes td { font-size: 13px; }
}
