*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink:       #0D0B14;
  --parchment: #F5EDD6;
  --cerulean:  #7B9BB5;
  --gold:      #C9A84C;
  --violet:    #2A2040;
  --lavender:  #8B6F9E;
  --text-light: #E8DFC8;
  --text-muted: #A89880;

  --border-gold: 1px solid rgba(201, 168, 76, 0.35);
  --radius-sm: 4px;
  --radius-md: 8px;

  --font-display: 'Jim Nightshade', cursive;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui: system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--ink);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--cerulean);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--gold);
}

ul {
  list-style: none;
}

/* ─── Custom Cursor ────────────────────────────────────── */
.cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, background 0.2s;
}

.cursor-pointer {
  position: fixed;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(201, 168, 76, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, width 0.2s, height 0.2s;
}

/* ─── Section shared wrapper ───────────────────────────── */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px 40px;
}

.section-label,
.char-section-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.section-title,
.char-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--parchment);
  margin-bottom: 12px;
}

.section-rule,
.char-section-rule {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin-bottom: 36px;
}

/* ─── Scroll reveal ────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════════════ */
.container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  background: rgba(13, 11, 20, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: var(--border-gold);
}

.nav-logo img {
 justify-content: center;
 display: flex;
 gap: 2rem;;
}


.container ul {
  display: flex;
  gap: 32px;
}

.container ul li a {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.container ul li a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.container ul li a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ─── Search bar ───────────────────────────────────────── */
form[role="search"] {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  width: min(480px, 90vw);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(42, 32, 64, 0.95);
  border: var(--border-gold);
  border-radius: 24px;
  padding: 8px 16px;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  border-color: var(--cerulean);
  box-shadow: 0 0 0 3px rgba(123, 155, 181, 0.2);
}

.search-bar span {
  font-size: 1rem;
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.search-clear:hover {
  color: var(--gold);
}

/* Search results dropdown */
.search-result {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 90vw);
  z-index: 98;
  background: var(--violet);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  max-height: 320px;
  overflow-y: auto;
  display: none; /* shown via JS when results exist */
}

.result-item {
  padding: 12px 18px;
  color: var(--text-light);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
}

/* ─── Mobile menu ──────────────────────────────────────── */
.icon {
  display: none;
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 101;
  width: 28px;
  height: 20px;
  cursor: pointer;
}

/* Hamburger button inside navbar */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 102;
}

.mobile-menu-btn .menu-line {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* Legacy position: fixed menu-line (for old icon) */
.menu-line:not(.mobile-menu-btn .menu-line) {
  display: none;
  position: fixed;
  right: 24px;
  width: 28px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  pointer-events: none;
  z-index: 101;
}

.menu-line:not(.mobile-menu-btn .menu-line):nth-of-type(1) { top: 22px; }
.menu-line:not(.mobile-menu-btn .menu-line):nth-of-type(2) { top: 30px; }
.menu-line:not(.mobile-menu-btn .menu-line):nth-of-type(3) { top: 38px; }

/* Mobile menu open state — shown when JS toggles #nav-menu.open */
#nav-menu.open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 76px;
  left: 0;
  right: 0;
  background: rgba(13, 11, 20, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: var(--border-gold);
  padding: 20px 32px;
  gap: 16px;
  z-index: 100;
}

#nav-menu.open li a {
  font-size: 1rem;
  padding: 8px 0;
}

/* ═══════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════ */
#hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 30% 50%, rgba(42, 32, 64, 0.9) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 70% 40%, rgba(123, 155, 181, 0.08) 0%, transparent 60%),
    linear-gradient(160deg, #0D0B14 0%, #1A1428 50%, #0D0B14 100%);
}

/* Stars layer — JS populates this */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Decorative runes */
.rune {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: rgba(201, 168, 76, 0.15);
  user-select: none;
  pointer-events: none;
  animation: runeFloat 8s ease-in-out infinite;
}

.rune:nth-child(odd) {
  animation-duration: 11s;
  animation-direction: alternate;
}

@keyframes runeFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.12; }
  50%       { transform: translateY(-12px) rotate(6deg); opacity: 0.22; }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px;
}

.hero-title {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}

.hero-text {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 1;
  color: var(--parchment);
  text-shadow:
    0 0 60px rgba(201, 168, 76, 0.25),
    0 2px 4px rgba(0,0,0,0.6);
  margin-bottom: 16px;
}

.hero-sub {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.06em;
  margin-bottom: 40px;
}

.overview-btn {
  display: inline-block;
  padding: 12px 32px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s;
}

.overview-btn:hover {
  background: var(--gold);
  color: var(--ink);
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.1); }
}

/* ═══════════════════════════════════════════════════════
   OVERVIEW — TABS
═══════════════════════════════════════════════════════ */
#overview {
  background: linear-gradient(180deg, var(--ink) 0%, var(--violet) 100%);
}

.section-tab {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  border-bottom: var(--border-gold);
  padding-bottom: 0;
}

.tab-btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: var(--cerulean);
}

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-collumn {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

.tab-text h3,
.tab-text h4 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--parchment);
  margin-bottom: 14px;
}

.tab-text p {
  color: var(--text-light);
  margin-bottom: 12px;
}

.lore-box {
  background: rgba(13, 11, 20, 0.6);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  padding: 24px;
}

.lore-box h3,
.lore-box h4 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 14px;
}

.lore-box ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lore-box li {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
}

.lore-box li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.6rem;
  top: 5px;
}

/* ═══════════════════════════════════════════════════════
   CHARACTERS
═══════════════════════════════════════════════════════ */
.character-section {
  background: var(--ink);
  padding-bottom: 60px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding-top: 16px;
}

.char-card {
  background: var(--violet);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
}

.char-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 8px 30px rgba(0,0,0,0.4),
    0 0 0 1px rgba(201, 168, 76, 0.5);
}

.char-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: rgba(13, 11, 20, 0.5);
}

.char-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.4s ease;
}

.char-card:hover .char-img img {
  transform: scale(1.04);
}

.char-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(13, 11, 20, 0.8);
  border: 1px solid rgba(201, 168, 76, 0.4);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
}

.char-body {
  padding: 20px;
}

.char-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--parchment);
  margin-bottom: 8px;
}

.char-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   ARTICLE / WIKI PAGE (Coco)
═══════════════════════════════════════════════════════ */
.article-section {
  background: var(--parchment);
  color: #2A1F14;
}

.article-section .section {
  padding-bottom: 0;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  color: #2A1F14;
}

.article-sub {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7A6040;
  margin-top: 4px;
}

.wiki-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
}

/* Sidebar */
.wiki-sidebar {
  position: sticky;
  top: 120px;
}

.sidebar-box {
  background: rgba(42, 32, 64, 0.06);
  border: 1px solid rgba(42, 32, 64, 0.18);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.sidebar-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #7A6040;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(42, 32, 64, 0.15);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-links a {
  font-size: 0.85rem;
  color: #4A3828;
  transition: color 0.2s;
}

.sidebar-links a:hover {
  color: var(--lavender);
}

/* Infobox */
.wiki-article {
  color: #2A1F14;
}

.infobox {
  float: right;
  width: 220px;
  margin: 0 0 24px 28px;
  background: rgba(245, 237, 214, 0.7);
  border: 1px solid rgba(42, 32, 64, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.85rem;
}

.infobox-name {
  background: var(--violet);
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-align: center;
  padding: 12px;
}

.infobox-image {
  background: rgba(42, 32, 64, 0.08);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--gold);
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
}

.infobox th,
.infobox td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(42, 32, 64, 0.1);
  vertical-align: top;
}

.infobox th {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #7A6040;
  width: 40%;
}

.infobox td {
  color: #2A1F14;
}

/* Article prose */
.wiki-article h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--violet);
  margin: 36px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(42, 32, 64, 0.18);
}

.wiki-article p {
  margin-bottom: 14px;
  line-height: 1.8;
  color: #3A2C1C;
}

.wiki-article p strong {
  color: var(--violet);
}

/* ═══════════════════════════════════════════════════════
   LORE SECTION
═══════════════════════════════════════════════════════ */
.lore-section {
  background: linear-gradient(180deg, #120F1E 0%, var(--ink) 100%);
}

/* Ensure lore sidebar and article content are always visible */
#lore .lore-sidebar,
#lore .lore-article {
  opacity: 1 !important;
  transform: none !important;
}

.lore-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--parchment);
}

.lore-sub {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.lore-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

.lore-sidebar {
  position: sticky;
  top: 120px;
}

.lore-sidebar-box {
  background: rgba(42, 32, 64, 0.5);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  padding: 18px;
}

.lore-sidebar-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: var(--border-gold);
}

.lore-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lore-sidebar-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lore-sidebar-links a:hover {
  color: var(--gold);
}

/* Lore info box (header) */
.lore-info-box {
  margin-bottom: 40px;
}

.lore-sec-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--parchment);
  margin-bottom: 16px;
}

.lore-img {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: var(--border-gold);
}

.lore-img img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

/* Lore article prose */
.lore-article h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  margin: 40px 0 16px;
  padding-bottom: 6px;
  border-bottom: var(--border-gold);
}

.lore-article p {
  color: var(--text-light);
  margin-bottom: 14px;
  line-height: 1.8;
}

/* Species cards */
.species-card {
  background: rgba(42, 32, 64, 0.45);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.species-card h4 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cerulean);
  margin-bottom: 10px;
}

.species-card > img {
  margin: 16px 0;
  border-radius: var(--radius-sm);
  border: var(--border-gold);
  max-height: 200px;
  object-fit: cover;
}

.references-sec {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 14px 0 8px;
}

.species-category {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.species-category li {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 12px;
  position: relative;
}

.species-category li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: rgba(201, 168, 76, 0.4);
}

/* Faction cards */
.faction-card {
  background: rgba(42, 32, 64, 0.45);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.faction-body h4 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--lavender);
  margin-bottom: 10px;
}

.faction-body img {
  margin: 14px 0;
  border-radius: var(--radius-sm);
  border: var(--border-gold);
  max-height: 180px;
  object-fit: cover;
}

.moralis-members,
.brimmed-members {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: var(--border-gold);
}

.easthies,
.luluci,
.iguin,
.restys {
  background: rgba(13, 11, 20, 0.4);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.easthies p strong,
.luluci p strong,
.iguin p strong,
.restys p strong {
  color: var(--cerulean);
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.easthies img,
.luluci img,
.iguin img,
.restys img {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  max-height: 450px;
  object-fit: cover;
  border: var(--border-gold);
}

/* History & Trivia */
.history-sec p,
.trivia-sec p {
  color: var(--text-light);
  margin-bottom: 14px;
  line-height: 1.8;
}

/* ═══════════════════════════════════════════════════════
   MAGIC SECTION
═══════════════════════════════════════════════════════ */
#magic {
  background: var(--ink);
  padding-bottom: 80px;
}

#magic .section {
  padding-bottom: 16px;
}

#magic .section h3 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--parchment);
  margin-bottom: 6px;
}

#magic .section p {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.magic-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

.magic-sidebar {
  position: sticky;
  top: 120px;
}

.magic-sidebar > div {
  background: rgba(42, 32, 64, 0.5);
  border: var(--border-gold);
  border-radius: var(--radius-md);
  padding: 18px;
}

.magic-sidebar ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.magic-sidebar a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.magic-sidebar a:hover {
  color: var(--gold);
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.history-content article {
  border-bottom: var(--border-gold);
  padding-bottom: 40px;
}

.history-content article:last-child {
  border-bottom: none;
}

.history-content h4 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--cerulean);
  margin-bottom: 16px;
}

.history-content p {
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.8;
}

.history-content p strong {
  color: var(--gold);
}

/* Image grids (Three Sages, spells) */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.image-grid figure {
  background: rgba(42, 32, 64, 0.5);
  border: var(--border-gold);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-align: center;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.image-grid figcaption {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px;
  letter-spacing: 0.05em;
}

/* Spell element groups */
.fire, .water, .earth, .wind, .light, .forbidden {
  margin-top: 24px;
}

.fire::before  { content: '⬡ Fire';  }
.water::before { content: '⬡ Water'; }
.earth::before { content: '⬡ Earth'; }
.wind::before  { content: '⬡ Wind';  }
.light::before { content: '⬡ Light'; }
.forbidden::before { content: '⬡ Forbidden'; }

.fire::before,
.water::before,
.earth::before,
.wind::before,
.light::before,
.forbidden::before {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: var(--border-gold);
}

.fire, .water, .earth, .wind, .light, .forbidden {
  display: flex;
  flex-direction: column;
}

.fire > figure,
.water > figure,
.earth > figure,
.wind > figure,
.light > figure,
.forbidden > figure {
display: none;
}


.fire,
.water,
.earth,
.wind,
.light,
.forbidden {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════ */
.footer {
  background: #080610;
  border-top: var(--border-gold);
  padding: 48px 24px 32px;
}

.footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.footer-title .nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--parchment);
  display: block;
  margin-bottom: 10px;
}

.footer-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 320px;
}

.footer-column h5 {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.footer-column ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-column a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-column a:hover {
  color: var(--cerulean);
}

.footer-bottom {
  grid-column: 1 / -1;
  padding-top: 24px;
  border-top: var(--border-gold);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

#back-top {
  grid-column: 1 / -1;
  justify-self: center;
  background: none;
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: var(--gold);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#back-top:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .tab-collumn {
    grid-template-columns: 1fr;
  }

  .wiki-layout {
    grid-template-columns: 1fr;
  }

  .wiki-sidebar {
    position: static;
  }

  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 24px 0;
  }

  .lore-layout,
  .magic-layout {
    grid-template-columns: 1fr;
  }

  .lore-sidebar,
  .magic-sidebar {
    position: static;
  }

  .moralis-members,
  .brimmed-members {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .container ul {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .icon {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .character-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .character-grid {
    grid-template-columns: 1fr;
  }

  form[role="search"] {
    top: 60px;
  }
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Back to top visibility */
#back-top { display: none; }
#back-top.show { display: block; }
