/* Chronicles & Enigmas - Master Editorial Stylesheet */
:root {
  --font-serif: 'Cinzel', 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dark Theme (Default) */
  --bg-primary: #090e17;
  --bg-secondary: #0f172a;
  --bg-card: #141d33;
  --bg-card-hover: #1c2744;
  --border-color: #212e4d;
  --border-light: rgba(255, 255, 255, 0.08);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --accent-gold: #f59e0b;
  --accent-gold-dark: #d97706;
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;

  --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --gradient-card: linear-gradient(180deg, rgba(20, 29, 51, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.7);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-light: rgba(0, 0, 0, 0.06);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.8;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

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

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Reading Progress Bar */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--gradient-gold);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Header & Nav */
header.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.site-logo svg {
  width: 28px;
  height: 28px;
  fill: var(--accent-gold);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-main);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  border-color: var(--accent-gold);
}

/* Hero Section (Homepage) */
.home-hero {
  padding: 3.5rem 0 2rem;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-gold);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.25rem;
}

.home-hero h1 {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text-main);
  max-width: 900px;
  margin-bottom: 1rem;
}

.home-hero h1 span {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-hero p.lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 800px;
  margin-bottom: 2rem;
}

/* Search Bar */
.search-box-wrap {
  position: relative;
  max-width: 600px;
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  transition: all 0.25s ease;
}

.search-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  fill: var(--text-subtle);
  pointer-events: none;
}

/* Category Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

/* Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.article-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-md);
}

.card-img-wrap {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.article-card:hover .card-img-wrap img {
  transform: scale(1.05);
}

.card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(9, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.card-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-subtle);
}

/* Single Article Layout */
.article-header {
  padding: 3rem 0 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.breadcrumbs {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-title-main {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.article-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.article-author-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
}

.author-name {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

.article-date-meta {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

/* Article Hero Image */
.article-hero-image-wrap {
  max-width: 1000px;
  margin: 0 auto 3rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.article-hero-image-wrap img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
}

.image-caption {
  background: var(--bg-card);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  font-style: italic;
}

/* Article Body Content */
.article-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-title-main { font-size: 2rem; }
  .home-hero h1 { font-size: 2.1rem; }
}

.article-content {
  font-size: 1.1rem;
  line-height: 1.85;
  color: #cbd5e1;
}

[data-theme="light"] .article-content {
  color: #334155;
}

.article-content h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 2.5rem 0 1rem;
  line-height: 1.35;
  border-left: 4px solid var(--accent-gold);
  padding-left: 1rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

/* Callout Boxes */
.callout-box {
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin: 2rem 0;
  border-left: 4px solid;
}

.callout-takeaway {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--accent-emerald);
}

.callout-takeaway h4 {
  color: var(--accent-emerald);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.callout-timeline {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent-blue);
}

.callout-timeline h4 {
  color: var(--accent-blue);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 140px;
  flex-shrink: 0;
}

.callout-theories {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--accent-gold);
}

.theory-item {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.theory-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.theory-title {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.theory-prob {
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Pull Quotes */
blockquote.editorial-quote {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--text-main);
  background: var(--bg-card);
  border-left: 4px solid var(--accent-gold);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

/* Table of Contents Sticky Aside */
.toc-aside {
  position: sticky;
  top: 90px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.toc-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-list {
  list-style: none;
  font-size: 0.88rem;
}

.toc-list li {
  margin-bottom: 0.65rem;
}

.toc-list a {
  color: var(--text-muted);
  display: block;
  line-height: 1.4;
}

.toc-list a:hover {
  color: var(--accent-gold);
}

/* Author Box at End of Article */
.author-end-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin: 3rem 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.author-end-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-gold);
  flex-shrink: 0;
}

.author-end-bio h4 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.author-end-role {
  color: var(--accent-gold);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.author-end-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Footer */
footer.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
  margin-top: 5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.footer-col h5 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.65rem;
}

.footer-col ul li a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-col ul li a:hover {
  color: var(--accent-gold);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-subtle);
  font-size: 0.85rem;
}
