/* nl.desu.be — plain CSS, locally served. Mobile first; no horizontal page overflow.
   Visual identity borrowed from kumo (palette, navbar, cards, buttons, alerts and the
   VitePress-style day/night switch), re-expressed without Bootstrap. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-interactive: #5b6270;
  --text: #1a1d23;
  --muted: #5b6270;
  --text-tertiary: #6b7280;
  --accent: #d9770e;
  --accent-hover: #b8630a;
  --accent-text: #14161a;
  --link: var(--accent);

  --ok: #276749;
  --ok-bg: #d1e7dd;
  --ok-border: #badbcc;
  --warn: #664d03;
  --warn-bg: #fff3cd;
  --warn-border: #ffecb5;
  --bad: #c92a2a;
  --bad-hover: #a61e1e;
  --bad-bg: #f8d7da;
  --bad-border: #f5c2c7;
  --info: #055160;
  --info-bg: #cff4fc;
  --info-border: #b6effb;

  --switch-bg: #e2e8f0;
  --switch-icon: #718096;
  --focus: color-mix(in srgb, var(--accent) 45%, transparent);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: 200ms ease;
}

/* Dark palette: applied when chosen with the switch, or by the OS when no choice was made. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e2024;
  --bg-subtle: #2c2f35;
  --surface: #25282d;
  --border: #34373d;
  --border-interactive: #9ea1a8;
  --text: #e8e9eb;
  --muted: #9ea1a8;
  --text-tertiary: #868a91;
  --accent: #e8912f;
  --accent-hover: #f2a34a;
  --accent-text: #14161a;
  --ok: #5aa77a;
  --ok-bg: #16321f;
  --ok-border: #234a2c;
  --warn: #ffd43b;
  --warn-bg: #3a2f0d;
  --warn-border: #524115;
  --bad: #ff6b6b;
  --bad-hover: #ff8787;
  --bad-bg: #3a1f1f;
  --bad-border: #5c2b2b;
  --info: #7dd3e0;
  --info-bg: #163238;
  --info-border: #204650;
  --switch-bg: #2d3748;
  --switch-icon: #cbd5e0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1e2024;
    --bg-subtle: #2c2f35;
    --surface: #25282d;
    --border: #34373d;
    --border-interactive: #9ea1a8;
    --text: #e8e9eb;
    --muted: #9ea1a8;
    --text-tertiary: #868a91;
    --accent: #e8912f;
    --accent-hover: #f2a34a;
    --accent-text: #14161a;
    --ok: #5aa77a;
    --ok-bg: #16321f;
    --ok-border: #234a2c;
    --warn: #ffd43b;
    --warn-bg: #3a2f0d;
    --warn-border: #524115;
    --bad: #ff6b6b;
    --bad-hover: #ff8787;
    --bad-bg: #3a1f1f;
    --bad-border: #5c2b2b;
    --info: #7dd3e0;
    --info-bg: #163238;
    --info-border: #204650;
    --switch-bg: #2d3748;
    --switch-icon: #cbd5e0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 15px; }
@media (min-width: 48rem) { html { font-size: 16px; } }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: no-preference) {
  body { transition: background-color var(--transition), color var(--transition); }
}
main { flex: 1 0 auto; }
.container { width: 100%; max-width: 64rem; margin: 0 auto; padding: 1rem; }
.narrow { max-width: 30rem; }
h1 { font-size: 1.6rem; font-weight: 600; margin: 0.25rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1rem 0 0.25rem; }
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus);
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em;
  background: var(--bg-subtle); border-radius: 4px; padding: 0.05em 0.3em; }
pre { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem; overflow-x: auto; white-space: pre-wrap; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--border); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent);
  color: var(--accent-text); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ header / navbar */
.site-header { background: var(--bg); border-bottom: 1px solid var(--border);
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05); margin-bottom: 0.5rem; }
.site-header .bar { padding: 0.5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.brand { font-weight: 600; font-size: 1.2rem; text-decoration: none; color: var(--accent); margin-right: auto;
  white-space: nowrap; overflow-wrap: normal; flex-shrink: 0; }
.brand:hover { color: var(--accent-hover); }
.header-tools { display: flex; align-items: center; gap: 0.6rem; }
.site-header nav { flex: 1 1 100%; }
.site-header ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.site-header li { margin: 0; }
.site-header nav a, .site-header nav .link-button {
  display: block; width: 100%; text-align: left; padding: 0.6rem 1rem; text-decoration: none;
  color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); }
.site-header nav a:hover, .site-header nav .link-button:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.site-header nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 0;
  width: 2.5rem; height: 2.1rem; padding: 0; color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm); }
.nav-toggle[hidden] { display: none; }
.nav-toggle svg { width: 1.3rem; height: 1.3rem; stroke: currentColor; }
.site-header.nav-collapsed nav { display: none; }
@media (min-width: 72rem) {
  .site-header .bar { flex-wrap: nowrap; }
  .brand { margin-right: 1rem; }
  .site-header nav, .site-header.nav-collapsed nav { display: block; flex: 1 1 auto; order: 2; }
  .header-tools { order: 3; }
  .nav-toggle { display: none; }
  .site-header ul { flex-direction: row; flex-wrap: wrap; gap: 0; }
  .site-header nav a, .site-header nav .link-button {
    width: auto; padding: 0.5rem 0.55rem; border: 0; background: none; border-radius: var(--radius-sm); }
  .site-header nav a:hover, .site-header nav .link-button:hover { background: none; }
  .site-header nav a[aria-current="page"] { background: none; }
}
form.inline { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; min-height: 0; font: inherit; cursor: pointer; color: var(--link); }
.link-button:hover { color: var(--accent-hover); }

/* ------------------------------------------------------------------ theme switch (kumo / VitePress) */
.vt-switch { position: relative; flex-shrink: 0; width: 40px; height: 24px; min-height: 0; padding: 0;
  border: 1px solid var(--border-interactive); border-radius: var(--radius-pill);
  background: var(--switch-bg); cursor: pointer; }
.vt-switch[hidden] { display: none; }
.vt-switch-check { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); box-shadow: var(--shadow-sm); }
.vt-switch-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px; fill: var(--switch-icon); opacity: 0; }
.vt-switch-icon.icon-sun { opacity: 1; }
[data-theme="dark"] .vt-switch-check { transform: translateX(16px); }
[data-theme="dark"] .vt-switch-icon.icon-sun { opacity: 0; }
[data-theme="dark"] .vt-switch-icon.icon-moon { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .vt-switch { transition: border-color var(--transition), background-color var(--transition); }
  .vt-switch-check { transition: transform var(--transition); }
  .vt-switch-icon { transition: opacity var(--transition); }
}
.public-tools { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; max-width: 64rem; margin: 0 auto; padding: 0.75rem 1rem 0; }

.site-footer { color: var(--text-tertiary); text-align: center; padding-top: 1.5rem; padding-bottom: 1.5rem; flex-shrink: 0; }
.site-footer p { margin: 0.25rem 0; }

/* ------------------------------------------------------------------ alerts */
.flash, .notice { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin: 0 0 1rem;
  border: 1px solid var(--info-border); background: var(--info-bg); color: var(--info); }
.flash-ok, .notice.good { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.flash-error, .notice.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-border); }
.notice { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); margin: 0.75rem 0; }
.flash a, .notice a { color: inherit; font-weight: 600; }
.empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 1.25rem;
  text-align: center; color: var(--muted); background: var(--surface); }

/* ------------------------------------------------------------------ cards, grids */
.card, .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.25rem; margin-bottom: 1rem; }
.auth-card { margin: 1.5rem auto; }
@media (min-width: 36rem) { .card { padding: 1.5rem; } .auth-card { padding: 2rem; margin-top: 2rem; } }
.card > h2:first-child, .card > h3:first-child, .auth-card > h1:first-child { margin-top: 0; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card.legal { max-width: 48rem; }
.legal h2 { font-size: 1.1rem; margin-top: 1.5rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
@media (min-width: 40rem) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.stat { font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }

/* ------------------------------------------------------------------ buttons */
.button, button { font: inherit; font-weight: 400; line-height: 1.5; cursor: pointer; display: inline-block;
  text-align: center; text-decoration: none; min-height: 2.4rem; padding: 0.375rem 0.85rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-subtle); color: var(--text); }
.button:hover, button:hover { background: var(--border); border-color: var(--border-interactive); color: var(--text); }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
button.danger, .button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.danger:hover, .button.danger:hover { background: var(--bad); border-color: var(--bad); color: #ffffff; }
button.good, .button.good { background: transparent; border-color: var(--ok); color: var(--ok); }
button.good:hover, .button.good:hover { background: var(--ok); border-color: var(--ok); color: #ffffff; }
@media (prefers-reduced-motion: no-preference) {
  .button, button { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
}

/* ------------------------------------------------------------------ forms */
.field { margin-bottom: 1rem; }
label { display: block; font-weight: 500; margin-bottom: 0.3rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea { width: 100%; max-width: 100%; font: inherit; padding: 0.4rem 0.75rem; line-height: 1.5;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 0.2rem var(--focus); }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
textarea { resize: vertical; }
input[type="file"] { max-width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
.error { color: var(--bad); margin: 0.25rem 0 0; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0 0; }
.req { color: var(--bad); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 1rem; padding: 0.5rem 1rem 0.75rem; }
legend { font-weight: 500; padding: 0 0.4rem; }
.check { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; margin: 0.2rem 0; }
.check input { flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0 1rem; }
.filters { display: grid; gap: 0.5rem; grid-template-columns: 1fr; align-items: end; margin-bottom: 1rem; }
@media (min-width: 40rem) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }
input.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.4rem; letter-spacing: 0.3em; max-width: 12rem; }
.inline-form { margin-top: 0.5rem; }

/* ------------------------------------------------------------------ TOTP enrolment */
.qr { display: inline-block; background: #ffffff; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); line-height: 0; }
.qr svg { display: block; width: 200px; height: 200px; max-width: 100%; }
code.secret { display: inline-block; font-size: 1rem; letter-spacing: 0.08em; padding: 0.3rem 0.5rem; }
.steps { padding-left: 1.25rem; margin: 0.5rem 0; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card .table-wrap { box-shadow: none; }
table { border-collapse: collapse; width: 100%; background: var(--surface); color: var(--text); }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--text) 4%, transparent); }
th { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; background: var(--bg-subtle); border-bottom-width: 2px; }
td.num, th.num { text-align: right; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; line-height: 1.4; padding: 0.1rem 0.55rem;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-subtle);
  color: var(--muted); margin: 0 0.15rem 0.15rem 0; }
.badge.ok, .badge-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-border); }
.pager { display: flex; gap: 0.5rem; align-items: center; justify-content: center; margin: 1rem 0; }
.pager a, .pager span { padding: 0.35rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); text-decoration: none; }
.pager span { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------------ quiz */
.question { font-size: 1.5rem; font-weight: 600; margin: 0.5rem 0 1rem; }
.answer-input { font-size: 1.25rem; }
.choices { display: grid; gap: 0.5rem; margin: 0 0 1rem; border: 0; padding: 0; }
.choice { display: flex; gap: 0.6rem; align-items: center; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.7rem 0.9rem; background: var(--surface); font-weight: 400; cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice:focus-within { border-color: var(--accent); }
.choice kbd { margin-left: auto; }
/* Keyboard shortcut badges, shown by app.js only (the shortcuts need it). */
kbd { display: inline-block; min-width: 1.4em; padding: 0 0.35em; font: 600 0.75rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center; color: var(--muted); background: var(--bg-subtle); border: 1px solid var(--border-interactive);
  border-bottom-width: 2px; border-radius: var(--radius-sm); vertical-align: middle; }
button kbd, .button kbd { margin-left: 0.4em; color: inherit; background: transparent; border-color: currentColor; opacity: 0.75; }
.kbd-help { font-size: 0.85rem; margin-top: 0.5rem; }
@media (hover: none) and (pointer: coarse) { .kbd-help, kbd.js-kbd { display: none !important; } }
.reference { font-size: 1.3rem; font-weight: 600; }
progress, meter { width: 100%; height: 0.9rem; accent-color: var(--accent); }
.conj th { width: 40%; }
.not-supplied { color: var(--muted); font-style: italic; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cloze { letter-spacing: 0.1em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* Import preview: keep short columns on one line; the table scrolls inside its wrapper. */
table.plan td:first-child { white-space: nowrap; }
table.plan .badge { white-space: nowrap; }
table.plan td:last-child { min-width: 11rem; }
