/* wgf-realm-header.css — Module M09: Realm / connected-realm identity header.
   Crest + identity block + faction balance bar + market line + stat strip.
   Mirrors the M08 character-header archetype — same card shell, accent bar, and
   stat-strip pattern.  Colours/type from _tokens.css only; no :root{} block here. */

/* ── Card shell — kit re-cut 2026-07-04: the realm identity header wears the
   in-game tooltip plate (near-black blue-tinted, thin light border, squared). ── */
.rh {
  background: linear-gradient(180deg, rgba(12, 12, 30, 0.97), rgba(5, 5, 16, 0.97));
  border: 1px solid #7a7a96;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  position: relative;
}

/* Thin gold accent bar — realm name is never quality-colored, so the accent
   uses the single brand gold token, not a per-class color. */
.rh::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--wgf-gold-accent);
}

/* ── Inner layout: crest | identity block ─────────────────────────────── */
.rh__body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
}

/* ── Crest cell (first-party SVG sigil — no external CDN) ─────────────── */
.rh__crest-wrap {
  flex: 0 0 auto;
  position: relative;
  width: 96px;
  height: 96px;
}
.rh__crest {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-card);
  border: 2px solid var(--wgf-border-neutral);
  background: var(--wgf-panel-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rh__crest svg {
  width: 54px;
  height: 54px;
  opacity: .85;
  color: var(--wgf-gold-muted);
}

/* Region pip (small badge bottom-right of crest) */
.rh__region-pip {
  position: absolute;
  bottom: -4px;
  right: -4px;
  min-width: 26px;
  height: 22px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  border: 2px solid var(--wgf-panel-1);
  background: var(--wgf-panel-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--wgf-gold-muted);
  line-height: 1;
}

/* ── Identity block (right of crest) ──────────────────────────────────── */
.rh__identity {
  flex: 1 1 auto;
  min-width: 0;
}
.rh__name-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
}
/* Realm name — Cinzel, brand-neutral.  NOT quality-colored. */
.rh__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--wgf-text);
  margin: 0;
  line-height: 1.2;
}
/* Group-page variant: slightly smaller so the longer name fits */
.rh__name--group {
  font-size: var(--text-lg);
}

/* Meta chip row: taxonomy + state (Region · Type · Timezone). No quality/market
   colors.  <ul> reset so list dots never leak into the layout. */
.rh__chips {
  list-style: none;
  margin: var(--space-1) 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rh__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--wgf-muted);
  background: var(--wgf-panel-2);
  border: 1px solid var(--wgf-border-neutral);
  border-radius: var(--radius-pill);
  padding: 2px var(--space-3);
  line-height: 1.5;
}
.rh__chip strong {
  color: var(--wgf-text);
  font-weight: 600;
}
.rh__chip .rh__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
}

/* ── Connected-realm group: the key realm fact ──────────────────────────
   The sibling realms that share ONE Auction House.  Always state this. */
.rh__connected {
  border: 1px solid var(--wgf-border-neutral);
  border-radius: var(--radius-card);
  background: var(--wgf-panel-2);
  padding: var(--space-3);
  margin: 0 0 var(--space-3);
}
.rh__connected-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-2);
}
.rh__connected-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wgf-gold-muted);
  margin: 0;
}
.rh__connected-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--wgf-muted);
}
.rh__connected-note {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--wgf-muted);
  font-style: italic;
  margin: 0 0 var(--space-2);
}
.rh__sibling-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-1);
}
.rh__sibling {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}
.rh__sibling a {
  color: var(--wgf-link);
  border-bottom: 1px solid transparent;
}
.rh__sibling a:hover { border-bottom-color: var(--wgf-gold-bright); }
.rh__sibling--self {
  color: var(--wgf-text);
  font-weight: 600;
}
.rh__sibling-sep {
  color: var(--wgf-border-neutral);
  margin: 0 .15em;
}

/* ── Faction balance bar ────────────────────────────────────────────────
   Alliance vs Horde share — METADATA (identity colors --fc-*), NOT market
   direction.  Deliberately never touches --wgf-up/--wgf-down. */
.rh__faction {
  margin: 0;
}
.rh__faction-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
}
.rh__faction-side {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-ui);
  color: var(--wgf-muted);
}
.rh__faction-side strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--wgf-text);
  font-weight: 500;
}
.rh__faction-side--ally::before {
  content: '';
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--fc-alliance);
  display: inline-block;
}
.rh__faction-side--horde::before {
  content: '';
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--fc-horde);
  display: inline-block;
}
.rh__faction-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--wgf-panel-3);
  border: 1px solid var(--wgf-border-neutral);
}
.rh__faction-fill--ally  { background: var(--fc-alliance); }
.rh__faction-fill--horde { background: var(--fc-horde); }

/* ── Latest verified AH data point + freshness ──────────────────────── */
.rh__market {
  border-top: 1px solid var(--wgf-border-neutral);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}
.rh__market-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rh__market-key {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--wgf-muted);
}
.rh__market-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-md);
  color: var(--wgf-text);
}
.rh__market-spacer {
  flex: 1 1 auto;
  min-width: var(--space-3);
}

/* ── Stat strip (M53 stacked-block pattern, identical to M08 rating strip) */
.rh__stat-strip {
  border-top: 1px solid var(--wgf-border-neutral);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.rh__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--wgf-border-neutral);
  gap: var(--space-1);
}
.rh__stat:last-child { border-right: none; }
.rh__stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--wgf-text);
  line-height: 1;
}
.rh__stat-value--word {
  font-family: var(--font-ui);
  font-size: var(--text-md);
}
.rh__stat-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--wgf-muted);
  white-space: nowrap;
}

/* ── No-data variant ─────────────────────────────────────────────────── */
.rh--nodata .rh__market {
  color: var(--wgf-muted);
}

/* ── Loading skeleton ─────────────────────────────────────────────────── */
.rh--loading { pointer-events: none; }
.rh--loading::before {
  background: var(--wgf-panel-3);
  animation: rh-sk-pulse 1.4s ease-in-out infinite alternate;
}
@keyframes rh-sk-pulse { from { opacity: .35 } to { opacity: .8 } }
@media (prefers-reduced-motion: reduce) {
  .rh--loading::before { animation: none; opacity: .5; }
}

.rh-sk-crest  { width: 96px; height: 96px; border-radius: var(--radius-card); flex: 0 0 auto;
                 background: var(--wgf-panel-3); animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }
.rh-sk-name   { height: 1.5em; width: 46%; margin-bottom: var(--space-2);
                 background: var(--wgf-panel-3); border-radius: var(--radius-control);
                 animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }
.rh-sk-chips  { height: 1.6em; width: 74%; margin-bottom: var(--space-2);
                 background: var(--wgf-panel-3); border-radius: var(--radius-control);
                 animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }
.rh-sk-conn   { height: 3.4em; width: 100%;
                 background: var(--wgf-panel-3); border-radius: var(--radius-control);
                 animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }
.rh-sk-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--wgf-border-neutral);
  gap: var(--space-2);
}
.rh-sk-stat:last-child { border-right: none; }
.rh-sk-val { height: 1.25em; width: 4ch;
              background: var(--wgf-panel-3); border-radius: var(--radius-control);
              animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }
.rh-sk-lbl { height: .7em; width: 6ch;
              background: var(--wgf-panel-3); border-radius: var(--radius-control);
              animation: rh-sk-pulse 1.4s ease-in-out infinite alternate; }

/* ── ROW IDENTITY variant — compact chip for directories / sibling lists ─
   The split Alliance|Horde icon's blue/red WIDTHS encode the faction balance:
   50/50 = centered, 64/36 = blue-weighted, etc.  Identity colors only.      */
.rh-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--wgf-panel-2);
  border: 1px solid var(--wgf-border-neutral);
  border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-3);
  max-width: 420px;
  overflow: hidden;
  text-decoration: none;
  transition: border-color var(--motion-fast) var(--ease-standard),
              background   var(--motion-fast) var(--ease-standard);
}
.rh-row:hover {
  border-color: var(--wgf-border);
  background: var(--wgf-panel-3);
}
.rh-row__name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--wgf-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.rh-row__region {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--wgf-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}
/* Faction-balance icon: split width IS the balance fraction */
.rh-row__faction {
  flex: 0 0 auto;
  display: flex;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-control);
  overflow: hidden;
  border: 1px solid var(--wgf-border-neutral);
}
.rh-row__fc {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}
.rh-row__fc svg { width: 13px; height: 13px; flex: 0 0 auto; color: #fff; opacity: .9; }
.rh-row__fc--ally  { background: var(--fc-alliance); }
.rh-row__fc--horde { background: var(--fc-horde); }

/* ── Inline number token: any quantity/stat in running text ────────────── */
.rh__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Crest sigil fill (inline SVG paths in .rh__crest) ─────────────────── */
.realm-sigil { fill: currentColor; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .rh__body { flex-direction: column; }
  .rh__stat-strip { grid-template-columns: repeat(2, 1fr); }
  .rh__stat:nth-child(2n) { border-right: none; }
  .rh__market { gap: var(--space-3); }
  .rh__market-spacer { display: none; }
}

/* ── Respect reduced-motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rh-row { transition: none; }
}

/* =============================================================================
   KIT RE-CUT 2026-07-04 (docs/ui-ux/13-ingame-reference sec 0.4/0.9/1) — the
   /realm/<slug>/deals/ and /realm/ surfaces adopt the in-game chrome. This sheet
   loads in <body> (after the shared SEO base in <head>), so these equal-specificity
   rules win by order. Bans honoured: no rounded pills, no fill bars, game fonts.
   ============================================================================= */

/* The deal candidates table sits in the near-black inset content well (ig-63/64). */
.rd-table-wrap {
  padding: var(--space-2);
  border: 1px solid var(--wgf-well-edge);
  border-radius: 4px;
  background: var(--wgf-well);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
/* Column headers = gold small-caps game-font colhead. */
.rd-deals-table thead th {
  font-family: var(--font-game);
  font-variant: small-caps;
  text-transform: none;
  letter-spacing: 0.04em;
  color: var(--wgf-gold-muted, #c8b888);
  text-shadow: var(--text-ink-outline);
}

/* Filter bar = squared plate; its selects/inputs = the kit inset field look. */
.rd-filterbar {
  border-radius: 4px;
  border: 1px solid var(--wgf-metal);
  background: linear-gradient(180deg, rgba(12, 12, 30, 0.6), rgba(5, 5, 16, 0.85));
}
.rd-field-label { font-family: var(--font-game); font-variant: small-caps; letter-spacing: 0.03em; }
.rd-input {
  border-radius: 4px;
  border: 1px solid var(--wgf-metal);
  background: var(--wgf-well);
  color: var(--wgf-text);
  font-family: var(--font-ui);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}
.rd-reset-btn {
  border-radius: 4px;
  border: 1px solid var(--wgf-metal);
  font-family: var(--font-game);
  font-variant: small-caps;
}

/* Deal-type + score chips = ONE squared idiom, never a rounded pill. */
.wgf-deal-badge, .wgf-score-badge {
  border-radius: 3px;
  font-family: var(--font-game);
}

/* Realm index cards = the tooltip plate; realm name in the game display face. */
.rd-feat-card, .rd-dir-card {
  border: 1px solid #7a7a96;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(12, 12, 30, 0.97), rgba(5, 5, 16, 0.97));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}
.rd-feat-card:hover, .rd-dir-card:hover {
  border-color: #9a9ab5;
  background: linear-gradient(180deg, rgba(22, 22, 44, 0.97), rgba(8, 8, 22, 0.97));
}
.rd-feat-card__name, .rd-dir-card__name {
  font-family: var(--font-game-display);
  font-variant: small-caps;
  text-shadow: var(--text-ink-outline);
}
/* Region marker = squared well chip (de-pilled); region filter = kit tabs. */
.rd-region-pill {
  border-radius: 3px;
  font-family: var(--font-game);
  font-variant: small-caps;
  text-transform: none;
}
.rd-region-btn {
  border-radius: 4px;
  border: 1px solid var(--wgf-metal-soft);
  background: linear-gradient(180deg, var(--wgf-panel-2), #14110c);
  color: var(--wgf-gold-muted, #c8b888);
  font-family: var(--font-game);
  font-variant: small-caps;
}
.rd-region-btn.is-active { border-color: var(--wgf-gold); color: var(--wgf-on-gold); background: var(--wgf-gold); }

/* The find-your-realm search field = the kit inset well. */
.rd-find__box, .rd-find__input {
  border-radius: 4px;
}
.rd-find__input {
  background: var(--wgf-well);
  border: 1px solid var(--wgf-metal);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}
/* Hero stat strips read as squared well chips, not rounded panels. */
.rd-statstrip li { border-radius: 4px; }
