/* The Dashboard page (src/dash/dash-twin.js). It reuses the Water Quality page's classes (.wqx-*, styles/modules/wq-twin.css)
   for cards, tables, tabs, search and the pop-up; only what is new is here, under .dsx.
   Colour is tokens only. Flow bands are a diverging scale: one warm hue for low, one cool hue for high, a neutral
   midpoint. Drought classes are the theme's --guide-color-drought-* (the Drought Monitor's own map colours). */

.dsx {
  --dsx-f-very-low: var(--guide-color-brick);
  --dsx-f-low: var(--guide-color-ochre-fill);
  --dsx-f-usual: var(--guide-color-neutral-300);
  --dsx-f-high: color-mix(in srgb, var(--guide-color-lake) 60%, var(--guide-color-paper));
  --dsx-f-very-high: var(--guide-color-lake);
  --dsx-map-ground: var(--guide-color-bg-1);
}
[data-theme="dark"] .dsx {
  --dsx-f-usual: var(--guide-color-neutral-600);
  --dsx-f-high: color-mix(in srgb, var(--guide-color-lake) 60%, var(--guide-color-neutral-800));
}
#dash-twin { padding: 12px 16px 0; max-width: 1240px; margin: 0 auto; }

.dsx-big { max-width: 40em; font-size: clamp(20px, 3.6vw, 30px); }
.dsx .wqx-tile b { font-size: var(--guide-fs-2xl); }
.dsx .wqx-tile b i { font-style: normal; font-weight: 500; font-size: var(--guide-fs-md); color: var(--guide-color-ink-soft); }
.dsx .wqx-tile b.dsx-quiet { font-size: var(--guide-fs-xl); color: var(--guide-color-ink-soft); }
.dsx-asof { margin-top: 6px; }
.dsx-asof.is-old { color: var(--guide-color-ink); font-weight: 600; }
.dsx-lede { margin: 0 0 12px; line-height: 1.5; max-width: 62em; }
.dsx-lede b { font-weight: 700; }
.dsx-facts, .dsx-steps, .dsx-contacts { margin: 12px 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.5; max-width: 70em; }
.dsx-contacts { list-style: none; padding-left: 0; }
.dsx-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsx .wqx-table .wqx-link { text-align: left; }
.dsx .wqx-table td, .dsx .wqx-table th { overflow-wrap: break-word; word-break: normal; }
.dsx .wqx-table th[scope="row"] { text-align: left; font-weight: 600; font-size: inherit; color: var(--guide-color-ink); padding: 8px; border-bottom: 1px solid var(--guide-color-border-subtle); vertical-align: top; }
.dsx-lawgroup { margin: 16px 0 8px; font-size: var(--guide-fs-sm); font-weight: 600; color: var(--guide-color-ink-soft); }
.dsx-lawgroup:first-of-type { margin-top: 0; }

/* part-to-whole bar: 2px surface gaps do the separating, no strokes */
.dsx-segbar { display: flex; gap: 2px; height: 28px; }
.dsx-seg { min-width: 4px; border-radius: 4px; }
.dsx-seg:focus-visible, .dsx-meter:focus-visible { outline: 2px solid var(--guide-color-signal); outline-offset: 2px; }
.dsx-meter { height: 10px; min-width: 90px; border-radius: 0 4px 4px 0; background: var(--guide-color-bg-2); overflow: hidden; }
.dsx-meter span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.dsx-meter--none { background: repeating-linear-gradient(90deg, var(--guide-color-border-default) 0 4px, transparent 4px 8px); height: 2px; margin: 4px 0; }
.dsx-chip { display: inline-flex; align-items: center; gap: 7px; }
.dsx-chip i, .dsx-verdict i { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.dsx-verdict { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: var(--guide-fs-lg); font-weight: 600; line-height: 1.35; }
.dsx-key-unranked { background: transparent; border: 1.5px solid var(--guide-color-neutral-400); border-radius: 50%; }

/* charts */
.dsx-svg { width: 100%; height: auto; display: block; overflow: visible; }
.dsx-grid { stroke: var(--guide-color-border-subtle); stroke-width: 1; }
.dsx-tick { fill: var(--guide-color-ink-muted); font-size: 12px; }
.dsx-hit { fill: transparent; outline: none; }
.dsx-hit:hover, .dsx-hit:focus-visible { fill: color-mix(in srgb, var(--guide-color-ink) 8%, transparent); }
.dsx-line { fill: none; stroke: var(--guide-color-lake); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dsx-median { fill: none; stroke: var(--guide-color-ink-muted); stroke-width: 1; }
.dsx-band { fill: color-mix(in srgb, var(--guide-color-ink) 14%, transparent); }
.dsx-band-wide { fill: color-mix(in srgb, var(--guide-color-ink) 7%, transparent); }
.dsx-end { fill: var(--guide-color-lake); stroke: var(--guide-color-paper); stroke-width: 2; }
.dsx .wqx-legend i.dsx-key-line { height: 2px; background: var(--guide-color-lake); border-radius: 0; }
.dsx .wqx-legend i.dsx-key-median { height: 1px; background: var(--guide-color-ink-muted); border-radius: 0; }
.dsx .wqx-legend i.dsx-key-band { background: color-mix(in srgb, var(--guide-color-ink) 20%, transparent); }
.dsx .wqx-legend i.dsx-key-band-wide { background: color-mix(in srgb, var(--guide-color-ink) 8%, transparent); }
.dsx .wqx-legend i.dsx-key-snow { border-radius: 50%; background: color-mix(in srgb, var(--guide-color-lake) 35%, transparent); border: 1px solid var(--guide-color-lake); }
.dsx .wqx-legend i.dsx-key-unranked { background: transparent; border-radius: 50%; border: 1.5px solid var(--guide-color-neutral-400); }

/* this week by basin */
.dsx-brief, .dsx-facts-row { list-style: none; margin: 0; padding: 0; }
.dsx-brief-row { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: 6px 16px; padding: 10px 0; border-bottom: 1px solid var(--guide-color-border-subtle); }
.dsx-facts-row { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.dsx-fact { display: grid; gap: 1px; outline: none; }
.dsx-fact:focus-visible { outline: 2px solid var(--guide-color-signal); outline-offset: 2px; }
.dsx-fact small { font-size: var(--guide-fs-xs); color: var(--guide-color-ink-muted); }
.dsx-fact.is-missing span { color: var(--guide-color-ink-soft); font-style: italic; }
@media (max-width: 640px) { .dsx-brief-row { grid-template-columns: minmax(0, 1fr); } }

/* map */
.dsx-mapwrap { border-radius: 12px; overflow: hidden; }
.dsx-map { width: 100%; height: auto; display: block; }
.dsx-county { stroke: var(--guide-color-border-strong); stroke-width: 0.6; cursor: pointer; outline: none; }
.dsx-county:hover, .dsx-county:focus-visible { stroke: var(--guide-color-ink); stroke-width: 1.6; }
.dsx-county.is-on { stroke: var(--guide-color-ink); stroke-width: 2.2; }
.dsx-gauge { stroke: var(--guide-color-paper); stroke-width: 2; cursor: pointer; outline: none; }
.dsx-gauge.is-unranked { fill: var(--guide-color-paper); stroke: var(--guide-color-neutral-400); stroke-width: 1.2; }
.dsx-gauge.is-quiet { fill: var(--guide-color-ink-muted); stroke: none; }
.dsx-gauge:hover, .dsx-gauge:focus-visible, .dsx-gauge.is-on { stroke: var(--guide-color-ink); stroke-width: 2; }
.dsx-snow { fill: color-mix(in srgb, var(--guide-color-lake) 35%, transparent); stroke: var(--guide-color-lake); stroke-width: 1; outline: none; }
.dsx-snow:hover, .dsx-snow:focus-visible { stroke: var(--guide-color-ink); stroke-width: 2; }

/* search result kinds: a shape cue beside the label, which also names the kind in words */
.dsx-kind-county, .dsx-kind-town { background: var(--guide-color-ink-soft); border-radius: 2px; }
.dsx-kind-watershed { background: var(--guide-color-lake); border-radius: 2px; }
.dsx-kind-gauge { background: var(--guide-color-lake); }

@media (max-width: 640px) {
  #dash-twin { padding: 8px 12px 0; }
  .dsx-meter { min-width: 56px; }
  /* a table row becomes a small card: the name on its own line, the figures beside each other under it */
  .dsx .wqx-table, .dsx .wqx-table tbody { display: block; }
  .dsx .wqx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dsx .wqx-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; gap: 4px 18px; padding: 10px 0; border-bottom: 1px solid var(--guide-color-border-subtle); }
  .dsx .wqx-table td, .dsx .wqx-table th[scope="row"] { display: block; padding: 0; border: 0; text-align: left; }
  .dsx .wqx-table td:first-child, .dsx .wqx-table th[scope="row"] { grid-column: 1 / -1; }
  .dsx .wqx-table.dsx-compare td::before { content: attr(data-label); display: block; font-size: var(--guide-fs-xs); color: var(--guide-color-ink-muted); white-space: normal; }
}
@media print {
  .dsx .wqx-pager, .dsx-hit { display: none !important; }
  .dsx-county { stroke: var(--guide-color-ink); }
}
