/* ===================================================================
   OccultWorldLedger — Design System v2
   "The work begins where the reading ends."
   A publication for practitioners. Built like it matters.
   =================================================================== */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Palette — warm ink and aged vellum, not generic dark+gold */
  --bg:         #0c0b09;
  --surface:    #13120f;
  --surface-2:  #1a1915;
  --surface-3:  #21201b;
  --text:       #e8dcc8;
  --text-muted: #9a8f80;
  --text-dim:   #5a5248;
  --gold:       #c9a84c;
  --gold-dim:   #c9a84c;
  --gold-bright:#e0c060;
  --crimson:    #7a2020;
  --crimson-lt: #a83030;
  --border:     #252318;
  --border-lt:  #302c22;

  /* Typography — editorial authority */
  --font-body:   'EB Garamond', 'Garamond Premier Pro', Georgia, serif;
  --font-display:'Cinzel', 'Trajan Pro', 'Palatino Linotype', serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Courier New', monospace;

  /* Spatial */
  --max-w:      1240px;
  --content-w:  700px;
  --gutter:     clamp(1.25rem, 5vw, 3.5rem);
  --radius:     2px;
}

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

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

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

/* ── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: 0.04em;
}
h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: 0.06em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

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

blockquote {
  border-left: 1px solid var(--gold-dim);
  padding: 0.25em 0 0.25em 1.75em;
  margin: 2.5em 0;
  color: var(--text-muted);
}
blockquote p { font-style: italic; margin-bottom: 0.4em; font-size: 1.05em; }
blockquote em { font-style: normal; color: var(--text-dim); }

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

strong { font-weight: 600; color: var(--text); }
em { font-style: italic; }

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

/* ── Ornamental divider ─────────────────────────────────────────── */
.ornament {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  color: var(--gold-dim);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
}
.ornament::before,
.ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-lt);
}

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 11, 9, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 2rem;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
  flex-shrink: 0;
}
.site-logo span {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75em;
  letter-spacing: 0.06em;
  font-style: italic;
  margin-top: 3px;
  text-transform: none;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.15s;
}
.site-nav a:hover,
.site-nav a.active { color: var(--gold); }

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  padding: clamp(4rem, 10vw, 7rem) 0 clamp(3rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--crimson-lt);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-eyebrow::before {
  content: '';
  width: 2rem;
  height: 1px;
  background: var(--crimson-lt);
}
.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  max-width: 820px;
  font-weight: 400;
}
.hero-excerpt {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin-bottom: 2rem;
  line-height: 1.75;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.hero-divider {
  width: 3rem;
  height: 1px;
  background: var(--gold-dim);
  margin: 1.5rem 0;
}
.hero-image-wrap {
  margin-top: 2.5rem;
  aspect-ratio: 21/8;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.hero-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, var(--bg) 100%);
}
.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6) contrast(1.1) sepia(0.15);
}

/* ── Section headers ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-lt);
}
.section-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.section-link {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.15s;
}
.section-link:hover { color: var(--gold); }

/* ── Article Grid ───────────────────────────────────────────────── */
.article-section { padding: clamp(2.5rem, 5vw, 4rem) 0; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

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

.card-category {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson-lt);
  margin-bottom: 0.6rem;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 0.6rem;
  color: var(--text);
  letter-spacing: 0.03em;
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--gold); }
.card-excerpt {
  font-size: 0.82rem;
  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);
}
.card-date {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.read-more {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  transition: color 0.15s;
}
.article-card:hover .read-more { color: var(--gold); }
.card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) contrast(1.05) sepia(0.1);
  transition: filter 0.3s, transform 0.5s;
}
.article-card:hover .card-image img {
  filter: brightness(0.8) contrast(1.05) sepia(0.15);
  transform: scale(1.03);
}

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

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

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

/* Drop cap — authoritative, not decorative */
.article-body > .content-width > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 4.2em;
  float: left;
  line-height: 0.78;
  margin: 0.06em 0.08em 0 0;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Ornamental section break */
.article-body p + h2::before,
.article-body h2 { margin-top: 2.5em; }
.article-body h2 {
  font-size: 1.2rem;
  margin-bottom: 0.875em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.article-body h3 {
  font-size: 1rem;
  margin: 2em 0 0.5em;
  color: var(--text);
}
.article-body p { margin-bottom: 1.75em; font-size: 1.02rem; }
.article-body ul, .article-body ol {
  margin: 1.5em 0 1.5em 1.25em;
}
.article-body ul { list-style: none; }
.article-body ul li {
  position: relative;
  padding-left: 1.25em;
  margin-bottom: 0.4em;
  color: var(--text-muted);
}
.article-body ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--gold-dim);
}
.article-body ol { list-style: decimal; }
.article-body ol li { margin-bottom: 0.4em; 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-bright); color: var(--gold-bright); }
.article-body strong { color: var(--text); }

/* ── Tags ──────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-lt);
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3em 0.8em;
  border: 1px solid var(--border-lt);
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s;
}
.tag:hover { border-color: var(--gold-dim); color: var(--gold); }

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

/* ── Archive Page ──────────────────────────────────────────────── */
.page-header {
  padding: clamp(3rem, 8vw, 5rem) 0 2rem;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  margin-bottom: 0.4rem;
  font-weight: 400;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}
.archive-section { padding: 3rem 0; }

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2.5rem;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4em 1em;
  background: transparent;
  border: 1px solid var(--border-lt);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover,
.filter-btn.active {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(184, 148, 46, 0.04);
}

/* ── About Page ────────────────────────────────────────────────── */
.about-section { padding: clamp(3rem, 8vw, 6rem) 0; }
.about-section h2 {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 3rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.about-section h2:first-child { margin-top: 0; }
.about-section p { color: var(--text-muted); max-width: 65ch; }
.about-section p.lead {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.75;
}
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.topic-item {
  background: var(--surface);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.topic-item::before {
  content: '— ';
  color: var(--gold-dim);
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 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: 0.75rem;
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.footer-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--gold);
}

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

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

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

/* ── Utilities ──────────────────────────────────────────────────── */
.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; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .site-nav { gap: 1.5rem; }
  .article-grid { grid-template-columns: 1fr; gap: 1px; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .header-inner { height: 58px; }
  .site-logo { font-size: 0.75rem; letter-spacing: 0.12em; }
  .article-grid { gap: 1px; }
}
