/* clockwire design system: Direction D "Newsroom". */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #FAFAF8;
  --card: #FFFFFF;
  --ink: #16181B;
  --ink2: #3D424A;
  --muted: #6B7078;
  --line: #E7E7E3;
  --soft: #F3F3F0;
  --accent: #E8590C;
  --accent-t: #C2410C;        /* accent for text, passes contrast on light */
  --accent-soft: #FDEEE5;
  --band: #16181B;
  --band-t: #F4F4F2;
  --band-time: #FF8F57;
  --ok: #1E7A46;   --ok-bg: #E5F3EA;
  --warn: #A86A00; --warn-bg: #FBF0D9;
  --bad: #B42318;  --bad-bg: #FCE9E7;
  --scroll: #C9C9C3;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121315;
  --card: #1B1D20;
  --ink: #EDEDEB;
  --ink2: #C9CCD1;
  --muted: #8D939B;
  --line: #2A2D31;
  --soft: #202226;
  --accent: #FF7A33;
  --accent-t: #FF8F57;
  --accent-soft: #3A2418;
  --band: #000000;
  --band-t: #EDEDEB;
  --ok: #6FD39A;   --ok-bg: #183223;
  --warn: #F0C062; --warn-bg: #352B17;
  --bad: #FF7B6E;  --bad-bg: #3A1D1A;
  --scroll: #44484E;
  color-scheme: dark;
}

/* Without JavaScript, follow the system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121315; --card: #1B1D20; --ink: #EDEDEB; --ink2: #C9CCD1;
    --muted: #8D939B; --line: #2A2D31; --soft: #202226; --accent: #FF7A33;
    --accent-t: #FF8F57; --accent-soft: #3A2418; --band: #000000; --band-t: #EDEDEB;
    --ok: #6FD39A; --ok-bg: #183223; --warn: #F0C062; --warn-bg: #352B17;
    --bad: #FF7B6E; --bad-bg: #3A1D1A; --scroll: #44484E;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  transition: background-color .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-t); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
button { font: inherit; color: inherit; }
img, svg { display: block; }
h1, h2, h3 { margin: 0; }

.wrap { max-width: 2400px; margin: 0 auto; padding: 0 24px; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); font-weight: 500; }
.meta { font-size: 13px; color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.kicker {
  font: 700 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-t);
}
.sec {
  font: 700 13px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}

/* Status pills: the only place status colours are used. */
.pill { font: 600 11px/1 var(--sans); padding: 5px 8px; border-radius: 6px; white-space: nowrap; display: inline-block; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

/* Pulsing live dot */
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  display: inline-block; position: relative; flex: none;
}
.dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: inherit; animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(3.2); opacity: 0; } }

.chip {
  font: 600 13px/1 var(--sans); padding: 8px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; cursor: pointer;
}
.chip.muted { color: var(--muted); }
.chip.dashed { border-style: dashed; color: var(--muted); }
.chip.strong { border-color: var(--ink); font-weight: 700; }
.chip.live { border-color: var(--accent); color: var(--accent-t); background: var(--accent-soft); }
.chip .count { font: 500 11px/1 var(--mono); opacity: .8; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }

/* -------------------------------------------------------------- masthead */
/* The masthead and ticker stay at the top while the page scrolls. */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); }
.masthead { border-bottom: 1px solid var(--line); background: var(--bg); }
.masthead-in { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand-name { font: 700 23px/1 var(--serif); letter-spacing: -0.02em; }
.menu-toggle {
  display: none; align-items: center; gap: 6px; flex: none; cursor: pointer;
  font: 600 13px/1 var(--sans); color: var(--ink2); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
/* Wide screens: the menu's parts sit in the masthead row itself. */
.mast-menu { display: contents; }
.menu { order: 1; flex: none; }
/* Clocks fill the space left over. Those that do not fit wrap onto a second,
   hidden line, so they drop out one by one as the window narrows. */
.clocks {
  order: 2; flex: 1 1 0; min-width: 0; height: 18px; overflow: hidden;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 16px; margin: 0; padding: 0; list-style: none;
  font: 500 12px/18px var(--mono); color: var(--muted);
}
.clocks li { white-space: nowrap; }
.clocks b { color: var(--ink); font-weight: 600; }
.search-link {
  order: 3; flex: none; display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px/1 var(--sans); color: var(--ink2); padding: 8px 4px;
}
.mast-actions { order: 4; flex: none; display: flex; align-items: center; gap: 12px; }
.mode-toggle {
  font: 600 13px/1 var(--sans); color: var(--ink2); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.mode-toggle:hover { color: var(--accent-t); }
.signin { font: 600 13px/1 var(--sans); white-space: nowrap; }
.go-pro {
  font: 700 13px/1 var(--sans); background: var(--accent-t); color: #FFFFFF;
  padding: 9px 12px; border-radius: 8px; white-space: nowrap;
}
.go-pro:hover { color: #FFFFFF; filter: brightness(1.08); }

/* ---------------------------------------------------------------- ticker */
.band { background: var(--band); color: var(--band-t); }
.band-in { display: flex; align-items: center; gap: 14px; height: 32px; }
.band-label {
  display: flex; align-items: center; gap: 8px; flex: none;
  font: 700 11px/1 var(--sans); letter-spacing: .08em;
}
.ticker {
  overflow: hidden; white-space: nowrap; flex: 1 1 auto; min-width: 0;
  font: 500 12px/32px var(--mono);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.ticker-in { display: inline-block; animation: run 120s linear infinite; will-change: transform; }
.ticker:hover .ticker-in, .ticker:focus-within .ticker-in { animation-play-state: paused; }
.ticker a { margin-right: 36px; color: var(--band-t); }
.ticker a:hover { color: var(--band-time); }
.ticker time { color: var(--band-time); margin-right: 8px; }
@keyframes run { to { transform: translateX(-50%); } }

/* -------------------------------------------------------------- tab rows */
.tabbar { border-bottom: 1px solid var(--line); }
.tabbar-in { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tabrow-label {
  font: 600 11px/1 var(--mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; width: 78px; flex: none;
}
.tab { font: 600 14px/1 var(--sans); padding: 9px 12px; border-radius: 8px; color: var(--ink2); white-space: nowrap; }
.tab.on { background: var(--ink); color: var(--card); }
.tab.on:hover { color: var(--card); }
.tab.soon { color: var(--muted); }

/* ------------------------------------------------------------ page body */
.page {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px;
  padding-top: 28px; padding-bottom: 56px;
}
.main-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.page-title { font: 700 28px/1.15 var(--serif); letter-spacing: -0.01em; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }

/* Headline cards */
.stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.story { padding: 20px 22px; }
.story-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.story-outlet { font: 600 13px/1 var(--sans); color: var(--ink2); }
.story-time { font: 500 12px/1 var(--mono); color: var(--muted); }
.story-title { font: 700 22px/1.25 var(--serif); letter-spacing: -0.01em; margin: 0 0 8px; }
.story-title a:hover { color: var(--accent-t); }
.story-summary {
  margin: 0 0 12px; color: var(--ink2); font-size: 15px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font: 600 11px/1 var(--sans); padding: 5px 8px; border-radius: 999px;
  background: var(--soft); color: var(--ink2); border: 1px solid var(--line);
}
.empty { padding: 28px; color: var(--muted); }

/* Right rail */
.rail-card { padding: 20px; }
.rail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.ji {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.35;
}
.ji-time { font: 500 12px/1.4 var(--mono); color: var(--accent-t); padding-top: 1px; }
.ji-outlet { font-size: 12px; font-weight: 700; color: var(--muted); }
.ji.new { animation: flash 2.5s ease-out 1; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.placeholder-note { margin: 8px 0 0; font-size: 14px; color: var(--ink2); }
.map-tease {
  position: relative; height: 150px; border-radius: 10px; margin-top: 12px;
  background: var(--soft); border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px;
}
.rail-link { color: var(--accent-t); font-size: 13px; }

/* Placeholder pages */
.soon-page { padding: 40px 0 80px; max-width: 640px; }
.soon-page h1 { font: 700 34px/1.15 var(--serif); margin-bottom: 12px; }
.soon-page p { color: var(--ink2); font-size: 17px; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 22px; padding-bottom: 32px; }
.footer p { margin: 0; color: var(--muted); font-size: 13px; }

/* ----------------------------------------------------------- admin pages */
.admin { padding-top: 24px; padding-bottom: 56px; }
.admin h1 { font: 700 28px/1.2 var(--serif); margin-bottom: 8px; }
.admin h2 { font: 700 20px/1.2 var(--serif); margin: 28px 0 6px; }
.admin p { color: var(--ink2); }
.admin button {
  font: 600 13px/1 var(--sans); padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); font-weight: 600; white-space: nowrap; }
tr.is-failing td { background: var(--bad-bg); }
tr.is-inactive td { color: var(--muted); }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 1080px) {
  .page { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabrow-label { width: auto; padding-right: 6px; }
  .story { padding: 16px; }
  .story-title { font-size: 19px; }
  .page-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .dot::after, .ji.new, .map-pulse { animation: none; }
  .ticker-in { animation: none; transform: none; }
  .ticker { -webkit-mask-image: none; mask-image: none; }
  .ticker a[aria-hidden="true"], .ticker a:nth-of-type(n+4) { display: none; }
}


/* ------------------------------------------------------------ top menu */
.menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.menu-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px;
  font: 600 14px/1 var(--sans); color: var(--ink2); white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.menu-link:hover { color: var(--ink); border-bottom-color: var(--line); }
.menu-link.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ filter bar */
.filterbar { border-bottom: 1px solid var(--line); background: var(--card); }
.filterbar-in {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 22px; padding-top: 7px; padding-bottom: 7px;
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent;
}
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.fgroup { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; flex: none; }
.flabel {
  font: 600 11px/1 var(--mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-right: 4px;
}
.fchip {
  font: 600 12px/1 var(--sans); padding: 6px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink2);
}
.fchip:hover { border-color: var(--ink2); color: var(--ink); }
.fchip.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.fchip.on:hover { color: var(--card); }
.fclear { font: 600 13px/1 var(--sans); color: var(--accent-t); text-decoration: underline; text-underline-offset: 3px; }
.chip.live.on { background: var(--accent); color: #FFFFFF; }
.chip[disabled] { cursor: not-allowed; opacity: .65; }
.pro-badge {
  font: 700 10px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 4px; background: var(--soft); color: var(--muted);
  border: 1px solid var(--line);
}

/* Home map preview */
.map-tease { position: relative; height: 190px; overflow: hidden; }
.map-tease .maplibregl-map { position: absolute; inset: 0; }
.map-tease-note { position: relative; z-index: 1; }
.map-tease.loaded .map-tease-note { display: none; }

/* -------------------------------------------------------------- map page */
body.map-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.map-page #content { flex: 1 1 auto; min-height: 0; display: flex; }
.map-shell { position: relative; flex: 1 1 auto; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--soft); }
.map-ui { position: absolute; z-index: 2; }
.map-card {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.map-topbar {
  /* Beside the layers panel, clear of the stories panel on the right. */
  top: 12px; left: 254px; max-width: calc(100% - 254px - 384px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 10px;
}
.map-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.map-btn {
  font: 600 13px/1 var(--sans); padding: 7px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink2);
  display: inline-flex; align-items: center; gap: 5px;
}
.map-btn:hover { color: var(--ink); border-color: var(--ink2); }
.map-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.map-btn[disabled] { cursor: not-allowed; opacity: .6; }
.map-layers { top: 12px; left: 12px; width: 230px; max-height: calc(100% - 90px); overflow: auto; }
.map-layers summary {
  list-style: none; cursor: pointer; padding: 10px 12px; font: 700 12px/1 var(--sans);
  letter-spacing: .06em; text-transform: uppercase; display: flex; justify-content: space-between;
}
.map-layers summary::-webkit-details-marker { display: none; }
.map-layers .layer-list { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.layer { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.layer input { margin: 0; accent-color: var(--accent); }
.layer .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.layer .n { margin-left: auto; font: 500 11px/1 var(--mono); color: var(--muted); }
.layer.locked { color: var(--muted); cursor: not-allowed; }
.layer-sep { border-top: 1px solid var(--line); margin: 6px 0; }
.map-panel {
  top: 12px; right: 12px; bottom: 56px; width: 360px; display: flex; flex-direction: column;
}
.map-panel[hidden] { display: none; }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.panel-head h2 { font: 700 18px/1.25 var(--serif); }
.panel-close {
  margin-left: auto; border: 1px solid var(--line); background: var(--bg); border-radius: 8px;
  font: 600 12px/1 var(--sans); padding: 6px 9px; cursor: pointer; color: var(--ink2);
}
.panel-list { overflow: auto; padding: 4px 16px 12px; list-style: none; margin: 0; }
.panel-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.panel-list li:first-child { border-top: 0; }
.panel-list .pl-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.panel-list .pl-title { font: 600 15px/1.3 var(--serif); }
.map-legend {
  left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; font-size: 12px;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.map-legend i.tri { border-radius: 0; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid #B54708; background: none; }
.map-status { top: 70px; left: 50%; transform: translateX(-50%); padding: 8px 12px; font-size: 13px; }
.map-status[hidden] { display: none; }
.maplibregl-popup-content { background: var(--card); color: var(--ink); }
.maplibregl-ctrl-attrib { font-size: 11px; }

@media (max-width: 720px) {
  .map-topbar { top: 8px; left: 8px; right: 8px; transform: none; max-width: none; }
  .map-layers { top: auto; bottom: 52px; left: 8px; width: 200px; max-height: 45%; }
  .map-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 55%;
    border-radius: 14px 14px 0 0;
  }
  .map-legend { display: none; }
}
@media (max-width: 720px) {
  /* Give the map more of a small screen. */
}

/* ------------------------------------------------- taxonomy (prompt 06) */
.fchip-wrap { display: inline-flex; align-items: stretch; }
.fchip.has-drill { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 8px; }
.fchip-drill {
  border: 1px solid var(--line); border-left: 0; background: var(--bg); color: var(--ink2);
  border-radius: 0 999px 999px 0; padding: 0 8px; cursor: pointer; display: inline-flex; align-items: center;
}
.fchip-drill:hover { color: var(--ink); border-color: var(--ink2); }
.fchip .count, .chip .count { font: 500 11px/1 var(--mono); opacity: .75; }
.my-tabs { display: inline-flex; flex-wrap: nowrap; gap: 4px; align-items: center; white-space: nowrap; }
.my-tabs .chip[aria-current] { border-color: var(--accent); color: var(--accent-t); }

.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--muted); }
.breadcrumb li + li::before { content: "\203A"; margin-right: 4px; color: var(--muted); }
.breadcrumb a { color: var(--ink2); }
.breadcrumb a:hover { color: var(--accent-t); }
.node-head { display: flex; flex-direction: column; gap: 8px; }
.node-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; color: var(--ink2); }
.node-meta a { color: var(--accent-t); }
.node-related { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.node-related .tag:hover { border-color: var(--ink2); color: var(--ink); }
.star-btn {
  font: 600 12px/1 var(--sans); padding: 6px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink2);
}
.star-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-t); background: var(--accent-soft); }

/* Drill-down panel: popover on desktop, bottom sheet on small screens. */
.drill-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .18); }
.drill {
  position: fixed; z-index: 41; max-height: min(560px, calc(100vh - 24px));
  display: flex; flex-direction: column; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}
.drill.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto !important; max-height: 80vh; border-radius: 16px 16px 0 0; }
.drill[hidden], .drill-backdrop[hidden] { display: none; }
.drill-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.drill-head h2 { font: 700 18px/1.2 var(--serif); margin: 0; }
.drill-open { margin-left: auto; font-size: 13px; color: var(--accent-t); }
.drill-close, .drill-back {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px; cursor: pointer;
  font: 600 12px/1 var(--sans); padding: 6px 9px; color: var(--ink2);
}
.drill-back { padding: 5px 7px; display: inline-flex; }
.drill-tabs { display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.drill-tab {
  font: 600 13px/1 var(--sans); padding: 9px 10px; border: 0; background: none; cursor: pointer;
  color: var(--ink2); border-bottom: 2px solid transparent; white-space: nowrap;
}
.drill-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.drill-tab .count { margin-left: 5px; font: 500 11px/1 var(--mono); color: var(--muted); }
.drill-search {
  margin: 10px 16px 6px; font: 400 14px/1.2 var(--sans); padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.drill-list { list-style: none; margin: 0; padding: 4px 8px 12px; overflow: auto; }
.drill-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.drill-list li:hover { background: var(--soft); }
.drill-name { flex: 1 1 auto; font-size: 14px; font-weight: 500; }
.drill-list .count { font: 500 12px/1 var(--mono); color: var(--accent-t); }
.drill-list .count.zero { color: var(--muted); opacity: .6; }
.drill-star, .drill-more {
  border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; display: inline-flex; border-radius: 6px;
}
.drill-star svg { fill: none; }
.drill-star[aria-pressed="true"] { color: var(--accent); }
.drill-star[aria-pressed="true"] svg { fill: currentColor; }
.drill-star:hover, .drill-more:hover { color: var(--ink); background: var(--bg); }
.drill-empty { padding: 12px 8px; }

/* Map: node filter and teams layer */
.map-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.map-filter .chip { padding: 6px 9px; font-size: 12px; }
.drill-head, .drill-tabs, .drill-search { flex: none; }
.drill-list { flex: 1 1 auto; min-height: 0; }
.drill-back[hidden] { display: none; }

/* ------------------------------------------- column layout (prompt 07) */
/* Go Pro keeps a dark enough orange for white text in both themes. */
.go-pro { background: #C2410C; }

/* Below the sticky header the home grid fills the rest of the window, and
   each column scrolls on its own. --top-h is the header plus the filter row,
   measured by clockwire.js; the value here is the fallback. */
.home-grid {
  display: grid; gap: 0 20px; padding-top: 10px;
  height: calc(100vh - var(--top-h, 130px));
  height: calc(100dvh - var(--top-h, 130px));
  min-height: 420px;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "stories justin video side";
}
.col {
  min-height: 0; overflow-y: auto; padding: 2px 8px 24px 2px;
  scrollbar-width: thin; scrollbar-color: var(--scroll) transparent;
}
.col::-webkit-scrollbar { width: 8px; }
.col::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col:focus { outline: none; }
.col:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.col-stories { grid-area: stories; container: stories / inline-size; }
.col-justin { grid-area: justin; }
.col-video { grid-area: video; }
.col-side { grid-area: side; }
.col-head {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 2px 0 8px;
}
.col-side > * + * { margin-top: 14px; }

/* Tabs: the side rail on tablets, the whole page on phones. */
.view-tabs { display: none; gap: 4px; }
.view-tabs button {
  font: 600 13px/1 var(--sans); padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--ink2);
}
.view-tabs button:hover { color: var(--ink); border-color: var(--ink2); }
.view-tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }

/* Map preview card: shown in the side column, or above Just in when there is no side column. */
.map-card-link { display: block; padding: 14px; }
.map-card-link .rail-head { flex-wrap: wrap; row-gap: 2px; }
.map-card-link .sec { white-space: nowrap; }
.map-card-link:hover { color: inherit; border-color: var(--ink2); }
.map-card-link .map-tease { height: 180px; margin-top: 8px; }
.map-card-link.in-justin { display: none; margin-bottom: 14px; }
.rail-card { padding: 14px 16px; }
.live-list { list-style: none; margin: 4px 0 0; padding: 0; }
.live-list li {
  display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: 14px;
}
.live-list a:hover { color: var(--accent-t); }
.ji-list { list-style: none; margin: 0; padding: 0; }
.ji-list li:first-child .ji { border-top: 0; }

/* Story cards: a lead card, then a two-column grid. */
.col-stories .page-head { margin-bottom: 8px; }
.col-stories .page-title { font-size: 24px; }
.col-stories .node-head, .col-stories .breadcrumb { margin-bottom: 10px; }
.stories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stories > li { display: flex; min-width: 0; }
.story-lead-item { grid-column: 1 / -1; }
.story { flex: 1 1 auto; min-width: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.story-media {
  aspect-ratio: 16 / 9; overflow: hidden; flex: none;
  background: var(--soft); border-bottom: 1px solid var(--line);
}
.story-media img { width: 100%; height: 100%; object-fit: cover; }
.story-media.no-img { aspect-ratio: 16 / 4; }
.story-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 0 12px;
  background: repeating-linear-gradient(135deg, transparent 0 10px, var(--line) 10px 11px);
}
.story-ph span {
  font: 600 14px/1.2 var(--serif); color: var(--ink2); background: var(--soft);
  padding: 4px 8px; border-radius: 6px; text-align: center;
}
.story-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.story-top { margin-bottom: 0; }
.story-title { font: 700 20px/1.25 var(--serif); margin: 0; }
.story-lead .story-title { font-size: 28px; line-height: 1.18; }
.story-summary { margin: 0; font-size: 14px; }
.story .tags {
  flex-wrap: nowrap; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.story .tag { flex: none; white-space: nowrap; }
@container stories (min-width: 760px) {
  .story-lead { flex-direction: row; }
  .story-lead .story-media { flex: 0 0 56%; border-bottom: 0; border-right: 1px solid var(--line); }
  .story-lead .story-media.no-img { flex-basis: 26%; aspect-ratio: auto; }
  .story-lead .story-body { padding: 18px 20px; justify-content: center; }
  .story-lead .story-summary { -webkit-line-clamp: 3; }
}
@container stories (max-width: 520px) {
  .stories { grid-template-columns: minmax(0, 1fr); }
  .story-lead .story-title { font-size: 23px; }
}

/* ------------------------------------------------------------ video wall */
.video-wall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.video-wall.single { grid-template-columns: minmax(0, 1fr); }
.video-wait { grid-column: 1 / -1; margin: 0; }
.vtile {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column; min-width: 0;
}
.vtile.sound-on { border-color: var(--accent); }
.vtile-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.vtile-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vtile-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 7px 8px; font-size: 12px; }
.vtile-name { font-weight: 700; color: var(--ink); }
.vtile-region { color: var(--muted); }
.vtile-live {
  font: 700 10px/1 var(--sans); letter-spacing: .06em; color: #FFFFFF;
  background: #B42318; padding: 3px 5px; border-radius: 4px;
}
.vtile-off { display: none; color: var(--bad); font-weight: 600; }
.vtile.offline .vtile-live { display: none; }
.vtile.offline .vtile-off { display: inline; }
.vtile-btns { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.vbtn {
  font: 600 11px/1 var(--sans); padding: 6px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink2);
}
.vbtn:hover { color: var(--ink); border-color: var(--ink2); }
.vbtn[aria-pressed="true"] { background: #C2410C; border-color: #C2410C; color: #FFFFFF; }
.vbtn-swap { display: none; }
.vtile.offline .vbtn-swap { display: inline-block; }
.video-note { margin: 10px 0 0; font-size: 12px; }

.vpicker {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  padding: 0; width: min(560px, calc(100vw - 32px)); max-height: 82vh;
}
.vpicker::backdrop { background: rgba(0, 0, 0, .35); }
.vpicker form { display: flex; flex-direction: column; max-height: 82vh; margin: 0; }
.vpicker-head { padding: 16px 18px 8px; }
.vpicker-head h2 { font: 700 19px/1.2 var(--serif); }
.vpicker-head p { margin: 6px 0 0; }
.vpicker-body { overflow: auto; padding: 4px 18px 8px; }
.vpicker fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.vpicker legend {
  font: 600 11px/1 var(--mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; padding: 0; margin-bottom: 6px;
}
.vpicker label { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.vpicker input { margin: 0; accent-color: var(--accent); }
.vpicker-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line);
}
.vpicker-foot .meta { margin-right: auto; }
.vpicker-foot button {
  font: 600 13px/1 var(--sans); padding: 9px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.vpicker-foot button.primary { background: #C2410C; border-color: #C2410C; color: #FFFFFF; }

/* ------------------------------------------------------------ breakpoints */
@media (max-width: 1599px) {
  /* Three columns: the map preview moves to the top of Just in. */
  .home-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr);
    grid-template-areas: "stories justin video";
  }
  .col-side { display: none; }
  .map-card-link.in-justin { display: block; }
}
@media (max-width: 1199px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .masthead-in { gap: 12px; }
  .menu-link { padding: 8px 6px; }
  .search-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* Two columns: stories, and a side rail with tabs. */
  .home-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "stories tabs" "stories rail";
  }
  .map-card-link.in-justin { display: none; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .rail-tabs { display: flex; grid-area: tabs; padding-bottom: 10px; }
  .col-justin, .col-video, .col-side { grid-area: rail; display: none; }
  .home-grid[data-rail="justin"] .col-justin,
  .home-grid[data-rail="video"] .col-video,
  .home-grid[data-rail="side"] .col-side { display: block; }
}
@media (max-width: 899px) {
  .signin { display: none; }
  .mode-toggle { padding: 8px; }
}
@media (max-width: 767px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .signin { display: inline; }
  /* Masthead: logo, search and a menu button that opens a drawer. */
  .masthead-in { position: relative; }
  .menu-toggle { display: inline-flex; order: 4; }
  .search-link { margin-left: auto; }
  .search-link span { position: static; width: auto; height: auto; clip: auto; }
  .mast-menu {
    display: none; position: absolute; left: 0; right: 0; top: 56px; z-index: 31;
    flex-direction: column; gap: 16px; padding: 14px 16px 18px;
    background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 10px 20px rgba(0, 0, 0, .12);
    max-height: calc(100dvh - 56px); overflow: auto;
  }
  .mast-menu.open { display: flex; }
  .menu ul { flex-wrap: wrap; }
  .clocks { height: auto; overflow: visible; justify-content: flex-start; flex-wrap: wrap; gap: 4px 16px; flex: none; }
  .mast-actions { flex-wrap: wrap; }
  /* One column at a time, chosen with tabs; the page scrolls normally. */
  .mobile-tabs {
    display: flex; position: sticky; top: var(--bar-h, 89px); z-index: 20; overflow-x: auto;
    background: var(--bg); padding: 8px 16px; border-bottom: 1px solid var(--line);
  }
  .home-grid { display: block; height: auto; min-height: 0; padding-top: 12px; padding-bottom: 24px; }
  .rail-tabs { display: none; }
  .col { display: none; overflow: visible; padding: 0; }
  .home-grid[data-view="stories"] .col-stories,
  .home-grid[data-view="justin"] .col-justin,
  .home-grid[data-view="video"] .col-video,
  .home-grid[data-view="side"] .col-side { display: block; }
  .col-head { position: static; }
  .story-title { font-size: 19px; }
}
