/* Even dit — vormgeving */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/Newsreader.woff") format("woff");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/Newsreader-Italic.woff") format("woff");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/InstrumentSans.woff") format("woff");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

/* ---------- Kleuren per leesstand ---------- */

:root,
[data-theme="nacht"] {
  --bg: #1c0f1d;
  --vel: #241426;
  --ink: #f3e5d5;
  --ink-zacht: rgba(243, 229, 213, 0.8);
  --ink-stil: rgba(243, 229, 213, 0.5);
  --accent: #cf9474;
  --accent-zacht: rgba(207, 148, 116, 0.82);
  --lijn: rgba(243, 229, 213, 0.12);
  --schaduw: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
[data-theme="dag"] {
  --bg: #f7f2ea;
  --vel: #fbf8f3;
  --ink: #1e1619;
  --ink-zacht: rgba(30, 22, 25, 0.78);
  --ink-stil: rgba(30, 22, 25, 0.52);
  --accent: #7c2a36;
  --accent-zacht: rgba(124, 42, 54, 0.85);
  --lijn: rgba(30, 22, 25, 0.12);
  --schaduw: rgba(60, 40, 30, 0.18);
  color-scheme: light;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}
/* iOS: volg de systeemtekstgrootte (Dynamic Type). */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html { font: -apple-system-body; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Newsreader", "Iowan Old Style", "Palatino", Georgia, serif;
  font-optical-sizing: auto;
  font-kerning: normal;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background-color .4s ease, color .4s ease;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
:focus { outline: none; }
:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

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

/* ---------- Opbouw: kop · leesvlak · voet ---------- */

.app {
  --zij: clamp(1.5rem, 7.5vw, 2.4rem);
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.kop, .voet {
  display: grid;
  grid-template-columns: var(--knop) minmax(0, 1fr) var(--knop);
  --knop: clamp(44px, 3rem, 56px);
  align-items: center;
  padding-inline: calc(var(--zij) - 0.85rem);
}
.kop { padding-top: 0.6rem; padding-bottom: 0.25rem; }
.voet { padding-top: 0.5rem; padding-bottom: max(0.9rem, 0.4rem); }

.titel {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-weight: 400;
  font-size: min(1.1rem, 22px);
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: var(--ink-zacht);
}

.icoonknop {
  width: clamp(44px, 3rem, 56px);
  height: clamp(44px, 3rem, 56px);
  display: grid;
  place-items: center;
  color: var(--accent);
  border-radius: 50%;
  transition: opacity .2s ease, color .2s ease;
}
.icoonknop svg { width: min(1.45rem, 28px); height: min(1.45rem, 28px); overflow: visible; }
.kop .icoonknop:first-child { justify-self: start; opacity: .7; }
.kop .icoonknop:last-child { justify-self: end; }
.icoonknop[aria-disabled="true"] { opacity: .3; cursor: default; }
@media (hover: hover) {
  .icoonknop:not([aria-disabled="true"]):hover,
  .anders:hover { opacity: .75; }
}

.voet .icoonknop:first-child { justify-self: start; }
.voet .icoonknop:last-child { justify-self: end; }

.hart { fill: transparent; transition: fill .25s ease; }
#knop-hart[aria-pressed="true"] .hart { fill: currentColor; }

.anders {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 0.75rem;
  font-size: min(1.05rem, 21px);
  white-space: nowrap;
  color: var(--accent);
  border-radius: 999px;
  transition: opacity .2s ease;
}
.anders svg { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Leesvlak ---------- */

.lees {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: 0.5rem var(--zij) 1.5rem;
  scrollbar-width: none;
}
.lees::-webkit-scrollbar { display: none; }

/* Ruimte boven en onder: iets boven het midden voor korte en middellange teksten. */
.lees::before, .lees::after { content: ""; flex: 2 1 0; min-height: 0; }
.lees::after { flex-grow: 3; }

[data-modus="lang"] .lees::before { flex: 0 0 clamp(1rem, 6vh, 3.5rem); }
[data-modus="lang"] .lees::after { flex: 1 0 2.5rem; }

.blok {
  --fs: 2rem;
  margin: 0 auto;
  width: 100%;
  max-width: var(--maat, 34rem);
  flex: 0 0 auto;
  transition: opacity .55s ease, filter .55s ease;
}
.blok.uit {
  opacity: 0;
  filter: blur(6px);
  transition-duration: .28s;
}

.tekst {
  margin: 0;
  font-size: var(--fs);
  line-height: var(--lh, 1.4);
  font-weight: var(--gewicht, 400);
  letter-spacing: var(--spatie, 0);
  color: var(--ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
  hanging-punctuation: first;
  font-feature-settings: "kern", "liga", "onum" 0;
}
.tekst p { margin: 0; }
.tekst p + p { margin-top: var(--alinea, 0.75em); }
.tekst em { font-style: italic; font-weight: inherit; }
.tekst .regel { display: block; padding-left: 1.1em; text-indent: -1.1em; }

[data-modus="kort"] .tekst { text-wrap: balance; }

.onder {
  margin-top: var(--onder-marge, 1.75rem);
}

.auteur {
  margin: 0;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 450;
  letter-spacing: 0.1em;
  line-height: 1.35;
  color: var(--ink-zacht);
}

.bronlink {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0.15rem 0 0 -0.5rem;
  padding: 0.55rem 0.5rem;   /* groot genoeg aanraakvlak, klein ogende link */
  min-height: 2.75rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent-zacht);
}
.bronlink span { font-size: 0.95em; }

.testlabel {
  margin: 0.8rem 0 0;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-zacht);
}

.leeg {
  margin: auto;
  color: var(--ink-stil);
}

/* Liggend of weinig hoogte: kop en voet compacter. */
@media (max-height: 500px) {
  .kop { padding-top: 0.15rem; padding-bottom: 0; }
  .voet { padding-top: 0; padding-bottom: 0.2rem; }
  .lees { padding-top: 0.25rem; padding-bottom: 0.75rem; }
}

/* ---------- Vellen (bron en verzameling) ---------- */

.vel {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 36rem;
  max-height: min(85dvh, 85vh);
  background: var(--vel);
  color: var(--ink);
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -10px 40px var(--schaduw);
  overflow: hidden;
}
.vel::backdrop {
  background: rgba(10, 4, 10, 0.55);
}
[data-theme="dag"] .vel::backdrop { background: rgba(40, 25, 20, 0.28); }

.vel[open] { animation: vel-in .35s ease both; }
.vel[open]::backdrop { animation: waas-in .35s ease both; }
@keyframes vel-in { from { opacity: 0; transform: translateY(1.25rem); } }
@keyframes waas-in { from { opacity: 0; } }

.vel-binnen {
  max-height: inherit;
  overflow-y: auto;
  padding: 0.6rem calc(var(--zij, 1.75rem) - 0.25rem) calc(1.75rem + env(safe-area-inset-bottom));
}

.vel-vol {
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}
.vel-vol .vel-binnen {
  height: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

.vel-kop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.vel-titel {
  margin: 0;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--ink-zacht);
}
.sluit { margin-right: -0.75rem; }

/* Broninformatie */
.bron-origineel {
  margin: 0.25rem 0 1.5rem;
  font-size: 1.35rem;
  line-height: 1.35;
}
.bron-origineel p { margin: 0; }
.bron-origineel p + p { margin-top: 0.5em; }
.bron-gegevens {
  margin: 0;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-zacht);
}
.bron-gegevens dt {
  margin-top: 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-stil);
}
.bron-gegevens dd { margin: 0.2rem 0 0; }
.bron-gegevens a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

/* Verzameling */
.lijst { list-style: none; margin: 0; padding: 0; }
.lijst li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border-top: 1px solid var(--lijn);
}
.lijst li:last-child { border-bottom: 1px solid var(--lijn); }
.lijst-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 1.1rem 0;
}
.lijst-tekst {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--ink);
}
.lijst-auteur {
  display: block;
  margin-top: 0.45rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-zacht);
}
.lijst .icoonknop { margin-top: 0.6rem; margin-right: -0.75rem; color: var(--ink-stil); }
.lijst .icoonknop svg { width: 1.2rem; height: 1.2rem; }
.lijst-leeg {
  margin: 2rem 0;
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--ink-zacht);
  max-width: 24em;
}

/* ---------- Zelf toevoegen ---------- */

.tekstknop {
  min-height: 2.75rem;
  padding: 0 0.25rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.tekstknop.sterk {
  padding: 0 1.4rem;
  border: 1px solid var(--accent-zacht);
  border-radius: 999px;
}
.tekstknop.gevaar { color: var(--ink-stil); }
.tekstknop.gevaar.bevestig { color: var(--accent); }

.lijst-kop {
  margin: 1.5rem 0 0.25rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-weight: 450;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-stil);
}
.toevoegen {
  margin: 2rem 0 1rem;
  text-align: center;
}
.syncregel {
  margin: 0.4rem 0 0;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-stil);
}
.syncregel button {
  font-size: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  padding: 0.6rem 0.2rem;
}

.schrijf { display: flex; flex-direction: column; gap: 1.1rem; }
.keuze {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.keuze label { position: relative; }
.keuze input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.keuze span {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid var(--lijn);
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--ink-zacht);
}
.keuze input:checked + span { border-color: var(--accent-zacht); color: var(--accent); }
.keuze input:focus-visible + span { outline: 1.5px solid var(--accent); outline-offset: 3px; }

.veld { display: flex; flex-direction: column; gap: 0.35rem; }
.veld-naam {
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-stil);
}
.veld-naam i { font-style: normal; text-transform: none; letter-spacing: 0.02em; }
.veld input, .veld textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--lijn);
  background: transparent;
  color: var(--ink);
  padding: 0.5rem 0;
  border-radius: 0;
  font: inherit;
  font-size: max(16px, 1.1rem);
  -webkit-appearance: none;
  appearance: none;
}
.veld textarea {
  font-size: max(16px, 1.35rem);
  line-height: 1.4;
  resize: vertical;
  min-height: 9rem;
  border: 1px solid var(--lijn);
  border-radius: 0.6rem;
  padding: 0.75rem 0.9rem;
}
.veld input:focus, .veld textarea:focus { outline: none; border-color: var(--accent-zacht); }
.veld input::placeholder { color: var(--ink-stil); }
.vinkje {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--ink-zacht);
}
.vinkje input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.schrijf-melding {
  margin: 0;
  min-height: 1.2em;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--accent);
}
.schrijf-acties { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
#knop-verwijder-eigen { align-self: flex-start; }
.koppel-uitleg {
  margin: 0 0 1.25rem;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-zacht);
}
.koppel-uitleg b { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }

/* Voorbeeldweergave: zelfde leesscherm, andere onderbalk */
.voorbeeldbalk {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.5rem var(--zij) max(0.9rem, 0.4rem);
}
.voorbeeldbalk[hidden] { display: none !important; }
.voorbeeldbalk .tekstknop:first-child { justify-self: start; }
.voorbeeldbalk .tekstknop:last-child { justify-self: end; }
.voorbeeldbalk .tekstknop { white-space: nowrap; }
.vb-label {
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-stil);
}
[data-voorbeeld] .voet { display: none; }
[data-voorbeeld] .kop .icoonknop { visibility: hidden; }
.app { grid-template-rows: auto minmax(0, 1fr) auto auto; }

/* ---------- Minder beweging ---------- */

@media (prefers-reduced-motion: reduce) {
  .blok, .blok.uit { transition: opacity .18s linear; filter: none; }
  .vel[open], .vel[open]::backdrop { animation: none; }
  body { transition: none; }
}
