/* Rondom: tekenvel van de maatschappelijk werker. Gebroken wit papier met stippen, blauwzwarte inkt,
   viltstift-handschrift (Kalam) voor namen op de kaart, Bricolage Grotesque voor de rest. */

@font-face { font-family: 'Kalam'; src: url('fonts/kalam-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --papier: #f7f3ea;
  --vel: #fffdf8;
  --inkt: #22303c;
  --inkt-zacht: #5a6470;
  --lijn: #e3dccd;
  --oranje: #e08a2c;
  --groen: #2e7d5b;
  --rood: #c43d2b;
  --grijs: #8a8172;
  --blauw: #2a5687;
  --schaduw: 0 1px 0 rgba(34, 48, 60, .05), 0 14px 34px -16px rgba(34, 48, 60, .3);
  --letter: 'Bricolage Grotesque', system-ui, sans-serif;
  --hand: 'Kalam', 'Bricolage Grotesque', cursive;
}

* { box-sizing: border-box; touch-action: manipulation; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--papier); color: var(--inkt); font-family: var(--letter); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background-image: radial-gradient(rgba(34, 48, 60, .11) 1px, transparent 1.2px);
  background-size: 22px 22px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input { font: inherit; color: inherit; }
input { font-size: 1rem; }
button { cursor: pointer; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
.verborgen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Kop ---------- */
.kop { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 14px 20px 10px; }
.merk { display: flex; align-items: center; gap: 10px; }
.merk-teken { width: 38px; height: 38px; fill: var(--inkt); stroke: var(--inkt); stroke-width: 2.2; flex: none; }
.merk h1 { font-size: 1.6rem; line-height: 1; font-variation-settings: 'wdth' 90; }
.merk-sub { margin: 2px 0 0; font-size: .86rem; color: var(--inkt-zacht); }
.kop-knoppen { display: flex; gap: 6px; flex-wrap: wrap; }

.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--inkt);
  background: var(--inkt); color: var(--vel); font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
}
.knop.licht { background: var(--vel); color: var(--inkt); border-color: var(--lijn); }
.knop.licht:hover { border-color: var(--inkt); }
.knop.rood { background: transparent; color: var(--rood); border-color: currentColor; }
.knop:active { transform: translateY(1px); }

/* ---------- Werkvlak ---------- */
.werkvlak { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; padding: 0 20px 20px; height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.kaartvlak {
  position: relative; min-height: 0; border-radius: 26px; background: var(--vel);
  box-shadow: var(--schaduw); border: 1px solid var(--lijn); overflow: hidden;
}
#kaart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.leeg {
  position: absolute; left: 50%; top: calc(50% + 86px); transform: translateX(-50%); width: min(80%, 380px);
  margin: 0; text-align: center; color: var(--inkt-zacht); font-size: .92rem; pointer-events: none;
}
.leeg span { font-family: var(--hand); font-size: 1.1rem; color: var(--inkt); }

.legenda { position: absolute; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 7px 12px; list-style: none; font-size: .78rem; color: var(--inkt-zacht); background: rgba(255, 253, 248, .86); border-radius: 12px; max-width: calc(100% - 28px); }
.legenda li { display: flex; align-items: center; gap: 6px; }
.legenda svg { width: 30px; height: 10px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.l-sterk { stroke: var(--groen); stroke-width: 5; }
.l-normaal { stroke: var(--inkt); stroke-width: 2; }
.l-zwak { stroke: var(--grijs); stroke-width: 2.4; stroke-dasharray: 1.5 6; }
.l-conflict { stroke: var(--rood); stroke-width: 2.2; }
.l-verbroken { stroke: var(--grijs); stroke-width: 1.8; }

/* ---------- Paneel ---------- */
.paneel { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.spreek { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 22px; background: var(--inkt); color: var(--vel); box-shadow: var(--schaduw); }
.mic {
  position: relative; flex: none; width: 68px; height: 68px; border-radius: 50%; border: 0;
  background: var(--oranje); display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(224, 138, 44, .5);
}
.mic svg { width: 30px; height: 30px; fill: none; stroke: var(--inkt); stroke-width: 2.2; stroke-linecap: round; }
.mic svg rect { fill: var(--inkt); }
.luistert .mic { animation: adem 1.6s ease-in-out infinite; background: var(--vel); }
.luistert .mic svg rect { fill: var(--rood); stroke: var(--rood); }
@keyframes adem { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 138, 44, .55); } 50% { box-shadow: 0 0 0 12px rgba(224, 138, 44, 0); } }
.spreek-tekst { min-width: 0; flex: 1; }
.status { margin: 0; font-weight: 600; font-size: .95rem; }
.live { margin: 4px 0 0; min-height: 1.4em; font-family: var(--hand); font-size: 1.08rem; line-height: 1.35; color: #f3d7b3; overflow-wrap: anywhere; }

.typ { display: flex; gap: 8px; }
.typ input { flex: 1; min-width: 0; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--lijn); background: var(--vel); outline: none; }
.typ input:focus { border-color: var(--inkt); }

.verslag-kop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.verslag-kop h2 { font-size: 1.05rem; }
.sleutel { margin: 0; display: flex; gap: 4px; flex-wrap: wrap; font-size: .72rem; }
.sleutel span { padding: 1px 6px; border-radius: 6px; }
.verslag {
  flex: 1; min-height: 120px; overflow-y: auto; margin: 0; padding: 4px 14px; list-style: none;
  background: var(--vel); border: 1px solid var(--lijn); border-radius: 18px;
}
.verslag li { padding: 10px 0; border-bottom: 1px dashed var(--lijn); font-size: .95rem; animation: binnen .5s ease-out; }
.verslag li:last-child { border-bottom: 0; }
.verslag:empty::before { content: 'Hier komt te staan wat Rondom hoorde, met wat het herkende gemarkeerd. Begin bijvoorbeeld met: "Dit is Milan, hij is 15. Hij woont bij zijn moeder Ria, daar heeft hij een goede band mee."'; display: block; padding: 12px 0; color: var(--inkt-zacht); font-size: .9rem; }
@keyframes binnen { from { opacity: 0; transform: translateY(6px); } }
mark, .sleutel span { background: none; color: inherit; border-radius: 4px; padding: 0 2px; }
.m-persoon { background: #fde7c6; box-shadow: inset 0 -2px 0 var(--oranje); }
.m-client { font-weight: 700; background: #e3e7ec; }
.m-sterk, .sleutel .m-sterk { background: #d7ecdf; color: #1f5a40; }
.m-normaal { background: #ebe8e1; }
.m-zwak, .sleutel .m-zwak { background: #ece8df; color: #5f584b; }
.m-conflict, .sleutel .m-conflict { background: #f6d9d3; color: #8f2a1c; }
.m-verbroken, .sleutel .m-verbroken { background: #e6e1d8; color: #5f584b; text-decoration: line-through; }
.m-overleden { background: #e6e1d8; }

.privacy { margin: 0; font-size: .78rem; color: var(--inkt-zacht); line-height: 1.4; }
.privacy strong { color: var(--inkt); }

/* ---------- Bladen (bewerken, voorbeelden) ---------- */
.blad {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 22px; border: 0; border-radius: 24px;
  background: var(--vel); color: var(--inkt); box-shadow: 0 30px 80px -20px rgba(34, 48, 60, .5);
}
.blad::backdrop { background: rgba(34, 48, 60, .35); }
.blad h2 { font-size: 1.3rem; margin-bottom: 12px; outline: none; }
.velden { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.velden label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--inkt-zacht); }
.velden input { min-height: 44px; padding: 0 12px; border: 2px solid var(--lijn); border-radius: 12px; background: var(--papier); color: var(--inkt); font-weight: 500; }
.velden input:focus { border-color: var(--inkt); outline: none; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-size: .8rem; font-weight: 600; color: var(--inkt-zacht); margin-bottom: 6px; }
.keuzes { display: flex; flex-wrap: wrap; gap: 6px; }
.keuze { position: relative; padding: 7px 12px; border-radius: 999px; border: 2px solid var(--lijn); font-size: .88rem; font-weight: 500; cursor: pointer; }
.keuze input { position: absolute; opacity: 0; pointer-events: none; }
.keuze:has(input:checked) { border-color: var(--inkt); background: var(--inkt); color: var(--vel); }
.keuze-sterk:has(input:checked) { background: var(--groen); border-color: var(--groen); }
.keuze-conflict:has(input:checked) { background: var(--rood); border-color: var(--rood); }
.keuze-zwak:has(input:checked), .keuze-verbroken:has(input:checked) { background: var(--grijs); border-color: var(--grijs); }
.blad-knoppen { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.blad-knoppen .rood { margin-right: auto; }
.alleen-client { display: none !important; }
.is-client .alleen-client { display: flex !important; }
.is-client .alleen-persoon { display: none !important; }
.uitleg { margin: 0 0 12px; color: var(--inkt-zacht); font-size: .92rem; }
.verhalen { display: grid; gap: 8px; }
.verhaal { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--lijn); background: var(--papier); text-align: left; }
.verhaal strong { font-family: var(--hand); font-size: 1.3rem; }
.verhaal span { color: var(--inkt-zacht); font-size: .88rem; }
.verhaal:hover { border-color: var(--inkt); }

.melding {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 16px; background: var(--inkt); color: var(--vel); font-size: .92rem; box-shadow: var(--schaduw);
}

/* ---------- iPad staand en telefoon: kaart boven, blijft staan terwijl je vertelt ---------- */
@media (max-width: 900px) {
  .werkvlak { grid-template-columns: 1fr; height: auto; padding: 16px 16px 24px; gap: 14px; }
  .leeg { display: none; }
  .kaartvlak {
    position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 2; display: flex; flex-direction: column;
    /* papierkleurige rand erboven, zodat tekst die eronder door schuift niet boven de kaart uitsteekt */
    box-shadow: var(--schaduw), 0 -14px 0 0 var(--papier);
  }
  #kaart { position: relative; inset: auto; width: 100%; height: auto; aspect-ratio: 1 / 1; max-height: 58dvh; }
  .legenda { position: static; align-self: center; margin: 0 0 8px; background: none; justify-content: center; }
  .verslag { flex: none; max-height: none; overflow: visible; }
}
@media (max-width: 560px) {
  .kop { padding: 10px 16px 8px; }
  .merk h1 { font-size: 1.35rem; }
  .merk-sub { font-size: .78rem; }
  .kop-knoppen { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; width: calc(100% + 32px); }
  .kop-knoppen::-webkit-scrollbar { display: none; }
  .knop { min-height: 38px; padding: 0 13px; font-size: .88rem; }
  .kaartvlak { border-radius: 20px; }
  #kaart { max-height: 48dvh; }
  .legenda { padding: 0 8px; gap: 2px 9px; font-size: .68rem; }
  .legenda svg { width: 22px; }
  .leeg { top: calc(50% + 62px); font-size: .8rem; }
  .mic { width: 58px; height: 58px; }
  .velden { grid-template-columns: 1fr; }
  .blad { padding: 18px; }
  .keuze { padding: 5px 10px; font-size: .84rem; }
  fieldset { margin-top: 10px; }
}
