/* SPDX-License-Identifier: GPL-3.0-or-later
   Copyright 2026 miculpionier (https://miculpionier.ro) */
/* Base: design tokens, reset, typography and vertical rhythm.
   Rhythm rule: block elements carry equal top and bottom margins.
   Trim rule: the first child of any container loses its top margin and the
   last child loses its bottom margin, so containers own their own padding. */

:root {
  color-scheme: light;
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #f3f6f4;
  --surface-2: #e6eee9;
  --text: #17201b;
  --text-2: #4a564f;
  --border: #d2dcd6;
  --border-strong: #9fb0a6;
  --accent: #1b6b3a;
  --accent-strong: #124f2a;
  --accent-soft: #e2f0e6;
  --accent-ink: #ffffff;
  --link: #1b6b3a;
  --link-visited: #4b3f8f;
  --focus: #ffbf47;
  --focus-ink: #0b0c0c;
  --input-border: #17201b;
  --warn-bg: #fff4d6;
  --warn-border: #c78a00;
  --warn-ink: #5c3d00;
  --danger: #a3261f;
  --info-bg: #e8f1fb;
  --info-border: #3b72b8;
  --footer-bg: #0f3a22;
  --footer-ink: #e9f3ec;
  --footer-muted: #b8cfc0;
  --shadow: 0 1px 2px rgb(16 32 24 / 0.08), 0 4px 16px rgb(16 32 24 / 0.06);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 2.5rem;
  --flow: 0.875rem;
  --radius: 4px;
  --radius-lg: 8px;
  --page: 60rem;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0e1511;
    --surface: #151f19;
    --surface-2: #1c2921;
    --text: #e6ede8;
    --text-2: #a8b7ad;
    --border: #2d3c33;
    --border-strong: #4d6155;
    --accent: #6cc791;
    --accent-strong: #8fd9ac;
    --accent-soft: #193325;
    --focus: #e8bd55;
    --focus-ink: #0e1511;
    --input-border: #6a8073;
    --accent-ink: #08130c;
    --link: #8fd9ac;
    --link-visited: #c3b5ff;
    --warn-bg: #33270b;
    --warn-border: #c78a00;
    --warn-ink: #f6dfa4;
    --danger: #ff8a80;
    --info-bg: #142334;
    --info-border: #5b8fd1;
    --footer-bg: #0a2416;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1511;
  --surface: #151f19;
  --surface-2: #1c2921;
  --text: #e6ede8;
  --text-2: #a8b7ad;
  --border: #2d3c33;
  --border-strong: #4d6155;
  --accent: #6cc791;
  --accent-strong: #8fd9ac;
  --accent-soft: #193325;
  --focus: #e8bd55;
  --focus-ink: #0e1511;
  --input-border: #6a8073;
  --accent-ink: #08130c;
  --link: #8fd9ac;
  --link-visited: #c3b5ff;
  --warn-bg: #33270b;
  --warn-border: #c78a00;
  --warn-ink: #f6dfa4;
  --danger: #ff8a80;
  --info-bg: #142334;
  --info-border: #5b8fd1;
  --footer-bg: #0a2416;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
}

:root[data-text="-1"] {
  font-size: 90%;
}
:root[data-text="1"] {
  font-size: 112.5%;
}
:root[data-text="2"] {
  font-size: 125%;
}
:root[data-text="3"] {
  font-size: 137.5%;
}
:root[data-text="4"] {
  font-size: 150%;
}
:root[data-spacing="wide"] body {
  line-height: 1.9;
  letter-spacing: 0.03em;
  word-spacing: 0.12em;
}
:root[data-spacing="wide"] :where(p, li, dd) {
  margin-block: 1.25em;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-6);
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

figure {
  margin-inline: 0;
}

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

/* ---------- Vertical rhythm: equal top and bottom margins ---------- */
:where(p, ul, ol, dl, table, figure, blockquote, pre, details, hr, address, fieldset, form) {
  margin-block: var(--flow);
}
:where(h1, h2, h3, h4, h5, h6) {
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
  color: var(--text);
}
:where(h1) {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
  margin-block: var(--space-5);
  letter-spacing: -0.015em;
}
:where(h2) {
  font-size: clamp(1.45rem, 1.2rem + 1vw, 1.8rem);
  margin-block: var(--space-6);
  letter-spacing: -0.01em;
}
:where(h3) {
  font-size: 1.25rem;
  margin-block: var(--space-5);
}
:where(h4) {
  font-size: 1.0625rem;
  margin-block: var(--space-4);
}
:where(h5, h6) {
  font-size: 1rem;
  margin-block: var(--space-4);
}

/* ---------- Margin trim: first and last children start and end flush ---------- */
:where(*) > :where(:first-child) {
  margin-block-start: 0;
}
:where(*) > :where(:last-child) {
  margin-block-end: 0;
}
@supports (margin-trim: block) {
  :where(main, article, section, aside, .card, .callout, .panel, figure, details, li, td, th, dd, blockquote) {
    margin-trim: block;
  }
}

p {
  text-wrap: pretty;
}
:where(ul, ol) {
  padding-inline-start: 1.5em;
}
li + li {
  margin-block-start: var(--space-2);
}
li > :where(ul, ol) {
  margin-block: var(--space-2);
}
:where(dt) {
  font-weight: 650;
}
:where(dd) {
  margin-inline-start: 0;
  margin-block: var(--space-1) var(--space-3);
}

a {
  color: var(--link);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.18em;
}
/* Pseudolink: looks like a link to a service outside this site, but has no target. */
.plink {
  color: var(--link);
  text-decoration: underline dashed;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
  cursor: default;
}
a:visited {
  color: var(--link-visited);
}
a:hover {
  text-decoration-thickness: 0.14em;
  color: var(--accent-strong);
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  box-shadow: 0 0 0 4px var(--focus-ink);
  border-radius: 1px;
}
:where(input, select, textarea):focus-visible {
  box-shadow: none;
}
[tabindex="-1"]:focus-visible {
  outline: none;
  box-shadow: none;
}
a:focus-visible {
  background: var(--focus);
  color: var(--focus-ink);
  text-decoration: none;
  box-shadow: 0 2px var(--focus-ink);
  outline: none;
}
:root[data-focus="plain"] :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}
:root[data-focus="plain"] a:focus-visible {
  background: none;
  color: var(--link);
  text-decoration: underline;
  box-shadow: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
}
hr + :where(h2, h3, h4) {
  margin-block-start: 0;
}
strong,
b {
  font-weight: 700;
}
small {
  font-size: 0.875em;
}
abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}
code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.92em;
}
kbd {
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 0.3em;
  background: var(--surface);
}
blockquote {
  border-inline-start: 4px solid var(--accent);
  padding: var(--space-2) var(--space-5);
  color: var(--text-2);
}

.num,
td.num,
th.num {
  font-variant-numeric: tabular-nums lining-nums;
  text-align: end;
  white-space: nowrap;
}
.muted {
  color: var(--text-2);
}
.nowrap {
  white-space: nowrap;
}
.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;
}

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

/* Chart series colors, validated for color vision deficiency in both modes. */
:root {
  --series-1: #257de0;
  --series-2: #f47230;
  --series-3: #00b894;
  --series-4: #f2a600;
  --series-5: #ee7fac;
  --series-6: #008a17;
  --series-7: #6a4ce2;
  --series-8: #ec4647;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --series-1: #338ced;
    --series-2: #e76624;
    --series-3: #00a888;
    --series-4: #d28e05;
    --series-5: #e24d8b;
    --series-6: #0aac23;
    --series-7: #9887ef;
    --series-8: #eb6263;
  }
}
:root[data-theme="dark"] {
  --series-1: #338ced;
  --series-2: #e76624;
  --series-3: #00a888;
  --series-4: #d28e05;
  --series-5: #e24d8b;
  --series-6: #0aac23;
  --series-7: #9887ef;
  --series-8: #eb6263;
}

svg.icon {
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
}

:root[data-wrap="off"] :where(p, li, dd, figcaption, blockquote) {
  text-wrap: wrap;
}
