:root {
  --bg: #fffdf6;
  --ink: #0f2342;
  --geel: #f9cc0d;
  --knop-bg: #ffffff;
  --knop-rand: #ece6cf;
  /* Masterd */
  --md-stage: #a9cff2; --md-stage2: #cfe4f8; --md-ink: #1c2340; --md-muted: #5b6585; --md-accent: #ff6b57; --md-accent-ink: #fff;
  /* BoekJe */
  --bj-zij: #1e1b4b; --bj-zij-tekst: #d4d2f3; --bj-accent: #4f46e5; --bj-accent-hover: #6366f1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1628; --ink: #ecf0f8; --knop-bg: #14223a; --knop-rand: #24365a;
    --md-stage: #26375c; --md-stage2: #33497a; --md-ink: #e8ecf8; --md-muted: #9aa5c6; --md-accent: #ff7a66; --md-accent-ink: #1a1010;
    --bj-zij: #17153a; --bj-zij-tekst: #d4d2f3; --bj-accent: #6366f1; --bj-accent-hover: #818cf8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1628; --ink: #ecf0f8; --knop-bg: #14223a; --knop-rand: #24365a;
  --md-stage: #26375c; --md-stage2: #33497a; --md-ink: #e8ecf8; --md-muted: #9aa5c6; --md-accent: #ff7a66; --md-accent-ink: #1a1010;
  --bj-zij: #17153a; --bj-zij-tekst: #d4d2f3; --bj-accent: #6366f1; --bj-accent-hover: #818cf8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background .2s, color .2s;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 48px 16px 64px; }

/* Thema-knop */
.thema {
  position: fixed; top: 16px; right: 16px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--knop-bg); border: 1px solid var(--knop-rand); color: var(--ink);
}
.thema:hover { border-color: var(--geel); }
.thema:focus-visible { outline: 3px solid var(--geel); outline-offset: 2px; }
.thema svg { width: 22px; height: 22px; }
.thema .maan { fill: currentColor; }
.thema .zon { fill: var(--geel); stroke: var(--geel); stroke-width: 2; stroke-linecap: round; }
.thema .zon { display: none; }
:root[data-theme="dark"] .thema .maan { display: none; }
:root[data-theme="dark"] .thema .zon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thema .maan { display: none; }
  :root:not([data-theme="light"]) .thema .zon { display: block; }
}

/* Logo */
.logo { margin: 0 auto 48px; max-width: 360px; }
.logo img { display: block; width: 100%; height: auto; }
.logo-donker { display: none !important; }
:root[data-theme="dark"] .logo-licht { display: none !important; }
:root[data-theme="dark"] .logo-donker { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-licht { display: none !important; }
  :root:not([data-theme="light"]) .logo-donker { display: block !important; }
}

/* Tegels */
.tegels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.tegel {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 200px; padding: 24px; border-radius: 20px;
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.tegel:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.tegel:focus-visible { outline: 3px solid var(--geel); outline-offset: 3px; }
.tegel .naam { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.tegel .tekst { flex: 1; font-size: 1rem; line-height: 1.5; }
.tegel .knop { align-self: flex-start; padding: 8px 18px; border-radius: 999px; font-weight: 700; }

/* Masterd-stijl */
.tegel.masterd {
  background: linear-gradient(160deg, var(--md-stage2), var(--md-stage));
  color: var(--md-ink);
  font-family: "Baloo 2", "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
}
.tegel.masterd { padding-top: 0; overflow: hidden; }
.tegel.masterd .titelbeeld {
  display: block; width: calc(100% + 48px); height: auto; margin: 0 -24px 8px;
  aspect-ratio: 708 / 276; object-fit: cover;
}
.tegel.masterd .tekst { color: var(--md-muted); }
.tegel.masterd .knop { background: var(--md-accent); color: var(--md-accent-ink); box-shadow: 0 3px 0 rgba(0,0,0,.18); }

/* BoekJe-stijl (zoals de zijbalk van boekje.wocus.nl) */
.tegel.boekje {
  background: var(--bj-zij); color: var(--bj-zij-tekst); gap: 0;
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
}
.bj-logo { color: #fff; font-size: 1.9rem; font-weight: 700; line-height: 1.1; display: flex; gap: 10px; align-items: center; }
.bj-logo svg { width: 28px; height: 28px; flex: none; }
.bj-onder { font-size: 13px; padding: 2px 0 14px 38px; }
.bj-kop { color: #8b87c9; font-size: 12px; font-weight: 700; letter-spacing: .03em; padding-bottom: 6px; }
.bj-soorten { list-style: none; margin: 0 0 14px; padding: 0; flex: 1; }
.bj-soorten li { display: flex; gap: 10px; align-items: center; padding: 5px 10px; margin: 0 -10px 2px; border-radius: 8px; }
.bj-soorten li:first-child { background: #3730a3; color: #fff; }
.bj-soorten svg { flex: none; }
.tegel.boekje .knop {
  align-self: stretch; display: flex; justify-content: center; align-items: center; gap: 7px;
  min-height: 42px; background: var(--bj-accent); color: #fff; border-radius: 8px; font-size: 17px;
}
.tegel.boekje:hover .knop { background: #4338ca; }

/* Donker: BoekJe-tegel iets afzetten tegen de achtergrond */
:root[data-theme="dark"] .tegel.boekje { box-shadow: inset 0 0 0 1px #2e2a6b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tegel.boekje { box-shadow: inset 0 0 0 1px #2e2a6b; }
}

/* Mobiel: logo niet onder de thema-knop */
@media (max-width: 560px) {
  .wrap { padding-top: 72px; }
  .logo { max-width: 260px; margin-bottom: 36px; }
}
