/* Datacenters in Nederland: a 2D Leaflet map in the LAYRS house style, light and dark. */
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/schibsted-grotesk-latin.woff2) format("woff2"); }
:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --ink: #000000;
  --muted: #5d6266;
  --rule: #cfd5d8;
  --sky: #e4e8ea;
  --red: #ec0000;
  --gutter: clamp(12px, 2.4vw, 28px);
  --vh: 100vh;
  /* Phase colours: categorical slots in fixed order, validated for both surfaces (see dataviz palette). */
  --f-operationeel: #2a78d6;
  --f-in_aanbouw: #eb6834;
  --f-vergund: #1baf7a;
  --f-aangevraagd: #eda100;
  --f-gepland: #6250d6;
  --f-afgeblazen: #8a9094;
  --ring: #ffffff;
  --j1: #86b6ef; --j2: #5598e7; --j3: #2a78d6; --j4: #1c5cab; --j5: #0d366b;
  --los: #86b6ef; --seg-klein-ink: #000; --seg-los-ink: #000;
  font: 400 14px/1.5 "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1a19; --ink: #f0efec; --muted: #c3c2b7; --rule: #3a3a38; --sky: #111; --red: #ff5a5a;
    --f-operationeel: #3987e5; --f-in_aanbouw: #d95926; --f-vergund: #199e70; --f-aangevraagd: #c98500; --f-gepland: #9085e9; --f-afgeblazen: #8a9094;
    --ring: #1a1a19;
    --j1: #184f95; --j2: #256abf; --j3: #3987e5; --j4: #6da7ec; --j5: #9ec5f4;
    --los: #6da7ec; --seg-klein-ink: #fff; --seg-los-ink: #000;
  }
  /* PDOK has no dark tile set; the grey map inverted makes a quiet dark base. */
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sky); color: var(--ink); overflow: hidden; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
a { color: var(--ink); text-decoration-color: var(--red); text-underline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#map { position: fixed; inset: 0; background: var(--sky); }

/* Masthead, as on the city map. */
.masthead { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--gutter)); left: var(--gutter); z-index: 500;
  pointer-events: none; }
.masthead > * { pointer-events: auto; }
h1 { margin: 0; font-size: clamp(22px, 4vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; display: flex; align-items: center; gap: 10px; }
.layrs { background: var(--red); color: #fff; font-weight: 800; font-size: .42em; letter-spacing: .14em; padding: .35em .45em .3em; border-radius: 2px; }
.dek { margin: 6px 0 0; color: var(--muted); max-width: 30ch; font-size: 13px; line-height: 1.4; }
.dek a { color: var(--muted); }

/* Legend doubles as the phase filter. */
.legend { position: fixed; right: var(--gutter); top: calc(env(safe-area-inset-top, 0px) + var(--gutter)); z-index: 500;
  background: var(--paper); border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 0 var(--rule), 0 4px 18px rgba(0,0,0,.08);
  width: min(240px, calc(100vw - 2 * var(--gutter))); }
.legend h2 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 5px 4px; border-radius: 8px;
  cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
.legend button:hover { background: var(--sky); }
.legend button[aria-pressed="false"] { color: var(--muted); }
.legend button[aria-pressed="false"] .dot { opacity: .25; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 0 2px var(--ring); }
.dot.afgeblazen { background: none; box-shadow: none; position: relative; }
.dot.afgeblazen::before, .dot.afgeblazen::after { content: ""; position: absolute; left: 1px; right: 1px; top: 6px; height: 2px; background: var(--c); transform: rotate(45deg); }
.dot.afgeblazen::after { transform: rotate(-45deg); }
.lens { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: 9px; margin-bottom: 8px; }
.lens button { flex: 1; border: 0; border-radius: 7px; background: none; padding: 5px 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.lens button:hover { background: var(--sky); }
.lens button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.lens-key { margin: 0 0 8px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.lens-key p { margin: 2px 0 0; }
.lens-key svg { display: block; overflow: visible; font-size: 10px; }
.lens-key .dash { display: inline-block; width: 10px; height: 10px; border: 1.5px dashed var(--f-operationeel); border-radius: 50%; vertical-align: -2px; }
.ramp { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.ramp li { display: flex; align-items: center; gap: 4px; }
.sw { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.sw-onbekend { background: var(--muted); opacity: .5; }
.sw-pijplijn { border: 2px solid var(--f-in_aanbouw); box-sizing: border-box; }
.tijdlijn { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.tijdlijn button { width: 30px; height: 30px; flex: none; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); cursor: pointer; font-size: 11px; padding: 0; }
.tijdlijn input[type="range"] { flex: 1; min-width: 0; accent-color: var(--red); margin: 0; }
.tijdlijn output { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; min-width: 5.5em; text-align: right; }
.filter-toggle { display: none; }
.legend h2 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.legend .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.legend .tools { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
.legend .tools button { width: auto; flex: 1; justify-content: center; border: 1px solid var(--rule); font-size: 12px; font-weight: 600; padding: 6px 8px; }
.search { margin-top: 8px; }
.search input { width: 100%; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 9px; background: var(--paper); color: var(--ink); font-size: 16px; }
@media (min-width: 721px) { .search input { font-size: 13px; } }

/* Leaflet controls in the house style; bottom-right is the feedback button's corner. */
.leaflet-container { font: inherit; }
.leaflet-bottom.leaflet-right { margin-right: 76px; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--paper) 85%, transparent); color: var(--muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--ink); }
.leaflet-bar { border: 0; box-shadow: 0 1px 0 var(--rule), 0 4px 18px rgba(0,0,0,.08); }
.leaflet-bar a { background: var(--paper); color: var(--ink); border-bottom-color: var(--rule); }
.leaflet-bar a:hover { background: var(--sky); }
.leaflet-tooltip { background: var(--paper); color: var(--ink); border: 0; border-radius: 8px; box-shadow: 0 1px 0 var(--rule), 0 4px 18px rgba(0,0,0,.12);
  padding: 6px 10px; font-size: 13px; }
.leaflet-tooltip-top::before { border-top-color: var(--paper); }
.leaflet-tooltip b { font-weight: 700; }
.tt-muted, .card .muted { color: var(--muted); }
.spikes { pointer-events: none; overflow: visible; }
.spikes path { pointer-events: auto; cursor: pointer; }
.leaflet-popup-content-wrapper { background: var(--paper); color: var(--ink); border-radius: 12px; box-shadow: 0 1px 0 var(--rule), 0 6px 24px rgba(0,0,0,.15); }
.leaflet-popup-tip { background: var(--paper); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.45; width: min(320px, calc(100vw - 80px)) !important; }
.leaflet-popup-close-button { color: var(--muted) !important; font-size: 20px !important; padding: 6px 6px 0 0 !important; width: 32px !important; height: 32px !important; }
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; padding-right: 16px; }
.card .op { color: var(--muted); margin: 0 0 6px; }
.card .fase { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; margin-bottom: 8px; }
.card .fase .dot { width: 10px; height: 10px; box-shadow: none; }
.card dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.card p { margin: 8px 0 0; }
.card .bron { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 12px; }
.card .bron a { color: var(--ink); }

/* List and about dialogs: a fixed head (title, close, filter) above a scrolling body. */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(var(--vh) - 48px);
  background: var(--paper); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.25); overscroll-behavior: contain; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dialog-head { flex: none; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 12px; padding: 18px 28px 12px;
  border-bottom: 1px solid var(--rule); }
.dialog-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.dialog-head .search { grid-column: 1 / -1; margin: 0; }
.dialog-head .hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--sky); cursor: pointer; font-size: 22px; line-height: 1; padding: 0; }
.dialog-close:hover { background: var(--rule); }
dialog article { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 28px 28px; }
#about article { padding-top: 16px; }
dialog h3 { margin: 20px 0 6px; font-size: 15px; font-weight: 700; }
dialog p, dialog li { line-height: 1.6; max-width: 68ch; }
dialog .notice { border-left: 3px solid var(--red); padding-left: 12px; font-weight: 500; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--paper); z-index: 1; }
td .dot { display: inline-block; vertical-align: -2px; margin-right: 6px; width: 10px; height: 10px; box-shadow: none; }
td.mw, td.verbruik { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.verbruik em, .card em { color: var(--muted); font-style: italic; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--sky); }
tbody tr:focus-visible { outline-offset: -2px; }
.leeg { color: var(--muted); padding: 24px 0; text-align: center; }

/* Cijfers: hero figure, disclosure strip, pipeline funnel. Marks carry colour, text wears text tokens. */
.fig { margin: 12px 0 28px; }
.fig h3 { margin: 18px 0 4px; }
.hero { margin: 4px 0 0; font-size: 56px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.hero small { font-size: .4em; font-weight: 700; letter-spacing: 0; color: var(--muted); }
.hero-sub { margin: 4px 0 0; color: var(--muted); max-width: 60ch; }
.lead { margin: 0 0 10px; max-width: 68ch; }
.strip { display: flex; gap: 2px; height: 44px; width: 100%; }
.strip .seg { flex: 0 0 auto; min-width: 2px; border: 0; padding: 0; background: var(--f-operationeel); border-radius: 0; cursor: pointer; position: relative; overflow: visible; }
.strip .seg:first-child { border-radius: 4px 0 0 4px; }
.strip .seg:last-child { border-radius: 0 4px 4px 0; }
.strip .seg.los { background: var(--los); color: var(--seg-los-ink); }
.strip .seg.klein { background: var(--j2); color: var(--seg-klein-ink); }
.strip .seg.dicht { background: repeating-linear-gradient(135deg, var(--rule) 0 3px, transparent 3px 7px); border: 1px solid var(--rule); }
.strip .seg.actief, .strip .seg:hover { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.strip .seg span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: inherit; white-space: nowrap; pointer-events: none; }
.strip .seg { color: #fff; }
.strip .seg.dicht span { color: var(--muted); }
.strip-tip { min-height: 2.8em; margin: 8px 0 4px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.strip-tip strong { color: var(--ink); }
.funnel { display: grid; gap: 8px; }
.staaf { display: grid; grid-template-columns: 11em 1fr; grid-template-areas: "lbl track" "lbl sub"; column-gap: 10px; align-items: center; }
.staaf .lbl { grid-area: lbl; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.staaf .lbl .dot { width: 10px; height: 10px; box-shadow: none; }
.staaf .track { grid-area: track; display: flex; align-items: center; gap: 8px; height: 18px; }
.staaf .fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.staaf .val { font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.staaf .sub { grid-area: sub; font-size: 12px; color: var(--muted); }
.staaf.afgeblazen .fill { opacity: .35; }
.staaf.ref { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.staaf.ref .fill { opacity: .45; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
#cijfers tbody tr { cursor: default; }
#cijfers tbody tr:hover { background: none; }

@media (max-width: 720px) {
  .masthead { right: var(--gutter); }
  .dek { display: none; }
  /* Legend as a compact bottom sheet next to the feedback button. */
  .legend { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); left: var(--gutter); right: auto;
    width: calc(100vw - 2 * var(--gutter)); padding: 8px 10px; }
  .legend .tools, .filter-toggle { margin-right: 60px; }
  .legend.open .tools { margin-right: 60px; }
  .legend h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legend ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; }
  .legend button { padding: 5px 2px; font-size: 12px; gap: 6px; }
  .legend .dot { width: 12px; height: 12px; }
  .legend .n { font-size: 11px; }
  .lens { margin-bottom: 6px; overflow-x: auto; scrollbar-width: none; }
  .lens button { flex: 1 0 auto; padding: 6px 8px; font-size: 12px; }
  .lens-key { margin-bottom: 6px; }
  .filter-toggle { display: flex; width: auto; justify-content: space-between; align-items: center; border: 1px solid var(--rule); border-radius: 8px; background: none; padding: 7px 10px; font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }
  .filter-toggle::after { content: "▾"; color: var(--muted); }
  .legend.open .filter-toggle::after { content: "▴"; }
  .filter-blok { display: none; }
  .legend.open .filter-blok { display: block; margin-top: 8px; }
  .legend h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legend.open .tools { margin-top: 8px; }
  .legend .search { margin-top: 6px; }
  .legend .search input { padding: 7px 9px; }
  .legend .tools { margin-top: 6px; padding-top: 6px; }
  .legend .tools button { padding: 7px 8px; }
  .leaflet-bottom.leaflet-left { display: none; }

  /* Dialogs fill the screen; the table becomes a stack of tappable rows. */
  dialog { width: 100vw; max-width: 100vw; height: var(--vh); max-height: var(--vh); margin: 0; border-radius: 0; box-shadow: none; }
  .dialog-head { padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px; gap: 8px 10px; }
  .dialog-head h2 { font-size: 20px; }
  .dialog-head .hint { display: none; }
  dialog article { padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
  #about article { padding-top: 12px; }
  .hero { font-size: 44px; }
  .staaf { grid-template-columns: 1fr; grid-template-areas: "lbl" "track" "sub"; row-gap: 2px; }
  .staaf .sub { margin-bottom: 4px; }
  #cijfers thead { display: table-header-group; }
  #cijfers tbody, #cijfers tr, #cijfers td { display: revert; }
  #cijfers tbody tr { display: table-row; min-height: 0; padding: 0; }
  #cijfers td { padding: 6px 8px; border-bottom: 1px solid var(--rule); }
  thead { display: none; }
  tbody, tr, td { display: block; }
  tbody tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "naam naam verbruik" "fase plaats mw"; align-items: baseline;
    column-gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--rule); min-height: 52px; }
  td { padding: 0; border: 0; }
  td.naam { grid-area: naam; font-weight: 700; font-size: 14px; }
  td.naam small { font-weight: 400; color: var(--muted); }
  td.mw { grid-area: mw; color: var(--muted); font-size: 12px; }
  td.verbruik { grid-area: verbruik; font-size: 13px; }
  td.verbruik:empty { display: none; }
  td.fase { grid-area: fase; color: var(--muted); font-size: 12px; }
  td.plaats { grid-area: plaats; color: var(--muted); font-size: 12px; }
  td.plaats:not(:empty)::before { content: "· "; }
  tbody tr:hover { background: none; }
  tbody tr:active { background: var(--sky); }
}
