/* ============================================
   Variables
   ============================================ */
:root {
  --bg:             #0C0C0C;
  --bg-lift:        #141414;
  --bg-card:        #181818;
  --border:         #2A2A2A;
  --border-light:   #1E1E1E;
 
  --text-primary:   #FFFAF0;
  --text-secondary: #AFC3D6;
  --text-dim:       #FFD8A8;
  --accent-link:    #da7e46;
  
  --accent-armed:         #FF4C4C;
  --accent-law:           #4DA6FF;
  --accent-disasters:     #FFC300;
  --accent-politics:      #2ECC71;
  --accent-science:       #B266FF;
  --accent-sports:        #FF8C42;
  --accent-international: #FF66CC;
  --accent-art:           #00E5A8;
  --accent-default:       #E5E5E5;
  --accent-business:      #87a3b6;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-sans:    'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --space:      8px;
  --radius:     3px;
  --max-width:  680px;
  --padding:    24px;
  --t:          160ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ============================================
   Container
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--padding) 80px;
}

.indexHeader h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(44px, 10vw, 68px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.9;
   padding: calc(var(--space)*4) 0 calc(var(--space)*3);
  color: var(--text-primary);
}

/* ============================================
   Topics Panel  (#news)
   ============================================ */
#news {
  margin-top: calc(var(--space)*4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.newsHeader {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: calc(var(--space)*1.5) calc(var(--space)*2);
  background: var(--bg-lift);
  border-bottom: 1px solid var(--border);
}

#newsList li {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  padding: calc(var(--space)*1.5) calc(var(--space)*2) calc(var(--space)*1.5) calc(var(--space)*4);
  border-bottom: 1px solid var(--border-light);
  position: relative;
  background: var(--bg-card);
  transition: background var(--t), color var(--t);
  cursor: default;
}

#newsList li:last-child { border-bottom: none; }

#newsList li::before {
  content: '';
  position: absolute;
  left: calc(var(--space)*2);
  top: calc(var(--space)*2.4);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background var(--t);
}

#newsList li:hover { background: var(--bg-lift); color: var(--text-primary); }
#newsList li:hover::before { background: var(--text-primary); }

/* Image strip at bottom of #news */
.img {
  display: flex;
  align-items: center;
  gap: calc(var(--space)*1.5);
  padding: calc(var(--space)*1.5) calc(var(--space)*2);
  background: var(--bg-lift);
  border-top: 1px solid var(--border);
}

.img img {
  width: 52px;
  height: 65px;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius);
  filter: grayscale(25%) contrast(1.05);
  flex-shrink: 0;
}

.caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.6;
  letter-spacing: 0.04em;
}

/* ============================================
   Date Landmark  (.date-section)
   For your existing HTML, also targets .header:has(.date)
   ============================================ */
.date-section,
.header:has(.date) {
  position: relative;
  margin-top: calc(var(--space)*6);
  padding: calc(var(--space)*2) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.date-label,
.header .date {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent-default);
  line-height: 1;
  padding: 0;
}

.date-label .weekday,
.header .date .weekday {
  color: var(--text-primary);
}

/* ============================================
   Category Sections
   ============================================ */
.category-section {
  margin-top: calc(var(--space)*2);
  padding-left: 12px;
  border-left: 2px solid var(--accent-default);
}

/* Add these classes to your .category-section divs */
.Armedconflictsandattacks         { border-left-color: var(--accent-armed); }
.Lawandcrime           { border-left-color: var(--accent-law); }
.Disastersandaccidents     { border-left-color: var(--accent-disasters); }
.Politicsandelections      { border-left-color: var(--accent-politics); }
.Healthandenvironment       { border-left-color: var(--accent-science); }
.Sports        { border-left-color: var(--accent-sports); }
.Internationalrelations { border-left-color: var(--accent-international); }
.Artsandculture { border-left-color: var(--accent-art); }
.Scienceandtechnology { border-left-color: var(--accent-science); }
.Businessandeconomy { border-left-color: var(--accent-business); }


.category-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: calc(var(--space)*2) 0 calc(var(--space)*1.25);
}

/* ============================================
   Event Cards
   ============================================ */
.event {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(var(--space)*2.5);
  margin-bottom: calc(var(--space)*1.5);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}

.event:hover { background: var(--bg-lift); border-color: #363636; }
.event:active { opacity: 0.6; transition-duration: 70ms; }

/* Event title (subsection label) */
.event-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: calc(var(--space)*1.25);
  margin-bottom: calc(var(--space)*1.25);
}
.event-title:empty { display: none; }

/* Additional stories in same event block */
.event-text {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  padding-top: calc(var(--space)*1.5);
  margin-top: calc(var(--space)*1);
  border-top: 1px solid var(--border-light);
  margin-bottom: calc(var(--space)*1);
}

/* ============================================
   Source Badges
   ============================================ */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-link);
  background: var(--bg-lift);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  margin-right: 5px;
  margin-top: 8px;
  transition: color var(--t), border-color var(--t);
}

.source-badge::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background var(--t);
}

.source-badge:hover { color: var(--text-secondary); border-color: #404040; }
.source-badge:hover::before { background: var(--text-secondary); }

#loader-div {
  margin: 0px;
  padding: 0px;
  position: absolute;
  right: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  z-index: 999;
}

.loader {
  position: absolute;
  top: 50%;
  left: 45%;
  width: 48px;
  height: 48px;
  border: 5px solid #FFF;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;    
  animation: rotation 1s linear infinite;
  }

  @keyframes rotation {
  0% {
      transform: rotate(0deg);
  }
  100% {
      transform: rotate(360deg);
  }
} 

/* ============================================
   Animations
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
  .event {
    opacity: 0;
    transform: translateY(12px);
    animation: up 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 60ms;
  }
  .event:nth-child(2) { animation-delay: 110ms; }
  .event:nth-child(3) { animation-delay: 160ms; }
  .event:nth-child(4) { animation-delay: 210ms; }
  .event:nth-child(5) { animation-delay: 260ms; }

  #newsList li {
    opacity: 0;
    transform: translateX(-8px);
    animation: right 250ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  #newsList li:nth-child(1) { animation-delay: 30ms; }
  #newsList li:nth-child(2) { animation-delay: 70ms; }
  #newsList li:nth-child(3) { animation-delay: 110ms; }
  #newsList li:nth-child(4) { animation-delay: 150ms; }

  .date-section,
  .header:has(.date) {
    opacity: 0;
    animation: fade 400ms ease forwards;
    animation-delay: 20ms;
  }

  @keyframes up    { to { opacity: 1; transform: translateY(0); } }
  @keyframes right { to { opacity: 1; transform: translateX(0); } }
  @keyframes fade  { to { opacity: 1; } }
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 720px) {
  :root { --padding: 36px; }
  .event > .event-text:first-of-type { font-size: 21px; }
  .date-ghost { font-size: 120px; }
}

@media (max-width: 400px) {
  .event > .event-text:first-of-type { font-size: 17px; }
  .date-ghost { font-size: 72px; }
}