/* 301Live: dark, quiet, fits the Cumberland Wireframe look. Palette from the wireframe's style/theme.json. */
:root {
  --bg: #000000;
  --panel: rgba(12, 14, 18, 0.72);
  --panel-solid: rgba(12, 14, 18, 0.96);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #c9cdd4;
  --dim: #7d838c;
  --bright: #eef0f3;
  --accent: #7fd4ff;
  --warn: #ffb547;
  --ok: #4ade80;
  --bad: #ff6b5c;
  --yellow: #ffe066;
  --radius: 10px;
  --font: Inter, "Inter var", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --top-h: 56px;
  --bottom-h: 62px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2, h3 { color: var(--bright); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1rem; }
h2 small { color: var(--dim); font-weight: 400; font-size: 0.8rem; margin-left: 4px; }
.dim { color: var(--dim); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--panel-solid); padding: 8px 12px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--bright); text-decoration: none !important; min-width: 0; }
.logo { display: block; height: 42px; width: auto; flex: none; overflow: visible; } /* logo A "On-Air Bug" (inline SVG from tools/make-logos.mjs) */
@media (max-width: 420px) { .logo { height: 38px; } }
.tag { color: var(--dim); font-size: 0.82rem; white-space: nowrap; }
@media (max-width: 420px) { .tag { display: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tabs { display: none; gap: 4px; margin-left: auto; }
.tabs .tab { padding: 6px 12px; border-radius: 8px; color: var(--text); font-size: 0.9rem; }
.tabs .tab[aria-current="page"] { background: rgba(127, 212, 255, 0.12); color: var(--accent); }
.tabs .tab:hover { text-decoration: none; background: rgba(255, 255, 255, 0.05); }
/* status chip: freshness + countdown to the next refresh (tap = refresh now) */
.net { --st: var(--accent); margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; min-height: 30px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--st) 35%, transparent); background: color-mix(in srgb, var(--st) 8%, transparent);
  color: var(--text); font: inherit; font-size: 0.76rem; white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums; max-width: 62vw; }
.net:hover { background: color-mix(in srgb, var(--st) 14%, transparent); }
.net .net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); box-shadow: 0 0 8px var(--st); flex: none; }
.net .net-text { color: var(--bright); overflow: hidden; text-overflow: ellipsis; }
.net .net-count { color: var(--dim); }
.net .net-count:empty { display: none; }
.net[data-level="live"] .net-dot { animation: net-pulse 2.4s ease-in-out infinite; }
.net[data-level="loading"] { --st: var(--dim); }
.net[data-level="partial"], .net[data-level="stale"] { --st: var(--warn); }
.net[data-level="partial"] .net-text, .net[data-level="stale"] .net-text { color: var(--warn); }
.net[data-level="offline"] { --st: var(--bad); }
.net[data-level="offline"] .net-text { color: var(--bad); }
@keyframes net-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .net[data-level="live"] .net-dot { animation: none; } }
@media (max-width: 420px) { .net .net-count { display: none; } .net[data-level="live"] .net-count:not(:empty) { display: inline; } }

/* ---------- bottom bar (phones) ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.bottombar .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 0.74rem; text-decoration: none !important; }
.bottombar svg { width: 22px; height: 22px; fill: currentColor; }
.bottombar .tab[aria-current="page"] { color: var(--accent); }

main { padding: 12px 12px calc(var(--bottom-h) + 20px + env(safe-area-inset-bottom)); max-width: 1240px; margin: 0 auto; }

.unofficial-strip { margin: 0 0 12px; font-size: 0.8rem; color: var(--dim); text-align: center; }
.unofficial-strip strong { color: var(--text); font-weight: 600; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; min-width: 0;
}
.card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.meta { font-size: 0.74rem; color: var(--dim); white-space: nowrap; }
.meta.stale { color: var(--warn); }
.meta.unavailable { color: var(--bad); }
.fresh-badge { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #000; background: var(--warn); vertical-align: 1px; }
.fresh-badge.bad { background: var(--bad); }
/* stale / unavailable cards: colored edge + tint so it can't be missed */
.card.is-stale { border-color: rgba(255, 181, 71, 0.5); box-shadow: inset 3px 0 0 var(--warn); background: linear-gradient(rgba(255, 181, 71, 0.05), transparent 60px), var(--panel); }
.card.is-unavailable { border-color: rgba(255, 107, 92, 0.5); box-shadow: inset 3px 0 0 var(--bad); background: linear-gradient(rgba(255, 107, 92, 0.06), transparent 60px), var(--panel); }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--bright); font-size: 0.8rem; text-align: center; }
.skeleton { height: 64px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.empty { color: var(--dim); font-size: 0.9rem; margin: 0; }
.empty.warn { color: var(--warn); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; border: 1px solid var(--border-strong); color: var(--text); white-space: nowrap; }
.soon { border-style: dashed; border-color: var(--border-strong); background: rgba(12, 14, 18, 0.4); }
.soon-pill { color: var(--accent); border-color: rgba(127, 212, 255, 0.35); }
.soon p { margin: 0; font-size: 0.88rem; }

/* level colors */
.lv-clear { --lv: var(--ok); }
.lv-advisory { --lv: var(--accent); }
.lv-weather { --lv: var(--yellow); }
.lv-incident { --lv: var(--warn); }
.lv-closure { --lv: var(--bad); }
.lv-unknown { --lv: var(--dim); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lv, var(--dim)); flex: none; box-shadow: 0 0 10px var(--lv, transparent); }

/* corridors */
.corridors { display: grid; grid-template-columns: 1fr; gap: 10px; }
.corridor { border: 1px solid var(--border); border-left: 3px solid var(--lv); border-radius: 8px; padding: 10px 12px; background: rgba(0, 0, 0, 0.35); }
.corridor .row1 { display: flex; align-items: center; gap: 10px; }
.corridor .route { font-weight: 700; color: var(--bright); font-size: 1.05rem; }
.corridor .state { color: var(--lv); font-weight: 600; font-size: 0.9rem; }
.corridor ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.84rem; }
.corridor li { margin: 2px 0; }
.corridor .sub { font-size: 0.78rem; color: var(--dim); margin-top: 4px; }

/* event list */
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(0, 0, 0, 0.35); }
.event .dot { margin-top: 6px; }
.event .title { color: var(--bright); font-size: 0.9rem; overflow-wrap: anywhere; }
.event .info { grid-column: 2; font-size: 0.78rem; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.event .lanes { grid-column: 2; font-size: 0.82rem; color: var(--text); }
.event button.linkish { grid-column: 2; justify-self: start; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 0.8rem; cursor: pointer; }

/* weather */
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-temp { font-family: "Oxanium", var(--font); font-size: 2.6rem; font-weight: 700; color: var(--bright); line-height: 1; letter-spacing: -0.02em; text-shadow: 0 0 18px rgba(127, 212, 255, 0.25); }
.wx-now .desc { color: var(--bright); }
.wx-now .small { font-size: 0.8rem; color: var(--dim); }
.periods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.period { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: rgba(0, 0, 0, 0.35); font-size: 0.8rem; }
.period .pn { color: var(--dim); font-size: 0.72rem; }
.period .pt { color: var(--bright); font-size: 1.05rem; font-weight: 600; }
.period .ps { color: var(--text); }

/* alerts: deliberately calm (not an emergency system) */
.alert { border: 1px solid rgba(255, 181, 71, 0.35); border-radius: 8px; padding: 10px; background: rgba(255, 181, 71, 0.06); margin-bottom: 8px; }
.alert .ev { color: var(--warn); font-weight: 600; }
.alert .hl { font-size: 0.84rem; margin: 4px 0; }
.alert .small { font-size: 0.76rem; color: var(--dim); }
.alert details { font-size: 0.82rem; margin-top: 6px; }
.alert details p { white-space: pre-line; }

/* rwis table */
.rwis { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.rwis th { text-align: left; font-weight: 500; color: var(--dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 8px 6px 0; }
.rwis td { padding: 7px 8px 7px 0; border-top: 1px solid var(--border); vertical-align: top; }
.rwis td.n { color: var(--bright); }
.rwis .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rwis .cold { color: var(--accent); }
.rwis .freeze { color: var(--yellow); font-weight: 600; }
.rwis .hide-sm { display: none; }
.flag { display: inline-block; font-size: 0.68rem; padding: 0 6px; margin-left: 6px; border-radius: 999px; border: 1px solid rgba(255, 224, 102, 0.4); color: var(--yellow); }

/* cameras */
.cams { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cam { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 92px; padding: 10px; text-align: left; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; cursor: pointer;
  background: radial-gradient(120% 90% at 100% 0%, rgba(127, 212, 255, 0.08), transparent 60%), rgba(0, 0, 0, 0.45); }
.cam:hover { border-color: rgba(127, 212, 255, 0.4); }
.cam:focus-visible, .tab:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cam .cn { color: var(--bright); font-size: 0.86rem; line-height: 1.25; overflow-wrap: anywhere; }
.cam .cm { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 8px; font-size: 0.72rem; color: var(--dim); }
.cam .live { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cam .cm > span:last-child { white-space: nowrap; }
.cam .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.cam.off { opacity: 0.6; }
.cam.off .live::before { background: var(--dim); }
.cams-more { margin-top: 10px; }
.note { font-size: 0.74rem; color: var(--dim); margin: 10px 0 0; }

/* ---------- footer ---------- */
.site-footer { margin: 18px 0 8px; padding: 16px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--dim); text-align: center; }
.site-footer p { margin: 4px 0; }
.site-footer strong { color: var(--text); }

/* ---------- about ---------- */
.about { max-width: 720px; margin: 0 auto; }
.about h2 { font-size: 1.2rem; margin-bottom: 8px; }
.about h3 { font-size: 0.95rem; margin: 18px 0 6px; }
.about ul { padding-left: 18px; }
.about li { margin: 6px 0; }
.callout { border: 1px solid rgba(255, 181, 71, 0.35); background: rgba(255, 181, 71, 0.06); border-radius: 8px; padding: 10px 12px; }

/* ---------- map ---------- */
#view-map { position: fixed; inset: var(--top-h) 0 calc(var(--bottom-h) + env(safe-area-inset-bottom)) 0; padding: 0; }
#view-map #map { position: absolute; inset: 0; background: #000; } /* id selector so maplibre-gl.css (.maplibregl-map {position:relative}) can't collapse it */
.map-legend { position: absolute; left: 10px; top: 10px; z-index: 5; max-width: calc(100% - 20px); padding: 8px 10px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 0.74rem; }
.map-legend .lg-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.map-legend .lg-row + .lg-row { margin-top: 5px; }
.map-legend .sw { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.map-legend .mk { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 5px; border: 1.5px solid #000; }
.map-legend .lg-title { color: var(--dim); }
.map-note { position: absolute; left: 10px; bottom: 10px; z-index: 5; margin: 0; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); font-size: 0.72rem; color: var(--dim); white-space: nowrap; max-width: calc(100% - 64px); overflow: hidden; text-overflow: ellipsis; }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--dim); }
.maplibregl-popup-content { background: var(--panel-solid) !important; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius) !important; padding: 12px 14px !important; font-family: var(--font); font-size: 0.84rem; max-width: 280px; }
.maplibregl-popup-tip { border-top-color: var(--panel-solid) !important; border-bottom-color: var(--panel-solid) !important; }
.maplibregl-popup-close-button { color: var(--dim); font-size: 18px; padding: 2px 8px; }
.pop h4 { margin: 0 18px 6px 0; color: var(--bright); font-size: 0.9rem; font-weight: 600; }
.pop .small { color: var(--dim); font-size: 0.76rem; }
.pop p { margin: 4px 0; }
.maplibregl-ctrl-group { background: var(--panel-solid) !important; border: 1px solid var(--border-strong); }
.maplibregl-ctrl-group button { filter: invert(0.9); }
.maplibregl-ctrl-group.view-toggle button { filter: none; width: auto; min-width: 58px; height: 30px; padding: 0 10px; color: var(--text); font: 600 0.72rem/1 "Oxanium", var(--font); letter-spacing: 0.08em; text-transform: uppercase; }
.maplibregl-ctrl-group.view-toggle button:hover { color: var(--accent); background: rgba(127, 212, 255, 0.08); }
/* map labels (DOM): towns, route shields, rivers. Black halo so they read over roads and hillshade. */
.ml-town, .ml-shield, .ml-water { pointer-events: none; white-space: nowrap; user-select: none; }
.ml-town { font-family: "Oxanium", var(--font); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: #dfe7f2;
  text-shadow: 0 0 3px #000, 0 0 6px #000, 0 0 10px #000; font-size: 11px; }
.ml-town.t0 { font-size: 15px; font-weight: 800; letter-spacing: 0.16em; color: #fff; text-shadow: 0 0 3px #000, 0 0 8px #000, 0 0 18px rgba(127, 212, 255, 0.45); }
.ml-town.t1 { font-size: 12.5px; color: #eef0f3; }
.ml-town.t2 { font-size: 10.5px; color: #b9c1cc; letter-spacing: 0.1em; }
.ml-town.t3 { font-size: 9.5px; color: #8d96a3; letter-spacing: 0.08em; font-weight: 500; }
.ml-town small { font-size: 0.72em; margin-left: 0.35em; color: var(--accent); letter-spacing: 0.08em; }
.ml-shield { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px 1px; border-radius: 4px; font: 700 10px/1.1 "Oxanium", var(--font); letter-spacing: 0.02em;
  color: #fff; background: #0b0d10; border: 1.5px solid currentColor; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75), 0 0 8px rgba(0, 0, 0, 0.8); }
.ml-shield b { font-weight: 600; opacity: 0.8; font-size: 0.9em; }
.ml-shield.interstate { color: #ff7d6f; background: #1b0b0a; border-radius: 4px 4px 9px 9px; }
.ml-shield.us { color: #ffc067; background: #1a1206; }
.ml-shield.state { color: #ffe066; background: #15130a; border-radius: 9px; }
.ml-water { font: italic 500 10px/1 var(--font); letter-spacing: 0.06em; color: #5aa9d6; text-shadow: 0 0 3px #000, 0 0 6px #000; }
.maplibregl-ctrl-attrib { background: rgba(0, 0, 0, 0.6) !important; color: var(--dim) !important; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--dim) !important; }

/* ---------- sheet (dialog) ---------- */
.sheet { width: min(720px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; padding: 0; border: 1px solid var(--border-strong); border-radius: 14px 14px 0 0; background: var(--panel-solid); color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sheet-head h3 { font-size: 0.95rem; }
.sheet-body { padding: 12px 14px 18px; }
.icon-btn { background: none; border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 14px; }
.video-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3.25; background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.btn { display: inline-block; margin-top: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(127, 212, 255, 0.4); color: var(--accent); font-size: 0.86rem; }
.btn:hover { text-decoration: none; background: rgba(127, 212, 255, 0.08); }

/* ---------- larger screens ---------- */
@media (min-width: 560px) {
  .cams { grid-template-columns: repeat(3, 1fr); }
  .periods { grid-template-columns: repeat(4, 1fr); }
  .rwis .hide-sm { display: table-cell; }
  .corridors { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  :root { --bottom-h: 0px; }
  .bottombar { display: none; }
  .tabs { display: flex; }
  .net { margin-left: 12px; }
  main { padding: 18px 20px 24px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .span-2 { grid-column: span 2; }
  .span-all { grid-column: 1 / -1; }
  .compact > header { margin-bottom: 4px; }
  .compact .note { margin-top: 4px; }
  .periods { grid-template-columns: repeat(4, 1fr); }
  .cams { grid-template-columns: repeat(3, 1fr); }
  #view-map { inset: var(--top-h) 0 0 0; }
  .sheet { margin: auto; border-radius: 14px; }
}
@media (min-width: 1200px) {
  .cams { grid-template-columns: repeat(4, 1fr); }
}
