/* Site styles. No external fonts, no JavaScript. Light/dark follows the OS. */

:root {
  --bg: #fafafc;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --text: #1b1d24;
  --muted: #5b6070;
  --border: #e3e5ec;
  --accent: #4b45d6;
  --accent-strong: #3a34b8;
  --accent-contrast: #ffffff;
  --accent-soft: #eeeefe;
  --note-bg: #fff8e5;
  --note-border: #ecd189;
  --radius: 14px;
  --wrap: 50rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --surface: #171a22;
    --surface-2: #1d212b;
    --text: #e7e8ee;
    --muted: #a2a7b6;
    --border: #2b303c;
    --accent: #a9b2ff;
    --accent-strong: #c4cbff;
    --accent-contrast: #13151d;
    --accent-soft: #20243f;
    --note-bg: #2a2413;
    --note-border: #6a5a24;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Skip link */
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip:focus { top: 1rem; color: var(--accent-contrast); }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.logo { flex: none; }
.logo-bg { fill: var(--accent); }
.logo-fg { fill: none; stroke: var(--accent-contrast); stroke-width: 1.8; stroke-linecap: round; }
.logo-spark { fill: var(--accent-contrast); }

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a,
.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav a:hover,
.lang-switch a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.lang-switch a {
  padding: 0.15rem 0.65rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.lang-switch a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
}

/* Main */
main.wrap { padding-top: 2rem; padding-bottom: 3.5rem; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.45rem; margin: 2.6rem 0 0.75rem; }
h3 { font-size: 1.12rem; margin: 1.8rem 0 0.5rem; }
h2[id], h3[id], section[id], article[id] { scroll-margin-top: 1rem; }

p, ul, ol, dl, table { margin: 0 0 1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.3rem 0; }
li > ul, li > ol { margin: 0.3rem 0 0; }

.page-head { margin-bottom: 1.5rem; }
.meta { color: var(--muted); font-size: 0.92rem; margin: 0; }
.lead { font-size: 1.15rem; color: var(--text); }
.muted { color: var(--muted); }

/* Callouts */
.callout {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: 0.4rem; }
.callout.note { background: var(--note-bg); border: 1px solid var(--note-border); }

/* Table of contents */
.toc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 0.6rem;
  margin: 1.75rem 0 2rem;
}
.toc h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.toc ol { margin: 0 0 0.5rem; padding-left: 1.4rem; }
.toc li { margin: 0.2rem 0; }
@media (min-width: 40rem) {
  .toc ol { columns: 2; column-gap: 2rem; }
  .toc li { break-inside: avoid; }
}

/* Definition lists */
dl.facts {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) 1fr;
  gap: 0.35rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
dl.facts dt { font-weight: 600; color: var(--muted); }
dl.facts dd { margin: 0; }
@media (max-width: 30rem) {
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dd { margin-bottom: 0.5rem; }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table { border-collapse: collapse; width: 100%; min-width: 36rem; margin: 0; font-size: 0.95rem; }
caption { text-align: left; padding: 0.75rem 1rem 0; font-weight: 600; }
th, td { text-align: left; vertical-align: top; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface-2); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:last-child > * { border-bottom: 0; }

/* Cards */
.section-title { margin-top: 2.75rem; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.cards > li { margin: 0; }
.card {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  color: var(--text);
  text-decoration: none;
}
a.card:hover { border-color: var(--accent); color: var(--text); }
.card-title { display: block; font-weight: 700; margin-bottom: 0.25rem; color: var(--text); }
.card-text { display: block; color: var(--muted); font-size: 0.95rem; }
.card.empty { border-style: dashed; background: transparent; }

.hero { padding: 1.5rem 0 0.5rem; }
.hero .lead { max-width: 38rem; color: var(--muted); }

.app-specific {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.app-specific > :last-child { margin-bottom: 0; }

.faq h3 { margin-top: 1.6rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.75rem 0 2.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.footer-nav li { margin: 0; }
.footer-nav a { color: var(--text); }
.footer-nav a[aria-current="page"] { font-weight: 700; }
.site-footer p { margin: 0 0 0.35rem; }
.site-footer a { color: var(--text); }

@media print {
  .site-header nav, .site-footer, .skip, .toc { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}

/* Buttons and misc */
.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { background: var(--accent-strong); color: var(--accent-contrast); }
.notfound { padding: 2rem 0; }
.notfound [lang="en"] { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
