/* tekentafel.css: het prentenboek (narrenbesluit 0006, skill tekentafel).
   Geen framework, geen webfonts, geen CDN. Papier uit gradients, krijt uit border-radius-trucs.
   De krijtkleur per afdeling komt uit /css/krijt.css (make), als var(--krijt). */

:root {
  --inkt: #2b2b2b;
  --papier: #fffaf0;
  --papier-donker: #f3e9d2;
  --krijt: #fb8c00;
  --rand: 5px;
  --wiebel: 255px 18px 225px 18px / 18px 225px 18px 255px;     /* een kind trekt geen rechte lijn */
  --wiebel-2: 18px 225px 18px 255px / 255px 18px 225px 18px;
  --letter: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round", "Comic Sans MS",
            "Chalkboard SE", "Segoe UI", system-ui, sans-serif;
  --kinderhand: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", "Bradley Hand", ui-rounded,
            "Arial Rounded MT Bold", "Nunito", "Quicksand", "Ubuntu", "DejaVu Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--inkt); font: 1.125rem/1.5 var(--letter);
  /* papier: een zachte gloed, een korrel uit een SVG-filter (data-URI, geen bestand van buiten) en vage lijntjes */
  background-color: var(--papier);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .9), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='k'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23k)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent 0 2.2rem, rgba(30, 136, 229, .07) 2.2rem calc(2.2rem + 1px));
  padding: 0 1rem 2rem;
}
a { color: inherit; }
h1, h2, .bordje, .knop, button, .onder, .mee, .zonwolk { font-family: var(--kinderhand); }

/* ---------- de kop van elke pagina ---------- */
.kop { position: relative; max-width: 72rem; margin: 0 auto; padding: 1.5rem 0 .5rem; text-align: center; }
.kop h1 {
  display: inline-block; margin: .5rem auto .25rem; padding: .1em .6em; font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.1; transform: rotate(-1.5deg);
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--krijt) 55%, transparent) 58% 88%, transparent 88%);
}
.gang-pagina .kop h1 { --krijt: #fdd835; }
.tafel-pagina .kop h1 { font-size: clamp(1.6rem, 4vw, 2.5rem); }
.onder { margin: .25rem auto 1rem; max-width: 46rem; font-size: clamp(1.05rem, 2.6vw, 1.35rem); }
.terug {
  display: inline-flex; align-items: center; min-height: 44px; padding: .4rem 1rem; margin-top: .25rem;
  border: 4px solid var(--inkt); border-radius: var(--wiebel); background: #fff; text-decoration: none;
  font-family: var(--kinderhand); box-shadow: 3px 4px 0 var(--krijt);
}
.kop .terug { display: flex; width: max-content; margin: 0 auto .5rem 0; }

/* ---------- de zon (rechtsboven in de gang) ---------- */
.zon {
  position: absolute; right: -.25rem; top: .25rem; width: 4.25rem; height: 4.25rem; padding: 0; border: 0;
  background: none; cursor: pointer; animation: draai 40s linear infinite; transition: translate .4s ease;
}
.zon img { width: 100%; height: 100%; display: block; }
.zon.opzij { translate: -1.5rem .5rem; }
@keyframes draai { to { rotate: 360deg; } }
.zonwolk {
  position: absolute; right: 4.5rem; top: 4rem; z-index: 2; max-width: 16rem; margin: 0; padding: .75rem 1rem;
  background: #fff; border: 4px solid var(--inkt); border-radius: var(--wiebel); font-size: 1.1rem;
  box-shadow: 4px 5px 0 #fdd835; text-align: left;
}
@media (max-width: 40rem) {
  .zon { width: 4rem; height: 4rem; }
  .gang-pagina .kop { padding-top: 4.5rem; }
  .zonwolk { right: .5rem; top: 4.5rem; }
}
@media (prefers-reduced-motion: reduce) { .zon { animation: none; } }

/* ---------- de gang met deurtjes ---------- */
.gang {
  list-style: none; margin: 1.5rem auto 0; padding: 0 .5rem; max-width: 72rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11.5rem, 100%), 1fr)); gap: 2rem 1.5rem; align-items: end;
}
.deurtje {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-height: 20rem; padding: 4.75rem 1rem 1.25rem; text-align: center; text-decoration: none; color: var(--inkt);
  background:
    linear-gradient(var(--krijt), var(--krijt)) padding-box;
  border: 6px solid var(--inkt); border-radius: 50% 50% 10px 12px / 28% 30% 10px 12px;
  box-shadow: inset 0 0 0 10px color-mix(in srgb, var(--krijt) 75%, #fff), 6px 8px 0 rgba(0, 0, 0, .12);
  transition: transform .15s ease, rotate .15s ease;
}
.gang li:nth-child(odd) .deurtje { rotate: -1deg; }
.gang li:nth-child(even) .deurtje { rotate: 1.2deg; }
.deurtje:hover, .deurtje:focus-visible { transform: translateY(-6px); rotate: 0deg; }
.deurtje:focus-visible, .ton:focus-visible, button:focus-visible, .knop:focus-visible, .terug:focus-visible {
  outline: 5px dashed var(--inkt); outline-offset: 5px;
}
@media (max-width: 40rem) { .deurtje { min-height: 15rem; } }
/* het raampje bovenin de deur */
.raampje {
  position: absolute; top: 1.4rem; left: 50%; width: 3.6rem; height: 2.6rem; translate: -50% 0;
  background: #e3f2fd; border: 5px solid var(--inkt); border-radius: 50% 50% 6px 6px / 70% 70% 6px 6px;
}
.raampje::after { content: ""; position: absolute; inset: -5px auto -5px 50%; border-left: 5px solid var(--inkt); }
/* het naambordje */
.bordje {
  display: block; padding: .35rem .7rem; background: #fff; border: 4px solid var(--inkt); border-radius: var(--wiebel-2);
  font-size: 1.3rem; line-height: 1.15; rotate: -2deg; box-shadow: 2px 3px 0 rgba(0, 0, 0, .15);
}
.deurtje .uitleg {
  display: block; margin: .9rem 1.1rem 0 0; padding: .3rem .5rem; font-size: 1rem; line-height: 1.3;
  background: rgba(255, 255, 255, .78); border-radius: 12px;
}
.deurtje small {
  margin-top: auto; padding: .2rem .6rem; font-size: .9rem; background: #fff; border: 3px solid var(--inkt);
  border-radius: 999px;
}
/* de deurknop */
.deurtje::after {
  content: ""; position: absolute; right: .55rem; top: 60%; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: #fdd835; border: 4px solid var(--inkt);
}
/* de ton, aan het eind van de gang */
.ton-plek { align-self: end; grid-column-end: -1; }   /* aan het eind van de gang */
.ton {
  display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  padding: .5rem; border-radius: 20px;
}
.ton img { width: 100%; max-width: 8rem; height: auto; transition: rotate .2s ease; }
.ton:hover img { rotate: -3deg; }
.ton b { font-family: var(--kinderhand); font-size: 1.1rem; }
.ton span { font-size: .9rem; max-width: 12rem; }
/* de kermisdeur (besluit 0012): de enige kleur die niet uit het krijtdoosje komt */
.kermisdeur {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-height: 20rem; padding: .9rem 1rem 1.25rem; text-align: center; text-decoration: none; color: var(--inkt);
  background: #ffc400; border: 6px solid #ff2e88; border-radius: 50% 50% 10px 12px / 28% 30% 10px 12px;
  box-shadow: inset 0 0 0 8px #ffe082, 0 0 18px 4px rgba(255, 46, 136, .55), 6px 8px 0 rgba(0, 0, 0, .12);
  rotate: -1.5deg; transition: transform .15s ease, rotate .15s ease;
}
.kermisdeur:hover, .kermisdeur:focus-visible { transform: translateY(-6px); rotate: 0deg; }
.kermisdeur:focus-visible { outline: 5px dashed var(--inkt); outline-offset: 5px; }
.kermisdeur img { width: min(7.5rem, 70%); height: auto; }
.kermisdeur .bordje { margin-top: -.4rem; }
.kermisdeur .uitleg {
  display: block; margin: .7rem .4rem 0; padding: .3rem .5rem; font-size: 1rem; line-height: 1.3;
  background: rgba(255, 255, 255, .85); border-radius: 12px;
}
.kermisdeur small {
  margin-top: auto; padding: .2rem .6rem; font-size: .9rem; background: #fff; border: 3px solid #ff2e88;
  border-radius: 999px;
}
.kermisdeur .nieuw {
  position: absolute; right: -.8rem; top: -.6rem; z-index: 1; padding: .15rem .55rem; rotate: 8deg;
  font: 700 1rem/1.3 var(--kinderhand); color: #fff; background: #ff2e88; border: 3px solid var(--inkt);
  border-radius: 999px; animation: knipper 1s steps(2, jump-none) infinite;   /* 1x aan, 1x uit per seconde */
}
@keyframes knipper { to { opacity: 0; } }
@media (max-width: 40rem) { .kermisdeur { min-height: 15rem; } }
@media (prefers-reduced-motion: reduce) {
  .kermisdeur, .kermisdeur:hover, .kermisdeur:focus-visible { transition: none; transform: none; }
  .kermisdeur .nieuw { animation: none; }
}
/* de vloer van de gang */
.vloer {
  max-width: 72rem; height: 1.6rem; margin: -.4rem auto 0; border-top: 6px solid var(--inkt);
  background: repeating-linear-gradient(90deg, #d7b98e 0 3.5rem, #caa877 3.5rem 7rem);
  border-radius: 0 0 40px 30px / 0 0 12px 16px; opacity: .9;
}

/* ---------- achter een deurtje: de galerij ---------- */
.afdeling .kop h1 { transform: rotate(-1deg); }
.galerij {
  list-style: none; margin: 1.5rem auto; padding: 0; max-width: 72rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 2rem;
}
.galerij a {
  display: flex; flex-direction: column; gap: .4rem; height: 100%; padding: 1rem; text-decoration: none;
  background: #fff; border: 5px solid var(--inkt); border-radius: var(--wiebel); box-shadow: 6px 7px 0 var(--krijt);
  transition: transform .15s ease;
}
.galerij li:nth-child(odd) a { rotate: -1deg; }
.galerij li:nth-child(even) a { rotate: 1deg; }
.galerij a:hover, .galerij a:focus-visible { transform: translateY(-5px) rotate(.5deg); }
.galerij img { width: 100%; height: auto; border: 3px solid var(--inkt); border-radius: 8px; background: #fff; }
.galerij b { font-family: var(--kinderhand); font-size: 1.25rem; line-height: 1.2; }
.galerij span { font-size: .98rem; }
.leeg { padding: 2rem; text-align: center; font-family: var(--kinderhand); font-size: 1.3rem; }

/* ---------- de tekentafel ---------- */
#tafel {
  max-width: 78rem; margin: 1rem auto; display: grid; gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) 20rem; align-items: start;
}
@media (max-width: 56rem) { #tafel { grid-template-columns: 1fr; } }
.vel {
  position: relative; background: #fff; border: 5px solid var(--inkt); border-radius: var(--wiebel);
  box-shadow: 8px 10px 0 var(--krijt), 0 0 0 1px rgba(0, 0, 0, .04);
}
.doek-vel { border-radius: 22px 10px 26px 12px / 12px 26px 10px 22px; padding: .75rem; justify-self: center; width: 100%; max-width: calc((100vh - 4rem) * 595 / 842 + 1.5rem); }
#doek {
  display: block; width: 100%; height: auto; aspect-ratio: 595 / 842; touch-action: none; cursor: crosshair;
  border-radius: 6px; background: #fff;
}
#tafel[data-gereedschap="emmer"] #doek { cursor: cell; }
#debug {
  position: absolute; left: 1rem; top: 1rem; padding: .25rem .6rem; background: #212121; color: #fff;
  font: 700 1rem/1.2 ui-monospace, monospace; border-radius: 6px;
}
.laden { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
@media (max-width: 56rem) { .laden { position: static; } }
.groep { display: flex; flex-wrap: wrap; gap: .6rem; }
button, .knop {
  min-height: 48px; min-width: 48px; padding: .45rem 1rem; font-size: 1.15rem; color: var(--inkt); cursor: pointer;
  background: #fff; border: 4px solid var(--inkt); border-radius: var(--wiebel); box-shadow: 3px 4px 0 rgba(0, 0, 0, .18);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  transition: transform .1s ease;
}
button:active, .knop:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .18); }
button[aria-pressed="true"] { background: color-mix(in srgb, var(--krijt) 35%, #fff); box-shadow: 3px 4px 0 var(--krijt); }
#gereedschap button { flex: 1 1 auto; }
#diktes button { width: 3.5rem; }
.punt { display: block; border-radius: 50%; background: var(--inkt); }
.punt-3 { width: 6px; height: 6px; } .punt-6 { width: 12px; height: 12px; } .punt-14 { width: 24px; height: 24px; }

/* het palet: krijtjes in een doosje */
.palet {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; padding: .8rem;
  background: #fff; border: 4px solid var(--inkt); border-radius: var(--wiebel-2);
}
@media (max-width: 56rem) { .palet { max-width: 30rem; } }
.krijtje {
  min-width: 0; min-height: 0; width: 100%; aspect-ratio: 1 / 1.6; padding: 0; border: 3px solid var(--inkt);
  border-radius: 45% 45% 10px 10px / 30% 30% 10px 10px; background: var(--kleur);
  box-shadow: inset 0 -.6rem 0 rgba(0, 0, 0, .12);
}
.krijtje[aria-pressed="true"] {
  background: var(--kleur); box-shadow: inset 0 -.6rem 0 rgba(0, 0, 0, .12), 0 0 0 4px #fff, 0 0 0 8px var(--inkt);
  transform: translateY(-4px) rotate(-4deg);
}
.gekozen { margin: -.4rem 0 0; text-align: center; font-family: var(--kinderhand); font-size: 1.1rem; min-height: 1.6em; }

/* de bestelling: neem maar mee */
.bestel {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: center; padding: 1rem;
  background: color-mix(in srgb, var(--krijt) 22%, #fff); border: 4px dashed var(--inkt); border-radius: var(--wiebel);
}
.mee { flex: 1 0 100%; margin: 0; text-align: center; font-size: 1.35rem; line-height: 1.2; }
.bestel button { flex: 1 1 6rem; flex-direction: column; gap: 0; font-size: 1.3rem; font-weight: 700; }
.bestel button small { font-size: .8rem; font-weight: 400; line-height: 1.15; }  /* de kleine lettertjes (besluit 0009) */

/* ---------- de ton en de lantaarn ---------- */
.ton-vel, .lantaarn-vel { max-width: 46rem; margin: 1.5rem auto; padding: 1.5rem 2rem 2rem; }
.ton-groot { display: block; width: min(12rem, 60%); height: auto; margin: 0 auto 1rem; }
.ton-vel h2 { margin: 1.5rem 0 .25rem; font-size: 1.6rem; }
.niets { padding-left: 0; list-style: none; }
.niets li { margin: .4rem 0; padding-left: 2.2rem; position: relative; }
.niets li::before {
  content: "\2715"; position: absolute; left: 0; top: -.05em; font: 700 1.4rem/1.2 var(--kinderhand); color: #e53935;
}
blockquote {
  margin: 1.5rem 0 0; padding: 1rem 1.25rem; font: 1.3rem/1.35 var(--kinderhand); background: #fffde7;
  border: 4px solid var(--inkt); border-radius: var(--wiebel-2); rotate: -1deg;
}
blockquote small { font-size: 1rem; }
/* de SLA: een contract met de hand op een bierviltje */
.sla { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .5rem 0 0; padding: 1rem 1.25rem;
  border: 3px dashed var(--inkt); border-radius: var(--wiebel); }
.sla dt { font-weight: 700; }
.sla dd { margin: 0; }
@media (max-width: 30rem) { .sla { grid-template-columns: 1fr; } .sla dd { margin-bottom: .4rem; } }
.lantaarn { --krijt: #fdd835; }
.lantaarn-vel { text-align: center; margin-top: 3rem; }
.mannetje { display: block; width: min(10rem, 55%); height: auto; margin: 0 auto; }
.lantaarn-vel h1 { margin: .5rem 0 0; font-size: clamp(1.8rem, 5vw, 2.6rem); }
.groot { font: 1.4rem/1.3 var(--kinderhand); margin: .25rem 0 1rem; }

/* ---------- de voet ---------- */
.voet { max-width: 72rem; margin: 3rem auto 0; text-align: center; font-size: 1rem; opacity: .85; }
.voet p { margin: .25rem 0; }
.voet p:first-child { font-family: var(--kinderhand); font-size: 1.1rem; }
