/* ============================================================
   BeyNews — Design System v2.0
   Complete rewrite from scratch.
   Palette from TEMP_EXAMPLE: #d6002f / #ff0f39 / #1a1a1a / #f4f6f9
   Font: Poppins
   ============================================================ */

/* --- Font Import --- */
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap");

/* ============================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */
:root {
  /* Primary Brand */
  --primary: #d6002f;
  --primary-hover: #ff0f39;
  --primary-soft: rgba(214, 0, 47, 0.08);
  --primary-glow: rgba(214, 0, 47, 0.25);

  /* Surfaces */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #fafbfc;
  --surface-muted: #f0f2f5;

  /* Text */
  --ink: #1a1a1a;
  --ink-secondary: #333333;
  --ink-muted: #666666;
  --ink-faint: #999999;

  /* Borders */
  --border: #e8eaed;
  --border-strong: #d0d4da;
  --border-hover: #c0c4cc;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-primary: 0 8px 24px rgba(214, 0, 47, 0.2);

  /* Feedback */
  --success: #0a7f43;
  --danger: #d6002f;
  --warning: #e5a100;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Layout */
  --container-max: 1280px;
  --header-height: auto;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease);
  --transition-base: 0.25s var(--ease);
  --transition-slow: 0.4s var(--ease);
}

/* ============================================================
   1b. DARK MODE TOKENS
   ============================================================ */
[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-raised: #222222;
  --surface-hover: #252525;
  --surface-muted: #1e1e1e;

  --ink: #ededed;
  --ink-secondary: #cccccc;
  --ink-muted: #999999;
  --ink-faint: #666666;

  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --border-hover: #444444;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-primary: 0 8px 24px rgba(214, 0, 47, 0.3);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ============================================================
   3. UTILITY CLASSES
   ============================================================ */
.container {
  width: min(var(--container-max), calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
   4. SITE SHELL & RED GRADIENT BAR
   ============================================================ */
.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-shell::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #d6002f, #ff0f39, #d6002f);
  background-size: 200% 100%;
  animation: shimmer 6s ease infinite;
  flex-shrink: 0;
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ============================================================
   5. HEADER
   ============================================================ */
.main-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow var(--transition-base);
  padding-bottom: 0;
}

.main-header.scrolled {
  box-shadow: var(--shadow-md);
}

/* ---- Header Top Bar ---- */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}


.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-badge {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-link {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  padding: 0.35rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.login-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---- Theme Toggle ---- */
.theme-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  background: var(--surface);
}

.theme-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

[data-theme="light"] .icon-moon {
  display: none;
}
[data-theme="dark"] .icon-sun {
  display: none;
}

/* ---- Header Brand ---- */
.header-brand {
  text-align: center;
  padding: 0.35rem 0;
}

.brand-logo {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  color: var(--ink);
  display: inline-block;
  transition: opacity var(--transition-fast);
}

.brand-logo:hover {
  opacity: 0.8;
}

.brand-logo .dot {
  color: var(--primary);
  font-size: 1.1em;
}

/* ---- Navigation ---- */
.main-nav {
  display: flex;
  justify-content: center;
  padding: 0 1rem;
}

.main-nav ul {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav > ul > li {
  position: relative;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  padding: 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
  position: relative;
}

.main-nav a:hover {
  color: var(--primary);
}

.main-nav a::after {
  content: "";
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: all var(--transition-base);
  transform: translateX(-50%);
}

.main-nav a:hover::after {
  width: 100%;
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  min-width: 220px;
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.main-nav > ul > li:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
  display: block;
  margin: 0;
}

.dropdown-menu a {
  display: block;
  padding: 0.7rem 1.2rem;
  font-size: 0.8rem;
  color: var(--ink);
  text-transform: none; /* Keep subcategories normal or uppercase? Usually normal or capital case */
  font-weight: 600;
  border-radius: 0;
}

.dropdown-menu a:hover {
  background: var(--surface-hover);
  color: var(--primary);
  padding-left: 1.5rem; /* Slide effect */
}

.dropdown-menu a::after {
  display: none;
}

.dropdown-arrow {
  opacity: 0.5;
  transition: transform var(--transition-fast);
}

.main-nav > ul > li:hover .dropdown-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

/* ---- Mobile Hamburger ---- */
.mobile-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all var(--transition-base);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================
   6. FLASH MESSAGES
   ============================================================ */
.flash {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  animation: flashIn 0.4s var(--ease);
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-error {
  background: #fff0f0;
  color: #b00020;
  border: 1px solid #fdd;
}

.flash-success {
  background: #edfff4;
  color: #0a7f43;
  border: 1px solid #c9f5d9;
}

[data-theme="dark"] .flash-error {
  background: rgba(214, 0, 47, 0.12);
  border-color: rgba(214, 0, 47, 0.25);
  color: #ff6b6b;
}

[data-theme="dark"] .flash-success {
  background: rgba(10, 127, 67, 0.12);
  border-color: rgba(10, 127, 67, 0.25);
  color: #5ddb88;
}

/* ============================================================
   7. PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  width: min(var(--container-max), calc(100% - 2rem));
  margin: 0 auto;
  padding: var(--space-2xl) 0;
}

/* ============================================================
   8. HERO SECTION (Homepage)
   ============================================================ */
.magazine-hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

.hero-primary {
  position: relative;
}

.hero-card {
  display: block;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-slow);
}

.hero-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.hero-card img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  max-height: 520px;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.hero-card:hover img {
  transform: scale(1.04);
}

/* ---- Hero Slider ---- */
.hero-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-height: 420px;
}

.slider-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
  transition: transform 0.5s var(--ease);
  height: 100%;
}

.hero-card.slide {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none; /* Disable hover transform for slides */
  position: relative;
}

.hero-card.slide:hover {
  transform: none;
  box-shadow: none;
}

.hero-card.slide img {
  min-height: 420px;
  max-height: 520px;
}

/* Fallback for missing images */
.hero-fallback {
  width: 100%;
  height: 100%;
  min-height: 420px;
  background-color: #ffffff;
  background-image: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  border: 1px solid var(--border);
}

.hero-fallback::before {
  display: none;
}

.fallback-text {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-soft);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  max-width: 80%;
  z-index: 1;
}

/* Slider Controls */
.slider-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-md);
  pointer-events: none; /* Let clicks pass through */
  z-index: 10;
}

.slider-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.2rem;
}

.slider-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  transform: scale(1.1);
}

.slider-dots {
  position: absolute;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dot.active, .dot:hover {
  background: #fff;
  transform: scale(1.2);
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2xl);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.4) 50%,
    transparent 100%
  );
  color: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hero-overlay h1 {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-overlay p {
  font-size: 0.95rem;
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.75;
  font-weight: 400;
}

.dot-sep {
  font-size: 0.5rem;
}

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}

.badge-primary {
  background: var(--primary);
  color: #fff;
}

/* ---- Hero Secondary / Trending ---- */
.hero-secondary {
  display: flex;
  flex-direction: column;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.7rem;
  margin-bottom: 1.2rem;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.section-title::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--primary);
  z-index: 1;
}

.section-title h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.view-all {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  transition: opacity var(--transition-fast);
}

.view-all:hover {
  opacity: 0.7;
}

.trending-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.trending-item:last-child {
  border-bottom: none;
}

.trending-item:hover {
  padding-left: 0.5rem;
}

.trend-rank {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--border-strong);
  line-height: 1;
  min-width: 2rem;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.trending-item:hover .trend-rank {
  color: var(--primary);
}

.trend-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.2rem;
  color: var(--ink);
  transition: color var(--transition-fast);
}

.trending-item:hover h4 {
  color: var(--primary);
}

.trend-content small {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ============================================================
   9. MAIN CONTENT AREA (Feed + Sidebar)
   ============================================================ */
.main-content-area {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-2xl);
  align-items: start;
}

.section-header {
  margin-bottom: var(--space-xl);
  position: relative;
  padding-bottom: 0.7rem;
}

.section-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.section-header::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--primary);
  z-index: 1;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============================================================
   10. MAGAZINE CARD (News Cards)
   ============================================================ */
.magazine-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.magazine-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-lg);
  align-items: start;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.magazine-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--surface-muted);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.magazine-card:hover .card-media img {
  transform: scale(1.06);
}

.card-category {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.card-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.card-content h3 a {
  color: var(--ink);
  transition: color var(--transition-fast);
}

.card-content h3 a:hover {
  color: var(--primary);
}

.card-content p {
  font-size: 0.88rem;
  color: var(--ink-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-weight: 500;
  margin-top: auto;
}

.card-footer .card-date::before {
  content: "📅 ";
  font-size: 0.7rem;
}

.card-footer .card-time::before {
  content: "⏱ ";
  font-size: 0.7rem;
}

/* ============================================================
   11. SIDEBAR
   ============================================================ */
.sidebar {
  position: sticky;
  top: calc(var(--header-height, 80px) + var(--space-xl));
}

.sidebar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  transition: border-color var(--transition-fast);
}

.sidebar-widget:hover {
  border-color: var(--border-hover);
}

.sidebar-widget h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-md);
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.sidebar-widget h3::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--primary);
}

.sidebar-widget p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

/* ---- Newsletter Form ---- */
.sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sidebar-form input[type="email"] {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
  outline: none;
}

.sidebar-form input[type="email"]:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.sidebar-form button {
  padding: 0.75rem;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.sidebar-form button:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary);
  transform: translateY(-2px);
}

/* ---- Tag Cloud (Categories) ---- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-item {
  padding: 0.35rem 0.85rem;
  background: var(--surface-muted);
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.tag-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ============================================================
   12. PAGINATION
   ============================================================ */
.pagination-modern {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.pagination-modern a {
  min-width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.pagination-modern a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
}

.pagination-modern a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

/* ============================================================
   13. CATEGORY PAGE
   ============================================================ */
.category-header {
  text-align: center;
  padding: var(--space-2xl) 0;
  margin-bottom: var(--space-2xl);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.category-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d6002f, #ff0f39);
}

.category-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: var(--space-sm);
  background: var(--primary-soft);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
}

.category-title h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.category-title p {
  font-size: 0.95rem;
  color: var(--ink-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Sidebar Widget */
.category-list-widget {
  display: flex;
  flex-direction: column;
}

.cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.cat-item:last-child {
  border-bottom: none;
}

.cat-item:hover {
  color: var(--primary);
  background: var(--primary-soft);
  padding-left: 1rem;
}

.cat-item.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-soft);
}

.cat-item svg {
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
}

.cat-item:hover svg,
.cat-item.active svg {
  opacity: 1;
  transform: translateX(0);
}

/* Empty State */
.empty-state-modern {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.empty-state-modern h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.empty-state-modern p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.8rem;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary);
  transform: translateY(-2px);
}

/* ============================================================
   14. ARTICLE DETAIL PAGE
   ============================================================ */
.article-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-2xl);
  align-items: start;
}

.article-main {
  min-width: 0;
}

.article-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.header-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.meta-date {
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-weight: 500;
}

.article-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--ink);
}

.article-lead {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--ink-muted);
  margin-bottom: var(--space-xl);
  font-weight: 300;
}

.author-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.author-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.author-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.read-time {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.share-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.views-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-weight: 500;
}

/* Featured Image */
.article-featured-image {
  margin: 0 0 var(--space-2xl);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.article-featured-image img {
  width: 100%;
  max-height: 550px;
  object-fit: cover;
}

/* Article Body Typography */
.article-content.typography {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink-secondary);
  max-width: 740px;
  margin: 0 auto;
}

.article-content.typography p {
  margin-bottom: 1.5rem;
}

.article-content.typography h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--ink);
}

.article-content.typography h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.8rem;
  color: var(--ink);
}

.article-content.typography blockquote {
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--primary-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--ink-secondary);
}

.article-content.typography img {
  border-radius: var(--radius-md);
  margin: 2rem 0;
}

.article-content.typography a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(214, 0, 47, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--transition-fast);
}

.article-content.typography a:hover {
  text-decoration-color: var(--primary);
}

.article-content.typography ul,
.article-content.typography ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.article-content.typography li {
  margin-bottom: 0.5rem;
  list-style: disc;
}

.article-content.typography ol li {
  list-style: decimal;
}

/* Related Articles (in sidebar) */
.related-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.related-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: all var(--transition-fast);
}

.related-item:last-child {
  border-bottom: none;
}

.related-item:hover {
  padding-left: 0.3rem;
}

.related-item img {
  width: 72px;
  height: 54px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.related-info h4 {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.2rem;
  color: var(--ink);
  transition: color var(--transition-fast);
}

.related-item:hover h4 {
  color: var(--primary);
}

.related-info time {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* ============================================================
   15. 404 PAGE
   ============================================================ */
.not-found {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.not-found h1 {
  font-size: 8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #d6002f, #ff0f39);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-md);
  animation: pulse404 2s ease-in-out infinite;
}

@keyframes pulse404 {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.03);
  }
}

.not-found p {
  font-size: 1.15rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-xl);
  font-weight: 400;
}

.not-found a {
  display: inline-block;
  padding: 0.85rem 2.2rem;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.not-found a:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary);
  transform: translateY(-3px);
}

/* ============================================================
   16. FOOTER
   ============================================================ */
.main-footer {
  background: #0f0f0f;
  color: #e0e0e0;
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

.main-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d6002f, #ff0f39);
}

.footer-content {
  width: min(var(--container-max), calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-2xl);
  padding: var(--space-3xl) 0 var(--space-2xl);
  border-bottom: 1px solid #222;
}

.footer-brand .brand-logo {
  color: #ffffff;
  font-size: 1.8rem;
  margin-bottom: var(--space-md);
  display: inline-block;
}

.footer-brand p {
  color: #888;
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 320px;
}

.footer-links h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: var(--space-lg);
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.footer-links a {
  color: #aaa;
  font-size: 0.88rem;
  font-weight: 400;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
  padding-left: 0.3rem;
}

.footer-bottom {
  width: min(var(--container-max), calc(100% - 2rem));
  margin: 0 auto;
  text-align: center;
  padding: var(--space-lg) 0;
  font-size: 0.8rem;
  color: #555;
}

/* ============================================================
   17. RESPONSIVE DESIGN (Mobile First Breakpoints)
   ============================================================ */

/* Tablet and below */
@media (max-width: 1024px) {
  .magazine-hero {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .main-content-area {
    grid-template-columns: 1fr;
  }

  .article-container {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .hero-card img {
    min-height: 280px;
    max-height: 380px;
  }

  .hero-overlay h1 {
    font-size: 1.5rem;
  }

  .sidebar {
    position: static;
  }
}

/* Mobile */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .page-content {
    padding: var(--space-xl) 0;
  }

  /* Header Mobile */
  .header-brand {
    padding: 0.7rem 0;
  }

  .brand-logo {
    font-size: 1.8rem;
  }

  .header-top {
    padding: 0.4rem 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .main-nav {
    display: none;
    border-top: 1px solid var(--border);
  }

  .main-nav.active {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    min-width: auto;
    width: 100%;
  }

  .main-nav li a {
    padding: 0.75rem 1rem;
    border-radius: 0;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .main-nav li a::after {
    display: none;
  }

  /* Cards */
  .magazine-card {
    grid-template-columns: 1fr;
  }

  .card-media {
    aspect-ratio: 16/9;
  }

  .card-content {
    padding: var(--space-md);
  }

  .card-content h3 {
    font-size: 1rem;
  }

  /* Article */
  .article-header h1 {
    font-size: 1.6rem;
  }

  .article-lead {
    font-size: 0.95rem;
  }

  .author-bar {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  /* Category */
  .category-title h1 {
    font-size: 1.6rem;
  }

  /* Footer */
  .footer-content {
    padding: var(--space-2xl) 0 var(--space-xl);
  }

  /* 404 */
  .not-found h1 {
    font-size: 5rem;
  }
}

/* Very small mobile */
@media (max-width: 480px) {
  .header-actions {
    gap: 0.4rem;
  }

  .login-link {
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
  }

  .hero-overlay {
    padding: var(--space-lg);
  }

  .hero-overlay h1 {
    font-size: 1.2rem;
  }

  .hero-overlay p {
    display: none;
  }
}

/* ============================================================
   18. SCROLL ANIMATIONS (Intersection Observer driven)
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.6s var(--ease);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   19. SELECTION & SCROLLBAR
   ============================================================ */
::selection {
  background: var(--primary);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0f0f0f;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #333;
}
