@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cinzel+Decorative:wght@400;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Fira+Code:wght@400&family=Caveat:wght@400;500;600;700&display=swap');

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

:root {
  --bg-deep: #0a0a0f;
  --bg-surface: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #222233;
  --border: #2a2a3d;
  --border-accent: #3d3524;
  --text: #c8c0b0;
  --text-dim: #a8997d;
  --text-heading: #e8dcc8;
  --accent-gold: #c9a84c;
  --accent-gold-dim: #8a7434;
  --font-display: 'Cinzel', Georgia, serif;
  --font-display-ornate: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --font-body: 'Crimson Pro', Georgia, serif;
  --font-mono: 'Fira Code', monospace;
  --max-width: 820px;
  --max-width-wide: 1100px;
}

html { font-size: 18px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 15% 30%, rgba(100,80,40,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 70%, rgba(60,40,80,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-heading); font-weight: 600; line-height: 1.3; }
h1 { font-size: 2rem; letter-spacing: 0.04em; }
h2 { font-size: 1.5rem; letter-spacing: 0.03em; }
h3 { font-size: 1.15rem; }

a { color: var(--accent-gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-heading); }

p { margin-bottom: 1.25rem; }
p:last-child { margin-bottom: 0; }

blockquote {
  border-left: 3px solid var(--accent-gold-dim);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: rgba(201,168,76,0.04);
  font-style: italic;
  color: var(--text-dim);
}

/* Ornamental Dividers */
.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 2rem auto;
  width: 200px;
}
.divider-ornament::before,
.divider-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold-dim), transparent);
}
.divider-ornament .ornament { color: var(--accent-gold-dim); font-size: 1rem; line-height: 1; }

.divider-line { width: 80px; height: 1px; background: var(--accent-gold-dim); margin: 2rem auto; }

/* Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: 0.05em;
}
.site-brand:hover { color: var(--accent-gold); }
.brand-icon { font-size: 1.3rem; }

.site-nav { display: flex; gap: 0.25rem; }
.nav-link {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--accent-gold); background: rgba(201,168,76,0.08); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-dim); transition: transform 0.2s, opacity 0.2s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Page Layout */
.page-content { position: relative; z-index: 1; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: var(--max-width-wide); margin: 0 auto; padding: 0 1.5rem; }

/* Home Hero */
.hero { position: relative; text-align: center; overflow: hidden; }
.hero-image {
  width: 100%;
  height: 380px;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  filter: brightness(0.4) saturate(0.7);
}
.hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4rem 1.5rem 3rem;
  background: linear-gradient(to bottom, transparent 0%, rgba(10,10,15,0.7) 30%, var(--bg-deep) 100%);
}
.hero-title {
  font-family: var(--font-display-ornate);
  font-size: 3rem;
  color: var(--text-heading);
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 30px rgba(0,0,0,0.8);
}
.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.hero-description {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* Session List */
.sessions-section { padding: 2rem 0 5rem; }
.section-heading {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
}
.session-list { display: flex; flex-direction: column; gap: 1px; }
.session-card {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: none;
  margin-bottom: 0.5rem;
}
.session-card:hover { background: var(--bg-card-hover); border-color: var(--border-accent); transform: translateX(4px); }
.session-number { font-family: var(--font-display); font-size: 0.75rem; color: var(--accent-gold-dim); letter-spacing: 0.05em; white-space: nowrap; min-width: 70px; }
.session-info { flex: 1; min-width: 0; }
.session-card-title { font-family: var(--font-display); font-size: 1rem; color: var(--text-heading); margin-bottom: 0.25rem; }
.session-teaser { font-size: 0.85rem; color: var(--text-dim); font-style: italic; line-height: 1.5; }
.session-date { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }

/* Session Page */
.session-header { padding: 4rem 0 2rem; text-align: center; border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.session-header .session-number { display: block; font-size: 0.8rem; margin-bottom: 0.5rem; }
.session-header h1 { margin-bottom: 0.5rem; }
.session-header .session-date { font-size: 0.8rem; }
.session-body { padding-bottom: 3rem; }
.session-body p { font-size: 1rem; text-indent: 1.5rem; }
.session-body p:first-of-type { text-indent: 0; }
.session-body p:first-of-type::first-letter {
  font-family: var(--font-display-ornate);
  font-size: 3.4rem;
  float: left;
  line-height: 1;
  padding-right: 0.15rem;
  padding-top: 0.05rem;
  color: var(--accent-gold);
}

/* Creature Images */
.creature-figure {
  float: right;
  margin: 0.25rem 0 1rem 1.5rem;
  width: 360px;
  text-align: center;
  background: var(--bg-card);
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(201,168,76,0.08), inset 0 0 0 1px rgba(201,168,76,0.1);
}
.creature-figure img {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: contain;
  display: block;
  border: 1px solid var(--border-accent);
}
.creature-figure figcaption {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent-gold);
  margin-top: 0.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.session-body::after {
  content: '';
  display: table;
  clear: both;
}

/* Session Nav */
.session-nav { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0; border-top: 1px solid var(--border); margin-top: 2rem; }
.session-nav-link { display: flex; flex-direction: column; padding: 0.75rem 1rem; border-radius: 6px; border: 1px solid var(--border); transition: border-color 0.2s, background 0.2s; max-width: 48%; text-decoration: none; }
.session-nav-link:hover { border-color: var(--border-accent); background: var(--bg-card); }
.session-nav-link.next { text-align: right; margin-left: auto; }
.session-nav-link.placeholder { border: none; }
.session-nav-label { font-family: var(--font-display); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-gold-dim); }
.session-nav-title { font-size: 0.85rem; color: var(--text); margin-top: 0.15rem; }

/* Characters Page */
.page-header { padding: 4rem 0 2rem; text-align: center; border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.page-intro { font-style: italic; color: var(--text-dim); text-align: center; max-width: 640px; margin: 0 auto 3rem; }

.character-section-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-dim);
  margin: 2.5rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.character-entry { padding: 2rem 0; border-bottom: 1px solid var(--border); }
.character-entry:last-child { border-bottom: none; }
.character-name { font-family: var(--font-display); font-size: 1.3rem; color: var(--accent-gold); margin-bottom: 0.25rem; }
.character-meta { font-size: 0.8rem; color: var(--text-dim); font-style: italic; margin-bottom: 1rem; }
.character-entry p { font-size: 0.95rem; }

/* Stat block */
.stat-block {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.stat-item { text-align: center; }
.stat-label { font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-gold-dim); display: block; }
.stat-value { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-heading); font-weight: 600; }
.stat-mod { font-size: 0.7rem; color: var(--text-dim); }

/* Character detail grid */
.char-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 2rem; margin: 1rem 0; font-size: 0.85rem; }
.char-detail-label { color: var(--text-dim); font-size: 0.75rem; font-family: var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; }
.char-detail-value { color: var(--text); margin-bottom: 0.5rem; }

/* Equipment list */
.equipment-list { list-style: none; margin: 0.5rem 0; padding: 0; }
.equipment-list li { font-size: 0.85rem; color: var(--text); padding: 0.25rem 0; padding-left: 1rem; position: relative; }
.equipment-list li::before { content: '◆'; position: absolute; left: 0; color: var(--accent-gold-dim); font-size: 0.5rem; top: 0.45rem; }

/* Locations Page */
.location-group { margin-bottom: 1rem; }
.location-parent {
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-gold-dim);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}
.location-parent:hover { background: var(--bg-card-hover); }
.location-parent-name { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-heading); margin-bottom: 0.25rem; }
.location-parent-desc { font-size: 0.85rem; color: var(--text-dim); font-style: italic; }
.location-toggle { font-size: 0.7rem; color: var(--accent-gold-dim); float: right; font-family: var(--font-display); letter-spacing: 0.05em; transition: transform 0.2s; }
.location-toggle.open { transform: rotate(90deg); }

.location-children {
  margin-left: 1.5rem;
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease;
}
.location-children.open { max-height: 2000px; }
.location-child { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.location-child:last-child { border-bottom: none; }
.location-child-name { font-family: var(--font-display); font-size: 0.9rem; color: var(--accent-gold); margin-bottom: 0.15rem; }
.location-child-desc { font-size: 0.8rem; color: var(--text-dim); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 2.5rem 1.5rem; text-align: center; }
.footer-text { font-family: var(--font-display); font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.06em; }
.footer-sub { font-size: 0.7rem; color: var(--text-dim); opacity: 0.5; margin-top: 0.25rem; }

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .hero-title { font-size: 2.2rem; }
  .hero-image { height: 260px; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: rgba(10,10,15,0.97); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); }
  .site-nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .session-card { flex-direction: column; gap: 0.5rem; }
  .session-nav { flex-direction: column; }
  .session-nav-link { max-width: 100%; }
  .session-nav-link.next { text-align: left; }
  .creature-figure { float: none; width: 360px; max-width: 100%; margin: 1.5rem auto; }
  .stat-block { grid-template-columns: repeat(3, 1fr); }
  .char-details { grid-template-columns: 1fr; }
}

/* Session Summary */
.session-summary {
  max-width: 640px;
  margin: 0 auto 0;
  padding: 0 1rem;
  text-align: center;
}
.session-summary p {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.8;
  text-indent: 0;
}

/* Loot Table */
.loot-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.85rem; }
.loot-table th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold-dim);
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
}
.loot-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.loot-table tr:hover td { background: rgba(201,168,76,0.03); }
.loot-item { color: var(--text-heading); font-weight: 500; }
.loot-source { color: var(--text-dim); font-size: 0.8rem; }
.loot-source a { color: var(--accent-gold-dim); }
.loot-holder { color: var(--text); }
.loot-note { color: var(--text-dim); font-style: italic; font-size: 0.8rem; }
.loot-status-active { color: #7a9e5a; }
.loot-status-consumed { color: var(--text-dim); text-decoration: line-through; }
.loot-status-lost { color: #8b3a3a; }
.loot-status-unknown { color: var(--text-dim); }
.loot-filter { margin-bottom: 1.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.loot-filter-btn {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.loot-filter-btn:hover, .loot-filter-btn.active {
  border-color: var(--accent-gold-dim);
  color: var(--accent-gold);
}
.loot-footnote { font-size: 0.8rem; color: var(--text-dim); font-style: italic; margin-top: 1rem; }

/* Utility Classes */
.location-parent--static { cursor: default; }
.character-equipment { margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-dim); }
.character-equipment strong { color: var(--accent-gold-dim); }
.session-body--flush { padding-top: 0; }

/* Location Button Reset */
button.location-parent {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  border: none;
  appearance: none;
}

/* Screen Reader Only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Loot Responsive */
@media (max-width: 768px) {
  .loot-table { font-size: 0.8rem; }
  .loot-table th, .loot-table td { padding: 0.4rem 0.5rem; }
  .loot-col-note { display: none; }
}
@media (max-width: 480px) {
  .loot-table { font-size: 0.75rem; }
  .loot-col-source { display: none; }
}

/* Loose Threads — Notebook */
.notebook {
  position: relative;
  padding: 2.5rem 2rem;
}
.notebook-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #d4c9a8 0%, #cfc3a0 40%, #c8ba96 100%);
  box-shadow: 2px 3px 12px rgba(0,0,0,0.5), -1px -1px 6px rgba(0,0,0,0.2);
  filter: url(#torn-edges);
  z-index: 0;
}
/* paper texture — subtle stain/aging spots */
.notebook-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 85% 8%, rgba(70,35,10,0.25) 0%, rgba(90,50,15,0.1) 30%, transparent 55%),
    radial-gradient(ellipse at 10% 75%, rgba(80,40,10,0.2) 0%, rgba(95,55,20,0.08) 35%, transparent 50%),
    radial-gradient(ellipse at 92% 65%, rgba(75,38,12,0.18) 0%, rgba(85,48,18,0.06) 30%, transparent 45%),
    radial-gradient(ellipse at 40% 15%, rgba(90,55,20,0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 55% 90%, rgba(85,45,15,0.15) 0%, rgba(90,50,18,0.05) 35%, transparent 50%);
  pointer-events: none;
}
/* red margin line */
.notebook::before {
  content: '';
  position: absolute;
  top: 0;
  left: 3rem;
  bottom: 0;
  width: 1px;
  background: rgba(140,60,60,0.3);
  z-index: 2;
}
.notebook-page {
  padding-left: 1.5rem;
  position: relative;
  z-index: 3;
}

.notebook-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: #3a2a18;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.notebook-subtext {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #453826;
  margin-bottom: 1.25rem;
  font-style: normal;
}
.notebook-rule {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(60,40,20,0.2), transparent);
  margin: 2rem 0;
}

.thread-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.thread-item {
  position: relative;
  padding: 0.6rem 0 0.6rem 1.4rem;
  border-bottom: 1px solid rgba(60,40,20,0.08);
  transition: background 0.2s;
}
.thread-item:last-child { border-bottom: none; }
.thread-item:hover { background: rgba(60,40,20,0.05); }

.thread-item::before {
  content: '—';
  position: absolute;
  left: 0;
  top: 0.75rem;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #8a7a60;
  line-height: 1;
}
.thread-item.thread-urgent::before {
  color: #8b3a2a;
}
.thread-item.thread-done::before {
  content: '—';
  color: #4a6838;
}

.thread-name {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 600;
  color: #2a1e10;
  display: block;
  line-height: 1.3;
}
.thread-item.thread-done .thread-name {
  text-decoration: line-through;
  text-decoration-color: rgba(74,104,56,0.7);
  text-decoration-thickness: 2px;
  color: #8a7e6a;
}
.thread-detail {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  color: #362a1a;
  display: block;
  line-height: 1.5;
  margin-top: 0.1rem;
}
.thread-item.thread-done .thread-detail {
  opacity: 0.5;
}
.thread-source {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: #8a7a60;
  display: block;
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.thread-item.thread-urgent .thread-name {
  color: #8b3a2a;
}

@media (max-width: 768px) {
  .notebook { padding: 1.5rem 1rem; }
  .notebook::before { left: 1.5rem; }
  .notebook-page { padding-left: 1rem; }
  .notebook-heading { font-size: 1.5rem; }
}

/* Print */
@media print {
  body::before, .site-header, .site-footer, .nav-toggle, .session-nav, .loot-filter { display: none; }
  body { background: #fff; color: #111; }
  h1, h2, h3, h4, .character-name, .location-parent-name { color: #111; }
  .page-header { border-bottom-color: #ccc; }
  a { color: #333; text-decoration: underline; }
  .session-body p, .character-entry p, .location-parent-desc, .location-child-desc { color: #222; }
  .loot-table th { color: #555; border-bottom-color: #ccc; }
  .loot-table td { border-bottom-color: #ddd; }
  .loot-table tr:hover td { background: none; }
  .notebook-bg { filter: none; background: #f5f0e0; box-shadow: none; }
  .notebook-bg::after { display: none; }
  .notebook-heading, .thread-name { color: #111; }
  .notebook-subtext, .thread-detail, .thread-source { color: #444; }
  .creature-figure { border-color: #ccc; background: #f9f9f9; box-shadow: none; }
  .creature-figure img { border-color: #ccc; }
}
