/* Ancient Civs — dark gold theme. Mirrors the mobile app's palette:
   gold (#C9A84C) on near-black (#0A0A0A) with a blue accent thread. */
:root {
  --gold: #C9A84C;
  --gold-dim: #9a803a;
  --bg: #0A0A0A;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --border: #2a2a2a;
  --text: #ECE7DA;
  --textdim: #9a958a;
  --blue: #5B8DB8;
  --green: #5EE2A0;
  --violet: #7d6bd6;   /* echoes the glow behind Anubis */
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { width: min(1600px, 92vw); margin: 0 auto; }
.muted { color: var(--textdim); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10,10,10,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { position: relative; display: flex; align-items: center; gap: 22px; height: 64px; }

/* Brand: Anubis medallion mark + "THE ANCIENTS" wordmark (lockup B) */
.brand { display: flex; align-items: center; gap: 11px; color: var(--gold); }
.brand-mark { display: flex; color: var(--gold); transition: transform .25s ease; }
.brand-mark svg { display: block; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.04); }
.brand-wm {
  font-weight: 800; font-size: 19px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold); white-space: nowrap;
}

/* On desktop the links + search flow straight into the bar's flexbox */
.nav-collapse { display: contents; }
.mainnav { display: flex; gap: 22px; margin-left: 6px; }
.mainnav a { position: relative; color: var(--textdim); font-size: 15px; font-weight: 500; padding: 4px 0; transition: color .15s; }
.mainnav a:hover { color: var(--text); }
.mainnav a.is-active { color: var(--gold); }
.mainnav a.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--gold); border-radius: 2px;
}

.search { margin-left: auto; display: flex; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 4px 4px 4px 14px; }
.search input { background: none; border: 0; color: var(--text); outline: none; width: 9rem; }
.search button { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 6px 10px; }

/* Hamburger — hidden on desktop, shown when the nav collapses */
.nav-toggle {
  display: none; margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--gold); font-size: 22px; padding: 6px 8px; line-height: 1;
}

/* ── Headings / hero ─────────────────────────────────────────────────────── */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); margin: 0 0 8px; color: var(--gold); letter-spacing: .3px; }
.hero p { margin: 0; color: var(--textdim); max-width: 60ch; }
.section-title { font-size: 22px; color: var(--gold); margin: 32px 0 14px; }
.breadcrumb { color: var(--textdim); font-size: 14px; margin: 22px 0 6px; }
.breadcrumb a:hover { color: var(--gold); }

/* ── Cinematic home hero (Anubis) ────────────────────────────────────────── */
.cinema {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 22px 0 26px;
  min-height: clamp(420px, 56vh, 600px);
  background:
    radial-gradient(120% 130% at 78% 18%, rgba(140,104,54,.30), transparent 55%),
    radial-gradient(120% 120% at 88% 50%, rgba(125,107,214,.16), transparent 55%),
    radial-gradient(90% 90% at 100% 0%, rgba(201,168,76,.12), transparent 60%),
    #060503;
  display: flex; align-items: center;
}
/* The Anubis figure, anchored to the right and bled into the dark. */
.cinema-art {
  position: absolute; top: 0; right: 0; height: 100%; width: auto; max-width: 62%;
  object-fit: cover; object-position: center top;
  filter: contrast(1.05) saturate(1.05);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 38%);
          mask-image: linear-gradient(90deg, transparent, #000 38%);
}
.cinema-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, #060606 6%, rgba(6,6,6,.72) 42%, rgba(6,6,6,0) 78%),
    linear-gradient(0deg, rgba(6,6,6,.65), transparent 45%);
}
.cinema-inner { position: relative; z-index: 1; padding: clamp(28px, 4vw, 56px); max-width: 640px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--violet); font-weight: 600; font-size: 13px;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 14px;
}
.cinema h1 {
  margin: 0 0 14px; color: var(--gold);
  font-size: clamp(34px, 6vw, 60px); line-height: 1.04; letter-spacing: .5px;
  text-shadow: 0 2px 30px rgba(0,0,0,.6);
}
.cinema-copy p { margin: 0 0 24px; color: var(--text); max-width: 46ch; font-size: 16.5px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-gold { background: var(--gold); color: #1a1407; }
.btn-gold:hover { background: #d8b855; }
.btn-ghost { border-color: var(--border); background: rgba(20,20,20,.6); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold); }

.stats {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0; width: fit-content; max-width: 100%;
  margin: 40px 0 0; padding: 24px 0 0; border-top: 1px solid rgba(255,255,255,.09);
}
.stats li { display: flex; flex-direction: column; gap: 5px; padding: 0 24px; }
.stats li:first-child { padding-left: 0; }
.stats li + li { border-left: 1px solid rgba(255,255,255,.09); }
.stats strong { font-size: 28px; font-weight: 700; color: var(--gold); line-height: 1; }
.stats span { font-size: 11px; color: var(--textdim); text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }

/* ── Category portals ────────────────────────────────────────────────────── */
.portals { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 24px 0 10px; }
.portal {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  transition: border-color .15s, transform .15s;
}
.portal:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.portal-ico { font-size: 24px; color: var(--gold); margin-bottom: 6px; }
.portal-name { font-size: 17px; font-weight: 700; color: var(--text); }
.portal-sub { font-size: 13px; color: var(--textdim); }

/* ── Ankh divider ────────────────────────────────────────────────────────── */
.rule-ankh { display: flex; align-items: center; gap: 18px; margin: 30px auto; max-width: 560px; color: var(--gold); }
.rule-ankh span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border) 40%, var(--gold-dim)); }
.rule-ankh span:last-child { background: linear-gradient(90deg, var(--gold-dim), var(--border) 60%, transparent); }
.rule-ankh i { font-size: 20px; opacity: .9; }

/* ── Flanked section label (centered) ────────────────────────────────────── */
.label-flanked { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; }
.label-flanked span { flex: 1; height: 1px; background: var(--border); }
.label-flanked h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--textdim); }

/* ── Featured civilization (half-width card + sites list) ────────────────── */
.featured-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
@media (max-width: 820px) { .featured-split { grid-template-columns: 1fr; } }

.feature {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  min-height: clamp(300px, 38vh, 420px);
  background: var(--panel-2);
  transition: transform .15s, box-shadow .15s;
}

/* Right half — a few sacred sites for the featured civ */
.feature-sites { display: flex; flex-direction: column; gap: 12px; }
.feature-sites-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.feature-sites-head span { color: var(--textdim); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.feature-sites-head a { color: var(--gold); font-size: 13px; font-weight: 600; white-space: nowrap; }
.mini-site {
  display: flex; align-items: center; gap: 14px; flex: 1; min-height: 0;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); transition: transform .15s, border-color .15s;
}
.mini-site:hover { border-color: var(--gold-dim); transform: translateX(3px); }
.mini-site img { width: 132px; height: 100%; max-height: 110px; min-height: 72px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.mini-site-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mini-site-body strong { color: var(--text); font-size: 16px; line-height: 1.2; }
.mini-site-meta { color: var(--textdim); font-size: 13px; }
.mini-site .tag { margin-left: auto; align-self: flex-start; flex-shrink: 0; }
.feature:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.feature-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-veil { position: absolute; inset: 0; background:
  linear-gradient(0deg, rgba(6,6,6,.95) 8%, rgba(6,6,6,.45) 45%, rgba(6,6,6,.15) 100%),
  radial-gradient(120% 80% at 0% 100%, rgba(6,6,6,.6), transparent 60%); }
.feature-body { position: absolute; inset: auto 0 0 0; padding: clamp(20px, 3vw, 32px); z-index: 1; }
.feature-region { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: rgba(0,0,0,.35); padding: 5px 12px; border-radius: 999px; }
.feature h3 { margin: 12px 0 4px; font-size: clamp(26px, 4vw, 40px); color: #fff; line-height: 1.05; }
.feature-tag { margin: 0 0 14px; color: #e7e2d6; font-style: italic; font-size: 16px; }
.feature-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.feature-period { color: var(--gold); font-weight: 600; font-size: 14px; letter-spacing: .04em; }
.feature-explore { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }

/* Region accent on civ cards (left edge on hover) */
.card { border-left: 3px solid transparent; }
.card:hover { border-left-color: var(--accent); }

/* ── Home "My List" showcase (larger, fancier favorite tiles) ────────────── */
.fav-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  grid-auto-rows: 300px;
}
.fav-tile {
  position: relative; overflow: hidden; border-radius: 18px;
  border: 1px solid var(--border); background: var(--panel-2);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.fav-tile::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
}
.fav-tile:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 20px 54px rgba(0,0,0,.55); }
.fav-tile:hover .civ-tile-bg { transform: scale(1.07); }
.fav-tile .civ-tile-body { padding: 20px 22px; }
.fav-tile h3 { margin: 7px 0 6px; color: #fff; font-size: 25px; line-height: 1.08; }
.fav-tile .fav-btn { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(0,0,0,.5); border-radius: 50%; width: 38px; height: 38px; font-size: 17px; }
.fav-type {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); background: rgba(0,0,0,.42);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.fav-empty { text-align: center; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fav-empty-ico { font-size: 36px; color: var(--gold-dim); }
.fav-empty h3 { margin: 4px 0 0; color: var(--text); font-size: 21px; }
.fav-empty p { margin: 0 0 10px; color: var(--textdim); max-width: 54ch; }
.fav-empty p .fa-star { color: var(--gold); }

/* Saved cards float to the top of their listing grid (favorites.js) and carry a
   subtle gold ring so it's clear why they lead. Works for both the flat .card
   grids (sites, rulers) and the image-forward .civ-tile grid. */
.card.is-fav-card { border-color: color-mix(in srgb, var(--gold) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 22%, transparent); }
.civ-tile.is-fav-card { border-color: color-mix(in srgb, var(--gold) 55%, var(--border)); }
.civ-tile.is-fav-card::after { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
/* Pinned "Saved" group on the Civilizations page */
.region-group--saved .region-head h2 { color: var(--gold); }
.region-group--saved .region-head h2 i { color: var(--gold); font-size: .8em; margin-right: 2px; }
.fav-empty .cta-row { justify-content: center; }
@media (max-width: 640px) { .fav-grid { grid-template-columns: 1fr; grid-auto-rows: 220px; } }

/* ── Continent groups ────────────────────────────────────────────────────── */
.region-group { margin: 34px 0 8px; }
.region-head {
  display: flex; align-items: center; gap: 12px; margin: 0 0 18px;
  padding: 14px 18px; border-radius: var(--radius);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 16%, var(--panel)) 0%,
    var(--panel) 60%);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
}
.region-head .region-dot { width: 13px; height: 13px; }
.region-head h2 { margin: 0; font-size: 26px; color: var(--accent); letter-spacing: .4px; }
.region-count { margin-left: auto; color: var(--textdim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; }
.pill-count { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--textdim); font-size: 11px; font-weight: 700; }
.pill.active .pill-count { background: rgba(0,0,0,.22); color: inherit; }

/* ── Civilizations bento grid ────────────────────────────────────────────── */
.civ-grid {
  display: grid; gap: 16px; grid-auto-flow: dense;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 300px;
}
.civ-tile {
  position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--border); border-left: 3px solid transparent;
  background: var(--panel-2);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.civ-tile:hover { transform: translateY(-3px); border-left-color: var(--accent); box-shadow: 0 14px 38px rgba(0,0,0,.5); }
.civ-tile-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.civ-tile:hover .civ-tile-bg { transform: scale(1.06); }
.civ-tile-ico { position: absolute; inset: 0; display: grid; place-items: center; font-size: 52px; color: var(--gold-dim); background: linear-gradient(160deg, var(--panel), var(--panel-2)); }
.civ-tile-veil { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(6,6,6,.94) 4%, rgba(6,6,6,.40) 52%, rgba(6,6,6,.04) 100%); }
.civ-tile-body { position: absolute; inset: auto 0 0 0; padding: 16px 18px; z-index: 1; }
.civ-tile-region { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.civ-tile h3 { margin: 5px 0 5px; color: #fff; font-size: 20px; line-height: 1.1; }
.civ-tile-tag { margin: 2px 0 8px; color: #e7e2d6; font-style: italic; font-size: 15px; max-width: 44ch; }
.civ-tile-period { color: var(--gold); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; }
.civ-tile .fav-btn { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.5); border-radius: 50%; width: 34px; height: 34px; }

/* Spotlight sizes */
.civ-tile--wide { grid-column: span 2; }
.civ-tile--big  { grid-column: span 2; grid-row: span 2; }
.civ-tile--big h3 { font-size: clamp(26px, 2.4vw, 36px); }

@media (max-width: 1100px) {
  .civ-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 260px; }
}
@media (max-width: 640px) {
  .civ-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 168px; }
  .civ-tile--wide, .civ-tile--big { grid-column: span 2; }
  .civ-tile--big { grid-row: span 2; }
}

@media (max-width: 720px) {
  .cinema-art { max-width: 100%; opacity: .35; }
  .cinema-veil { background: linear-gradient(90deg, #060606 30%, rgba(6,6,6,.6)); }
  .cinema-inner { max-width: none; }
}

/* ── Map (Leaflet) ───────────────────────────────────────────────────────── */
/* Map pin search */
.map-search { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; }
.map-search:focus-within { border-color: var(--gold-dim); }
.map-search-ico { color: var(--gold); font-size: 15px; }
.map-search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text);
  font: inherit; font-size: 15px; outline: none; }
.map-search input::placeholder { color: var(--textdim); }
.map-search-count { color: var(--textdim); font-size: 13px; white-space: nowrap; }
.ta-map { height: 72vh; min-height: 480px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel-2); z-index: 0; }
.civ-map { height: 240px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); z-index: 0; }
/* Site pins float above busy basemaps (terrain/satellite) */
.site-pin { filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
/* Dark, themed Leaflet popups/controls */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.leaflet-popup-content { margin: 10px 14px; font-size: 13.5px; }
.leaflet-container a.map-pop { color: var(--gold); font-weight: 600; }
.map-pop-sub { color: var(--textdim); font-size: 12px; }
.leaflet-container { font: inherit; }
.leaflet-bar a, .leaflet-control-layers { background: var(--panel); color: var(--text); border-color: var(--border); }
.leaflet-bar a { color: var(--gold); }
.leaflet-control-layers-expanded { padding: 8px 10px; color: var(--text); }
.leaflet-control-layers label { margin: 3px 0; }
.leaflet-control-attribution { background: rgba(10,10,10,.7); color: var(--textdim); }
.leaflet-control-attribution a { color: var(--gold-dim); }

/* ── Mysteries (alien lore) ──────────────────────────────────────────────── */
/* 1–5 eye weirdness meter */
.eyes { display: inline-flex; gap: 3px; }
.eyes i { font-size: 12px; color: #3a3a3a; }
.eyes i.on { color: var(--gold); }

/* Index hero — cinematic banner with a background photo (Giza), green accent */
.lore-index-hero { position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--border); min-height: 260px; display: flex; margin-bottom: 22px; }
.lore-index-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lore-index-veil { position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,6,6,.35) 0%, rgba(6,6,6,.72) 55%, rgba(6,6,6,.94) 100%),
    radial-gradient(120% 90% at 15% 0%, color-mix(in srgb, var(--green) 22%, transparent), transparent 60%); }
.lore-index-inner { position: relative; z-index: 1; margin-top: auto; padding: clamp(20px, 3.4vw, 40px); }
.lore-index-inner h1 { margin: 0 0 8px; color: #fff; font-size: clamp(30px, 5vw, 52px); letter-spacing: -.015em; }
.lore-index-inner h1 i { color: var(--green); }
.lore-index-inner p { margin: 0; color: #e7e2d6; font-size: clamp(15px, 1.8vw, 18px); max-width: 62ch; }

/* List cards — a photo of the place on top, green mystery accent */
#lore-grid { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.lore-card { border-left: 3px solid transparent; }
.lore-card:hover { border-left-color: var(--green); }
.lore-card .thumb { aspect-ratio: 16 / 9; }
.lore-card:hover .thumb img { transform: scale(1.04); }
.lore-card .thumb img { transition: transform .4s ease; }
.lore-card .body { padding: 18px 20px 16px; gap: 10px; min-height: 170px; }
.lore-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lore-type { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--green); }
.lore-card h3 { font-size: 20px; line-height: 1.15; }
.lore-card .summary { font-size: 14.5px; line-height: 1.5; color: #d8d3c6; flex: 1; }
.lore-foot { justify-content: space-between; align-items: center; margin-top: auto; }
.lore-more { color: var(--green); font-weight: 600; font-size: 12.5px; opacity: .85; }

/* Detail hero */
.lore-hero { margin: 14px 0 8px; }
/* When a place photo exists, render it as a cinematic banner behind the title */
.lore-hero-img { position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--border); min-height: 320px; display: flex; margin: 14px 0 18px; }
.lore-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lore-hero-veil { position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,6,6,.3) 0%, rgba(6,6,6,.7) 58%, rgba(6,6,6,.95) 100%),
    radial-gradient(120% 90% at 12% 0%, color-mix(in srgb, var(--green) 20%, transparent), transparent 60%); }
.lore-hero-img .lore-hero-inner { position: relative; z-index: 1; margin-top: auto;
  width: 100%; padding: clamp(20px, 3.2vw, 40px); }
.lore-hero-img h1 { color: #fff; }
.lore-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent); padding: 5px 11px; border-radius: 999px; }
.lore-hero h1 { margin: 12px 0 6px; color: #fff; font-size: clamp(26px, 4vw, 40px); }
.lore-hook { color: #e7e2d6; font-style: italic; font-size: 17px; max-width: 68ch; }
.eyes-chip { display: inline-flex; align-items: center; gap: 8px; }
.eyes-chip .k { color: var(--textdim); font-size: 12px; }

/* Section accents: green = the theory side, blue = the mainstream/skeptic side */
.lore-sec-green::before { background: var(--green); }
.lore-sec-green { color: var(--green); }
.lore-sec-blue::before { background: var(--blue); }
.lore-sec-blue { color: var(--blue); }
.bullets-green li::marker { color: var(--green); }
.bullets-blue li::marker { color: var(--blue); }

/* "What's actually interesting" — gold callout */
.lore-interesting { margin: 26px 0 6px; padding: 18px 20px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--gold) 33%, transparent);
  background: color-mix(in srgb, var(--gold) 7%, var(--panel)); }
.lore-interesting h3 { margin: 0 0 8px; color: var(--gold); font-size: 16px; }
.lore-interesting p { margin: 0; color: #e3ded2; font-style: italic; line-height: 1.65; max-width: 72ch; }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.tl-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.tl-legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--textdim); }
.tl-zoom { display: flex; gap: 8px; }
.tl-zoom button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel);
  color: var(--gold); font-size: 15px; cursor: pointer; transition: border-color .15s, background .15s; }
.tl-zoom button:hover { border-color: var(--gold-dim); background: var(--panel-2); }

.tl-scroll { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); scrollbar-color: var(--gold-dim) transparent; }
.tl-canvas { position: relative; min-width: 100%; }

/* Era bands — full-height translucent columns with a label in the axis strip */
.tl-era { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--era) 8%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--era) 40%, transparent); pointer-events: none; }
.tl-era-name { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: color-mix(in srgb, var(--era) 75%, #fff); white-space: nowrap; }

/* Year grid lines + labels */
.tl-grid { position: absolute; top: 40px; bottom: 0; width: 1px; background: rgba(255,255,255,.05); pointer-events: none; }
.tl-year { position: absolute; top: 34px; transform: translateX(-50%); font-size: 11px; color: var(--textdim); white-space: nowrap; pointer-events: none; }

/* Pinned key events */
.tl-event { position: absolute; top: 0; height: 64px; pointer-events: none; }
.tl-event-dot { position: absolute; top: 4px; left: -4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,.18); pointer-events: auto; }
.tl-event::after { content: ''; position: absolute; top: 8px; left: -0.5px; width: 1px; bottom: 0; background: rgba(201,168,76,.18); }
.tl-event-label { position: absolute; top: -2px; left: 10px; font-size: 10.5px; color: var(--gold); background: var(--bg);
  padding: 2px 6px; border-radius: 5px; white-space: nowrap; opacity: 0; transition: opacity .12s; pointer-events: none; }
.tl-event:hover .tl-event-label { opacity: 1; }
.tl-event:hover .tl-event-dot { transform: scale(1.25); }

/* Civilization bars */
.tl-bar { position: absolute; height: 22px; border-radius: 5px; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 30%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); border-left: 3px solid var(--accent);
  display: flex; align-items: center; transition: transform .12s, box-shadow .12s, background .12s; }
.tl-bar:hover { background: color-mix(in srgb, var(--accent) 48%, var(--panel)); transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.5); z-index: 3; }
.tl-bar-label { padding: 0 8px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.7); pointer-events: none; }

/* Stats: a flat row of 4 wraps badly on phones — use a clean 2×2 grid instead */
@media (max-width: 560px) {
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px; width: 100%; margin-top: 32px; }
  .stats li, .stats li:first-child { padding: 0 0 0 16px; border-left: 1px solid rgba(255,255,255,.09); }
  .stats strong { font-size: 26px; }
}

/* ── Filter pills ────────────────────────────────────────────────────────── */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.pill {
  border: 1px solid var(--border); background: var(--panel);
  color: var(--textdim); padding: 6px 14px; border-radius: 999px;
  font-size: 14px; cursor: pointer;
}
.pill.active { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 600; }

/* ── Card grid ───────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* My List: shorter thumbs so more favorites fit on screen (~half height). */
#mylist-sections .card .thumb,
.search-grid .card .thumb { aspect-ratio: 16 / 5; }

/* Sites + Rulers + Pyramids listings use larger, more cinematic cards. */
#site-grid, #ruler-grid, #pyramid-grid { gap: 20px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
#site-grid .body, #ruler-grid .body, #pyramid-grid .body { padding: 16px 18px 18px; gap: 8px; }
#site-grid h3, #ruler-grid h3, #pyramid-grid h3 { font-size: 20px; }
#site-grid .meta, #ruler-grid .meta, #pyramid-grid .meta { font-size: 13.5px; }
#site-grid .summary, #ruler-grid .summary, #pyramid-grid .summary { font-size: 14.5px; line-height: 1.5; }

/* Pyramid cards: rank + height badges over the thumb, comparative height bar. */
#pyramid-grid .card { border-left: 3px solid transparent; }
#pyramid-grid .card:hover { border-left-color: var(--accent); }
.pyr-rank { position: absolute; top: 10px; left: 10px; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--gold); background: rgba(0,0,0,.62); padding: 3px 9px; border-radius: 999px; }
.pyr-height { position: absolute; bottom: 10px; right: 10px; font-size: 15px; font-weight: 800; color: #fff;
  background: rgba(0,0,0,.62); padding: 4px 10px; border-radius: 8px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.pyr-bar { position: relative; height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin: 2px 0; }
.pyr-bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; opacity: .85; }
.pyr-loc { color: var(--textdim); }
#pyramid-grid .meta { flex-wrap: wrap; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 16/10; background: var(--panel-2); position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ico { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: var(--gold-dim); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; font-size: 16px; color: var(--text); }
.card .meta { font-size: 12.5px; color: var(--textdim); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card .summary { font-size: 13.5px; color: var(--textdim); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--textdim); }
.tag.unesco { color: var(--blue); border-color: var(--blue); }
.tag.aa { color: var(--green); border-color: var(--green); }
.tag.must { color: var(--gold); border-color: var(--gold-dim); }
.tag.capital { color: var(--gold); border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent); font-weight: 600; }
.tag.capital i { font-size: 9px; }

/* ── Regional capitals — featured civ sites ──────────────────────────────── */
.section-note { color: var(--textdim); font-size: 14px; margin: -6px 0 16px; max-width: 70ch; line-height: 1.55; }
.cap-star, .section-note .cap-star i { color: var(--gold); }
.section-title i { color: var(--gold); font-size: .85em; }

/* Bigger cards + gold accent so capitals read as the headline sites */
.capitals-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 26px; }
.capital-card { border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--border));
  border-left: 3px solid var(--gold); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 8%, transparent); }
.capital-card:hover { border-color: var(--gold); }
.capital-card .thumb { aspect-ratio: 16 / 9; }
.capital-card h3 { color: var(--gold); }
.capital-badge { position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #1a1407; background: var(--gold);
  padding: 4px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.capital-badge i { font-size: 10px; }
.chip-capital { color: var(--gold); border-color: var(--gold) !important;
  background: color-mix(in srgb, var(--gold) 14%, transparent); font-weight: 600; }

/* Map: star pin for capitals + the pin legend key */
.capital-pin { display: grid; place-items: center; text-align: center; line-height: 1;
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 1px 2px rgba(0,0,0,.8)); }
.capital-pin i { font-size: 20px; -webkit-text-stroke: 1.5px #fff; paint-order: stroke fill; }
.map-key { display: flex; align-items: center; gap: 8px; color: var(--textdim); font-size: 13px; margin: 6px 0 0; }
.map-key-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--gold-dim); border: 2px solid #fff; display: inline-block; }
.map-key-star i, .map-key-star { color: var(--gold); font-size: 14px; }
.map-key-star { margin-left: 8px; }
.region-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ── Civilization hero — cinematic full-bleed banner ─────────────────────── */
.civ-hero {
  position: relative; display: flex; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--border);
  min-height: clamp(380px, 50vh, 560px); margin: 16px 0 30px; background: var(--panel-2);
}
.civ-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.civ-hero-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,.12) 0%, rgba(0,0,0,0) 32%, rgba(7,7,7,.55) 72%, rgba(7,7,7,.94) 100%),
    linear-gradient(72deg, rgba(7,7,7,.82) 0%, rgba(7,7,7,.25) 48%, transparent 66%),
    radial-gradient(130% 90% at 88% -10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%);
}
.civ-hero-back {
  position: absolute; z-index: 2; top: 18px; left: clamp(20px, 3.5vw, 44px);
  display: inline-flex; align-items: center; gap: 7px;
  color: #ece7da; font-size: 13px; font-weight: 600;
  background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.16);
  padding: 7px 14px; border-radius: 999px; backdrop-filter: blur(4px); transition: border-color .15s, color .15s;
}
.civ-hero-back:hover { color: #fff; border-color: var(--accent); }
.civ-hero-inner { position: relative; z-index: 1; margin-top: auto; width: 100%; padding: clamp(22px, 3.6vw, 46px); }
.civ-hero-region {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--accent); font-weight: 700; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: rgba(0,0,0,.4); padding: 6px 13px; border-radius: 999px;
}
.civ-hero h1 { margin: 16px 0 8px; font-size: clamp(36px, 6.4vw, 66px); line-height: 1.01; letter-spacing: -.015em; color: #fff; }
.civ-hero-tag { margin: 0 0 20px; font-style: italic; font-size: clamp(16px, 2.2vw, 22px); color: #ece7da; max-width: 42ch; }
.civ-hero-meta { display: flex; flex-wrap: wrap; gap: 9px 20px; color: #d8d3c6; font-size: 14px; }
.civ-hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.civ-hero-meta i { color: var(--accent); }
.civ-hero-tally { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.civ-hero-tally span {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px; padding: 7px 15px; font-size: 13px; color: #d8d3c6;
}
.civ-hero-tally strong { color: var(--gold); font-size: 15px; font-weight: 800; }
.civ-hero-tally .aa-tag { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.civ-hero-tally .aa-tag i { color: var(--green); }

/* Lead paragraph + section accents on the detail body */
.prose-lead { font-size: 17.5px; line-height: 1.7; color: #e3ded2; max-width: 72ch; }
.section-title { position: relative; padding-left: 14px; }
.section-title::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 3px; background: var(--gold); }
.chip-known { border-color: var(--gold-dim); color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--panel)); }

/* Ancient-astronaut "mystery" callout (green lore accent) */
.mystery-call {
  display: flex; gap: 14px; align-items: flex-start; margin: 22px 0 4px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--green) 7%, var(--panel));
}
.mystery-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); font-size: 18px; }
.mystery-call strong { color: var(--green); display: block; margin-bottom: 3px; }
.mystery-call p { margin: 0; color: #cfd9d2; font-size: 14px; }

/* ── Detail page ─────────────────────────────────────────────────────────── */
.detail-hero { position: relative; border-radius: var(--radius); overflow: hidden; margin: 14px 0 24px; min-height: 260px; background: var(--panel-2); }
.detail-hero img { width: 100%; height: 360px; object-fit: cover; opacity: .8; }
.detail-hero .overlay { position: absolute; inset: auto 0 0 0; padding: 28px 24px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.detail-hero h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 40px); color: #fff; }
.detail-hero .sub { color: var(--gold); font-weight: 600; }

/* Ruler detail: portrait hero uses a region accent, a title badge and a tagline. */
.ruler-hero { border-left: 3px solid var(--accent); }
.ruler-hero-ph { display: grid; place-items: center; height: 360px; font-size: 72px; color: var(--accent);
  background: linear-gradient(160deg, var(--panel), var(--panel-2)); }
.ruler-title-badge { background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent);
  text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; }
.ruler-tagline { margin: 8px 0 0; color: #e7e2d6; font-style: italic; font-size: 16px; max-width: 60ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.prose { max-width: 70ch; color: #d8d3c6; }
.prose p { margin: 0 0 14px; }
.cols { display: grid; gap: 28px; grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.panel h4 { margin: 0 0 10px; color: var(--gold); font-size: 15px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--textdim); }
.list-reset { list-style: none; margin: 0; padding: 0; }
.bullets { margin: 0; padding-left: 18px; color: #d8d3c6; }
.bullets li { margin: 4px 0; }

/* ── Favorite button ─────────────────────────────────────────────────────── */
.fav-btn { background: none; border: 0; color: var(--textdim); cursor: pointer; font-size: 18px; padding: 4px; }
.fav-btn.is-fav { color: var(--gold); }
.card .fav-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.5); border-radius: 50%; width: 34px; height: 34px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 22px 0; color: var(--textdim); font-size: 13px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Mobile nav: collapse links + search into a hamburger dropdown ───────── */
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-collapse {
    display: none;
    position: fixed; top: 64px; left: 0; right: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 4vw 18px;
    background: rgba(12,12,12,.98); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0,0,0,.55);
  }
  .topbar.nav-open .nav-collapse { display: flex; }
  .mainnav { flex-direction: column; gap: 0; margin: 0; }
  .mainnav a { padding: 13px 2px; font-size: 16px; border-bottom: 1px solid var(--border); }
  .mainnav a.is-active::after { display: none; }
  .search { margin: 14px 2px 0; }
  .search input { width: 100%; }
}
