/* ═════════════════════════════════════════════════════════════════════
   Aegis Lighting v2 — minimally-invasive contrast hints.

   v1 painted opaque dark scrims under every .t-panel and
   .t-panel-body, which obliterated the per-theme colour tokens on
   pages without hero photos (rules, lore, glossary, etc). Visitors
   saw a near-black wash with barely-readable text — exactly the
   "themes don't work" report.

   v2 doctrine:
     * NEVER set background-color or background-image directly on a
       panel that the theme already styled. Theme tokens own the look.
     * ONLY add contrast helpers that are SAFE on every theme:
         - text-shadow      (boosts legibility without changing colour)
         - subtle borders   (using theme tokens, not hardcoded)
         - inset/outset
           shadows          (definition without recolouring)
     * Apply panel-scrim ONLY on themes that the source repo (premium-fx.css)
       declares HAVE a hero photo for .t-panel — naturalist, obsidian-codex,
       cretaceous-greenhouse, volcanic-glass, polar-field-lab, vellum-atlas.
       Other themes (solarpunk, bioluminescent-deep, steampunk-foundry,
       martian-survey) have no hero photo on .t-panel so we don't touch
       their panels at all.
     * Live in the END of the cascade so this single file can be removed
       to revert the deploy with zero side effects.

   Tested target: rules, lore, glossary (no hero photos), index +
   realism-hub (with hero photos), all 10 themes.
   ═════════════════════════════════════════════════════════════════════ */

/* ── 1. Panel hero-photo scrim ─ ONLY on themes with .t-panel hero ── */
/* premium-fx.css sets `--panel-bg-img: url(...)` ONLY on these six
   themes' .t-panel. We mirror the same selector list so we only paint
   a scrim where there's actually a photo to scrim. Themes without a
   hero photo get NO override here — their panels keep whatever
   background the theme assigned. */
[data-theme="naturalist"]            .t-panel,
[data-theme="obsidian-codex"]        .t-panel,
[data-theme="cretaceous-greenhouse"] .t-panel,
[data-theme="volcanic-glass"]        .t-panel,
[data-theme="polar-field-lab"]       .t-panel,
[data-theme="vellum-atlas"]          .t-panel {
  position: relative;
  isolation: isolate;
}
[data-theme="naturalist"]            .t-panel::after,
[data-theme="obsidian-codex"]        .t-panel::after,
[data-theme="cretaceous-greenhouse"] .t-panel::after,
[data-theme="volcanic-glass"]        .t-panel::after,
[data-theme="polar-field-lab"]       .t-panel::after,
[data-theme="vellum-atlas"]          .t-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  /* light scrim — keeps photo as texture, takes top 25 / bottom 60 % */
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg, #0E0F12) 22%, transparent) 0%,
    color-mix(in srgb, var(--bg, #0E0F12) 55%, transparent) 100%
  );
}
/* lift content above the scrim where it exists */
[data-theme="naturalist"]            .t-panel > *,
[data-theme="obsidian-codex"]        .t-panel > *,
[data-theme="cretaceous-greenhouse"] .t-panel > *,
[data-theme="volcanic-glass"]        .t-panel > *,
[data-theme="polar-field-lab"]       .t-panel > *,
[data-theme="vellum-atlas"]          .t-panel > * {
  position: relative;
  z-index: 1;
}

/* ── 2. Row text — small text-shadow only, no colour change ───────── */
.t-row .t-label,
.t-row .t-num {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* ── 3. Hero headline shadow — works on every theme ─────────────── */
section.hero h1,
.aegis-hero h1,
.r-hero h1 {
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 0, 0, 0.3);
}
section.hero .sub,
.hero .sub,
.aegis-hero .sub,
.r-hero .sub,
.hero .lede,
.r-hero .lede,
.t-eyebrow {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

/* ── 4. Stats bar segment dividers ────────────────────────────────── */
.stat-cell + .stat-cell {
  border-left: 1px solid color-mix(in srgb, var(--ink, #E7EAE6) 10%, transparent);
}

/* ── 5. Field Cam canvas frame ─ subtle only ──────────────────────── */
#fieldcam,
.field-cam {
  position: relative;
}
#fieldcam canvas,
.field-cam canvas {
  display: block;
  filter: contrast(1.04);
}

/* ── 6. Spine nav glassmorphism ─ subtle blur, no recolour ────────── */
.nx-spine,
.aegis-spine {
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
}

/* ── 7. Print: drop scrims so the page prints clean ───────────────── */
@media print {
  [data-theme="naturalist"]            .t-panel::after,
  [data-theme="obsidian-codex"]        .t-panel::after,
  [data-theme="cretaceous-greenhouse"] .t-panel::after,
  [data-theme="volcanic-glass"]        .t-panel::after,
  [data-theme="polar-field-lab"]       .t-panel::after,
  [data-theme="vellum-atlas"]          .t-panel::after {
    display: none !important;
  }
}
