/*
  Basis: reset, document, typografie, focus, formulieren en toegankelijkheid.
  Deze laag zet alleen het fundament; componenten staan in components.css.
  Figtree is het enige lettertype; alle kleuren komen uit tokens.css.
*/

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
select,
textarea {
  font-synthesis-weight: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

/* Figtree voor alle koppen; het display-token is gelijk aan de UI-token. */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

/* Kleinere koppen gebruiken dezelfde Figtree in interfacegewicht. */
h4,
h5,
h6 {
  font-family: var(--font-ui);
  font-weight: var(--weight-semibold);
}

h4 {
  font-size: var(--text-md);
}

h5 {
  font-size: var(--text-sm);
}

h6 {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
}

input, button, select, textarea { font: inherit; font-family: var(--font-ui); }

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Zichtbare focus met voldoende offset, ook op donkere vlakken. */
:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-ink);
}

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

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  border-radius: 5px;
}

hr {
  height: 0;
  margin: var(--space-4) 0;
  border: 0;
  border-top: var(--line-thin) solid var(--border);
}

code,
kbd,
samp,
pre {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

pre {
  overflow: auto;
  padding: var(--space-3);
  border: var(--line-thin) solid var(--border);
  border-radius: 5px;
  background: var(--fill);
}

[hidden] {
  display: none !important;
}

/* Tabellen: rustig, zonder zebrastrepen. */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

caption {
  padding-bottom: var(--space-2);
  color: var(--muted);
  text-align: left;
}

th {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--line-thin) solid var(--border);
  color: var(--muted);
  font-weight: var(--weight-medium);
  text-align: left;
  vertical-align: bottom;
}

td {
  padding: var(--space-3);
  border-bottom: var(--line-thin) solid var(--border);
  vertical-align: top;
}

tfoot td {
  font-weight: var(--weight-semibold);
}

/* Formulierbasis. De componentenlaag verfijnt velden en knoppen. */
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  font-weight: var(--weight-medium);
}

label {
  font-weight: var(--weight-medium);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: var(--line-thin) solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  line-height: var(--leading-snug);
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

input[type="radio"] {
  border-radius: var(--r-round);
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Alleen voor schermlezers, maar wel focusbaar waar nodig. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sr-only:focus,
.sr-only:active {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Dunne scrollbar in de neutrale lijnkleur. */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 5px;
  background: var(--border);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
