/*
 * Geluidskaart signature ("the calm acoustician": number first, then what it means in practice).
 * Load after kit.css + themes/geluidskaart.css.
 * Elements: map as hero with search card, dB scale strip (RIVM Lden classes + address marker + WHO line),
 * source bars (here vs national as a tick), band chip for tables/rankings.
 * The noise colours (--gk-q1..q7) are data: they appear only on the map, the scale and band chips.
 */

/* ---------- Map as hero: the map is the photo ---------- */
.zs-maphero { position: relative; background: var(--zs-brand-deep); }
.zs-maphero__map { height: clamp(20rem, 62vh, 38rem); background: var(--zs-surface-alt); }
.zs-maphero__map { position: relative; }
.zs-maphero__map > :first-child { height: 100%; }
.zs-maphero__card { background: var(--zs-surface); color: var(--zs-ink); padding: 1.25rem; border-bottom: 1px solid var(--zs-line); }
.zs-maphero__card h1 { font-size: clamp(1.7rem, 2vw + 1.2rem, 2.5rem); line-height: 1.1; }
.zs-maphero__card p { margin: .6rem 0 1rem; color: var(--zs-muted); }
.zs-maphero__search { display: flex; gap: .5rem; }
.zs-maphero__search input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: .65rem .75rem; min-height: 2.9rem; border: 1px solid var(--zs-ink); border-radius: var(--zs-radius-sm); background: #fff; color: var(--zs-ink); }
.zs-maphero__search input:focus-visible { outline: 3px solid var(--zs-accent); outline-offset: 1px; }
.zs-maphero__hint { font-size: .85rem; color: var(--zs-muted); margin: .5rem 0 0; }
@media (min-width: 56rem) {
  .zs-maphero__card { position: absolute; z-index: 600; top: 1.5rem; left: max(1.5rem, calc((100vw - 72rem) / 2)); width: 26rem; border: 1px solid var(--zs-line); border-radius: var(--zs-radius); box-shadow: 0 2px 10px rgb(16 38 47 / .18); }
}

/* Map legend: same classes as the dB scale, numbers in ink below the colours, never text on yellow. */
.zs-maplegend { display: inline-grid; grid-template-columns: repeat(7, 2.4rem); gap: 2px; background: var(--zs-surface); padding: .4rem .5rem .3rem; border-radius: var(--zs-radius-sm); font-size: .72rem; color: var(--zs-ink); box-shadow: 0 1px 4px rgb(16 38 47 / .25); }
.zs-maplegend span { display: block; height: .55rem; box-shadow: inset 0 0 0 1px rgb(24 36 46 / .18); }
.zs-maplegend small { grid-row: 2; text-align: center; font-variant-numeric: tabular-nums; }
.zs-maplegend .q1, .zs-db__scale .q1, .zs-band.q1::before { background: var(--gk-q1); }
.zs-maplegend .q2, .zs-db__scale .q2, .zs-band.q2::before { background: var(--gk-q2); }
.zs-maplegend .q3, .zs-db__scale .q3, .zs-band.q3::before { background: var(--gk-q3); }
.zs-maplegend .q4, .zs-db__scale .q4, .zs-band.q4::before { background: var(--gk-q4); }
.zs-maplegend .q5, .zs-db__scale .q5, .zs-band.q5::before { background: var(--gk-q5); }
.zs-maplegend .q6, .zs-db__scale .q6, .zs-band.q6::before { background: var(--gk-q6); }
.zs-maplegend .q7, .zs-db__scale .q7, .zs-band.q7::before { background: var(--gk-q7); }

/* ---------- dB scale: one source at one address ----------
 * style="--v: 58; --who: 53"  (unitless dB). Scale runs 40-75 dB in seven 5 dB classes.
 */
.zs-db { --lo: 40; --span: 35; margin: 0; background: var(--zs-surface); border: 1px solid var(--zs-line); border-radius: var(--zs-radius); padding: 1.1rem 1.1rem .9rem; }
.zs-db__reading { display: grid; grid-template-columns: auto 1fr; gap: 0 1rem; align-items: baseline; margin-bottom: 1.6rem; }
.zs-db__value { grid-row: span 2; font: 700 clamp(2.6rem, 4vw + 1rem, 3.6rem)/1 var(--zs-font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--zs-ink); }
.zs-db__value span { font-size: .45em; font-weight: 600; letter-spacing: 0; margin-left: .1em; }
.zs-db__source { font: 700 1.15rem/1.25 var(--zs-font-display); }
.zs-db__band { color: var(--zs-muted); font-size: .95rem; }
.zs-db__scale { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; height: .9rem; }
.zs-db__scale > span { box-shadow: inset 0 0 0 1px rgb(24 36 46 / .18); }
.zs-db__scale > span:first-child { border-radius: 4px 0 0 4px; }
.zs-db__scale > span:last-of-type { border-radius: 0 4px 4px 0; }
.zs-db__pos { position: absolute; top: 0; bottom: 0; left: calc((clamp(var(--lo), var(--x), var(--lo) + var(--span)) - var(--lo)) / var(--span) * 100%); }
/* Address marker: a needle through the bar with a triangle on top. */
.zs-db__marker { --x: var(--v); }
.zs-db__marker::before { content: ""; position: absolute; top: -.45rem; bottom: -.3rem; left: -1.5px; width: 3px; background: var(--zs-ink); box-shadow: 0 0 0 2px var(--zs-surface); }
.zs-db__marker::after { content: ""; position: absolute; top: -.95rem; left: -.45rem; border: .45rem solid transparent; border-top: .55rem solid var(--zs-ink); border-bottom: 0; }
/* WHO guideline: a dashed line with its label above, quieter than the marker. */
.zs-db__who { --x: var(--who); }
.zs-db__who::before { content: ""; position: absolute; top: -.3rem; bottom: -.3rem; left: -1px; border-left: 2px dashed var(--zs-brand); }
.zs-db__who b { position: absolute; bottom: calc(100% + .35rem); right: .35rem; font-size: .72rem; font-weight: 600; color: var(--zs-brand); white-space: nowrap; }
/* Label sits left of the line (value above WHO is the common case); add .is-under on .zs-db when the value is below WHO. */
.zs-db.is-under .zs-db__who b { right: auto; left: .35rem; }
.zs-db__ticks { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: .72rem; color: var(--zs-muted); font-variant-numeric: tabular-nums; }
.zs-db__ticks li { justify-self: start; transform: translateX(-50%); }
.zs-db__ticks li:first-child { transform: none; visibility: hidden; }
.zs-db__meaning { margin: .9rem 0 0; padding-top: .8rem; border-top: 1px solid var(--zs-line); max-width: 60ch; }
.zs-db__meaning strong { font-family: var(--zs-font-display); }
.zs-db__source-note { font-size: .78rem; color: var(--zs-muted); margin: .4rem 0 0; }
/* Compact: one row per source in an address result (no big number, value at the left). */
.zs-db--row { display: grid; grid-template-columns: 9rem 3.5rem minmax(0, 1fr); align-items: center; gap: .3rem .9rem; padding: .7rem 0; border: 0; border-bottom: 1px solid var(--zs-line); border-radius: 0; background: none; }
.zs-db--row .zs-db__reading { display: contents; }
.zs-db--row .zs-db__source { font-size: 1rem; grid-column: 1; grid-row: 1; }
.zs-db--row .zs-db__value { grid-column: 2; grid-row: 1; font-size: 1.35rem; text-align: right; }
.zs-db--row .zs-db__band { grid-column: 1; grid-row: 2; font-size: .82rem; }
.zs-db--row .zs-db__scale { grid-column: 3; grid-row: 1 / span 2; height: .6rem; }
.zs-db--row .zs-db__ticks, .zs-db--row .zs-db__who b { display: none; }
@media (max-width: 30rem) { .zs-db--row { grid-template-columns: 1fr auto; } .zs-db--row .zs-db__scale { grid-column: 1 / -1; grid-row: 3; margin: .9rem 0 .2rem; } }

/* ---------- Source bars: share severely annoyed here, national value as a tick ----------
 * Row: <td><span class="zs-sources__track"><span class="zs-sources__bar" style="--w:62%"></span><span class="zs-sources__ref" style="--r:48%"></span></span></td>
 * --w and --r share one maximum per table (the existing stat-bars $max).
 */
.zs-sources { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.zs-sources caption { text-align: left; font: 700 1.15rem/1.3 var(--zs-font-display); padding-bottom: .3rem; }
.zs-sources__legend { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .82rem; color: var(--zs-muted); margin: 0 0 .6rem; padding: 0; list-style: none; }
.zs-sources__legend li { display: inline-flex; align-items: center; gap: .4rem; }
.zs-sources__legend .here { width: 14px; height: 10px; border-radius: 0 3px 3px 0; background: var(--gk-bar); }
.zs-sources__legend .nl { width: 3px; height: 14px; background: var(--zs-ink); }
.zs-sources th, .zs-sources td { padding: .45rem 0; border-bottom: 1px solid var(--zs-line); text-align: left; vertical-align: middle; }
.zs-sources thead th { font-size: .8rem; font-weight: 600; color: var(--zs-muted); }
.zs-sources tbody th { font-weight: 600; padding-right: 1rem; white-space: nowrap; width: 1%; }
.zs-sources td:last-child, .zs-sources th:last-child { text-align: right; padding-left: .75rem; white-space: nowrap; width: 1%; }
.zs-sources__track { position: relative; display: block; height: .75rem; min-width: 4rem; }
.zs-sources__bar { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); min-width: 2px; background: var(--gk-bar); border-radius: 0 4px 4px 0; }
.zs-sources__ref { position: absolute; top: -.25rem; bottom: -.25rem; left: var(--r); width: 3px; margin-left: -1.5px; background: var(--zs-ink); box-shadow: 0 0 0 2px var(--zs-surface); }
.zs-sources .num { font-weight: 700; }
.zs-sources .ref { color: var(--zs-muted); font-weight: 400; }
.zs-sources .num + .ref::before { content: " / "; }
.zs-sources tr.is-above .num { color: var(--zs-ink); }
.zs-sources tr.is-above th::after { content: "boven landelijk"; display: block; font-size: .72rem; font-weight: 600; color: var(--zs-highlight-ink); background: var(--zs-highlight); border-radius: var(--zs-radius-sm); padding: 0 .35rem; width: max-content; margin-top: .15rem; }

/* ---------- Band chip: colour square + label, for rankings and lists ---------- */
.zs-band { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; white-space: nowrap; }
.zs-band::before { content: ""; width: .8rem; height: .8rem; border-radius: 2px; box-shadow: inset 0 0 0 1px rgb(24 36 46 / .25); }

/* ---------- Acoustician's note: number first, then practice ---------- */
.zs-note { border-left: 3px solid var(--zs-brand); padding: .2rem 0 .2rem 1rem; max-width: 62ch; }
.zs-note p { margin: 0; }
.zs-note p + p { margin-top: .4rem; color: var(--zs-muted); }
