/*
 * Ratsfunk design tokens (draft, not approved).
 *
 * One accent (petrol), warm paper neutrals, one signal colour (amber) reserved for "Neu".
 * Error red exists only for form validation.
 *
 * Contrast ratios (WCAG 2.1, computed from the hex values below; AA needs 4.5 for text,
 * 3.0 for large text and for UI component boundaries):
 *
 * LIGHT                                   DARK
 *   ink        on bg        15.6            ink        on bg        14.6
 *   ink        on surface   16.3            ink        on surface   13.1
 *   ink        on sunk      14.2            ink        on sunk      15.3
 *   ink-muted  on bg         6.9            ink-muted  on bg         8.5
 *   ink-muted  on surface    7.2            ink-muted  on surface    7.6
 *   ink-muted  on sunk       6.2            ink-muted  on sunk       8.9
 *   accent     on bg         7.5            accent     on bg         9.0
 *   accent     on surface    7.8            accent     on surface    8.0
 *   accent     on accent-bg  6.7            accent     on accent-bg  6.7
 *   on-accent  on accent     7.8            on-accent  on accent     8.2
 *   on-accent  on accent-hover 10.4         on-accent  on accent-hover 9.8
 *   signal     on bg         5.8            signal     on bg         9.0
 *   signal     on surface    6.1            signal     on surface    8.0
 *   signal     on signal-bg  5.2            signal     on signal-bg  6.8
 *   error      on surface    7.5            error      on surface    8.3
 *   error      on error-bg   6.4            error      on error-bg   7.7
 *   line-strong on surface   4.3            line-strong on surface   4.5   (input borders, >= 3.0)
 *   line-strong on bg        4.2            line-strong on bg        5.0
 *   line       on bg         1.4            line       on bg         1.5   (decorative only)
 *
 * Print (letter, report): ink = black, accent = #0E5A6B as the single spot colour; the signal
 * colour is not used in print. In greyscale the accent maps to about 70 % black.
 */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  /* Self-hosted, SIL OFL 1.1 (see fonts/OFL-SourceSerif4.md). No third-party request. */
  src: url('fonts/SourceSerif4-Semibold.woff2') format('woff2');
}

:root {
  color-scheme: light dark;

  /* Colour: light */
  --rf-bg: #fbfaf7;
  --rf-surface: #ffffff;
  --rf-sunk: #f1efe9;
  --rf-ink: #17212b;
  --rf-ink-muted: #4d5964;
  --rf-line: #dad6cc;
  --rf-line-strong: #737a82;
  --rf-accent: #0e5a6b;
  --rf-accent-hover: #0a4654;
  --rf-accent-bg: #e3f0f2;
  --rf-on-accent: #ffffff;
  --rf-signal: #a84300;
  --rf-signal-bg: #fbebdd;
  --rf-error: #a3231c;
  --rf-error-bg: #fbeae8;
  --rf-focus: var(--rf-accent);

  /* Type: headlines in the serif, everything else in the system sans, data in the system mono.
     Mails use the same stacks without the web font (Georgia takes over for headlines). */
  --rf-font-serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --rf-font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --rf-font-mono:
    ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Consolas, 'Liberation Mono', Menlo,
    monospace;

  /* Type scale (rem, base 16 px). Display sizes are fluid between phone and desktop. */
  --rf-text-xs: 0.8125rem; /* 13 px: footnotes, labels in mono */
  --rf-text-sm: 0.875rem; /* 14 px: hints, meta */
  --rf-text-md: 1rem; /* 16 px: body */
  --rf-text-lg: 1.125rem; /* 18 px: lead, h3 */
  --rf-text-xl: 1.375rem; /* 22 px: prices, card titles */
  --rf-text-2xl: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); /* h2 */
  --rf-text-3xl: clamp(2rem, 1.35rem + 3.2vw, 3.25rem); /* h1 */
  --rf-text-stat: clamp(2.25rem, 1.8rem + 2.2vw, 3rem); /* numbers */
  --rf-leading-tight: 1.15;
  --rf-leading-snug: 1.35;
  --rf-leading-body: 1.55;
  --rf-measure: 38rem; /* max line length for running text */

  /* Spacing (4 px grid) */
  --rf-space-1: 0.25rem;
  --rf-space-2: 0.5rem;
  --rf-space-3: 0.75rem;
  --rf-space-4: 1rem;
  --rf-space-5: 1.5rem;
  --rf-space-6: 2rem;
  --rf-space-7: 3rem;
  --rf-space-8: 4rem;
  --rf-space-9: 6rem;
  --rf-gutter: 1.25rem;
  --rf-page: 68rem;

  /* Radii and lines: small radii, hairlines, no shadows */
  --rf-radius-sm: 3px;
  --rf-radius-md: 6px;
  --rf-border: 1px solid var(--rf-line);
  --rf-rule: 3px; /* left rule of an alert entry */
}

/* Colour: dark. Follows the system; data-theme on <html> overrides it in either direction. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --rf-bg: #10161b;
    --rf-surface: #18212a;
    --rf-sunk: #0b1014;
    --rf-ink: #e9e6df;
    --rf-ink-muted: #a9b2ba;
    --rf-line: #2d3843;
    --rf-line-strong: #7c8893;
    --rf-accent: #6cc3d2;
    --rf-accent-hover: #8ad3e0;
    --rf-accent-bg: #14323a;
    --rf-on-accent: #06222a;
    --rf-signal: #f2a654;
    --rf-signal-bg: #3a2a17;
    --rf-error: #ff9f94;
    --rf-error-bg: #3b1d1b;
  }
}

:root[data-theme='dark'] {
  --rf-bg: #10161b;
  --rf-surface: #18212a;
  --rf-sunk: #0b1014;
  --rf-ink: #e9e6df;
  --rf-ink-muted: #a9b2ba;
  --rf-line: #2d3843;
  --rf-line-strong: #7c8893;
  --rf-accent: #6cc3d2;
  --rf-accent-hover: #8ad3e0;
  --rf-accent-bg: #14323a;
  --rf-on-accent: #06222a;
  --rf-signal: #f2a654;
  --rf-signal-bg: #3a2a17;
  --rf-error: #ff9f94;
  --rf-error-bg: #3b1d1b;
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}
