/* Same tokens as www.modelmatic.eu (src/css/main.css): warm paper palette + accent. */
:root {
  --theme-paper: #faf9f5;
  --theme-ink: #141413;
  --theme-muted: #3d3d3a;
  --theme-tertiary: #66655e; /* darker than www's #87867f for WCAG AA on small text */
  --theme-input-border: #8d8b82; /* ≥3:1 for form controls (WCAG 1.4.11) */
  --btn-bg: #a8492b;
  --btn-bg-hover: #8f3c22;
  --btn-fg: #ffffff;
  --theme-border: #d1cfc5;
  --theme-alt: #f0eee6;
  --theme-card: #ffffff;
  --theme-accent: #d97757;
  --theme-accent-hover: #c26344;
  --theme-accent-ink: #a8492b; /* accent for text on paper: AA contrast */
  --theme-accent-soft: rgb(217 119 87 / 0.1);
  --theme-danger: #b42318;
  --theme-ok: #2f6b3a;
  --theme-header: rgb(250 249 245 / 0.92);
  --font-sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  color-scheme: light;
}

.dark {
  --theme-paper: #1b1a17;
  --theme-ink: #ede8df;
  --theme-muted: #b0ac9f;
  --theme-tertiary: #9a978c;
  --theme-input-border: #7c7a70;
  --btn-bg: #e8896a;
  --btn-bg-hover: #f0a487;
  --btn-fg: #1b1a17;
  --theme-border: #38362f;
  --theme-alt: #252420;
  --theme-card: #252420;
  --theme-accent: #e8896a;
  --theme-accent-hover: #d97757;
  --theme-accent-ink: #f0a487;
  --theme-accent-soft: rgb(232 137 106 / 0.1);
  --theme-danger: #ff8a7a;
  --theme-ok: #8fd19e;
  --theme-header: rgb(27 26 23 / 0.92);
  color-scheme: dark;
}

@font-face { font-family: 'Geist'; src: url('/fonts/Geist-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/Geist-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/Geist-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/fonts/Geist-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--theme-ink);
  background-color: var(--theme-paper);
}

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--theme-card); padding: .5rem 1rem; border-radius: .5rem; }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--theme-border); background: var(--theme-header); backdrop-filter: blur(8px); }
.site-header-inner { margin: 0 auto; max-width: 72rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; }
.brand { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; color: var(--theme-ink); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.lang-switch { display: flex; align-items: center; border: 1px solid var(--theme-border); border-radius: .5rem; font-size: .75rem; }
.lang-switch span { color: var(--theme-border); }
.lang-link { padding: .375rem .625rem; color: var(--theme-tertiary); text-decoration: none; }
.lang-link:hover { color: var(--theme-ink); }
.lang-link.is-active { font-weight: 600; color: var(--theme-accent-ink); }

main { flex: 1; width: 100%; min-width: 0; }
.container-narrow { margin: 0 auto; max-width: 28rem; padding: 3rem 1rem 4rem; }
.container-wide { margin: 0 auto; max-width: 72rem; padding: 2rem 1rem 4rem; }

.eyebrow { margin: 0 0 .5rem; font-family: var(--font-mono); font-size: .875rem; color: var(--theme-accent-ink); }
.page-title { margin: 0 0 .75rem; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.section-title { margin: 2.5rem 0 1rem; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; }
.lead { margin: 0 0 2rem; color: var(--theme-muted); }
.muted { color: var(--theme-muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--font-mono); font-size: .8125rem; word-break: break-all; }

.card { border: 1px solid var(--theme-border); border-radius: .75rem; background: var(--theme-card); padding: 1.5rem; }

.field { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }
.field label, .label { font-size: .875rem; font-weight: 500; }
.input, select.input {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* ≥16px avoids iOS zoom */
  border: 1px solid var(--theme-input-border);
  border-radius: .5rem;
  background: var(--theme-card);
  color: var(--theme-ink);
  padding: .625rem .875rem;
}
.input:focus { outline: 2px solid var(--theme-accent); outline-offset: 1px; border-color: var(--theme-accent); }

.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-size: .875rem; font-weight: 500;
  border-radius: .5rem; padding: .625rem 1.25rem; cursor: pointer;
  text-decoration: none; transition: background-color .15s, border-color .15s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-secondary { background: var(--theme-card); border-color: var(--theme-border); color: var(--theme-ink); }
.btn-secondary:hover { background: var(--theme-alt); }
.btn-ghost { background: transparent; color: var(--theme-ink); padding: .5rem .75rem; }
.btn-ghost:hover { background: var(--theme-alt); }
.btn-danger { background: transparent; border-color: var(--theme-danger); color: var(--theme-danger); padding: .375rem .75rem; }
.btn-danger:hover { background: rgb(180 35 24 / .08); }
.btn-block { width: 100%; }
:is(.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .link, a):focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 2px; }
button[disabled] { opacity: .6; cursor: progress; }

.link { color: var(--theme-accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.link:hover { opacity: .85; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0; color: var(--theme-tertiary); font-size: .8125rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--theme-border); }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.between { justify-content: space-between; }

.notice { border-radius: .5rem; padding: .75rem 1rem; font-size: .875rem; margin-bottom: 1rem; border: 1px solid var(--theme-border); background: var(--theme-alt); }
.notice[data-kind='error'] { border-color: var(--theme-danger); color: var(--theme-danger); background: transparent; }
.notice[data-kind='ok'] { border-color: var(--theme-ok); color: var(--theme-ok); background: transparent; }
.notice:empty { display: none; }

.scopes { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.scopes li { display: flex; gap: .75rem; padding: .625rem 0; border-bottom: 1px solid var(--theme-border); font-size: .9375rem; }
.scopes li::before { content: '✓'; color: var(--theme-accent-ink); font-weight: 600; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--theme-border); border-radius: .75rem; background: var(--theme-card); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { text-align: left; padding: .625rem .75rem; border-bottom: 1px solid var(--theme-border); vertical-align: middle; white-space: nowrap; }
th { font-weight: 600; background: var(--theme-alt); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td form { display: inline; margin: 0; }
select.role { font: inherit; font-size: .8125rem; padding: .25rem .375rem; border-radius: .375rem; border: 1px solid var(--theme-input-border); background: var(--theme-card); color: var(--theme-ink); }
.badge { display: inline-block; font-size: .75rem; padding: .125rem .5rem; border-radius: 999px; background: var(--theme-accent-soft); color: var(--theme-accent-ink); }
.badge[data-kind='bad'] { background: rgb(180 35 24 / .1); color: var(--theme-danger); }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1.5rem; border-bottom: 1px solid var(--theme-border); }
.tabs a { padding: .5rem .875rem; text-decoration: none; color: var(--theme-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .9375rem; }
.tabs a[aria-current='page'] { color: var(--theme-ink); border-color: var(--theme-accent); font-weight: 500; }

.site-footer { border-top: 1px solid var(--theme-border); background: var(--theme-alt); }
.site-footer-inner { margin: 0 auto; max-width: 72rem; padding: 1.5rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; font-size: .8125rem; color: var(--theme-tertiary); }
.site-footer a { color: var(--theme-tertiary); }
.site-footer a:hover { color: var(--theme-ink); }

@media (min-width: 640px) {
  .site-header-inner, .site-footer-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
  .page-title { font-size: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.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; }
textarea.input { font-family: var(--font-mono); font-size: .875rem; }
td .row { flex-wrap: nowrap; }
tbody th[scope='row'] { position: sticky; left: 0; background: var(--theme-card); z-index: 1; }
