@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400..700;1,6..72,400..700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   WHAT IS IN NEWS TODAY - DESIGN SYSTEM & THEMING CONTRACT
   - Light Theme: Pure whites, crisp subtle grays (#FFFFFF, #F8F9FA, #F4F4F5, #E4E4E7)
   - Dark Theme: Deep neutral black and refined charcoal grays (#09090B, #121215, #18181B, #27272A)
   - Distinct Action Buttons: Electric Blue, AI Indigo, Alert Rose, Emerald, Amber
   - High Readability & WCAG 2.1 AAA Contrast (7:1+ body, 4.5:1+ headers)
   ========================================================================== */

:root {
  --font-serif: 'Newsreader', Georgia, Cambria, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Light Theme Palette: Whites & Grays */
  --bg-canvas: #F8F9FA;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F4F4F5;
  --border-primary: #E4E4E7;
  --border-secondary: #D4D4D8;
  --text-primary: #09090B;    /* Contrast 19:1 (WCAG AAA) */
  --text-secondary: #3F3F46;  /* Contrast 8.5:1 (WCAG AAA) */
  --text-muted: #52525B;      /* Contrast 7.1:1 (WCAG AAA) */

  /* Distinct Accent Colors */
  --btn-primary-bg: #1D4ED8;
  --btn-primary-hover: #1E40AF;
  --btn-primary-text: #FFFFFF;
  --btn-ai-gradient: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --btn-breaking-bg: #E11D48;
  --btn-audio-bg: #0284C7;
  --btn-share-bg: #D97706;
}

.dark {
  /* Dark Theme Palette: Strict Blacks & Grays (No Blue Tints) */
  --bg-canvas: #09090B;       /* Pure neutral black */
  --bg-surface: #18181B;      /* Refined dark gray card surface */
  --bg-elevated: #202024;     /* Elevated gray */
  --border-primary: #27272A;  /* Defined charcoal border */
  --border-secondary: #3F3F46;/* Subtle gray divider */
  --text-primary: #FAFAFA;    /* Contrast 18.5:1 (WCAG AAA) */
  --text-secondary: #E4E4E7;  /* Contrast 11.2:1 (WCAG AAA) */
  --text-muted: #A1A1AA;      /* Contrast 7.0:1 (WCAG AAA) */

  --btn-primary-bg: #2563EB;
  --btn-primary-hover: #3B82F6;
  --btn-primary-text: #FFFFFF;
}

/* Global Reset & Base Typography */
html {
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.65;
  letter-spacing: -0.011em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Editorial Serif & Mono Typography */
.font-editorial {
  font-family: var(--font-serif);
  font-feature-settings: "liga", "kern";
  letter-spacing: -0.022em;
}

.font-mono-numbers {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

/* Scrollbar utilities */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Smooth transitions */
.transition-smooth {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* High Contrast Card Elevations */
.card-hover {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease;
}
.card-hover:hover {
  transform: translateY(-2.5px);
  box-shadow: 0 14px 28px -6px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
  border-color: #A1A1AA;
}
.dark .card-hover:hover {
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.65), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  border-color: #52525B;
}

/* Smart Brevity Callout Box */
.why-it-matters-box {
  background: #FFFBEB;
  border-left: 4px solid #D97706;
}
.dark .why-it-matters-box {
  background: #1C1917;
  border-left: 4px solid #F59E0B;
}
.dark .why-it-matters-box p {
  color: #FEF3C7;
}

/* ABC News Live Pulse */
@keyframes pulseRedDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
}
.animate-pulse-red {
  animation: pulseRedDot 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Sound Wave Animation for 60s Audio Brief */
@keyframes soundWave {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}
.wave-bar {
  width: 3px;
  background-color: currentColor;
  border-radius: 9999px;
  display: inline-block;
}
.wave-playing .wave-bar:nth-child(1) { animation: soundWave 0.8s ease-in-out infinite; }
.wave-playing .wave-bar:nth-child(2) { animation: soundWave 0.6s ease-in-out 0.2s infinite; }
.wave-playing .wave-bar:nth-child(3) { animation: soundWave 0.9s ease-in-out 0.4s infinite; }
.wave-playing .wave-bar:nth-child(4) { animation: soundWave 0.7s ease-in-out 0.1s infinite; }

/* Horizontal Carousel Snap */
.carousel-snap {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.carousel-snap-item {
  scroll-snap-align: start;
}

/* Shimmer animation on refresh */
@keyframes crossFadeShimmer {
  from {
    opacity: 0.75;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-cross-fade {
  animation: crossFadeShimmer 0.35s ease-out forwards;
}

/* Channel Header Active Pill */
.channel-pill {
  position: relative;
  transition: all 0.2s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.channel-pill.active {
  color: #09090B;
  font-weight: 700;
}
.dark .channel-pill.active {
  color: #FAFAFA;
}
.channel-pill.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #1D4ED8;
  border-radius: 2px 2px 0 0;
}
.dark .channel-pill.active::after {
  background-color: #38BDF8;
}

/* WCAG 2.1 AAA Accessibility: Focus-Visible Outlines */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2.5px solid #2563EB !important;
  outline-offset: 2.5px !important;
}
.dark a:focus-visible, .dark button:focus-visible, .dark input:focus-visible, .dark [tabindex="0"]:focus-visible {
  outline: 2.5px solid #60A5FA !important;
  outline-offset: 2.5px !important;
}

/* Native <dialog> Modal Backdrop & Scroll Containment */
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(8px);
}

/* Reading Progress Bar */
#reading-progress {
  transition: width 0.1s linear;
}

/* Mobile Bottom Dock Safe Area Padding */
.safe-bottom-dock {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

/* Micro-Interaction Reaction Pop */
@keyframes reactPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.animate-react-pop {
  animation: reactPop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* AdSense Slot Reservation (Zero CLS Guarantee) */
.ad-slot-leaderboard {
  min-height: 90px;
}
@media (max-width: 640px) {
  .ad-slot-leaderboard {
    min-height: 50px;
  }
}
.ad-slot-rectangle {
  min-height: 250px;
}

/* Primary Button Styling Utilities */
.btn-electric-blue {
  background-color: #1D4ED8;
  color: #FFFFFF;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.btn-electric-blue:hover {
  background-color: #1E40AF;
  transform: translateY(-1px);
}
.dark .btn-electric-blue {
  background-color: #2563EB;
}
.dark .btn-electric-blue:hover {
  background-color: #3B82F6;
}

.btn-ai-violet {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #FFFFFF;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.btn-ai-violet:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-breaking-rose {
  background-color: #E11D48;
  color: #FFFFFF;
}
.btn-breaking-rose:hover {
  background-color: #BE123C;
}

.btn-share-amber {
  background-color: #D97706;
  color: #FFFFFF;
}
.btn-share-amber:hover {
  background-color: #B45309;
}
