/* =====================================================================
   AAUREX two-mode colour system. Shared by the main site and Cardioverse.
   html[data-mode="aaurex"]      official brand (default)
   html[data-mode="cardioverse"] Cardioverse campaign palette
   Page CSS reads the semantic tokens below; do not hard-code colours.
   The mode is set before paint by the inline script in each <head> and
   managed by /js/theme.js (switcher, storage, cross-tab sync).
   ===================================================================== */

:root {
  /* Official AAUREX palette */
  --c-midnight: #101B2D;
  --c-onyx: #171717;
  --c-moss: #52634A;
  --c-burgundy: #652D3D;
  --c-champagne: #D6C19A;
  --c-umber: #765640;
  --c-ivory: #F4F1EA;
  --c-stone: #B8B5AC;
  --c-white: #FFFFFF;
  /* Cardioverse palette */
  --c-cv-white: #FFFFFF;
  --c-cv-paper: #F4F2EF;
  --c-cv-red: #E3242B;
  --c-cv-grey: #A6A6A6;
  --c-cv-ink: #1D1D1F;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- AAUREX Mode (default) ---------- */
:root,
:root[data-mode="aaurex"] {
  color-scheme: dark;
  /* switcher tokens (safe on Cardioverse pages, no name clashes) */
  --ms-bg: rgba(244, 241, 234, .04);
  --ms-solid: #121c2b;
  --ms-line: rgba(214, 193, 154, .38);
  --ms-thumb: #D6C19A;
  --ms-on: #171717;
  --ms-off: #B8B5AC;
  --ms-hover: #F4F1EA;
  --ms-focus: #D6C19A;
}
/* Main-site semantic tokens are scoped to body.editorial so they never
   override the Cardioverse microsite's own tokens (--paper, --ink, ...). */
html:not([data-mode="cardioverse"]) body.editorial {
  --paper: #101B2D;
  --surface: #151d2a;
  --surface-raised: rgba(244, 241, 234, .035);
  --ink: #F4F1EA;
  --text: #F4F1EA;
  --muted: #B8B5AC;
  --line: rgba(214, 193, 154, .16);
  --line-strong: rgba(214, 193, 154, .34);
  --accent: #D6C19A;          /* labels, links, small accent text */
  --accent-strong: #E6D6B4;   /* hover */
  --accent-2: #9DAE92;        /* moss tint, readable on midnight */
  --accent-fill: #52634A;     /* moss fills, bars, active rules */
  --serif-accent: #D6C19A;    /* italic serif words in headings */
  --btn-bg: #D6C19A;
  --btn-ink: #171717;
  --btn-bg-hover: #E6D6B4;
  --btn-ghost-line: rgba(214, 193, 154, .42);
  --btn-ghost-ink: #F4F1EA;
  --header-surface: rgba(16, 27, 45, .88);
  --menu-surface: #121c2b;
  --focus: #D6C19A;
  --badge-bg: rgba(101, 45, 61, .55);
  --badge-ink: #EBDCC0;
  --shadow-soft: 0 18px 40px -24px rgba(0, 0, 0, .7);
  --shadow-lift: 0 26px 50px -28px rgba(0, 0, 0, .85);
  --img-filter: saturate(.72) contrast(1.04);
  --grain-opacity: .07;
  --hairline: linear-gradient(90deg, transparent, rgba(214, 193, 154, .38) 22%, rgba(214, 193, 154, .38) 78%, transparent);
  --logo-ring: #F4F1EA;

  /* Section compositions. Every composition starts and ends on --seam so
     consecutive sections flow into each other instead of stacking. */
  --seam: #121a27;
  --bg-hero:
    radial-gradient(120% 80% at 88% -10%, rgba(214, 193, 154, .22), transparent 55%),
    radial-gradient(55% 45% at 0% 55%, rgba(82, 99, 74, .34), transparent 70%),
    linear-gradient(170deg, #142238 0%, #101B2D 45%, #121a27 100%);
  --bg-a: /* midnight, faint moss glow */
    radial-gradient(50% 40% at 0% 50%, rgba(82, 99, 74, .30), transparent 70%),
    linear-gradient(180deg, #121a27 0%, #101B2D 30%, #101B2D 72%, #121a27 100%);
  --bg-b: /* onyx with burgundy undertone */
    radial-gradient(50% 40% at 92% 55%, rgba(101, 45, 61, .42), transparent 70%),
    linear-gradient(180deg, #121a27 0%, #171717 28%, #171617 75%, #121a27 100%);
  --bg-c: /* midnight to onyx, champagne light at the top */
    radial-gradient(70% 40% at 50% 0%, rgba(214, 193, 154, .09), transparent 75%),
    linear-gradient(180deg, #121a27 0%, #111a29 40%, #161718 85%, #121a27 100%);
  --bg-d: /* occasional umber warmth */
    radial-gradient(45% 38% at 85% 50%, rgba(118, 86, 64, .34), transparent 70%),
    linear-gradient(180deg, #121a27 0%, #14161c 40%, #101B2D 80%, #121a27 100%);
  --bg-cta:
    radial-gradient(55% 45% at 15% 55%, rgba(101, 45, 61, .56), transparent 72%),
    radial-gradient(40% 40% at 90% 45%, rgba(214, 193, 154, .10), transparent 72%),
    linear-gradient(180deg, #121a27 0%, #171717 55%, #151515 100%);
  --bg-footer:
    radial-gradient(60% 120% at 100% 100%, rgba(82, 99, 74, .16), transparent 70%),
    linear-gradient(180deg, #151515 0%, #121212 100%);
  --bg-promo:
    radial-gradient(45% 45% at 90% 50%, rgba(101, 45, 61, .45), transparent 72%),
    radial-gradient(35% 45% at 5% 50%, rgba(118, 86, 64, .22), transparent 72%),
    linear-gradient(160deg, #171717 0%, #1a1416 60%, #121a27 100%);
  --bg-card: linear-gradient(180deg, rgba(244, 241, 234, .045), rgba(244, 241, 234, .015));
  --hero-lines: repeating-radial-gradient(circle at 100% 0%, transparent 0 96px, rgba(214, 193, 154, .10) 96px 97px);

  /* Cardioverse promo block on main pages */
  --promo-title: #F4F1EA;
  --promo-title-alt: #D6C19A;
  --promo-rule: #D6C19A;
}

/* ---------- Cardioverse Mode ---------- */
:root[data-mode="cardioverse"] {
  color-scheme: light;
  --ms-bg: #FFFFFF;
  --ms-solid: #FFFFFF;
  --ms-line: #C8C5C0;
  --ms-thumb: #E3242B;
  --ms-on: #FFFFFF;
  --ms-off: #5E5E61;
  --ms-hover: #1D1D1F;
  --ms-focus: #C81E25;
}
html[data-mode="cardioverse"] body.editorial {
  --paper: #F4F2EF;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --ink: #1D1D1F;
  --text: #1D1D1F;
  --muted: #5E5E61;
  --line: #DEDBD7;
  --line-strong: #C8C5C0;
  --accent: #C81E25;          /* small red text, AA on warm paper */
  --accent-strong: #A8161C;
  --accent-2: #C81E25;
  --accent-fill: #E3242B;
  --serif-accent: #E3242B;    /* large display text only */
  --btn-bg: #E3242B;
  --btn-ink: #FFFFFF;
  --btn-bg-hover: #C81E25;
  --btn-ghost-line: #C8C5C0;
  --btn-ghost-ink: #1D1D1F;
  --header-surface: rgba(244, 242, 239, .95);
  --menu-surface: #F4F2EF;
  --focus: #C81E25;
  --badge-bg: #F4F2EF;
  --badge-ink: #C81E25;
  --shadow-soft: 0 16px 34px -26px rgba(80, 40, 30, .35);
  --shadow-lift: 0 24px 44px -26px rgba(80, 40, 30, .42);
  --img-filter: saturate(.7);
  --grain-opacity: .035;
  --hairline: linear-gradient(90deg, transparent, #DEDBD7 18%, #DEDBD7 82%, transparent);
  --logo-ring: #FFFFFF;

  --seam: #F7F5F2;
  --bg-hero:
    radial-gradient(70% 70% at 92% 0%, rgba(227, 36, 43, .07), transparent 62%),
    linear-gradient(180deg, #FFFFFF 0%, #F7F5F2 100%);
  --bg-a: linear-gradient(180deg, #F7F5F2 0%, #F4F2EF 35%, #F4F2EF 70%, #F7F5F2 100%);
  --bg-b: linear-gradient(180deg, #F7F5F2 0%, #FFFFFF 30%, #FFFFFF 75%, #F7F5F2 100%);
  --bg-c:
    radial-gradient(40% 40% at 92% 45%, rgba(227, 36, 43, .045), transparent 72%),
    linear-gradient(180deg, #F7F5F2 0%, #FBFAF8 40%, #F4F2EF 100%);
  --bg-d: linear-gradient(180deg, #F4F2EF 0%, #EFECE8 50%, #F7F5F2 100%);
  --bg-cta:
    radial-gradient(45% 45% at 8% 55%, rgba(227, 36, 43, .06), transparent 72%),
    linear-gradient(180deg, #F7F5F2 0%, #FFFFFF 100%);
  --bg-footer: linear-gradient(180deg, #FFFFFF 0%, #FAF9F7 100%);
  --bg-promo:
    radial-gradient(40% 45% at 92% 50%, rgba(227, 36, 43, .055), transparent 72%),
    linear-gradient(180deg, #FFFFFF 0%, #FBFAF8 100%);
  --bg-card: #FFFFFF;
  --hero-lines: repeating-radial-gradient(circle at 100% 0%, transparent 0 96px, rgba(29, 29, 31, .045) 96px 97px);

  --promo-title: #E3242B;
  --promo-title-alt: #A6A6A6;
  --promo-rule: #E3242B;
}

/* ---------- Mode switcher (main header and Cardioverse) ---------- */
.mode-switch {
  --ms-h: 38px;
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: none;
  height: var(--ms-h);
  padding: 3px;
  border: 1px solid var(--ms-line);
  border-radius: 99px;
  background: var(--ms-bg);
  font: 600 11px/1 var(--font-sans);
  letter-spacing: .04em;
  isolation: isolate;
}
.mode-switch__thumb {
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: var(--ms-w, 50%);
  border-radius: 99px;
  background: var(--ms-thumb);
  transform: translateX(var(--ms-x, 3px));
  transition: transform .32s var(--ease-out), width .32s var(--ease-out), background-color .3s;
}
.mode-switch:not(.is-ready) .mode-switch__thumb { opacity: 0; }
.mode-switch button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ms-off);
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color .25s;
  -webkit-tap-highlight-color: transparent;
}
.mode-switch button:hover { color: var(--ms-hover); }
.mode-switch button[aria-checked="true"] { color: var(--ms-on); }
.mode-switch button:focus-visible {
  outline: 2px solid var(--ms-focus);
  outline-offset: 3px;
}
.mode-switch button:active { transform: scale(.97); }
/* small shape marker so the state is not carried by colour alone */
.mode-switch button::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: .7;
}
.mode-switch button[aria-checked="true"]::before { background: currentColor; opacity: 1; }
.mode-switch--floating {
  position: fixed;
  z-index: 90;
  top: 10px;
  right: 14px;
  background: var(--ms-solid);
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .35);
}
.mode-switch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 420px) {
  .mode-switch { --ms-h: 36px; font-size: 10.5px; letter-spacing: .02em; }
  .mode-switch button { padding: 0 9px; gap: 5px; }
  .mode-switch button::before { width: 4px; height: 4px; }
}

/* ---------- Mode change cross-fade ---------- */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .38s; animation-timing-function: ease; }
html.mode-fading body,
html.mode-fading body *,
html.mode-fading body *::before,
html.mode-fading body *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  .mode-switch__thumb, .mode-switch button { transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
