/* ═══════════════════════════════════════════════════════════
   WorldNewsHub — Dark Editorial Broadsheet
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:          #0e0e0e;
  --bg-card:     #161616;
  --bg-hover:    #1e1e1e;
  --border:      #2a2a2a;
  --border-light:#333;
  --text:        #e8e0d0;
  --text-muted:  #8a8278;
  --text-dim:    #5a5450;
  --accent:      #c8222a;
  --accent-glow: rgba(200, 34, 42, 0.15);
  --gold:        #c9a84c;
  --world:       #3a6bc8;
  --tech:        #2eaa6f;
  --finance:     #c9a84c;
  --sports:      #c8222a;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;
  --radius:       3px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0,0,0,.6);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.header-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.separator { margin: 0 0.5rem; color: var(--border-light); }

.refresh-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  letter-spacing: 0.1em;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.refresh-btn.loading { opacity: 0.5; pointer-events: none; }
.refresh-icon { display: inline-block; transition: transform 0.5s; }
.refresh-btn.loading .refresh-icon { animation: spin 1s linear infinite; }

/* ── MASTHEAD ── */
.masthead {
  text-align: center;
  padding: 1rem 0 0.75rem;
}

.masthead-rule {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin-bottom: 0.75rem;
}
.masthead-rule:last-child { margin-bottom: 0; margin-top: 0.75rem; }

.masthead-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.masthead-title .accent { color: var(--accent); }

.masthead-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 300;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* ── NAV ── */
.section-nav {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  margin: 0 -2rem;
  padding: 0 2rem;
}

.nav-item {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-item:hover       { color: var(--text); }
.nav-item.active      { color: var(--text); border-bottom-color: var(--accent); }
.nav-item[data-section="world"]:hover   { color: var(--world); border-bottom-color: var(--world); }
.nav-item[data-section="tech"]:hover    { color: var(--tech);  border-bottom-color: var(--tech);  }
.nav-item[data-section="finance"]:hover { color: var(--gold);  border-bottom-color: var(--gold);  }
.nav-item[data-section="sports"]:hover  { color: var(--sports);border-bottom-color: var(--sports);}

/* ── TICKER ── */
.ticker-wrap {
  display: flex;
  align-items: center;
  background: var(--accent);
  overflow: hidden;
  height: 36px;
}

.ticker-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #fff;
  background: rgba(0,0,0,0.3);
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-track {
  white-space: nowrap;
  animation: ticker 60s linear infinite;
  display: flex;
  align-items: center;
  gap: 3rem;
  padding-left: 2rem;
}

.ticker-item {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: #fff;
  opacity: 0.95;
}

.ticker-item::after {
  content: '  ◆';
  opacity: 0.5;
  margin-left: 3rem;
}

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

/* ── MAIN CONTENT ── */
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* ── LOADING / ERROR STATES ── */
.loading-state {
  text-align: center;
  padding: 5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state { text-align: center; padding: 3rem; color: var(--accent); }
.error-state button {
  background: var(--accent); color: #fff; border: none;
  padding: 0.4rem 1rem; cursor: pointer; margin-left: 0.5rem;
  border-radius: var(--radius); font-family: var(--font-mono);
}
.hidden { display: none !important; }

/* ── SECTION ── */
.news-section {
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.news-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-flag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.world-flag   { background: rgba(58,107,200,0.15); color: var(--world);   border: 1px solid rgba(58,107,200,0.3); }
.tech-flag    { background: rgba(46,170,111,0.15); color: var(--tech);    border: 1px solid rgba(46,170,111,0.3); }
.finance-flag { background: rgba(201,168,76,0.15); color: var(--gold);    border: 1px solid rgba(201,168,76,0.3); }
.sports-flag  { background: rgba(200,34,42,0.15);  color: var(--sports);  border: 1px solid rgba(200,34,42,0.3); }

.section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-light), transparent);
}

/* ── ARTICLES GRID ── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

/* Card 0 (featured) spans 6 cols and 2 rows */
.article-card:nth-child(1) { grid-column: span 6; grid-row: span 2; }
/* Cards 1-2 each 3 cols, row 1 */
.article-card:nth-child(2) { grid-column: span 3; }
.article-card:nth-child(3) { grid-column: span 3; }
/* Cards 3-4 each 3 cols, row 2 */
.article-card:nth-child(4) { grid-column: span 3; }
.article-card:nth-child(5) { grid-column: span 3; }

.article-card {
  background: var(--bg-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.article-card:hover { background: var(--bg-hover); }

/* Featured card extras */
.article-card:nth-child(1) {
  padding: 2rem;
  gap: 1rem;
}

.article-card:nth-child(1) .article-title {
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
  line-height: 1.25;
  -webkit-line-clamp: 5;
}

.article-card:nth-child(1) .article-desc {
  display: block;
  -webkit-line-clamp: 5;
}

/* Image on featured */
.card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  opacity: 0.85;
  display: block;
}

.card-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.3;
}

/* Hide image on small cards */
.article-card:not(:nth-child(1)) .card-image,
.article-card:not(:nth-child(1)) .card-image-placeholder {
  display: none;
}

.article-source {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.article-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.article-card:hover .article-title { color: #fff; }

.article-desc {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.55;
  display: none;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.article-meta {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.read-more {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 0.5rem;
}

.article-card:hover .read-more::after {
  content: ' →';
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-info, .footer-copy {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  line-height: 1.8;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .articles-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .article-card:nth-child(1) { grid-column: span 6; grid-row: span 1; }
  .article-card:nth-child(2) { grid-column: span 3; }
  .article-card:nth-child(3) { grid-column: span 3; }
  .article-card:nth-child(4) { grid-column: span 3; }
  .article-card:nth-child(5) { grid-column: span 3; }
}

@media (max-width: 600px) {
  .site-header { padding: 0 1rem; }
  .content     { padding: 1.5rem 1rem; }
  .section-nav { overflow-x: auto; }
  .nav-item    { padding: 0.6rem 0.8rem; font-size: 0.65rem; }
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1px;
  }
  .article-card,
  .article-card:nth-child(1),
  .article-card:nth-child(2),
  .article-card:nth-child(3),
  .article-card:nth-child(4),
  .article-card:nth-child(5) {
    grid-column: 1;
    grid-row: auto;
  }
  .article-card:nth-child(1) .card-image,
  .article-card:nth-child(1) .card-image-placeholder {
    display: none;
  }
}

@media (max-width: 480px) {
  .masthead-title { font-size: 1.8rem; }
}

/* ═══════════════════════════════════════════════════════════
   AD SLOTS
   ═══════════════════════════════════════════════════════════ */

.ad-slot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

/* Leaderboard — top banner */
.ad-leaderboard {
  min-height: 90px;
  padding: 0.5rem 0;
}

/* Mid-page rectangles */
.ad-mid {
  min-height: 280px;
  margin: 0 auto 2rem;
  max-width: 1280px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Footer banner */
.ad-footer-banner {
  min-height: 90px;
  padding: 0.5rem 0;
  background: var(--bg);
}

/* Placeholder shown when ad network is not yet active */
.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  height: 100%;
  min-height: inherit;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px dashed var(--border-light);
  margin: 0.5rem 1rem;
  border-radius: var(--radius);
}

.ad-size {
  color: var(--border-light);
  font-size: 0.6rem;
}

/* On mobile: hide leaderboard placeholders, keep rectangles */
@media (max-width: 600px) {
  .ad-leaderboard,
  .ad-footer-banner { display: none; }
  .ad-mid { min-height: 200px; }
}

/* ── FOOTER LINKS ── */
.footer-links {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-sep {
  margin: 0 0.5rem;
  color: var(--border-light);
}
