/* ============================================================
   Return of the Ancients — Patch 0.5.0 Codex
   An arcane-codex aesthetic: obsidian, gilt, vellum, blood-red,
   verdant emerald. Gothic display type over a serif body.
   ============================================================ */

:root {
  /* Dominant colours */
  --obsidian:        #0a0807;
  --obsidian-deep:   #050403;
  --vellum:          #d9c89a;
  --vellum-dim:      #a89570;
  --gilt:            #c9a567;
  --gilt-bright:     #e6c685;
  --gilt-dark:       #826b3d;
  --crimson:         #b13b3b;
  --crimson-deep:    #7a1f1f;
  --crimson-glow:    rgba(177, 59, 59, 0.35);
  --emerald:         #6fae6a;
  --emerald-deep:    #2f6630;
  --emerald-glow:    rgba(111, 174, 106, 0.32);
  --amber:           #c98b3f;
  --ink:             #1a1310;
  --ink-soft:        #2a201b;
  --rule:            rgba(201, 165, 103, 0.22);
  --rule-strong:     rgba(201, 165, 103, 0.5);

  /* Typography */
  --font-display:    "Cinzel", "Cormorant Garamond", serif;
  --font-headline:   "Spectral", "Cormorant Garamond", "Garamond", serif;
  --font-body:       "Lora", Georgia, "Times New Roman", serif;
  --font-mono:       "JetBrains Mono", "Consolas", monospace;
}

/* ---------- reset & shell ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--vellum);
  background:
    radial-gradient(ellipse at 18% 4%, rgba(180, 100, 40, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 92% 14%, rgba(110, 60, 20, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 110%, rgba(60, 30, 10, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--obsidian-deep) 0%, var(--obsidian) 60%, #0b0807 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grain overlay across the entire page */
.parchment-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.85 0 0 0 0 0.7 0 0 0 0 0.5 0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a {
  color: var(--gilt);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 200ms ease, border-color 200ms ease;
}
a:hover {
  color: var(--gilt-bright);
  border-bottom-color: var(--gilt-bright);
}

/* ---------- top navigation ---------- */
.codex-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  background: linear-gradient(180deg, rgba(10,8,7,0.97), rgba(10,8,7,0.88));
  border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
}
.nav-mark {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gilt);
  letter-spacing: 0.04em;
}
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  flex: 1;
}
.nav-links a {
  display: inline-block;
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 12.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  border: none;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover {
  color: var(--gilt-bright);
  border-bottom-color: var(--gilt);
}

/* Hamburger toggle — desktop hides it, mobile media query exposes it. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 32px;
  padding: 0 6px;
  background: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
  margin-left: auto;
  border-radius: 2px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--gilt);
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}
.codex-nav.is-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.codex-nav.is-open .nav-toggle span:nth-child(2) { opacity: 0; }
.codex-nav.is-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
/* ---------- HERO ---------- */
.hero {
  position: relative;
  z-index: 2;
  padding: 120px 24px 80px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
/* Scroll-down indicator below the countdown — only on phones.
   Pure-CSS chevron made from two borders. Blinks via opacity. */
.hero-scroll {
  display: none;
  width: 22px;
  height: 22px;
  border-right: 2px solid var(--gilt);
  border-bottom: 2px solid var(--gilt);
  border-bottom-right-radius: 2px;
  margin: 32px auto 0;
  transform: rotate(45deg);
  animation: hero-scroll-blink 1.4s ease-in-out infinite;
}
.hero-scroll:hover { border-color: var(--gilt-bright); }
@keyframes hero-scroll-blink {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

/* The actual key-art background. Lives on its own layer so a mask can fade
   ONLY the image at the bottom — the hero content (countdown, stats) stays
   at full opacity above it. */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(ellipse at 50% 55%, rgba(10,7,5,0.35) 0%, rgba(10,7,5,0.72) 80%),
    linear-gradient(180deg, rgba(10,7,5,0.55) 0%, rgba(10,7,5,0.5) 50%, rgba(10,7,5,0.5) 100%),
    radial-gradient(ellipse at 50% 0%, rgba(201,165,103,0.10) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(177,59,59,0.07) 0%, transparent 70%),
    url("images/presskit-web/Key-Art-No-Logo.jpg");
  background-position: 0 0, 0 0, 0 0, 0 0, center;
  background-size: auto, auto, auto, auto, cover;
  background-repeat: no-repeat;
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  pointer-events: none;
}
.hero-frame { z-index: 1; }
.hero::before, .hero::after {
  content: "";
  position: absolute;
  left: 50%;
  width: min(80vw, 880px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt) 50%, transparent);
  transform: translateX(-50%);
  opacity: 0.5;
}
.hero::before { top: 84px; }
.hero::after { bottom: 56px; }

.hero-frame {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}
.hero-version {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.5em;
  color: var(--gilt);
  margin-bottom: 18px;
  animation: hero-fade 1.2s ease both;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 8.5vw, 124px);
  line-height: 0.95;
  margin: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.hero-line-1 {
  display: block;
  color: var(--vellum);
  font-weight: 500;
  font-size: 0.45em;
  letter-spacing: 0.4em;
  margin-bottom: 0.4em;
  opacity: 0;
  animation: hero-fade 1.4s ease 0.2s both;
  text-shadow:
    0 0 18px rgba(201, 165, 103, 0.45),
    0 0 38px rgba(201, 165, 103, 0.2);
}
.hero-line-2 {
  display: block;
  background: linear-gradient(180deg, var(--gilt-bright) 0%, var(--gilt) 45%, var(--gilt-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(201, 165, 103, 0.55))
          drop-shadow(0 0 52px rgba(201, 165, 103, 0.3));
  opacity: 0;
  animation: hero-fade 1.4s ease 0.4s both;
}
.hero-subtitle {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 24px;
  color: var(--vellum);
  margin-top: 22px;
  opacity: 0;
  animation: hero-fade 1.4s ease 0.6s both;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}
.hero-meta {
  margin-top: 18px;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vellum);
  opacity: 0;
  animation: hero-fade 1.4s ease 0.8s both;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.hero-meta .hero-sep { color: var(--gilt-dark); }
.hero-source { border-bottom: 1px solid var(--gilt); }

.hero-countdown {
  margin: 36px auto 6px;
  max-width: 720px;
  padding: 22px 28px;
  border: 1px solid var(--gilt-dark);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 165, 103, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(28, 20, 16, 0.85), rgba(15, 11, 8, 0.65));
  position: relative;
  opacity: 0;
  animation: hero-fade 1.4s ease 0.95s both;
}
.hero-countdown::before,
.hero-countdown::after {
  content: "";
  position: absolute;
  top: -1px; bottom: -1px;
  width: 14px;
  border: 1px solid var(--gilt);
}
.hero-countdown::before { left: -1px;  border-right: none; }
.hero-countdown::after  { right: -1px; border-left: none; }
.hero-countdown-label {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gilt);
  text-align: center;
  margin-bottom: 14px;
}
.hero-countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}
.hero-countdown-cell { padding: 6px 0; position: relative; }
.hero-countdown-cell + .hero-countdown-cell::before {
  content: ":";
  position: absolute;
  left: -8px; top: 16px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--gilt-dark);
}
.hero-countdown-num {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  color: var(--gilt-bright);
  line-height: 1;
  display: block;
  font-variant-numeric: tabular-nums;
}
.hero-countdown-unit {
  display: block;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vellum-dim);
}
.hero-countdown.live .hero-countdown-num,
.hero-countdown.live .hero-countdown-unit { color: #b6dab1; }
.hero-countdown-live {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b6dab1;
  text-align: center;
  text-shadow: 0 0 22px rgba(122, 209, 122, 0.5);
}
.hero-countdown-since {
  text-align: center;
  margin-top: 6px;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 15px;
  color: var(--vellum-dim);
}

.hero-stats {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  animation: hero-fade 1.4s ease 1.1s both;
}
.hero-stat { flex: 0 0 152px; }
.hero-stat {
  position: relative;
  padding: 16px 12px 14px;
  border: 1px solid var(--rule);
  background: rgba(20, 14, 10, 0.6);
}
.hero-stat::before, .hero-stat::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--gilt);
}
.hero-stat::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.hero-stat::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--gilt-bright);
  line-height: 1;
  display: block;
}
.hero-stat-label {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--vellum-dim);
}

@keyframes hero-fade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}



/* ---------- main ---------- */
.codex-main {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 120px;
}

/* ---------- legend ---------- */
.legend-section { margin-bottom: 56px; }
.legend-card {
  position: relative;
  padding: 28px 32px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.7));
  border: 1px solid var(--rule);
}
.legend-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--rule);
  pointer-events: none;
}
.legend-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gilt);
  margin: 0 0 18px;
}
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.legend-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-desc {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--vellum-dim);
}
.legend-desc em { color: var(--vellum); font-style: italic; }
.legend-note {
  margin: 22px 0 0;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 18px;
  color: var(--vellum-dim);
}

/* ---------- section ---------- */
.codex-section {
  margin-top: 96px;
  scroll-margin-top: 72px;
}
.section-header {
  margin-bottom: 32px;
  text-align: center;
  position: relative;
}
.section-header::before, .section-header::after {
  content: "";
  position: absolute;
  top: 38px;
  width: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt-dark));
}
.section-header::before { left: 8%; }
.section-header::after  { right: 8%; transform: scaleX(-1); }

.section-sigil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px; height: 54px;
  border: 1px solid var(--gilt);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gilt-bright);
  margin-bottom: 14px;
  background: radial-gradient(circle at 50% 30%, rgba(201, 165, 103, 0.18), transparent);
  box-shadow: inset 0 0 14px rgba(201, 165, 103, 0.12), 0 0 24px rgba(201, 165, 103, 0.05);
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0;
  font-weight: 700;
}
.section-subtitle {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 24px;
  color: var(--vellum-dim);
  max-width: 720px;
  margin: 12px auto 0;
}

/* ---------- generic chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 2px;
  border: 1px solid;
  white-space: nowrap;
}
.chip .arr { font-size: 11px; line-height: 1; }
.chip-buff {
  color: #b6dab1;
  border-color: var(--emerald-deep);
  background: linear-gradient(180deg, rgba(47, 102, 48, 0.35), rgba(20, 50, 22, 0.55));
  box-shadow: inset 0 0 0 1px rgba(111,174,106,0.18), 0 0 12px var(--emerald-glow);
}
.chip-nerf {
  color: #efb1b1;
  border-color: var(--crimson-deep);
  background: linear-gradient(180deg, rgba(122, 31, 31, 0.45), rgba(60, 14, 14, 0.55));
  box-shadow: inset 0 0 0 1px rgba(177,59,59,0.18), 0 0 12px var(--crimson-glow);
}
.chip-neutral {
  color: #e6cf9c;
  border-color: var(--gilt-dark);
  background: linear-gradient(180deg, rgba(130, 107, 61, 0.3), rgba(50, 40, 22, 0.45));
}
.chip-flag {
  color: #f3d28a;
  border-color: var(--amber);
  background: rgba(201, 139, 63, 0.18);
}
.chip-mag {
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  padding: 2px 8px;
  color: var(--vellum-dim);
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
}

/* ---------- content pillars ---------- */
.content-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 980px) { .content-pillars { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .content-pillars { grid-template-columns: 1fr; } }
.pillar {
  position: relative;
  padding: 26px 26px 20px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.85));
  border: 1px solid var(--rule);
}
.pillar::before, .pillar::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt);
  pointer-events: none;
}
.pillar::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.pillar::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.pillar.has-img { padding-top: 0; }
.pillar-img {
  margin: 0 -26px -14px;
  height: 160px;
  position: relative;
}
.pillar-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
}
.pillar h3 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 10px;
}
.pillar p {
  margin: 0;
  font-family: var(--font-body);
  color: var(--vellum-dim);
}
.pillar .pillar-tag {
  display: inline-block;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--vellum-dim);
}

/* ---------- league grid ---------- */
.league-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
}
.league-card {
  position: relative;
  padding: 26px 26px 20px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.85));
  border: 1px solid var(--rule);
}
.league-card::before, .league-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt);
  pointer-events: none;
}
.league-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.league-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.league-card.new::before, .league-card.new::after,
.league-card.featured::before, .league-card.featured::after {
  border-color: var(--gilt-bright);
}
.league-card.featured { grid-column: 1 / -1; }
.league-card.has-img { padding-top: 0; }
.league-img {
  margin: 0 -26px -18px;
  height: 200px;
  position: relative;
  pointer-events: none;
}
.league-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%);
}

/* Featured (Runes of Aldur): full-row stacked layout — taller banner image
   on top, bullets fanned into 2 columns under it for the wide canvas. */
.league-card.featured .league-img { height: 360px; }
.league-card.featured .league-img img { object-position: center 30%; }
.league-card.featured .league-name {
  font-size: 30px;
  letter-spacing: 0.1em;
  margin-top: 6px;
}
.league-card.featured .league-hub { font-size: 18px; margin-bottom: 20px; }
.league-card.featured ul {
  display: block;
  column-count: 2;
  column-gap: 32px;
}
.league-card.featured li {
  break-inside: avoid;
  margin-bottom: 8px;
}
.league-card.featured li:last-child { margin-bottom: 0; }
@media (max-width: 780px) {
  .league-card.featured .league-img { height: 220px; }
  .league-card.featured ul { column-count: 1; }
}

.league-new-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  padding: 3px 10px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #b6dab1;
  background: linear-gradient(180deg, rgba(47, 102, 48, 0.65), rgba(20, 50, 22, 0.8));
  border: 1px solid var(--emerald-deep);
  box-shadow: 0 0 8px var(--emerald-glow);
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}
.league-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.league-tag {
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gilt);
  min-width: 0;
}
a.league-tag {
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}
.league-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0;
}
.league-hub {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 19px;
  color: var(--gilt-bright);
  margin-bottom: 16px;
}
.league-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.league-card li {
  position: relative;
  padding-left: 18px;
  font-size: 16px;
  color: var(--vellum);
}
.league-card li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 3px;
  font-size: 11px;
  color: var(--gilt);
}

/* ---------- ascendancy ---------- */
.ascendancy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
}
.asc-card {
  padding: 22px 24px 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(201,165,103,0.18) 0%, transparent 50%),
    linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.85));
  border: 1px solid var(--rule);
  position: relative;
}
.asc-card::before, .asc-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt);
  pointer-events: none;
}
.asc-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.asc-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.asc-card.new {
  background: linear-gradient(135deg, rgba(47, 102, 48, 0.18), rgba(20, 14, 10, 0.8));
}
.asc-card.has-splash { overflow: hidden; }
.asc-splash {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.asc-splash img {
  position: absolute;
  top: 0; right: -8%;
  height: 100%;
  width: auto;
  object-fit: cover;
  opacity: 0.55;
  filter: saturate(0.85);
  mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%, #000 100%);
}
.asc-card.has-splash .asc-header,
.asc-card.has-splash .asc-changes { position: relative; z-index: 1; }
.asc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.asc-mark {
  width: 56px; height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--obsidian);
  background: linear-gradient(135deg, var(--gilt-bright), var(--gilt-dark));
  border-radius: 4px;
  flex-shrink: 0;
  overflow: hidden;
}
.asc-mark-img {
  background:
    radial-gradient(circle at 50% 30%, rgba(201, 165, 103, 0.32), transparent 70%),
    var(--obsidian-deep);
  border: 1px solid var(--gilt-dark);
  padding: 0;
}
.asc-mark-img img {
  width: 100%; height: 100%; object-fit: cover;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.6));
}
.asc-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0;
}
.asc-class {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--vellum);
  font-size: 19px;
}
.asc-new-tag {
  margin-left: auto;
  padding: 2px 8px;
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #b6dab1;
  background: linear-gradient(180deg, rgba(47, 102, 48, 0.55), rgba(20, 50, 22, 0.7));
  border: 1px solid var(--emerald-deep);
  box-shadow: 0 0 6px var(--emerald-glow);
  border-radius: 2px;
}
.asc-changes { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }

/* Wide ascendancy card (5+ changes — e.g. Chronomancer) spans the full grid
   and fans its changes into multiple columns. */
.asc-card-wide { grid-column: 1 / -1; }
.asc-card-wide .asc-changes {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px 22px;
}

/* Blood Mage + Witchhunter share a single grid column slot, stacked vertically.
   Second child (Witchhunter) expands to fill any remaining height. */
.asc-pair {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  gap: 22px;
}
.asc-change {
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--rule);
}
.asc-change:last-child { border-bottom: none; }
.asc-change-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.asc-change-name {
  font-family: var(--font-headline);
  font-weight: 600;
  color: var(--gilt-bright);
  flex: 1;
  min-width: 0;
}
.asc-change-desc {
  font-size: 16px;
  color: var(--vellum-dim);
  margin-top: 2px;
}
/* Small qualitative tag (new / moved / reworked / removed) shown after the change name. */
.asc-badge {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.85;
}
.asc-badge.buff   { color: #7ad17a; }
.asc-badge.nerf   { color: #e26666; }
.asc-badge.rework { color: var(--gilt-bright); }

/* Unique cards: optional inventory icon on the left, width-capped, free height. */
.unique-card.has-img {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
}
.unique-img {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}
.unique-img img {
  width: 56px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}
.unique-card.has-img .unique-body { min-width: 0; }
.unique-card.has-img .unique-name { margin-top: 0; }

/* ---------- skills ---------- */
.skills-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: rgba(18, 13, 10, 0.6);
  border: 1px solid var(--rule);
}
.codex-search {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--obsidian-deep);
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--vellum);
  border-radius: 2px;
}
.codex-search:focus { outline: none; border-color: var(--gilt); }
.sort-group {
  display: flex;
  gap: 4px;
  align-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vellum-dim);
}
.sort-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  cursor: pointer;
  border-radius: 2px;
}
.sort-btn:hover { color: var(--vellum); border-color: var(--gilt-dark); }
.sort-btn.active { color: var(--obsidian); background: var(--gilt); border-color: var(--gilt); }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.skill-card {
  position: relative;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(15, 11, 8, 0.85));
  border: 1px solid var(--rule);
  padding: 16px 18px 14px;
  cursor: pointer;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.skill-card:hover {
  border-color: var(--gilt);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.skill-card.has-buff { border-left: 3px solid var(--emerald); }
.skill-card.has-nerf { border-left: 3px solid var(--crimson); }
.skill-card.has-mixed { border-left: 3px solid var(--amber); }
.skill-card.has-neutral { border-left: 3px solid var(--gilt-dark); }

.skill-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.skill-icon {
  width: 48px; height: 48px;
  flex-shrink: 0;
  border: 1px solid var(--rule);
  background:
    radial-gradient(circle at 50% 30%, rgba(201, 165, 103, 0.18), transparent),
    var(--obsidian-deep);
  display: grid;
  place-items: center;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.skill-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.5));
}
.skill-icon .icon-fallback {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gilt);
}
.skill-info { flex: 1; min-width: 0; }
.skill-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--vellum);
  margin: 0;
  text-transform: uppercase;
}
.skill-tag {
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 20px;
  color: var(--vellum);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.skill-card { padding-bottom: 28px; }
.skill-card .skill-expand-hint {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--vellum-dim);
  text-transform: uppercase;
  text-align: right;
  opacity: 0.7;
}
.skill-card:hover .skill-expand-hint { opacity: 1; color: var(--gilt); border-top-color: var(--gilt-dark); }

/* Support gem icons are circular orbs in PoE — match that shape so they read as supports. */
.support-icon, .support-icon img {
  border-radius: 50%;
}
.support-icon {
  background:
    radial-gradient(circle at 50% 35%, rgba(201, 165, 103, 0.24), transparent 70%),
    radial-gradient(circle at 50% 100%, rgba(0,0,0,0.5), transparent 60%),
    var(--obsidian-deep);
  box-shadow: inset 0 0 0 1px rgba(201, 165, 103, 0.22);
  border-color: transparent;
}

/* ---------- supports ---------- */
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 980px) { .support-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .support-grid { grid-template-columns: 1fr; } }
.support-card {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(15, 11, 8, 0.85));
  border: 1px solid var(--rule);
  border-left-width: 3px;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.support-card:hover {
  border-color: var(--gilt);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.support-card.has-buff { border-left-color: var(--emerald); }
.support-card.has-nerf { border-left-color: var(--crimson); }
.support-card.has-mixed { border-left-color: var(--amber); }
.support-card.has-neutral { border-left-color: var(--gilt-dark); }
.support-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 8px;
}
.support-card p {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--vellum-dim);
}
.support-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- passives ---------- */
.passive-callouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.passive-callout {
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(122, 31, 31, 0.18), rgba(20, 14, 10, 0.8));
  border: 1px solid var(--rule);
  border-left: 3px solid var(--crimson);
}
.passive-callout.buff {
  background: linear-gradient(135deg, rgba(47, 102, 48, 0.18), rgba(20, 14, 10, 0.8));
  border-left-color: var(--emerald);
}
.passive-callout.neutral {
  background: linear-gradient(135deg, rgba(201, 165, 103, 0.12), rgba(20, 14, 10, 0.8));
  border-left-color: var(--gilt);
}
.callout-tag {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  margin-bottom: 6px;
}
.callout-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 6px;
}
.callout-body { font-size: 16px; color: var(--vellum-dim); margin: 0; }

.passive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.passive-card {
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(15, 11, 8, 0.85));
  border: 1px solid var(--rule);
  border-left-width: 3px;
}
.passive-card.has-buff { border-left-color: var(--emerald); }
.passive-card.has-nerf { border-left-color: var(--crimson); }
.passive-card.has-neutral { border-left-color: var(--gilt-dark); }
.passive-card.has-mixed { border-left-color: var(--amber); }
.passive-name {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 6px;
}
.passive-desc { font-size: 16px; color: var(--vellum-dim); margin: 0 0 8px; }
.passive-chips { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- uniques ---------- */
/* Tabs: segmented control inside a gilt-cornered frame. */
.uniques-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  padding: 5px;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 165, 103, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, rgba(28, 20, 16, 0.85), rgba(15, 11, 8, 0.85));
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.uniques-tabs::before, .uniques-tabs::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--gilt-dark);
  pointer-events: none;
}
.uniques-tabs::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.uniques-tabs::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.uniques-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.uniques-tab:hover {
  color: var(--vellum);
  background: rgba(201, 165, 103, 0.06);
}
.uniques-tab.active {
  color: var(--obsidian);
  background: linear-gradient(180deg, var(--gilt-bright) 0%, var(--gilt) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 220, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 0 14px rgba(201, 165, 103, 0.25);
}
.uniques-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 1px 6px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--gilt-bright);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gilt-dark);
  border-radius: 999px;
}
.uniques-tab.active .uniques-tab-count {
  color: var(--obsidian);
  background: rgba(15, 11, 8, 0.22);
  border-color: rgba(15, 11, 8, 0.5);
}
.uniques-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 720px) {
  .uniques-content { grid-template-columns: 1fr; }
}
.unique-card {
  padding: 16px 18px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(180, 110, 50, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(28, 20, 16, 0.85), rgba(15, 11, 8, 0.9));
  border: 1px solid var(--rule);
  position: relative;
}
.unique-card::before, .unique-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt-dark);
  pointer-events: none;
}
.unique-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.unique-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.unique-card .unique-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #b97a3c;
  margin: 0 0 8px;
}
.unique-card.new-unique .unique-name { color: var(--gilt-bright); }
.unique-card p { margin: 0 0 8px; font-size: 16px; color: var(--vellum-dim); }
.unique-card .unique-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.new-unique-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.new-unique-pill {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  color: #b97a3c;
  background: rgba(28, 20, 16, 0.85);
  border-radius: 2px;
  transition: border-color 200ms, color 200ms;
}
.new-unique-pill:hover { color: var(--gilt-bright); border-color: var(--gilt); }

/* ---------- endgame & currency & monsters & campaign ---------- */
.endgame-grid, .currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}
.currency-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .currency-grid { grid-template-columns: 1fr; } }
.endgame-card, .currency-card {
  position: relative;
  padding: 20px 22px;
  background: linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.85));
  border: 1px solid var(--rule);
}
.endgame-card::before, .endgame-card::after,
.currency-card::before, .currency-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt-dark);
  pointer-events: none;
}
.endgame-card::before, .currency-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.endgame-card::after,  .currency-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.endgame-card h3, .currency-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 12px;
}
.endgame-card ul, .currency-card ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
}
.endgame-card li, .currency-card li {
  position: relative;
  padding-left: 18px;
  font-size: 16px;
  color: var(--vellum);
}
.endgame-card li::before, .currency-card li::before {
  content: "◆";
  position: absolute;
  left: 0; top: 2px;
  font-size: 9px;
  color: var(--gilt);
}

/* Currency cards inherit the league-mechanic look: 220px banner, bigger
   title, ✦ bullets, more generous line-height. */
.currency-card {
  padding: 26px 26px 22px;
  overflow: hidden;
}
.currency-card.has-img { padding-top: 0; }
.currency-img {
  margin: 0 -26px 18px;
  height: 200px;
  position: relative;
  pointer-events: none;
}
.currency-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
}
.currency-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0 0 4px;
}
.currency-sub {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--gilt-bright);
  font-size: 18px;
  margin-bottom: 16px;
}
.currency-card ul {
  display: grid;
  gap: 10px;
}
.currency-card li {
  padding-left: 18px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--vellum);
}
.currency-card li::before {
  content: "✦";
  position: absolute;
  left: 0; top: 3px;
  font-size: 11px;
  color: var(--gilt);
}

.monster-list, .campaign-list, .removed-list {
  display: grid;
  gap: 8px;
  max-width: 920px;
  margin: 0 auto;
}
.list-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(20, 14, 10, 0.55);
  border: 1px solid var(--rule);
  border-left-width: 3px;
}
.list-row.has-buff { border-left-color: var(--emerald); }
.list-row.has-nerf { border-left-color: var(--crimson); }
.list-row.has-neutral { border-left-color: var(--gilt-dark); }
.list-row.has-mixed { border-left-color: var(--amber); }
.list-row { padding-right: 48px; }
.list-row .list-text { flex: 1; color: var(--vellum); }
.list-row .list-chips { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.list-row .kind-mark {
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
}

/* ---------- sources ---------- */
.codex-sources { margin-top: 80px; }
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.source-card {
  position: relative;
  padding: 22px;
  background: rgba(20, 14, 10, 0.6);
  border: 1px solid var(--rule);
}
.source-card::before, .source-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt-dark);
  pointer-events: none;
}
.source-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.source-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.source-card h3 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0 0 10px;
}
.source-card.source-flag {
  border-color: rgba(201, 139, 63, 0.35);
  background: rgba(80, 50, 20, 0.25);
}
.source-card.source-flag h3 { color: var(--amber); }
.source-card ul { padding-left: 18px; margin: 0; display: grid; gap: 8px; }
.source-card li { color: var(--vellum-dim); font-size: 16px; }
.source-card code { font-family: var(--font-mono); color: var(--gilt-bright); font-size: 14px; }

/* ---------- footer ---------- */
.codex-footer {
  position: relative;
  text-align: center;
  margin-top: 80px;
  padding: 80px 24px 36px;
  border-top: none;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  overflow: hidden;
}
.footer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("images/presskit-web/Act4_Cinematic.jpg") center 55% / cover no-repeat;
  opacity: 0.45;
  mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 70%, transparent 100%);
  pointer-events: none;
}
.footer-logo {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0 auto 28px;
  max-width: 380px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.65));
}
.footer-lines {
  position: relative;
  z-index: 1;
}
.footer-line + .footer-line { margin-top: 4px; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 4, 3, 0.85);
  backdrop-filter: blur(4px);
}
.modal-frame {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 36px 36px 30px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 165, 103, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(28, 20, 16, 0.98), rgba(12, 9, 7, 0.98));
  border: 1px solid var(--gilt);
  box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--vellum);
  width: 32px; height: 32px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 50%;
}
.modal-close:hover { color: var(--gilt-bright); border-color: var(--gilt); }
.modal-content h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0 0 4px;
}
.modal-content .modal-sub {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--vellum-dim);
  font-size: 18px;
  margin: 0 0 18px;
}
.modal-content ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}
.modal-content li {
  padding: 12px 14px;
  background: rgba(15, 11, 8, 0.7);
  border-left: 3px solid var(--gilt-dark);
  font-size: 16px;
  color: var(--vellum);
}
.modal-content blockquote {
  margin: 0;
  font-family: var(--font-headline);
  font-style: italic;
  font-size: 18px;
  color: var(--vellum);
  border-left: 2px solid var(--gilt);
  padding: 10px 16px;
  background: rgba(15, 11, 8, 0.5);
}
.modal-links {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-links a {
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--gilt);
  color: var(--gilt-bright);
  border-radius: 2px;
}
.modal-links a:hover { background: var(--gilt); color: var(--obsidian); }

/* ============================================================
   v2 additions — kind badge, inline coloured values,
   endgame-as-sections, classified-uniques buckets
   ============================================================ */

/* Card-corner kind mark. Flat icon, no bg/border. */
.kind-mark {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0,0,0,0.55);
  letter-spacing: 0;
}
.kind-mark.buff    { color: #7ad17a; text-shadow: 0 0 10px rgba(122, 209, 122, 0.55); }
.kind-mark.nerf    { color: #e26666; text-shadow: 0 0 10px rgba(226, 102, 102, 0.55); }
.kind-mark.mixed   { color: var(--amber); text-shadow: 0 0 10px rgba(201, 139, 63, 0.5); }
.kind-mark.rework, .kind-mark.neutral { color: var(--gilt-bright); text-shadow: 0 0 8px rgba(230, 198, 133, 0.4); }
.kind-mark.flag    { color: var(--amber); }

/* Inline-coloured values: flat coloured text, no pill, no border */
.val {
  font-family: var(--font-mono);
  font-size: 0.94em;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.val-up    { color: #7ad17a; }
.val-down  { color: #e26666; }
/* Old value being replaced (buff/nerf): muted + strikethrough */
.val-was   { color: var(--vellum-dim); text-decoration: line-through; text-decoration-color: rgba(217, 200, 154, 0.4); }
/* Old value in a side-grade / rework: muted only, no strikethrough */
.val-mute  { color: var(--vellum-dim); }
/* New value in a rework: gilt amber, no strikethrough */
.val-rework{ color: var(--gilt-bright); }
.val-arrow { color: var(--vellum-dim); padding: 0 4px; font-weight: 400; font-family: var(--font-body); }
.val-tag   { color: var(--vellum); font-size: 1em; font-family: var(--font-headline); font-style: italic; margin-right: 6px; }

/* Change lines for cards (replaces chip wall) */
.changes {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.changes li {
  font-size: 18px;
  color: var(--vellum);
  line-height: 1.6;
}
.changes li .val-tag { display: inline-block; }
.changes .ch-add::before    {
  content: "NEW";
  display: inline-block;
  background: linear-gradient(180deg, rgba(47, 102, 48, 0.55), rgba(20, 50, 22, 0.7));
  color: #b6dab1;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 8px;
  border: 1px solid var(--emerald-deep);
  box-shadow: 0 0 6px var(--emerald-glow);
  vertical-align: 2px;
}
.changes .ch-rem::before    {
  content: "NEW";
  display: inline-block;
  background: linear-gradient(180deg, rgba(122, 31, 31, 0.55), rgba(60, 14, 14, 0.7));
  color: #efb1b1;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 8px;
  border: 1px solid var(--crimson-deep);
  box-shadow: 0 0 6px var(--crimson-glow);
  vertical-align: 2px;
}
.changes .ch-rework::before {
  content: "REWORKED";
  display: inline-block;
  background: linear-gradient(180deg, rgba(130, 107, 61, 0.55), rgba(50, 40, 22, 0.7));
  color: #f3d28a;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 8px;
  border: 1px solid var(--gilt-dark);
  box-shadow: 0 0 6px rgba(201, 139, 63, 0.25);
  vertical-align: 2px;
}

/* Text-only chips (badge + label) keep the badge attached to the label so the
   label never wraps onto its own line under a hanging badge. */
.changes .ch-add,
.changes .ch-rem,
.changes .ch-rework {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}
.changes .ch-add > .val,
.changes .ch-rem > .val,
.changes .ch-rework > .val {
  white-space: normal;
  min-width: 0;
}

/* Override "NEW" → "REMOVED" badge when the chip describes a removal (chip.removed === true). */
.changes .ch-add.ch-loss::before    { content: "REMOVED"; }
.changes .ch-rem.ch-loss::before    { content: "REMOVED"; }
.changes .ch-rework.ch-loss::before {
  content: "REMOVED";
  display: inline-block;
  background: linear-gradient(180deg, rgba(130, 107, 61, 0.45), rgba(50, 40, 22, 0.6));
  color: #e6cf9c;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 8px;
  border: 1px solid var(--gilt-dark);
  vertical-align: 2px;
}

/* Skill card adjustments (position relative for badge, no chip wall) */
.skill-card,
.support-card,
.passive-card,
.unique-card,
.asc-card,
.list-row {
  position: relative;
  overflow: visible;
}
.skill-chips, .support-chips, .passive-chips, .unique-chips, .list-chips { display: none; }
/* keep in-flow positioning (see earlier rule) */

/* Endgame as full-width sections with a top-right photo that fades into the
   card body (similar to the ascendancy splash treatment). */
.endgame-feature {
  position: relative;
  padding: 26px 28px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(201,165,103,0.18) 0%, transparent 50%),
    linear-gradient(180deg, rgba(30, 22, 18, 0.7), rgba(18, 13, 10, 0.85));
  border: 1px solid var(--rule);
  overflow: hidden;
}
.endgame-feature::before, .endgame-feature::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--gilt-dark);
  pointer-events: none;
  z-index: 2;
}
.endgame-feature::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.endgame-feature::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.endgame-photo {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  max-width: 520px;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.55;
  filter: saturate(0.85);
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(90deg, transparent 0%, #000 60%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 60%, #000 100%);
}
.endgame-body { position: relative; z-index: 1; }
.endgame-body h3 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vellum);
  margin: 0 0 4px;
}
.endgame-body .endgame-sub {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--vellum-dim);
  font-size: 18px;
  margin-bottom: 12px;
}
.endgame-body ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 6px;
}
.endgame-body li {
  position: relative;
  padding-left: 18px;
  font-size: 16px;
  color: var(--vellum);
}
.endgame-body li::before {
  content: "◆";
  position: absolute;
  left: 0; top: 3px;
  font-size: 9px;
  color: var(--gilt);
}

/* Unique buckets */
.unique-bucket { margin-bottom: 28px; }
.unique-bucket-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.unique-bucket-header h3 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gilt-bright);
  margin: 0;
}
.unique-bucket-count {
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vellum-dim);
}
.unique-bucket-desc {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--vellum);
  font-size: 20px;
  line-height: 1.5;
  flex: 1;
}
.unique-bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.legacy-tile {
  padding: 14px 16px;
  background:
    linear-gradient(135deg, rgba(170, 92, 38, 0.10) 0%, rgba(20, 14, 10, 0.85) 80%),
    var(--obsidian-deep);
  border: 1px solid var(--rule);
  position: relative;
  transition: border-color 200ms;
  display: flex;
  flex-direction: column;
}
.legacy-tile.has-img {
  flex-direction: row;
  gap: 14px;
  align-items: flex-start;
}
.legacy-tile.has-img .legacy-body { flex: 1; min-width: 0; }
.legacy-img {
  flex-shrink: 0;
  width: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}
.legacy-img img {
  max-width: 64px;
  max-height: 96px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45));
}
.legacy-tile.high { border-color: rgba(185, 122, 60, 0.6); }
.legacy-tile.low { border-style: dashed; }
.legacy-tile.new  { border-color: var(--rule-strong); background: linear-gradient(135deg, rgba(201,165,103,0.06), rgba(20,14,10,0.85)); }
.legacy-tile:hover { border-color: var(--gilt); }
.legacy-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #b97a3c;
  margin: 0 0 4px;
}
.legacy-tile.new .legacy-name { color: var(--gilt-bright); }
.legacy-slot {
  font-family: var(--font-headline);
  font-style: italic;
  color: var(--vellum);
  font-size: 18px;
  margin: 0 0 4px;
}
.legacy-note {
  color: var(--vellum-dim);
  font-size: 16px;
  margin: 0 0 8px;
  line-height: 1.55;
}
.legacy-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.legacy-links a {
  font-family: var(--font-display);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  color: var(--vellum-dim);
  background: transparent;
  border-radius: 2px;
}
.legacy-links a:hover { color: var(--gilt-bright); border-color: var(--gilt); }
.legacy-links .lnk-poe1 { color: #b97a3c; border-color: rgba(185, 122, 60, 0.5); }
.legacy-confidence {
  position: absolute;
  top: 8px; right: 10px;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vellum-dim);
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.legacy-confidence.high { color: var(--emerald); border-color: var(--emerald-deep); }
.legacy-confidence.low  { color: var(--amber); border-color: var(--amber); }

/* ---------- utility ---------- */
.is-hidden { display: none !important; }

@media (max-width: 780px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 6px; font-size: 11.5px; }
  .codex-main { padding: 30px 18px 80px; }
  .codex-section { margin-top: 64px; }
  .hero { padding: 80px 18px 60px; }
  .hero-stats { gap: 14px; }
  .hero-stat-num { font-size: 30px; }
  .modal-frame { padding: 28px 22px; }
  /* Endgame text gets crowded under the right-side photo at narrow widths.
     Tone the photo into a faint full-card backdrop instead. */
  .endgame-photo {
    width: 100%;
    max-width: none;
    opacity: 0.18;
    mask-image: linear-gradient(180deg, #000 0%, #000 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 60%, transparent 100%);
  }
}

/* Phone-sized — tighter spacing, scrollable nav, smaller hero, single-column
   uniques bucket grid, modal becomes a full-bleed sheet. */
@media (max-width: 560px) {
  .codex-nav { padding: 10px 14px; gap: 10px; }
  .nav-toggle { display: flex; }
  /* Drawer: nav-links drops down from the sticky nav when toggle is open. */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px 14px 14px;
    background: linear-gradient(180deg, rgba(10,8,7,0.98), rgba(10,8,7,0.95));
    border-bottom: 1px solid var(--rule-strong);
    box-shadow: 0 12px 24px rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.2s ease;
  }
  .codex-nav.is-open .nav-links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links a {
    display: block;
    padding: 12px 6px;
    font-size: 13px;
    letter-spacing: 0.22em;
    border-bottom: 1px solid var(--rule);
  }
  .nav-links li:last-child a { border-bottom: none; }
  .codex-main { padding: 24px 14px 60px; }
  .codex-section { margin-top: 48px; }

  /* Hero takes the entire first screen — background image, title, timer,
     and misc info only. The stat grid is hidden to avoid overflow.
     Use 100svh (small viewport height) so the bottom isn't hidden behind
     mobile browser chrome. */
  .hero {
    padding: 72px 14px 80px;
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }
  .hero-frame {
    margin: 0 auto;
  }
  .hero-version { font-size: 12px; letter-spacing: 0.4em; }
  .hero-subtitle { font-size: 18px; }
  .hero-meta { gap: 8px; font-size: 11px; }
  .hero-countdown { padding: 18px 16px; }
  .hero-countdown-grid { gap: 4px; }
  .hero-countdown-num { font-size: 28px; }
  .hero-countdown-unit { font-size: 9.5px; letter-spacing: 0.18em; }
  /* Hide the quest-facts stat grid on phones — too dense for the viewport. */
  .hero-stats { display: none; }
  /* Show the scroll-down indicator on phones only. */
  .hero-scroll { display: block; }
  /* Shift the key art upward on phones so the character's face sits above
     the title/countdown text overlay. The photo layer is scaled to 150%
     container height so there's vertical overflow to crop (cover sizing
     would otherwise lock the image to container height with no room to
     shift on portrait viewports). */
  .hero-bg {
    background-size: auto, auto, auto, auto, auto 125%;
    background-position: 0 0, 0 0, 0 0, 0 0, 50% 85%;
  }

  .section-header h2 { font-size: 28px; }
  .section-subtitle { font-size: 18px; }

  .league-card.featured ul { column-count: 1; }
  .league-img, .pillar-img { height: 140px; }
  .league-card.featured .league-img { height: 200px; }

  .unique-bucket-grid { grid-template-columns: 1fr; }
  .unique-bucket-header { flex-direction: column; align-items: flex-start; gap: 6px; }

  .currency-img { height: 140px; }
  .currency-card h3, .league-name, .league-card.featured .league-name { font-size: 22px; }

  /* Endgame photo already faded by the 780px rule; here just hide it. */
  .endgame-photo { display: none; }
  .endgame-feature { padding: 22px 20px; }

  /* List rows: kind-mark vertical-center stays, but text can flow under it. */
  .list-row { padding: 12px 16px; gap: 10px; }
  .list-row .kind-mark { font-size: 20px; right: 12px; }

  .modal-frame { padding: 24px 16px; max-height: 92vh; }
  .footer-logo, .footer-art { max-width: 260px; }

  /* Uniques tabs: shrink padding and wrap so all three tabs fit. */
  /* Uniques tabs on phones: keep segmented look but compact, drop tracking
     so the three labels still fit on one row. */
  .uniques-tabs { padding: 4px; gap: 2px; }
  .uniques-tab {
    padding: 9px 4px;
    font-size: 11.5px;
    letter-spacing: 0.08em;
    gap: 6px;
    flex-direction: column;
  }
  .uniques-tab-label { line-height: 1.2; text-align: center; }
  .uniques-tab-count { min-width: 22px; font-size: 11px; padding: 0 5px; }

  /* Skills controls: stack search above sort buttons. */
  .skills-controls { padding: 12px 14px; gap: 10px; }
  .sort-group { flex-wrap: wrap; }
}
