/* Ellowyn Chronicles: Realms of Ruin — site stylesheet
   Design tokens, grounded in the existing PDF palette:
   Base:    #0D0B1E (void), #14122A (panel), #1C1936 (panel-raised)
   Text:    #EDEAE2 (parchment), #9C97AE (muted)
   Purple:  #7F77DD / #3C3489  — Rift, Arcane, general accent
   Coral:   #D85A30 / #712B13  — Doom, Danger, Dark Pacts
   Teal:    #2BB58C / #085041  — Nature, Common, Safe
   Amber:   #D89A3E / #633806  — Warning, Grim, Gold
   Display: 'Cormorant Garamond' — literary, restrained, not stock-fantasy
   Body:    'Work Sans'
*/

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --void: #0D0B1E;
  --panel: #14122A;
  --panel-raised: #1C1936;
  --border: #2C2850;
  --parchment: #EDEAE2;
  --muted: #9C97AE;

  --purple: #7F77DD;
  --purple-deep: #3C3489;
  --coral: #D85A30;
  --coral-deep: #712B13;
  --teal: #2BB58C;
  --teal-deep: #085041;
  --amber: #D89A3E;
  --amber-deep: #633806;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(127,119,221,0.14), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(216,90,48,0.08), transparent);
  color: var(--parchment);
  font-family: 'Work Sans', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--parchment);
  margin: 0 0 0.4em 0;
}

h1 { font-size: 3rem; line-height: 1.05; }
h2 { font-size: 2rem; margin-top: 2.2em; }
h3 { font-size: 1.4rem; font-weight: 600; }

p { color: var(--parchment); }
.muted { color: var(--muted); }

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ── Top nav ─────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: rgba(13,11,30,0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
}
.topnav .brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--parchment);
  margin-right: 0.5rem;
  flex-shrink: 0;
}
.topnav .brand:hover { text-decoration: none; color: var(--purple); }
.topnav a.navlink {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  flex-shrink: 0;
}
.topnav a.navlink:hover, .topnav a.navlink.active {
  color: var(--parchment);
  text-decoration: none;
  border-bottom-color: var(--purple);
}

/* ── Layout ──────────────────────────────────────────── */
.wrap { max-width: 980px; margin: 0 auto; padding: 0 1.5rem 5rem; }
.wrap-wide { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem 5rem; }

.hero {
  padding: 4.5rem 1.5rem 2rem;
  text-align: center;
}
.hero .eyebrow {
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--coral); font-weight: 600; margin-bottom: 0.8rem;
}
.hero h1 { font-size: 3.4rem; }
.hero .tagline {
  max-width: 640px; margin: 1rem auto 0;
  color: var(--muted); font-size: 1.08rem;
}

/* ── Doom Track signature element ───────────────────── */
.doomtrack { display: flex; gap: 3px; max-width: 760px; margin: 2.5rem auto 0.6rem; }
.doomtrack .cell {
  flex: 1; aspect-ratio: 1 / 1.15;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.1rem;
  border: 1px solid rgba(255,255,255,0.08);
  animation: rise 0.6s backwards ease-out;
}
.doomtrack .cell:nth-child(n) { animation-delay: calc(var(--i) * 0.04s); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.doomtrack .safe { background: rgba(43,181,140,0.16); color: var(--teal); }
.doomtrack .grim { background: rgba(216,154,62,0.16); color: var(--amber); }
.doomtrack .forsaken { background: rgba(216,90,48,0.2); color: var(--coral); }
.doomtrack-caption { text-align: center; font-size: 0.8rem; color: var(--muted); }
.doomtrack-caption b { color: var(--parchment); }

/* ── Section nav grid (index page) ──────────────────── */
.section-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.section-card {
  display: block; padding: 1.2rem 1.3rem;
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.section-card:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: var(--accent, var(--purple));
  background: var(--panel-raised);
}
.section-card .count {
  font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.7rem;
  color: var(--accent, var(--purple));
}
.section-card .label { display: block; margin-top: 0.15rem; font-weight: 600; color: var(--parchment); }
.section-card .desc { display: block; margin-top: 0.3rem; font-size: 0.82rem; color: var(--muted); }

/* ── Cards (generic content card used across section pages) ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--purple));
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.card h3 { margin-bottom: 0.3rem; }
.card .meta { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.6rem; }
.card .tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  background: rgba(127,119,221,0.16); color: var(--purple);
  margin-right: 0.4rem;
}
.card .flavour { font-style: italic; color: var(--muted); font-size: 0.9rem; margin-top: 0.6rem; }
.card .stat-row { display: flex; gap: 1.2rem; margin: 0.5rem 0; flex-wrap: wrap; }
.card .stat { font-size: 0.85rem; }
.card .stat b { color: var(--parchment); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Rule blocks (index rules primer) ───────────────── */
.rule-block { margin-bottom: 1.6rem; }
.rule-block .rb-label { font-weight: 600; color: var(--accent, var(--purple)); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); margin: 3rem 0; }

footer { text-align: center; padding: 3rem 1.5rem 2rem; color: var(--muted); font-size: 0.82rem; }

.pill-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.pill { font-size: 0.78rem; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }

/* ── Download links ──────────────────────────────────────── */
.dl-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 8px;
  background: rgba(127,119,221,0.14); color: var(--purple);
  border: 1px solid rgba(127,119,221,0.35);
  margin-top: 1.2rem;
}
.dl-btn:hover { text-decoration: none; background: rgba(127,119,221,0.24); }
.dl-btn .arrow { font-size: 0.9rem; }
.dl-row { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 1.2rem; }
.dl-row .dl-btn { margin-top: 0; }
.downloads-list .card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.downloads-list .card h3 { margin: 0; }
.downloads-list .card .desc { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }

/* ── Tile images ──────────────────────────────────────────── */
.tile-image {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 8px; margin-bottom: 0.9rem;
  border: 1px solid var(--border);
}
.card.tile-card { padding-top: 1rem; }

/* Tier / element color helpers, reused per section */
.tier-common { --accent: var(--teal); }
.tier-elite { --accent: var(--amber); }
.tier-boss { --accent: var(--coral); }
