/* Gedeelde stylesheet voor alle lessen en referentiedocumenten.
   Tufte-geïnspireerd: rustige typografie, veel wit, printvriendelijk. */

:root {
  --ink: #1a1a14;
  --ink-soft: #55554a;
  --paper: #fffdf7;
  --accent: #a8471d;        /* roest-oranje: verbranding */
  --accent-soft: #f3e2d3;
  --line: #d9d4c5;
  --ok: #2e7d43;
  --bad: #b3362a;
  --code-bg: #f4f1e8;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Charter, Georgia, 'Times New Roman', serif;
  line-height: 1.6;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

/* ---- Koppen ---- */

.kicker {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

h1 {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.4rem 0 0.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.6rem 0 0.4rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0 0 1.5rem;
}

/* ---- Tekstelementen ---- */

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 650; }

.term { font-style: italic; }
.term-en {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82em;
  color: var(--ink-soft);
}

figure { margin: 1.5rem 0; }
figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  margin: 1rem 0;
}
th, td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---- Kaders ---- */

.box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: #fdf9f0;
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
  border-radius: 0 6px 6px 0;
}
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }

.box-title {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

details.reveal {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin: 1rem 0;
}
details.reveal summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Quiz (assets/quiz.js) ---- */

.quiz-q {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
  background: #fffefb;
}
.q-text { font-weight: 600; margin: 0 0 0.7rem; }
.q-opts { display: flex; flex-direction: column; gap: 0.45rem; }
.q-opt {
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.15s;
}
.q-opt:hover:not(:disabled) { background: var(--accent-soft); }
.q-opt:disabled { cursor: default; }
.q-opt.is-right { border-color: var(--ok); background: #e7f3ea; font-weight: 600; }
.q-opt.is-wrong { border-color: var(--bad); background: #f9e9e7; opacity: 0.75; }
.q-feedback { font-size: 0.88rem; margin: 0.6rem 0 0; color: var(--ink-soft); }
.q-feedback.is-right::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.q-feedback.is-wrong::before { content: "✗ "; color: var(--bad); font-weight: 700; }

/* ---- Motorsimulatie (assets/engine-cycle.js) ---- */

.engine-sim {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  padding: 1rem;
  margin: 1.4rem 0;
}
.engine-sim svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.engine-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.8rem;
}
.engine-controls button {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  cursor: pointer;
}
.engine-controls button:hover { background: var(--accent-soft); }
.engine-controls button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.engine-status {
  text-align: center;
  font-size: 0.9rem;
  min-height: 2.6em;
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
}
.engine-status strong { color: var(--ink); }

/* ---- Volgordespel (assets/sequence.js) ---- */

.seq-game {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
}
.seq-prompt { font-weight: 600; margin: 0 0 0.7rem; }
.seq-done {
  margin: 0 0 0.8rem;
  padding-left: 1.4rem;
}
.seq-done li {
  background: #e7f3ea;
  border: 1px solid #bcd9c4;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  margin: 0.3rem 0;
  font-size: 0.92rem;
}
.seq-pool { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.seq-pool button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
}
.seq-pool button:hover { background: var(--accent-soft); }
.seq-pool button.flash-wrong {
  border-color: var(--bad);
  background: #f9e9e7;
}
.seq-feedback { font-size: 0.88rem; margin: 0.7rem 0 0; color: var(--ink-soft); min-height: 1.2em; }
.seq-feedback.is-wrong::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.seq-feedback.is-done { color: var(--ok); font-weight: 600; }
.seq-feedback.is-done::before { content: "✓ "; }
.seq-reset {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  margin-top: 0.8rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  cursor: pointer;
}

/* ---- Systeemdiagram (assets/engine-diagram.js) ---- */

main.wide { max-width: 62rem; }

.ed-wrap { margin: 1.5rem 0; }
.ed-svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  padding: 0.5rem;
}
.ed-part { cursor: pointer; transition: opacity 0.15s; }
.ed-svg.has-sel .ed-part { opacity: 0.18; }
.ed-svg.has-sel .ed-part.sel { opacity: 1; }
.ed-badge-t {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
}
.ed-label {
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  fill: var(--ink-soft);
  text-anchor: middle;
  pointer-events: none;
}
.ed-hint { font-size: 0.85rem; color: var(--ink-soft); margin: 0.7rem 0 1.4rem; }
.ed-legend { column-count: 2; column-gap: 2.2rem; font-size: 0.88rem; }
.ed-sys { break-inside: avoid; margin: 0 0 1.1rem; }
.ed-sys h3 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.ed-sys ul { list-style: none; margin: 0; padding: 0; }
.ed-dot {
  display: inline-block;
  width: 0.7em; height: 0.7em;
  border-radius: 50%;
  margin-right: 0.45em;
}
.ed-item {
  padding: 0.28rem 0.4rem;
  border-radius: 5px;
  cursor: pointer;
  break-inside: avoid;
}
.ed-item:hover { background: var(--code-bg); }
.ed-item.sel { background: var(--accent-soft); }

@media (max-width: 700px) { .ed-legend { column-count: 1; } }

/* ---- Kleptiming (assets/valve-timing.js) ---- */

.vt-slider {
  display: block;
  width: 100%;
  margin: 0.9rem 0 0.2rem;
  accent-color: var(--accent);
}
.vt-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  justify-content: center;
  font-family: Avenir, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}
.vt-readouts b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
  display: inline-block;
}
.vt-readouts b.vt-open { color: var(--ok); }
.vt-readouts b.vt-closed { color: var(--ink-soft); }

.vt-fig {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  padding: 1rem 1rem 0.8rem;
  margin: 1.4rem 0;
}
.vt-fig svg {
  display: block;
  margin: 0 auto;
  max-width: 380px;
  width: 100%;
  height: auto;
}
.vt-fig.vt-fig-wide svg { max-width: 680px; }
.vt-fig figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}

/* ---- Navigatie / voettekst ---- */

.lesson-nav {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.teacher-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  background: var(--code-bg);
}

/* ---- Onderdelentekening (assets/parts-map.js) ---- */

.pm-wrap { margin: 1.5rem 0; }
.pm-figure {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
}
.pm-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}
.pm-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.22rem;
  border-radius: 0.7rem;
  border: 2px solid var(--accent);
  background: rgba(255, 253, 247, 0.55);
  color: var(--accent);
  font: 600 0.68rem/1 Avenir, 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 253, 247, 0.75);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}
.pm-marker-maybe { border-style: dashed; }
.pm-marker:hover { transform: translate(-50%, -50%) scale(1.15); }
.pm-figure.has-sel .pm-marker { opacity: 0.22; }
.pm-figure.has-sel .pm-marker.sel {
  opacity: 1;
  background: var(--accent);
  color: #fff;
  transform: translate(-50%, -50%) scale(1.3);
  z-index: 2;
}

.pm-legend { column-count: 2; column-gap: 2.2rem; font-size: 0.88rem; margin-top: 1.6rem; }
.pm-sys { break-inside: avoid; margin: 0 0 1.2rem; }
.pm-sys h3 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.pm-dot {
  display: inline-block;
  width: 0.7em; height: 0.7em;
  border-radius: 50%;
  margin-right: 0.45em;
}
.pm-les { font-size: 0.8rem; color: var(--ink-soft); margin: 0 0 0.45rem; }
.pm-sys ul { list-style: none; margin: 0; padding: 0; }
.pm-item {
  display: flex;
  gap: 0.45rem;
  padding: 0.26rem 0.4rem;
  border-radius: 5px;
  cursor: pointer;
  break-inside: avoid;
}
.pm-item:hover { background: var(--code-bg); }
.pm-item.sel { background: var(--accent-soft); }
.pm-legend.has-sel .pm-item:not(.sel) { opacity: 0.5; }
.pm-num {
  flex: 0 0 auto;
  min-width: 1.7rem;
  font: 600 0.78rem Avenir, 'Helvetica Neue', Arial, sans-serif;
  color: var(--accent);
}
.pm-body { display: block; }
.pm-maybe { color: var(--ink-soft); font-style: italic; }
.pm-note { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.1rem; }

@media (max-width: 700px) { .pm-legend { column-count: 1; } }

/* ---- Print ---- */

@media print {
  html { font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .engine-controls, .teacher-note, .ed-hint, .vt-slider { display: none; }
  .ed-svg { border: none; padding: 0; }
  a { color: var(--ink); text-decoration: none; }
  .quiz-q, .box { break-inside: avoid; }
  .pm-marker {
    box-shadow: none;
    background: #fff;
    opacity: 1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .pm-figure.has-sel .pm-marker { opacity: 1 !important; }
  .pm-legend { column-count: 2; }
  .pm-legend.has-sel .pm-item:not(.sel) { opacity: 1; }
}
