/* ==========================================================================
   THE DUSK — Custom Publication Design System
   Designed for Saurav Das | Independent Research & Analysis
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette - Obsidian Dark (Default) */
  --bg-primary: #0a0c10;
  --bg-secondary: #12161f;
  --bg-tertiary: #1a202c;
  --bg-card: #151a24;
  --bg-glass: rgba(18, 22, 31, 0.82);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-focus: #e2b714;
  
  --text-primary: #f0f4f8;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --text-accent: #e2b714;
  --text-accent-hover: #f6d365;

  --accent-gold: #e2b714;
  --accent-gold-soft: rgba(226, 183, 20, 0.12);
  --accent-cyan: #38bdf8;
  --accent-cyan-soft: rgba(56, 189, 248, 0.12);
  --accent-emerald: #34d399;
  --accent-rose: #f43f5e;

  /* Fonts */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions & Shadows */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(226, 183, 20, 0.15);

  --container-max: 1240px;
  --reader-max: 780px;
}

/* Accent Color Presets */
[data-accent="cyan"] {
  --text-accent: #38bdf8;
  --text-accent-hover: #7dd3fc;
  --accent-gold: #38bdf8;
  --accent-gold-soft: rgba(56, 189, 248, 0.12);
  --border-focus: #38bdf8;
}

[data-accent="emerald"] {
  --text-accent: #34d399;
  --text-accent-hover: #6ee7b7;
  --accent-gold: #34d399;
  --accent-gold-soft: rgba(52, 211, 153, 0.12);
  --border-focus: #34d399;
}

[data-accent="rose"] {
  --text-accent: #fb7185;
  --text-accent-hover: #fda4af;
  --accent-gold: #fb7185;
  --accent-gold-soft: rgba(251, 113, 133, 0.12);
  --border-focus: #fb7185;
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg-primary: #faf9f6;
  --bg-secondary: #f3f0ea;
  --bg-tertiary: #e7e2d7;
  --bg-card: #ffffff;
  --bg-glass: rgba(250, 249, 246, 0.88);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.16);
  --border-focus: #b48500;

  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-accent: #9a6e00;
  --text-accent-hover: #7a5700;

  --accent-gold: #b48500;
  --accent-gold-soft: rgba(180, 133, 0, 0.1);
  --accent-cyan: #0284c7;
  --accent-cyan-soft: rgba(2, 132, 199, 0.1);
  --accent-emerald: #059669;
  --accent-rose: #e11d48;

  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 30px rgba(180, 133, 0, 0.1);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

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

/* Container */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Glassmorphic Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-symbol {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-gold), #8a6500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.4rem;
  color: #0a0c10;
  box-shadow: 0 4px 12px rgba(226, 183, 20, 0.3);
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 4px 14px rgba(226, 183, 20, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand-logo:hover .brand-logo-img {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(226, 183, 20, 0.5);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent-gold);
  color: #0a0c10;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1.25rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(226, 183, 20, 0.25);
}

.btn-primary:hover {
  background: var(--text-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(226, 183, 20, 0.35);
}

/* Search Overlay */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  z-index: 900;
  display: flex;
  justify-content: center;
  padding-top: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.search-modal.active {
  opacity: 1;
  pointer-events: all;
}

.search-box {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.search-input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-family: var(--font-sans);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-item h4 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.search-result-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Hero Section */
.hero-section {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.mobile-hero-media {
  display: none;
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gold-soft);
  color: var(--text-accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(226, 183, 20, 0.3);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.2rem;
  }
}

.hero-excerpt {
  font-size: 1.12rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero-author {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 500;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-accent);
}

.hero-media {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16 / 9;
  cursor: pointer;
  background: var(--bg-card);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s var(--ease-out);
}

.hero-media:hover img {
  transform: scale(1.03);
}

/* Category Filter Bar */
.filter-bar {
  padding: 2.5rem 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.category-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn:hover, .category-btn.active {
  background: var(--accent-gold);
  color: #0a0c10;
  border-color: var(--accent-gold);
  font-weight: 600;
}

/* Article Cards Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  padding: 3rem 0;
}

@media (max-width: 600px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--ease-out);
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-secondary);
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.5s var(--ease-out);
}

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

.card-category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 12, 16, 0.75);
  backdrop-filter: blur(8px);
  color: var(--text-accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(226, 183, 20, 0.3);
  text-transform: uppercase;
}

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

.card-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.article-card:hover .card-title {
  color: var(--text-accent);
}

.card-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.read-time {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
}

/* Full Article Reader View */
.reader-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 800;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.reader-modal.active {
  opacity: 1;
  pointer-events: all;
}

/* Lock background page scrolling when any modal is open on mobile */
body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none !important;
}

#all-research-modal,
#reader-modal {
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

.reader-header-nav {
  position: sticky;
  top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  padding: 0.75rem 0;
}

.reader-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-back {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
}

.reader-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

.article-header {
  max-width: 1040px;
  margin: 0 auto 2.5rem;
}

.reader-cover-media {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto 2.5rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
}

.reader-cover-media img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
}

/* 2-Column Article Grid with TOC Sidebar */
.article-layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3.5rem;
  align-items: start;
  max-width: 1040px;
  margin: 0 auto;
}

.toc-sidebar {
  position: sticky;
  top: 90px;
}

@media (max-width: 992px) {
  .article-layout-grid {
    grid-template-columns: 1fr;
  }
  
  .toc-sidebar {
    display: none !important; /* Hide TOC on mobile/tablet for focused reading */
  }
}

.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.toc-header {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  font-size: 0.86rem;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.45;
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toc-link:hover, .toc-link.active {
  color: var(--text-accent);
  background: var(--accent-gold-soft);
  border-left-color: var(--text-accent);
  transform: translateX(2px);
  font-weight: 600;
}

/* Article Body Typography */
.article-body {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-body p {
  margin-bottom: 1.8rem;
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  margin: 3rem 0 1.2rem;
  color: var(--text-primary);
  line-height: 1.25;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.article-body h3 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 2.2rem 0 1rem;
  color: var(--text-accent);
}

.article-body blockquote {
  border-left: 3px solid var(--text-accent);
  padding: 1.25rem 1.75rem;
  background: var(--bg-secondary);
  border-radius: 0 12px 12px 0;
  margin: 2rem 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--text-primary);
}

/* Special Callout - My Two Cents */
.two-cents-box {
  background: linear-gradient(135deg, rgba(226, 183, 20, 0.08), rgba(56, 189, 248, 0.05));
  border: 1px solid rgba(226, 183, 20, 0.3);
  border-radius: 16px;
  padding: 2rem;
  margin: 3rem 0;
  position: relative;
}

.two-cents-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-accent);
  margin-bottom: 1rem;
}

/* Interactive Widgets Container */
.widget-box {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 2rem;
  margin: 3rem 0;
  box-shadow: var(--shadow-lg);
}

.widget-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.widget-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Range Slider & Form Inputs */
.input-group {
  margin-bottom: 1.5rem;
}

.input-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.custom-range {
  width: 100%;
  accent-color: var(--accent-gold);
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.widget-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-accent);
  margin-top: 4px;
}

/* Sources Drawer */
.sources-section {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.source-item {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.source-item a {
  color: var(--text-accent);
  text-decoration: none;
}

.source-item a:hover {
  text-decoration: underline;
}

/* Newsletter Modal */
.newsletter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.newsletter-modal.active {
  opacity: 1;
  pointer-events: all;
}

.newsletter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.newsletter-card h3 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.newsletter-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.8rem;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.newsletter-form input {
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border-medium);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
}

.newsletter-form input:focus {
  border-color: var(--accent-gold);
}

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

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

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

.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.2rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.6rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-accent);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================================
   HOMEPAGE ENHANCEMENT COMPONENTS
   ========================================================================== */

/* 1. Ticker Banner */
.ticker-banner {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.ticker-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
  white-space: nowrap;
  animation: tickerSlide 25s linear infinite;
}

.ticker-wrapper:hover {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.ticker-tag {
  color: var(--text-accent);
  font-weight: 600;
  text-transform: uppercase;
}

/* 2. Interactive Research Stats Bar */
.stats-bar-section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.stat-card:hover {
  border-color: var(--text-accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.5);
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-accent);
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.stat-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* 3. Topic Explorer Carousel Grid */
.topic-explorer-section {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.section-heading-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.topic-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.topic-card:hover {
  border-color: var(--text-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.topic-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.topic-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.topic-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-accent);
}

/* 4. Trending Essays & Quote Block */
.trending-quote-section {
  padding: 3.5rem 0;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 850px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

.trending-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.25s ease;
}

.trending-item:hover {
  border-color: var(--text-accent);
  transform: translateX(4px);
}

.trending-rank {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  min-width: 32px;
}

.quote-card {
  background: linear-gradient(135deg, rgba(226, 183, 20, 0.08), rgba(56, 189, 248, 0.06));
  border: 1px solid rgba(226, 183, 20, 0.3);
  border-radius: 20px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.quote-mark {
  font-family: var(--font-serif);
  font-size: 4rem;
  line-height: 1;
  color: var(--text-accent);
  opacity: 0.5;
  margin-bottom: -1rem;
}

.quote-text {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.quote-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* General Introduction Hero Banner — Dissolved Dark Background Etching */
.intro-hero-section {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-primary);
  overflow: hidden;
}

/* Dissolved Background Parliament Etching */
.intro-hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 58%;
  height: 100%;
  background-image: url('../assets/parliament_intro.jpg');
  background-size: cover;
  background-position: center right;
  opacity: 0.20;
  filter: invert(0.92) hue-rotate(165deg) contrast(1.3) brightness(0.75);
  mix-blend-mode: screen;
  mask-image: linear-gradient(to right, transparent 0%, black 40%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 40%, black 90%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

[data-theme="light"] .intro-hero-section::before {
  opacity: 0.15;
  filter: contrast(1.1) sepia(0.3);
  mix-blend-mode: multiply;
}

.intro-hero-box {
  position: relative;
  z-index: 2;
  border-left: 3px solid var(--text-accent);
  padding-left: 2rem;
  max-width: 860px;
}

.intro-main-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.intro-main-desc {
  font-size: 1.18rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Latest Analysis Header Row */
.latest-analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.latest-analysis-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
}

.view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.35rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.view-all-btn:hover {
  background: var(--accent-gold);
  color: #0a0c10;
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

/* Mobile Layout Optimization (<768px Smartphones & Tablets) */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .container {
    padding: 0 0.85rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .nav-container {
    height: 60px !important;
    padding: 0 0.25rem !important;
    gap: 6px !important;
  }

  .brand-logo-img {
    width: 34px !important;
    height: 34px !important;
  }

  .brand-title {
    font-size: 1.1rem !important;
  }

  .brand-subtitle {
    display: block !important;
    font-size: 0.65rem !important;
    color: var(--text-muted) !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    margin-top: 1px !important;
  }

  .nav-links {
    display: none !important;
  }

  .accent-dots-wrapper {
    display: none !important;
  }

  .ticker-banner {
    display: none !important;
  }

  .icon-btn {
    width: 34px !important;
    height: 34px !important;
  }

  .btn-subscribe {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.76rem !important;
  }

  .intro-hero-section {
    padding: 1.5rem 0 !important;
  }

  .intro-hero-box {
    padding-left: 0.85rem !important;
    border-left-width: 3px !important;
  }

  .intro-main-title {
    font-size: 1.4rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.65rem !important;
  }

  .intro-main-desc {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
  }

  /* Featured Deep Dive: Image placement after Meta & before Read button */
  .hero-grid {
    display: block !important;
  }

  .desktop-hero-media {
    display: none !important;
  }

  .mobile-hero-media {
    display: block !important;
    width: 100% !important;
    margin: 1rem 0 1.25rem !important;
  }

  .mobile-hero-media img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1200 / 450 !important;
    object-fit: contain !important;
    border-radius: 14px !important;
    box-shadow: var(--shadow-lg) !important;
  }

  .hero-title {
    font-size: 1.6rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.75rem !important;
  }

  .hero-excerpt {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    margin-bottom: 1.15rem !important;
  }

  .hero-meta {
    gap: 0.65rem !important;
    font-size: 0.8rem !important;
    flex-wrap: wrap !important;
    margin-bottom: 0.85rem !important;
  }

  /* Concept 1: Visual Magazine Card Layout for Mobile (High Impact Banner + Sleek Meta Strip) */
  .articles-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .article-card {
    border-radius: 14px !important;
    overflow: hidden !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-medium) !important;
    box-shadow: var(--shadow-sm) !important;
  }

  .card-image-wrapper {
    aspect-ratio: 1200 / 450 !important;
    background: var(--bg-secondary) !important;
    overflow: hidden !important;
    border-radius: 14px 14px 0 0 !important;
  }

  .card-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .card-content {
    padding: 0.85rem 1rem !important;
  }

  /* Hide redundant HTML title, category & excerpt on mobile — the banner artwork displays the title cleanly */
  .articles-grid .card-title,
  .articles-grid .card-excerpt,
  .articles-grid .card-category {
    display: none !important;
  }

  .articles-grid .card-meta {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.82rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
  }

  .topic-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* Enforce Strict Zero-Horizontal Scroll on All Research Catalog Modal & Geopolitics Tag Page */
  #all-research-modal,
  #all-research-modal .container,
  #all-research-modal .filter-bar,
  #all-research-modal #catalog-articles-grid {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Make all-research-modal a perfect fit on phone screens for short/single-article views */
  #all-research-modal .container {
    padding: 1rem 0.85rem 2rem !important;
  }

  #all-research-modal h1 {
    font-size: 1.5rem !important;
    margin-top: 2px !important;
    line-height: 1.2 !important;
  }

  #all-research-modal p {
    font-size: 0.88rem !important;
    line-height: 1.4 !important;
    margin-top: 0.25rem !important;
  }

  #all-research-modal .filter-bar {
    padding: 0.75rem 0 0 !important;
  }

  #all-research-modal #catalog-articles-grid {
    padding-top: 1rem !important;
    gap: 1rem !important;
  }

  #all-research-modal .category-tags {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
    padding-bottom: 0.5rem !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
  }

  #all-research-modal .category-tags::-webkit-scrollbar {
    display: none !important;
  }

  #all-research-modal .category-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.8rem !important;
    padding: 0.4rem 0.85rem !important;
  }

  #all-research-modal .article-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Article Reader Modal Mobile Perfection (Matches UPI Article Fit) */
  .reader-header {
    padding: 0.6rem 0.75rem !important;
  }

  .reader-header-actions {
    gap: 0.4rem !important;
  }

  .reader-container {
    padding: 1.25rem 0.85rem 3rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .reader-cover-media {
    width: 100% !important;
    margin-bottom: 1.25rem !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background: var(--bg-secondary) !important;
  }

  .reader-cover-media img {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 1200 / 450 !important;
    object-fit: contain !important;
    border-radius: 12px !important;
  }

  .article-main-title {
    font-size: 1.6rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.85rem !important;
  }

  .article-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .toc-sidebar {
    display: none !important;
  }

  .article-main-col {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Article Reader Modal Mobile Zero-Horizontal-Panning Rule */
  #reader-modal,
  .reader-modal,
  .reader-container,
  .article-layout-grid,
  .article-main-col,
  .article-body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .article-body * {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .article-body div[style*="display:grid"],
  .article-body div[style*="display: grid"],
  .editorial-infographic-card div[style*="display:grid"],
  .editorial-infographic-card div[style*="display: grid"] {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 1rem !important;
  }

  .article-body ul,
  .article-body ol {
    padding-left: 1.25rem !important;
    padding-right: 0.5rem !important;
  }

  .article-body img,
  .article-body svg,
  .article-body figure,
  .article-body iframe {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .article-body table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .article-body pre,
  .article-body code {
    white-space: pre-wrap !important;
    word-break: break-all !important;
    max-width: 100% !important;
  }

  .editorial-infographic-card,
  .two-cents-box,
  .quote-card,
  .interactive-widget-card,
  .infographic-box {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.15rem 0.85rem !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  .modal-box {
    width: 94vw !important;
    max-height: 88vh !important;
    padding: 1.25rem 1rem !important;
  }
}

/* Universal Netlify Badge Destroyer */
[class*="netlify"],
[id*="netlify"],
.netlify-badge,
#netlify-badge,
a[href*="netlify"],
iframe[src*="netlify"],
body > div[style*="fixed"],
body > a[style*="fixed"],
div[style*="z-index: 2147483647"],
div[style*="z-index: 999999"],
div:has(a[href*="netlify"]) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  max-width: 0 !important;
  max-height: 0 !important;
}








