:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent-color: #1e3a8a;       /* Deep Editorial Navy */
  --accent-hover: #172554;
  --accent-secondary: #d97706;   /* Amber / Gold */
  --accent-red: #dc2626;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-alt: #1f2937;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

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

body {
  font-family: var(--font-heading);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Typography */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* Header & Navigation */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 48px;
  width: auto;
  border-radius: 6px;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-indicator {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

/* Search Bar */
.search-wrapper {
  position: relative;
  width: 280px;
}

.search-input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--accent-color);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

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

/* Categories Nav Bar */
.category-nav {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.category-nav::-webkit-scrollbar {
  height: 4px;
}

.category-nav::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
}

.nav-container {
  display: flex;
  gap: 4px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

.nav-link {
  display: inline-block;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: all 0.15s ease;
}

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

/* Main Layout */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* Headlines Banner */
.ticker-banner {
  background: linear-gradient(90deg, #1e3a8a, #1e293b);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--card-shadow);
}

.ticker-badge {
  background-color: #d97706;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ticker-text {
  font-size: 0.95rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Newspaper Grid */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.section-title {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .papers-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
  }
}

/* Newspaper Card */
.paper-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.paper-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
}

.card-img-wrapper {
  position: relative;
  aspect-ratio: 1 / 1.45;
  background-color: var(--bg-surface-alt);
  overflow: hidden;
}

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

.paper-card:hover .card-img {
  transform: scale(1.02);
}

.badge-back {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.card-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Single Newspaper View (SEO Hero) */
.newspaper-single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 16px;
}

@media (min-width: 992px) {
  .newspaper-single {
    grid-template-columns: 460px 1fr;
  }
}

.cover-viewer {
  background-color: var(--bg-surface);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  text-align: center;
}

.cover-stage {
  position: relative;
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  cursor: zoom-in;
}

.cover-img {
  width: 100%;
  height: auto;
  display: block;
}

.cover-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.newspaper-single > * { min-width: 0; }
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 600px) {
  .cover-viewer { padding: 10px; }
  .cover-controls .btn { padding: 7px 10px; font-size: 0.82rem; flex: 1 1 auto; justify-content: center; }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  text-decoration: none;
}

.btn-outline {
  background-color: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: var(--bg-surface-alt);
  text-decoration: none;
}

/* Audio TTS Box */
.tts-box {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: #ffffff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}

.tts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tts-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tts-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.wave-bar {
  width: 4px;
  height: 6px;
  background-color: #d97706;
  border-radius: 2px;
  transition: height 0.1s ease;
}

.wave-active .wave-bar:nth-child(1) { animation: wave 0.8s infinite ease-in-out; }
.wave-active .wave-bar:nth-child(2) { animation: wave 0.6s infinite ease-in-out; }
.wave-active .wave-bar:nth-child(3) { animation: wave 1.0s infinite ease-in-out; }
.wave-active .wave-bar:nth-child(4) { animation: wave 0.7s infinite ease-in-out; }

@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 20px; }
}

.tts-button {
  background-color: #d97706;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  transition: background-color 0.2s;
}

.tts-button:hover {
  background-color: #b45309;
}

/* OCR Headlines Card */
.ocr-content-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.ocr-main-h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.35;
  border-left: 4px solid var(--accent-secondary);
  padding-left: 14px;
}

.ocr-sub-list {
  list-style: none;
  margin-top: 16px;
}

.ocr-sub-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ocr-sub-list li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--accent-secondary);
  font-size: 1.4rem;
  line-height: 1;
}

/* Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

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

/* Mobile Hamburger Button */
.mobile-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 38px;
  height: 38px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  z-index: 101;
}

.mobile-toggle-btn span {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* Mobile Drawer & Backdrop */
.mobile-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 999;
}

.mobile-backdrop.open {
  display: block;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100%;
  background-color: var(--bg-surface);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-drawer.open {
  left: 0;
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.mobile-drawer-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-drawer-search .search-input {
  width: 100%;
  padding: 10px 14px;
}

.mobile-drawer-links {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  background-color: var(--bg-surface-alt);
  color: var(--accent-color);
  text-decoration: none;
}

/* Mobile Responsive Adaptations */
@media (max-width: 900px) {
  .top-bar {
    padding: 10px 14px;
    gap: 10px;
  }
  
  .header-actions {
    gap: 8px;
  }

  .date-indicator {
    display: none; /* Hide date text badge on mobile to avoid overflow */
  }

  .search-wrapper {
    display: none; /* Desktop search hides; mobile search is in drawer or bar */
  }

  .mobile-toggle-btn {
    display: flex;
  }

  .brand-title {
    font-size: 1.15rem;
  }
  
  .brand-sub {
    font-size: 0.65rem;
  }

  .category-nav {
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-container {
    padding: 0 10px;
    gap: 2px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .main-container {
    padding: 16px 12px 40px;
  }
}
