/* ===== GroenDorp RP – Wetboek ===== */
:root {
  --bg: #f3f6ef;
  --surface: #ffffff;
  --surface-2: #eaf0e5;
  --ink: #17251b;
  --muted: #53635a;
  --line: #d9e2d4;
  --brand: #2c7a4d;
  --brand-dark: #1c5636;
  --brand-soft: #e1f0e6;
  --on-brand: #ffffff;
  --ooc: #8b5200;
  --ooc-soft: #fbefd5;
  --ooc-line: #ecd29c;
  --red: #a8332a;
  --red-soft: #fbe6e3;
  --blue: #1f5596;
  --blue-soft: #e3edfa;
  --gray-soft: #eceff0;
  --mark: #fff1a8;
  --shadow: 0 1px 2px rgba(20, 45, 28, .07), 0 6px 20px rgba(20, 45, 28, .07);
  --radius: 14px;
  --head: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --drawer: 440px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1711;
    --surface: #17221a;
    --surface-2: #1d2c21;
    --ink: #e8f0e9;
    --muted: #a3b4a8;
    --line: #2b3b2f;
    --brand: #5fc189;
    --brand-dark: #8fdcae;
    --brand-soft: #1b3324;
    --on-brand: #0b1a10;
    --ooc: #f0b95b;
    --ooc-soft: #2b2310;
    --ooc-line: #5a4519;
    --red: #ff9b8f;
    --red-soft: #3a1c19;
    --blue: #8fbcf5;
    --blue-soft: #16273d;
    --gray-soft: #222b25;
    --mark: #5b4d10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--body);
  transition: padding-right .25s ease;
}
h1, h2, h3 { font-family: var(--head); line-height: 1.2; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- bovenbalk ----- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand strong { display: block; font-family: var(--head); font-size: 1.1rem; line-height: 1.1; }
.brand small { color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%; padding: 11px 40px 11px 42px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; min-height: 44px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.search .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; border-radius: 50%; color: var(--muted); font-size: 1rem; }
.search .clear:hover { background: var(--surface-2); }
.btn {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 16px; min-height: 44px;
  font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
@media (prefers-color-scheme: dark) { .btn-primary:hover { background: #7ad3a0; } }
.btn-small { min-height: 36px; padding: 5px 12px; font-size: .88rem; font-weight: 600; }

/* ----- hero ----- */
.hero { background: linear-gradient(180deg, var(--brand-soft), var(--bg)); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(180deg, #000, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hero-inner { position: relative; max-width: 1180px; margin: 0 auto; padding: 36px 16px 26px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.7rem); }
.hero p.lead { max-width: 60ch; color: var(--muted); font-size: 1.08rem; margin: 10px 0 0; }
.hero .stats { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; min-height: 36px;
  font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }

/* ----- IC / OOC kaarten ----- */
.kinds { max-width: 1180px; margin: 22px auto 0; padding: 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kind {
  text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px 18px;
  display: grid; gap: 4px; box-shadow: var(--shadow); position: relative;
}
.kind .tag { font-weight: 800; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }
.kind strong { font-family: var(--head); font-size: 1.25rem; line-height: 1.2; }
.kind span.d { color: var(--muted); font-size: .94rem; }
.kind.ic .tag { color: var(--brand-dark); }
.kind.ooc .tag { color: var(--ooc); }
.kind.ic[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.kind.ooc[aria-pressed="true"] { border-color: var(--ooc); background: var(--ooc-soft); }
.kind[aria-pressed="true"]::after { content: "Gefilterd – klik om alles te tonen"; position: absolute; right: 14px; top: 12px; font-size: .74rem; font-weight: 700; color: var(--muted); }
.kind:hover { border-color: var(--muted); }
@media (max-width: 700px) { .kinds { grid-template-columns: 1fr; } .kind[aria-pressed="true"]::after { content: "Gefilterd"; } }

/* ----- layout ----- */
.layout { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .layout { grid-template-columns: 270px minmax(0, 1fr); gap: 32px; } }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.toc > summary { list-style: none; padding: 13px 16px; font-weight: 700; cursor: pointer; display: flex; justify-content: space-between; }
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary::after { content: "▾"; color: var(--muted); }
.toc[open] > summary::after { content: "▴"; }
@media (min-width: 1000px) {
  .toc { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; align-self: start; }
  .toc > summary { pointer-events: none; }
  .toc > summary::after { content: none; }
}
.toc nav { padding: 0 8px 12px; }
.toc h3 { font: 700 .72rem/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 6px; display: flex; align-items: center; gap: 8px; }
.toc h3 i { width: 9px; height: 9px; border-radius: 3px; background: var(--brand); display: inline-block; }
.toc h3.ooc i { background: var(--ooc); }
.toc h3.neutral i { background: var(--muted); }
.toc a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 9px; text-decoration: none; color: var(--ink); font-size: .93rem; line-height: 1.35; }
.toc a b { color: var(--muted); min-width: 1.5em; text-align: right; font-weight: 600; }
.toc a:hover { background: var(--surface-2); }
.toc a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.toc a.active b { color: inherit; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar .hint { color: var(--muted); font-size: .9rem; }

/* ----- delen ----- */
.part { margin-bottom: 34px; }
.part-banner { border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.part-banner .tag { display: inline-block; font-weight: 800; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-bottom: 8px; }
.part-banner h2 { font-size: 1.55rem; }
.part-banner p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.part-ic .part-banner { background: var(--brand-soft); border-color: var(--brand); }
.part-ic .part-banner .tag { background: var(--brand); color: var(--on-brand); }
.part-ooc .part-banner { background: var(--ooc-soft); border-color: var(--ooc-line); }
.part-ooc .part-banner .tag { background: var(--ooc); color: #fff; }
@media (prefers-color-scheme: dark) { .part-ooc .part-banner .tag { color: #1c1405; } }
.part-algemeen .part-banner .tag, .part-slot .part-banner .tag { background: var(--surface-2); color: var(--muted); }

/* ----- hoofdstukken en artikelen ----- */
details.ch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
details.ch > summary { list-style: none; cursor: pointer; padding: 15px 18px; display: flex; align-items: center; gap: 14px; min-height: 60px; }
details.ch > summary::-webkit-details-marker { display: none; }
.ch-num {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800;
  background: var(--brand-soft); color: var(--brand-dark); font-family: var(--head);
}
.part-ooc .ch-num { background: var(--ooc-soft); color: var(--ooc); }
.part-algemeen .ch-num, .part-slot .ch-num { background: var(--surface-2); color: var(--muted); }
.ch-title { font: 700 1.15rem/1.25 var(--head); flex: 1; min-width: 0; }
.ch-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.chev { width: 22px; height: 22px; flex: none; color: var(--muted); transition: transform .2s; }
details[open] > summary > .chev { transform: rotate(180deg); }
details.ch > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
details.ch[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.ch-body { padding: 8px 12px 14px; }
.ch-intro { padding: 6px 8px 4px; color: var(--muted); }
.ch-intro p { margin: .3em 0 .6em; }
@media (max-width: 560px) { .ch-count { display: none; } details.ch > summary { padding: 13px 14px; } }

details.art { border-radius: 11px; margin: 6px 0; border: 1px solid transparent; }
details.art[open] { background: var(--bg); border-color: var(--line); }
details.art > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; gap: 12px; align-items: baseline; border-radius: 11px; min-height: 44px; }
details.art > summary::-webkit-details-marker { display: none; }
details.art > summary:hover { background: var(--surface-2); }
.art-num { flex: none; font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; min-width: 3.7em; }
.part-ooc .art-num { color: var(--ooc); }
.art-title { font-weight: 600; flex: 1; min-width: 0; }
details.art > summary::after { content: "+"; color: var(--muted); font-weight: 700; font-size: 1.2rem; line-height: 1; align-self: center; }
details.art[open] > summary::after { content: "–"; }
.art-body { padding: 2px 16px 14px 16px; }
@media (min-width: 700px) { .art-body { padding-left: calc(12px + 3.7em + 12px); } }
.art-body p { margin: .4em 0 .6em; }
.art-body ol, .art-body ul { margin: .3em 0 .8em; padding-left: 1.35em; }
.art-body li { margin: .25em 0; }
.art-body li > ol { margin: .3em 0; list-style-type: lower-alpha; }
.art-body table { width: 100%; border-collapse: collapse; margin: .6em 0 .9em; font-size: .94rem; background: var(--surface); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
.art-body th, .art-body td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.art-body th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.art-body tr:last-child td { border-bottom: 0; }
.art-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.flash { animation: flash 1.8s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--brand); } 100% { box-shadow: 0 0 0 0 transparent; } }
.chapter, details.art, .part { scroll-margin-top: 84px; }

/* ----- zoekresultaten ----- */
.results-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-head h2 { font-size: 1.35rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 8px 8px 4px; box-shadow: var(--shadow); }
.result .crumb { padding: 4px 12px 0; font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb .k { font-weight: 800; letter-spacing: .08em; font-size: .68rem; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); }
.crumb .k.ooc { background: var(--ooc-soft); color: var(--ooc); }
.result details.art > summary { flex-wrap: wrap; }
.snippet { flex-basis: 100%; color: var(--muted); font-size: .92rem; font-weight: 400; margin-left: calc(3.7em + 12px); }
@media (max-width: 699px) { .snippet { margin-left: 0; } }
details[open] .snippet { display: none; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty { text-align: center; padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 1.3rem; margin-bottom: 8px; }
.empty .btn { margin-top: 14px; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 16px 90px; text-align: center; color: var(--muted); font-size: .88rem; }
.site-footer p { max-width: 70ch; margin: .3em auto; }

/* ----- assistent ----- */
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 25; box-shadow: var(--shadow); min-height: 52px; padding: 12px 20px; }
@media (min-width: 700px) { .fab { display: none; } }
.assistant {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer), 100%); z-index: 50; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0, 0, 0, .15); display: flex; flex-direction: column;
  transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
}
.assistant.open { transform: none; visibility: visible; transition: transform .25s ease; }
@media (min-width: 1300px) { body.assistant-open { padding-right: var(--drawer); } .assistant { box-shadow: none; } }
.as-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; background: var(--brand-soft); }
.as-head h2 { font-size: 1.2rem; }
.as-head p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.as-head .grow { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; font-size: 1.15rem; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.as-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { max-width: 94%; border-radius: 16px; padding: 10px 14px; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot p { margin: .35em 0; }
.msg.bot ul { margin: .35em 0; padding-left: 1.2em; }
.verdict { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; border-radius: 999px; padding: 4px 12px 4px 9px; font-size: .92rem; margin-bottom: 4px; }
.v-ok { background: var(--brand-soft); color: var(--brand-dark); border: 1.5px solid var(--brand); }
.v-no { background: var(--red-soft); color: var(--red); border: 1.5px solid var(--red); }
.v-maybe { background: var(--ooc-soft); color: var(--ooc); border: 1.5px solid var(--ooc); }
.v-info { background: var(--blue-soft); color: var(--blue); border: 1.5px solid var(--blue); }
.v-none, .v-plain { background: var(--gray-soft); color: var(--muted); border: 1.5px solid var(--line); }
.followup { margin-top: 8px; padding: 9px 12px; border-radius: 12px; background: var(--blue-soft); border: 1px solid var(--blue); }
.followup strong { display: block; font-size: .85rem; color: var(--blue); margin-bottom: 2px; }
.followup ul { margin: 0; padding-left: 1.2em; }
.srcs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.srcs > span { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.srcs .chip { font-size: .8rem; padding: 3px 10px; min-height: 30px; }
.note { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.suggest { display: grid; gap: 8px; }
.suggest button { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 13px; font-size: .93rem; min-height: 44px; }
.suggest button:hover { border-color: var(--brand); background: var(--brand-soft); }
.as-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; background: var(--surface); }
.as-form { display: flex; gap: 8px; align-items: flex-end; }
.as-form textarea {
  flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 13px; font: inherit; background: var(--bg); color: var(--ink);
  min-height: 46px; max-height: 140px; line-height: 1.4;
}
.as-form textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.as-form .btn { min-height: 46px; padding: 0 18px; }
.as-form .btn:disabled { opacity: .55; cursor: not-allowed; }
.as-disc { margin: 8px 2px 0; font-size: .76rem; color: var(--muted); line-height: 1.4; }
.as-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--brand-dark); text-decoration: underline; font-size: .82rem; }
@media (max-width: 699px) { .assistant { width: 100%; border-left: 0; } .assistant .as-log { padding: 12px; } }

@media print {
  .topbar, .kinds, .toolbar, .toc, .fab, .assistant, .hero::before, .art-actions, .site-footer, .quick { display: none !important; }
  body { background: #fff; color: #000; padding: 0 !important; }
  .layout { display: block; padding: 0; }
  details.ch, .part-banner { box-shadow: none; }
}

/* ----- telefoon: bovenbalk past op het scherm ----- */
@media (max-width: 699px) {
  #ask-open { display: none; }
  .brand small { display: none; }
  .topbar-inner { gap: 10px; }
  .hero-inner { padding-top: 26px; }
}
@media (max-width: 699px) {
  .brand span { display: none; }
  .topbar-inner { padding: 8px 12px; }
}
