/* ============================================================
   tokens.css — the Scarlet design system, vendored for the shopfront.
   Source of truth: cathedral/shopsite-live/colors_and_type.css
   (itself derived from desktop/src/ui/design_system.rs).
   This file is the *definition* of the palette, so the brand audit skips it;
   every other stylesheet and page must reference these via var(--…).
   Fonts are self-hosted: no third-party request, works offline.
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/Inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/JetBrainsMono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/JetBrainsMono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/SpaceGrotesk-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/SpaceGrotesk-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/SpaceGrotesk-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/SpaceGrotesk-700.woff2') format('woff2');
}

:root {
  /* ===== BRAND — Calibrated Scarlet (House) + 5-Division Wayfinding Accents ===== */
  --scarlet:           #E11D48;   /* primary accent, on white 4.6:1 */
  --scarlet-dark:      #BE123C;   /* accent text / hover, 6.0:1 */
  --scarlet-light:     #FB7185;
  --on-accent:         #FFFFFF;   /* text on the rose fill, 4.70:1 */   /* tint only, never text on light */
  --rose-accent:       #F43F5E;
  --indigo:            #4338CA;   /* Security & Governance division, on white 7.9:1 */
  --indigo-dark:       #3730A3;

  /* ===== DIVISION TOKENS (active page defaults to House Scarlet) ===== */
  --div-accent:        var(--scarlet);
  --div-accent-dark:   var(--scarlet-dark);
  --div-accent-bg:     rgba(225, 29, 72, 0.07);
  --div-accent-border: rgba(225, 29, 72, 0.28);
  --div-shadow:        0 8px 26px rgba(225, 29, 72, 0.22);

  /* ===== DARK SURFACE TOKENS (Apps, CLI, Hardware, Dark Mode) ===== */
  --basalt-night:      #0A0A14;
  --aotearoa-bone:     #F7F7FA;
  --titanium-steel:    #525255;

  /* ===== SEMANTIC — darkened for text on a light surface ===== */
  --success:           #047857;
  --warning:           #B45309;
  --error:             #DC2626;
  --critical:          #B91C1C;   /* severity text, distinct from the brand accent */
  --info:              #1D4ED8;
  --gold:              #854D0E;
  --engine-online:     #15803D;

  /* ===== SURFACES — one theme, paper-first ===== */
  --bg-base:           #F7F7FA;   /* page */
  --bg-darker:         #F1F1F5;   /* band */
  --bg-dark:           #EEF1F5;   /* raised block */
  --bg-card:           #FFFFFF;   /* canonical card */
  --bg-card-alt:       #F8FAFC;
  --bg-surface:        #E6EAF0;
  --bg-hover:          #E4E8EE;

  /* ===== TEXT — the brand base colour, used as ink ===== */
  --fg1:               #0A0A14;
  --fg2:               #1E293B;
  --fg-muted:          #475569;
  --fg-dim:            #55616F;

  /* ===== BORDERS ===== */
  --border-subtle:     #E3E4EA;
  --border-default:    #CBD5E1;

  /* ===== INTERACTION — translucency that works on paper ===== */
  --hover:             rgba(10, 10, 20, 0.05);
  --line:              #E3E4EA;
  --line-strong:       rgba(10, 10, 20, 0.16);
  --line-hover:        rgba(10, 10, 20, 0.24);
  --inset:             rgba(10, 10, 20, 0.035);
  --header-bg:         rgba(247, 247, 250, 0.92);
  --shadow-lift:       0 14px 34px rgba(10, 10, 20, 0.07);
  --shadow-accent:     0 8px 26px rgba(225, 29, 72, 0.24);

  /* ===== TYPE ===== */
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-serif:   'EB Garamond', Georgia, serif;

  --fs-display:   2.5rem;
  --fs-h1:        2rem;
  --fs-h2:        1.5rem;
  --fs-h3:        1.25rem;
  --fs-h4:        1.125rem;
  --fs-body-lg:   1.125rem;
  --fs-body:      1rem;
  --fs-body-sm:   0.875rem;
  --fs-caption:   0.75rem;
  --fs-label:     0.6875rem;   /* 11px — the floor, never below */

  --lh-tight:     1.2;
  --lh-default:   1.5;
  --lh-relaxed:   1.6;
  --tracked:      0.08em;
  --tracked-wide: 0.1em;

  /* ===== SPACING (4px scale) ===== */
  --sp-xs:   4px;
  --sp-sm:   8px;
  --sp-md:   16px;
  --sp-lg:   24px;
  --sp-xl:   32px;
  --sp-xxl:  48px;

  /* ===== RADIUS ===== */
  --r-input:  6px;
  --r-button: 8px;
  --r-card:   12px;
  --r-badge:  4px;
  --r-pill:   9999px;

  /* ===== SHADOW / MOTION ===== */
  --shadow-card:  0 1px 2px rgba(10, 10, 20, 0.05), 0 10px 28px rgba(10, 10, 20, 0.06);
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --t-hover:      200ms;

  /* ===== SITE ALIASES — the names the stylesheet and pages already use ===== */
  --bg:            var(--bg-base);
  --bg-2:          var(--bg-darker);
  --surface:       var(--bg-card);
  --surface-solid: var(--bg-card);
  --surface-2:     var(--bg-dark);
  --border:        var(--border-subtle);
  --border-strong: rgba(225, 29, 72, 0.30);
  --border-gold:   rgba(161, 98, 7, 0.30);
  --border-teal:   rgba(15, 118, 110, 0.28);
  --fg:            var(--fg1);
  --fg-2:          var(--fg2);
  --crimson:       var(--scarlet);
  --crimson-soft:  var(--scarlet-dark);
  --crimson-bg:    rgba(225, 29, 72, 0.07);
  --gold-soft:     var(--gold);
  --gold-bg:       rgba(161, 98, 7, 0.08);
  --teal:          #0F766E;
  --teal-soft:     #0F766E;
  --teal-bg:       rgba(15, 118, 110, 0.08);
  --emerald:       var(--success);
  --radius:        var(--r-card);
  --radius-sm:     var(--r-button);
  --maxw:          1140px;
}

@media print {
  body { background: #fff !important; color: #111 !important; }
  .site-header, .site-footer, .no-print { display: none !important; }
  .glass-card { border-color: #ccc !important; background: #fff !important; color: #111 !important; }
}

/* ===== NIGHT THEME — Basalt Obsidian with Calibrated Scarlet Glow ===== */
html[data-theme="dark"] {
  --bg-base:           #08080D;
  --bg-darker:         #0D0E16;
  --bg-dark:           #131522;
  --bg-card:           #10121C;
  --bg-card-alt:       #141726;
  --bg-surface:        #1A1E30;
  --bg-hover:          #20253A;

  --fg1:               #F4F6FB;
  --fg2:               #CBD5E1;
  --fg-muted:          #94A3B8;
  --fg-dim:            #7C8BA1;

  --border-subtle:     rgba(255, 255, 255, 0.10);
  --border-default:    rgba(255, 255, 255, 0.16);
  --line:              rgba(255, 255, 255, 0.10);
  --line-strong:       rgba(255, 255, 255, 0.20);
  --line-hover:        rgba(225, 29, 72, 0.45);
  --inset:             rgba(255, 255, 255, 0.04);
  --hover:             rgba(255, 255, 255, 0.06);
  --header-bg:         rgba(8, 8, 13, 0.88);
  --scarlet-dark:      #FB7185;
  --shadow-card:       0 2px 6px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(225, 29, 72, 0.08);
  --shadow-lift:       0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ===== TRIPPY SUN / MOON SACRED-GEOMETRY SIGIL SWITCH ===== */
.theme-sigil-btn {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--scarlet);
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.18);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  flex-shrink: 0;
  margin-left: 10px;
}
.theme-sigil-btn:hover {
  box-shadow: 0 0 22px rgba(225, 29, 72, 0.42);
  border-color: var(--scarlet);
}
.theme-sigil-btn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-sigil-btn .sigil-ring {
  transform-origin: 16px 16px;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.theme-sigil-btn .sigil-rays {
  transform-origin: 16px 16px;
  transition: transform 0.6s ease, opacity 0.35s ease;
}
.theme-sigil-btn .sigil-moon-cut {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}
html[data-theme="dark"] .theme-sigil-btn {
  color: #F59E0B;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.28), inset 0 0 8px rgba(225, 29, 72, 0.25);
}
html[data-theme="dark"] .theme-sigil-btn svg {
  transform: rotate(180deg);
}
html[data-theme="dark"] .theme-sigil-btn .sigil-rays {
  opacity: 0;
  transform: scale(0.4) rotate(90deg);
}
html[data-theme="dark"] .theme-sigil-btn .sigil-ring {
  transform: rotate(-45deg);
}
html:not([data-theme="dark"]) .theme-sigil-btn .sigil-moon-cut {
  transform: translate(12px, -12px);
  opacity: 0;
}
