/* News timeline styling (year-grouped with line breaks between years)
   - Each year is rendered as its own segment: a line from the newest dot in that year
     down to the oldest dot in that year, then the line stops and restarts for the next year.
   - Items reveal on scroll (see .reveal styles).
   - Item spacing can be proportional to time gap using the --gap CSS variable set per item.

   Geometry knobs (easy tweaks):
     --rail-width: width reserved for the dot/line column
     --rail-gap:   horizontal gap between dot column and content
     --dot-size:   dot diameter
     --line-width: timeline line thickness
     --line-x-offset: fine-tune line alignment left/right (px)
*/

#news-container {
  --rail-width: 1.6em;
  --rail-gap: 0.75em;
  --dot-size: 0.9em;
  --line-width: 2px;
  --line-x-offset: 0px;
  --news-date-col: 7.0em;
  --news-col-gap: 0.8em;
  position: relative;
}

/* Each year is a separate "track" */
.news-year-group {
  position: relative;
  margin: 0 0 1.4em 0;
}

/* Year heading: use page defaults (h3 styling) unless you override here */
.news-year {
  margin: 0.5em 0 0.6em 0;
  margin-left: 0;
}

/* The year-specific line segment (JS sets top/height) */
.news-year-line {
  position: absolute;
  left: calc(var(--rail-width) * 0.5 - var(--line-width) * 0.5);
  transform: translateX(var(--line-x-offset));
  width: var(--line-width);
  background: #d0d0d0;
  border-radius: 999px;
  top: 0;
  height: 0;
  pointer-events: none;
}

/* One item row */
.news-item {
  display: flex;
  align-items: flex-start;
  gap: var(--rail-gap);
  margin: 0;
  margin-top: calc(0.6em + var(--gap, 0px));
}

.news-grid {
  display: grid;
  grid-template-columns: var(--news-date-col) 1fr;
  column-gap: var(--news-col-gap);
  align-items: start;
}

/* Date column styling */
.news-date {
  color: #555;
  white-space: nowrap; /* keeps date from wrapping */
}

/* Content column (title/source/extras all align here) */
.news-content {
  min-width: 0; /* prevents grid overflow issues */
}

.news-headline {
  line-height: 1.35;
}

/* On small screens, stack date above content */
@media (max-width: 700px) {
  .news-grid {
    grid-template-columns: 1fr;
    row-gap: 0.25em;
  }
  .news-date {
    white-space: normal;
  }
}

/* The dot column */
.news-rail {
  width: var(--rail-width);
  flex: 0 0 var(--rail-width);
  display: flex;
  justify-content: center;
  position: relative;
}

/* The dot */
.news-dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #808080;
  box-sizing: border-box;
  margin-top: 0.25em; /* aligns dot with text baseline-ish */
}

/* Content column */
.news-content {
  flex: 1 1 auto;
  min-width: 0;
}

.news-row {
  line-height: 1.35;
}

.news-date {
  display: inline-block;
  min-width: 7.5em;
  color: #555;
}

.news-title {
  font-weight: bold;
}

.news-source {
  color: #666;
  margin-left: 0.35em;
}

/* Link styling */
.news-title a {
  text-decoration: none;
}
.news-title a:hover {
  text-decoration: underline;
}

/* Extras as pill links */
.news-extras {
  margin-top: 0.35em;
}

.news-pill {
  display: inline-block;
  margin-right: 0.4em;
  margin-bottom: 0.35em;
  padding: 0.2em 0.55em;
  border: .2em solid #2a5a7a;
  border-radius: .2em;
  text-decoration: none;
  font-size: 0.92em;
  color: #2a5a7a;
  background: white;
}

.news-pill:hover {
  background: #efefef;
}

/* Scroll-reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 450ms ease, transform 450ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Accessibility: reduce motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Mobile tweaks */
@media (max-width: 700px) {
  #news-container {
    --rail-width: 1.4em;
    --rail-gap: 0.6em;
    --dot-size: 0.85em;
  }

  .news-date {
    display: block;
    min-width: 0;
    margin-bottom: 0.15em;
  }

  /* reduce perceived huge gaps on small screens */
  .news-item {
    margin-top: calc(0.5em + (var(--gap, 0px) * 0.65));
  }
}
