/* ============================================
   OZ SOURCE: A Visual Study Guide
   Aesthetic: Aged paper, sepia, bookish
   Sister site to the Wicked study guide
   ============================================ */

:root {
  /* Aged-paper palette - distinct from the Wicked site's emerald/magenta */
  --paper:        #f4ead4;   /* warm cream */
  --paper-light:  #faf2dc;   /* lighter cream */
  --paper-dark:   #e8d8a8;   /* darker edge */
  --ink:          #2a1f0e;   /* deep sepia ink */
  --ink-soft:     #5a4423;   /* faded ink */
  --ink-faint:    #8a6f3e;   /* aged ink */
  --accent:       #6b3410;   /* burnt sienna */
  --accent-soft:  #9a5a2a;   /* lighter sienna */
  --gold:         #a07a2c;   /* old gold */
  --rule:         #c4a455;   /* gilt rule */
  --shadow:       rgba(60, 30, 0, 0.15);

  --font-serif:   'Iowan Old Style', 'Hoefler Text', 'Garamond', 'Georgia', serif;
  --font-display: 'Cinzel', 'Trajan Pro', 'Iowan Old Style', serif;
  --font-script:  'Apple Chancery', 'Snell Roundhand', 'Apple Color Emoji', cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  position: relative;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.65;
  /* Subtle paper texture using SVG */
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(160, 122, 44, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(107, 52, 16, 0.05), transparent 50%);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent-soft); }
a:hover { color: var(--accent-soft); border-bottom-style: solid; }

/* ============ Header ============ */
.site-header {
  background: linear-gradient(180deg, var(--paper-light), var(--paper));
  border-bottom: 3px double var(--rule);
  padding: 1.25rem 0;
  text-align: center;
  position: relative;
}
.site-header::before, .site-header::after {
  content: '❦';
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--gold); font-size: 1.5rem;
}
.site-header::before { left: 1.5rem; }
.site-header::after  { right: 1.5rem; }

.site-title {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700; letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
}
.site-tagline {
  margin: 0.3rem 0 0; font-style: italic;
  color: var(--ink-soft); font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* ============ Nav ============ */
.site-nav {
  background: var(--paper-light);
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 0;
}
.site-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.5rem;
}
.site-nav a {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: none;
  padding: 0.3rem 0.5rem;
  transition: color 0.2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--accent); }

/* ============ Main ============ */
main { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); letter-spacing: 0.03em; }
h1 { font-size: 2.2rem; margin: 0 0 0.5rem; text-align: center; }
h1::after { content: ''; display: block; width: 80px; height: 1px; background: var(--rule); margin: 0.6rem auto 0; }
h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; color: var(--accent); }
p { margin: 0.8rem 0; }
.lede { font-style: italic; text-align: center; font-size: 1.05rem; color: var(--ink-soft); max-width: 720px; margin: 1rem auto 2rem; }

/* ============ Cards / Grids ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.card {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1rem;
  display: flex; flex-direction: column;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px var(--shadow); }
.card .img-wrap {
  width: 100%; aspect-ratio: 4/5;
  background: var(--paper);
  margin-bottom: 0.8rem;
  overflow: hidden; border: 1px solid var(--paper-dark);
  display: flex; align-items: center; justify-content: center;
}
.card .img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card .meta { font-size: 0.8rem; color: var(--ink-faint); font-style: italic; margin-bottom: 0.4rem; }
.card p { font-size: 0.95rem; color: var(--ink-soft); }

/* ============ Two-column layout ============ */
.two-col { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 2rem; margin: 0; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; gap: 1rem; } }

/* Image column in two-col: properly contained, framed, no bleed */
.two-col .img-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--paper);
  overflow: hidden;
  border: 1px solid var(--paper-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow);
}
.two-col .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

/* ============ Hero ============ */
.hero {
  position: relative;
  text-align: center;
  padding: 0;
  margin-bottom: 2rem;
  border: 1px solid var(--rule);
  background:
    url('../images/books/wwz_denslow_cover.jpg') center/cover no-repeat,
    linear-gradient(180deg, var(--paper-light), var(--paper));
  overflow: hidden;
}
/* Inner panel: solid backing so text always sits on a clean surface */
.hero::after {
  content: '';
  position: absolute;
  inset: 12px;
  z-index: 0;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  box-shadow: 0 2px 12px var(--shadow);
}
.hero > * {
  position: relative;
  z-index: 1;
  padding: 2rem 2.5rem;
}
.hero h1 { margin-bottom: 0.5rem; }

/* Hero figure row — three source-material images below the hero */
.hero-figure-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 0 0 2rem;
  padding: 0 1rem;
}
.hero-fig {
  margin: 0;
  text-align: center;
}
.hero-fig img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border: 3px solid var(--paper-dark);
  box-shadow: 0 2px 10px var(--shadow);
  display: block;
  filter: sepia(0.15) saturate(0.9);
}
.hero-fig figcaption {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}
@media (max-width: 640px) {
  .hero-figure-row { grid-template-columns: 1fr; }
  .hero-fig img { height: 180px; }
}

/* ============ Pull quote ============ */
.pull-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  text-align: center;
  color: var(--accent);
  margin: 2rem auto;
  padding: 1rem 2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  max-width: 720px;
  line-height: 1.5;
}
.pull-quote::before { content: '“'; font-size: 3rem; color: var(--gold); display: block; line-height: 0.5; margin-bottom: 0.5rem; }
.pull-quote::after  { content: '”'; font-size: 3rem; color: var(--gold); display: block; line-height: 0.1; margin-top: 0.3rem; }

/* ============ Source / book entries ============ */
.source-entry {
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
}
.source-entry h3 { margin-top: 0; color: var(--ink); }
.source-entry .meta { color: var(--ink-faint); font-size: 0.85rem; font-style: italic; }
.source-entry .used { color: var(--accent); font-size: 0.9rem; margin-top: 0.5rem; }

/* ============ Character index ============ */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.character-card {
  text-align: center;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  padding: 0.8rem;
  transition: transform 0.2s;
}
.character-card:hover { transform: translateY(-2px); }
.character-card .img-wrap {
  width: 100%; aspect-ratio: 1/1;
  background: var(--paper);
  margin-bottom: 0.6rem;
  overflow: hidden; border: 1px solid var(--paper-dark);
}
.character-card .img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.character-card h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.character-card .role { font-size: 0.8rem; color: var(--ink-faint); font-style: italic; }

/* ============ Cross-link banner ============ */
.crosslink {
  background: linear-gradient(90deg, transparent, var(--paper-light), transparent);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.2rem;
  text-align: center;
  margin: 2.5rem 0 1.5rem;
}
.crosslink p { margin: 0.2rem 0; }
.crosslink a { font-family: var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; }

/* ============ Tables ============ */
.book-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.book-table th, .book-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); text-align: left; }
.book-table th { background: var(--paper-light); font-family: var(--font-display); font-weight: 600; color: var(--accent); }
.book-table tr:hover { background: rgba(160, 122, 44, 0.06); }

/* ============ Lightbox ============ */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(20, 10, 0, 0.92); z-index: 1000; align-items: center; justify-content: center; padding: 2rem; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; box-shadow: 0 4px 30px rgba(0,0,0,0.6); }
.lightbox .caption { color: var(--paper); margin-top: 0.5rem; font-style: italic; text-align: center; }
.lightbox-close { position: absolute; top: 1rem; right: 1.5rem; color: var(--paper); font-size: 2.5rem; cursor: pointer; border: none; background: none; }

/* ============ Footer ============ */
.site-footer {
  background: var(--paper-light);
  border-top: 3px double var(--rule);
  padding: 1.5rem 1rem;
  text-align: center;
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.site-footer p { margin: 0.3rem 0; }

/* ============ Theme toggle (sister to Wicked) ============ */
.theme-toggle {
  position: absolute; top: 1rem; right: 1rem; z-index: 999;
  background: var(--paper-light);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-soft);
}
.theme-toggle:hover { color: var(--accent); }
body.theme-twilight {
  background: #1a1408;
  color: #d8c89a;
  --paper: #1a1408;
  --paper-light: #2a2010;
  --paper-dark: #3a2c18;
  --ink: #d8c89a;
  --ink-soft: #b8a878;
  --ink-faint: #88704a;
  --accent: #d4a05a;
  --accent-soft: #e8bc7a;
  --gold: #d4a05a;
  --rule: #6a4f2a;
  --shadow: rgba(0, 0, 0, 0.5);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(212, 160, 90, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(232, 188, 122, 0.05), transparent 50%);
}
body.theme-twilight .card,
body.theme-twilight .source-entry,
body.theme-twilight .character-card,
body.theme-twilight .hero {
  background: var(--paper-light);
  border-color: var(--rule);
}

/* ============ Misc ============ */
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
.text-center { text-align: center; }
.italic { font-style: italic; }
.fade { color: var(--ink-faint); }
.ornament { text-align: center; color: var(--gold); font-size: 1.3rem; margin: 1rem 0; }
