/*
 * Partner Paul website: design tokens (Salbei, light first).
 *
 * Light is the default for every visitor. The switch in the nav sets
 * data-theme="dark" on <html> and the page remembers it (localStorage
 * "pp-theme"); the dark values are in the block below. Only colours and
 * shadows differ between the themes; type,
 * spacing, radii and motion are shared. Names follow the app
 * (apps/web/src/styles/globals.css) wherever the app has the concept. New
 * names exist only for what the marketing site needs on top (display scale,
 * motion, layout, the tonal surface, sheet edges). Reference: README.md.
 *
 * Contrast ratios (WCAG 2.x) are noted next to every text colour as
 * bg / surface / surface-2 / surface-tonal. AA needs 4.5:1 for text, 3:1 for
 * large text (24 px, or 18.66 px bold) and for UI boundaries and focus
 * indicators.
 *
 * Fonts: Google Fonts in the showcase for now. Production must self-host
 * Inter, Inter Tight and JetBrains Mono (woff2, font-display: swap) and keep
 * the family names below.
 */

:root {
  color-scheme: light;

  /* ------------------------------------------------------------------
   * Colour: ground, surfaces, ink, lines (light; dark values further down)
   * ------------------------------------------------------------------ */

  --bg: #f4f4ec;             /* page ground: sage cream */
  --surface: #ffffff;        /* sheets, cards, panels */
  --surface-2: #e6efe4;      /* hover and selected rows, chips, badges, tonal button, neutral callout */
  --surface-tonal: #dcebdd;  /* pale green areas: behind the hero file, the waitlist sheet */

  --ink: #17251e;            /* headings, body, row titles     14.39 / 15.91 / 13.51 / 12.86 */
  --ink-secondary: #45534b;  /* lead, help, nav links, belegt   7.33 /  8.10 /  6.88 /  6.55 */
  --ink-tertiary: #5c6a62;   /* meta, placeholders, prüfen      5.14 /  5.69 /  4.83 /  4.60 */

  --border: rgba(23, 37, 30, 0.08);           /* hairlines: dividers */
  --border-strong: rgba(23, 37, 30, 0.14);    /* table rules, outlines */
  --border-control: #76817a;  /* input, textarea and checkbox boundary: 3.66 / 4.05 / 3.43 / 3.27 (WCAG 1.4.11) */
  --sheet-border: transparent; /* edge of a floating sheet: none in light, the shadow carries it */

  /* ------------------------------------------------------------------
   * Colour: the one accent (Salbei green)
   * Primary action, current selection, focus, links in prose, the logo dot.
   * Never headings, labels, secondary actions or decoration.
   * ------------------------------------------------------------------ */

  --accent: #2a6f4f;          /* as text/link: 5.45 / 6.03 / 5.12 / 4.87 */
  --accent-hover: #225e42;
  --accent-pressed: #1b4f37;
  --accent-tint: rgba(42, 111, 79, 0.08);     /* selection, accent badge ground; accent on it over surface-2 4.62 */
  --on-accent: #ffffff;       /* text on accent: 6.03, on hover 7.64, on pressed 9.46 */

  /* ------------------------------------------------------------------
   * Colour: states (belegt, offen, fehlt, prüfen)
   * Only in status labels, badges and callouts that report that state.
   * Each state also has its own icon shape, so colour is never the only cue.
   * ------------------------------------------------------------------ */

  --success: var(--accent);   /* belegt: check icon in green, text stays ink-secondary */
  --warning: #835800;         /* offen: amber        5.65 / 6.25 / 5.31 / 5.05 */
  --warning-bg: #fbeecd;      /* warning callout ground; ink 13.80, ink-secondary 7.03, amber 5.42 */
  --danger: #a6402f;          /* fehlt: restrained red  5.59 / 6.18 / 5.25 / 5.00 */
  --danger-bg: #fbe1da;       /* danger callout ground; ink 12.79, ink-secondary 6.51, red 4.97 */

  --status-belegt: var(--success);
  --status-offen: var(--warning);
  --status-fehlt: var(--danger);
  --status-pruefen: var(--ink-tertiary);

  /* ------------------------------------------------------------------
   * Focus: a crisp 2 px ring, never a glow
   * ------------------------------------------------------------------ */

  --focus-color: var(--accent);               /* 5.45 on bg, 6.03 on surface, 4.87 on surface-tonal */
  --focus-width: 2px;
  --focus-offset: 2px;
  --focus-ring: 0 0 0 1px var(--accent);      /* inputs: added to the 1 px accent border = 2 px */

  /* ------------------------------------------------------------------
   * Logo colours (source of truth: ../brand/build-logo.mjs)
   * ------------------------------------------------------------------ */

  --logo-line: #17251e;
  --logo-dot: #4fbf8a;        /* the brand dot, the same in both themes (logos are exempt from WCAG contrast) */
  --logo-ground: #f4f4ec;
  --logo-paper: #f3f5f1;      /* print and partner material */

  /* ------------------------------------------------------------------
   * Typography
   * ------------------------------------------------------------------ */

  --font-sans: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter Tight Variable", var(--font-sans);
  --font-mono: "JetBrains Mono", "JetBrains Mono Variable", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-features: "cv11";    /* Inter single-storey a, as in the app */

  --weight-regular: 400;      /* body */
  --weight-medium: 500;       /* labels, buttons, row titles */
  --weight-semibold: 600;     /* headings, wordmark */

  /* UI scale: identical to the app. Nothing between these steps. */
  --text-xs: 12px;            /* meta, badges, page references */
  --text-sm: 13px;            /* labels, help, status, notes */
  --text-base: 14px;          /* UI text, buttons, inputs, nav */
  --text-md: 15px;            /* body text on the website */
  --text-lg: 20px;            /* card and panel titles */
  --text-xl: 28px;            /* sub-section headings */
  --leading-tight: 1.3;
  --leading-ui: 1.5;
  --leading-reading: 1.65;

  /* Marketing scale on top: fixed pixel line heights keep the 4 px rhythm. */
  --text-lead: 17px;          --leading-lead: 28px;     /* intro under a headline */
  --leading-body: 24px;                                  /* --text-md as website body */
  --text-display-3: 36px;     --leading-display-3: 40px; --tracking-display-3: -0.02em;
  --text-display-2: 48px;     --leading-display-2: 52px; --tracking-display-2: -0.025em;
  --text-display-1: 64px;     --leading-display-1: 68px; --tracking-display-1: -0.03em;
  --tracking-heading: -0.02em;  /* --text-xl and --text-lg headings */
  --tracking-wordmark: -0.01em;
  --text-touch: 16px;         /* form controls under 600 px only: stops iOS zoom on focus */

  --measure: 65ch;            /* body text */
  --measure-lead: 34em;       /* lead text */

  /* ------------------------------------------------------------------
   * Spacing: 4 px grid (app steps plus 14, 20, 24, 32 for page rhythm)
   * ------------------------------------------------------------------ */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ------------------------------------------------------------------
   * Radii, lines, sizes
   * ------------------------------------------------------------------ */

  --radius-xs: 5px;           /* badges, page references, checkbox */
  --radius-sm: 8px;           /* buttons, inputs */
  --radius-md: 12px;          /* cards, callouts */
  --radius-lg: 16px;          /* sheets, product panels, dialogs */
  --radius-xl: 20px;          /* tonal areas behind or around sheets */
  --radius-full: 999px;       /* status dots, counts */

  --border-width: 1px;

  --control-sm: 28px;
  --control-md: 36px;
  --control-lg: 44px;         /* website CTAs and form fields; touch target */
  --chip-h: 20px;             /* badges, page references */
  --icon-sm: 12px;            /* status icons */
  --icon-md: 16px;            /* icons in buttons, checkbox */

  /* ------------------------------------------------------------------
   * Shadows: soft and green-tinted in light; sheets float a little
   * ------------------------------------------------------------------ */

  --shadow-xs: 0 1px 2px rgba(23, 37, 30, 0.05);
  --shadow-sm: 0 1px 2px rgba(23, 37, 30, 0.05), 0 4px 12px rgba(23, 37, 30, 0.05);
  --shadow-md: 0 1px 3px rgba(23, 37, 30, 0.05), 0 10px 28px rgba(23, 37, 30, 0.08);
  --shadow-lg: 0 2px 6px rgba(23, 37, 30, 0.05), 0 24px 52px -12px rgba(23, 37, 30, 0.16);
  --shadow-panel: 0 2px 6px rgba(23, 37, 30, 0.05), 0 28px 56px -16px rgba(23, 37, 30, 0.18); /* sheets, the product panel */

  /* ------------------------------------------------------------------
   * Motion: answers an action or runs one sequence; transform and opacity only
   * ------------------------------------------------------------------ */

  --duration-fast: 120ms;     /* hover, colour, border */
  --duration-base: 200ms;     /* open, close, state change */
  --duration-slow: 360ms;     /* one reveal per page */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ------------------------------------------------------------------
   * Layout
   * ------------------------------------------------------------------ */

  --w-content: 1200px;        /* nav, hero, sections, footer */
  --w-page: 960px;            /* long single-column pages (as in the app) */
  --w-reading: 720px;         /* legal text, articles (as in the app) */
  --page-pad: 32px;           /* side padding of .pp-wrap */
  --nav-h: 64px;              /* website nav */
  --header-h: 56px;           /* app top bar, panel headers in screenshots */
  --section-space: var(--space-32);  /* block padding of a page section */

  --grid-columns: 12;
  --grid-gutter: 24px;
  --split-gap: 64px;          /* copy column to product column */

  /* Breakpoints. Media queries cannot read custom properties; use the
     literal values: (max-width: 599px), (max-width: 1023px), (max-width: 1263px). */
  --bp-sm: 600px;
  --bp-md: 1024px;
  --bp-lg: 1264px;
}

/* Dark: the Salbei values, chosen with the switch in the nav (data-theme="dark"; the page stores the choice). */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d1411;
  --surface: #131c18;
  --surface-2: #1a2520;
  --surface-tonal: #15221b;

  --ink: #eef3ef;            /* 16.62 / 15.49 / 14.07 / 14.65 */
  --ink-secondary: #a6b3ab;  /*  8.58 /  8.00 /  7.26 /  7.57 */
  --ink-tertiary: #808d86;   /*  5.40 /  5.03 /  4.57 /  4.76 */

  --border: rgba(238, 243, 239, 0.09);
  --border-strong: rgba(238, 243, 239, 0.16);
  --border-control: #6b7470;  /* 3.87 / 3.61 / 3.28 / 3.41 */
  --sheet-border: var(--border); /* shadows barely read on dark, so sheets keep a hairline */

  --accent: #4fbf8a;          /* 8.13 / 7.58 / 6.88 / 7.00 */
  --accent-hover: #6fd3a3;
  --accent-pressed: #3fa877;
  --accent-tint: rgba(79, 191, 138, 0.13);
  --on-accent: #0d1411;       /* 8.13, hover 10.24, pressed 6.29 */

  --warning: #e0a526;
  --warning-bg: #2a2412;
  --danger: #e07a6e;
  --danger-bg: #2c1b18;

  --logo-line: #eef3ef;
  --logo-ground: #0d1411;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.5), 0 20px 48px rgba(0, 0, 0, 0.55);
  --shadow-panel: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* Display sizes and page padding step down with the viewport. */
@media (max-width: 1263px) {
  :root {
    --text-display-1: 56px;   --leading-display-1: 60px;
    --split-gap: 48px;
  }
}
@media (max-width: 1023px) {
  :root {
    --text-display-1: 48px;   --leading-display-1: 52px;
    --text-display-2: 40px;   --leading-display-2: 44px;
    --page-pad: 24px;
    --section-space: var(--space-24);
  }
}
@media (max-width: 599px) {
  :root {
    --text-display-1: 40px;   --leading-display-1: 44px;
    --text-display-2: 32px;   --leading-display-2: 36px;
    --text-display-3: 28px;   --leading-display-3: 32px;
    --page-pad: 20px;
    --section-space: var(--space-20);
  }
}

/* Reduced motion: every transition built on the tokens ends instantly,
   so the end state shows without a separate rule per component. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
  }
}
