/*
 * ZeitWerk design tokens: the ONE source of colour for every web surface
 * (docs/design/design-system.md §2, binding from 2026-11-09; ZEIT-171).
 * Imported by web/admin, web/clock and web/site. No colour value may appear in
 * those apps' CSS outside this file (scripts/check-tokens.mjs enforces it).
 *
 * Theme (§7): light by default. Dark applies only when <html data-theme="dark">
 * is set by the sun/moon toggle; there is deliberately no prefers-color-scheme
 * query, so every surface opens light.
 *
 * Monochrome design (CTO design package 2026-11, ZEIT-308 admin, ZEIT-309 clock
 * and site): black, white, greys, one functional error red (always with an icon
 * and text) and the heart red, which appears ONLY in "Made with ♥ in Seligenstadt".
 * The semantic tokens below carry no values of their own; they point at the
 * --mono-* primitives at the end of :root, so one palette serves all three apps.
 * Status is text plus an icon, never a hue: --ok and --warn are ink.
 * The six --cat-* category hues stay: six greys could not be told apart.
 */
:root {
  color-scheme: light;

  /* §2 tokens (light) */
  --bg: var(--mono-page);
  --bg-alt: var(--mono-card);
  --surface: var(--mono-card);
  --text: var(--mono-ink);
  --text-2: var(--mono-text-2);
  --text-3: var(--mono-text-3);
  /* Links and the focus ring are ink, never blue: the design lives on type and contrast. */
  --accent: var(--mono-ink);
  --button-bg: var(--mono-ink);
  --button-fg: var(--mono-card);
  --border-input: var(--mono-field);
  --border-deco: var(--mono-divider);
  --ok: var(--mono-ink);
  --danger: var(--mono-danger);
  --warn: var(--mono-ink);
  --clock-in: var(--mono-ink);
  --clock-out: var(--mono-ink);

  /* Tints for status chips and selection backgrounds (§6: "tinted background plus
     text and an icon"); never used for text. */
  --accent-tint: var(--mono-tint);
  --accent-tint-2: var(--mono-tint-2);
  --ok-tint: var(--mono-tint);
  --warn-tint: var(--mono-tint);
  --danger-tint: var(--mono-danger-tint);

  /* Text on fills: filled stamp/status marks, destructive buttons and accent fills. The dark
     theme switches the last two to ink because its fills are light. */
  --on-fill: var(--mono-card);
  --on-danger: var(--mono-card);
  --on-accent: var(--mono-card);
  /* Fixed print pair (PIN and reminder letters, the calendar QR code): always ink on paper. */
  --paper: var(--mono-card);
  --ink: var(--mono-ink);
  --ink-2: var(--mono-text-2);
  /* ZEIT-236: the company's accent colour. Set at runtime from the company's branding on
     <html> through the CSSOM (style.setProperty, CSP-safe), never written in CSS; the
     server accepts only colours with >= 4.5:1 against white, so --on-fill text on it
     passes in both themes. Until a company sets one it is the product accent. */
  --tenant-accent: var(--accent);
  --scrim: var(--mono-scrim);

  /* The signature heart ("Made with ♥ in Seligenstadt") and nothing else. */
  --heart: var(--mono-heart);

  /* ZEIT-309: the stamp card's dark half (design reference 03): ink panel, inverse text. */
  --panel: var(--mono-ink);
  --on-panel: var(--mono-card);
  --on-panel-2: var(--mono-divider);

  /* Data visualisation: six distinguishable category colours (planner, absences). */
  --cat-0: #3b63f6;
  --cat-1: #f79009;
  --cat-2: #12b76a;
  --cat-3: #7a5af8;
  --cat-4: #ee46bc;
  --cat-5: #06aed4;

  /* ZEIT-260/308 charts: --chart-1 = worked hours / any single series (ink), --chart-2 = target
     (mid grey, 4.9:1 on card). Grid and axis are recessive hairlines; chart text uses
     --text-2 / --text-3. */
  --chart-1: var(--mono-ink);
  --chart-2: var(--mono-chart-2);
  --chart-grid: var(--mono-grid);
  --chart-axis: var(--mono-divider);
  --chart-shadow: var(--mono-shadow);

  /* §4 typography and §6 layout (8 px grid; cards 16 px, buttons 12 px; flat, a 1 px line
     instead of a shadow) */
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  /* Archivo Black (SIL OFL 1.1), self-hosted from @fontsource/archivo-black; no font CDN. */
  --font-display: "Archivo Black", var(--font);
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius-button: 12px;
  --radius-card: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --shadow-card: 0 0 0 1px var(--border-deco);
  --motion: 160ms;

  /* ZEIT-308: the monochrome palette of the 2026-11 design package (black, white, greys and one
     heart red). These primitives hold every colour value; the semantic tokens above point at them
     (ZEIT-309 folded the clock/site layer, formerly tokens-mono.css, in here). web/admin re-points
     the same semantic tokens onto the same primitives in web/admin/src/styles.css. Contrast, WCAG 2.2, measured:
     light  ink 17.8:1 on page; text-2 6.9:1 on page, 6.4:1 on tint; text-3 5.7:1 on card,
            5.0:1 on tint; field border 3.2:1 on page (1.4.11); danger 6.5:1 on card, 5.9:1 on its tint;
            chart-2 4.9:1 on card; heart 4.3:1 on page (a graphic with a text alternative, >= 3:1).
     dark   text 17.2:1 on page; text-2 8.8:1 and text-3 6.7:1 on card; field border 4.4:1 on card;
            danger 7.3:1 on card; heart 4.2:1 on page. */
  --mono-ink: #101010;
  --mono-ink-soft: #3d3d3d;
  --mono-card: #ffffff;
  --mono-page: #f7f7f7;
  --mono-tint: #efefef;
  --mono-tint-2: #e6e6e6;
  --mono-text-2: #565656;
  --mono-text-3: #666666;
  --mono-field: #8a8a8a;
  --mono-divider: #d6d6d6;
  --mono-grid: #ececec;
  --mono-chart-2: #707070;
  --mono-danger: #b3261e;
  --mono-danger-tint: #fcf1f1;
  --mono-heart: #e32132;
  --mono-scrim: rgb(16 16 16 / 45%);
  --mono-shadow: rgb(16 16 16 / 14%);
  /* Dark: an inverted monochrome, chosen step by step (not a filter flip). */
  --mono-d-page: #0e0e0e;
  --mono-d-card: #1a1a1a;
  --mono-d-tint: #262626;
  --mono-d-tint-2: #303030;
  --mono-d-text: #f2f2f2;
  --mono-d-text-2: #b8b8b8;
  --mono-d-text-3: #a0a0a0;
  --mono-d-field: #808080;
  --mono-d-divider: #333333;
  --mono-d-grid: #262626;
  --mono-d-chart-2: #8f8f8f;
  --mono-d-danger: #f28b82;
  --mono-d-danger-tint: #2a1515;
  --mono-d-scrim: rgb(0 0 0 / 60%);
  --mono-d-shadow: rgb(0 0 0 / 50%);
  /* ZEIT-309: the stamp card's dark half in dark mode, darker than the page so it still reads
     as "black half / light half" without a white slab at night (17.9:1 with --mono-d-text). */
  --mono-d-panel: #000000;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: var(--mono-d-page);
  --bg-alt: var(--mono-d-card);
  --surface: var(--mono-d-card);
  --text: var(--mono-d-text);
  --text-2: var(--mono-d-text-2);
  --text-3: var(--mono-d-text-3);
  --accent: var(--mono-d-text);
  --button-bg: var(--mono-d-text);
  --button-fg: var(--mono-ink);
  --border-input: var(--mono-d-field);
  --border-deco: var(--mono-d-divider);
  --ok: var(--mono-d-text);
  --danger: var(--mono-d-danger);
  --warn: var(--mono-d-text);
  --clock-in: var(--mono-d-text);
  --clock-out: var(--mono-d-text);

  --accent-tint: var(--mono-d-tint);
  --accent-tint-2: var(--mono-d-tint-2);
  --ok-tint: var(--mono-d-tint);
  --warn-tint: var(--mono-d-tint);
  --danger-tint: var(--mono-d-danger-tint);
  --scrim: var(--mono-d-scrim);
  --on-danger: var(--mono-ink);
  --on-accent: var(--mono-ink);

  --panel: var(--mono-d-panel);
  --on-panel: var(--mono-d-text);
  --on-panel-2: var(--mono-d-text-2);

  --chart-1: var(--mono-d-text);
  --chart-2: var(--mono-d-chart-2);
  --chart-grid: var(--mono-d-grid);
  --chart-axis: var(--mono-d-divider);
  --chart-shadow: var(--mono-d-shadow);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion: 0ms;
  }
}

/*
 * status.zeitwerk1.de (ZEIT-497). Colours ONLY from the shared design tokens (web/shared/tokens.css,
 * prepended by scripts/build.mjs; scripts/check-tokens.mjs enforces it), so the page looks like the
 * rest of ZeitWerk in light and dark. WCAG 2.2 AA: text uses --text or --text-2, every control is
 * at least 44 x 44 px (HIG) and has a visible focus ring, state is text plus a symbol, never colour
 * alone, and nothing scrolls sideways at 320 CSS px (1.4.10).
 */
@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/archivo-black-latin-400-normal.woff2") format("woff2");
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}
h1 {
  font-size: 1.75rem;
  margin: 1.5rem 0 1rem;
}
h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
}
h3 {
  font-size: 1rem;
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
main:focus {
  outline: none;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1;
  padding: 0.5rem 1rem;
  background: var(--surface);
}

.top,
main,
.foot {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem;
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
}
.brand {
  margin: 0;
  font-size: 1.125rem;
}
.brand-name {
  font-family: var(--font-display);
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.button-quiet {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-button);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.summary {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.summary p {
  margin: 0;
}
.summary .headline {
  font-size: 1.125rem;
  font-weight: 600;
}
.summary-alert {
  background: var(--danger-tint);
  box-shadow: inset 4px 0 0 var(--danger);
}
.muted {
  color: var(--text-2);
}
.small {
  font-size: 0.875rem;
}

.components {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.components li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-deco);
}
.components li:first-child {
  border-top: 0;
}

.state {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent-tint);
  font-size: 0.875rem;
  white-space: nowrap;
}
.state-alert {
  background: var(--danger-tint);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.incident {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.incident-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}
.timeline {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}
.timeline li {
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 2px solid var(--border-deco);
  overflow-wrap: anywhere;
}
.timeline time {
  display: block;
  color: var(--text-2);
  font-size: 0.875rem;
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-button);
  background: var(--accent-tint);
}
.foot {
  margin-top: 2.5rem;
  padding-bottom: 2rem;
  color: var(--text-2);
  font-size: 0.875rem;
}
.foot p {
  margin: 0.25rem 0;
}

@media (prefers-reduced-motion: no-preference) {
  .summary {
    transition: background-color 0.2s;
  }
}
