/* Regelingenwijzer
   Kleuren: kobaltblauw als hoofdkleur, magenta voor wat vaak gemist wordt,
   marineblauwe tekst op wit. Teal is gereserveerd voor de gemeente. */

:root {
  --paper: #ffffff;
  --sheet: #ffffff;
  --panel: #edf2ff;
  --band: #1e3fd0;
  --band-ink: #ffffff;
  --band-soft: #d3dcff;
  --ink: #0e1a4a;
  --ink-soft: #4a5480;
  --rule: #d6dcf0;
  --pen: #1e3fd0;
  --marker: #ffd3e4;
  --marker-ink: #0e1a4a;
  --gemist: #d61f69;
  --gemist-ink: #ffffff;
  --good: #087a4a;
  --warn: #a65800;
  --local: #0f6e64;
  --local-soft: #dff1ee;

  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  /* Typeschaal, ratio 1.25 op 17px */
  --fs-xs: 0.8125rem;
  --fs-s: 0.9375rem;
  --fs-m: 1.0625rem;
  --fs-l: 1.3125rem;
  --fs-xl: 1.625rem;
  --fs-xxl: clamp(2.25rem, 1.4rem + 3.6vw, 3.75rem);

  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8.5' fill='none' stroke='%231e3fd0' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1230;
    --sheet: #121b44;
    --panel: #121b44;
    --band: #1a2d9e;
    --band-ink: #ffffff;
    --band-soft: #c9d3ff;
    --ink: #e8ecff;
    --ink-soft: #a6afd6;
    --rule: #27325f;
    --pen: #8ea4ff;
    --marker: #6a1f45;
    --marker-ink: #ffffff;
    --gemist: #ff5c9a;
    --gemist-ink: #0b1230;
    --good: #5fd39a;
    --warn: #f2b45c;
    --local: #6fd0c1;
    --local-soft: #10302f;
    --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8.5' fill='none' stroke='%238ea4ff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1230;
  --sheet: #121b44;
  --panel: #121b44;
  --band: #1a2d9e;
  --band-ink: #ffffff;
  --band-soft: #c9d3ff;
  --ink: #e8ecff;
  --ink-soft: #a6afd6;
  --rule: #27325f;
  --pen: #8ea4ff;
  --marker: #6a1f45;
  --marker-ink: #ffffff;
  --gemist: #ff5c9a;
  --gemist-ink: #0b1230;
  --good: #5fd39a;
  --warn: #f2b45c;
  --local: #6fd0c1;
  --local-soft: #10302f;
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8.5' fill='none' stroke='%238ea4ff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ---------- Basis ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--pen); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 14px; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter-r) 72px var(--gutter);
}

/* ---------- Kop ---------- */

.band {
  background: var(--band);
  color: var(--band-ink);
  margin-bottom: 48px;
}
.masthead {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px var(--gutter-r) 52px var(--gutter);
}
.masthead > * { max-width: 44rem; }

.brand {
  font-weight: 800;
  font-size: var(--fs-s);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
/* Een vinkje als beeldmerk, in balpen-blauw */
.brand::before {
  content: "";
  width: 22px; height: 22px;
  border: 2px solid var(--band-ink);
  border-radius: 3px;
  background: #fff no-repeat center / 16px var(--tick);
}

h1 {
  font-size: var(--fs-xxl);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
  margin-bottom: 20px;
}

.lede {
  font-size: var(--fs-l);
  line-height: 1.45;
  max-width: 36em;
  text-wrap: pretty;
}

.scope {
  margin-top: 14px;
  color: var(--band-soft);
  font-size: var(--fs-s);
}

/* ---------- Twee kolommen ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* ---------- Vinklijst ---------- */

.picker {
  position: sticky;
  top: 0;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 20px 24px;
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.link-btn {
  background: none; border: 0; padding: 4px 0;
  font: inherit; font-size: var(--fs-s);
  color: var(--pen);
  text-decoration: underline; text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover { text-decoration-thickness: 2px; }

.gemeente {
  display: grid;
  gap: 8px;
  padding: 16px;
  margin-bottom: 28px;
  background: var(--sheet);
  border-left: 4px solid var(--local);
}
.gemeente label { font-weight: 600; color: var(--local); }
.gemeente select {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 8px 40px 8px 12px;
  color: var(--ink);
  background: var(--sheet) no-repeat right 14px center / 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234f5d62' stroke-width='1.8'/%3E%3C/svg%3E");
  border: 1.5px solid var(--ink-soft);
  border-radius: 4px;
  appearance: none;
}
.gemeente .hint { font-size: var(--fs-xs); color: var(--ink-soft); line-height: 1.45; }

.groups { display: grid; gap: 28px; }

.group { border: 0; margin: 0; padding: 0; min-width: 0; }
.group legend {
  display: flex; width: 100%;
  justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 0 0 8px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--pen);
}
.group-name { font-weight: 800; font-size: var(--fs-m); }
.group-count { font-size: var(--fs-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.opt {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.opt input {
  appearance: none;
  margin: 1px 0 0;
  width: 22px; height: 22px;
  border: 2px solid var(--ink-soft);
  border-radius: 3px;
  background: var(--sheet) no-repeat center / 16px;
  cursor: pointer;
}
.opt:hover input { border-color: var(--ink); }
.opt input:checked {
  border-color: var(--ink);
  background-image: var(--tick);
}
.opt input:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }

/* De markeerstift: een gele streep die achter de tekst wordt getrokken */
.opt-text {
  font-size: var(--fs-s);
  line-height: 1.45;
}
.opt-text .mark {
  padding: 1px 3px;
  margin-left: -3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(100deg,
    transparent 0.2em,
    var(--marker) 0.3em,
    var(--marker) calc(100% - 0.3em),
    transparent calc(100% - 0.15em));
  background-repeat: no-repeat;
  background-position: 0 60%;
  background-size: 0% 78%;
  transition: background-size 0.28s cubic-bezier(.3,.7,.2,1);
}
.opt input:checked + .opt-text .mark {
  background-size: 100% 78%;
  color: var(--marker-ink);
}

/* ---------- Resultaten ---------- */

.results { min-width: 0; scroll-margin-top: 16px; }
.results:focus { outline: none; }

.results-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 28px;
}
.count {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.showall {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-s);
  color: var(--ink-soft);
  cursor: pointer;
}
.showall input { width: 18px; height: 18px; margin: 0; accent-color: var(--pen); }

.cards { display: grid; gap: 44px; }

.inst-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 6px;
  border-top: 4px solid var(--pen);
}
.inst-head h3 { font-size: var(--fs-l); font-weight: 800; line-height: 1.25; }
.inst-count { font-size: var(--fs-xs); color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

.is-local .inst-head { border-top-color: var(--local); }
.is-local .inst-head h3 { color: var(--local); }

/* Een regeling */
.row { border-bottom: 1px solid var(--rule); }

.row summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 4px 20px;
  padding: 16px 0;
  cursor: pointer;
}
.row summary::-webkit-details-marker { display: none; }
.row summary:focus-visible { outline-offset: 4px; }

.row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}
.row-title { font-weight: 600; font-size: var(--fs-m); line-height: 1.35; }
.row summary:hover .row-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

.row-sub {
  grid-column: 1;
  color: var(--ink-soft);
  font-size: var(--fs-s);
  max-width: 62ch;
}

.tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.tag-geld { color: var(--good); box-shadow: inset 0 0 0 1.5px currentColor; }
.tag-letop { color: var(--warn); box-shadow: inset 0 0 0 1.5px currentColor; }
.tag-gemist { background: var(--gemist); color: var(--gemist-ink); }

/* Plus wordt min */
.toggle {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  position: relative;
  width: 28px; height: 28px;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  transition: border-color 0.15s;
}
.toggle::before, .toggle::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 12px; height: 2px;
  background: var(--ink);
  translate: -50% -50%;
  transition: rotate 0.2s ease;
}
.toggle::after { rotate: 90deg; }
.row summary:hover .toggle { border-color: var(--ink); }
.row[open] .toggle::after { rotate: 0deg; }

.row-body {
  display: grid;
  gap: 14px;
  padding: 0 48px 22px 0;
  max-width: calc(68ch + 48px);
  font-size: var(--fs-s);
}
.wie strong { display: block; font-weight: 600; }

.check {
  background: var(--panel);
  border-left: 4px solid var(--pen);
  padding: 14px 18px 14px 16px;
}
.check-h { font-weight: 600; margin-bottom: 6px; }
.check ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }

.why { color: var(--ink-soft); font-style: italic; }

.row-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 20px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.instantie { color: var(--ink-soft); }
.instantie strong { color: var(--ink); font-weight: 600; }
.ext { font-weight: 600; }
.ext::after {
  content: "";
  display: inline-block;
  width: 0.7em; height: 0.7em;
  margin-left: 0.3em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 1h6v6M9 1L1 9' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 1h6v6M9 1L1 9' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Lege staat en hint */
.empty {
  padding: 22px 24px;
  background: var(--panel);
  border: 1.5px dashed var(--pen);
  max-width: 40rem;
}
.empty-title { font-weight: 800; font-size: var(--fs-l); margin-bottom: 4px; }
.empty p:last-child { color: var(--ink-soft); }

/* ---------- Voet ---------- */

.colophon {
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 8px;
  max-width: 44rem;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}

/* ---------- Springknop (alleen mobiel) ---------- */

.jump { display: none; }

/* ---------- Tablet en telefoon ---------- */

@media (max-width: 880px) {
  .masthead { padding-top: 22px; padding-bottom: 36px; }
  .band { margin-bottom: 32px; }
  .lede { font-size: 1.125rem; text-wrap: wrap; }
  .brand { margin-bottom: 20px; }

  .layout { grid-template-columns: minmax(0, 1fr); gap: 48px; }

  .picker {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 18px 16px 22px;
  }

  .groups { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 28px 32px; }

  .opt { padding: 11px 0; }

  .row-body { padding-right: 0; }

  .jump {
    position: fixed;
    left: var(--gutter); right: var(--gutter-r);
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    background: var(--band);
    color: var(--band-ink);
    text-decoration: none;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 6px 20px -6px rgb(0 0 0 / 0.45);
    transition: translate 0.25s ease, opacity 0.25s ease;
  }
  .jump.is-hidden { translate: 0 140%; opacity: 0; pointer-events: none; }
  .jump-cta {
    background: var(--gemist);
    color: var(--gemist-ink);
    padding: 6px 12px;
    border-radius: 3px;
  }
  body { padding-bottom: 80px; }
}

@media (max-width: 520px) {
  .results-head { grid-template-columns: minmax(0, 1fr); }
  .showall { order: 3; }
  .inst-head { flex-wrap: wrap; }
  .row summary { gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
