/* Layout concept: a newsroom front page. Sticky masthead with section tabs, a lead story beside a briefs column, then card grids. Guides, Real Estate and Map reuse the same grid. Newsroom is a desk view with a review queue. */
:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --fg: #11262b;
  --muted: #5a6e72;
  --line: #d6dfdd;
  --accent: #0b3a8f;      /* flag blue, used for actions and links */
  --accent-fg: #ffffff;
  --alert: #c8102e;       /* flag red, used only for breaking and review states */
  --sun: #f4c20d;         /* flag yellow, used sparingly for highlights */
  --ok: #1f7a4d;
  --sea: #cfe3ea;
  --land: #e4ecd9;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1a1e; --surface: #12272c; --fg: #e8f0ef; --muted: #93a8ac; --line: #26414a;
    --accent: #7fa8ff; --accent-fg: #0b1a1e; --alert: #ff6b81; --sun: #f4c20d; --ok: #5fd39a;
    --sea: #12303a; --land: #1d3a33; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1a1e; --surface: #12272c; --fg: #e8f0ef; --muted: #93a8ac; --line: #26414a;
  --accent: #7fa8ff; --accent-fg: #0b1a1e; --alert: #ff6b81; --sun: #f4c20d; --ok: #5fd39a;
  --sea: #12303a; --land: #1d3a33; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; padding-inline: 16px; padding-block: 0 48px; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin-inline: auto; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; text-wrap: balance; margin: 0; }
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* masthead */
.mast { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 2px solid var(--fg); margin-inline: -16px; padding-inline: 16px; }
.mast-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-block: 12px 8px; }
.logo { display: flex; align-items: baseline; gap: 8px; background: none; border: 0; padding: 0; }
.logo b { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.03em; }
.logo b i { font-style: normal; color: var(--accent); }
.logo span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 10px; font-size: 12px; font-family: var(--font-mono); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--alert); border-color: var(--alert); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav button { border: 0; background: none; padding: 9px 14px; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.nav button[aria-current="page"] { border-bottom-color: var(--alert); }
.ticker { display: flex; gap: 12px; align-items: center; background: var(--fg); color: var(--bg); margin-inline: -16px; padding: 6px 16px; font-size: 13px; overflow: hidden; }
.ticker strong { background: var(--alert); color: #fff; padding: 1px 8px; border-radius: 3px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; white-space: nowrap; }
.ticker span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sample { margin-block: 14px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 6px; font-size: 12.5px; color: var(--muted); }

/* sections */
main { padding-block: 22px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.sec-head h2 { font-size: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.search { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 6px; padding: 7px 10px; font: inherit; min-width: 0; width: 220px; max-width: 100%; }

.front { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
.lead { display: grid; gap: 10px; cursor: pointer; }
.lead h2 { font-size: clamp(28px, 4.5vw, 44px); letter-spacing: -.02em; }
.lead p { font-family: var(--font-body); font-size: 18px; margin: 0; color: var(--fg); }
.pic { aspect-ratio: 16 / 9; max-width: 100%; border-radius: 4px; position: relative; overflow: hidden; background: var(--sea); }
.pic svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.briefs { border-left: 1px solid var(--line); padding-left: 24px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.brief { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.brief h3 { font-size: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.tag { color: var(--alert); font-weight: 500; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; display: grid; align-content: start; overflow: hidden; min-width: 0; }
.card .body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.card h3 { font-size: 19px; }
.card p { margin: 0; font-family: var(--font-body); color: var(--muted); font-size: 15px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.save { border: 0; background: none; font-size: 12px; font-family: var(--font-mono); color: var(--muted); padding: 2px 0; }
.save[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.badge { display: inline-block; border: 1px solid currentColor; border-radius: 3px; padding: 0 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.badge.sale { color: var(--accent); } .badge.rent { color: var(--ok); } .badge.review { color: var(--alert); } .badge.ok { color: var(--ok); }
.ad { border: 1px dashed var(--muted); border-radius: 6px; padding: 14px; display: grid; gap: 4px; background: var(--surface); }
.plus { background: var(--fg); color: var(--bg); border-radius: 6px; padding: 18px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-top: 28px; }
.plus h3 { font-size: 22px; } .plus p { margin: 4px 0 0; opacity: .8; font-size: 14px; }
.plus .btn { border-color: var(--bg); }

/* article */
.article { max-width: 700px; margin-inline: auto; display: grid; gap: 14px; }
.article h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -.02em; }
.article .text { font-family: var(--font-body); font-size: 19px; line-height: 1.65; display: grid; gap: 14px; }
.article .text p { margin: 0; }
.comments { border-top: 2px solid var(--fg); padding-top: 14px; display: grid; gap: 12px; }
.comment { border-bottom: 1px solid var(--line); padding-bottom: 10px; font-size: 14px; }
.comment b { font-family: var(--font-mono); font-size: 12px; }
textarea, input[type=text], select { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 6px; padding: 8px 10px; font: inherit; }
textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }

/* map */
.mapbox { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.map { background: var(--sea); border: 1px solid var(--line); border-radius: 6px; padding: 0; overflow: hidden; }
.map svg { width: 100%; max-height: 74vh; display: block; }
.land { fill: var(--land); stroke: var(--muted); stroke-width: .8; }
.pin { cursor: pointer; }
.pin circle { stroke: var(--surface); stroke-width: 2; }
.pin text { font-family: var(--font-ui); font-size: 11px; font-weight: 600; fill: var(--fg); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; }
.pin[aria-pressed="true"] circle { stroke: var(--fg); stroke-width: 3; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: grid; gap: 10px; min-width: 0; }
.panel h3 { font-size: 22px; }

/* newsroom */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.q-item { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 12px; display: grid; gap: 8px; }
.q-item p { margin: 0; font-family: var(--font-body); font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { border: 1px dashed var(--line); border-radius: 6px; padding: 18px; color: var(--muted); font-size: 14px; }
.role-note { background: var(--surface); border-left: 4px solid var(--sun); padding: 10px 14px; font-size: 14px; border-radius: 0 6px 6px 0; margin-bottom: 18px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 6px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; z-index: 40; }
.modal { background: var(--surface); border-radius: 8px; padding: 20px; width: min(420px, 100%); display: grid; gap: 12px; }
.foot { margin-top: 36px; padding-top: 16px; border-top: 2px solid var(--fg); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .front, .mapbox, .desk { grid-template-columns: minmax(0, 1fr); }
  .briefs { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .sec-head h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: no-preference) { .card, .brief { transition: transform .15s; } .card:hover { transform: translateY(-2px); } }

/* connected-version additions */
[hidden] { display: none !important; }
.stack { display: grid; gap: 12px; min-width: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.note { font-size: 13px; color: var(--muted); }
.err { color: var(--alert); font-size: 14px; min-height: 1.2em; }
.linkbtn { background: none; border: 0; color: var(--accent); text-decoration: underline; padding: 0; font-size: 13px; justify-self: start; }
.modal .note { margin: 0; }
html { color-scheme: light; }
body { margin: 0; }
img { max-width: 100%; }
.worldbar { margin-bottom: 18px; max-width: 320px; }
.source { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); border-radius: 6px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.source .note { flex-basis: 100%; }
a.btn { text-decoration: none; display: inline-block; }

/* archive and listing management */
.arch-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
.arch-month { font-size: 20px; margin: 22px 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--fg); }
.arow { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.arow:hover h3 { text-decoration: underline; }
.adate { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding-top: 4px; }
.arow h3 { font-size: 18px; margin: 2px 0; }
.arow p { margin: 0; font-family: var(--font-body); color: var(--muted); font-size: 15px; }
.abody { min-width: 0; }
.arch-more { margin-top: 18px; text-align: center; }
.archive-link { margin-top: 20px; }
@media (max-width: 760px) { .arch-filters { grid-template-columns: minmax(0, 1fr); } .arow { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* real map */
.leafmap { height: min(72vh, 640px); min-height: 380px; background: var(--sea); }
.leaflet-container { font: inherit; }
.pinicon span { display: block; width: 22px; height: 22px; margin: 2px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--fg), 0 1px 4px rgba(0, 0, 0, .4); }
.pin-n span { border-radius: 50%; background: var(--alert); }
.pin-g span { border-radius: 3px; background: var(--accent); transform: rotate(45deg) scale(.88); }
.pin-e span { border-radius: 4px; background: var(--ok); }
.pinicon.sel span { box-shadow: 0 0 0 3px var(--fg), 0 1px 6px rgba(0, 0, 0, .5); }
.agcluster div { width: 40px; height: 40px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; border: 3px solid var(--surface); box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.agcluster span { font-family: var(--font-mono); font-weight: 500; font-size: 13px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88); } }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88); }
@media (max-width: 760px) { .leafmap { height: 56vh; min-height: 320px; } }

/* alerts dialog */
fieldset.topics { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: 18px; height: 18px; }
