/* nixfred air · ATL — brand: #070909 ground, mint #7ff9bc glow, teal #085f6c, Kanit.
   Law 17: the page never scrolls. Only the flight list scrolls, in place. */
@font-face { font-family: Kanit; font-weight: 300; font-display: swap; src: url(/fonts/kanit-300.woff2) format("woff2"); }
@font-face { font-family: Kanit; font-weight: 400; font-display: swap; src: url(/fonts/kanit-400.woff2) format("woff2"); }
@font-face { font-family: Kanit; font-weight: 500; font-display: swap; src: url(/fonts/kanit-500.woff2) format("woff2"); }
@font-face { font-family: Kanit; font-weight: 700; font-display: swap; src: url(/fonts/kanit-700.woff2) format("woff2"); }
@font-face { font-family: Kanit; font-weight: 900; font-display: swap; src: url(/fonts/kanit-900.woff2) format("woff2"); }

:root {
  --bg: #070909; --panel: #0c1112; --panel2: #101819; --line: #1a2528; --line2: #24353a;
  --text: #d7e2ea; --mute: #8fa3b5; --dim: #566a77;
  --mint: #7ff9bc; --teal: #085f6c; --amber: #ffd23f; --sky: #8fb4ff; --red: #ff5d6c; --ground: #cfe3ea;
  --glow: 0 0 14px rgba(127, 249, 188, .28);
  --mast: 52px; --foot: 26px; --board: 340px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body {
  display: grid; grid-template-rows: var(--mast) minmax(0, 1fr) var(--foot); height: 100dvh;
  font: 400 14px/1.35 Kanit, system-ui, sans-serif; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--mint); text-decoration: none; } a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.muted { color: var(--mute); }
.only-mobile { display: none; }

/* ---------- masthead ---------- */
.mast { display: flex; align-items: center; gap: 14px; padding: 0 14px; background: linear-gradient(#0b1112, #080c0d); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 900; font-size: 20px; letter-spacing: -.01em; }
.brand i { font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #04120b; background: var(--mint); border-radius: 3px; padding: 1px 6px 0; box-shadow: var(--glow); }
.apt { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line2); }
.icao { font-weight: 700; letter-spacing: .08em; color: var(--mint); }
.aptname { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; flex: none; }
.seg button { background: transparent; border: 0; padding: 5px 13px; font-weight: 500; font-size: 13px; color: var(--mute); }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button.on { color: #04120b; background: var(--mint); box-shadow: var(--glow); font-weight: 700; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg button:not(.on):not(:disabled):hover { color: var(--text); background: var(--panel2); }
body[data-mode="radar"] .cams { display: none; }
.mast-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.feed { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 12px 4px 10px; font-size: 12.5px; color: var(--text); max-width: 340px; white-space: nowrap; }
.feed span { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot.sm { width: 6px; height: 6px; }
[data-feed="live"] .dot { background: var(--mint); box-shadow: 0 0 8px var(--mint); animation: beat 2s infinite; }
[data-feed="stale"] .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
[data-feed="down"] .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes beat { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.clock { display: flex; align-items: baseline; gap: 5px; }
.clock strong { font-size: 17px; font-weight: 500; letter-spacing: .02em; }
.clock small { color: var(--mute); font-size: 11px; letter-spacing: .1em; }
.icon { display: inline-grid; place-items: center; width: 34px; height: 34px; background: transparent; border: 1px solid var(--line2); border-radius: 8px; color: var(--mute); }
.icon:hover { color: var(--mint); border-color: var(--mint); }

/* ---------- layout ---------- */
main { display: grid; grid-template-columns: var(--board) minmax(0, 1fr); min-height: 0; position: relative; }
.board { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); z-index: 6; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #050707; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage canvas[hidden] { display: none; }
/* faint scanlines: texture that also hides banding in the sky gradient */
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(127, 249, 188, .022) 0 1px, transparent 1px 3px); mix-blend-mode: screen; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
body[data-mode="radar"] #labels { display: none; }
.only-radar { display: none; }
body[data-mode="radar"] .only-radar { display: flex; }

.foot { display: flex; align-items: center; gap: 14px; padding: 0 14px; font-size: 11.5px; color: var(--dim); background: #080b0c; border-top: 1px solid var(--line); min-width: 0; }
.foot-l { display: inline-flex; align-items: center; gap: 7px; min-width: 0; flex: 0 1 auto; overflow: hidden; white-space: nowrap; }
.foot-l span { overflow: hidden; text-overflow: ellipsis; }
.foot-m { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.foot a, .link { white-space: nowrap; color: var(--mute); background: none; border: 0; padding: 0; font-size: 11.5px; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.foot a:hover, .link:hover { color: var(--mint); }

/* ---------- board ---------- */
.station { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 500; letter-spacing: .14em; color: var(--mute); }
.eyebrow b { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: var(--glow); flex: none; }
.eyebrow span { margin-left: auto; color: var(--dim); }
.flow { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-height: 40px; }
.flow svg { flex: none; border: 1px solid var(--line); border-radius: 6px; background: #080c0d; }
.flow .txt { min-width: 0; line-height: 1.2; }
.flow .txt strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: .02em; color: var(--mint); }
.flow .txt small { color: var(--mute); font-size: 11.5px; }

.wx { display: grid; grid-template-columns: 72px 1fr; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.wx .gauge { grid-row: span 2; }
.wx .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; }
.wx .m { line-height: 1.15; }
.wx .m small { display: block; font-size: 9.5px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; }
.wx .m b { font-weight: 500; font-size: 14px; white-space: nowrap; }
.wx .cat { justify-self: start; font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 1px 9px; border-radius: 999px; border: 1px solid currentColor; }
.wx .raw { grid-column: 1 / -1; font: 400 10px/1.3 ui-monospace, "JetBrains Mono", monospace; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }

.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.counts .c { text-align: center; padding: 4px 0 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); cursor: pointer; }
.counts .c:hover { border-color: var(--line2); }
.counts .c strong { display: block; font-size: 19px; font-weight: 700; line-height: 1.05; }
.counts .c small { font-size: 9.5px; letter-spacing: .14em; color: var(--mute); }
.counts .c.arr strong { color: var(--mint); } .counts .c.dep strong { color: var(--amber); } .counts .c.gnd strong { color: var(--ground); } .counts .c.near strong { color: var(--sky); }

.list { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; }
.tabs button { flex: 1; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 5px 0 6px; font-size: 12.5px; font-weight: 500; color: var(--mute); }
.tabs button.on { color: var(--mint); border-bottom-color: var(--mint); }
.tabs button:not(.on):hover { color: var(--text); }
.search { display: flex; align-items: center; gap: 8px; margin: 8px 12px 4px; padding: 0 9px; height: 32px; background: #080c0d; border: 1px solid var(--line2); border-radius: 7px; color: var(--mute); }
.search:focus-within { border-color: var(--mint); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 13px; }
.search input::placeholder { color: var(--dim); }
.search kbd { font: 500 10px Kanit, sans-serif; color: var(--dim); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; }
.listhead { display: flex; justify-content: space-between; padding: 4px 14px 3px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.empty { padding: 22px 16px; text-align: center; color: var(--dim); margin: 0; }
.row { display: grid; grid-template-columns: 3px 1fr auto; gap: 0 10px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #0f1517; padding: 7px 14px 7px 0; }
.row:hover { background: var(--panel2); }
.row.sel { background: rgba(127, 249, 188, .08); }
.row .bar { grid-row: span 2; background: var(--c, var(--sky)); border-radius: 0 2px 2px 0; opacity: .9; }
.row .l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row .call { font-weight: 700; font-size: 14.5px; letter-spacing: .01em; }
.row .ty { font-size: 11px; color: var(--mute); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; line-height: 1.35; }
.row .r1 { text-align: right; font-weight: 500; font-size: 13px; white-space: nowrap; }
.row .l2 { grid-column: 2 / 4; color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.emg .call { color: var(--red); }

/* ---------- stage overlays ---------- */
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; pointer-events: none; z-index: 2; }
.chip { background: rgba(8, 12, 13, .78); border: 1px solid var(--line2); border-radius: 999px; padding: 3px 12px; font-size: 12px; color: var(--mute); backdrop-filter: blur(6px); }
.legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; padding: 5px 12px; background: rgba(8, 12, 13, .78); border: 1px solid var(--line2); border-radius: 8px; font-size: 11.5px; color: var(--mute); z-index: 2; backdrop-filter: blur(6px); }
body[data-mode="radar"] .legend { bottom: 38px; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.k.arr { --c: var(--mint); } .k.dep { --c: var(--amber); } .k.near { --c: var(--sky); } .k.gnd { --c: var(--ground); }
.zoom { position: absolute; right: 12px; bottom: 12px; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button { width: 36px; height: 36px; background: rgba(8, 12, 13, .85); border: 1px solid var(--line2); border-radius: 8px; font-size: 18px; color: var(--text); }
.zoom button:hover { border-color: var(--mint); color: var(--mint); }
#notice { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); max-width: min(560px, 92%); padding: 8px 16px; border-radius: 8px; background: rgba(40, 10, 14, .92); border: 1px solid var(--red); color: #ffd5d9; font-size: 13px; z-index: 5; text-align: center; }
#notice[hidden] { display: none; }
#notice.info { background: rgba(8, 40, 30, .92); border-color: var(--mint); color: #d6fff0; }

.tag { position: absolute; left: 0; top: 0; padding: 1px 6px 2px; font-size: 11px; font-weight: 600; line-height: 1.25; background: rgba(7, 9, 9, .7); border-left: 2px solid var(--c, var(--sky)); color: var(--text); white-space: nowrap; will-change: transform; }
.tag small { display: block; font-weight: 400; font-size: 10px; color: var(--mute); }
.tag.sel { background: rgba(7, 9, 9, .94); color: #fff; }

/* selected aircraft card */
.card { position: absolute; right: 12px; top: 12px; width: 304px; background: rgba(9, 13, 14, .92); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; z-index: 4; backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(127, 249, 188, .05); }
.card::before, .card::after { content: ""; position: absolute; width: 12px; height: 12px; border: 2px solid var(--c, var(--mint)); pointer-events: none; }
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.card[hidden] { display: none; }
.card .top { display: flex; align-items: flex-start; gap: 8px; }
.card h3 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .01em; line-height: 1.05; }
.card .sub { color: var(--mute); font-size: 12.5px; }
.card .x { margin-left: auto; width: 26px; height: 26px; border-radius: 6px; background: transparent; border: 1px solid var(--line2); color: var(--mute); line-height: 1; }
.card .chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.card .pill { font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); }
.card .pill.plain { color: var(--mute); border-color: var(--line2); font-weight: 500; letter-spacing: .02em; }
.card .g { display: grid; grid-template-columns: 1fr 78px; gap: 10px; align-items: center; }
.card .nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.card .nums div small { display: block; font-size: 9.5px; letter-spacing: .13em; color: var(--dim); text-transform: uppercase; }
.card .nums div b { font-weight: 500; font-size: 15px; white-space: nowrap; }
.card .alt { margin-top: 10px; height: 6px; border-radius: 3px; background: #0a1011; border: 1px solid var(--line); overflow: hidden; }
.card .alt i { display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--teal), var(--c)); box-shadow: 0 0 10px var(--c); transition: width .3s linear; }
.card .alt-l { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--dim); letter-spacing: .08em; margin-top: 2px; }
.card .ext { display: block; margin-top: 9px; font-size: 12px; color: var(--mute); }

/* help dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 0; width: min(680px, 94vw); max-height: min(86vh, 720px); box-shadow: 0 30px 90px rgba(0, 0, 0, .7); }
dialog::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; }
dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog h2 { margin: 0; font-size: 18px; font-weight: 700; }
.help-body { overflow-y: auto; padding: 14px 18px 18px; font-size: 13.5px; color: var(--mute); }
.help-body h3 { margin: 16px 0 6px; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--mint); }
.help-body h3:first-child { margin-top: 0; }
.help-body p { margin: 0 0 8px; }
.help-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; }
.help-body dt { color: var(--text); font-weight: 500; }
.help-body dd { margin: 0; }
.help-body ul { margin: 0; padding-left: 18px; }
.help-body li { margin: 2px 0; }
.help-body code { color: var(--text); }

/* ---------- compact heights: keep the whole board on one screen ---------- */
@media (max-height: 800px) {
  .wx .raw { display: none; }
  .flow { min-height: 34px; margin-top: 5px; }
  .station { padding-top: 8px; }
  .counts .c strong { font-size: 17px; }
}
@media (max-height: 640px) {
  .flow svg { display: none; }
  .wx { grid-template-columns: 56px 1fr; padding: 6px 14px; }
}

/* ---------- narrow: board becomes a drawer ---------- */
@media (max-width: 920px) {
  .aptname, .brand i, .feed span { display: none; }
  .feed { padding: 6px; }
  .only-mobile { display: inline-grid; }
  main { grid-template-columns: minmax(0, 1fr); }
  .board { position: absolute; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .7); }
  body.board-open .board { transform: none; }
  .mast { gap: 8px; padding: 0 8px; }
  .apt { padding-left: 8px; }
  .clock small { display: none; }
  .card { right: 8px; left: 8px; top: auto; bottom: 8px; width: auto; }
  .legend { display: none; }
  .zoom { bottom: auto; top: 12px; }
  body[data-mode="radar"] .legend { display: none; }
  .hud-top { right: 56px; }
  .foot-m { display: none; }
  .foot { justify-content: space-between; }
}
@media (max-width: 760px) {
  /* the camera selector no longer fits in the masthead: float it over the stage */
  .cams { position: fixed; top: calc(var(--mast) + 8px); left: 8px; z-index: 8; background: rgba(8, 12, 13, .88); backdrop-filter: blur(6px); }
  .hud-top { display: none; }
}
@media (max-width: 520px) {
  .cams button { padding: 5px 8px; }
  .seg button { padding: 5px 9px; font-size: 12px; }
  .clock { display: none; }
  .brand b { font-size: 17px; }
}
@media (max-width: 400px) {
  /* 320-375 px phones: the masthead was ~20 px short, so the flexible .apt box shrank below its own
     text and "KATL" painted under the 3D toggle. Reclaim the width and stop .apt shrinking. */
  .mast { gap: 6px; padding: 0 6px; }
  .brand { gap: 6px; }
  .brand img { width: 28px; height: 28px; }
  .apt { flex: none; padding-left: 6px; }
  .seg button { padding: 5px 7px; }
}
@media (max-width: 340px) { .brand b { display: none; } } /* 320 px: the logo carries the brand */
@media (prefers-reduced-motion: reduce) {
  .dot, .card .alt i { animation: none; transition: none; }
  .stage::after { display: none; }
}
