/*
 * RTL-first. Layout uses logical properties throughout (margin-inline-start,
 * not margin-left) so the whole sheet works unchanged if dir flips to ltr.
 */

/* Default theme: "Clouds" - calm blue, the same on mobile and desktop. There
   used to be a second, unrelated look forced onto small screens only; that
   split is gone; the only other look now is an explicit opt-in, see
   [data-theme="fashion"] near the end of this file. */
:root {
  --bg: #f5f9fd;
  --fg: #182634;
  --muted: #4c6178;
  --border: #d7e4f0;
  --accent: #2f7bc4;
  --surface: #eaf3fb;
  --danger: #b3261e;
  --radius: 8px;
  --maxw: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Night sky, not black - kept dark mode from feeling like an unrelated
       theme of its own. */
    --bg: #111927;
    --fg: #e8eff7;
    --muted: #a9bccf;
    --border: #263a4a;
    --accent: #7fb8ee;
    --surface: #17212f;
    --danger: #f2766b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, "Segoe UI", Arial, sans-serif;
}

.wrap { max-width: var(--maxw); margin-inline: auto; padding: 1.5rem 1rem 4rem; }

header.site {
  border-block-end: 1px solid var(--border);
  /* A calm sky, not a flat fill - the one "shine" the default theme gets,
     quiet enough to still read as calm rather than decorative. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface));
}
/* wrap, not nowrap: three items (title, byline, meta) plus a long Hebrew
   h1 in uppercase tracking on a narrow phone would otherwise overflow the
   header sideways instead of dropping to a second line. */
header.site .wrap { padding-block: 1rem; display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem 1rem; }
header.site h1 { font-size: 1.15rem; margin: 0; }
header.site a { color: var(--accent); text-decoration: none; font-size: .9rem; }
/* An attribution line, not a headline - kept quiet on purpose. */
header.site .site-by { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); }
/* Quieter still than the byline it sits under - a caveat, not a warning. */
header.site .site-disclaimer { font-size: .7rem; opacity: .8; }

/* Pushes itself (and the probed-timestamp span after it) to the far end of
   the header row, away from the title cluster. */
.theme-pick { display: flex; gap: .3rem; margin-inline-start: auto; }
.theme-pick button {
  font-size: .72rem;
  padding: .3rem .65rem;
  border-radius: 999px;
}
.theme-pick button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Mixed Hebrew/Latin content reorders incorrectly without per-element dir.
   Anything holding API-sourced text gets dir="auto" in the markup. */
[dir="auto"] { unicode-bidi: plaintext; }

input[type="search"], input[type="text"], select {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  inline-size: 100%;
}

.searchbar { display: flex; gap: .5rem; margin-block-end: 1.25rem; }
.searchbar input { flex: 1; }

button {
  font: inherit;
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-block-end: .75rem;
}
.card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.card h3 a { color: var(--accent); text-decoration: none; }
.card p { margin: .25rem 0; color: var(--muted); font-size: .9rem; }

.meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; color: var(--muted); }
.tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .55rem;
}

.notice { padding: .8rem 1rem; border-radius: var(--radius); margin-block-end: 1rem; }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid var(--danger); }
.notice.info  { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }

.skeleton { color: var(--muted); padding: 2rem 0; }

/* ---------- API map ---------- */

.lead { color: var(--muted); max-inline-size: 62ch; margin-block-end: 1.5rem; }

.controls { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-block-end: .75rem; }
.controls input[type="search"] { flex: 1; min-inline-size: 15rem; }
.check { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.check input { inline-size: auto; }

#summary { margin-block-end: 1rem; }

.api-head { display: flex; align-items: baseline; gap: .75rem; justify-content: space-between; }

/* Status colour is carried by a text label too, not colour alone. */
.badge {
  font-size: .75rem;
  padding: .15rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid;
}
.badge.ok      { color: #1a7f45; border-color: #1a7f45; background: color-mix(in srgb, #1a7f45 10%, transparent); }
.badge.warn    { color: #9a6700; border-color: #9a6700; background: color-mix(in srgb, #9a6700 10%, transparent); }
.badge.bad     { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.badge.limited { color: #6d4aa8; border-color: #6d4aa8; background: color-mix(in srgb, #6d4aa8 10%, transparent); }
.badge.unknown { color: var(--muted); border-color: var(--border); }

@media (prefers-color-scheme: dark) {
  .badge.ok      { color: #5fce8f; border-color: #2f7d4f; }
  .badge.warn    { color: #e0b341; border-color: #7d652f; }
  .badge.limited { color: #b79ae8; border-color: #5c4487; }
}

/* Left border repeats the verdict for scanning down the list. */
.card.api { border-inline-start-width: 3px; }
.card.api.ok   { border-inline-start-color: #1a7f45; }
.card.api.warn { border-inline-start-color: #9a6700; }
.card.api.bad  { border-inline-start-color: var(--danger); }
.card.api.limited { border-inline-start-color: #6d4aa8; }

/* ---------- top view ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: .6rem;
  margin-block-end: 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  text-align: start;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-inline-start-width: 3px;
  border-radius: var(--radius);
  background: var(--bg);
}
button.stat { cursor: pointer; }
.stat-n { font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { font-size: .8rem; color: var(--muted); }

.stat.ok      { border-inline-start-color: #1a7f45; }
.stat.warn    { border-inline-start-color: #9a6700; }
.stat.limited { border-inline-start-color: #6d4aa8; }
.stat.bad     { border-inline-start-color: var(--danger); }
.stat.unknown { border-inline-start-color: var(--muted); }
.stat.active  { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- committees.html: filter row + expanded document list ---------- */

/* Several label+control pairs (each already an .acc-year-pick) wrapping
   together as one row, rather than one control per line. */
.cm-filters { display: flex; flex-wrap: wrap; gap: 0 1.5rem; align-items: flex-end; }
/* .acc-year-pick's own flex-wrap is for a single lone group; several of them
   sharing one row need each group's label+control to stay paired, so only the
   row as a whole (.cm-filters) wraps, never a label away from its control. */
.cm-filters .acc-year-pick { margin-block-end: .75rem; flex-wrap: nowrap; }
#cmSearch, #cmSite { min-inline-size: 18rem; }

.cm-doclist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.cm-doclist a { color: var(--accent); }

.cm-script-wrap { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.cm-script {
  inline-size: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.5;
  padding: .75rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

/* ---------- page sections (ערים / כלל הארץ) ---------- */

.acc-section { margin-block-end: 2.5rem; }
.acc-section > h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-block-end: .4rem;
  border-block-end: 1px solid var(--border);
}
/* The per-city year breakdown: a plain data table, kept to a readable width
   rather than stretched across the whole page like the live records table. */
#cityTable { max-inline-size: 32rem; }
#cityTable .matrix { font-variant-numeric: tabular-nums; }
#cityTable .matrix tbody th { font-weight: 600; }

/* ---------- fatalities-by-year chart ---------- */

/* The two year charts sit side by side and wrap to a stack when the row gets
   too narrow for both to keep readable bar widths. */
.acc-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  margin-block-end: 1.25rem;
}
.acc-charts .acc-chart { flex: 1 1 20rem; margin: 0; }

.acc-chart { margin: 0 0 1.25rem; }
/* The "all accidents" chart is the neutral-magnitude twin of the red "killed"
   one, so its bars take the accent hue instead of danger. */
.acc-chart.total .acc-bar-fill { background: var(--accent); }
.acc-chart figcaption {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin-block-end: .75rem;
}
.acc-bars {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  max-inline-size: 32rem;
}
.acc-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}
/* Fixed-height track; the fill grows from the shared zero baseline, so the
   value label - the first flex child - rides right on top of each bar. */
.acc-bar-track {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  block-size: 150px;
  inline-size: 100%;
}
.acc-bar-v {
  font-size: .8rem;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  margin-block-end: .2rem;
}
.acc-bar-fill {
  inline-size: 100%;
  max-inline-size: 3rem;
  border-radius: 4px 4px 0 0;
  background: var(--danger);
}
.acc-bar-y { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* When a single year is picked, its bar stays lit and the others recede,
   so the chart echoes the dropdown selection. */
.acc-bars:has(.acc-bar.active) .acc-bar { opacity: .4; }
.acc-bars:has(.acc-bar.active) .acc-bar.active { opacity: 1; }

/* The table is the widest thing on the page; it scrolls, the body never does. */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

.matrix { border-collapse: collapse; inline-size: 100%; font-size: .85rem; }
.matrix th, .matrix td { padding: .45rem .7rem; text-align: start; white-space: nowrap; }
.matrix thead th {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border-block-end: 1px solid var(--border);
  position: sticky;
  inset-block-start: 0;
}
/* A 50-row preview must not push the rest of the page down: it gets its own
   viewport and scrolls inside it. The sticky thead above keeps the headers -
   and therefore the sort controls - reachable while scrolled. */
.matrix-wrap.scroll { max-block-size: 26rem; overflow-y: auto; }

/* Only columns the server can sort by are interactive - see headCell(). */
.matrix th.sortable { cursor: pointer; user-select: none; }
.matrix th.sortable:hover { color: var(--fg); }
.matrix th.sortable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.matrix th.sorted { color: var(--accent); }
.s-mark { font-size: .7em; margin-inline-start: .3rem; opacity: .45; }
.matrix th.sorted .s-mark { opacity: 1; }

.matrix tr.grp th {
  font-size: .8rem;
  background: var(--surface);
  border-block: 1px solid var(--border);
}
.grp-sub { font-weight: 400; color: var(--muted); font-size: .75rem; }

.matrix tr.row { cursor: pointer; border-block-end: 1px solid var(--border); }
.matrix tr.row:hover, .matrix tr.row:focus-visible { background: var(--surface); outline: none; }
.matrix tr.row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.matrix tr.row td:first-child { border-inline-start: 3px solid transparent; font-weight: 500; }
.matrix tr.row.ok      td:first-child { border-inline-start-color: #1a7f45; }
.matrix tr.row.warn    td:first-child { border-inline-start-color: #9a6700; }
.matrix tr.row.limited td:first-child { border-inline-start-color: #6d4aa8; }
.matrix tr.row.bad     td:first-child { border-inline-start-color: var(--danger); }
.matrix tr.row.unknown td:first-child { border-inline-start-color: var(--border); }

/* Jump target needs to announce itself - the card is mid-page and looks like its neighbours. */
.card.api.flash { background: color-mix(in srgb, var(--accent) 10%, transparent); transition: background .4s; }

/* ---------- portal grid ---------- */

.section { font-size: 1rem; margin-block: 2rem .75rem; color: var(--muted); font-weight: 600; }
.section:first-of-type { margin-block-start: 0; }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .75rem;
}

.portal {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  text-align: start;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}
.portal:hover { border-color: var(--accent); }
.portal.active { border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }

.p-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.p-name { font-weight: 600; }
.p-sub  { font-size: .78rem; color: var(--muted); }
.p-about { font-size: .85rem; color: var(--muted); line-height: 1.45; }

/* ---------- apps: big, welcoming, nothing that reads as a URL ----------
   No title/subtitle/description text, no arrow-hint line - an icon and a
   name, styled as a destination to tap rather than a link to read. Fixed
   light colours rather than the page's own theme variables: the point is
   to stand out as an inviting button regardless of which of the two site
   themes (or accidents.html's own warning mood) happens to be active. */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: .85rem;
}
.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-align: center;
  text-decoration: none;
  padding: 1.5rem 1rem;
  border-radius: 1.1rem;
  border: 1px solid #f0d9bc;
  background: linear-gradient(160deg, #fffaf3, #ffe6c2);
  color: #3a2c17;
  box-shadow: 0 3px 10px -6px rgba(0, 0, 0, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.app-tile:hover, .app-tile:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .4);
}
.app-icon { font-size: 2.3rem; line-height: 1; }
.app-name { font-weight: 600; font-size: .95rem; }

/* ---------- "continue" disclosure past the portals ----------
   Native <details>/<summary>: no JS toggle to write or keep accessible,
   the browser already handles open/closed and keyboard use. The `open`
   attribute ships in the markup so desktop (and no-JS/no-CSS clients)
   just see the full page; only the mobile media query below closes it
   by default and gives the summary a tap target worth pressing. */
.more summary.more-toggle {
  list-style: none;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
  margin-block: .5rem 1.25rem;
}
.more summary.more-toggle::-webkit-details-marker { display: none; }
.more[open] summary.more-toggle { display: none; }

/* ---------- live explorer ---------- */

.toggle-ex { font-size: .85rem; padding: .35rem .7rem; margin-block-start: .5rem; }

.explorer {
  margin-block-start: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem;
  background: var(--surface);
}
.ex-bar { display: flex; gap: .4rem; align-items: stretch; flex-wrap: wrap; }
.ex-method {
  font-size: .78rem; font-weight: 600;
  padding: .5rem .6rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--accent);
  text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.ex-method:hover { border-color: var(--accent); }
.ex-method.disabled { pointer-events: none; opacity: .5; color: var(--muted); }
.ex-method.static { color: var(--muted); cursor: default; }
.ex-url { flex: 1; min-inline-size: 12rem; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }
.ex-status { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-block: .6rem .4rem; }

.ex-out pre {
  margin: 0;
  max-block-size: 22rem;
  overflow: auto;              /* long responses scroll inside the panel */
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem;
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre;
}
.j-key  { color: var(--accent); }
.j-str  { color: #1a7f45; }
.j-num  { color: #9a6700; }
.j-bool { color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .j-str { color: #5fce8f; }
  .j-num { color: #e0b341; }
}

/* Endpoints are LTR inside an RTL page; they must scroll, not widen it. */
.endpoint { overflow-x: auto; }
.endpoint code {
  font-size: .82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .15rem .4rem;
  white-space: nowrap;
}

/* ---------- data.gov.il explorer ---------- */

.ckan { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.ckan .lead { margin-block-start: 0; font-size: .92rem; }

.ck-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-block-end: .8rem; font-size: .85rem; }
.ck-crumb {
  font: inherit; font-size: .85rem; padding: .15rem .4rem; cursor: pointer;
  color: var(--accent); background: none; border: none; border-radius: 4px; text-decoration: underline;
}
.ck-crumb:hover { background: var(--surface); }
.ck-here { color: var(--muted); }
.ck-sep { color: var(--muted); }

.ck-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-block-end: .6rem; }
.ck-controls input[type="search"] { flex: 1 1 14rem; font-size: .9rem; padding: .45rem .65rem; }
.ck-controls input[type="search"]:disabled { opacity: .5; cursor: not-allowed; }
.ck-controls select {
  font: inherit; font-size: .82rem; padding: .35rem .5rem; max-inline-size: 100%;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.ck-count { font-size: .85rem; color: var(--muted); margin-block-end: .6rem; }

/* min(17rem, 100%) rather than a bare 17rem: below a 17rem viewport the track
   would otherwise stay 17rem wide and push the page sideways. */
.ck-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: .6rem; }
.ck-card {
  display: flex; flex-direction: column; gap: .3rem; text-align: start; cursor: pointer;
  padding: .7rem .8rem; font: inherit;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  /* A `1fr` track floors at min-content, so one long unbroken string in a title
     or description widens the track past the viewport and scrolls the whole
     page - measured at 85px over on a 380px screen. These two lines are what
     stop dataset text from dictating the layout. */
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.ck-card:hover { background: var(--surface); border-color: var(--accent); }
.ck-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ck-title { font-weight: 600; font-size: .92rem; }
.ck-org { font-size: .78rem; color: var(--muted); }
.ck-notes { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.ck-meta { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-block-start: .2rem; }
.ck-n { font-size: .72rem; color: var(--muted); }

.ck-detail h3 { margin-block: 0 .6rem; font-size: 1.05rem; }
.ck-detail h4 { margin-block: 1.2rem .5rem; font-size: .9rem; color: var(--muted); }
.ck-facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; margin: 0 0 .8rem; font-size: .85rem; }
.ck-facts dt { color: var(--muted); }
.ck-facts dd { margin: 0; }
.ck-desc { font-size: .88rem; line-height: 1.6; white-space: pre-wrap; }
.ck-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.ck-open {
  font: inherit; font-size: .76rem; padding: .2rem .55rem; cursor: pointer;
  color: var(--bg); background: var(--accent); border: 1px solid var(--accent); border-radius: 999px;
}
.ck-open:hover { filter: brightness(1.1); }
.ck-nodata { font-size: .72rem; color: var(--muted); }
/* Built in the browser from the DataStore, so it actually produces a file -
   unlike the resource's own URL, which the WAF answers with a challenge page. */
.ck-dl {
  font: inherit; font-size: .76rem; padding: .2rem .55rem; cursor: pointer; white-space: nowrap;
  color: var(--accent); background: var(--bg); border: 1px solid var(--accent); border-radius: 999px;
}
.ck-dl:hover:not(:disabled) { background: var(--surface); }
.ck-dl:disabled { opacity: .6; cursor: progress; }

/* The record table: one column per field, so it is wide by nature. */
.ck-rec th { vertical-align: top; }
.ck-type { display: block; font-size: .65rem; font-weight: 400; color: var(--muted); }
.ck-fil th { padding: .25rem .35rem; background: var(--surface); position: sticky; inset-block-start: 3.1rem; }
.ck-fil input {
  inline-size: 100%; min-inline-size: 6rem; font: inherit; font-size: .75rem; padding: .2rem .35rem;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
}
.ck-rec tbody td { border-block-end: 1px solid var(--border); max-inline-size: 22rem; overflow: hidden; text-overflow: ellipsis; }

/* ---------- portal drill-in ---------- */

.p-open { font-size: .8rem; color: var(--accent); margin-block-start: .2rem; }

.drill {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-block: 1rem 0;
  background: var(--surface);
}
.drill-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.drill-head h2 { font-size: 1.05rem; margin: 0; }
.drill-title { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.drill-home { font-size: .78rem; color: var(--accent); text-decoration: none; white-space: nowrap; }
.drill-home:hover { text-decoration: underline; }
.drill-close { font-size: .8rem; padding: .25rem .6rem; }
.drill-sub { font-size: .85rem; color: var(--muted); margin-block: .2rem .6rem; }

/* The request is shown so the result can be reproduced outside the page. */
/* The preview stops at the catalogue; this points at the page that does not. */
/* No color rule here used to mean "whatever the browser's default link
   color is" - fine on a white desktop background, but the mobile theme's
   near-black bg turned that default (a dark visited-link purple) almost
   unreadable. Same accent as every other link on the page. */
.drill-more { margin-inline-start: .5rem; font-size: .8rem; white-space: nowrap; color: var(--accent); }

.drill-url { margin-block: .6rem 0; overflow-x: auto; }
.drill-url code { font-size: .74rem; color: var(--muted); white-space: nowrap; }

/* Preview tables hold prose, unlike the API matrix - let long values wrap
   inside a bounded cell instead of stretching the table off-screen. */
.matrix.preview td { white-space: normal; max-inline-size: 22rem; }
.matrix.preview td.ident { font-weight: 500; }
.matrix.preview tbody tr:nth-child(even) { background: color-mix(in srgb, var(--fg) 3%, transparent); }

/* Filter box inside a portal drill-in. */
.drill-filter { display: flex; gap: .5rem; align-items: center; margin-block-end: .7rem; }
/* Same treatment as .ck-dl in the data.gov.il explorer: built here from
   DataStore records, so it downloads exactly what's filtered on screen. */
.drill-dl {
  font: inherit; font-size: .76rem; padding: .2rem .55rem; cursor: pointer; white-space: nowrap;
  color: var(--accent); background: var(--bg); border: 1px solid var(--accent); border-radius: 999px;
}
.drill-dl:hover:not(:disabled) { background: var(--surface); }
.drill-dl:disabled { opacity: .6; cursor: progress; }
/* Offset paging. Server-side `start`, so these move through the whole result
   set rather than through what was already fetched. */
.pager { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-block-start: .7rem; }
.pager .pg {
  font: inherit;
  font-size: .82rem;
  padding: .25rem .6rem;
  min-inline-size: 2.2rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.pager .pg:hover:not(:disabled) { background: var(--surface); }
.pager .pg:disabled { color: var(--muted); cursor: default; opacity: .55; }
.pager .pg.cur {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.pg-gap { color: var(--muted); padding-inline: .1rem; }

/* Column filters. Each is one fq clause, so they compose with the search box. */
.drill-cols { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-block-end: .7rem; }
.drill-cols select {
  font: inherit;
  font-size: .82rem;
  padding: .3rem .5rem;
  max-inline-size: 100%;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.drill-filter input[type="search"] { flex: 1; font-size: .9rem; padding: .45rem .65rem; }
/* Server-side vs local is not cosmetic: it says whether you are searching the
   whole collection or only the rows already fetched. */
.drill-scope {
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .55rem;
  white-space: nowrap;
}

/* Expandable rows: a dataset opens into its downloadable files. */
.matrix.preview.expandable tr.has-files { cursor: pointer; }
.matrix.preview.expandable tr.has-files:hover,
.matrix.preview.expandable tr.has-files:focus-visible { background: var(--surface); outline: none; }
.matrix.preview.expandable tr.has-files:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.matrix.preview .c-x { inline-size: 1.6rem; text-align: center; }
.x-mark { color: var(--muted); font-size: .8rem; }
.matrix.preview tr.files-row td { background: var(--surface); padding: .5rem .7rem; }

.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.files a {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-decoration: none;
  color: var(--fg);
  font-size: .85rem;
}
.files a:hover { border-color: var(--accent); }
/* Format first and size up front: one of these is a 9 MB CSV. */
.f-fmt {
  font-size: .7rem; font-weight: 600; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: .05rem .35rem; min-inline-size: 3rem; text-align: center;
}
.f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-size { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.f-tag {
  font-size: .68rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: .05rem .45rem;
  white-space: nowrap;
}
.f-go { color: var(--accent); }
.files-note { font-size: .76rem; color: var(--muted); margin-block: .45rem 0; }
.slow-note { display: block; font-size: .78rem; color: var(--muted); margin-block-start: .25rem; }

/* ---------- legible by default, mobile and desktop alike ----------
   One design language everywhere, not a phone-only look and a separate
   desktop one: bigger type, higher-contrast muted text, roomier click
   targets, a stronger focus ring. This used to be desktop-only, paired
   with an unrelated dark/gold theme forced onto small screens; that split
   is gone; a phone and a laptop should feel like the same site. */
body { font-size: 1.1rem; line-height: 1.65; }

h1 { font-size: 1.3rem; }
.section { font-size: 1.05rem; }

button, input[type="search"], input[type="text"], select {
  font-size: 1rem;
  padding: .7rem .95rem;
}

.card, .portal, .stat { padding: 1rem 1.2rem; }
.portal-grid, .stat-row { gap: .85rem; }
.stat-n { font-size: 1.75rem; }
.stat-l { font-size: .88rem; }

.tag, .badge { font-size: .8rem; padding: .2rem .65rem; }

.matrix th, .matrix td { padding: .6rem .85rem; font-size: .92rem; }

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Small screens still need less padding and a shorter first screen - that's
   real estate, not a different design language, so it stays viewport-based
   while reading colour from whichever theme is active. */
@media (max-width: 640px) {
  .card, .portal, .stat { padding: .85rem 1rem; }
  .wrap { padding-block: 1.5rem 4.5rem; }

  /* The one button on the page meant to be found without scrolling first -
     filled rather than outlined, so it reads as the next step rather than
     one option among the portal cards above it. */
  .more summary.more-toggle {
    display: block;
    text-align: center;
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: .75rem 1rem;
    margin-block: 1.5rem;
    font-weight: 600;
  }
}

/* ---------- theme: fashion (opt-in) ----------
   The alternate look from the theme picker in the header - black, gold and
   serif, with a gold sheen on the title and on button hover/tap. Available
   at any screen size now, not forced onto phones: see src/theme.js for how
   [data-theme] gets set. */
[data-theme="fashion"] {
  --bg: #0d0b08;
  --fg: #f3ecdc;
  --muted: #b7a67f;
  --border: #3c3320;
  --accent: #ddb44f;
  --surface: #18140d;
  --danger: #d2685a;
  --radius: 3px;
  --font-display: Georgia, "David", "Times New Roman", serif;
}

[data-theme="fashion"] body { letter-spacing: .01em; }

/* Section titles and card/portal names carry the "fashion editorial" voice:
   serif, tracked, quiet weight. Everything that is UI chrome (buttons,
   tags, labels) stays sans but gains the same tracking instead - that
   split is what a fashion-house site actually looks like. */
[data-theme="fashion"] header.site h1,
[data-theme="fashion"] .section,
[data-theme="fashion"] .card h3, [data-theme="fashion"] .card h3 a,
[data-theme="fashion"] .p-name, [data-theme="fashion"] .ck-title,
[data-theme="fashion"] .drill-head h2,
[data-theme="fashion"] .ck-detail h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: .03em;
}

[data-theme="fashion"] header.site {
  background: radial-gradient(120% 140% at 20% 0%, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--bg) 65%);
  border-block-end: 1px solid var(--border);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 25%, transparent);
}
[data-theme="fashion"] header.site h1 {
  text-transform: uppercase;
  letter-spacing: .16em;
  background: linear-gradient(100deg, var(--accent) 0%, #fff6dc 22%, var(--accent) 45%, var(--muted) 65%, var(--accent) 85%);
  background-size: 250% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: fh-shine 7s ease-in-out infinite;
}
[data-theme="fashion"] header.site a { text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; }

[data-theme="fashion"] .section {
  display: flex; align-items: center; gap: .7rem;
  text-transform: uppercase; letter-spacing: .18em; font-weight: 400;
  color: var(--muted);
}
[data-theme="fashion"] .section::after { content: ''; flex: 1; block-size: 1px; background: var(--border); }

@keyframes fh-shine {
  0%, 100% { background-position: 220% 0; }
  50%      { background-position: -60% 0; }
}

/* Hairline borders + a soft gold lift on the surfaces that matter - cards,
   portals, stat tiles, the explorer panel. Status colour on the leading
   edge (.card.api, .stat, tr.row) is left alone: it's the one thing on the
   page carrying meaning, not decoration. */
[data-theme="fashion"] .card, [data-theme="fashion"] .portal, [data-theme="fashion"] .stat,
[data-theme="fashion"] .ckan, [data-theme="fashion"] .explorer, [data-theme="fashion"] .drill,
[data-theme="fashion"] .matrix-wrap, [data-theme="fashion"] .ck-card {
  background: linear-gradient(180deg, var(--surface), var(--bg));
  border-color: var(--border);
}
[data-theme="fashion"] .portal:hover, [data-theme="fashion"] .ck-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
[data-theme="fashion"] .portal.active, [data-theme="fashion"] .stat.active {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}

[data-theme="fashion"] .tag, [data-theme="fashion"] .badge, [data-theme="fashion"] .drill-scope,
[data-theme="fashion"] .ck-n, [data-theme="fashion"] .f-tag {
  text-transform: uppercase;
  letter-spacing: .05em;
}
[data-theme="fashion"] .badge.ok { box-shadow: 0 0 10px -4px color-mix(in srgb, #5fce8f 70%, transparent); }

/* Buttons: tracked uppercase, thin gold hairline, a sheen that sweeps on
   hover for a mouse and on :active for a thumb - a touch has no hover. */
[data-theme="fashion"] button, [data-theme="fashion"] .ex-method, [data-theme="fashion"] .ck-crumb {
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: .07em;
}
[data-theme="fashion"] button::after, [data-theme="fashion"] .ex-method::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, color-mix(in srgb, var(--accent) 55%, transparent) 50%, transparent 70%);
  background-size: 250% 100%;
  background-position: 150% 0;
  transition: background-position .7s ease;
  pointer-events: none;
}
[data-theme="fashion"] button:hover:not(:disabled)::after, [data-theme="fashion"] button:active:not(:disabled)::after,
[data-theme="fashion"] .ex-method:hover::after, [data-theme="fashion"] .ex-method:active::after { background-position: -50% 0; }

[data-theme="fashion"] button:hover:not(:disabled), [data-theme="fashion"] button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 4px 16px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}

[data-theme="fashion"] .ck-open, [data-theme="fashion"] .ck-dl, [data-theme="fashion"] .drill-dl,
[data-theme="fashion"] .pager .pg.cur {
  border-color: var(--accent);
  box-shadow: 0 4px 14px -8px color-mix(in srgb, var(--accent) 65%, transparent);
}

[data-theme="fashion"] input[type="search"], [data-theme="fashion"] input[type="text"], [data-theme="fashion"] select {
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
}
[data-theme="fashion"] input[type="search"]:focus, [data-theme="fashion"] input[type="text"]:focus,
[data-theme="fashion"] select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

[data-theme="fashion"] .lead { font-family: var(--font-display); line-height: 1.7; }

/* ---------- accidents.html: a distinct, sober mood ----------
   Its own page gets its own design, not a filtered variant of the other
   two - fatal-accident data doesn't suit calm blue or gold shine either
   one. A warning amber/red accent, overriding whichever base theme (clouds
   or fashion) is picked - deliberately higher specificity than
   [data-theme], so the mood here holds regardless of theme choice. Nearly
   every component (cards, buttons, badges, the pager) just inherits this
   through --accent already; nothing else needed rewriting. */
body.accidents-page {
  --accent: #b3541c;
}
@media (prefers-color-scheme: dark) {
  body.accidents-page { --accent: #e0913f; }
}
body.accidents-page header.site {
  border-block-end: 3px solid var(--accent);
  background:
    repeating-linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 14%, transparent) 0 14px, transparent 14px 28px),
    var(--surface);
}

/* committees.html reuses accidents-page's whole header treatment (striped
   background, centered title) but with its own neutral-gray mood instead of
   the accidents page's orange - a separate topic, not a severity/warning
   color, so it shouldn't borrow that page's caution tone. Same specificity
   as the rule above (one class + one element), so source order alone is
   what makes this win on pages carrying both classes. */
body.committees-page { --accent: #6b7280; }
@media (prefers-color-scheme: dark) {
  body.committees-page { --accent: #9ca3af; }
}

/* Centered on this page specifically - the map's header stays a normal
   start-aligned row with a byline/theme-pick/probed-stamp cluster; this
   page's header only has the title and controls, so a centered title reads
   as a page heading rather than a squeezed-in item in a row. */
body.accidents-page header.site .wrap { justify-content: center; text-align: center; }
body.accidents-page header.site h1 { inline-size: 100%; }

.acc-year-pick { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-block-end: 1.25rem; }
.acc-year-pick label { font-size: .9rem; color: var(--muted); }
.acc-year-pick select,
.acc-year-pick input {
  font: inherit;
  font-size: .9rem;
  padding: .35rem .6rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.acc-year-pick input { min-inline-size: 16rem; }

/* Shown in the city panel before a city is picked. */
.acc-hint { color: var(--muted); font-size: .9rem; margin: .5rem 0; }

[data-theme="fashion"] .more summary.more-toggle {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #000));
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 400;
}
