/* ==========================================================================
   LBW Platform design tokens: layers 1 (foundations) and 2 (semantic), ADR-028.
   Neutral only. A host's brand pack (/brand/theme.css, layer 3) sets the brand tokens:
   --color-brand (identity and decoration only, never text), --color-accent,
   --color-accent-hover, --color-focus and, for the admin app, --color-band.
   The defaults below are neutral, for any surface that loads no pack (customer-facing pages).
   Components use semantic tokens only (--color-*, --space-*, --radius-*, --text-*, --motion-*):
   the architecture tests fail on a primitive, --color-brand or a raw colour anywhere else.
   Light mode first; dark follows the system, or data-theme="dark" on <html>.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  /* Latin and Latin Extended, with tabular numerals. SIL Open Font License (licensing/fonts). */
  src: url("../fonts/inter-variable-latin.woff2") format("woff2");
}

/* 1. Foundations ------------------------------------------------------------- */
:root {
  --lbw-carbon: #1C1F20;
  --lbw-graphite: #384349;
  --lbw-slate: #55595C;
  --lbw-taupe: #8A847A;
  --lbw-sand: #D6D1C7;
  --lbw-stone: #EAE7E1;
  --lbw-paper: #F4F1EA;
  --lbw-white: #FFFFFF;
  --lbw-night-900: #121416;
  --lbw-night-800: #15181A;
  --lbw-night-700: #1E2225;
  --lbw-night-600: #33393D;
  --lbw-night-500: #6B7176;
  --lbw-mist: #A7AEB4;
  --lbw-bone: #ECE9E3;

  /* Status: text = text, icons and solid fills; surface = banner background; border = its outline.
     Light text passes 4.5:1 on Paper, white and Stone, and white text passes on it as a fill.
     Dark text passes 6:1 on night-700/800/900, and Carbon text passes on it as a fill.
     Borders pass 3:1 against their surface and the page. Never the brand colours. */
  --status-success-text-light: #2B754A; --status-success-surface-light: #E7F9EC; --status-success-border-light: #419C66;
  --status-warning-text-light: #B54303; --status-warning-surface-light: #FEF0EB; --status-warning-border-light: #CC7452;
  --status-danger-text-light:  #B2242C; --status-danger-surface-light:  #FFEFEE; --status-danger-border-light:  #CF706B;
  --status-info-text-light:    #2B5FA8; --status-info-surface-light:    #ECF4FF; --status-info-border-light:    #5B8DD4;
  --status-success-text-dark:  #6CC08B; --status-success-surface-dark:  #122D1C; --status-success-border-dark:  #1F814D;
  --status-warning-text-dark:  #EF8234; --status-warning-surface-dark:  #382011; --status-warning-border-dark:  #A75B25;
  --status-danger-text-dark:   #F37986; --status-danger-surface-dark:   #391D1F; --status-danger-border-dark:   #AD525C;
  --status-info-text-dark:     #8AB4F0; --status-info-surface-dark:     #18273C; --status-info-border-dark:     #3F70B4;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.75rem;  --text-sm: 0.875rem; --text-md: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.375rem; --text-2xl: 1.75rem;
  --leading-tight: 1.25; --leading-normal: 1.5;
  --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.5rem;  --space-6: 2rem;   --space-7: 3rem;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-full: 999px;
  --target-min: 44px;
  --content-max: 40rem;
  --content-wide: 64rem;
  --shadow-raised: 0 1px 2px rgb(0 0 0 / 0.06), 0 2px 8px rgb(0 0 0 / 0.06);
  --motion-fast: 120ms; --motion-base: 200ms; --motion-ease: cubic-bezier(.2, .7, .2, 1);
}

/* 2. Semantic: light (default) ---------------------------------------------- */
:root,
[data-theme="light"] {
  --color-bg: var(--lbw-paper);
  --color-surface: var(--lbw-white);
  --color-surface-sunken: var(--lbw-stone);
  --color-border: var(--lbw-sand);            /* decorative dividers */
  --color-border-strong: var(--lbw-taupe);    /* form controls: 3.7:1 on white */
  --color-text: var(--lbw-carbon);            /* 14.7:1 on paper */
  --color-text-muted: var(--lbw-slate);       /* 6.3:1 on paper */
  --color-text-on-accent: var(--lbw-white);
  --color-success: var(--status-success-text-light);
  --color-success-surface: var(--status-success-surface-light);
  --color-success-border: var(--status-success-border-light);
  --color-warning: var(--status-warning-text-light);
  --color-warning-surface: var(--status-warning-surface-light);
  --color-warning-border: var(--status-warning-border-light);
  --color-danger: var(--status-danger-text-light);
  --color-danger-surface: var(--status-danger-surface-light);
  --color-danger-border: var(--status-danger-border-light);
  --color-info: var(--status-info-text-light);
  --color-info-surface: var(--status-info-surface-light);
  --color-info-border: var(--status-info-border-light);
  --color-on-status: var(--lbw-white);
  --color-band-text: var(--lbw-white);
  /* Neutral defaults for the brand tokens; a pack overrides them. */
  --color-brand: var(--lbw-graphite);
  --color-accent: var(--lbw-graphite);
  --color-accent-hover: var(--lbw-carbon);
  --color-focus: var(--lbw-graphite);
  --color-band: var(--lbw-graphite);
  color-scheme: light;
}

/* 2. Semantic: dark ---------------------------------------------------------- */
[data-theme="dark"] {
  --color-bg: var(--lbw-night-800);
  --color-surface: var(--lbw-night-700);
  --color-surface-sunken: var(--lbw-night-900);
  --color-border: var(--lbw-night-600);
  --color-border-strong: var(--lbw-night-500);
  --color-text: var(--lbw-bone);              /* 14.7:1 */
  --color-text-muted: var(--lbw-mist);        /* 7.1:1 */
  --color-text-on-accent: var(--lbw-carbon);
  --color-success: var(--status-success-text-dark);
  --color-success-surface: var(--status-success-surface-dark);
  --color-success-border: var(--status-success-border-dark);
  --color-warning: var(--status-warning-text-dark);
  --color-warning-surface: var(--status-warning-surface-dark);
  --color-warning-border: var(--status-warning-border-dark);
  --color-danger: var(--status-danger-text-dark);
  --color-danger-surface: var(--status-danger-surface-dark);
  --color-danger-border: var(--status-danger-border-dark);
  --color-info: var(--status-info-text-dark);
  --color-info-surface: var(--status-info-surface-dark);
  --color-info-border: var(--status-info-border-dark);
  --color-on-status: var(--lbw-carbon);
  --color-brand: var(--lbw-mist);
  --color-accent: var(--lbw-mist);
  --color-accent-hover: var(--lbw-bone);
  --color-focus: var(--lbw-mist);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: var(--lbw-night-800);
    --color-surface: var(--lbw-night-700);
    --color-surface-sunken: var(--lbw-night-900);
    --color-border: var(--lbw-night-600);
    --color-border-strong: var(--lbw-night-500);
    --color-text: var(--lbw-bone);
    --color-text-muted: var(--lbw-mist);
    --color-text-on-accent: var(--lbw-carbon);
    --color-success: var(--status-success-text-dark);
    --color-success-surface: var(--status-success-surface-dark);
    --color-success-border: var(--status-success-border-dark);
    --color-warning: var(--status-warning-text-dark);
    --color-warning-surface: var(--status-warning-surface-dark);
    --color-warning-border: var(--status-warning-border-dark);
    --color-danger: var(--status-danger-text-dark);
    --color-danger-surface: var(--status-danger-surface-dark);
    --color-danger-border: var(--status-danger-border-dark);
    --color-info: var(--status-info-text-dark);
    --color-info-surface: var(--status-info-surface-dark);
    --color-info-border: var(--status-info-border-dark);
    --color-on-status: var(--lbw-carbon);
    --color-brand: var(--lbw-mist);
    --color-accent: var(--lbw-mist);
    --color-accent-hover: var(--lbw-bone);
    --color-focus: var(--lbw-mist);
    color-scheme: dark;
  }
}

/* Reduced motion: every transition collapses to instant. */
@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-base: 0ms; }
}
