@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

/* ============================================================
   style.css — Stone of Reality shared stylesheet
   Covers: all pages
   Fonts: Cinzel (headings/nav/tags) + EB Garamond (body)
   Body base size: 18px
   ============================================================

   HOW THIS WORKS
   ──────────────
   This file handles all structure, layout, and component rules.
   Each HTML page keeps a small <style> block with only two things:
     1. A :root {} block defining its own color palette
     2. Any rules that are genuinely unique to that page

   Page-specific :root variables used here (every page must define):
     --bg           background base color
     --text         body text color
     --muted        secondary/caption text color
     --accent       primary accent color
     --accent-2     secondary accent / headings
     --border       default border color (rgba recommended)
     --border-strong  hover/active border color
     --shadow       box-shadow value
     --max          max content width (1200px or 1280px)

   Optional variables (define if your page uses them):
     --bg-2         slightly lighter bg for gradients
     --panel        card/panel background color
     --panel-2      secondary panel
     --shadow-soft  lighter shadow for subcards
*/


/* ── RESET & BASE ────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'EB Garamond', Georgia, "Times New Roman", serif;
  color: var(--text);
  line-height: 1.72;
  font-size: 18px;
}

/* Subtle grid texture overlay — present on every page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  color: #ffffff;
}

p { margin-top: 0; }
p:last-child,
ul:last-child { margin-bottom: 0; }

h2, h3, h4 { line-height: 1.2; font-family: 'Cinzel', Georgia, serif; }

h3 {
  margin: 0 0 0.45rem;
  font-size: 1.22rem;
  color: var(--accent-2);
}

h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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


/* ── LAYOUT ──────────────────────────────────────────────── */

/* Pages that use a vignette/z-index stacking context
   (folklore, factions) set position:relative and z-index:1
   on .shell themselves. The base rule handles the rest. */
.shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}


/* ── HEADER ──────────────────────────────────────────────── */

header {
  border-bottom: 1px solid var(--border);
}

.hero {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 4.5rem 0 3rem;
  display: grid;
  gap: 1.2rem;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.75rem;
  font-family: 'Cinzel', Georgia, serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5.2vw, 4.8rem);
  line-height: 0.93;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-family: 'Cinzel', Georgia, serif;
}

.hero p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
  font-size: 1.07rem;
}

/* Index-specific hero layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  align-items: start;
}

.hero-side-grid {
  display: grid;
  gap: 1rem;
}

.hero-card {
  background: linear-gradient(180deg, var(--panel, rgba(255,255,255,0.06)), rgba(0,0,0,0.3));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.hero-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.18rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


/* ── NAV ─────────────────────────────────────────────────── */

nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

nav ul {
  list-style: none;
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.88rem 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.62rem;
}

nav a {
  display: inline-block;
  padding: 0.48rem 0.88rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--accent-2);
  font-size: 0.82rem;
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.04em;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

nav a:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: #ffffff;
}


/* ── MAIN CONTENT ────────────────────────────────────────── */

main {
  padding: 2.2rem 0 4.5rem;
}

section {
  margin-top: 1.4rem;
  scroll-margin-top: 5.5rem;
}

.section-title {
  margin: 0 0 0.3rem;
  font-size: 1.92rem;
  color: var(--accent-2);
  letter-spacing: 0.05em;
  font-family: 'Cinzel', Georgia, serif;
  padding-bottom: 0.6rem;
}

.section-title::after {
  content: "";
  display: block;
  width: 2.8rem;
  height: 2px;
  margin-top: 0.45rem;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 999px;
}

.section-subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}


/* ── CARDS ───────────────────────────────────────────────── */

.card {
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1.3rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 0 1px var(--border-strong);
  border-color: var(--border-strong);
}

.subcard {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  height: 100%;
}


/* ── GRID LAYOUTS ────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.grid-wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.four-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}


/* ── TAG ─────────────────────────────────────────────────── */

.tag {
  display: inline-block;
  margin-bottom: 0.52rem;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-family: 'Cinzel', Georgia, serif;
  /* Default tag — warm gold. Pages can override with .tag-* variants */
  background: linear-gradient(180deg, #d4aa56, #8a6a28);
  color: #1a1208;
}

/* Colored tag variants (used on factions page, available everywhere) */
.tag-blue   { background: linear-gradient(180deg, #5da8c0, #2c6a80); color: #07181e; }
.tag-warm   { background: linear-gradient(180deg, #d4aa56, #8a6a28); color: #1a1208; }
.tag-red    { background: linear-gradient(180deg, #c06050, #7a3028); color: #1a0808; }
.tag-green  { background: linear-gradient(180deg, #5a9e78, #2e6248); color: #061410; }
.tag-gray   { background: linear-gradient(180deg, #8090a0, #485868); color: #080c10; }
.tag-purple { background: linear-gradient(180deg, #9070c0, #503880); color: #100818; }
.tag.gold   { background: linear-gradient(180deg, #cfb16d, #a88845); color: #161616; }


/* ── NOTE / CALLOUT ──────────────────────────────────────── */

.note {
  padding: 0.88rem 1rem;
  border-left: 3px solid var(--border-strong);
  background: rgba(255,255,255,0.04);
  border-radius: 0 12px 12px 0;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 1rem;
}

/* Semantic note variants */
.note-red  { border-left-color: rgba(192, 80, 64, 0.6);  background: rgba(60, 20, 16, 0.28); }
.note-warm { border-left-color: rgba(200,160, 80, 0.5);  background: rgba(50, 36, 14, 0.28); }
.note-blue { border-left-color: rgba(100,180,210, 0.5);  background: rgba(15, 40, 55, 0.28); }


/* ── LISTS ───────────────────────────────────────────────── */

.clean-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.44rem;
}

.clean-list li {
  padding-bottom: 0.44rem;
  border-bottom: 1px dashed rgba(255,255,255,0.07);
}

.clean-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.list-columns {
  columns: 2 240px;
  column-gap: 1.4rem;
  margin: 0;
  padding-left: 1.2rem;
}

.list-columns li {
  break-inside: avoid;
  margin-bottom: 0.34rem;
}


/* ── STATS TABLE (index) ─────────────────────────────────── */

.stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}

.stats li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}

.stats span:first-child { color: var(--muted); }


/* ── JUMP GRID (index city index + hero links) ───────────── */

.jump-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.jump-grid a {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.jump-grid a strong {
  display: block;
  color: var(--accent-2);
  margin-bottom: 0.2rem;
}

.jump-grid a:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px var(--border-strong);
}


/* ── MAP & QR FRAMES (index) ─────────────────────────────── */

.map-frame,
.qr-frame {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.map-frame img,
.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.qr-frame {
  max-width: 190px;
  margin: 0 auto;
  background: #f5efe7;
  padding: 0.5rem;
}


/* ── TIMELINE (timeline page) ────────────────────────────── */

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline .subcard {
  position: relative;
  padding-left: 1.25rem;
}

.timeline .subcard::before {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 1rem;
  bottom: 1rem;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  opacity: 0.8;
}


/* ── DIVIDER ─────────────────────────────────────────────── */

.divider {
  text-align: center;
  color: var(--border-strong);
  font-size: 1.1rem;
  letter-spacing: 0.6em;
  margin: 0.5rem 0 1rem;
  user-select: none;
}


/* ── POEM (folklore page) ────────────────────────────────── */

.poem-card {
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.8rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.poem-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 20px rgba(255,255,255,0.04);
}

.poem-card::before,
.poem-card::after {
  content: "❧";
  position: absolute;
  font-size: 2.4rem;
  color: var(--border-strong);
  line-height: 1;
  opacity: 0.5;
}

.poem-card::before { top: 0.6rem;    left: 0.8rem; }
.poem-card::after  { bottom: 0.6rem; right: 0.8rem; transform: rotate(180deg); }

.poem {
  white-space: pre-line;
  font-style: italic;
  color: var(--accent-2);
  font-size: 1.05rem;
  line-height: 1.9;
  margin: 0.8rem 0 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--border-strong);
}

.poem-source {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
  text-align: right;
}

.saying {
  padding: 0.9rem 1.1rem 0.9rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.03);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--accent-2);
  margin: 0.8rem 0 0;
}

.saying cite {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  font-style: normal;
  color: var(--muted);
}

.legend-entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1rem;
  align-items: start;
}

.legend-glyph {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--border-strong);
  padding-top: 0.1rem;
  opacity: 0.7;
}


/* ── FACTION CARDS (factions page) ──────────────────────── */

.faction-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.faction-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 0 1px var(--border-strong);
  border-color: var(--border-strong);
}

.faction-header {
  padding: 1.2rem 1.4rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.faction-header-left {
  flex: 1;
  min-width: 200px;
}

.faction-body {
  padding: 1.2rem 1.4rem;
}

.faction-body p { margin-top: 0; }
.faction-body p:last-child { margin-bottom: 0; }

.faction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.meta-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}

.person {
  padding: 0.8rem 0;
  border-bottom: 1px dashed var(--border);
}

.person:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.person-name {
  color: var(--accent-2);
  font-weight: bold;
  font-size: 1.02rem;
}

.person-role {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
  margin-bottom: 0.3rem;
}

.slogan {
  font-style: italic;
  color: var(--accent);
  border-left: 2px solid var(--border-strong);
  padding-left: 0.9rem;
  margin: 0.8rem 0 0;
  font-size: 0.96rem;
}


/* ── FOOTER ──────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem 3rem;
  font-size: 0.88rem;
}



/* ── SCROLL REVEAL ANIMATION ─────────────────────────────── */
/* Driven by reveal.js. Elements get .will-reveal on init,   */
/* then .revealed when they enter the viewport.              */
/* prefers-reduced-motion: the JS bails early, so these      */
/* classes are never applied — elements show normally.       */

.will-reveal {
  opacity: 0;
  transform: translateY(20px);
  /* Transition covers both the reveal AND the existing hover  */
  /* lift — whichever fires, the element moves smoothly.       */
  transition:
    opacity    0.52s ease,
    transform  0.52s ease;
}

.revealed {
  opacity: 1;
  transform: translateY(0);
  /* Keep transition so hover still works after reveal.        */
  /* transitionDelay is set inline by JS and cleared here so   */
  /* hover doesn't inherit the stagger delay.                  */
  transition:
    opacity    0.52s ease,
    transform  0.52s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
  transition-delay: 0s !important;
}

/* Cards that are also .revealed should still honour           */
/* their own hover transitions without fighting the reveal.    */
.card.revealed,
.faction-card.revealed,
.poem-card.revealed {
  /* The hover transform is on top of translateY(0),           */
  /* so it still works correctly.                              */
  transition:
    opacity      0.52s ease,
    transform    0.22s ease,
    box-shadow   0.22s ease,
    border-color 0.22s ease;
  transition-delay: 0s !important;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .qr-frame {
    max-width: 160px;
  }
}

@media (max-width: 600px) {
  .list-columns {
    columns: 1;
  }

  .faction-header {
    flex-direction: column;
  }
}
