/* News Map web: tokens from the approved designs (canvas "News Map Mobile", web artboard). */
:root {
  --bg: #eceee9; --surface: #ffffff; --surface-2: #f4f5f1; --ink: #1b2321; --muted: #5b6561; --line: #d3d8d2;
  --line-soft: #e3e6e1; --accent: #2546b8; --accent-ink: #1a3590; --accent-soft: #eef1fb;
  --bad: #cf3628; --bad-ink: #b52e22; --bad-soft: #fbe9e7;
  --caution: #d98d0b; --caution-ink: #8a5a00; --caution-soft: #fcf1dc;
  --good: #2b8549; --good-ink: #21703c; --good-soft: #e5f2e9;
  --neutral: #7a8480; --neutral-soft: #eef0ec; --border-state: #6e6790;
  --f-display: "Barlow Condensed", "Noto Sans", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --header-h: 66px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body.map-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f-body); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); min-height: var(--header-h);
  padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.brand b { font: 700 26px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; }
.sample-badge { font: 600 11px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--caution-ink);
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }
.search { flex: 1 1 200px; max-width: 300px; display: flex; align-items: center; gap: 8px; height: 42px;
  padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); position: relative; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-weight: 500; }
.area-btn { height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer; white-space: nowrap; }
.search-results { position: absolute; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 28px rgba(20,30,25,.16); z-index: 30; padding: 6px; max-height: 360px; overflow: auto; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; }
.search-results button:hover, .search-results button:focus { background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; height: 34px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 11px; cursor: pointer; font: 500 12.5px var(--f-mono); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg .now-btn { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--f-body); color: var(--bad-ink); padding: 0 11px 0 9px; }
.seg .now-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.seg .now-btn[aria-pressed="true"] { background: var(--bad); color: #fff; }
.seg .now-btn[aria-pressed="true"]::before { background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 17px; background: var(--surface);
  border: 1px solid var(--line); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="false"] { opacity: .45; }
.chip select { border: 0; background: transparent; cursor: pointer; max-width: 92px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.bg-bad { background: var(--bad); } .bg-caution { background: var(--caution); } .bg-good { background: var(--good); } .bg-neutral { background: var(--neutral); }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.btn { height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }

/* ---------- layout ---------- */
.layout { display: flex; flex-wrap: wrap; align-items: stretch; flex: 1; min-height: 0; }
.side { flex: 1 1 340px; max-width: 380px; min-width: 0; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; height: 100%; }
.tabs { display: flex; border-bottom: 1px solid var(--line-soft); }
.tabs button { flex: 1; height: 48px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  font: 600 15px var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.side-body { overflow-y: auto; flex: 1; padding: 14px 10px 20px; display: flex; flex-direction: column; gap: 4px; }
.side-head { padding: 0 10px 6px; display: flex; flex-direction: column; gap: 6px; }
.crumbs { display: flex; gap: 4px; font: 500 12px var(--f-mono); color: var(--muted); }
.crumbs span[aria-current] { color: var(--ink); }
h1.area-title { margin: 0; font: 700 26px/1.05 var(--f-display); letter-spacing: .02em; text-transform: uppercase; }
.counts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 600; font-size: 13.5px; }
.counts span { display: inline-flex; align-items: center; gap: 5px; }
.c-bad { color: var(--bad-ink); } .c-caution { color: var(--caution-ink); } .c-good { color: var(--good-ink); } .c-neutral { color: var(--muted); }
.item { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 3px 12px; padding: 12px 10px; border-radius: 10px; color: var(--ink);
  cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.item:hover { background: var(--surface-2); }
.item[aria-current="true"] { background: var(--accent-soft); }
.ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; grid-row: span 2; }
.ic-bad { background: var(--bad-soft); color: var(--bad); } .ic-caution { background: var(--caution-soft); color: #b07205; }
.ic-good { background: var(--good-soft); color: var(--good); } .ic-neutral { background: var(--neutral-soft); color: var(--muted); }
.it { font-weight: 600; font-size: 15px; line-height: 1.3; }
.im { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.now-pill { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--bad);
  color: #fff; font: 600 10.5px var(--f-body); letter-spacing: .08em; }
.now-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.unverified { color: var(--caution-ink); }
.empty { padding: 20px 10px; color: var(--muted); }

.map-col { flex: 999 1 560px; min-width: 0; position: relative; height: 100%; background: #e1e3dc; }
#map { position: absolute; inset: 0; }
.map-tools { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.map-tools button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.legend { position: absolute; left: 16px; bottom: 16px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: calc(100% - 32px);
  padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.94); border: 1px solid var(--line); font-size: 12px; color: #3f4945; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.past-bar { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 4px;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 4px; box-shadow: 0 2px 10px rgba(20,30,25,.25); }
.past-bar button { border: 0; background: none; color: #fff; width: 40px; height: 40px; cursor: pointer; font-size: 18px; }
.past-bar .when { display: flex; flex-direction: column; align-items: center; padding: 0 8px; }
.past-bar .when small { font: 500 10.5px var(--f-mono); color: #b9c2be; }
.past-bar .when b { font: 700 19px var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.past-bar .today { width: auto; padding: 0 12px; height: 36px; border-radius: 10px; background: #fff; color: var(--accent); font-weight: 600; font-size: 14px; }
.hour-slider { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.hour-slider input { width: 100%; accent-color: var(--accent); }
.hour-slider .ticks { display: flex; justify-content: space-between; }

/* popup (first click) */
.maplibregl-popup-content { padding: 12px 14px !important; border-radius: 12px !important; box-shadow: 0 10px 28px rgba(20,30,25,.2) !important;
  font-family: var(--f-body); width: 290px; max-width: 80vw; }
.pop { display: flex; flex-direction: column; gap: 7px; }
.pop h3 { margin: 0; font: 600 19px/1.12 var(--f-display); }
.pop p { margin: 0; font-size: 14px; line-height: 1.4; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 7px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.pop-foot button { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; }
.tag { display: inline-flex; align-items: center; align-self: flex-start; height: 22px; padding: 0 7px; border-radius: 5px; font: 600 11px var(--f-body);
  letter-spacing: .05em; text-transform: uppercase; }
.tag-bad { background: var(--bad-soft); color: var(--bad-ink); } .tag-caution { background: var(--caution-soft); color: var(--caution-ink); }
.tag-good { background: var(--good-soft); color: var(--good-ink); } .tag-neutral, .tag-plain { background: var(--neutral-soft); color: #3f4945; }

/* story panel (second click) */
.story { flex: 1 1 360px; max-width: 400px; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); height: 100%;
  overflow-y: auto; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.story[hidden] { display: none; }
.story h2 { margin: 0; font: 600 30px/1.06 var(--f-display); text-wrap: balance; }
.story .lead { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; }
.h4 { margin: 0; font: 600 12px var(--f-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.verified { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13.5px; color: var(--good-ink); }
.timeline { display: flex; flex-direction: column; gap: 12px; border-left: 2px solid var(--line); margin: 0 0 0 5px; padding: 0; list-style: none; }
.timeline li { position: relative; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.timeline li:first-child::before { background: var(--accent); border-color: #fff; }
.sources a, .sources div { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; border-top: 1px solid var(--line-soft); color: var(--ink); }
.story-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.story-actions .btn { flex: 1; }
.close-btn { width: 36px; height: 36px; border: 0; background: none; cursor: pointer; font-size: 20px; color: var(--muted); }

/* route check */
.route-form { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 8px; padding: 0 10px; }
.route-form label { display: flex; flex-direction: column; gap: 2px; font: 500 11px var(--f-mono); color: var(--muted); }
.route-form input { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface-2); font-weight: 600; font-size: 16px; color: var(--ink); }
.route-form .swap { grid-row: span 2; align-self: center; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.route-form .btn { grid-column: span 2; }
.verdict { margin: 4px 10px; border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.verdict b { font: 700 28px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.v-avoid { background: var(--bad-soft); color: var(--bad-ink); } .v-caution { background: var(--caution-soft); color: var(--caution-ink); }
.v-clear { background: var(--good-soft); color: var(--good-ink); }
.verdict span { color: var(--ink); }
.km { font: 500 12px var(--f-mono); color: var(--accent); }
.alt-card { margin: 6px 10px; padding: 10px 12px; border: 1.5px dashed var(--accent); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.form-error { color: var(--bad-ink); font-size: 13px; padding: 0 10px; }

/* simple content pages */
.page { max-width: 760px; margin: 0 auto; padding: 32px max(20px, env(safe-area-inset-left)) 64px; display: flex; flex-direction: column; gap: 18px; }
.page h1 { margin: 0; font: 700 44px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.page h2 { margin: 12px 0 0; font: 700 26px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.page p, .page li { font-size: 16.5px; line-height: 1.6; max-width: 66ch; }
.page table { border-collapse: collapse; width: 100%; background: var(--surface); border-radius: 12px; overflow: hidden; }
.page th, .page td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line-soft); vertical-align: top; font-size: 15px; }
.page th { background: var(--surface-2); font: 600 12px var(--f-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field textarea, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); font-size: 16px; }
.errorlist { color: var(--bad-ink); margin: 0; padding-left: 18px; font-size: 14px; }
.hint { font-size: 13.5px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13.5px; }
.story-page-map { height: 260px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }

@media (max-width: 900px) {
  body.map-page { height: auto; overflow: visible; }
  .layout { height: auto; }
  .side, .story { max-width: none; height: auto; }
  .map-col { height: 70vh; order: -1; flex-basis: 100%; }
  .top-actions { margin-left: 0; }
  .search { max-width: none; flex-basis: 100%; }
  .filters { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
}

/* CR-024: news types, tick any combination */
.types-dialog { border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
.types-dialog::backdrop { background: rgba(20, 30, 25, 0.35); }
.types-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.types-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.type-option { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.type-option input { width: 18px; height: 18px; accent-color: var(--accent); }
.types-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 420px) { .types-list { grid-template-columns: 1fr; } }

/* Read aloud (CR-015a, web) */
.listen-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.listen-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* News type symbols (CR-025) */
.msym { font-family: "Material Symbols Outlined"; font-weight: 500; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-feature-settings: "liga"; display: inline-block; vertical-align: middle; }
.type-option .msym { font-size: 18px; color: var(--muted); }

/* Adverts (CR-027) */
.advert { display: block; flex: none; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); margin: 6px 0; }
/* flex: none — in the scrolling list (a flex column) a card that hides its overflow would otherwise be squeezed to a thin line. */
.advert img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.advert-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.advert-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.advert-go { align-self: flex-start; margin-top: 6px; height: 34px; display: inline-flex; align-items: center; text-decoration: none; }
.story-has-advert #side-body .advert { display: none; }
/* CR-030: the advert's text scrolls across a strip under the picture, like a news ticker. */
.advert-ticker { background: var(--accent-ink); color: #fff; overflow: hidden; font-weight: 600; font-size: 14px;
  line-height: 1.3; padding: 7px 0; }
.advert-ticker .track { display: inline-flex; white-space: nowrap; }
.advert-ticker .track span { padding: 0 12px; }
.advert-ticker .track span + span { display: none; }
.advert-ticker:not(.moving) .track { display: block; overflow: hidden; text-overflow: ellipsis; }
.advert-ticker.moving .track span { padding-right: 56px; }
.advert-ticker.moving .track span + span { display: inline; }
.advert-ticker.moving .track { animation: nm-ticker var(--ticker-time, 12s) linear infinite; }
.advert-ticker.moving:hover .track { animation-play-state: paused; }
@keyframes nm-ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .advert-ticker .track { white-space: normal; animation: none !important; }
}
