/* ===================================================================
   OccultWorldLedger — Design System
   Dark editorial aesthetic. Typography does the work.
   =================================================================== */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #0d0d0d;
  --surface:     #141414;
  --surface-2:   #1a1a1a;
  --text:        #f5f0e8;
  --text-muted:  #9a9488;
  --gold:        #c9a84c;
  --gold-dim:    #7a6330;
  --crimson:     #8b1a1a;
  --border:      #2a2a2a;
  --border-light:#333333;

  --font-serif:  'Libre Baskerville', 'Crimson Text', Georgia, serif;
  --font-body:   'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Courier New', monospace;

  --max-w:       1200px;
  --content-w:   720px;
  --gutter:      clamp(1.5rem, 5vw, 4rem);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--text); }
ul, ol { list-style: none; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 0; }

/* ── Selection ───────────────────────────────────────────────────── */
::selection { background: var(--gold); color: var(--bg); }

/* ── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); }

p { margin-bottom: 1.5em; }
p:last-child { margin-bottom: 0; }

blockquote {
  border-left: 2px solid var(--gold-dim);
  padding: 0.5em 0 0.5em 1.5em;
  margin: 2em 0;
  color: var(--text-muted);
  font-style: italic;
}
blockquote p { margin-bottom: 0.5em; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em auto;
  width: 60%;
}

/* ── Layout helpers ─────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.content-width {
  max-width: var(--content-w);
  margin: 0 auto;
}

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--gutter);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
}
.site-logo span {
  color: var(--text-muted);
  font-size: 0.6em;
  display: block;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s;
}
.site-nav a:hover,
.site-nav a.active { color: var(--gold); }

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--border);
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  max-width: 900px;
}
.hero-excerpt {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin-bottom: 2rem;
  line-height: 1.7;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.hero-image-wrap {
  margin-top: 3rem;
  aspect-ratio: 16/7;
  overflow: hidden;
  border: 1px solid var(--border);
}
.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8) contrast(1.05);
}

/* ── Article Grid ───────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.section-link {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2px;
}

/* ── Article Card ───────────────────────────────────────────────── */
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
  position: relative;
}
.article-card:hover { border-color: var(--gold-dim); }
.article-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px;
  height: 0;
  background: var(--gold);
  transition: height 0.3s;
}
.article-card:hover::before { height: 100%; }

.card-category {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 0.75rem;
}
.card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--gold); }
.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}
.card-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.read-more {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.75) contrast(1.1);
  transition: filter 0.3s, transform 0.4s;
}
.article-card:hover .card-image img {
  filter: brightness(0.9) contrast(1.05);
  transform: scale(1.02);
}

/* ── Article Page ──────────────────────────────────────────────── */
.article-header {
  padding: clamp(3rem, 8vw, 6rem) 0 3rem;
  border-bottom: 1px solid var(--border);
}
.article-header .container { max-width: var(--content-w); }
.article-category {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 1.5rem;
}
.article-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin-bottom: 1.5rem;
  line-height: 1.15;
}
.article-byline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.article-byline span { color: var(--gold-dim); }

.article-featured-image {
  aspect-ratio: 16/6;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.article-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) contrast(1.1);
}

.article-body {
  padding: clamp(2.5rem, 6vw, 4rem) 0;
}
.article-body .content-width { max-width: var(--content-w); margin: 0 auto; }

/* Drop cap on first paragraph */
.article-body > .content-width > p:first-of-type::first-letter {
  font-family: var(--font-serif);
  font-size: 4.5em;
  float: left;
  line-height: 0.8;
  margin: 0.05em 0.1em 0 0;
  color: var(--gold);
  font-weight: 400;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 2.5em 0 0.75em;
  color: var(--text);
}
.article-body h3 {
  font-size: 1.2rem;
  margin: 2em 0 0.5em;
  color: var(--text);
}
.article-body p { margin-bottom: 1.75em; }
.article-body ul, .article-body ol {
  margin: 1.5em 0;
  padding-left: 1.5em;
}
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 0.5em; color: var(--text-muted); }
.article-body a { color: var(--gold); border-bottom: 1px solid var(--gold-dim); }
.article-body a:hover { border-color: var(--gold); }

/* ── Tags ──────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3em 0.75em;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}
.tag:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ── Related Articles ──────────────────────────────────────────── */
.related-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px;
  margin-top: 2rem;
}

/* ── Archive Page ──────────────────────────────────────────────── */
.page-header {
  padding: clamp(3rem, 8vw, 5rem) 0 2rem;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.5rem;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.archive-section { padding: 3rem 0; }

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4em 1em;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover,
.filter-btn.active {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(201,168,76,0.05);
}

/* ── About Page ────────────────────────────────────────────────── */
.about-section { padding: clamp(3rem, 8vw, 6rem) 0; }
.about-section h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.about-section p { color: var(--text-muted); max-width: 65ch; }
.about-section p.lead {
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.7;
}
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 2rem;
}
.topic-item {
  background: var(--bg);
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: var(--font-serif);
}
.topic-item::before {
  content: '—';
  color: var(--gold-dim);
  margin-right: 0.5em;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.footer-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--gold-dim);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.75em 1.75em;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.btn:hover {
  background: var(--gold);
  color: var(--bg);
}

/* ── Loading State ─────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}
.loading::after {
  content: '........';
  animation: dots 1.5s steps(4, end) infinite;
  margin-left: 0.5em;
  color: var(--gold-dim);
}
@keyframes dots {
  0%, 20% { content: '........'; }
  40% { content: '......'; }
  60% { content: '....'; }
  80%, 100% { content: '..'; }
}

/* ── Error state ───────────────────────────────────────────────── */
.error-msg {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  border: 1px solid var(--border);
}

/* ── Utility ────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .site-nav { gap: 1.5rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .article-grid { grid-template-columns: 1fr; gap: 1px; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  h1 { letter-spacing: -0.01em; }
}
