/* ═══════════════════════════════════════════════════════════════════════════
   theme-bridge.css — makes the LEGACY component CSS obey the NEW theme.

   WHY THIS FILE EXISTS
   --------------------
   The theme lock says: "Buttons, cards, rules, section numbers, and links match
   homepage components. Do not import legacy card chrome." and "Do not ship two
   visual systems."

   61 routes carry component classes (.page-hero, .contact-field, .product-card,
   .g-compare-grid, .content-page …) whose ONLY styling lives in the legacy
   stack. Deleting that stack would strip those pages bare. So the component CSS
   STAYS — but the legacy palette it reads must be re-pointed at the theme tokens.

   The legacy stack is token-driven, which makes this cheap and complete:
     --mint   referenced 356×      --line  319×      --violet 45×
     --amber   30×                 --text   26×      --red    14×
   Re-pointing the :root definitions re-themes every one of those rules at once,
   with no per-rule surgery and no chance of missing one.

   This is a BRIDGE, not a second design system: it declares no new colours of
   its own. Every value below resolves to an existing design-system.css token, so
   if the homepage token changes, every inner page follows. That is the contract.

   Verified by parity_check.js, which measures the computed background, body
   colour, H1 font and H1 weight on the homepage AND on inner routes and fails if
   they differ. It is mutation-tested: reintroduce a legacy colour, it fails.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── surface / text: the theme's own values ────────────────────────────── */
  --bg:        var(--ink-950);        /* #070606 — was #06080d */
  --bg2:       var(--ink-900);
  --panel:     color-mix(in srgb, var(--ink-900) 82%, transparent);
  --panel2:    color-mix(in srgb, var(--ink-850) 88%, transparent);
  --text:      var(--text-primary);   /* #FAF7EA — was #f3f7f5 */
  --muted:     var(--text-muted);     /* #D6D8D6 — was #91a09c */
  --fg:        var(--text-primary);

  /* ── accent: the ONLY accent. mint (#6fffd3) and violet (#99a7ff) both
        collapse onto the theme cyan so no page shows a second hue. ─────────── */
  --mint:      var(--caledapt-cyan);  /* #19E8DE */
  --mint2:     var(--caledapt-cyan-deep);

  /* --green is NOT an accent. It is the legacy SUCCESS colour and it is used
     beside amber (#ffc96a, pending) and red (#ff6f85, failure) in the gateway
     UI — e.g. agent-gateway.js picks
       delivered ? green : amber
       delta > 0 ? green : delta < 0 ? red : grey
     Collapsing green onto the accent makes a successful email send look like a
     brand link and destroys the delivered/pending/failed triad. An earlier
     version of this file set --green: var(--caledapt-cyan) and that was wrong.
     It stays a distinct hue, desaturated to sit inside the theme's palette. */
  --green:     #5FD9A4;
  --violet:    var(--caledapt-cyan-deep);

  /* ── rules ─────────────────────────────────────────────────────────────── */
  --line:      var(--line-soft);
  --line2:     var(--line);

  /* ── status colours kept distinct: these carry meaning, not brand.
        Amber = caution, red = failure, and collapsing them onto cyan would
        make a failed scan look like a passing one. Slightly desaturated to
        sit inside the theme's palette. ─────────────────────────────────────── */
  --amber:     #E9C46A;
  --red:       #F2707F;
}

/* ── the chrome: theme components win outright ───────────────────────────────
   Eight legacy rules target .shell / .brand / .mobile-nav — the same three
   selectors the shared header uses. These are restated at theme specificity so
   the legacy stack cannot win regardless of link order. Measured, not assumed:
   parity_check.js compares computed geometry between homepage and inner pages. */

/* The theme's .shell (design-system.css) is a full-width band capped at --max.
   The legacy one was min(100% - 56px, 1440px) with no padding; the cap is
   restated from the shared token so all three stacks agree. */
.shell {
  width: auto;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--shell);
}

/* The legacy brand was a flex row with a 3-bar CSS mark. The theme brand is an
   <img> + wordmark, so the row layout is preserved but the sizing is the
   theme's, and the legacy min-width/nowrap traps are removed: those existed for
   the old wordmark-plus-"AI" pair and now squeeze the 375px header. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex: none;
  min-width: 0;
  text-decoration: none;
}
.brand img { width: 34px; height: 34px; flex: none; }

/* The legacy .mobile-nav was a small dropdown panel at right:20px, top:96px,
   shown by a JS class toggle. The theme's is a full-width sheet directly under
   the header. The theme geometry is restated so the legacy rule cannot clip it
   on a 375px viewport — that was the mobile-overflow half of the contract. */
.mobile-nav {
  display: block;
  position: fixed;
  top: 66px;
  /* NOTE: an earlier version of this rule added
       max-width: calc(100vw - (var(--shell) * 2));
     to suppress the 20px overflow menu_probe reported. That treated the SYMPTOM.
     The cause was that `.scenic-host > *` and `.page > *` both set
     position:relative on .mobile-nav, so it was in normal flow with left:20px
     applied as an offset — 375px wide starting at x=20. The exclusions in
     scenic.css / world.css / design-system.css fix it at the source, and this
     clamp is deliberately absent so a regression shows up here instead of being
     masked. */
  left: var(--shell);
  right: var(--shell);
  width: auto;
  z-index: 59;
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: var(--space-4);
}
.mobile-nav[hidden] { display: none; }
@media (min-width: 1081px) { .mobile-nav { display: none !important; } }

/* ── typography: the two defects the contract names explicitly ───────────────
   "Legacy pages … Inter headings around 42-46px weight 650" and
   "H1 extrabold, not Inter 650." The legacy stacks set .page-hero h1,
   .rp-page-hero h1, .content-page .hero h1 and .hero h1 to weight 650. They are
   overridden here to the theme's 800 so no inner page ships an Inter-650 H1. */

.page-hero h1,
.rp-page-hero h1,
.rp-hero h1,
.content-page .hero h1,
.hero h1,
.page-hero h1 > em,
.rp-page-hero h1 > span,
.rp-hero h1 > span,
.content-page .hero h1 > span,
.hero h1 > span,
.rp-final h2 > span,
.rp-sect-head h2 > span,
.section-head h2 em,
.build-card h2 em,
.final-card h2 em {
  font-family: var(--font-display);
  font-weight: 800;
}

/* The legacy gradient-span headings (mint→white→violet) are a second visual
   signature. The theme headings are flat cream, so the gradient is removed and
   only the colour is kept. -webkit-text-fill-color is what actually paints the
   gradient, so both must be cleared or the span stays gradient while the class
   says otherwise. */
.page-hero h1 > em,
.rp-page-hero h1 > span,
.rp-hero h1 > span,
.content-page .hero h1 > span,
.hero h1 > span,
.rp-final h2 > span,
.rp-sect-head h2 > span,
.section-head h2 em,
.build-card h2 em,
.final-card h2 em {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-primary);
  font-style: normal;
}

/* ── body canvas: the legacy radial-gradient wash is the light legacy canvas
   the contract forbids. design-system.css sets body background to --surface-0;
   this restates it so no legacy gradient survives under it. ──────────────── */
html, body, .content-body {
  background: var(--surface-0) !important;
  background-image: none !important;
  color: var(--text-primary);
  font-family: var(--font-body);
}