:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #fcfcfb;
  --line: #dddcd6;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6b6a66;
  --brand: #0f3b5f;
  --brand-ink: #ffffff;
  --link: #1c5cab;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --warning-ink: #7a4f00;
  --critical: #d03b3b;
  --critical-ink: #a32626;
  --unknown: #8e8d88;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e6e5e0;
  --ref: #8e8d88;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --line: #2f2f2c;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a09f98;
    --brand: #0d2e4a;
    --link: #86b6ef;
    --good-ink: #5fd35f;
    --warning-ink: #fab219;
    --critical-ink: #ff8a8a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #2a2a27;
    --ref: #77766f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --line: #2f2f2c; --text: #f0efec; --text-2: #c3c2b7; --muted: #a09f98;
  --brand: #0d2e4a; --link: #86b6ef; --good-ink: #5fd35f; --warning-ink: #fab219; --critical-ink: #ff8a8a;
  --series-1: #3987e5; --series-2: #d95926; --grid: #2a2a27; --ref: #77766f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header { background: var(--brand); color: var(--brand-ink); padding: 20px 0 18px; margin-bottom: 20px; }
.site-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.site-header h1 a { color: inherit; text-decoration: none; }
.tagline { margin: 4px 0 0; opacity: .85; font-size: .95rem; }

.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--warning); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); }

.hero { display: flex; gap: 16px; align-items: center; border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  border: 1px solid var(--line); background: var(--surface); border-left: 10px solid var(--unknown); }
.hero h2 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.hero-sub { margin: 4px 0 0; color: var(--text-2); }
.hero-ico { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; font-size: 1.6rem; font-weight: 700; color: #fff; background: var(--unknown); }
.hero[data-state="open"] { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 7%, var(--surface)); }
.hero[data-state="open"] .hero-ico { background: var(--good); }
.hero[data-state="restricted"] { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.hero[data-state="restricted"] .hero-ico { background: var(--warning); color: #3a2600; }
.hero[data-state="closed"] { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 9%, var(--surface)); }
.hero[data-state="closed"] .hero-ico { background: var(--critical); }

.board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 12px; }
.row { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 1fr; gap: 8px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row-name h3 { margin: 0; font-size: 1.05rem; }
.row-name span { font-size: .8rem; color: var(--muted); }
.cell { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 4px solid var(--unknown); }
.cell[data-state="open"] { border-left-color: var(--good); }
.cell[data-state="restricted"] { border-left-color: var(--warning); }
.cell[data-state="closed"] { border-left-color: var(--critical); }
.cell-dir { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.cell small { font-size: .75rem; color: var(--muted); }
.row-detail { grid-column: 1 / -1; }
.checked { margin: 10px 0 0; font-size: .8rem; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin: 24px 0 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] { flex: none; font: inherit; font-weight: 600; color: var(--text-2); background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 14px; cursor: pointer; margin-bottom: -1px; }
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--brand-strong, var(--link)); border-bottom-color: currentColor; }
.tabs [role="tab"]:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: .75rem; background: var(--warning); color: #3a2600; margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.pill .ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: .8rem; line-height: 1; }
.pill.open { color: var(--good-ink); } .pill.open .ico { background: var(--good); }
.pill.restricted { color: var(--warning-ink); } .pill.restricted .ico { background: var(--warning); color: #3a2600; }
.pill.closed { color: var(--critical-ink); } .pill.closed .ico { background: var(--critical); }
.pill.unknown { color: var(--muted); } .pill.unknown .ico { background: var(--unknown); }
.detail { margin: 0; font-size: .9rem; color: var(--text-2); white-space: pre-line; }

.panel { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 16px; }
.panel h2.spaced { margin-top: 24px; }

.wind-summary { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 12px; }
.wind-summary .stat b { display: block; font-size: 1.5rem; line-height: 1.1; }
.wind-summary .stat span { font-size: .8rem; color: var(--muted); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .ref { stroke: var(--ref); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .ref-label { fill: var(--text-2); font-size: 11px; }
.chart .now { stroke: var(--text-2); stroke-width: 1; }
.chart .gust { stroke: var(--series-1); }
.chart .mean { stroke: var(--series-2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .past { opacity: .4; }
.chart .cross { stroke: var(--text-2); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--text-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .8rem; box-shadow: 0 4px 14px rgb(0 0 0 / .12); white-space: nowrap; }
.tip b { color: var(--text); }
.tip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.table-view { margin-top: 10px; font-size: .875rem; }
.table-view summary { cursor: pointer; color: var(--link); }
.table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.closure { border-top: 1px solid var(--line); padding: 10px 0; }
.closure:first-child { border-top: 0; padding-top: 0; }
.closure h3 { margin: 0; font-size: 1rem; }
.closure p { margin: 4px 0 0; }
.closure details { margin-top: 6px; font-size: .875rem; white-space: pre-line; }

.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.hist li:first-child { border-top: 0; }
.hist .when { font-size: .85rem; color: var(--muted); grid-column: 2; }
.hist .what { grid-column: 2; }
.hist .pill { grid-row: span 2; align-self: start; }

.notice { border-top: 1px solid var(--line); padding: 8px 0; }
.notice:first-child { border-top: 0; }
.notice summary { cursor: pointer; font-weight: 600; }
.notice div { white-space: pre-line; font-size: .9rem; color: var(--text-2); margin-top: 6px; }

.links { padding-left: 20px; margin: 8px 0 0; }
.links li { margin: 4px 0; }
.rules td:first-child { white-space: nowrap; font-weight: 600; }

.site-footer { margin-top: 32px; padding: 20px 0 32px; border-top: 1px solid var(--line); }
.site-footer p { margin: 0 0 8px; }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr 1fr; align-items: start; }
  .row-name { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.35rem; }
  .hero { padding: 16px; gap: 12px; }
  .hero h2 { font-size: 1.3rem; }
  .hero-ico { width: 42px; height: 42px; font-size: 1.3rem; }
  .tabs [role="tab"] { padding: 10px 10px; }
}
[hidden] { display: none !important; }
@media (max-width: 480px) {
  .tabs { gap: 0; }
  .tabs [role="tab"] { flex: 1 1 auto; padding: 10px 6px; font-size: .9rem; }
  .cell-dir .long { display: none; }
}
.row-name, .cell { min-width: 0; overflow-wrap: anywhere; }
.cell .pill { white-space: normal; align-items: flex-start; }
.cell .pill .ico { flex: none; }

/* traffic */
.cell-traffic { color: var(--text-2) !important; font-weight: 600; }
.tr-bridge + .tr-bridge { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tr-bridge h3 { margin: 0 0 8px; font-size: 1.05rem; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.tr-dir .cell-dir { margin-bottom: 2px; }
.tr-speed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 4px; }
.tr-mph { display: inline-block; padding: 2px 12px; border-radius: 10px; font-size: 1.9rem; line-height: 1.2; color: #fff; background: var(--unknown); }
.tr-mph small { font-size: .5em; font-weight: 600; }
.tr-mph[data-speed="fast"] { background: var(--good); }
.tr-mph[data-speed="mid"] { background: var(--warning); color: #3a2600; }
.tr-mph[data-speed="slow"] { background: var(--critical); }
.tr-level { display: inline-block; padding: 4px 12px; border-radius: 10px; font-size: 1.15rem; font-weight: 700; border: 2px solid var(--line); color: var(--text-2); }
.tr-level[data-level="free-flowing"] { border-color: var(--good); color: var(--good-ink); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.tr-level[data-level="busy"] { border-color: var(--warning); color: var(--warning-ink); background: color-mix(in srgb, var(--warning) 16%, var(--surface)); }
.tr-level[data-level="heavy"], .tr-level[data-level="queuing"], .tr-level[data-level="closed"] { border-color: var(--critical); color: var(--critical-ink); background: color-mix(in srgb, var(--critical) 12%, var(--surface)); }
.tr-typical { margin-top: 8px; }
.strip { display: flex; align-items: flex-end; gap: 2px; height: 36px; margin-top: 6px; }
.strip span { flex: 1; background: color-mix(in srgb, var(--series-1) 45%, var(--surface)); border-radius: 2px 2px 0 0; min-height: 2px; }
.strip span.now { background: var(--series-1); }
.strip-axis { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }
h3.sub { margin: 22px 0 6px; font-size: 1rem; }
.mini-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; }
.mini-title { font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
@media (max-width: 480px) {
  .tabs [role="tab"] { padding: 10px 4px; font-size: .82rem; }
}
@media (max-width: 380px) {
  .tabs [role="tab"] { padding: 10px 3px; font-size: .78rem; }
}
.tmap { margin: 0 0 18px; }
.tmap img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.tmap figcaption { margin-top: 6px; }

/* wide screens: use the full width (with a margin) and put traffic details beside the map */
@media (min-width: 1000px) {
  .wrap { max-width: 1800px; padding: 0 32px; }
  .tr-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 24px; align-items: start; }
  .tr-layout .tmap { margin: 0; }
  .tr-side h3.sub:first-of-type { margin-top: 18px; }
}
@media (min-width: 1000px) {
  .tr-side .tr-grid, .tr-side .mini-charts { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}
@media (min-width: 1000px) and (max-width: 1399px) {
  .tr-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
