/* 1. GLOBAL RESET & VARIABLES */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #fff; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

:root {
  --blue: #000000;
  --link-blue: #014da1;
  --border: rgba(0,0,0,.12);
  --font: "Neue Haas Grotesk Display Pro", "Neue Haas Grotesk Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* 2. NAVIGATION & HEADER */
.banner {
  width: 100%; background: #fff; color: #000; padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-family: var(--font); font-size: 20px; line-height: 1.2; font-weight: 700;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

.brand { color: var(--blue); text-decoration: none; white-space: nowrap; }

.links { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 0; justify-content: flex-end; }
.links a { color: var(--blue); text-decoration: none; font: inherit; padding-left: 12px; white-space: nowrap; }
.links a:hover { text-decoration: underline; }
.links a + a::before { content: "•"; display: inline-block; margin: 0 12px 0 0; color: #000; }

.nav-toggle, .hamburger { display: none; }

/* 3. LAYOUT COMPONENTS */
.spacer { height: 48px; background: #fff; }
.hero img { display: block; width: 100%; height: auto; }

.article, .page-header, .controls, #newsContainer, .loading, .empty-state, .error {
  max-width: 68ch; margin-left: auto; margin-right: auto; padding: 0 18px; font-family: var(--font);
}

.article { margin-top: 28px; margin-bottom: 64px; font-size: 20px; line-height: 1.6; color: #000; }
.article p + p { margin-top: 16px; }

/* 4. NEWS PAGE SPECIFICS */
.page-header { margin-top: 48px; margin-bottom: 32px; }
.page-header h1 { font-size: 32px; font-weight: 700; margin: 0 0 12px 0; }
.page-header p { font-size: 20px; line-height: 1.6; color: rgba(0,0,0,.75); }

.filter-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-btn {
  padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: 4px;
  cursor: pointer; font-family: var(--font); font-size: 16px; transition: all 0.2s;
}
.filter-btn.active { background: #000; color: #fff; border-color: #000; }

#newsSearch {
  width: 100%; padding: 12px 15px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; background: #f9f9f9; font-family: var(--font); margin-bottom: 32px;
}

/* 5. INDIVIDUAL NEWS ITEMS (FIXED) */
#newsContainer { display: flex; flex-direction: column; gap: 40px; margin-bottom: 64px; }

.news-item {
  background: #fff; padding-bottom: 32px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; /* Vertical stack prevents squashing */
}

.news-meta {
  font-size: 14px;
  line-height: 1.5; /* Increased for better legibility */
  color: rgba(0,0,0,.75);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  
  /* The Magic Fix */
  display: flex;
  flex-wrap: wrap; /* Allows items to drop to a new line instead of squashing */
  gap: 8px 16px;   /* Adds a gap between Date and Source */
}

/* Ensures the labels don't merge with the values */
.news-meta span {
  display: inline-block;
  white-space: nowrap;
  margin-right: 15px; /* This creates the physical gap between Date and Source */
}

/* Remove margin from the last span so it doesn't push against the edge */
.news-meta span:last-child {
  margin-right: 0;
}
.news-title { font-size: 24px; font-weight: 700; line-height: 1.25; margin: 0 0 12px 0; }
.news-title a { color: #000; text-decoration: none; }
.news-title a:hover { text-decoration: underline; }

.news-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Show exactly 3 lines of text */
  -webkit-box-orient: vertical;  
  overflow: hidden; /* Hide anything beyond those 3 lines */
  
  font-size: 18px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 14px;
  min-height: 4.8em; /* Ensures boxes are roughly the same height even with short text */
}
.read-more { font-size: 14px; color: var(--link-blue); text-decoration: none; font-weight: 500; }
.read-more:hover { text-decoration: underline; }

/* 6. FOOTER */
.footer-banner {
  width: 100%; background: #fff; border-top: 1px solid var(--border); padding: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.footer-left { display: flex; flex-direction: column; gap: 10px; }
.footer-credit, .footer-banner .email { font-family: var(--font); font-size: 14px; }
.footer-banner .email { color: var(--link-blue); text-decoration: none; }
.footer-banner .uni-logo { height: 100px; width: auto; }

/* 7. LOADING & UTILITIES */
.spinner {
  width: 32px; height: 32px; border: 3px solid #f3f3f3; border-top: 3px solid #000;
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* 8. MOBILE RESPONSIVENESS */
@media (max-width: 700px) {
  .banner { font-size: 16px; position: relative; }
  .links { display: none; }
  .hamburger { display: inline-block; margin-left: auto; cursor: pointer; padding: 6px 10px; }
  .nav-toggle:checked ~ .links {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); padding: 10px 14px;
    flex-direction: column; gap: 10px; z-index: 100;
  }
  .links a { padding-left: 0; }
  .links a + a::before { content: none; }
  
  .article { font-size: 16px; }
  .page-header h1 { font-size: 24px; }
  .news-title { font-size: 20px; }
  .news-excerpt { font-size: 16px; }
  
  .footer-banner { flex-direction: column; align-items: flex-start; }
  .footer-banner .uni-logo { height: 60px; margin-left: 0; }
}
