/* Open Vertaling — thema en basisopmaak. Controls hebben elk hun eigen CSS.
 *
 * Kleuren komen uit het logo: lapisblauw en hemelsblauw (de bladzijden) en
 * zonnegeel (het licht). Lapis en loodtingeel zijn ook de pigmenten van de
 * Hollandse 17e eeuw, de tijd van de Statenvertaling.
 */

/* ── Lettertypen (SIL Open Font License, zie fonts/OFL.txt) ─────────────── */
@font-face { font-family: 'Source Serif 4'; src: url('../fonts/source-serif-4-latin-normal.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('../fonts/source-serif-4-latin-italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
/* Lexend alleen voor het woordmerk: OpenVertaling, "Open" vet en "Vertaling" dun. */
@font-face { font-family: 'Lexend'; src: url('../fonts/lexend-300.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('../fonts/lexend-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/ibm-plex-sans-latin-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* ── Kleuren ────────────────────────────────────────────────────────────── */
:root {
    --lapis: #1F3A9E;
    --lapis-deep: #142a78;
    --sky: #3E7BF0;
    --sun: #FFB81C;
    --sun-soft: #FFF1CC;
    --night: #101845;

    --paper: #FAFBFE;
    --surface: #FFFFFF;
    --mist: #EEF2FB;
    --ink: #1A2140;
    --muted: #5A6382;
    --line: #DDE3F2;
    --focus: #3E7BF0;
    --danger: #B3261E;
    --ok: #1E7A4C;

    --accent: var(--lapis);          /* links, actieve staat */
    --accent-soft: rgba(62, 123, 240, .12);

    --hl-geel: #FFE8A3;
    --hl-groen: #CFEFD6;
    --hl-blauw: #D3E2FF;
    --hl-roze: #FAD4E2;

    --font-text: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --reader-size: 19px;

    --topbar-h: 64px;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 69, .05), 0 8px 24px rgba(16, 24, 69, .07);
    color-scheme: light;
}

:root[data-theme="donker"] {
    --lapis: #8FB0FF;
    --lapis-deep: #B9CCFF;
    --sky: #5B8CF5;
    --sun: #FFC94D;
    --sun-soft: #3A3218;
    --night: #0A0F2E;

    --paper: #0E1433;
    --surface: #151D45;
    --mist: #1B2552;
    --ink: #E9ECF7;
    --muted: #A2AAC8;
    --line: #27326A;
    --focus: #8FB0FF;
    --danger: #FF8A80;
    --ok: #7FD6A4;

    --accent: #8FB0FF;
    --accent-soft: rgba(143, 176, 255, .14);

    --hl-geel: #5B4A12;
    --hl-groen: #1F4A30;
    --hl-blauw: #23407A;
    --hl-roze: #5A2340;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

/* ── Basis ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
/* Tot alle controls er zijn: geen half opgebouwde pagina laten zien. */
html.c4m-booting body > * { visibility: hidden; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--sun-soft); }

/* Koppen: Source Serif 4 met optische grootte; groot = scherper contrast. */
h1, h2, h3 { font-family: var(--font-text); font-optical-sizing: auto; font-weight: 600; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.012em; }
h1 { font-size: clamp(32px, 4.2vw, 46px); }
h2 { font-size: clamp(25px, 3vw, 32px); }
h3 { font-size: 20px; letter-spacing: -.005em; }
p { margin: 0 0 1em; }

/* Woordmerk: één woord, het verschil zit in het gewicht. */
.wordmark { font-family: 'Lexend', var(--font-ui); font-weight: 300; letter-spacing: -.02em; white-space: nowrap; }
.wordmark b { font-weight: 700; color: var(--lapis); }
:root[data-theme="donker"] .wordmark b { color: var(--sun); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); }
.main { min-width: 0; min-height: calc(100vh - var(--topbar-h)); }
.page { max-width: 1120px; margin: 0 auto; padding: 40px 28px 72px; }
.page-narrow { max-width: 460px; }

@media (max-width: 900px) {
    .page { padding: 24px 18px 56px; }
}

/* ── Knoppen en velden ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 18px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font: 500 14.5px/1 var(--font-ui); cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: border-color .15s, background-color .15s;
}
.btn:hover { border-color: var(--sky); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--lapis); border-color: var(--lapis); color: #fff; }
:root[data-theme="donker"] .btn-primary { color: var(--night); }
.btn-primary:hover { background: var(--lapis-deep); border-color: var(--lapis-deep); }
.btn-sun { background: var(--sun); border-color: var(--sun); color: #1A1400; }
.btn-sun:hover { filter: brightness(1.04); border-color: var(--sun); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 16px; }
.btn-icon { width: 40px; padding: 0; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 14px; font-weight: 500; color: var(--ink); }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
    width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font: 15.5px/1.4 var(--font-ui);
}
textarea.input { min-height: 100px; resize: vertical; font-family: var(--font-text); font-size: 17px; }
.input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px var(--accent-soft); }

.form-error { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 4px 0 10px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--mist); color: var(--muted); }
.badge-gold { background: var(--sun-soft); color: #7A5600; }
:root[data-theme="donker"] .badge-gold { color: var(--sun); }
.badge-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs button {
    border: 0; background: none; padding: 12px 14px; font: 500 15px var(--font-ui); color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sky); }

.empty { padding: 32px 0; text-align: center; color: var(--muted); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--sky); animation: spin .8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Meldingen ──────────────────────────────────────────────────────────── */
.c4m-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.c4m-toast {
    background: var(--night); color: #fff; padding: 11px 18px; border-radius: 999px;
    box-shadow: var(--shadow); font-size: 14.5px; transition: opacity .3s;
}
:root[data-theme="donker"] .c4m-toast { background: var(--ink); color: var(--night); }
.c4m-toast-error { background: var(--danger) !important; color: #fff !important; }
.c4m-toast.out { opacity: 0; }

/* ── Leespagina's (Over, Vertaalprincipes, API, een nieuwsbericht) ─────────── */
/* Paginakop: licht van rechtsboven, waar de zon staat; onderaan een streep in de logokleuren. */
.page-head {
    position: relative; overflow: hidden;
    background:
        radial-gradient(55% 90% at 92% 8%, color-mix(in srgb, var(--sun) 22%, transparent) 0%, transparent 70%),
        radial-gradient(40% 70% at 0% 100%, color-mix(in srgb, var(--sky) 12%, transparent) 0%, transparent 70%),
        var(--mist);
}
.page-head::before {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
    background: linear-gradient(90deg, var(--lapis) 0%, var(--sky) 55%, var(--sun) 100%);
}
/* Het logo als zon achter de kop: groot, rustig, half buiten beeld. */
.page-head::after {
    content: ''; position: absolute; right: -120px; top: -80px; width: 460px; height: 460px;
    background: url('../img/logo.svg') center / contain no-repeat; opacity: .12; pointer-events: none;
}
.page-head > * { position: relative; z-index: 1; }
@media (max-width: 900px) { .page-head::after { width: 300px; height: 300px; right: -110px; top: -60px; } }

/* Bovenregel boven een paginakop, zoals op de voorpagina. */
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font: 600 13px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--lapis); }
.eyebrow::before { content: ''; width: 28px; height: 3px; border-radius: 2px; background: var(--sun); }

/* Leesvoortgang: een dunne zonnestreep onder de bovenbalk (Views.Basic.longread). */
.read-progress {
    position: fixed; left: 0; right: 0; top: var(--topbar-h); height: 3px; z-index: 49; pointer-events: none;
    background: linear-gradient(90deg, var(--sky), var(--sun)); transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}

/* Initiaal: de eerste letter van een leestekst, zoals in een oude bijbeldruk. */
.dropcap::first-letter {
    float: left; font: 600 3.6em/.82 var(--font-text); color: var(--lapis);
    margin: .07em .1em 0 -.02em; padding-right: .04em;
}

/* Beelden en kaders schuiven rustig in beeld; alleen als JS dat aanzet en de lezer beweging wil. */
html.longread-anim .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
html.longread-anim .reveal.is-in { opacity: 1; transform: none; }
@media print {
    html.longread-anim .reveal { opacity: 1; transform: none; }
    .read-progress { display: none; }
}

/* ── Cookiemelding (Views.Basic.privacyNote): klein, onderin, blokkeert niets ─ */
.privacy-note {
    position: fixed; left: 20px; bottom: 20px; z-index: 150; max-width: 420px;
    display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 18px;
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--sun);
    border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.5;
    animation: privacy-note-in .4s ease-out both;
}
.privacy-note p { margin: 0; }
.privacy-note .btn { flex: none; }
@keyframes privacy-note-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 560px) {
    .privacy-note { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media print { .privacy-note { display: none; } }

/* ── Tabellen ───────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
