/* =====================================================================
   Inner pages & homepage section rail
   ===================================================================== */

/* ----- Page hero (subpages) ----- */
.page-hero {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.page-hero .section-title { margin-bottom: .35rem; }
.page-hero-lead {
  color: var(--muted);
  max-width: 720px;
  margin-bottom: 0;
  font-size: 1.05rem;
}

/* ----- Homepage section rail (scroll anchors) ----- */
.section-rail {
  position: fixed;
  right: clamp(.75rem, 2vw, 1.25rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 1020;
  display: none;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: .5rem;
  transition: transform .25s ease;
}
@media (min-width: 1200px) {
  .section-rail { display: flex; }
}
.section-rail-panel {
  overflow: hidden;
  transition: opacity .32s ease, transform .32s ease, max-height .35s ease;
}

/* Collapse handle — white vertical MENU tab; visible only when scrolled */
.section-rail-handle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  padding: .7rem .45rem;
  border: none;
  border-radius: 6px;
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(15, 27, 45, 0.18);
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.section-rail-handle-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .12rem;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}
.section-rail-handle:hover {
  background: #f4f7fb;
  box-shadow: 0 6px 22px rgba(15, 27, 45, 0.22);
}
.section-rail-handle:active { transform: scale(0.96); }
.section-rail-handle:focus-visible {
  outline: 2px solid var(--blue-dark);
  outline-offset: 2px;
}

/* Scrolled: links collapse away; MENU handle slides in */
.section-rail.is-collapsed .section-rail-handle {
  display: flex;
  animation: menuHandleIn .38s ease-out both;
}
.section-rail.is-collapsed .section-rail-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateX(1rem) scale(0.96);
  max-height: 0;
  pointer-events: none;
}
.section-rail.is-collapsed.is-open .section-rail-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  max-height: 24rem;
  pointer-events: auto;
  animation: menuPanelIn .32s ease-out both;
}

/* Opened from collapsed MENU — styles on #sectionRailPanel directly */
#sectionRailPanel.is-panel-open {
  background: rgba(7, 22, 45, 0.82);
  border-radius: 6px;
  padding: .35rem .25rem;
}
#sectionRailPanel.is-panel-open a {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: none;
}
#sectionRailPanel.is-panel-open a:hover,
#sectionRailPanel.is-panel-open a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

@keyframes menuHandleIn {
  from { opacity: 0; transform: translateX(1.25rem); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes menuPanelIn {
  from { opacity: 0; transform: translateX(0.75rem) scale(0.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .section-rail,
  .section-rail-panel,
  .section-rail.is-collapsed .section-rail-handle,
  .section-rail.is-collapsed.is-open .section-rail-panel { transition: none; animation: none; }
}

.section-rail ul {
  list-style: none;
  margin: 0;
  padding: .5rem 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.section-rail a {
  display: block;
  padding: 0.3rem 0.85rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  border-radius: 6px;
  white-space: nowrap;
  transition: color .2s, background .2s;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}
.section-rail a:hover,
.section-rail a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}
.section-rail a.active { font-weight: 700; }
.section-rail a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* ----- News archive ----- */
.news-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.5rem;
}
.news-year {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
  font-size: 1.35rem;
  color: var(--navy);
}
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.news-card h3,
.news-card h4 {
  font-size: 1.05rem;
  margin-bottom: .65rem;
}
.news-card .news-date {
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: .35rem;
}
.news-card p:last-child { margin-bottom: 0; }
.news-card .media-frame { margin: 1rem 0; }
.news-card-featured {
  border-color: rgba(37, 99, 235, 0.25);
  background: linear-gradient(135deg, #ffffff 0%, var(--bg-2) 100%);
}
.news-archive-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) {
  .news-archive-item { grid-template-columns: 140px 1fr; gap: 1.25rem; }
}
.news-archive-item:last-child { border-bottom: none; }
.news-archive-thumb {
  width: 100%;
  max-width: 140px;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-3);
  object-fit: cover;
}
.news-list-links {
  list-style: none;
  padding: 0;
  margin: .75rem 0 0;
}
.news-list-links li {
  padding: .35rem 0;
  padding-left: 1.1rem;
  position: relative;
}
.news-list-links li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .75rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue-dark);
}

/* ----- Research / publications lists ----- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.project-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.project-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-3);
}
.project-card-body {
  padding: 1.15rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-card-body h3 { font-size: 1rem; margin-bottom: .5rem; }
.project-card-body p {
  font-size: .92rem;
  color: var(--muted);
  flex: 1;
  margin-bottom: .75rem;
}
.project-tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--blue-dark);
  margin-bottom: .35rem;
}

.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
  color: var(--muted);
}
.pub-list li:last-child { border-bottom: none; }
.pub-list a { font-weight: 600; }

.software-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}
.software-block h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.software-links { list-style: none; padding: 0; margin: .5rem 0 0; }
.software-links li { padding: .25rem 0; }

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.people-section-title {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.content-prose { max-width: 820px; }
.content-prose p { color: var(--muted-2); }
.content-prose h3 { margin-top: 1.75rem; margin-bottom: .65rem; font-size: 1.15rem; }

.breadcrumb-nav {
  font-size: .88rem;
  margin-bottom: .75rem;
}
.breadcrumb-nav a { color: var(--muted); }
.breadcrumb-nav a:hover { color: var(--blue-dark); }
