/* TAF Traker - shared chrome.
   Dark-only by design: it's a weather-radar style tool read against a dark
   map, and the standard flight-category colors (validated with the dataviz
   palette checker on --surface-0) are tuned for a dark surface. */

:root {
  color-scheme: dark;

  --bg:          #090b0d;
  --surface-0:   #0d1013;
  --surface-1:   #111418;
  --surface-2:   #171b20;
  --surface-3:   #1f242b;
  --glass:       rgba(13, 16, 19, 0.94);
  --border:      #1c2128;
  --border-2:    #2a3039;

  --text-1:      #f2f4f7;
  --text-2:      #b4bac4;
  --text-3:      #7d8590;
  --grid:        #22262d;
  --baseline:    #343a43;

  --accent:      #5cc8ff;
  --accent-dim:  rgba(92, 200, 255, 0.14);

  /* Flight categories (standard aviation hues, stepped for the dark band) */
  --lifr: #d33fd6;
  --ifr:  #e5484d;
  --mvfr: #3b8cf0;
  --vfr:  #1f9e43;
  --nodata: #5b626c;

  /* Severity of actual-vs-forecast (status hues; always shipped with a label) */
  --sev-bust:     #ff4d6d;
  --sev-miss:     #ff8a3d;
  --sev-tempo:    #b9a7ff;
  --sev-degraded: #fab219;
  --sev-better:   #4fd1c5;

  --radius: 6px;
  --radius-sm: 4px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text-1); font-family: var(--font); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 52px; display: flex; align-items: stretch; gap: 22px;
  padding: 0 18px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar > * { align-self: center; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-1); white-space: nowrap; font-family: var(--mono); font-weight: 600; font-size: 14.5px; letter-spacing: 0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; border-radius: 4px; }
.brand small { font-family: var(--font); font-weight: 500; color: var(--text-3); font-size: 11px; letter-spacing: 0.04em; margin-left: 2px;
  border: 1px solid var(--border-2); border-radius: 3px; padding: 0 5px; line-height: 16px; }
.nav { display: flex; gap: 2px; align-self: stretch; }
.nav a { display: flex; align-items: center; color: var(--text-3); padding: 0 12px; font-weight: 500; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--text-1); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text-1); border-bottom-color: var(--accent); }
.topbar .spacer { flex: 1; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.clock b { color: var(--text-1); font-weight: 600; }

/* Search */
.search { position: relative; width: 260px; }
.search input {
  width: 100%; height: 32px; padding: 0 10px 0 30px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-1);
  font: inherit; font-size: 13px; outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface-1); }
.search svg { position: absolute; left: 9px; top: 8px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.search-results {
  position: absolute; top: 36px; left: 0; right: 0; max-height: 320px; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: var(--shadow); padding: 4px; display: none; z-index: 60;
}
.search-results.open { display: block; }
.search-results button {
  display: flex; gap: 10px; width: 100%; text-align: left; padding: 7px 9px; border: 0;
  background: none; border-radius: 6px; cursor: pointer; align-items: baseline;
}
.search-results button:hover, .search-results button.active { background: var(--surface-3); }
.search-results .code { font-family: var(--mono); font-weight: 700; width: 44px; flex: none; }
.search-results .name { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Pills & badges ---------- */
.cat-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 20px;
  padding: 0 6px; border-radius: 3px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: #fff;
}
.cat-0 { background: var(--lifr); } .cat-1 { background: var(--ifr); }
.cat-2 { background: var(--mvfr); } .cat-3 { background: var(--vfr); }
.cat-x { background: var(--nodata); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.sev {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 3px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.sev svg { width: 11px; height: 11px; }
.sev-4 { color: #ffe1e6; background: rgba(255, 77, 109, 0.22); border-color: rgba(255, 77, 109, 0.7); }
.sev-3 { color: #ffe3cf; background: rgba(255, 138, 61, 0.2); border-color: rgba(255, 138, 61, 0.65); }
.sev-2 { color: #e4dcff; background: rgba(185, 167, 255, 0.16); border-color: rgba(185, 167, 255, 0.5); }
.sev-1 { color: #ffefc7; background: rgba(250, 178, 25, 0.15); border-color: rgba(250, 178, 25, 0.55); }
.sev-0 { color: var(--text-2); background: var(--surface-3); }
.sev-better { color: #d4fffb; background: rgba(79, 209, 197, 0.14); border-color: rgba(79, 209, 197, 0.5); }

.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.trend-down { color: #ff9d7a; }
.trend-up { color: #6fe0c8; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.card h2 { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.card .sub { font-size: 12px; color: var(--text-3); margin: 0 0 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-0); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 3px; font-size: 12.5px; font-weight: 500; color: var(--text-3); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text-1); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--border-2); }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); flex: none;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text-1); background: var(--surface-3); }
.icon-btn svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-1); font-size: 12.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-accent { background: var(--accent-dim); border-color: rgba(92, 200, 255, 0.45); color: #d8f2ff; }
input[type="date"], input[type="datetime-local"], select {
  height: 30px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-1); font: inherit; font-size: 12.5px; color-scheme: dark;
}

/* Tooltip (charts) */
.tip {
  position: fixed; z-index: 160; pointer-events: none; min-width: 160px; max-width: 400px;
  background: rgba(14, 17, 21, 0.98); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 9px 11px; font-size: 12px; opacity: 0; transition: opacity 0.08s;
}
.tip.on { opacity: 1; }
.tip .t-head { font-weight: 700; margin-bottom: 4px; color: var(--text-1); }
.tip .t-row { display: flex; align-items: center; gap: 7px; color: var(--text-2); margin-top: 2px; }
.tip .t-row b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.tip .t-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip .t-lab { width: 86px; flex: none; }
.tip .t-row .cat-pill { flex: none; }
.tip .t-sub { margin: 1px 0 3px 112px; font-family: var(--mono); font-size: 11px; color: var(--text-2); overflow-wrap: anywhere; }
.tip .t-raw { margin: 2px 0 4px 112px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); overflow-wrap: anywhere; line-height: 1.4; }

/* Empty / loading */
.empty { color: var(--text-3); font-size: 13px; padding: 28px 8px; text-align: center; }
.loading { opacity: 0.55; transition: opacity 0.2s; }

.footer { color: var(--text-3); font-size: 11.5px; padding: 18px 16px 28px; text-align: center; line-height: 1.7; }
.footer a { color: var(--text-2); text-decoration: underline; }

/* One-time experimental-product notice */
.notice { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 7, 10, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.notice-card { max-width: 480px; background: var(--surface-1); border: 1px solid rgba(255, 138, 61, 0.55);
  border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.notice-card h2 { margin: 0 0 10px; font-size: 17px; color: #ffe3cf; }
.notice-card p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.notice-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.notice-actions a, .notice-links { font-size: 13px; color: var(--text-3); }

@media (max-width: 860px) {
  .search { width: 160px; }
  .clock { display: none; }
  .brand small { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .search { display: none; }
  .nav a { padding: 6px 8px; }
}
