/*
 * Nationaal Contract- en Leveranciersmanagementonderzoek — losstaande stijl (eigen bestand; de volwassenheidsscan blijft ongewijzigd).
 *
 * Geen webfont en geen externe verzoeken. CLVM-palet: forest green, amber, terracotta,
 * slate en cream. Contrast (WCAG AA): forest op cream 7,6:1, wit op forest 8,1:1,
 * slate op cream 6,0:1, terracotta op wit 5,2:1. Wit haalt op amber geen 4,5:1, dus
 * amber alleen als accentlijn of met donkere inkt. De grote scorecijfers staan in een
 * systeem-serif (Fraunces is niet lokaal beschikbaar en Google Fonts is bewust geen optie, #681).
 */

:root {
  --forest: #2D5A1B;
  --forest-hover: #24491a;
  --amber: #C97D10;
  --terracotta: #B0512A;
  --slate: #4A6272;
  --cream: #F9F7F2;
  --surface: #ffffff;
  --border: #d6d2c6;
  --ink: #1f1f1e;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  /* Focusrand: forest haalt ≥3:1 op cream, wit én de lichtgroene aangevinkte keuze (#f1f6ee);
     amber haalde dat op lichte vlakken niet (WCAG 1.4.11). */
  --focus: var(--forest);
}

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  padding: 10px 16px; border-radius: 8px;
  background: var(--forest); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.survey:focus, .survey h1:focus { outline: none; }

.survey-shell {
  padding: 32px 20px calc(56px + env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.survey { max-width: 760px; margin: 0 auto; }
.survey-noscript { max-width: 760px; margin: 0 auto; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* ── Kop en typografie ───────────────────────────────────────────────────── */

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.survey a.survey-logo { text-decoration: none; }
.survey-logo { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--forest); font-weight: 800; text-decoration: none; }

.survey h1 {
  margin: 12px 0 0;
  font-size: clamp(1.6rem, 4.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest);
  overflow-wrap: break-word;
  /* Geen automatische afbreking ("leveranciersma-nagement"); alleen op een zacht
     afbreekstreepje in de tekst. */
  hyphens: manual;
}
.survey h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--forest); }
.survey h3 { margin: 0 0 4px; font-size: 1.05rem; color: var(--forest); }
.survey p { margin: 12px 0 0; }
.lead { font-size: 1.05rem; line-height: 1.7; }
.intro-question { margin-top: 12px; font-size: 1.2rem; font-weight: 600; line-height: 1.4; color: var(--slate); }
.note { font-size: 0.9rem; color: var(--slate); }
.survey a { color: var(--forest); text-decoration: underline; text-underline-offset: 2px; }

.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: #e7efe2; color: var(--forest);
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
}

.card { margin-top: 24px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.privacy-card { border-left: 4px solid var(--amber); }
.privacy-card p { font-size: 0.95rem; }

/* ── Voortgang ───────────────────────────────────────────────────────────── */

.progress-head { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--slate); }
.progress-track { margin-top: 8px; height: 8px; border-radius: 999px; background: #e3dfd3; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--forest); transition: width 0.2s; }

/* ── Vragen ──────────────────────────────────────────────────────────────── */

/* min-width: 0 — een fieldset is standaard min-content breed en duwt de pagina dan breder
   dan het scherm (WCAG 1.4.10 reflow). */
.question { min-width: 0; margin: 24px 0 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.question.has-error { border-color: var(--terracotta); border-width: 2px; }
.q-legend { display: block; padding: 0; font-weight: 700; font-size: 1rem; color: var(--ink); }
/* Legend binnen de kaart in plaats van op de rand (standaardweergave van fieldset/legend). */
fieldset.question > .q-legend { float: left; width: 100%; }
fieldset.question > .q-legend + * { clear: both; }
.q-optional { font-weight: 400; color: var(--slate); }
.q-help, .q-counter, .q-max-status { margin: 6px 0 0; font-size: 0.875rem; color: var(--slate); }
.q-max-status:empty { display: none; }

.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; min-height: 44px;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer;
}
.choice:hover { border-color: var(--slate); }
.choice:has(input:checked) { border-color: var(--forest); background: #f1f6ee; }
.choice:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
/* hyphens: auto (lang=nl): lange woorden breken met afbreekstreepje; overflow-wrap is de vangrail. */
.choice-text { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.choice input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--forest); cursor: inherit; }
.scale-num { display: inline-block; min-width: 1.4em; font-weight: 700; color: var(--forest); }

.scale-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.scale-row .choice { flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 8px 4px; font-weight: 700; }
@media (max-width: 359px) { .scale-row { gap: 4px; } } /* schaalknoppen ~44px breed op 320px */
.scale-legend { display: grid; gap: 2px; font-size: 0.85rem; color: var(--slate); }

.field-error { margin: 8px 0 0; color: var(--terracotta); font-size: 0.9rem; font-weight: 600; }
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.error-summary ul { margin: 8px 0 0; padding-left: 20px; font-weight: 400; }
.error-summary a { color: var(--terracotta); }
/* Tikvlak ≥44px voor de ankerlinks; block (niet inline-block) houdt het opsommingsteken bij de eerste regel. */
.error-summary li a { display: block; min-height: 44px; padding: 10px 0; }
.error-summary {
  margin-top: 20px; padding: 12px 16px; border-radius: 10px;
  border: 2px solid var(--terracotta); background: #fff; color: var(--terracotta); font-weight: 600;
}

/* ── Formuliervelden ─────────────────────────────────────────────────────── */

.contact-block { margin-top: 20px; padding: 18px 20px; border: 1px solid var(--border); border-left: 4px solid var(--forest); border-radius: var(--radius); background: var(--surface); }
.field { margin-top: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.9rem; font-weight: 600; }
.text-input {
  display: block; width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
  color: var(--ink); font: inherit;
}
.text-input[aria-invalid="true"] { border-color: var(--terracotta); }
.textarea { margin-top: 10px; min-height: 110px; resize: vertical; }
.checkbox-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; font-size: 0.95rem; cursor: pointer; }
.checkbox-row input { flex: 0 0 auto; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--forest); }

/* Honeypot: buiten beeld, niet bereikbaar met toetsenbord of schermlezer. */
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ── Knoppen ─────────────────────────────────────────────────────────────── */

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn-row.spread { justify-content: space-between; }
.btn {
  min-height: 48px; padding: 12px 22px; border: 1.5px solid var(--forest); border-radius: 999px;
  background: #fff; color: var(--forest); font: inherit; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--forest); color: #fff; }
.btn.primary:hover { background: var(--forest-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Scorecard ───────────────────────────────────────────────────────────── */

.score-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
@media (min-width: 560px) { .score-grid { grid-template-columns: 1fr 1fr; } }
.score-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 18px 20px;
  border: 1px solid var(--border); border-top: 4px solid var(--forest); border-radius: var(--radius); background: #fff;
}
.score-name { font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate); }
.score-value { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; line-height: 1.1; color: var(--forest); }
.score-value small { font-family: inherit; font-size: 1rem; color: var(--slate); }
.score-level { font-weight: 700; color: var(--ink); }
.score-importance { margin-top: 4px; font-size: 0.875rem; color: var(--slate); }
.total-row { display: grid; gap: 12px; margin-top: 12px; align-items: center; }
@media (min-width: 560px) { .total-row { grid-template-columns: 1fr 1fr; } }
.score-total { border-top-color: var(--amber); background: #fffaf1; }
.score-total .score-value { font-size: 3.2rem; }
.self-level { margin: 0; padding: 16px 20px; border: 1px dashed var(--slate); border-radius: var(--radius); background: #fff; font-weight: 600; color: var(--slate); }

@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}
