/*
 * Design tokens (docs/DESIGN.md). Every other rule reads these; light and dark are both WCAG 2.1 AA:
 * text >= 4.5:1, input borders and focus >= 3:1 against their background.
 */
@font-face {
  font-family: 'Work Sans';
  src: url('fonts/WorkSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Work Sans';
  src: url('fonts/WorkSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1d2b2a;
  --paper: #ffffff;
  --desk: #eef1ee;
  --seal: #0e6a4e;
  --seal-ink: #ffffff;
  --seal-soft: #e1f0ea;
  --stamp: #b3261e;
  --stamp-soft: #fbe9e7;
  --graphite: #56615e;
  --rule: #cfd6d2;
  --field-border: #7d8985;
  --focus: #0e6a4e;

  --font: 'Work Sans', 'Segoe UI', system-ui, sans-serif;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 21px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --radius: 3px;
  --shadow-paper: 0 1px 2px rgba(29, 43, 42, 0.08), 0 8px 24px rgba(29, 43, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --ink: #e4ebe7;
    --paper: #18201e;
    --desk: #101614;
    --seal: #53c79c;
    --seal-ink: #0b1512;
    --seal-soft: #173229;
    --stamp: #ff8f80;
    --stamp-soft: #3a1d1a;
    --graphite: #a1ada8;
    --rule: #2c3733;
    --field-border: #74827c;
    --focus: #53c79c;
    --shadow-paper: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--desk);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }

a { color: inherit; text-underline-offset: 3px; }

.num, output, .totals, input[inputmode='decimal'] { font-variant-numeric: tabular-nums; }

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

input:not([type='radio']):not([type='checkbox']):not([type='file']), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

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

input::placeholder, textarea::placeholder { color: var(--graphite); opacity: 1; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

.visually-hidden {
  position: absolute !important;
  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: var(--space-3); top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: var(--space-2) var(--space-3);
}
.skip-link:focus { top: var(--space-3); }

/* Buttons: one primary (filled), secondary (outlined, clearly enabled), quiet (text) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius); border: 1.5px solid transparent;
  font-weight: 700; font-size: var(--text-base); line-height: 1.2;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--seal-soft); }
.btn-quiet { background: transparent; color: var(--ink); border-color: transparent; text-decoration: underline; padding-inline: var(--space-2); font-weight: 400; }
.btn:disabled { cursor: default; opacity: 0.6; }
.btn[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* The header shared by the app, the validator page and the docs site (same links, same one-line promise). */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header-inner {
  max-width: 1440px; margin: 0 auto; padding: var(--space-3) var(--space-5);
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: var(--space-2) var(--space-5);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; font-weight: 700; font-size: var(--text-lg); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--seal); box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 11px var(--seal);
}
.site-tagline { margin: 0; color: var(--graphite); font-size: var(--text-sm); }
.site-nav { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.site-nav a { padding: 10px 10px; text-decoration: none; font-size: var(--text-sm); border-radius: var(--radius); }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current='page'] { font-weight: 700; box-shadow: inset 0 -2px 0 var(--seal); border-radius: 0; }
.lang-switch { display: inline-flex; border: 1.5px solid var(--ink); border-radius: var(--radius); }
.lang-switch button {
  min-width: 44px; min-height: 40px; border: 0; background: transparent; cursor: pointer; font-weight: 700; font-size: var(--text-sm);
}
.lang-switch button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

@media (max-width: 1180px) {
  .site-header-inner { grid-template-columns: auto 1fr auto; }
  .site-tagline { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .site-header-inner { padding: var(--space-2) var(--space-4); grid-template-columns: 1fr auto; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; margin-left: -10px; }
  .site-tagline { grid-row: 3; }
}


.docs { max-width: 1240px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-8); display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--space-6); }
.docs-nav { position: sticky; top: var(--space-4); align-self: start; }
.docs-nav ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.docs-nav a { display: block; padding: 8px 12px; text-decoration: none; margin-left: -1px; border-left: 3px solid transparent; }
.docs-nav a:hover { text-decoration: underline; }
.docs-nav a[aria-current='page'] { border-left-color: var(--seal); font-weight: 700; }
.prose { min-width: 0; max-width: 820px; }
.prose h1 { font-size: 34px; margin-bottom: var(--space-3); }
.prose h2 { font-size: var(--text-xl); margin: var(--space-6) 0 var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--rule); }
.prose h3 { font-size: var(--text-lg); margin: var(--space-5) 0 var(--space-2); }
.prose p, .prose li { max-width: 72ch; }
.prose .lead { font-size: var(--text-lg); color: var(--ink); }
.prose a { color: var(--seal); }
.prose code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.9em; background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; padding: 0 4px; overflow-wrap: anywhere; }
.code { margin: var(--space-3) 0 var(--space-4); }
.code figcaption { font-size: var(--text-sm); font-weight: 700; margin-bottom: 4px; }
.code pre { margin: 0; padding: var(--space-3) var(--space-4); background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--ink); border-radius: var(--radius); overflow-x: auto; }
.code pre code { border: 0; padding: 0; background: none; font-size: 13px; line-height: 1.55; overflow-wrap: normal; white-space: pre; }
.table-wrap { overflow-x: auto; margin: var(--space-3) 0 var(--space-4); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); background: var(--paper); }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); list-style: none; padding: 0; margin: var(--space-4) 0; }
.cards a { display: block; height: 100%; padding: var(--space-3) var(--space-4); background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--ink); text-decoration: none; color: var(--ink); }
.cards a:hover { border-top-color: var(--seal); }
.cards strong { display: block; }
.cards span { color: var(--graphite); font-size: var(--text-sm); }
.figures { display: flex; flex-wrap: wrap; gap: var(--space-5); margin: var(--space-3) 0; }
.figure { display: flex; flex-direction: column; }
.figure b { font-size: 30px; font-variant-numeric: tabular-nums; color: var(--seal); }
.figure span { font-size: var(--text-sm); color: var(--graphite); max-width: 22ch; }
.badge { display: inline-block; padding: 1px 8px; border: 1.5px solid currentColor; border-radius: 2px; font-size: 12px; font-weight: 700; }
.badge-mandatory, .badge-yes { color: var(--seal); }
.badge-planned { color: var(--ink); }
.badge-delayed, .badge-unverified, .badge-no { color: var(--stamp); }
.badge-voluntary { color: var(--graphite); }
.muted { color: var(--graphite); font-size: var(--text-sm); }
.source-note { font-size: var(--text-sm); color: var(--graphite); margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-2); margin: var(--space-4) 0; list-style: none; padding: 0; }
.country-grid a { display: block; padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.site-footer { max-width: 1240px; margin: 0 auto; padding: var(--space-5); color: var(--graphite); font-size: var(--text-sm); }
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); gap: var(--space-4); }
  .docs-nav { position: static; }
  .docs-nav ol { display: flex; flex-wrap: wrap; border-left: 0; gap: 4px; }
  .docs-nav a { border-left: 0; border: 1px solid var(--rule); background: var(--paper); padding: 8px 10px; margin: 0; min-height: 40px; }
  .docs-nav a[aria-current='page'] { border-color: var(--seal); box-shadow: inset 0 -3px 0 var(--seal); }
  .prose h1 { font-size: 26px; }
}
