/* Stadt Leipzig corporate design — design tokens. SINGLE SOURCE OF TRUTH.
 *
 * tokens-version: 1.5.0
 *
 * Every value here is either quoted from the Markenportal (source noted) or
 * a documented project decision (marked DECISION — see references/decisions.md).
 * Copy into a project as-is. Do NOT edit locally: changes go into the skill,
 * otherwise projects drift apart. Bump tokens-version on every change and
 * re-run scripts/build_tokens.py to regenerate the Tailwind artefacts.
 *
 * Units
 *   - type scale in rem (respects the reader's browser font size — BITV)
 *   - spacing, radii, borders in px
 *   - --doc-* in pt/mm and --slide-* in pt/cm: consumed by audit_docx.py and
 *     audit_pptx.py; inert in the browser. They live here so print and Office
 *     share the same single source as the web.
 *
 * Non-negotiables baked into these tokens (Farben p.14, Typografie p.6/12,
 * Barrierefrei p.2): brand colours never colour text; colour goes on
 * surfaces. No gradients, no tints other than the six Helle Töne, no
 * shadows on text, no italics, no ALL CAPS, no hyphenation. A dark theme
 * exists for screens only (D117, D118 "Graphit"); print, Office, newsletters
 * and social media stay light.
 *
 * Two layers (DECISION D80): the brand identity above is fixed. Screen
 * interfaces additionally get the "Screen UI" block below — neutrals,
 * small radii, overlay shadows, a layout column — so apps look like
 * leipzig.de and follow common UI practice instead of transplanting print
 * rules (rectilinear, shadow-free, no greys) onto controls and cards.
 *
 * Four page switches (D88–D118, references/decisions.md), all on <html> or on
 * the root element of an embedded product — put all four on the SAME element:
 *   data-cd-mode   reading | task (task when absent)        D88, D89, D95, D98
 *   data-leitfarbe blau (default) | gold | waldgruen | kupfer | violett | porphyr
 *                  — the page's colour scheme                 D96, D97
 *   data-cta       gold | absent (reading pages only)         D90
 *   data-theme     dark | auto | absent = light (screens only) D117, D118
 *                  auto follows prefers-color-scheme; nested data-theme
 *                  values are not supported (one theme per product root)
 * The attribute blocks at the end of this file re-point the semantic aliases;
 * components read the aliases and never need to know the colour. A var()
 * inside a custom property resolves on the element that declares it, so every
 * block re-declares each derived alias — that keeps a wrapper below <html>
 * (an embedded product) correct too.
 */

:root {
  /* ---- Brand palette (Farben p.4–8) ------------------------------------ */
  /* Primärfarben */
  --color-blau: #0E3AB6;            /* Leipzig Blau · CMYK 100/70/0/0 · Pantone 293 C · text on it: white */
  --color-gold: #FFE500;            /* Leipzig Gold · CMYK 0/0/100/0 · Yellow PY12 C · text on it: black */
  /* Sekundärfarben */
  --color-waldgruen: #006647;       /* Leipzig Waldgrün · 90/0/70/40 · 342 C · text: white */
  --color-kupfer: #F07E26;          /* Leipzig Kupfer (Orange) · 0/55/90/0 · 151 C · text: BLACK */
  --color-violett: #5C2A6B;         /* Leipzig Violett · 65/100/0/10 · 259 C · text: white */
  --color-porphyr: #A11838;         /* Leipzig Porphyr · 20/100/60/10 · 7426 C · text: white */
  /* Helle Töne — the only permitted tints, one per parent colour (Farben p.7–8); text on all: black */
  --color-blau-hell: #C3E7FF;
  --color-gold-hell: #FFF6A6;
  --color-waldgruen-hell: #C5ECE0;
  --color-kupfer-hell: #FED27A;
  --color-violett-hell: #DC95FF;
  --color-porphyr-hell: #FFBAC4;
  /* Unbunt */
  --color-schwarz: #000000;
  --color-weiss: #FFFFFF;
  /* Logo-Blau lives ONLY inside the logo artwork (Farben p.4, Logo p.7). It is
     listed so the checker can recognise it and reject it in project code. */
  --color-logo-blau: #0040F0;
  /* Light grey: not part of the palette. Permitted as a logo background
     ("hellgrau", Logo p.6) and used by the city's own deck for placeholders.
     DECISION D10: the palette-adjacent neutral (table stripes, dividers,
     disabled, --color-ui-bg); screen
     UI adds the neutrals in the Screen UI block below (D84). */
  --color-grau-hell: #F2F2F2;

  /* ---- Semantic aliases (what code should actually reference) ---------- */
  --color-primary: var(--color-blau);
  --color-primary-hell: var(--color-blau-hell);
  --color-accent: var(--color-gold);           /* Gold is the Bürgerservice colour in the manual (Farben p.18). Screens: any product may take Gold as its Leitfarbe ([data-leitfarbe="gold"], D97), and reading pages may use the Gold CTA pill ([data-cta="gold"], D90, customer decision A3); pair rules (Gold + Gold hell, a Sekundärfarbe or Blau; never a foreign Helle Ton) and the two-colour cap D12 unchanged */
  --color-text: var(--color-schwarz);
  --color-text-inverse: var(--color-weiss);
  --color-bg: var(--color-weiss);
  --color-bg-subtle: var(--color-grau-hell);   /* DECISION */
  --color-border: var(--color-schwarz);        /* DECISION D10: 1px black for brand surfaces and documents; screen UI borders use --color-ui-line / --color-ui-line-strong (D84) */
  --color-divider: var(--color-grau-hell);     /* DECISION: soft separators */
  /* Status — DECISION, mapped onto the Sekundärfarben; text colour per palette rule */
  --color-success: var(--color-waldgruen);     /* text on it: white */
  --color-warning: var(--color-kupfer);        /* text on it: BLACK */
  --color-danger: var(--color-porphyr);        /* text on it: white */
  --color-info: var(--color-blau);             /* text on it: white */
  /* The four *-hell status tints are for DOCUMENTS AND SLIDES ONLY (D97,
     D110). Never a screen status background, badge or row fill: on screens
     status boxes and badges are neutral with icon + word (D97, D103), and a
     status word is never coloured text (D110). */
  --color-success-hell: var(--color-waldgruen-hell);
  --color-warning-hell: var(--color-kupfer-hell);
  --color-danger-hell: var(--color-porphyr-hell);
  --color-info-hell: var(--color-blau-hell);

  /* ---- Interaction (DECISION — Farben p.8 says web "Zwischentöne" exist but publishes none) */
  --color-link: var(--color-blau);             /* underlined; Blau on Blau pages, black in every other Leitfarbe block (D96, D97). NEVER #0040F0 */
  --color-link-visited: var(--color-link);     /* no separate visited colour (D96): Violett next to Blau would be a Sekundärfarbe pair */
  --link-underline: 1px;
  --link-underline-hover: 3px;                 /* hover changes weight, never colour */
  --link-underline-offset: 0.2em;              /* real text-decoration, never a gradient (D96) */
  --color-focus: var(--color-schwarz);
  --color-focus-halo: var(--color-weiss);      /* 2px black ring + 2px white halo = visible on every surface */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --shadow-focus-halo: 0 0 0 var(--focus-ring-offset) var(--color-focus-halo); /* focus halo; --shadow-overlay is the one Screen-UI shadow (D83, D89) */
  --opacity-disabled: 0.5;                     /* documents only — not for screens: disabled controls use grau-hell + ui-line-strong + muted (D98) */
  --target-min: 44px;                          /* DECISION: minimum pointer target (WCAG 2.5.5 AAA); 2.5.8 AA would be 24px */
  --color-on-primary: var(--color-text-inverse); /* text on --color-primary; the [data-leitfarbe] blocks set it (black on Gold and Kupfer, D97) — never flip it by hand */
  --color-ink: var(--color-schwarz);           /* D118: the "ink" of controls — field edge on hover, focus and error, the pressed chip, the select chevron; white in the dark theme. Not a text colour */

  /* ---- Typography (Typografie p.2–11) ---------------------------------- */
  /* Leipzig Sans is the brand font. Arial is the only permitted substitute
     (Typografie p.11), Noto Sans only for non-Latin scripts. Web fonts:
     the city's official LeipzigSans-Regular/-Medium/-Bold .woff2/.woff ship
     unchanged in assets/fonts/web/ (never convert — licence; DECISION D31)
     — see assets/fonts/web/README.md. */
  --font-sans: 'Leipzig Sans', Arial, sans-serif;
  --font-sans-nonlatin: 'Noto Sans', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* DECISION: no brand mono exists */

  /* Weights the city owns and uses (print-indesign: Light/Regular/Medium/Bold; italics exist but are never used and Barrierefrei p.2 forbids them) */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;   /* headings in the official deck and templates */
  --weight-bold: 700;     /* URLs in the Absender row, H2/H3 in print */

  /* Type scale — D88: the city's measured screen sizes (leipzig.de), two
     modes. The values here are task mode, the fallback when data-cd-mode is
     missing; [data-cd-mode="reading"] below raises body and h1. Typografie p.5
     ratio 1:2 holds in task mode (32:16). html stays 16px (D101). */
  --text-display: 3rem;   /* 48px — brand-surface L-Form hero headline only (D88 item 8) */
  --text-h1: 2rem;        /* 32px in task mode; reading: clamp(2rem, 1.6rem + 1.6vw, 2.5rem) (D88) */
  --text-h2: 1.625rem;    /* 26px, both modes (D88) */
  --text-h3: 1.375rem;    /* 22px (D88) */
  --text-h4: 1.25rem;     /* 20px (D88) */
  --text-body-lg: 1.125rem; /* 18px — reading body, task question/lead, reading CTA label (D88); not "--text-lg": the Tailwind class text-lg is flagged by check_style */
  --text-body: 1rem;      /* 16px in task mode; reading: var(--text-body-lg) (D88) */
  --text-ui: 1rem;        /* 16px fixed in both modes: fields, labels, breadcrumb, table cells, footer (D88) */
  --text-meta: var(--text-ui); /* 16px dates, places, counts, help — both modes (D88, D91) */
  --text-small: 0.875rem; /* 14px ≈ 10.5pt — the floor, not a default: result counts, header tool labels < 1024px (D88; Barrierefrei p.2: ≥10pt) */
  --text-endorsement: 0.75rem; /* 12px — the only absolute web size the manual states (Endorsement p.12) */

  --leading-tight: 1.2;
  --leading-snug: 1.3;    /* endorsement line-height 130% (Endorsement p.12) */
  --leading-normal: 1.5;

  --tracking-normal: 0;
  --tracking-absender: 0.02em; /* Light Absender text, tracking +20 in the templates */

  /* ---- The layout unit x (Layout p.5–6, Logo p.12) ---------------------- */
  /* x = logo height / 3. Margins 2x top/bottom, 3x left/right — identical to
     the logo's Schutzzone, so the logo sits flush in the margin corner.
     Minimum gap between elements 2x; caption gap 1x. Digital logo min 30px.
     (Brand layouts; screen UI: --ui-column + --ui-gutter, D86.) */
  --logo-height: 48px;                 /* DECISION default for desktop; 30px is the floor (Logo p.13) */
  --logo-height-min: 30px;             /* brand layouts and print-derived canvases only */
  --logo-height-compact: 36px;         /* D112: the smallest header logo on screens — a dense host
                                          UI's own logo slot (core-only screens, theming.md §1);
                                          site and app headers use --ui-logo-height 44/48 (D92) */
  /* The delivered SVG/PNG canvas already contains the Schutzzone: artwork
     height × 2.2 ≈ canvas height (layout-logo B.14). Brand layouts: size the
     <img> by canvas; website/app headers use the artwork trimmed to its
     bounding box (D81). */
  --logo-canvas-ratio: 2.2;
  --x: calc(var(--logo-height) / 3);   /* 16px at the default */
  --margin-block: calc(2 * var(--x));  /* top / bottom */
  --margin-inline: calc(3 * var(--x)); /* left / right */
  --gap-min: calc(2 * var(--x));
  --gap-caption: var(--x);

  /* ---- Spacing scale (px, for component internals) ---------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 80px;        /* 5 × 16 — leipzig.de's section rhythm (D95) */
  /* Spacing roles (D95); reading mode raises both to --space-9 below */
  --space-section: var(--space-6);  /* between sections: 32 task, 80 reading */
  --space-footer: var(--space-7);   /* content → footer: 48 task, 80 reading (D92) */

  /* ---- Radii: the CD is rectilinear (L-Form, tiles); Störer is a circle --- */
  --radius-none: 0;
  --radius-full: 9999px;  /* Störer; on screens also pill buttons (D82) */
  /* Screen UI (D82): leipzig.de rounds buttons (pill), images and cards */
  --radius-sm: 4px;       /* form fields, small chips */
  --radius-md: 8px;       /* cards, dialogs, menus */

  /* ---- Borders --------------------------------------------------------- */
  --border-width: 1px;
  --border-width-thick: 2px;

  /* ---- Elevation: the brand layouts use no shadows (Layout p.21, Störer p.8).
     Screen UI (D83, D89): open floating layers lift — menus, dialogs,
     toasts; cards never (hover darkens the border). Never on type, never on
     the L-Form, the Störer or the logo. */
  --shadow-none: none;
  --shadow-overlay: 0 8px 24px rgb(0 0 0 / 0.12);    /* dropdowns, dialogs */
  --shadow-raised: 0 4px 16px rgb(14 58 182 / 0.12); /* deprecated: not for card hover — the border darkens instead (D89); unused on screens, kept through tokens 1.x for projects on 1.1.0, removed in 2.0 */

  /* ---- L-Form (L-Form p.3–8) ------------------------------------------- */
  /* Touches exactly two edges. One leg ends flush with the edge, the other
     stops short. Asymmetric — never equal legs. Min 5% of the format area.
     One L-Form colour per layout. Values below are the component defaults. */
  --lform-color: var(--color-primary);     /* follows data-leitfarbe (D97) */
  --lform-thickness: calc(3 * var(--x));   /* the thin leg */
  --lform-step: calc(6 * var(--x));        /* the thick leg */
  --lform-min-area: 5%;

  /* ---- Störer (Störer p.4–5) ------------------------------------------- */
  --stoerer-size-min: 30%;     /* of the format's short side */
  --stoerer-size-max: 70%;
  --stoerer-safe-inset: 10%;   /* of the diameter, measured inward */
  --stoerer-rotation-max: 10deg;

  /* ---- Endorsement bar, web (Endorsement p.12–13) ----------------------- */
  /* The manual's 18px/12px labels are cap-top/baseline distances of the 12px
     text, not paddings (VERIFICATION B2): a 40px bar with the text vertically
     centred reproduces the figure. */
  --endorsement-text: var(--text-endorsement);
  --endorsement-leading: 1.3;
  --endorsement-logo-block: 60px;
  --endorsement-bar-height: 40px;

  /* ---- Layout --------------------------------------------------------- */
  --container-max: 1200px;   /* DECISION D34 — brand-surface pages; screen UI uses --ui-column / --ui-column-wide (D86) */
  --measure: 33em;           /* D94: ≈ 48ch, 63–70 characters per line in either mode (594px at 18px). Never ch for this font: 72ch was ≈ 94–104 characters */

  /* ---- Screen UI (DECISION D80–D86) — app interfaces, not print --------- */
  /* Neutrals for UI chrome. They never replace a brand colour; text stays
     black except secondary text, which is --color-text-muted (8.45:1). */
  --color-ui-bg: var(--color-grau-hell);   /* page behind cards */
  --color-ui-line: #D6D6D6;                /* card borders, dividers — not text */
  --color-ui-line-strong: #767676;         /* form-field borders, 4.54:1 on white (WCAG 1.4.11) */
  --color-text-muted: #4D4D4D;             /* help, meta, captions: 8.45:1 white, 7.55:1 grau-hell */
  /* Semantic UI fills (D118, tokens 1.5.0) — components read these, never
     --color-grau-hell for a UI role, so the dark theme re-points one token
     instead of a component selector. --color-grau-hell keeps #F2F2F2 in both
     themes (the inverted pill's hover on a Vollton, the logo ground). */
  --color-ui-subtle: var(--color-grau-hell);        /* hover, readonly, disabled, table head, zebra, skeleton */
  --color-ui-overlay: var(--color-weiss);           /* menus, search panel, dialogs, toasts: lift by lightness in the dark */
  --color-ui-overlay-subtle: var(--color-grau-hell); /* hover inside an overlay */
  /* Light grounds inside any theme: the named Helle Töne stay light in the
     dark theme, so their links and field borders keep the light values. */
  --color-link-on-light: var(--color-blau);         /* = the light page link: Blau on Blau pages, black otherwise (D96) */
  --color-line-on-light: var(--color-ui-line-strong); /* field border on a named Helle Ton: #767676 in both themes */
  /* Graphit (D118, customer decision 2026-10-13): the dark theme's neutrals,
     hue-neutral (R = G = B), elevation by lightness. Used only by the
     [data-theme] blocks at the end of this file — never directly. */
  --color-graphit-page: #121212;           /* task page, form panel (--color-ui-bg) — white 18.73:1 */
  --color-graphit-surface: #1C1C1C;        /* cards, header, footer, reading page, fields (--color-bg) — white 17.04:1 */
  --color-graphit-raised: #262626;         /* hover, selected row, table head, tags, overlays — white 15.13:1 */
  --color-graphit-overlay: #303030;        /* hover inside an overlay — white 13.19:1 */
  --color-graphit-line: #3D3D3D;           /* card borders, dividers (decorative, like #D6D6D6) */
  --color-graphit-line-strong: #8F8F8F;    /* field borders, placeholder: 5.27:1 surface, 4.68:1 raised */
  --color-graphit-muted: #C4C4C4;          /* secondary text: ≥ 7.56:1 on every Graphit layer */
  /* Elements that belong to one theme only (the logo pair, D118):
     [data-theme-only="light|dark"] { display: var(--display-light|dark) } */
  --display-light: block;
  --display-dark: none;
  /* Hover/pressed shades, one per Vollton (D85, D97). Farben p.8 allows web
     Zwischentöne without publishing them: these are the skill's, with the
     label contrast measured (check_contrast.py). */
  --color-blau-hover: #0B2F94;             /* D85: white label 11.36:1 */
  --color-gold-hover: #F7DD00;             /* leipzig.de's Gold hover (D90): black label 15.30:1 */
  --color-waldgruen-hover: #005239;        /* Waldgrün × 0.8: white 9.27:1 */
  --color-kupfer-hover: #E97A25;           /* Kupfer × 0.97: black 7.28:1 */
  --color-violett-hover: #4A2256;          /* Violett × 0.8: white 12.69:1 */
  --color-porphyr-hover: #81132D;          /* Porphyr × 0.8: white 10.17:1 */
  --color-primary-hover: var(--color-blau-hover); /* hover/pressed of the filled primary; re-pointed per Leitfarbe (D97) */
  /* Call to action (D90): the Leitfarbe pill; Gold under [data-cd-mode="reading"][data-cta="gold"] */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-cta-hover); /* black where the fill is Gold or Kupfer: fill vs hover only 1.08:1 / 1.06:1 (D97) */
  /* State colours that follow the Leitfarbe (D97, D99, D100) */
  --color-primary-indicator: var(--color-primary); /* progress fill, active-nav marker, list markers, checked box fill; black on Gold and Kupfer (WCAG 1.4.11) */
  --color-on-indicator: var(--color-weiss);        /* the mark on an indicator, always white (D97, D99) */
  --color-selected-bg: var(--color-primary-hell);  /* selected choice row, current nav item; white under data-cta="gold" (D90, D99) */
  --color-tag-bg: var(--color-primary-hell);       /* tag pills, always with a 1px --color-line-on-tint border; grau-hell under data-cta="gold" (D100) */
  --color-line-on-tint: var(--color-ui-line-strong); /* field, tag and box borders on the page's Helle Ton (and tag pills); black on Violett and Porphyr, where #767676 is 2.12 / 2.83:1 (D99, D100, 1.4.11) */
  --color-status-bar: var(--color-schwarz);        /* 4px inline-start bar of danger/warning boxes and field errors (D97, D99) */
  --color-chart-edge: var(--color-schwarz);        /* 1px outline of chart marks under 3:1 on the card (D107); white in the dark (D118) */
  /* The page's tint surface (D118): .surface-primary-hell, the tile default,
     the task intro band and the .l-form--tint hero. Light: the page's Helle
     Ton with black text and the page's link and pill. Dark: the Leitfarbe's
     Vollton with its mandated text and the inverted pill — never a grey or
     newly tinted band. Each [data-leitfarbe] block re-declares the set. */
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);   /* the infobox rule and tab on the tint (black on Gold, Kupfer) */
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  /* Status boxes are all neutral white boxes on screens; info carries a 4px
     --color-primary-indicator bar, no tint (D103) — 1.2.0's
     --color-status-info-bg is gone. */
  --color-backdrop: rgb(0 0 0 / 0.5);              /* modal dialog backdrop (::backdrop, D103): a scrim over the page, not a palette colour — never a surface for text or a brand area; the one translucent colour token */
  /* One column for header, content and footer so every left edge lines up */
  --ui-column: 40rem;                      /* D89: forms, surveys, logins, single-task flows (640px ≈ leipzig.de's form panel) */
  --ui-column-wide: 72rem;                 /* D89: reading pages (text capped by --measure), dashboards, lists */
  --ui-gutter: 16px;                       /* side margin of the column: 16 / 32 from 640px / 64 from 1024px in reading mode (D89) */
  --control-height: 48px;                  /* inputs, buttons; >= --target-min */
  --ui-header-height: 80px;                /* min-height of the first header row, never a fixed height (D92) */
  --ui-logo-height: 44px;                  /* trimmed header artwork; 48px from 1024px (D92) */
  /* Absender beside the header logo (D109): margin-block-start that puts the
     first baseline of 16px Leipzig Sans (ascent 1.016em + half-leading at
     line-height 1.3 = 1.04em) on the baseline of "Stadt", 0.453 x the trimmed
     artwork's height below its top: 3.4px at 44, 5.1px at 48. Use it inside a
     row aligned to flex-start; em resolves on the element that uses it. */
  --ui-absender-offset: calc(0.453 * var(--ui-logo-height) - 1.04em);
  /* Buttons (D98): heights are min-heights, labels wrap */
  --button-height: var(--control-height);  /* 48px — task mode, form panels, cards */
  --button-height-lg: 56px;                /* reading-mode buttons */
  --button-height-sm: var(--target-min);   /* 44px — header, toolbars, table rows */
  --button-icon-shift: 4px;                /* trailing arrow on hover/focus; 0 under reduced motion (D98, D25) */

  /* ---- Charts (D13, D97) — series order; the Leitfarbe blocks move their own
     colour to position 1 and keep the rest in D13 order. Charts are exempt
     from the two-colour cap but need a second cue; Gold, Kupfer and Blau hell
     marks on white need a 1px black outline, also with direct labels (3:1
     fails; D107). Hosts that cannot draw outlines: dataviz.md §2 fallback. */
  --chart-1: var(--color-blau);
  --chart-2: var(--color-gold);
  --chart-3: var(--color-waldgruen);
  --chart-4: var(--color-kupfer);
  --chart-5: var(--color-violett);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);

  /* ---- Motion — DECISION; nothing in the CD -------------------------- */
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --easing: cubic-bezier(0.2, 0, 0, 1);

  /* ---- Documents (Word / PDF) — pt and mm -------------------------------- */
  /* DECISION derived from the print type scale (body 10/15, H1 Medium 30,
     H2 Bold 13.5, H3 Bold 11.5, captions 8 — print-indesign) and the
     Barrierefrei floor of 10pt for reading text. */
  --doc-title-size: 30pt;    /* Medium */
  --doc-h1-size: 24pt;       /* Medium */
  --doc-h2-size: 14pt;       /* Bold */
  --doc-h3-size: 12pt;       /* Bold */
  --doc-body-size: 11pt;     /* Regular, 1.35 leading */
  --doc-caption-size: 9pt;   /* Light/Regular — captions, footers, URLs */
  --doc-min-size: 9pt;       /* captions may not go below; body ≥ 10pt is checked separately */
  --doc-body-min-size: 10pt; /* Barrierefrei p.2 */
  /* Letter: anchored on the city's Briefpapier / Urkunde (office-slides): logo box
     38.9×15.6mm at 10.4mm from top, 15.5mm from the right edge; left 35mm. */
  --doc-margin-top: 40mm;
  --doc-margin-bottom: 20mm;
  --doc-margin-left: 35mm;
  --doc-margin-right: 20mm;
  /* Report: interior brochure Satzspiegel (print-indesign, A4) */
  --doc-report-margin-top: 25mm;
  --doc-report-margin-bottom: 20mm;
  --doc-report-margin-left: 20mm;
  --doc-report-margin-right: 20mm;
  --doc-logo-height: 12mm;   /* 100% = delivered artwork = 12mm (VERIFICATION B4); min 5mm */
  --doc-logo-min: 5mm;
  --doc-header-distance: 10mm;  /* Briefpapier logo top edge 10.4mm (office-slides §3.2) */
  --doc-footer-distance: 10mm;  /* DECISION */
  --doc-list-indent: 6.35mm;    /* Urkunde numbering.xml hanging indent, 360 twips */

  /* ---- Print (InDesign-class) — from the ten city templates (print-indesign) */
  --print-bleed: 3mm;
  --print-x-a4: 4mm;            /* unit x on A4/A5/square/DIN lang; A6 3mm; A3 6; A2 10; A1 12; A0 16 */
  --print-body-size: 10pt;      /* Regular, 15pt leading */
  --print-body-leading: 15pt;
  --print-h1-size: 30pt;        /* Medium, 33.75 */
  --print-h2-size: 13.5pt;      /* Bold, 15 */
  --print-h3-size: 11.5pt;      /* Bold, 15 */
  --print-caption-size: 9pt;    /* DECISION: templates use 8pt; ≥9pt for generated material */
  --print-baseline-grid: 3.75pt;

  /* ---- Slides (PowerPoint) — from the official deck (office-slides) ------ */
  --slide-width: 33.867cm;   /* 16:9 */
  --slide-height: 19.05cm;
  --slide-margin-left: 2.43cm;
  --slide-margin-right: 1.74cm;
  --slide-margin: 1.74cm;    /* generic safe area used by audit_pptx.py */
  --slide-h1-size: 48pt;     /* Medium — title slide */
  --slide-title-size: 28pt;  /* Medium — H3 slide title */
  --slide-h4-size: 18pt;
  --slide-body-size: 16pt;   /* Regular, 125% */
  --slide-small-size: 14pt;
  --slide-caption-size: 12pt;/* Light */
  --slide-footer-size: 10pt; /* footer strip only */
  --slide-min-size: 12pt;    /* DECISION: anything below except the footer is a finding */
  --slide-logo-width: 3.23cm;
  --slide-logo-height: 1.30cm;
}

/* D93: never synthesise. Regular/Medium/Bold ship as the city's official web
   files; a weight without a face renders as the nearest declared face (700
   without Bold → Medium), never as faux bold, and a face whose file fails
   shows up in document.fonts as "error". Light 300 has no web file and
   renders as Regular. Never italics (Barrierefrei p.2). */
html { font-synthesis: none; }

/* Motion off when the reader asks for it. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --button-icon-shift: 0px;   /* D98 */
  }
}

/* ---- Responsive steps (D89, D92) --------------------------------------- */
@media (min-width: 640px) {
  :root,
  [data-cd-mode="task"] {
    --ui-gutter: 32px;
  }
}
@media (min-width: 1024px) {
  :root {
    --ui-logo-height: 48px;
  }
  [data-cd-mode="reading"] {
    --ui-gutter: 64px;          /* the 64px step is reading mode only (D89) */
  }
}

/* ---- Modes (D88, D95) — task is the fallback; reading raises body, h1 and
   the section rhythm. `--measure` is in em, so it follows the body size. */
[data-cd-mode="task"] {
  --text-h1: 2rem;
  --text-body: 1rem;
  --space-section: var(--space-6);
  --space-footer: var(--space-7);
}
[data-cd-mode="reading"] {
  --text-h1: clamp(2rem, 1.6rem + 1.6vw, 2.5rem);  /* 32px on phones, 40px from ≈ 900px (D88) */
  --text-body: var(--text-body-lg);                /* 18px (D88, customer decision A4) */
  --space-section: var(--space-9);                 /* 80px (D95) */
  --space-footer: var(--space-9);                  /* 80px (D92, D95) */
}

/* ---- Leitfarben (D97, customer decision plan §8.1) ----------------------
   Blau is the base; any Vollton may be a product's primary, Gold included.
   Pair rules stay (D12): the Leitfarbe with white and its own Helle Ton; for
   Blau also any Helle Ton; for Gold also a Sekundärfarbe or Blau — never Gold
   beside a foreign Helle Ton. Every block
   declares the full set so a wrapper below <html> resolves correctly.
   Links: Blau only on Blau pages, black elsewhere (D96). Indicators: black
   where the fill fails 3:1 on white (Gold 1.28, Kupfer 2.72). Borders on the
   Helle Ton: black where #767676 fails 3:1 on it (Violett hell, Porphyr hell). */
[data-leitfarbe="blau"] {
  --color-primary: var(--color-blau);
  --color-primary-hell: var(--color-blau-hell);
  --color-primary-hover: var(--color-blau-hover);
  --color-on-primary: var(--color-weiss);          /* 9.13:1, hover 11.36:1 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-cta-hover);
  --color-link: var(--color-blau);
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-blau);
  --color-primary-indicator: var(--color-primary);
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-ui-line-strong);
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-blau);
  --chart-2: var(--color-gold);
  --chart-3: var(--color-waldgruen);
  --chart-4: var(--color-kupfer);
  --chart-5: var(--color-violett);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);
}
[data-leitfarbe="gold"] {
  --color-primary: var(--color-gold);
  --color-primary-hell: var(--color-gold-hell);
  --color-primary-hover: var(--color-gold-hover);
  --color-on-primary: var(--color-schwarz);        /* 16.46:1, hover 15.30:1; white would be 1.28 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-schwarz);   /* fill vs hover only 1.08:1 */
  --color-link: var(--color-schwarz);   /* Blau links beside Gold + Gold hell would be a third colour (D96) */
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-schwarz);
  --color-primary-indicator: var(--color-schwarz); /* Gold on white 1.28:1 */
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-ui-line-strong);
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-gold);
  --chart-2: var(--color-blau);
  --chart-3: var(--color-waldgruen);
  --chart-4: var(--color-kupfer);
  --chart-5: var(--color-violett);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);
}
[data-leitfarbe="waldgruen"] {
  --color-primary: var(--color-waldgruen);
  --color-primary-hell: var(--color-waldgruen-hell);
  --color-primary-hover: var(--color-waldgruen-hover);
  --color-on-primary: var(--color-weiss);          /* 7.02:1, hover 9.27:1 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-cta-hover);
  --color-link: var(--color-schwarz);
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-schwarz);
  --color-primary-indicator: var(--color-primary);
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-ui-line-strong);
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-waldgruen);
  --chart-2: var(--color-blau);
  --chart-3: var(--color-gold);
  --chart-4: var(--color-kupfer);
  --chart-5: var(--color-violett);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);
}
[data-leitfarbe="kupfer"] {
  --color-primary: var(--color-kupfer);
  --color-primary-hell: var(--color-kupfer-hell);
  --color-primary-hover: var(--color-kupfer-hover);
  --color-on-primary: var(--color-schwarz);        /* 7.72:1, hover 7.28:1; white would be 2.72 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-schwarz);   /* fill vs hover only 1.06:1 */
  --color-link: var(--color-schwarz);
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-schwarz);
  --color-primary-indicator: var(--color-schwarz); /* Kupfer on white 2.72:1 */
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-ui-line-strong);
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-kupfer);
  --chart-2: var(--color-blau);
  --chart-3: var(--color-gold);
  --chart-4: var(--color-waldgruen);
  --chart-5: var(--color-violett);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);
}
[data-leitfarbe="violett"] {
  --color-primary: var(--color-violett);
  --color-primary-hell: var(--color-violett-hell);
  --color-primary-hover: var(--color-violett-hover);
  --color-on-primary: var(--color-weiss);          /* 10.51:1, hover 12.69:1 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-cta-hover);
  --color-link: var(--color-schwarz);
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-schwarz);
  --color-primary-indicator: var(--color-primary);
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-schwarz);           /* #767676 on Violett hell 2.12:1 */
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-violett);
  --chart-2: var(--color-blau);
  --chart-3: var(--color-gold);
  --chart-4: var(--color-waldgruen);
  --chart-5: var(--color-kupfer);
  --chart-6: var(--color-blau-hell);
  --chart-7: var(--color-porphyr);
}
[data-leitfarbe="porphyr"] {
  --color-primary: var(--color-porphyr);
  --color-primary-hell: var(--color-porphyr-hell);
  --color-primary-hover: var(--color-porphyr-hover);
  --color-on-primary: var(--color-weiss);          /* 7.77:1, hover 10.17:1 */
  --color-cta: var(--color-primary);
  --color-on-cta: var(--color-on-primary);
  --color-cta-hover: var(--color-primary-hover);
  --color-cta-hover-border: var(--color-cta-hover);
  --color-link: var(--color-schwarz);
  --color-link-visited: var(--color-link);
  --color-link-on-light: var(--color-schwarz);
  --color-primary-indicator: var(--color-primary);
  --color-selected-bg: var(--color-primary-hell);
  --color-tag-bg: var(--color-primary-hell);
  --color-line-on-tint: var(--color-schwarz);           /* #767676 on Porphyr hell 2.83:1 */
  --lform-color: var(--color-primary);
  --tint-bg: var(--color-primary-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
  --chart-1: var(--color-porphyr);
  --chart-2: var(--color-blau);
  --chart-3: var(--color-gold);
  --chart-4: var(--color-waldgruen);
  --chart-5: var(--color-kupfer);
  --chart-6: var(--color-violett);
  --chart-7: var(--color-blau-hell);
}

/* ---- Gold call to action (D90, customer decision A3) --------------------
   Only on a reading page whose whole colour budget is Gold-compatible: besides
   white, black and the neutrals at most Blau, one Sekundärfarbe Vollton, or
   Gold/Gold hell — no other Helle Ton anywhere on the page. The block turns
   every tint-bearing state neutral so no component can bring a foreign Helle
   Ton next to the pill at runtime. Scoped to reading mode: a task page cannot
   turn Gold by accident. Kept after the Leitfarbe blocks (it also outranks
   them by specificity). */
[data-cd-mode="reading"][data-cta="gold"] {
  --color-cta: var(--color-gold);
  --color-on-cta: var(--color-schwarz);            /* 16.46:1 */
  --color-cta-hover: var(--color-gold-hover);      /* black 15.30:1 */
  --color-cta-hover-border: var(--color-schwarz);   /* Gold vs hover only 1.08:1 */
  --color-selected-bg: var(--color-bg);
  --color-tag-bg: var(--color-grau-hell);
  /* the tint surface turns neutral grau-hell (D90): no Helle Ton beside Gold */
  --tint-bg: var(--color-grau-hell);
  --tint-text: var(--color-schwarz);
  --tint-link: var(--color-link);
  --tint-line: var(--color-line-on-tint);
  --tint-cta: var(--color-cta);
  --tint-on-cta: var(--color-on-cta);
  --tint-cta-hover: var(--color-cta-hover);
  --tint-cta-hover-border: var(--color-cta-hover-border);
  --tint-cta-border: var(--color-cta);
  --tint-accent: var(--color-primary-indicator);
  --tint-lform-color: var(--color-primary);
  --tint-lform-text: var(--color-on-primary);
}

/* ==== Dark theme "Graphit" (D117, D118, customer decision 2026-10-13) ====
   Screens only: every block sits in @media screen, so print stays light
   (D117); Office, newsletters and social media never load it.
   Opt in with data-theme on the switch-carrying element:
     data-theme="dark"   always dark
     data-theme="auto"   dark when the reader's system asks for it
                         (prefers-color-scheme: dark), light otherwise
     no data-theme       light — the system setting is ignored
   The identity does not change: Volltöne keep their hex, their mandated
   label and the D97 hover shade. Only the neutral layer changes (Graphit,
   elevation by lightness), plus what sits ON it: links, indicators (the
   Leitfarbe's Helle Ton where the Vollton fails 3:1 on graphite), the
   inverted focus ring, white status bars and chart outlines. The page's
   tint surface (--tint-*) becomes the Vollton.
   Nested data-leitfarbe roots below a dark root are re-declared by
   :is([data-theme], [data-theme] *)[data-leitfarbe] (0,2,0), which beats
   the light Leitfarbe blocks (0,1,0). The "auto" blocks repeat the "dark"
   blocks exactly (build_tokens.py --check and the tests compare them). */
@media screen {
  [data-theme="dark"] {
    color-scheme: dark;                               /* native scrollbars, date pickers, autofill */
    --color-text: var(--color-weiss);                 /* 17.04:1 on the surface */
    --color-text-inverse: var(--color-schwarz);
    --color-bg: var(--color-graphit-surface);
    --color-bg-subtle: var(--color-graphit-raised);
    --color-border: var(--color-weiss);
    --color-divider: var(--color-graphit-line);
    --color-ink: var(--color-weiss);
    --color-ui-bg: var(--color-graphit-page);
    --color-ui-line: var(--color-graphit-line);
    --color-ui-line-strong: var(--color-graphit-line-strong);
    --color-text-muted: var(--color-graphit-muted);
    --color-ui-subtle: var(--color-graphit-raised);
    --color-ui-overlay: var(--color-graphit-raised);
    --color-ui-overlay-subtle: var(--color-graphit-overlay);
    --color-line-on-light: #767676;                   /* the light field border: named Helle Töne stay light */
    /* Focus, D21 inverted: 2 px white ring + 2 px black halo; one of the two
       reaches 3:1 on every surface. Never changed by the Leitfarbe. */
    --color-focus: var(--color-weiss);
    --color-focus-halo: var(--color-schwarz);
    --shadow-focus-halo: 0 0 0 var(--focus-ring-offset) var(--color-focus-halo);
    /* Elevation: a 12 % shadow is invisible on graphite; overlays also lift to
       --color-ui-overlay. The backdrop dims more. */
    --shadow-overlay: 0 8px 24px rgb(0 0 0 / 0.6);
    --color-backdrop: rgb(0 0 0 / 0.7);
    --color-status-bar: var(--color-weiss);           /* danger/warning bar and field errors: white bar + icon, never Porphyr hell */
    --color-chart-edge: var(--color-weiss);           /* outlines the dark marks (Blau, Waldgrün, Violett, Porphyr) */
    --display-light: none;
    --display-dark: block;
  }
  /* blau first: also the default when data-leitfarbe is absent */
  [data-theme="dark"]:not([data-leitfarbe]),
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="blau"] {
    --color-on-primary: var(--color-weiss);       /* :root says text-inverse, black in the dark */
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-blau-hell);   /* Blau links only on Blau pages (D96): their dark twin */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-blau-hell);   /* Blau on graphite 1.86:1 — its own Helle Ton (Monochrom, Farben p.12–13) */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="gold"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold/Kupfer: fill vs hover 1.08 / 1.06:1 (D97) */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-gold);   /* Gold 13.35:1 on the surface */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-schwarz);
    --tint-accent: var(--color-schwarz);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="waldgruen"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-waldgruen-hell);   /* Waldgrün on graphite 2.42:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="kupfer"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold/Kupfer: fill vs hover 1.08 / 1.06:1 (D97) */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-kupfer);   /* Kupfer 6.26:1 on the surface */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-schwarz);
    --tint-accent: var(--color-schwarz);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="violett"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-violett-hell);   /* Violett on graphite 1.62:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-leitfarbe="porphyr"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-porphyr-hell);   /* Porphyr on graphite 2.19:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="dark"], [data-theme="dark"] *)[data-cd-mode="reading"][data-cta="gold"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold vs hover 1.08:1 */
    --color-link: var(--color-weiss);                 /* Blau hell beside the Gold pill would be a foreign Helle Ton (D90) */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-weiss);
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-ui-subtle);
    --tint-text: var(--color-text);
    --tint-link: var(--color-link);
    --tint-line: var(--color-ui-line-strong);
    --tint-cta: var(--color-cta);
    --tint-on-cta: var(--color-on-cta);
    --tint-cta-hover: var(--color-cta-hover);
    --tint-cta-hover-border: var(--color-cta-hover-border);
    --tint-cta-border: var(--color-cta);
    --tint-accent: var(--color-primary-indicator);
    --tint-lform-color: var(--color-primary);
    --tint-lform-text: var(--color-on-primary);
  }
}

/* High contrast (prefers-contrast: more): card lines reach 3:1 (#8F8F8F). */
@media screen and (prefers-contrast: more) {
  [data-theme="dark"] { --color-ui-line: var(--color-graphit-line-strong); }
}

@media screen and (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    color-scheme: dark;                               /* native scrollbars, date pickers, autofill */
    --color-text: var(--color-weiss);                 /* 17.04:1 on the surface */
    --color-text-inverse: var(--color-schwarz);
    --color-bg: var(--color-graphit-surface);
    --color-bg-subtle: var(--color-graphit-raised);
    --color-border: var(--color-weiss);
    --color-divider: var(--color-graphit-line);
    --color-ink: var(--color-weiss);
    --color-ui-bg: var(--color-graphit-page);
    --color-ui-line: var(--color-graphit-line);
    --color-ui-line-strong: var(--color-graphit-line-strong);
    --color-text-muted: var(--color-graphit-muted);
    --color-ui-subtle: var(--color-graphit-raised);
    --color-ui-overlay: var(--color-graphit-raised);
    --color-ui-overlay-subtle: var(--color-graphit-overlay);
    --color-line-on-light: #767676;                   /* the light field border: named Helle Töne stay light */
    /* Focus, D21 inverted: 2 px white ring + 2 px black halo; one of the two
       reaches 3:1 on every surface. Never changed by the Leitfarbe. */
    --color-focus: var(--color-weiss);
    --color-focus-halo: var(--color-schwarz);
    --shadow-focus-halo: 0 0 0 var(--focus-ring-offset) var(--color-focus-halo);
    /* Elevation: a 12 % shadow is invisible on graphite; overlays also lift to
       --color-ui-overlay. The backdrop dims more. */
    --shadow-overlay: 0 8px 24px rgb(0 0 0 / 0.6);
    --color-backdrop: rgb(0 0 0 / 0.7);
    --color-status-bar: var(--color-weiss);           /* danger/warning bar and field errors: white bar + icon, never Porphyr hell */
    --color-chart-edge: var(--color-weiss);           /* outlines the dark marks (Blau, Waldgrün, Violett, Porphyr) */
    --display-light: none;
    --display-dark: block;
  }
  /* blau first: also the default when data-leitfarbe is absent */
  [data-theme="auto"]:not([data-leitfarbe]),
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="blau"] {
    --color-on-primary: var(--color-weiss);       /* :root says text-inverse, black in the dark */
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-blau-hell);   /* Blau links only on Blau pages (D96): their dark twin */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-blau-hell);   /* Blau on graphite 1.86:1 — its own Helle Ton (Monochrom, Farben p.12–13) */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="gold"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold/Kupfer: fill vs hover 1.08 / 1.06:1 (D97) */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-gold);   /* Gold 13.35:1 on the surface */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-schwarz);
    --tint-accent: var(--color-schwarz);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="waldgruen"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-waldgruen-hell);   /* Waldgrün on graphite 2.42:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="kupfer"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold/Kupfer: fill vs hover 1.08 / 1.06:1 (D97) */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-kupfer);   /* Kupfer 6.26:1 on the surface */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-schwarz);
    --tint-accent: var(--color-schwarz);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="violett"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-violett-hell);   /* Violett on graphite 1.62:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-leitfarbe="porphyr"] {
    --color-cta-hover-border: var(--color-weiss);   /* white hover rim, 17.04:1 on the card: the D97 shade alone changes only 1.2–1.3:1 on graphite */
    --color-link: var(--color-weiss);   /* black in the light theme */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-porphyr-hell);   /* Porphyr on graphite 2.19:1 */
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-primary);
    --tint-text: var(--color-on-primary);
    --tint-link: var(--color-on-primary);
    --tint-line: var(--color-on-primary);
    --tint-cta: var(--color-weiss);
    --tint-on-cta: var(--color-schwarz);
    --tint-cta-hover: var(--color-grau-hell);
    --tint-cta-hover-border: var(--color-schwarz);
    --tint-cta-border: var(--color-weiss);
    --tint-accent: var(--color-weiss);
    --tint-lform-color: var(--color-weiss);
    --tint-lform-text: var(--color-schwarz);
  }
  :is([data-theme="auto"], [data-theme="auto"] *)[data-cd-mode="reading"][data-cta="gold"] {
    --color-cta-hover-border: var(--color-schwarz);   /* Gold vs hover 1.08:1 */
    --color-link: var(--color-weiss);                 /* Blau hell beside the Gold pill would be a foreign Helle Ton (D90) */
    --color-link-visited: var(--color-link);
    --color-primary-indicator: var(--color-weiss);
    --color-on-indicator: var(--color-schwarz);
    --color-selected-bg: var(--color-graphit-raised);
    --color-tag-bg: var(--color-graphit-raised);
    --color-line-on-tint: var(--color-graphit-line-strong);
    --tint-bg: var(--color-ui-subtle);
    --tint-text: var(--color-text);
    --tint-link: var(--color-link);
    --tint-line: var(--color-ui-line-strong);
    --tint-cta: var(--color-cta);
    --tint-on-cta: var(--color-on-cta);
    --tint-cta-hover: var(--color-cta-hover);
    --tint-cta-hover-border: var(--color-cta-hover-border);
    --tint-cta-border: var(--color-cta);
    --tint-accent: var(--color-primary-indicator);
    --tint-lform-color: var(--color-primary);
    --tint-lform-text: var(--color-on-primary);
  }
}

@media screen and (prefers-color-scheme: dark) and (prefers-contrast: more) {
  [data-theme="auto"] { --color-ui-line: var(--color-graphit-line-strong); }
}
