/* ═══════════════════════════════════════════════════════════════════════
   WORLD CODEX — WIKI STYLESHEET
   Gothic Grimoire Aesthetic | Dark Fantasy Encyclopedia
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────────────────────────────── */
:root {
  /* Colour Palette */
  --ink:          #0d0b0e;        /* deepest background */
  --ink-mid:      #131118;        /* card backgrounds */
  --ink-light:    #1c1826;        /* sidebar, elevated surfaces */
  --ink-border:   #2a2438;        /* borders */
  --ink-hover:    #231f32;        /* hover states */

  --parchment:    #e8dfc8;        /* primary text */
  --parchment-dim:#a09070;        /* secondary text, muted */
  --parchment-faint:#5a5040;      /* very muted text */

  --blood:        #8b1a1a;        /* primary accent */
  --blood-bright: #c0392b;        /* hover accent */
  --blood-glow:   rgba(139,26,26,0.25);
  --blood-dim:    rgba(139,26,26,0.10);

  --gold:         #b8962e;        /* secondary accent */
  --gold-bright:  #d4ae3f;
  --gold-dim:     rgba(184,150,46,0.15);

  --amethyst:     #6b3fa0;        /* tertiary accent */
  --amethyst-dim: rgba(107,63,160,0.15);

  --teal:         #1a7a6e;
  --teal-dim:     rgba(26,122,110,0.15);

  /* Typography */
  --font-display: 'Cinzel Decorative', 'Cinzel', serif;
  --font-heading: 'Cinzel', serif;
  --font-body:    'EB Garamond', Georgia, serif;

  /* Spacing */
  --sidebar-w:    300px;
  --content-max:  860px;
  --radius:       4px;

  /* Transitions */
  --ease:         cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --fast:         0.18s;
  --mid:          0.32s;
  --slow:         0.55s;
}

/* ── RESET & BASE ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 17px;
}

body {
  margin: 0;
  background-color: var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.78;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle noise texture across entire page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.028;
  pointer-events: none;
  z-index: 0;
}

/* ── LAYOUT ──────────────────────────────────────────────────────────── */
.wiki-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────────────────────── */
.wiki-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink-light);
  border-right: 1px solid var(--ink-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--blood) var(--ink-mid);
  transition: transform var(--mid) var(--ease);
  z-index: 200;
}

.wiki-sidebar::-webkit-scrollbar { width: 4px; }
.wiki-sidebar::-webkit-scrollbar-track { background: var(--ink-mid); }
.wiki-sidebar::-webkit-scrollbar-thumb {
  background: var(--blood);
  border-radius: 2px;
}

/* Brand */
.sidebar-brand {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--ink-border);
  text-align: center;
}

.brand-rune {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 8px;
  animation: pulse-rune 4s ease-in-out infinite;
}

@keyframes pulse-rune {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-subtitle {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  color: var(--parchment-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 4px 0 0;
}

/* Search */
.sidebar-search {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--ink-border);
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--parchment-faint);
  font-size: 0.8rem;
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  background: var(--ink-mid);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 7px 10px 7px 30px;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--parchment);
  outline: none;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.sidebar-search input::placeholder { color: var(--parchment-faint); }

.sidebar-search input:focus {
  border-color: var(--blood);
  box-shadow: 0 0 0 2px var(--blood-dim);
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--ink-mid);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
  z-index: 300;
  display: none;
}

.search-results.active { display: block; }

.search-result-item {
  padding: 8px 12px;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  color: var(--parchment-dim);
  cursor: pointer;
  border-bottom: 1px solid var(--ink-border);
  transition: background var(--fast), color var(--fast);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.focused {
  background: var(--ink-hover);
  color: var(--gold);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 0 20px;
}

.nav-section-label {
  font-family: var(--font-heading);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--parchment-faint);
  padding: 10px 18px 6px;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item { border-bottom: 1px solid rgba(255,255,255,0.03); }

.nav-link-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  color: var(--parchment-dim);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color var(--fast), background var(--fast);
  position: relative;
}

.nav-link-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--blood);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--fast) var(--ease);
}

.nav-link-item:hover,
.nav-link-item.active {
  color: var(--gold);
  background: var(--ink-hover);
}

.nav-link-item:hover::before,
.nav-link-item.active::before {
  transform: scaleY(1);
}

.nav-numeral {
  font-family: var(--font-display);
  font-size: 0.58rem;
  color: var(--blood);
  flex-shrink: 0;
}

/* Sub-nav */
.nav-children {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(0,0,0,0.18);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--mid) var(--ease);
}

.nav-item.open .nav-children { max-height: 600px; }

.nav-children a {
  display: block;
  padding: 6px 18px 6px 32px;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  color: var(--parchment-faint);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color var(--fast), padding-left var(--fast);
}

.nav-children a:hover {
  color: var(--parchment-dim);
  padding-left: 38px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--ink-border);
  text-align: center;
}

.sidebar-footer-rune {
  color: var(--blood);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.sidebar-footer p {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--parchment-faint);
  margin: 0;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────────────────────────────────── */
.wiki-main {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blood), var(--gold));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 999;
  transition: transform 0.1s linear;
}

/* ── HERO ─────────────────────────────────────────────────────────── */
.wiki-hero {
  position: relative;
  padding: 90px 60px 80px;
  background: radial-gradient(ellipse at 50% 0%, #1a0e1e 0%, var(--ink) 65%);
  border-bottom: 1px solid var(--ink-border);
  overflow: hidden;
  text-align: center;
}

.wiki-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, var(--blood-dim) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, var(--amethyst-dim) 0%, transparent 50%);
  pointer-events: none;
}

.wiki-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--gold);
  border-radius: 50%;
  animation: float-particle linear infinite;
  opacity: 0;
}

@keyframes float-particle {
  0%   { transform: translateY(100%) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-100%) translateX(20px); opacity: 0; }
}

.hero-content { position: relative; z-index: 1; }

.hero-eyebrow {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.2s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  color: var(--parchment);
  letter-spacing: 0.06em;
  margin: 0 0 16px;
  line-height: 1.05;
  text-shadow: 0 0 60px var(--blood-glow), 0 2px 30px rgba(0,0,0,0.8);
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.35s forwards;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--parchment-dim);
  max-width: 520px;
  margin: 0 auto 30px;
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.5s forwards;
}

.hero-divider {
  margin: 0 auto 30px;
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.6s forwards;
}

.divider-gem {
  color: var(--gold);
  font-size: 1.1rem;
}

.hero-meta {
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.75s forwards;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--ink-border);
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-width: 90px;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--parchment-faint);
}

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

/* ── ARTICLE ─────────────────────────────────────────────────────── */
.wiki-article {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 60px 48px 100px;
}

/* ── SECTION ─────────────────────────────────────────────────────── */
.wiki-section {
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.wiki-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-chapter-tag {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--blood-bright);
  margin-bottom: 8px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--parchment);
  letter-spacing: 0.04em;
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-border);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 60px; height: 2px;
  background: var(--blood);
}

.section-lead {
  font-size: 1.08rem;
  font-style: italic;
  color: var(--parchment-dim);
  margin: 14px 0 28px;
  padding-left: 16px;
  border-left: 2px solid var(--ink-border);
}

/* ── SUBSECTION ──────────────────────────────────────────────────── */
.subsection {
  margin: 36px 0;
  scroll-margin-top: 20px;
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gold-dim);
}

.subsub-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--parchment-dim);
  letter-spacing: 0.04em;
  border-left: 2px solid var(--blood);
  padding-left: 10px;
  margin-bottom: 10px;
}

p {
  margin: 0 0 14px;
  color: var(--parchment);
}

em { color: var(--parchment-dim); font-style: italic; }
strong { color: var(--parchment); font-weight: 600; }

/* ── DIVIDER ─────────────────────────────────────────────────────── */
.section-divider {
  text-align: center;
  margin: 50px 0;
  position: relative;
}

.section-divider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-border), transparent);
}

.section-divider span {
  position: relative;
  background: var(--ink);
  padding: 0 20px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--blood);
  letter-spacing: 0.3em;
}

/* ── CALLOUTS ────────────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  margin: 18px 0;
  font-size: 0.93rem;
}

.callout p { margin: 0; }

.callout-icon {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 2px;
  color: inherit;
}

.callout-lore {
  background: var(--amethyst-dim);
  border-color: var(--amethyst);
  color: var(--parchment-dim);
}
.callout-lore .callout-icon { color: var(--amethyst); }

.callout-note {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--parchment-dim);
}
.callout-note .callout-icon { color: var(--teal); }

.callout-warning {
  background: rgba(180, 130, 30, 0.10);
  border-color: rgba(180, 130, 30, 0.5);
  color: var(--parchment-dim);
}
.callout-warning .callout-icon { color: var(--gold); }

.callout-rare {
  background: var(--blood-dim);
  border-color: var(--blood);
  color: var(--parchment-dim);
}
.callout-rare .callout-icon { color: var(--gold); }

/* ── INFO CARDS ──────────────────────────────────────────────────── */
.info-card {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 16px;
  height: 100%;
  transition: border-color var(--fast), transform var(--fast);
}

.info-card:hover {
  border-color: var(--blood);
  transform: translateY(-2px);
}

.info-card-dark {
  background: var(--ink-mid);
  border-color: rgba(255,255,255,0.06);
}

.info-card-header {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-border);
}

.info-card p { margin: 0; font-size: 0.88rem; color: var(--parchment-dim); }

/* ── SIDEBAR CARDS ───────────────────────────────────────────────── */
.sidebar-card {
  background: var(--ink-mid);
  border: 1px solid var(--ink-border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.88rem;
}

.sidebar-card-blood { border-left-color: var(--blood); }

.sidebar-card-title {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-card li {
  padding: 4px 0;
  color: var(--parchment-dim);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
}

.sidebar-card li:last-child { border-bottom: none; }
.sidebar-card li::before { content: '◆ '; font-size: 0.5rem; color: var(--blood); }

/* ── CLASSIFICATION GRID ─────────────────────────────────────────── */
.classification-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.classification-item {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform var(--fast), border-color var(--fast);
}

.classification-item:hover {
  transform: translateY(-2px);
  border-color: var(--blood);
}

.classification-item p { font-size: 0.85rem; color: var(--parchment-dim); margin: 8px 0 0; }

.class-badge {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 6px;
}

.class-pure      { background: var(--teal-dim); color: var(--teal); border: 1px solid var(--teal); }
.class-new       { background: var(--gold-dim);  color: var(--gold-bright); border: 1px solid var(--gold); }
.class-unfinished{ background: var(--amethyst-dim); color: var(--amethyst); border: 1px solid var(--amethyst); }
.class-altered   { background: rgba(100,160,100,0.12); color: #6aaa6a; border: 1px solid #4a8a4a; }
.class-broken    { background: var(--blood-dim); color: var(--blood-bright); border: 1px solid var(--blood); }

/* ── STRENGTH CARDS ──────────────────────────────────────────────── */
.strength-card {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  height: 100%;
  transition: transform var(--fast), border-color var(--fast);
}

.strength-card:hover { transform: translateY(-2px); }

.strength-icon { font-size: 1.8rem; margin-bottom: 10px; }
.strength-card h4 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}
.strength-card p { font-size: 0.85rem; color: var(--parchment-dim); margin: 0; }

.strength-strong  { background: rgba(100,160,100,0.06); border-color: rgba(100,160,100,0.3); }
.strength-strong  h4 { color: #6aaa6a; }
.strength-fragile { background: var(--gold-dim); border-color: rgba(184,150,46,0.3); }
.strength-fragile h4 { color: var(--gold); }
.strength-weak    { background: var(--blood-dim); border-color: rgba(139,26,26,0.3); }
.strength-weak    h4 { color: var(--blood-bright); }

/* ── SOUL LIST ───────────────────────────────────────────────────── */
.souls-list { margin: 18px 0; }

.soul-entry {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--ink-light);
  transition: border-color var(--fast);
}

.soul-entry:hover { border-color: var(--blood); }

.soul-number {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--blood);
  flex-shrink: 0;
  min-width: 36px;
}

.soul-name {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 6px;
}

.soul-info p { font-size: 0.85rem; color: var(--parchment-dim); margin: 0; }

/* ── MAGIC CARDS ─────────────────────────────────────────────────── */
.magic-card {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 20px;
  height: 100%;
  transition: border-color var(--fast), transform var(--fast);
}

.magic-card:hover { border-color: var(--amethyst); transform: translateY(-2px); }

.magic-card-icon { font-size: 2rem; margin-bottom: 10px; }

.magic-card h4 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin: 0 0 10px;
}

.magic-card p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0; }

/* ── ENCHANTMENT BLOCKS ──────────────────────────────────────────── */
.enchant-block {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 16px;
  height: 100%;
}

.enchant-block h5 {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.enchant-block ul { list-style: none; padding: 0; margin: 0; }

.enchant-block li {
  padding: 4px 0;
  font-size: 0.85rem;
  color: var(--parchment-dim);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.enchant-block li:last-child { border-bottom: none; }

.enchant-willful {
  background: var(--teal-dim);
  border-color: rgba(26,122,110,0.4);
}
.enchant-willful h5 { color: var(--teal); }

.enchant-unwillful {
  background: var(--blood-dim);
  border-color: rgba(139,26,26,0.4);
}
.enchant-unwillful h5 { color: var(--blood-bright); }

.styled-list {
  padding-left: 20px;
  color: var(--parchment-dim);
  font-size: 0.93rem;
}

.styled-list li { margin-bottom: 6px; }

/* ── FIRE LORD CARDS ─────────────────────────────────────────────── */
.firelord-card {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  height: 100%;
  transition: transform var(--fast), border-color var(--fast);
  cursor: default;
}

.firelord-card:hover { transform: translateY(-3px); }

.firelord-card[data-lord="garanzo"]:hover { border-color: #ff6a00; }
.firelord-card[data-lord="zazoro"]:hover  { border-color: #0080ff; }
.firelord-card[data-lord="phayne"]:hover  { border-color: #7b2fd4; }
.firelord-card[data-lord="zathura"]:hover { border-color: #c0392b; }

.firelord-fire { font-size: 2rem; margin-bottom: 8px; }

.firelord-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--parchment);
  margin: 0 0 8px;
}

.firelord-color {
  width: 36px;
  height: 3px;
  border-radius: 2px;
  margin: 0 auto 10px;
}

.firelord-card p { font-size: 0.82rem; color: var(--parchment-dim); margin: 0; }

/* ── LOVE CARDS ──────────────────────────────────────────────────── */
.love-card {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  height: 100%;
}

.love-card h5 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.love-card p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0; }

.love-demon { background: var(--blood-dim); border-color: rgba(139,26,26,0.4); }
.love-demon h5 { color: var(--blood-bright); }

.love-angel { background: var(--teal-dim); border-color: rgba(26,122,110,0.4); }
.love-angel h5 { color: var(--teal); }

/* ── PROPERTY BLOCKS ─────────────────────────────────────────────── */
.prop-block {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  height: 100%;
  transition: border-color var(--fast);
}

.prop-block:hover { border-color: var(--gold); }
.prop-icon { font-size: 1.8rem; margin-bottom: 10px; }
.prop-block h5 {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.prop-block p { font-size: 0.82rem; color: var(--parchment-dim); margin: 0; }

/* ── CALENDAR GRID ───────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.calendar-heaven { grid-template-columns: repeat(4, 1fr); }

.cal-item {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color var(--fast);
}

.cal-item:hover { border-color: var(--blood); }

.cal-number {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold);
  line-height: 1;
}

.cal-label {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--parchment-faint);
}

/* Day cycle */
.day-cycle-list { display: flex; flex-direction: column; gap: 8px; }

.day-phase {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.88rem;
}

.phase-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  min-width: 36px;
  text-align: center;
}

.day-phase strong { color: var(--gold); }
.day-phase div { color: var(--parchment-dim); }

.day-full { border-left: 3px solid var(--gold); }
.day-first { border-left: 3px solid rgba(184,150,46,0.4); }
.day-true { border-left: 3px solid var(--blood); }

/* ── BLINK CARDS ─────────────────────────────────────────────────── */
.blink-card {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  height: 100%;
}

.blink-card h5 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}

.blink-card p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0; }

.blink-half { background: rgba(184,150,46,0.06); border-color: rgba(184,150,46,0.3); }
.blink-half h5 { color: var(--gold); }
.blink-full { background: var(--ink-mid); border-color: rgba(255,255,255,0.08); }
.blink-full h5 { color: var(--parchment-dim); }

/* ── HIERARCHY TREE ──────────────────────────────────────────────── */
.hierarchy-tree { margin: 18px 0; }

.hierarchy-level {
  position: relative;
  margin-bottom: 4px;
  padding: 14px 16px;
  border: 1px solid var(--ink-border);
  border-left: 4px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: transform var(--fast);
}

.hierarchy-level:hover { transform: translateX(3px); }

.level-badge {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hierarchy-level p { font-size: 0.85rem; color: var(--parchment-dim); margin: 0; }

/* Hell hierarchy colours */
.level-czar    { background: rgba(139,26,26,0.10); border-left-color: var(--blood); }
.level-czar .level-badge { color: var(--blood-bright); }
.level-mogul   { background: rgba(139,26,26,0.06); border-left-color: rgba(139,26,26,0.5); }
.level-mogul .level-badge { color: rgba(192,57,43,0.8); }
.level-denizen { background: rgba(184,150,46,0.06); border-left-color: rgba(184,150,46,0.4); }
.level-denizen .level-badge { color: var(--gold); }
.level-newling { background: rgba(255,255,255,0.02); border-left-color: var(--ink-border); }
.level-newling .level-badge { color: var(--parchment-faint); }

/* Heaven hierarchy colours */
.hierarchy-heaven .level-governor  { background: rgba(26,122,110,0.10); border-left-color: var(--teal); }
.hierarchy-heaven .level-governor .level-badge { color: var(--teal); }
.hierarchy-heaven .level-purifier  { background: rgba(107,63,160,0.08); border-left-color: var(--amethyst); }
.hierarchy-heaven .level-purifier .level-badge { color: var(--amethyst); }
.hierarchy-heaven .level-seeker    { background: rgba(184,150,46,0.06); border-left-color: rgba(184,150,46,0.5); }
.hierarchy-heaven .level-seeker .level-badge { color: var(--gold); }
.hierarchy-heaven .level-guardian  { background: rgba(184,150,46,0.04); border-left-color: rgba(184,150,46,0.3); }
.hierarchy-heaven .level-guardian .level-badge { color: rgba(212,174,63,0.7); }
.hierarchy-heaven .level-illume    { background: rgba(255,255,255,0.02); border-left-color: rgba(255,255,255,0.1); }
.hierarchy-heaven .level-illume .level-badge { color: var(--parchment-dim); }
.hierarchy-heaven .level-essence   { background: rgba(255,255,255,0.01); border-left-color: rgba(255,255,255,0.06); }
.hierarchy-heaven .level-essence .level-badge { color: var(--parchment-faint); }

/* ── LOCATION LIST ───────────────────────────────────────────────── */
.location-list { margin: 18px 0; }

.location-entry {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--ink-light);
  transition: border-color var(--fast), transform var(--fast);
}

.location-entry:hover {
  border-color: var(--blood);
  transform: translateX(3px);
}

.location-icon { font-size: 1.6rem; flex-shrink: 0; }

.location-entry h5 {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin: 0 0 6px;
}

.location-entry p { font-size: 0.85rem; color: var(--parchment-dim); margin: 0; }

/* ── PORTAL GATE SHAPES ──────────────────────────────────────────── */
.gate-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 120px;
  height: 120px;
  border: 2px solid var(--blood);
  background: var(--blood-dim);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  margin: 0 auto;
  transition: border-color var(--fast), transform var(--fast);
  animation: gate-pulse 3s ease-in-out infinite;
}

.gate-shape:hover { border-color: var(--gold); transform: scale(1.05); }

.gate-cylindrical { border-radius: 50%; }
.gate-triangular  {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border: none;
  background: var(--blood-dim);
  border-radius: 0;
  padding-top: 50px;
  outline: 2px solid var(--blood);
}
.gate-circular    { border-radius: 50%; border-style: dashed; }

@keyframes gate-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--blood-dim); }
  50% { box-shadow: 0 0 20px var(--blood-glow); }
}

/* ── AGE RANGE TABLE ─────────────────────────────────────────────── */
.age-range-table { border: 1px solid var(--ink-border); border-radius: var(--radius); overflow: hidden; }

.age-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--ink-border);
  transition: background var(--fast);
}

.age-row:last-child { border-bottom: none; }
.age-row:hover { background: var(--ink-hover); }

.age-range {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold);
  padding: 12px 20px;
  min-width: 150px;
  border-right: 1px solid var(--ink-border);
}

.age-desc {
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--parchment-dim);
}

/* ── KINGDOM CARDS ───────────────────────────────────────────────── */
.kingdom-card {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
  transition: border-color var(--fast), transform var(--fast);
}

.kingdom-card:hover { transform: translateY(-2px); }

.kingdom-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.kingdom-icon { font-size: 1.8rem; flex-shrink: 0; }

.kingdom-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--parchment);
  margin: 0 0 4px;
}

.kingdom-tag {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--parchment-faint);
}

.kingdom-card p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0 0 10px; }

.kingdom-detail {
  font-size: 0.82rem;
  color: var(--parchment-dim);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.kingdom-detail:last-child { border-bottom: none; }

.detail-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--parchment-faint);
  text-transform: uppercase;
  margin-right: 6px;
}

/* Kingdom colour accents */
.kingdom-ashra   { background: rgba(139,26,26,0.05); border-color: rgba(139,26,26,0.35); }
.kingdom-ashra:hover { border-color: var(--blood); }
.kingdom-wulfe   { background: rgba(100,160,100,0.04); border-color: rgba(100,160,100,0.25); }
.kingdom-wulfe:hover { border-color: #6aaa6a; }
.kingdom-naytron { background: var(--gold-dim); border-color: rgba(184,150,46,0.3); }
.kingdom-naytron:hover { border-color: var(--gold); }
.kingdom-heftle  { background: rgba(184,150,46,0.04); border-color: rgba(184,150,46,0.2); }
.kingdom-arundaur{ background: rgba(180,80,80,0.05); border-color: rgba(180,80,80,0.25); }
.kingdom-coldoak { background: rgba(100,100,100,0.05); border-color: rgba(150,150,150,0.2); }
.kingdom-isle    { background: var(--teal-dim); border-color: rgba(26,122,110,0.3); }
.kingdom-isle:hover { border-color: var(--teal); }

/* ── FAE CARDS ───────────────────────────────────────────────────── */
.fae-card {
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 18px;
  height: 100%;
  transition: border-color var(--fast), transform var(--fast);
}

.fae-card:hover { transform: translateY(-2px); }

.fae-card h5 {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.fae-card p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0; }

.fae-individual { background: var(--teal-dim); border-color: rgba(26,122,110,0.35); }
.fae-individual h5 { color: var(--teal); }
.fae-swarm      { background: var(--amethyst-dim); border-color: rgba(107,63,160,0.35); }
.fae-swarm h5   { color: var(--amethyst); }

/* ── SUBSECTION HIGHLIGHT ────────────────────────────────────────── */
.subsection-highlight {
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px;
  margin: 18px 0;
}

.subsection-highlight h4 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin: 0 0 8px;
}

.subsection-highlight p { font-size: 0.88rem; color: var(--parchment-dim); margin: 0; }

/* ── ARTICLE FOOTER ──────────────────────────────────────────────── */
.article-footer {
  text-align: center;
  margin-top: 60px;
  padding: 40px 0 0;
  border-top: 1px solid var(--ink-border);
}

.footer-rune {
  font-size: 1.2rem;
  color: var(--gold);
  display: inline-block;
  margin: 0 10px;
}

.article-footer p {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--parchment-faint);
  margin: 10px 0;
}

/* ── BACK TO TOP ─────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--blood);
  border: 1px solid var(--blood-bright);
  border-radius: 50%;
  color: var(--parchment);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--mid), transform var(--mid), background var(--fast);
  z-index: 500;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover { background: var(--blood-bright); }

/* ── MOBILE TOGGLE ───────────────────────────────────────────────── */
.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 42px;
  height: 42px;
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 600;
  transition: background var(--fast), color var(--fast);
}

.sidebar-toggle:hover { background: var(--ink-hover); color: var(--parchment); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mid);
}

.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .wiki-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }

  .wiki-sidebar.open { transform: translateX(0); }

  .reading-progress { left: 0; }

  .wiki-article { padding: 40px 24px 80px; }

  .wiki-hero { padding: 70px 24px 60px; }

  .calendar-grid { grid-template-columns: repeat(3, 1fr); }
  .calendar-heaven { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
  html { font-size: 15px; }

  .hero-title { font-size: 2rem; }

  .wiki-article { padding: 32px 16px 60px; }

  .calendar-grid { grid-template-columns: repeat(2, 1fr); }

  .classification-grid { grid-template-columns: 1fr; }

  .gate-shape { width: 90px; height: 90px; }
}

/* ─────────────────────────────────────────────────────────────────────
   SCROLLBAR (main area)
───────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--blood); border-radius: 3px; }

/* ─────────────────────────────────────────────────────────────────────
   SELECTION
───────────────────────────────────────────────────────────────────── */
::selection {
  background: var(--blood-glow);
  color: var(--parchment);
}
