/* ============================================================
   NewsChief Color System
   ============================================================ */

/* LIGHT MODE — :root / [data-theme="light"] */
:root,
[data-theme="light"] {
  /* — Surfaces (Light Peach Family) — */
  --color-bg:               #FEF0E7;
  --color-surface:          #FFF5EE;
  --color-surface-2:        #FFFBF8;
  --color-surface-offset:   #FDDFC8;
  --color-surface-offset-2: #F8D4BA;
  --color-surface-dynamic:  #F2C8A8;
  --color-divider:          #EEC9AD;
  --color-border:           #E5BCA0;

  /* — Text (Deep Navy Range) — */
  --color-text:             #0A1628;
  --color-text-muted:       #3C527A;
  --color-text-faint:       #8A9FC8;
  --color-text-inverse:     #FFF5EE;

  /* — Primary Accent (Navy Blue) — */
  --color-primary:          #1B3080;
  --color-primary-hover:    #142462;
  --color-primary-active:   #0D1845;
  --color-primary-highlight:#D0DAF5;

  /* — Secondary (Breaking News / Alert Red) — */
  --color-secondary:        #C94A2A;
  --color-secondary-hover:  #A83B20;
  --color-secondary-highlight: #F8DACE;

  /* — Accent (Featured / Premium Gold) — */
  --color-accent:           #C27C10;
  --color-accent-hover:     #A0640C;
  --color-accent-highlight: #F5E3C0;

  /* — Category Purple (Opinion / Culture) — */
  --color-purple:           #6B3AAA;
  --color-purple-hover:     #572E8A;
  --color-purple-highlight: #E0D4F0;

  /* — Success (Verified / Live) — */
  --color-success:          #246B30;
  --color-success-hover:    #185022;
  --color-success-highlight:#C8E8CC;

  /* — Shadows (warm peach-toned) — */
  --shadow-sm: 0 1px 3px oklch(0.25 0.04 30 / 0.08);
  --shadow-md: 0 4px 14px oklch(0.25 0.04 30 / 0.12);
  --shadow-lg: 0 12px 36px oklch(0.25 0.04 30 / 0.16);

  /* — Compatibility aliases — */
  --shadow-color: oklch(0.25 0.04 30 / 0.12);
  --overlay:      oklch(0 0 0 / 0.5);
  --swiper-theme-color: #1B3080;
}

/* DARK MODE — [data-theme="dark"] */
[data-theme="dark"] {
  /* — Surfaces (Deep Navy Blue Family) — */
  --color-bg:               #0B1635;
  --color-surface:          #101E42;
  --color-surface-2:        #14244E;
  --color-surface-offset:   #0E1B3E;
  --color-surface-offset-2: #122248;
  --color-surface-dynamic:  #1A2C5C;
  --color-divider:          #1E3268;
  --color-border:           #253C7A;

  /* — Text (Soft Lavender-White Range) — */
  --color-text:             #EDE8FA;
  --color-text-muted:       #A89EC0;
  --color-text-faint:       #5C5478;
  --color-text-inverse:     #0B1635;

  /* — Primary Accent (Deep Purple) — */
  --color-primary:          #9B59E8;
  --color-primary-hover:    #8844D4;
  --color-primary-active:   #7030BE;
  --color-primary-highlight:#2A1E52;

  /* — Secondary (Breaking News / Alert Red) — */
  --color-secondary:        #F06A48;
  --color-secondary-hover:  #D85530;
  --color-secondary-highlight: #3A1E18;

  /* — Accent (Featured / Premium Gold) — */
  --color-accent:           #E8A830;
  --color-accent-hover:     #CC8E18;
  --color-accent-highlight: #3A2E10;

  /* — Category Purple (Opinion / Culture) — */
  --color-purple:           #B880F0;
  --color-purple-hover:     #A060D8;
  --color-purple-highlight: #2C1A48;

  /* — Success (Verified / Live) — */
  --color-success:          #4EAA62;
  --color-success-hover:    #368A48;
  --color-success-highlight:#1A3A22;

  /* — Shadows (deep blue-toned) — */
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 14px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 36px oklch(0 0 0 / 0.50);

  /* — Compatibility aliases — */
  --shadow-color: oklch(0 0 0 / 0.35);
  --overlay:      oklch(0 0 0 / 0.7);
  --swiper-theme-color: #9B59E8;
}

/* SHARED TOKENS (both modes) */
:root {
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body:    'Inter', 'Helvetica Neue', sans-serif;

  --radius-sm:   0.25rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;

  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
}

/* BASE ELEMENT OVERRIDES */
html {
  color-scheme: light dark;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: background-color var(--transition), color var(--transition);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--color-text);
}

h4, h5, h6 {
  font-family: var(--font-body);
  color: var(--color-text);
}

a {
  color: var(--color-primary);
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-hover);
}

/* Theme toggle button */
[data-theme-toggle] {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

[data-theme-toggle]:hover {
  background-color: var(--color-surface-offset);
  color: var(--color-text);
  border-color: var(--color-primary);
}

/* Text size button — active state */
.text-size-btn[data-text-size-active] {
  background-color: var(--color-primary-highlight);
  color: var(--color-primary);
  font-weight: 600;
}

/* Breaking news banner */
.breaking-banner {
  background-color: var(--color-secondary);
  color: var(--color-text-inverse);
  width: 100%;
}

/* LIVE badge */
.live-badge {
  background-color: var(--color-secondary);
  color: var(--color-text-inverse);
  animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* Article card image placeholder gradient */
.article-img-placeholder {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-highlight));
}

/* Article category labels */
.category-label {
  color: var(--color-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

/* Primary buttons */
.btn-primary-nc {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  border: none;
  transition: background-color var(--transition);
}

.btn-primary-nc:hover {
  background-color: var(--color-primary-hover);
}

/* Ghost buttons */
.btn-ghost-nc {
  background-color: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: background-color var(--transition), color var(--transition);
}

.btn-ghost-nc:hover {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

/* Active nav item */
.nav-item-active {
  background-color: var(--color-primary-highlight);
  color: var(--color-primary);
}

/* Card base */
.nc-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  transition: box-shadow var(--transition), transform var(--transition);
}

.nc-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Form focus ring */
.nc-input:focus {
  box-shadow: 0 0 0 3px var(--color-primary-highlight);
  outline: none;
  border-color: var(--color-primary);
}

/* Featured badge */
.badge-featured {
  background-color: var(--color-accent-highlight);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

/* Opinion / culture badge */
.badge-opinion {
  background-color: var(--color-purple-highlight);
  color: var(--color-purple);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

/* ============================================================
   Reset and base styles
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.ticker-animate {
    animation: ticker 30s linear infinite;
}

.ticker-wrapper:hover .ticker-animate {
    animation-play-state: paused;
}

.glitch {
    animation: glitch 1s linear infinite;
}

@keyframes glitch {
    2%, 64% { transform: translate(2px, 0); }
    4%, 60% { transform: translate(-2px, 0); }
}

.gradient-bg {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}

.gradient-text {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-gradient {
    background: linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0.0));
}

.backdrop-blur-soft {
    backdrop-filter: blur(14px);
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide scrollbar on category navigation */
.category-nav::-webkit-scrollbar {
    display: none;
}

.category-nav {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Active states */
.filter-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

.subcategory-item.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.subcategory-item.active i {
    color: var(--color-text-inverse);
}

.tab-active {
    border-bottom: 3px solid var(--color-primary);
    color: var(--color-primary);
}

.tab-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.category-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

/* Profile upload */
.profile-upload {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.profile-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.upload-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid var(--color-surface);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Accordion */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-content.active {
    max-height: 5000px;
    transition: max-height 0.5s ease-in;
}

.print-button:hover {
    transform: translateY(-2px);
}

/* Share sticky */
.share-sticky {
    position: sticky;
    top: 100px;
}

/* Swiper */
.swiper {
    width: 100%;
    height: 100%;
}

.swiper-slide {
    background-position: center;
    background-size: cover;
}

.swiper-button-next, .swiper-button-prev {
    color: var(--color-primary) !important;
    background: var(--color-surface);
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
}

.swiper-button-next:after, .swiper-button-prev:after {
    font-size: 16px !important;
}

.swiper-pagination-bullet-active {
    background: var(--color-primary) !important;
}

/* Gallery */
.gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .gallery-masonry {
        column-count: 2;
        column-gap: 1rem;
    }
}

/* Article card */
.article-card {
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 40px;
    bottom: -20px;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-primary), transparent);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tag cloud */
.tag-cloud-item {
    transition: all 0.3s ease;
}

.tag-cloud-item:hover {
    transform: scale(1.05);
}

/* Trending badge */
.trending-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Case card */
.case-card {
    transition: all 0.3s ease;
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-active .status-dot {
    background: #10B981;
    animation: pulse 2s infinite;
}

.status-closed .status-dot {
    background: #6B7280;
}

/* Podcast */
.podcast-card {
    aspect-ratio: 1/1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.podcast-card:hover .play-overlay {
    opacity: 1;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.pulse-ring {
    animation: pulseRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseRing {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

/* Player */
.player-container {
    min-height: 100vh;
    padding-bottom: 200px;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 200px;
}

.bar {
    width: 8px;
    background: linear-gradient(to top, var(--color-primary), var(--color-primary-hover));
    border-radius: 4px;
    animation: pulse 1s ease-in-out infinite;
}

.bar:nth-child(1) { height: 60px; animation-delay: 0s; }
.bar:nth-child(2) { height: 100px; animation-delay: 0.1s; }
.bar:nth-child(3) { height: 140px; animation-delay: 0.2s; }
.bar:nth-child(4) { height: 80px; animation-delay: 0.3s; }
.bar:nth-child(5) { height: 120px; animation-delay: 0.4s; }
.bar:nth-child(6) { height: 90px; animation-delay: 0.5s; }
.bar:nth-child(7) { height: 150px; animation-delay: 0.6s; }
.bar:nth-child(8) { height: 110px; animation-delay: 0.7s; }
.bar:nth-child(9) { height: 130px; animation-delay: 0.8s; }
.bar:nth-child(10) { height: 70px; animation-delay: 0.9s; }

.bar.paused {
    animation: none;
    height: 20px !important;
}

/* Link card - moved to story-player.php inline styles */

/* Episode card */
.episode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(106, 90, 205, 0.2);
}

/* Story Cards */
.story-card {
    position: relative;
    aspect-ratio: 9/16;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.story-card video {
    pointer-events: none;
}

.story-card:hover video {
    animation: none;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-card:hover .play-overlay {
    opacity: 1;
}

.story-gradient {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.4), transparent);
}

.category-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
}

.category-scroll::-webkit-scrollbar {
    height: 4px;
}

.category-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.category-scroll::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

.category-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

.category-btn {
    transition: all 0.3s ease;
}

.category-btn.active {
    font-weight: 600;
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* ============================================================
   STRUCTURAL CLASSES (used in header after Tailwind class removal)
   ============================================================ */

/* Header strip */
.nc-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

/* Sub-nav / category bar */
.nc-subnav {
    background-color: var(--color-surface);
    border-color: var(--color-border);
}

/* ============================================================
   TAILWIND UTILITY OVERRIDES
   Maps common Tailwind palette utilities to our design tokens.
   Uses html[data-theme] ancestor to beat Tailwind specificity.
   ============================================================ */

/* Page / main content backgrounds */
html[data-theme] body,
html[data-theme] main {
    background-color: var(--color-bg) !important;
    color: var(--color-text) !important;
    font-family: var(--font-body) !important;
}

/* Surface whites / light grays ? token surfaces */
html[data-theme] .bg-white {
    background-color: var(--color-surface) !important;
}
html[data-theme] .bg-gray-50 {
    background-color: var(--color-surface-2) !important;
}
html[data-theme] .bg-gray-100 {
    background-color: var(--color-surface-offset) !important;
}
html[data-theme] .bg-gray-200 {
    background-color: var(--color-surface-offset-2) !important;
}

/* Dark surface grays (Tailwind dark-mode utilities) ? token surfaces */
html[data-theme] .bg-gray-700,
html[data-theme] .bg-gray-800,
html[data-theme] .bg-gray-900 {
    background-color: var(--color-surface) !important;
}

/* Text colors */
html[data-theme] .text-gray-900,
html[data-theme] .text-gray-800,
html[data-theme] .text-gray-700 {
    color: var(--color-text) !important;
}
html[data-theme] .text-gray-600,
html[data-theme] .text-gray-500 {
    color: var(--color-text-muted) !important;
}
html[data-theme] .text-gray-400,
html[data-theme] .text-gray-300 {
    color: var(--color-text-faint) !important;
}

/* Borders */
html[data-theme] .border-gray-200,
html[data-theme] .border-gray-300 {
    border-color: var(--color-border) !important;
}
html[data-theme] .border-gray-600,
html[data-theme] .border-gray-700 {
    border-color: var(--color-border) !important;
}

/* Hover states */
html[data-theme] .hover\:bg-gray-100:hover {
    background-color: var(--color-surface-offset) !important;
}
html[data-theme] .hover\:bg-gray-700:hover {
    background-color: var(--color-surface-dynamic) !important;
}

/* Dividers */
html[data-theme] .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html[data-theme] .divide-gray-700 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--color-divider) !important;
}

/* Shadows */
html[data-theme] .shadow-md {
    box-shadow: var(--shadow-md) !important;
}
html[data-theme] .shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}
html[data-theme] .shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

/* Breaking news / alert red */
html[data-theme] .bg-red-600,
html[data-theme] .bg-red-700 {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
}

/* Success green */
html[data-theme] .bg-green-600,
html[data-theme] .bg-green-700 {
    background-color: var(--color-success) !important;
}
html[data-theme] .text-green-600,
html[data-theme] .text-green-400 {
    color: var(--color-success) !important;
}

/* White text on dark surfaces */
html[data-theme] .text-white {
    color: var(--color-text-inverse) !important;
}

/* Input & form elements */
html[data-theme] input,
html[data-theme] textarea,
html[data-theme] select {
    background-color: var(--color-surface-2) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}
html[data-theme] input:focus,
html[data-theme] textarea:focus,
html[data-theme] select:focus {
    box-shadow: 0 0 0 3px var(--color-primary-highlight) !important;
    border-color: var(--color-primary) !important;
    outline: none !important;
}
html[data-theme] input::placeholder,
html[data-theme] textarea::placeholder {
    color: var(--color-text-faint) !important;
}