/* ==========================================================================
   Hardware Codelab — styling

   De design tokens hieronder zijn overgenomen uit de roadmap-app, zodat deze
   codelab naadloos in een iframe binnen de roadmap past.
   ========================================================================== */

:root {
  --bg: oklch(99% .003 270);
  --bg-sub: oklch(97.5% .004 270);
  --surface: #ffffff;
  --surface-2: oklch(98% .003 270);
  --border: oklch(92% .006 270);
  --border-strong: oklch(86% .008 270);
  --fg: oklch(20% .012 270);
  --fg-muted: oklch(45% .012 270);
  --fg-faint: oklch(62% .01 270);
  --accent: oklch(55% .16 265);
  --ok: oklch(58% .16 145);
  --accent-soft: color-mix(in oklch, var(--accent) 12%, var(--surface));
  --danger: oklch(55% .18 25);
  --assignment: oklch(58% .16 145);
  --product: oklch(68% .14 75);
  --knowledge: oklch(60% .14 235);
  --side: oklch(60% .14 305);
  --shadow-sm: 0 1px 0 oklch(0% 0 0 / .04), 0 1px 2px oklch(0% 0 0 / .04);
  --shadow-md: 0 1px 0 oklch(0% 0 0 / .04), 0 4px 12px -2px oklch(0% 0 0 / .08), 0 2px 4px -1px oklch(0% 0 0 / .04);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", "JetBrains Mono", monospace;

  --sidebar-w: 274px;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.muted { color: var(--fg-muted); }

/* --------------------------------------------------------------- layout */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
  background: var(--bg-sub);
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-head .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}
.sidebar-head .tagline {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--fg-muted);
  line-height: 1.45;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 10px 28px;
}

.track { margin-bottom: 4px; }
.track-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.track-btn:hover { background: var(--surface-2); }
.track-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--track-color, var(--accent));
}
.track-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.track-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--fg-faint);
  border-bottom: 1.8px solid var(--fg-faint);
  transform: rotate(-45deg);
  transition: transform .15s ease;
  flex-shrink: 0;
  margin-left: 2px;
}
.track[data-open="true"] .track-chevron { transform: rotate(45deg); }
.track-steps {
  display: none;
  margin: 2px 0 10px 11px;
  padding: 0 0 0 11px;
  list-style: none;
  border-left: 1px solid var(--border);
}
.track[data-open="true"] .track-steps { display: block; }

.step-link {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--fg-muted);
  text-align: left;
  cursor: pointer;
}
.step-link:hover { background: var(--surface-2); color: var(--fg); }
.step-link[aria-current="true"] {
  background: var(--accent-soft);
  color: color-mix(in oklch, var(--accent) 70%, var(--fg));
  font-weight: 600;
}
.step-check {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 2px;
  display: grid;
  place-items: center;
}
.step-link.done .step-check { background: var(--assignment); border-color: var(--assignment); }
.step-link.done .step-check::after {
  content: "";
  width: 6px;
  height: 3px;
  border-left: 1.7px solid #fff;
  border-bottom: 1.7px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.step-title { min-width: 0; }
.step-kind {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--assignment);
  flex-shrink: 0;
  margin-top: 3px;
}

.sidebar-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-bar {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--assignment);
  transition: width .25s ease;
}
.progress-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.reset-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--fg-faint);
  font: inherit;
  font-size: 11px;
}
.reset-btn:hover { color: var(--danger); text-decoration: underline; }

/* --------------------------------------------------------------- main */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg-muted);
}
.menu-btn svg { width: 15px; height: 15px; fill: currentColor; }
.crumb { font-size: 13px; color: var(--fg-muted); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb b { color: var(--fg); font-weight: 600; }
.crumb .sep { margin: 0 6px; color: var(--fg-faint); }

.topbar-spacer { flex: 1; min-width: 8px; }

.open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.open-btn:hover { border-color: var(--border-strong); background: var(--bg-sub); }
.open-btn svg { width: 12px; height: 12px; fill: currentColor; opacity: .7; display: block; }

.scroller { flex: 1; min-height: 0; overflow-y: auto; }

.article {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 24px 96px;
}
.article-head {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}
.article-head h1 { font-size: 1.9rem; line-height: 1.2; margin: 8px 0 10px; }
.article-head .lead { margin: 0; color: var(--fg-muted); line-height: 1.65; font-size: 14.5px; }
.kind-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-2);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.kind-uitleg { color: color-mix(in oklch, var(--knowledge) 60%, var(--fg)); border-color: color-mix(in oklch, var(--knowledge) 30%, var(--border)); }
.kind-opdracht { color: color-mix(in oklch, var(--assignment) 60%, var(--fg)); border-color: color-mix(in oklch, var(--assignment) 30%, var(--border)); }
.kind-naslag { color: color-mix(in oklch, var(--side) 60%, var(--fg)); border-color: color-mix(in oklch, var(--side) 30%, var(--border)); }

/* --------------------------------------------------------------- prose */

.prose { line-height: 1.75; color: var(--fg); font-size: 14.5px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.7em; margin: 1em 0 .4em; }
.prose h2 { font-size: 1.28em; margin: 1.7em 0 .4em; padding-bottom: .2em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.08em; margin: 1.4em 0 .3em; }
.prose p { margin: .7em 0; }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .86em;
  border: 1px solid var(--border);
}
.prose pre {
  margin: .9em 0;
  border-radius: var(--radius);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.62;
}
.prose pre code { background: none; padding: 0; border: none; font-size: 13px; }
.prose ul, .prose ol { margin: .7em 0 .7em 1.4em; padding: 0; }
.prose li { margin: .3em 0; }
.prose li > p { margin: .25em 0; }
.prose blockquote {
  border-left: 3px solid color-mix(in oklch, var(--accent) 50%, var(--border));
  padding-left: 14px;
  color: var(--fg-muted);
  margin: .8em 0;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.8em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: .9em 0; font-size: .95em; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose img { max-width: 100%; border-radius: var(--radius); }
.prose kbd {
  font-family: var(--mono);
  font-size: .8em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--fg);
  white-space: nowrap;
}
.table-scroll { overflow-x: auto; margin: .9em 0; }
.table-scroll table { margin: 0; }

/* --------------------------------------------------------------- admonitions */

.admonition {
  border-left: 4px solid var(--adm-color, var(--accent));
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 1.2em 0;
  overflow: hidden;
}
.admonition-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: color-mix(in oklch, var(--adm-color) 14%, var(--surface));
  color: color-mix(in oklch, var(--adm-color) 65%, var(--fg));
}
.admonition-icon { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; opacity: .9; }
.admonition-collapsible > summary { cursor: pointer; list-style: none; -webkit-user-select: none; user-select: none; }
.admonition-collapsible > summary::-webkit-details-marker { display: none; }
.admonition-collapsible > summary > .admonition-title::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.admonition-collapsible[open] > summary > .admonition-title::after { transform: rotate(45deg); }
.admonition-body { padding: 10px 14px; font-size: 13.5px; }
.admonition-body > :first-child { margin-top: 0; }
.admonition-body > :last-child { margin-bottom: 0; }

.admonition-note, .admonition-info       { --adm-color: oklch(60% .14 235); }
.admonition-tip, .admonition-success     { --adm-color: oklch(60% .14 160); }
.admonition-warning, .admonition-caution { --adm-color: oklch(68% .15 75); }
.admonition-danger, .admonition-bug      { --adm-color: oklch(55% .18 25); }
.admonition-example                      { --adm-color: oklch(58% .16 300); }
.admonition-hint                         { --adm-color: oklch(60% .14 200); }
.admonition-oplossing                    { --adm-color: oklch(58% .16 300); }
.admonition-uitdaging                    { --adm-color: oklch(68% .15 75); }

/* --------------------------------------------------------------- opdracht card */

.opdracht {
  margin: 1.4em 0;
  border: 1px solid color-mix(in oklch, var(--assignment) 32%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--assignment) 4%, var(--surface));
  overflow: hidden;
}
.opdracht-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 9px 14px;
  background: color-mix(in oklch, var(--assignment) 11%, var(--surface));
  border-bottom: 1px solid color-mix(in oklch, var(--assignment) 22%, var(--border));
  flex-wrap: wrap;
}
.opdracht-head .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: color-mix(in oklch, var(--assignment) 62%, var(--fg));
}
.opdracht-head .title { font-weight: 600; font-size: 13.5px; }
.opdracht-body { padding: 12px 14px; font-size: 14px; }
.opdracht-body > :first-child { margin-top: 0; }
.opdracht-body > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- lab (editor + preview) */

.lab {
  margin: 1.3em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.lab-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.lab-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lab-actions { margin-left: auto; display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.lab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.lab-btn:hover { border-color: var(--border-strong); background: var(--bg-sub); }
.lab-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.lab-btn.primary:hover { background: color-mix(in oklch, var(--accent) 86%, black); }
.lab-btn svg { width: 11px; height: 11px; fill: currentColor; }

.lab-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.lab[data-layout="preview"] .lab-split { grid-template-columns: minmax(0, 1fr); }
.lab[data-layout="preview"] .lab-code { display: none; }

/* Cap de hoogte: bij een lang voorbeeld zou de preview anders ver buiten beeld
   vallen terwijl je door de code scrollt. */
.lab-code {
  border-right: 1px solid var(--border);
  min-width: 0;
  max-height: 460px;
  overflow: auto;
}
.lab-preview-pane { display: flex; flex-direction: column; min-width: 0; background: var(--bg-sub); }
.lab-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px;
  min-height: 190px;
  overflow: auto;
  background-image:
    linear-gradient(45deg, oklch(95.5% .004 270) 25%, transparent 25%),
    linear-gradient(-45deg, oklch(95.5% .004 270) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, oklch(95.5% .004 270) 75%),
    linear-gradient(-45deg, transparent 75%, oklch(95.5% .004 270) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.lab-stage iframe {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: block;
  max-width: 100%;
}
.lab-console {
  border-top: 1px solid var(--border);
  background: var(--surface);
  max-height: 136px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  padding: 6px 10px;
  display: none;
}
.lab-console.has-output { display: block; }
.lab-console .row { display: flex; gap: 7px; padding: 1px 0; }
.lab-console .row .marker { color: var(--fg-faint); flex-shrink: 0; }
.lab-console .row .msg { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.lab-console .row.error { color: var(--danger); }
.lab-console .row.error .marker { color: var(--danger); }
.lab-console .row.warn { color: color-mix(in oklch, var(--product) 55%, var(--fg)); }
.lab-console .hint {
  display: block;
  margin-top: 3px;
  font-family: Inter, system-ui, sans-serif;
  color: var(--fg-muted);
  font-style: italic;
}

/* CodeMirror-skin, afgestemd op de roadmap-tokens */
.CodeMirror {
  height: auto;
  min-height: 190px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--surface);
  color: var(--fg);
}
.CodeMirror-gutters { background: var(--surface-2); border-right: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--fg-faint); font-size: 11px; }
.CodeMirror-cursor { border-left: 1.6px solid var(--accent); }
.CodeMirror-activeline-background { background: var(--surface-2); }
.CodeMirror-selected { background: color-mix(in oklch, var(--accent) 16%, transparent) !important; }
.CodeMirror-matchingbracket { color: var(--accent) !important; font-weight: 700; text-decoration: none !important; }
.cm-s-default .cm-keyword    { color: oklch(50% .18 300); }
.cm-s-default .cm-def        { color: oklch(48% .15 250); }
.cm-s-default .cm-variable   { color: var(--fg); }
.cm-s-default .cm-variable-2 { color: oklch(46% .13 250); }
.cm-s-default .cm-property   { color: oklch(44% .12 210); }
.cm-s-default .cm-number     { color: oklch(50% .16 45); }
.cm-s-default .cm-string     { color: oklch(46% .14 150); }
.cm-s-default .cm-comment    { color: var(--fg-faint); font-style: italic; }
.cm-s-default .cm-operator   { color: var(--fg-muted); }
.cm-s-default .cm-atom       { color: oklch(50% .16 45); }

/* --------------------------------------------------------------- reference cards */

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px;
  margin: 1.1em 0;
}
.ref-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}
.ref-card h4 { margin: 0 0 4px; font-size: 12.5px; }
.ref-card p { margin: 0; font-size: 12.5px; color: var(--fg-muted); line-height: 1.5; }

/* --------------------------------------------------------------- step nav */

.stepnav {
  display: flex;
  gap: 10px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.stepnav .navcard {
  flex: 1 1 200px;
  min-width: 0;
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--shadow-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stepnav .navcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stepnav .navcard .dir {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-faint);
  font-weight: 700;
  margin-bottom: 2px;
}
.stepnav .navcard .name { font-weight: 600; font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepnav .navcard.next { text-align: right; }
.stepnav .done-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklch, var(--assignment) 35%, var(--border));
  background: color-mix(in oklch, var(--assignment) 8%, var(--surface));
  color: color-mix(in oklch, var(--assignment) 55%, var(--fg));
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.stepnav .done-btn[aria-pressed="true"] { background: var(--assignment); border-color: var(--assignment); color: #fff; }

/* --------------------------------------------------------------- overview cards */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 1.3em 0;
}
.overview-card {
  display: block;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  border-left: 4px solid var(--track-color, var(--accent));
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  color: var(--fg);
}
.overview-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); border-left-color: var(--track-color, var(--accent)); }
.overview-card h3 { margin: 0 0 5px; font-size: 15px; }
.overview-card p { margin: 0 0 10px; font-size: 13px; color: var(--fg-muted); line-height: 1.55; }
.overview-card .meta { font-size: 11.5px; color: var(--fg-faint); font-family: var(--mono); }

/* --------------------------------------------------------------- misc */

.boot {
  display: grid;
  place-content: center;
  gap: 10px;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--fg-muted);
}
.error-box {
  background: color-mix(in oklch, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--danger) 35%, var(--border));
  color: var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: left;
}
.scrim { display: none; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    transform: translateX(-101%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }
  .app[data-menu="open"] .sidebar { transform: none; }
  .app[data-menu="open"] .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: oklch(20% .01 270 / .28);
  }
  .menu-btn { display: inline-flex; }
  .open-btn-label { display: none; }
  .open-btn { padding: 6px 9px; }
  .article { padding: 22px 16px 90px; }
  .lab-split { grid-template-columns: minmax(0, 1fr); }
  .lab-code { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ==========================================================================
   Toevoegingen voor de Hardware Codelab
   ========================================================================== */

.kind-onderdeel { color: color-mix(in oklch, var(--product) 55%, var(--fg)); border-color: color-mix(in oklch, var(--product) 35%, var(--border)); }

.trophy {
  font-size: 11px;
  font-weight: 600;
  color: color-mix(in oklch, var(--product) 60%, var(--fg));
  white-space: nowrap;
}

/* --------------------------------------------------------------- artikelkop met afbeelding */

.article-head.has-image {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 20px;
  align-items: center;
}
.article-image {
  width: 168px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #f4f5f7;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0 0 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}
.facts > div { background: var(--surface); padding: 8px 12px; }
.facts dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-size: 13px; font-weight: 550; }

/* --------------------------------------------------------------- statische codeblokken */

.codeblock {
  position: relative;
  margin: 1em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.codeblock-title {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}
.prose .codeblock pre {
  margin: 0;
  border: none;
  border-radius: 0;
  background: var(--surface);
}
.copy-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 11px;
  color: var(--fg-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.codeblock:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* --------------------------------------------------------------- simulator */

.lab-chip {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: color-mix(in oklch, var(--accent) 70%, var(--fg));
  background: var(--accent-soft);
}
.sim-lab .lab-split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.sim-lab[data-layout="preview"] .lab-split { grid-template-columns: minmax(0, 1fr); }
.sim-stage { padding: 0; place-items: stretch; display: block; min-height: 150px; }
.sim-stage iframe {
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.sim-idle {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--fg-faint);
  font-size: 12.5px;
}
.lab-console.serial {
  max-height: 180px;
  background: oklch(22% .01 270);
  color: oklch(92% .01 270);
  border-top: 1px solid oklch(30% .01 270);
}
.lab-console.serial .serial-title {
  position: sticky;
  top: -6px;
  margin: -6px -10px 4px;
  padding: 3px 10px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: oklch(70% .01 270);
  background: oklch(26% .01 270);
}
.lab-console.serial .row.error { color: oklch(72% .16 25); }
.lab-console.serial .row.error .marker { color: oklch(72% .16 25); }
.lab-console.serial .row.warn { color: oklch(82% .13 85); }
.lab-console.serial .row.warn .marker { color: oklch(82% .13 85); }
.lab-console.serial .hint { color: oklch(78% .01 270); }
.lab-console.serial .serial-line { display: block; white-space: pre-wrap; }

/* --------------------------------------------------------------- widgets */

.widget {
  margin: 1.3em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.w-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.w-title { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); }
.w-body { padding: 14px 16px; }
.w-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.w-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.w-grow { flex: 1 1 240px; }
.w-svg { display: block; max-width: 100%; height: auto; }
.w-note { font-size: 12.5px; color: var(--fg-muted); line-height: 1.55; }
.w-readout {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.w-readout b { font-weight: 700; }
.w-big { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.w-label { font-size: 11px; font-weight: 700; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .06em; }

.w-control { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.w-control > span { display: flex; justify-content: space-between; gap: 10px; color: var(--fg-muted); }
.w-control > span b { color: var(--fg); font-family: var(--mono); font-weight: 600; }
.w-control input[type="range"] { width: 100%; accent-color: var(--accent); }
.w-select, .w-input {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
}
.w-input { width: 110px; font-family: var(--mono); }

.w-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.w-chip {
  font: inherit;
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.w-chip:hover { border-color: var(--border-strong); }
.w-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.w-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
}
.w-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.w-col > .w-btn { align-self: flex-start; }

.w-challenge {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  background: color-mix(in oklch, var(--product) 7%, var(--surface));
}
.w-challenge .badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 99px;
  color: color-mix(in oklch, var(--product) 55%, var(--fg));
  background: color-mix(in oklch, var(--product) 18%, var(--surface));
}
.w-challenge .text { flex: 1; min-width: 0; line-height: 1.55; }
.w-challenge .text p { margin: 0; }
.w-challenge.solved { background: color-mix(in oklch, var(--ok) 9%, var(--surface)); }
.w-challenge.solved .badge { color: #fff; background: var(--ok); }
.w-feedback { font-size: 12.5px; margin-top: 4px; }
.w-feedback.ok { color: color-mix(in oklch, var(--ok) 70%, var(--fg)); font-weight: 600; }
.w-feedback.nok { color: var(--danger); }

/* kit-overzicht */
.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
}
.kit-item {
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  color: var(--fg);
  transition: box-shadow .12s, border-color .12s;
}
.prose a.kit-item, .prose a.kit-item:hover { color: var(--fg); text-decoration: none; }
.kit-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kit-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #f4f5f7; }
.kit-item .kit-name { padding: 7px 9px 1px; font-size: 12px; font-weight: 650; line-height: 1.3; }
.kit-item .kit-tag { padding: 0 9px 8px; font-size: 11px; color: var(--fg-faint); }
.kit-item.nolink { cursor: default; }
.kit-item.nolink:hover { box-shadow: none; border-color: var(--border); }
.kit-filter { padding: 12px 14px 0; }

/* pinout */
.pin-info { min-height: 120px; }
.pin-info h4 { margin: 0 0 4px; font-size: 15px; }
.pin-info .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.pin-info .tag {
  font-size: 11px;
  font-family: var(--mono);
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.pin-info .tag.warn { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 35%, var(--border)); }
.pin-hit { cursor: pointer; }
.pin-hit:hover rect, .pin-hit.active rect { stroke: var(--accent); stroke-width: 2.5; }

/* breadboard */
.bb-hole { cursor: pointer; }

/* quiz */
.quiz {
  margin: 1.4em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.quiz-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.quiz-chip { color: color-mix(in oklch, var(--product) 55%, var(--fg)); background: color-mix(in oklch, var(--product) 16%, var(--surface)); }
.quiz-title { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.quiz-score { margin-left: auto; font-size: 11.5px; font-family: var(--mono); color: var(--fg-faint); }
.quiz.complete .quiz-score { color: color-mix(in oklch, var(--ok) 70%, var(--fg)); font-weight: 700; }
.quiz-q { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.quiz-q:last-child { border-bottom: none; }
.quiz-question { font-weight: 600; margin-bottom: 8px; line-height: 1.55; }
.quiz-question p { margin: 0; }
.quiz-options { display: flex; flex-direction: column; gap: 5px; }
.quiz-opt {
  text-align: left;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.quiz-opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.quiz-opt.right { border-color: var(--ok); background: color-mix(in oklch, var(--ok) 10%, var(--surface)); }
.quiz-opt.wrong { border-color: var(--danger); background: color-mix(in oklch, var(--danger) 7%, var(--surface)); }
.quiz-opt code, .quiz-question code, .w-challenge code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}
.quiz-explain { font-size: 13px; margin-top: 7px; line-height: 1.55; }
.quiz-explain:empty { display: none; }
.quiz-explain.ok strong { color: color-mix(in oklch, var(--ok) 70%, var(--fg)); }
.quiz-explain.nok strong { color: var(--danger); }

@media (max-width: 880px) {
  .sim-lab .lab-split { grid-template-columns: minmax(0, 1fr); }
  .sim-lab .lab-head { flex-wrap: wrap; row-gap: 6px; }
  .sim-lab .lab-title { flex: 1 1 auto; }
  .sim-lab .lab-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .article-head.has-image { grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
  .article-image { width: 96px; }
}
