/* OUTER HEAVEN — fleet showcase v2
   Dark-only for this pass. THEME-HOOK markers show where a light palette
   drops in later — every color below is a token, nothing hardcoded, so
   that pass only adds a second value block, never restructures a rule.
   Vanilla CSS, no build step. */

/* ============ TOKENS ============ */
:root {
  /* ---- color: surfaces ---- */
  --bg:        #08080b;
  --bg-raise:  #0e0f14;
  --bg-panel:  #121319;
  --line:      rgba(255,255,255,.09);
  --line-soft: rgba(255,255,255,.05);

  /* ---- color: ink (measured against --bg / --bg-panel, see report) ---- */
  --ink:       #f3f4f7;   /* body/heading — ~18.5:1 on --bg */
  --ink-dim:   #9aa1ad;   /* secondary body copy — ~7.7:1 on --bg, ~7.2:1 on --bg-panel */
  --ink-faint: #838a98;   /* meta/labels, smallest text on the page — ~5.8:1 on --bg */

  /* ---- color: realm accent (set by JS per realm) ---- */
  --a: #c0273a;
  /* text-safe tint of any accent used as foreground text (role labels etc).
     Raw accents fail 4.5:1 on dark surfaces when read as text; this mix
     keeps hue identity while guaranteeing contrast. Decoration (borders,
     glow, shadow, dot) keeps the raw accent — only running text uses this. */
  --a-text: color-mix(in srgb, var(--a) 60%, white 40%);

  /* THEME-HOOK: a [data-theme="light"] block redefines every var above,
     nothing else in this file needs to change. */

  /* ---- type scale: 1.25 ratio, fluid between 380px and 1280px ---- */
  --text-2xs:  0.6875rem;                                   /* 11px — micro/eyebrow-free labels */
  --text-xs:   0.8125rem;                                   /* 13px — meta, footer */
  --text-sm:   0.9375rem;                                   /* 15px — taglines, dense captions */
  --text-base: 1rem;                                        /* 16px — body floor */
  --text-md:   1.125rem;                                    /* 18px — lede, panel tagline */
  --text-lg:   1.25rem;                                     /* 20px — card name */
  --text-xl:   clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);   /* 22–28px — panel name, h3 */
  --text-2xl:  clamp(1.75rem, 1.35rem + 1.7vw, 2.375rem);   /* 28–38px — section h2 */
  --text-display: clamp(2.375rem, 1.55rem + 3.6vw, 4rem);   /* 38–64px — hero h1 */

  /* ---- spacing scale: 4px base ---- */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-7:  32px;
  --sp-8:  40px;
  --sp-9:  48px;
  --sp-10: 64px;
  --sp-11: 80px;
  --sp-12: 96px;

  --shadow:   0 24px 60px -20px rgba(0,0,0,.9);
  --ease:     cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  /* slow, symmetric in/out curve — used for the realm background dissolve,
     which needs to read as deliberate rather than a snap or a quick fade */
  --ease-slow: cubic-bezier(.65,0,.35,1);
  --measure:  68ch;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
/* width:100% + overflow-x:hidden on BOTH html and body, not just body: a
   known defensive pattern for iOS Safari, which can otherwise compute an
   effective layout width wider than the true visual viewport and render
   correctly-centered content shifted to one side of the real screen
   (owner observed this on a real iPhone, 2026-09-03; unconfirmed root
   cause, this is the next best-supported attempt after ruling out
   backdrop-filter+sticky). */
html {
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* browser surfaces belong to the design too */
::selection { background: var(--a); color: #08080b; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--a-text);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ambient ground glow — faint, keeps flat black from reading dead.
   Two stacked, hand-authored gradient layers (no fabricated art) that
   crossfade on realm switch via opacity, not a `background` property
   interpolation — that only tweens reliably when both sides are shaped
   the same, and Dungeon/Apartment are deliberately not. body::before is
   the Dungeon composition (low, warm); body::after is the Apartment
   composition (high, cool). [data-realm] on <body> picks which is on top.
   Slowed to ~1s with --ease-slow so the swap reads as a dissolve. */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 1050ms var(--ease-slow);
}
body::before {
  opacity: 1;
  background:
    radial-gradient(130% 65% at 50% 112%, rgba(192,39,58,.22), transparent 62%),
    radial-gradient(85% 55% at 15% -5%, rgba(255,140,60,.09), transparent 60%);
}
body::after {
  opacity: 0;
  background:
    radial-gradient(120% 65% at 50% -12%, rgba(214,74,143,.20), transparent 58%),
    radial-gradient(85% 55% at 85% 108%, rgba(80,140,255,.08), transparent 62%);
}
body[data-realm="personas"]::before { opacity: 0; }
body[data-realm="personas"]::after  { opacity: 1; }

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

.wrap {
  width: min(1180px, calc(100% - var(--sp-9)));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--sp-4);
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  font-weight: 650;
  transition: top 200ms var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

.meta {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--text-2xs);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  /* backdrop-filter dropped: iOS Safari has known compositing bugs combining
     backdrop-filter with position:sticky, which can mis-size the sticky
     layer and shift page content left of true viewport center (owner
     observed this on a real iPhone, 2026-09-03). Background made near-opaque
     to compensate for losing the frosted-glass blur look. */
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.site-head .wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-4);
  height: 64px;
}
.head-reserved { justify-self: start; }
.brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  font-weight: 700;
  letter-spacing: .12em;
  font-size: var(--text-sm);
  text-transform: uppercase;
  justify-self: center;
}
.brand .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 12px var(--a);
  transition: background 500ms var(--ease), box-shadow 500ms var(--ease);
  align-self: center;
}
.head-actions { display: flex; align-items: center; gap: var(--sp-3); justify-self: end; }

/* ---------- buttons — physical press, no ripple ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--ink-dim);
  font: inherit;
  font-size: var(--text-xs);
  letter-spacing: .01em;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 10px;
  cursor: pointer;
  /* raised feel: inset top highlight (the edge catching light) + a tight
     contact shadow + a softer ambient one underneath */
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,.07),
    0 1px 1px rgba(0,0,0,.55),
    0 8px 20px -12px rgba(0,0,0,.7);
  transition:
    transform 120ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    border-color 220ms var(--ease),
    color 220ms var(--ease),
    background 220ms var(--ease);
}
.btn:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--a) 45%, var(--line));
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,.09),
    0 1px 1px rgba(0,0,0,.6),
    0 10px 24px -12px rgba(0,0,0,.75);
}
.btn:active {
  /* shadow visibly collapses inward on press, not just a translate nudge */
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,.55),
    0 1px 1px rgba(0,0,0,.4);
  transition-duration: 40ms;
}
.btn.primary {
  background: color-mix(in srgb, var(--a) 16%, var(--bg-raise));
  border-color: color-mix(in srgb, var(--a) 55%, transparent);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,.12),
    0 1px 1px rgba(0,0,0,.5),
    0 10px 24px -12px color-mix(in srgb, var(--a) 55%, transparent);
}
.btn.primary:hover {
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,.14),
    0 1px 1px rgba(0,0,0,.55),
    0 0 28px -6px var(--a);
}
.btn.primary:active {
  box-shadow: inset 0 1px 3px rgba(0,0,0,.55), 0 1px 1px rgba(0,0,0,.4);
}

/* ---------- realm tablist ---------- */
.realms {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-raise);
  position: relative;
  /* the track reads as a shallow groove the pill sits inside */
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.02);
}
.realm-tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: var(--text-xs);
  padding: 7px var(--sp-4);
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  z-index: 1;
  transition: color 260ms var(--ease), transform 100ms var(--ease-out);
}
.realm-tab:hover { color: var(--ink-dim); }
.realm-tab:active { transform: translateY(1px); transition-duration: 40ms; }
.realm-tab[aria-selected="true"] { color: var(--ink); }
.realm-ind {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  border-radius: 9px;
  background: color-mix(in srgb, var(--a) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--a) 50%, transparent);
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,.14),
    0 1px 2px rgba(0,0,0,.4),
    0 0 22px -4px var(--a);
  transition: transform 480ms var(--ease-out), width 480ms var(--ease-out),
              background 400ms var(--ease), border-color 400ms var(--ease),
              box-shadow 400ms var(--ease);
  z-index: 0;
}

/* ---------- org chart (this IS the hero — apex + fanned roster, one composition) ---------- */
.orgchart {
  position: relative;
  padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 6vw, 80px);
}
.orgchart-copy {
  text-align: center;
  max-width: 720px;
  margin: 0 auto clamp(48px, 7vw, 80px);
}
.wordmark {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 .32em;
  font-size: var(--text-display);
  line-height: 1.02;
  letter-spacing: -.03em;
  font-weight: 800;
}
.wordmark .word.accent {
  /* Display size only: raw accent measures 3.43:1, above the 3:1 large-text
     threshold. --a-text (the lighter tint) stays for small accent text. */
  color: var(--a);
  transition: color 600ms var(--ease);
}
.orgchart-copy .lede {
  color: var(--ink-dim);
  max-width: 52ch;
  margin: var(--sp-5) auto 0;
  font-size: var(--text-md);
}
.orgchart-copy p#shared-note-hero {
  color: var(--ink-faint);
  max-width: 54ch;
  margin: var(--sp-3) auto 0;
  font-size: var(--text-xs);
}
.hero-cta { display: flex; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-6); flex-wrap: wrap; }

/* the diagram: apex card, SVG connectors and the specialist roster share
   this positioning context so the lines can be measured against both. */
.diagram { position: relative; }

/* apex — Igris. Bigger portrait, heavier border/glow, more padding than any
   specialist card: the size difference alone should read as "in charge." */
.apex-card {
  --c: #c0273a;
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  width: min(360px, 80vw);
  margin: 0 auto var(--sp-10);
  padding: var(--sp-8) var(--sp-7) var(--sp-8);
  border-radius: 28px;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-raise));
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, var(--line));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent) inset,
    0 34px 80px -26px color-mix(in srgb, var(--c) 70%, transparent),
    var(--shadow);
  transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease);
}
.apex-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -34% -30% auto -30%;
  height: 170%;
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--c) 26%, transparent), transparent 62%);
  filter: blur(22px);
  animation: breathe 7s var(--ease) infinite;
}
@keyframes breathe {
  0%,100% { opacity: .7; transform: scale(1); }
  50%     { opacity: 1;  transform: scale(1.045); }
}
.apex-card:hover, .apex-card:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c) 32%, transparent) inset,
    0 38px 90px -24px color-mix(in srgb, var(--c) 82%, transparent),
    var(--shadow);
}
.apex-card:active { transform: translateY(0); transition-duration: 60ms; }
.apex-portrait {
  position: relative;
  width: clamp(148px, 20vw, 184px);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.75);
}
.apex-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
.apex-portrait .glow {
  position: absolute; inset: -18%;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 46%, transparent), transparent 58%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.apex-role {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-xs);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 65%, white 35%);
}
.apex-name { font-size: var(--text-2xl); font-weight: 720; letter-spacing: -.02em; }
.apex-tag { color: var(--ink-dim); font-size: var(--text-md); text-align: center; max-width: 30ch; }

/* apex rank badge — same visual language as .card .rank (defined further
   down) but the apex reads as clearly more "alive": a slow, faint breathe
   rather than the specialists' quiet hover-brighten. */
.apex-card .rank {
  position: absolute;
  top: var(--sp-5); right: var(--sp-5);
  z-index: 3;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: var(--text-2xs);
  font-weight: 700;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: color-mix(in srgb, var(--c) 60%, white 40%);
  background: rgba(6,6,9,.72);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  backdrop-filter: blur(4px);
  animation: rankPulse 4.5s var(--ease) infinite;
}
@keyframes rankPulse {
  0%, 100% { opacity: .85; box-shadow: 0 0 0 0 transparent; }
  50%      { opacity: 1;   box-shadow: 0 0 14px 2px color-mix(in srgb, var(--c) 55%, transparent); }
}

/* apex cursor-tracked light — desktop/mouse only (js/app.js checks
   hover:hover + pointer:fine before wiring the mousemove listener at all;
   this layer just sits at opacity 0 until ".cursor-lit" is toggled).
   --mx/--my default to center so nothing looks broken if the class ever
   lands without the listener having fired first. */
.apex-card {
  --mx: 50%;
  --my: 50%;
}
.apex-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx) var(--my), color-mix(in srgb, var(--c) 32%, transparent), transparent 62%);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms var(--ease);
}
.apex-card.cursor-lit::after { opacity: 1; }

/* animated connector lines fanning from the apex down to the active realm's
   cards. Positions are computed in JS from getBoundingClientRect() against
   #orgchart-diagram; this layer only needs to sit behind the cards and stay
   click-through. */
.fan-lines {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
  transition: opacity 260ms var(--ease);
}
.fan-lines.fan-swapping { opacity: 0; }
.fan-line {
  fill: none;
  stroke-width: 1.75;
  opacity: .8;
  transition: opacity 220ms var(--ease), stroke-width 220ms var(--ease), filter 220ms var(--ease);
}
.fan-line.flowing {
  stroke-dasharray: 5 7;
  animation: fanflow 2.6s linear infinite;
}
@keyframes fanflow { to { stroke-dashoffset: -48; } }

/* hover/focus on a roster card highlights its own connector (js/app.js
   wireFanHover()) — the other lines recede, none disappear. */
.fan-lines.fan-hover .fan-line { opacity: .2; }
.fan-lines.fan-hover .fan-line.active-line {
  opacity: 1;
  stroke-width: 2.75;
  filter: drop-shadow(0 0 6px var(--ln));
}

/* realm-switch flicker: a couple of quick brightness/opacity pulses right
   as the lines redraw for the new realm, evoking a reboot rather than a
   plain crossfade. Class added/removed by setRealm()'s existing
   setTimeout-based swap sequencing. */
.fan-lines.fan-flicker { animation: fanFlicker 380ms steps(1, end) 1; }
@keyframes fanFlicker {
  0%   { opacity: 1;   filter: brightness(1); }
  12%  { opacity: .15; filter: brightness(2.4); }
  24%  { opacity: 1;   filter: brightness(1); }
  38%  { opacity: .25; filter: brightness(2.2); }
  50%  { opacity: 1;   filter: brightness(1); }
  70%  { opacity: .4;  filter: brightness(1.8); }
  100% { opacity: 1;   filter: brightness(1); }
}

#roster { position: relative; z-index: 1; }

/* rise-from-floor entrance — visible by default, animation is an enhancement.
   rAF is unreliable when this tab is backgrounded; JS toggles .in with a
   forced-reflow helper + setTimeout, never rAF. See js/app.js `paint()`. */
.rise { opacity: 1; }
.rise.will-rise { opacity: 0; }
.rise.will-rise.in {
  animation: rise 1000ms var(--ease-out) forwards;
}
@keyframes rise {
  0%   { opacity: 0; transform: translateY(52px); filter: blur(5px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
/* the commander materializes as a system window would: a bottom-up wipe
   layered on the rise, not a plain fade */
.materialize.will-rise { clip-path: inset(100% 0 0 0); }
.materialize.will-rise.in {
  animation: rise 1000ms var(--ease-out) forwards, wipe 900ms var(--ease-out) forwards;
}
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }

/* ---------- section furniture ---------- */
.section { padding: clamp(var(--sp-9), 6vw, var(--sp-12)) 0; }
.section-head { margin-bottom: var(--sp-7); }
.section-head h2 {
  font-size: var(--text-2xl);
  letter-spacing: -.02em;
  font-weight: 680;
}
.section-head p {
  color: var(--ink-dim);
  margin-top: var(--sp-3);
  max-width: var(--measure);
}
.shared-note {
  color: var(--ink-faint) !important;
  font-size: var(--text-xs);
  margin-top: var(--sp-4) !important;
}
.rule { height: 1px; background: var(--line-soft); border: 0; margin: 0; }

/* ---------- roster ---------- */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(224px, 1fr));
  justify-content: center;
  gap: var(--sp-4);
}
.card {
  --c: var(--a);
  position: relative;
  appearance: none;
  text-align: left;
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-raise));
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 260ms var(--ease-out),
    border-color 260ms var(--ease),
    box-shadow 260ms var(--ease);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c), transparent);
  opacity: .3;
  transition: opacity 300ms var(--ease);
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  box-shadow: 0 20px 46px -26px var(--c), var(--shadow);
}
.card:hover::after, .card:focus-visible::after { opacity: 1; }
.card:active { transform: translateY(0); transition-duration: 60ms; }

.card .portrait, .persona-card .portrait {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0a0a0e;
  margin-bottom: var(--sp-4);
  isolation: isolate;
}
.card .portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 560ms var(--ease-out);
}
.card:hover .portrait img { transform: scale(1.04); }
.card .portrait .glow {
  position: absolute;
  inset: -18%;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 40%, transparent), transparent 58%);
  mix-blend-mode: screen;
  opacity: .5;
  transition: opacity 400ms var(--ease);
  pointer-events: none;
}
.card:hover .portrait .glow { opacity: 1; }

.card h3 {
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -.01em;
}
.card .role {
  color: color-mix(in srgb, var(--c) 60%, white 40%);
  font-size: var(--text-2xs);
  letter-spacing: .06em;
  margin-top: 2px;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.card .tag {
  color: var(--ink-dim);
  font-size: var(--text-sm);
  margin-top: var(--sp-3);
  line-height: 1.5;
}
.card .rank {
  position: absolute;
  top: var(--sp-5); right: var(--sp-5);
  z-index: 3;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: var(--text-2xs);
  font-weight: 700;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: color-mix(in srgb, var(--c) 60%, white 40%);
  background: rgba(6,6,9,.72);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  backdrop-filter: blur(4px);
  transition: color 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease);
}
/* quieter counterpart to the apex badge's own pulse — brightens in step
   with the card's existing hover treatment rather than animating on its
   own, so the apex reads as the more "alive" of the two. */
.card:hover .rank, .card:focus-visible .rank {
  color: color-mix(in srgb, var(--c) 85%, white 15%);
  border-color: color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 0 10px -2px var(--c);
}
.card .shared-flag {
  display: inline-block;
  margin-top: var(--sp-3);
  font-size: var(--text-2xs);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px var(--sp-3);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* placeholder card (no portrait yet) — a deliberate monogram, not a broken image.
   Shared with .persona-card, which is always in this state (no photos yet). */
.card.no-art .portrait, .persona-card .portrait {
  display: grid;
  place-items: center;
  position: relative;
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 8%, transparent) 0 1px, transparent 1px 11px),
    #0a0a0e;
}
.card.no-art .portrait .monogram, .persona-card .portrait .monogram {
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--c) 55%, transparent);
  display: grid;
  place-items: center;
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 700;
  color: color-mix(in srgb, var(--c) 65%, white 35%);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 20%, transparent), transparent 70%);
}
.card.no-art .portrait .label, .persona-card .portrait .label {
  position: absolute;
  bottom: var(--sp-3);
  left: 0; right: 0;
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 9.5px;
  letter-spacing: .12em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* staggered entrance */
.stagger { opacity: 1; transform: none; }
.stagger.will-rise { opacity: 0; transform: translateY(22px); }
.stagger.will-rise.in { animation: fadeUp 820ms var(--ease-out) forwards; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

.roster.swapping .card { animation: swapOut 220ms var(--ease) forwards; }
@keyframes swapOut { to { opacity: 0; transform: translateY(-12px) scale(.985); } }

/* ---------- principles (replaces the numbered-card scaffold) ---------- */
.principles {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
}
.principle {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
}
.principle h3 {
  font-size: var(--text-md);
  font-weight: 650;
}
.principle p {
  color: var(--ink-dim);
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ---------- dashboard proof: real capture of the internal tool, swapped
   per realm in js/app.js (setRealm -> DASHBOARD_GIF lookup). Crossfaded via
   opacity on the <img> itself (a class toggled off/on around the src swap)
   rather than a hard cut, since a GIF restarts its loop from frame 1 on any
   src change. Same --ease-slow token body::before/::after already use for
   their realm crossfade above. */
.dashboard-proof {
  margin: var(--sp-8) 0 0;
  padding: 0;
}
.dashboard-proof img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--a) 35%, var(--line));
  background: var(--bg-panel);
  box-shadow: 0 20px 46px -30px var(--a), var(--shadow);
  transition: opacity 1050ms var(--ease-slow), border-color 400ms var(--ease);
}
.dashboard-proof img.fading {
  opacity: 0;
  transition-duration: 220ms;
}
.dashboard-proof figcaption {
  margin-top: var(--sp-3);
  color: var(--ink-dim);
  font-size: var(--text-sm);
}

/* ---------- detail panel (modal) ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3,3,5,.72);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.panel {
  position: fixed;
  z-index: 61;
  left: 50%; top: 50%;
  translate: -50% -50%;
  width: min(720px, calc(100% - var(--sp-8)));
  max-height: min(86vh, 760px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-raise));
  border: 1px solid color-mix(in srgb, var(--c, var(--a)) 30%, var(--line));
  border-radius: 20px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.95), 0 0 60px -30px var(--c, var(--a));
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.975);
  transition: opacity 260ms var(--ease-out), transform 340ms var(--ease-out);
}
.panel.open { opacity: 1; pointer-events: auto; transform: none; }

.panel-head {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--sp-6);
  padding: var(--sp-7) var(--sp-7) var(--sp-6);
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
}
.panel-portrait {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0a0a0e;
  isolation: isolate;
}
.panel-portrait img { width: 100%; height: 100%; object-fit: cover; }
.panel-portrait .glow {
  position: absolute; inset: -18%;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 46%, transparent), transparent 58%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.panel-portrait .monogram {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 34px;
  font-weight: 700;
  color: color-mix(in srgb, var(--c) 65%, white 35%);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%);
}
.panel-heading h2 { margin-top: 6px; font-size: var(--text-xl); letter-spacing: -.02em; font-weight: 680; }
.panel .role {
  color: color-mix(in srgb, var(--c) 60%, white 40%);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: var(--text-2xs);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.panel .tagline { color: var(--ink-dim); margin-top: var(--sp-2); font-size: var(--text-md); }
.panel-body { padding: var(--sp-7) var(--sp-7) var(--sp-8); }
.panel-body p { margin: 0 0 var(--sp-4); color: var(--ink-dim); max-width: var(--measure); }
.panel-body p:last-of-type { margin-bottom: 0; }
.limit {
  margin-top: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  border-radius: var(--radius-md);
  background-color: color-mix(in srgb, var(--c) 6%, transparent);
}
.limit .meta { color: color-mix(in srgb, var(--c) 65%, white 35%); }
.limit p { margin-top: var(--sp-2); color: var(--ink); font-size: var(--text-sm); }

/* delayed entrance for the panel's most persuasive content — "what it will
   not do" (.limit) and the persona panel's "what it produces" (.produces-
   list). Both start hidden via .reveal-delayed; js/app.js adds .reveal-in
   a beat after the panel itself has opened (paint()-forced-reflow +
   class-toggle, same mechanism as everywhere else in this file — no new
   animation plumbing). A brief tint flash rides along on the way in. */
.reveal-delayed { opacity: 0; transform: translateY(10px); }
/* Two independent keyframe animations, not one combined rule: the reveal
   (opacity/transform — the part that actually has to work) is fully
   decoupled from the background tint pulse (a pure decoration). Comma-
   separated multi-animation is the same proven pattern .materialize already
   uses (rise + wipe) elsewhere in this file. Previously both concerns lived
   in one @keyframes block alongside a base rule that set `background`
   (shorthand) while the keyframes animated `background-color` (longhand) —
   splitting removes that shorthand/longhand pairing entirely so the reveal
   can never be at its mercy. */
.limit.reveal-delayed.reveal-in {
  animation: limitReveal 620ms var(--ease-out) forwards, limitTint 620ms var(--ease-out) forwards;
}
@keyframes limitReveal {
  0%   { opacity: 0; transform: translateY(10px); }
  35%  { opacity: 1; transform: none; }
  100% { opacity: 1; transform: none; }
}
@keyframes limitTint {
  0%   { background-color: color-mix(in srgb, var(--c) 6%, transparent); }
  45%  { background-color: color-mix(in srgb, var(--c) 24%, transparent); }
  100% { background-color: color-mix(in srgb, var(--c) 6%, transparent); }
}
.panel-close {
  position: absolute;
  top: var(--sp-4); right: var(--sp-4);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(8,8,12,.7);
  color: var(--ink-dim);
  cursor: pointer;
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.5);
  transition: transform 120ms var(--ease-out), box-shadow 160ms var(--ease-out), color 200ms var(--ease), border-color 200ms var(--ease);
}
.panel-close:hover { color: var(--ink); border-color: color-mix(in srgb, var(--c) 50%, var(--line)); }
.panel-close:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.55);
  transition-duration: 40ms;
}

/* ---------- personas ---------- */
/* section itself: visibility follows active realm (js/app.js), fades rather
   than blinking. [hidden] short-circuits the transition on load/realm-swap
   completion — see updatePersonaVisibility(). */
#personas {
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
#personas:not(.persona-visible) { opacity: 0; transform: translateY(10px); }
#personas.persona-visible { opacity: 1; transform: none; }
#rule-personas { transition: opacity 320ms var(--ease); }

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  max-width: 620px;
}
.persona-card {
  --c: var(--a); /* no per-persona accent yet — ride the realm accent, same as .card's fallback */
  appearance: none;
  text-align: left;
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-raise));
  cursor: pointer;
  transition:
    transform 260ms var(--ease-out),
    border-color 260ms var(--ease),
    box-shadow 260ms var(--ease);
}
.persona-card:hover, .persona-card:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  box-shadow: 0 20px 46px -26px var(--c), var(--shadow);
}
.persona-card:active { transform: translateY(0); transition-duration: 60ms; }
.persona-card h3 { font-size: var(--text-lg); font-weight: 650; }
.persona-card p { margin-top: var(--sp-2); color: var(--ink-dim); font-size: var(--text-sm); }

/* produces list — reuses the panel's own type/spacing, not a new visual system */
.produces-list {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-1) 0;
  border-radius: var(--radius-sm);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
/* same split as .limit above — reveal (opacity/transform) and tint
   (background-color) as two independent keyframe animations, not one
   combined rule. */
.produces-list.reveal-delayed.reveal-in {
  animation: producesReveal 620ms var(--ease-out) forwards, producesTint 620ms var(--ease-out) forwards;
}
@keyframes producesReveal {
  0%   { opacity: 0; transform: translateY(10px); }
  35%  { opacity: 1; transform: none; }
  100% { opacity: 1; transform: none; }
}
@keyframes producesTint {
  0%   { background-color: transparent; }
  45%  { background-color: color-mix(in srgb, var(--c) 14%, transparent); }
  100% { background-color: transparent; }
}
.produces-list li {
  position: relative;
  padding-left: var(--sp-5);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.produces-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .6em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c, var(--a));
}

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--line-soft);
  padding: var(--sp-7) 0 var(--sp-9);
}
.site-foot .wrap { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .orgchart { padding-top: clamp(28px, 8vw, 48px); }
  .apex-card { margin-bottom: var(--sp-8); padding: var(--sp-7) var(--sp-6) var(--sp-7); }
  .site-head .wrap { grid-template-columns: 1fr; justify-items: center; row-gap: var(--sp-2); height: auto; padding-block: var(--sp-3); }
  .head-reserved { display: none; }
  .brand { order: 1; }
  .head-actions { order: 2; justify-self: center; }
  .principles { grid-template-columns: 1fr; gap: var(--sp-6); }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - var(--sp-6)); }
  .roster { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
  .card { padding: var(--sp-4) var(--sp-4) var(--sp-5); }
  .card .rank { top: var(--sp-4); right: var(--sp-4); }
  .panel-head { grid-template-columns: 84px 1fr; gap: var(--sp-4); padding: var(--sp-6) var(--sp-5) var(--sp-5); }
  .panel-body { padding: var(--sp-5); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .rise, .stagger, .materialize, .reveal-delayed { opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
  .apex-card::before, .apex-card .rank { animation: none !important; }
  .apex-card::after { display: none !important; } /* cursor light: JS never wires the listener under reduced motion, this just belts-and-braces it */
  .fan-line.flowing { animation: none !important; }
  .fan-lines.fan-flicker { animation: none !important; }
}
