/* ============================================
   APEX 4.1 — The Pulse of AI & Technology
   Dark Editorial Design System
   ============================================ */

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

:root {
  /* Core palette — dark editorial */
  --bg-primary: #0A0A0F;
  --bg-secondary: #111118;
  --bg-card: #16161F;
  --bg-card-hover: #1C1C28;
  --bg-elevated: #1E1E2A;
  --bg-accent: #FF3333;

  --text-primary: #F0F0F5;
  --text-secondary: #A0A0B8;
  --text-muted: #6B6B80;
  --text-accent: #FF3333;

  --border: #2A2A3A;
  --border-light: #1F1F2E;

  --red: #FF3333;
  --red-dark: #CC2828;
  --red-glow: rgba(255, 51, 51, 0.15);
  --electric-blue: #3B82F6;
  --neon-green: #10B981;
  --amber: #F59E0B;
  --purple: #8B5CF6;

  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(255,51,51,0.2);

  --radius: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.15;
  font-weight: 700;
}
h1 { font-size: 3.5rem; letter-spacing: -0.03em; }
h2 { font-size: 2.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.5rem; letter-spacing: -0.01em; }
h4 { font-size: 1.125rem; }
p { color: var(--text-secondary); line-height: 1.7; }

.text-accent { color: var(--text-accent); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: var(--font-mono); }

/* --- Breaking News Ticker --- */
.ticker-bar {
  background: var(--red);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
}

.ticker-inner {
  display: inline-flex;
  animation: ticker 30s linear infinite;
  gap: 48px;
}

.ticker-inner span::before {
  content: '//';
  margin-right: 8px;
  opacity: 0.5;
}

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

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-logo .version {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--red);
  background: var(--red-glow);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: relative;
  top: -6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text-primary); }
.nav-links a.active { color: var(--red); }

.nav-search {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  width: 200px;
  transition: all var(--transition);
}
.nav-search-input:focus {
  outline: none;
  border-color: var(--red);
  width: 260px;
}
.nav-search-input::placeholder { color: var(--text-muted); }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
}

/* --- Hero / Lead Story --- */
.hero-section {
  padding: 32px 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

.hero-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  transition: transform var(--transition);
}
.hero-main:hover { transform: translateY(-2px); }

.hero-main-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.hero-main-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 30%, rgba(10,10,15,0.95) 90%);
}

.hero-main-content {
  position: relative;
  z-index: 1;
  padding: 36px;
}

.hero-main-content h1 {
  font-size: 2.75rem;
  margin-bottom: 12px;
  line-height: 1.1;
}

.hero-main-content p {
  font-size: 1.0625rem;
  max-width: 560px;
  margin-bottom: 16px;
}

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-sidebar-card {
  flex: 1;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  transition: transform var(--transition);
}
.hero-sidebar-card:hover { transform: translateY(-2px); }

.hero-sidebar-card .card-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.hero-sidebar-card .card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 20%, rgba(10,10,15,0.9) 85%);
}

.hero-sidebar-card .card-content {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.hero-sidebar-card h3 {
  font-size: 1.125rem;
  line-height: 1.25;
}

/* --- Tags / Labels --- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 3px;
  margin-bottom: 10px;
}
.tag-red { background: var(--red); color: #fff; }
.tag-blue { background: var(--electric-blue); color: #fff; }
.tag-green { background: var(--neon-green); color: #fff; }
.tag-amber { background: var(--amber); color: #000; }
.tag-purple { background: var(--purple); color: #fff; }
.tag-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* --- Meta Info --- */
.meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.meta-dot::before {
  content: '\00B7';
  margin-right: 0px;
}
.meta-author { color: var(--text-secondary); font-weight: 600; }

/* --- Section Divider --- */
.section-divider {
  padding: 48px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--red);
}

.section-divider h2 {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-divider h2::before {
  content: '';
  width: 4px;
  height: 22px;
  background: var(--red);
  border-radius: 2px;
}

.section-divider a {
  font-size: 0.8125rem;
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: opacity var(--transition);
}
.section-divider a:hover { opacity: 0.7; }

/* --- Article Cards --- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 24px 0 48px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.article-card:hover {
  border-color: var(--border);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.article-card-img {
  height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.article-card-img .tag {
  position: absolute;
  top: 12px;
  left: 12px;
}

.article-card-body {
  padding: 20px;
}
.article-card-body h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
  line-height: 1.3;
  transition: color var(--transition);
}
.article-card:hover .article-card-body h3 { color: var(--red); }
.article-card-body p {
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Trending Sidebar --- */
.trending-list {
  display: flex;
  flex-direction: column;
}

.trending-item {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.trending-item:last-child { border-bottom: none; }
.trending-item:hover { background: var(--bg-card); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius); }

.trending-rank {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  min-width: 36px;
}
.trending-item:hover .trending-rank { color: var(--red); }

.trending-content h4 {
  font-size: 0.9375rem;
  line-height: 1.35;
  margin-bottom: 6px;
}
.trending-content .meta { font-size: 0.6875rem; }

/* --- Two Column Layout --- */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
}

/* --- Newsletter CTA --- */
.newsletter-cta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  margin-top: 24px;
}
.newsletter-cta h3 { margin-bottom: 8px; }
.newsletter-cta p { font-size: 0.875rem; margin-bottom: 20px; }

.newsletter-form {
  display: flex;
  gap: 8px;
}
.newsletter-form input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
}
.newsletter-form input:focus {
  outline: none;
  border-color: var(--red);
}
.newsletter-form input::placeholder { color: var(--text-muted); }

.btn-red {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--transition);
}
.btn-red:hover {
  background: var(--red-dark);
  box-shadow: var(--shadow-glow);
}

/* --- Wide Feature Banner --- */
.feature-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  margin: 24px 0 48px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.feature-banner:hover { border-color: var(--text-muted); }

.feature-banner-img {
  min-height: 320px;
  background-size: cover;
  background-position: center;
}

.feature-banner-content {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.feature-banner-content h2 { font-size: 2rem; margin-bottom: 12px; }
.feature-banner-content p { font-size: 1rem; margin-bottom: 20px; }

/* --- Footer --- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 64px 0 32px;
  margin-top: 48px;
}

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

.footer-brand p {
  font-size: 0.875rem;
  margin-top: 12px;
  max-width: 300px;
}

.footer h4 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.footer-links li { margin-bottom: 10px; }
.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--red); }

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

.footer-social {
  display: flex;
  gap: 16px;
}
.footer-social a { transition: color var(--transition); }
.footer-social a:hover { color: var(--text-primary); }

/* --- Article Page --- */
.article-hero {
  padding: 120px 0 48px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}
.article-hero h1 { margin-bottom: 16px; }
.article-hero .meta { justify-content: center; margin-bottom: 32px; }

.article-featured-img {
  width: 100%;
  max-width: 960px;
  margin: 0 auto 48px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-card);
}

.article-content {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 64px;
}
.article-content p {
  font-size: 1.0625rem;
  line-height: 1.85;
  margin-bottom: 24px;
  color: var(--text-secondary);
}
.article-content h2 {
  font-size: 1.75rem;
  margin: 48px 0 16px;
}
.article-content h3 {
  font-size: 1.25rem;
  margin: 36px 0 12px;
}
.article-content blockquote {
  border-left: 3px solid var(--red);
  padding: 16px 0 16px 24px;
  margin: 32px 0;
  font-size: 1.125rem;
  font-style: italic;
  color: var(--text-primary);
}
.article-content code {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--neon-green);
}
.article-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  overflow-x: auto;
  margin: 24px 0;
}
.article-content pre code {
  background: none;
  padding: 0;
}
.article-content ul, .article-content ol {
  margin: 16px 0 24px 24px;
  list-style: disc;
}
.article-content li {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* --- Category Page --- */
.category-hero {
  padding: 120px 0 48px;
  border-bottom: 2px solid var(--red);
}
.category-hero h1 { margin-bottom: 12px; }

/* --- About Page --- */
.about-hero-section {
  padding: 120px 0 64px;
  text-align: center;
}
.about-hero-section h1 { margin-bottom: 20px; }
.about-hero-section p {
  max-width: 640px;
  margin: 0 auto;
  font-size: 1.25rem;
}

.about-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.about-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 48px 0;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  transition: border-color var(--transition);
}
.pillar-card:hover { border-color: var(--red); }
.pillar-card .pillar-icon { font-size: 2rem; margin-bottom: 16px; }
.pillar-card h3 { font-size: 1.125rem; margin-bottom: 8px; }
.pillar-card p { font-size: 0.875rem; }

/* --- Affiliate / Sponsored Units --- */
.sponsored-unit {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.sponsored-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sponsored-unit p { font-size: 0.875rem; margin: 0; }

/* --- Sidebar Ad Slots --- */
.sidebar-ad {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-top: 24px;
}
.sidebar-ad .ad-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.sidebar-ad .ad-placeholder {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- VIP Promo Inline --- */
.vip-promo-inline {
  background: linear-gradient(135deg, rgba(255,51,51,0.06) 0%, rgba(139,92,246,0.06) 100%);
  border: 1px solid rgba(255,51,51,0.15);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin: 24px 0;
  transition: border-color var(--transition);
}
.vip-promo-inline:hover { border-color: var(--red); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  h1 { font-size: 2.5rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-sidebar { flex-direction: row; }
  .hero-sidebar-card { min-height: 220px; }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .feature-banner { grid-template-columns: 1fr; }
  .feature-banner-img { min-height: 220px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .about-pillars { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }

  .nav-links { display: none; }
  .nav-search { display: none; }
  .mobile-menu-btn { display: block; }

  .hero-main { min-height: 360px; }
  .hero-main-content h1 { font-size: 1.75rem; }
  .hero-sidebar { flex-direction: column; }
  .articles-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; }
}
