/* ===========================================================================
   Borked PC — Brand Tokens
   Direction: Bone & Oxblood      Version: 1.1.0      Updated: 2026-09-22

   Import this once, at the root of any Borked PC surface. Reference the
   semantic tokens (--bpc-surface-*, --bpc-text-*, --bpc-accent-*) from
   components. Do not reference the primitives directly and do not write a
   literal hex value into a component.

   Rules this file assumes you will follow:
     1. Red is never a field behind type. It is a rule, an underline, an
        arrow, an icon, a dot, or one small button.
     2. Outside of a single accent rule, red only appears below 24px.
     3. Status colours are state, never decoration. They are not the accent.
     4. The display face steps 400 -> 500 on dark. Light type thins optically
        on dark grounds and starts to look fragile.
     5. --bpc-heritage-red is the existing logo colour. Legacy mark only.
        It never appears in the interface.

   Fonts (add to <head>):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400&family=IBM+Plex+Mono:wght@400;500&display=swap">
   =========================================================================== */

:root {

  /* --- primitives: the raw palette. Components should not use these. ------ */
  --bpc-bone-50:  #FFFDF9;
  --bpc-bone-100: #F7F2EA;
  --bpc-bone-200: #EFE8DC;
  --bpc-bone-300: #E7DCCC;
  --bpc-bone-400: #D4C6B3;
  --bpc-bone-500: #A99C8C;

  --bpc-ink-400: #8A7C74;
  --bpc-ink-500: #6B5D57;
  --bpc-ink-600: #524540;
  --bpc-ink-700: #3A2F29;
  --bpc-ink-800: #241C19;
  --bpc-ink-900: #1C1613;
  --bpc-ink-950: #16110F;

  --bpc-red-100: #FBEAE7;
  --bpc-red-200: #F0A79E;
  --bpc-red-300: #E0503F;
  --bpc-red-400: #D9524A;
  /* Dark-mode small-text accent only. B4 audit, 2026-09-22: --bpc-red-400 on
     --bpc-surface-raised measures 4.15:1 in dark, under the 4.5:1 WCAG AA
     floor for text this size (10-11px mono labels and badges). Not a new
     brand colour, a lightened step of the same red, used only where
     --bpc-accent-sm is used below -- large text (H1 emphasis, the warranty
     sum, tier names, proof figures) stays on --bpc-red-400/--bpc-accent,
     which already clears the lower 3:1 large-text floor everywhere. */
  --bpc-red-350: #DE635B;
  --bpc-red-600: #B02A22;
  --bpc-red-700: #A82420;
  --bpc-red-800: #8E1D1B;
  --bpc-red-900: #6E1614;

  --bpc-espresso-400: #4A3F39;
  --bpc-espresso-500: #382F2B;
  --bpc-espresso-600: #2E2622;
  --bpc-espresso-700: #241D1A;
  --bpc-espresso-800: #1C1613;
  --bpc-espresso-900: #16110F;

  --bpc-cream-100: #F2EAE0;
  --bpc-cream-300: #C7B8AE;
  --bpc-cream-500: #A3938A;
  --bpc-cream-700: #8F8079;

  /* Legacy logo colour. Not an interface colour. Do not use it as one. */
  --bpc-heritage-red: #C00002;

  /* --- semantic: light theme. This is what components reference. --------- */
  --bpc-surface-ground:  var(--bpc-bone-100);
  --bpc-surface-raised:  var(--bpc-bone-50);
  --bpc-surface-sunk:    var(--bpc-bone-200);
  --bpc-surface-inverse: var(--bpc-ink-900);

  --bpc-text-primary:   var(--bpc-ink-800);
  --bpc-text-secondary: var(--bpc-ink-500);
  --bpc-text-muted:     var(--bpc-ink-400);
  --bpc-text-inverse:   var(--bpc-cream-100);
  --bpc-text-on-accent: var(--bpc-bone-50);

  --bpc-accent:       var(--bpc-red-800);
  --bpc-accent-hover: var(--bpc-red-700);
  --bpc-accent-mark:  var(--bpc-red-600);
  --bpc-accent-tint:  var(--bpc-red-100);
  /* Small-text accent (mono labels, badges under ~24px). Same as
     --bpc-accent-mark in light, where it already clears 4.5:1 everywhere;
     dark overrides this alone, below. */
  --bpc-accent-sm:    var(--bpc-red-600);

  --bpc-border-hairline: var(--bpc-bone-300);
  --bpc-border-strong:   var(--bpc-bone-400);
  --bpc-border-accent:   var(--bpc-red-800);

  --bpc-status-success:  #1F6F43;
  --bpc-status-warning:  #8A5E10;
  --bpc-status-critical: #B3261E;
  --bpc-status-info:     #2A5568;

  /* Paper grain. An SVG turbulence filter, desaturated to neutral, tiled at
     140px. It is a texture rather than a colour, which is why it can live
     here without being a palette decision: it carries no hue, it only stops
     a flat fill reading as a flat fill. Strength is set by the rect's own
     opacity below; raise it and it stops being paper and starts being an
     effect. */
  --bpc-texture-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.16'/%3E%3C/svg%3E");

  --bpc-shadow-sm: 0 1px 2px rgba(36,28,25,.05);
  --bpc-shadow-md: 0 1px 2px rgba(36,28,25,.05), 0 10px 30px -16px rgba(36,28,25,.18);

  /* Display weight is a token because it changes between themes. */
  --bpc-display-weight: 400;

  /* --- type -------------------------------------------------------------- */
  --bpc-font-display:  Newsreader, Georgia, "Times New Roman", serif;
  --bpc-font-body:     Archivo, "Helvetica Neue", Arial, sans-serif;
  --bpc-font-mono:     "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --bpc-font-document: Georgia, serif;   /* Word and email. Never Calibri. */

  --bpc-size-display-xl: clamp(36px, 6vw, 60px);
  --bpc-size-display-l:  clamp(30px, 4.6vw, 44px);
  --bpc-size-display-m:  clamp(24px, 3.6vw, 32px);
  --bpc-size-heading-l:  22px;
  --bpc-size-heading-m:  18px;
  --bpc-size-heading-s:  15px;
  --bpc-size-body-l:     18px;
  --bpc-size-body-m:     16px;
  --bpc-size-body-s:     14px;
  --bpc-size-label:      11px;

  --bpc-lh-display-xl: 1.06;
  --bpc-lh-display-l:  1.10;
  --bpc-lh-display-m:  1.16;
  --bpc-lh-heading:    1.28;
  --bpc-lh-body:       1.62;
  --bpc-lh-tight:      1.40;

  --bpc-track-display: -0.02em;
  --bpc-track-heading: -0.015em;
  --bpc-track-label:   0.12em;

  --bpc-measure-reading: 65ch;
  --bpc-measure-display: 17ch;
  --bpc-measure-caption: 46ch;

  /* --- space, radius, border, layout, motion ----------------------------- */
  --bpc-space-1:  2px;   --bpc-space-2:  4px;   --bpc-space-3:  8px;
  --bpc-space-4:  12px;  --bpc-space-5:  16px;  --bpc-space-6:  20px;
  --bpc-space-7:  24px;  --bpc-space-8:  32px;  --bpc-space-9:  40px;
  --bpc-space-10: 48px;  --bpc-space-11: 64px;  --bpc-space-12: 80px;
  --bpc-space-13: 96px;

  --bpc-radius-none: 0;
  --bpc-radius-sm:   2px;
  --bpc-radius-md:   4px;
  --bpc-radius-lg:   8px;
  --bpc-radius-pill: 999px;

  --bpc-border-width-hairline: 1px;
  --bpc-border-width-rule:     2px;
  --bpc-border-width-accent:   3px;

  --bpc-container:  1140px;
  --bpc-gutter:     20px;
  --bpc-gutter-min: 16px;

  --bpc-motion-fast: 120ms;
  --bpc-motion-base: 180ms;
  --bpc-motion-slow: 280ms;
  --bpc-ease: cubic-bezier(.2, 0, 0, 1);
}

/* ---------------------------------------------------------------------------
   Dark theme. Only the semantic tokens change; primitives stay put.
   The :not([data-theme="light"]) guard means an explicit light choice beats
   a dark operating system.
   ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bpc-surface-ground:  var(--bpc-espresso-800);
    --bpc-surface-raised:  var(--bpc-espresso-700);
    --bpc-surface-sunk:    var(--bpc-espresso-900);
    --bpc-surface-inverse: var(--bpc-bone-100);

    --bpc-text-primary:   var(--bpc-cream-100);
    --bpc-text-secondary: var(--bpc-cream-500);
    --bpc-text-muted:     var(--bpc-cream-700);
    --bpc-text-inverse:   var(--bpc-ink-800);
    --bpc-text-on-accent: var(--bpc-ink-950);

    --bpc-accent:       var(--bpc-red-400);
    --bpc-accent-hover: var(--bpc-red-300);
    --bpc-accent-mark:  var(--bpc-red-400);
    --bpc-accent-tint:  #2A1614;
    --bpc-accent-sm:    var(--bpc-red-350);

    --bpc-border-hairline: var(--bpc-espresso-500);
    --bpc-border-strong:   var(--bpc-espresso-400);
    --bpc-border-accent:   var(--bpc-red-400);

    --bpc-status-success:  #5FBE88;
    --bpc-status-warning:  #E3A93F;
    --bpc-status-critical: #FF6B5E;
    --bpc-status-info:     #8FB3C4;

    --bpc-shadow-sm: 0 1px 2px rgba(0,0,0,.45);
    --bpc-shadow-md: 0 1px 2px rgba(0,0,0,.45), 0 10px 30px -16px rgba(0,0,0,.70);

    --bpc-display-weight: 500;
  }
}

:root[data-theme="dark"] {
  --bpc-surface-ground:  var(--bpc-espresso-800);
  --bpc-surface-raised:  var(--bpc-espresso-700);
  --bpc-surface-sunk:    var(--bpc-espresso-900);
  --bpc-surface-inverse: var(--bpc-bone-100);

  --bpc-text-primary:   var(--bpc-cream-100);
  --bpc-text-secondary: var(--bpc-cream-500);
  --bpc-text-muted:     var(--bpc-cream-700);
  --bpc-text-inverse:   var(--bpc-ink-800);
  --bpc-text-on-accent: var(--bpc-ink-950);

  --bpc-accent:       var(--bpc-red-400);
  --bpc-accent-hover: var(--bpc-red-300);
  --bpc-accent-mark:  var(--bpc-red-400);
  --bpc-accent-tint:  #2A1614;
  --bpc-accent-sm:    var(--bpc-red-350);

  --bpc-border-hairline: var(--bpc-espresso-500);
  --bpc-border-strong:   var(--bpc-espresso-400);
  --bpc-border-accent:   var(--bpc-red-400);

  --bpc-status-success:  #5FBE88;
  --bpc-status-warning:  #E3A93F;
  --bpc-status-critical: #FF6B5E;
  --bpc-status-info:     #8FB3C4;

  --bpc-shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --bpc-shadow-md: 0 1px 2px rgba(0,0,0,.45), 0 10px 30px -16px rgba(0,0,0,.70);

  --bpc-display-weight: 500;
}

/* ===========================================================================
   Base. Optional, but this is the intended starting point for a page.
   =========================================================================== */

html { color-scheme: light dark; }

body {
  background: var(--bpc-surface-ground);
  color: var(--bpc-text-primary);
  font-family: var(--bpc-font-body);
  font-size: var(--bpc-size-body-m);
  line-height: var(--bpc-lh-body);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* Display type. The weight token is what makes dark mode hold up. */
.bpc-display-xl,
.bpc-display-l,
.bpc-display-m {
  font-family: var(--bpc-font-display);
  font-weight: var(--bpc-display-weight);
  letter-spacing: var(--bpc-track-display);
  text-wrap: balance;
  max-width: var(--bpc-measure-display);
  margin: 0;
}
.bpc-display-xl { font-size: var(--bpc-size-display-xl); line-height: var(--bpc-lh-display-xl); }
.bpc-display-l  { font-size: var(--bpc-size-display-l);  line-height: var(--bpc-lh-display-l);  }
.bpc-display-m  { font-size: var(--bpc-size-display-m);  line-height: var(--bpc-lh-display-m);  }

/* The one italic word. This is the brand's signature typographic move:
   emphasise the single word the positioning turns on, and nothing else. */
.bpc-display-xl em,
.bpc-display-l em,
.bpc-display-m em { font-style: italic; color: var(--bpc-accent); }

.bpc-heading-l { font-size: var(--bpc-size-heading-l); line-height: var(--bpc-lh-heading); font-weight: 600; letter-spacing: var(--bpc-track-heading); margin: 0; }
.bpc-heading-m { font-size: var(--bpc-size-heading-m); line-height: var(--bpc-lh-heading); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.bpc-heading-s { font-size: var(--bpc-size-heading-s); line-height: var(--bpc-lh-tight);   font-weight: 600; margin: 0; }

.bpc-body-l { font-size: var(--bpc-size-body-l); line-height: var(--bpc-lh-body); max-width: var(--bpc-measure-reading); }
.bpc-body-s { font-size: var(--bpc-size-body-s); line-height: 1.55; }

.bpc-label {
  font-family: var(--bpc-font-mono);
  font-size: var(--bpc-size-label);
  font-weight: 500;
  letter-spacing: var(--bpc-track-label);
  text-transform: uppercase;
  color: var(--bpc-text-muted);
}

/* Figures line up in columns. Always. */
.bpc-data { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* The accent rule: the sanctioned way to use red at size. Nothing else
   larger than 24px may be red. */
.bpc-rule {
  width: 46px;
  height: var(--bpc-border-width-accent);
  background: var(--bpc-accent);
  border: 0;
  margin: 0 0 var(--bpc-space-5);
}

/* Primary call to action. An underline, not a filled red block. */
.bpc-cta {
  display: inline-block;
  font-weight: 600;
  font-size: var(--bpc-size-body-s);
  color: var(--bpc-text-primary);
  text-decoration: none;
  border-bottom: var(--bpc-border-width-rule) solid var(--bpc-accent);
  padding-bottom: 3px;
  transition: border-color var(--bpc-motion-base) var(--bpc-ease);
}
.bpc-cta:hover { border-color: var(--bpc-accent-hover); }

.bpc-container {
  max-width: var(--bpc-container);
  margin-inline: auto;
  padding-inline: var(--bpc-gutter);
}
@media (max-width: 560px) {
  .bpc-container { padding-inline: var(--bpc-gutter-min); }
}

:focus-visible {
  outline: 2px solid var(--bpc-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
