/* ── TIMELINE ──- */
.timeline-section {
  padding: 3rem 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
}

.timeline-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.75rem;
}

.timeline-track {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  /* Allow horizontal scroll on very small screens as a last resort,
     but nodes are sized to fit comfortably at 320px+ */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.timeline-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  z-index: 0;
}

.tl-node {
  flex: 1;
  min-width: 80px; /* was 110px — tighter on mobile */
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
  /* Larger tap target */
  padding: 0.5rem 0;
}

.tl-year {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 0.45rem;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.tl-node.active .tl-year,
.tl-node:hover .tl-year { color: var(--accent); }

.tl-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid #b0aca5;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.tl-node:hover .tl-dot {
  border-color: var(--accent);
  transform: scale(1.25);
}
.tl-node.active .tl-dot {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.25);
}

.tl-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.4;
  transition: color 0.2s;
  padding: 0 0.25rem;
  margin-top: 0.45rem;
}
.tl-node.active .tl-label,
.tl-node:hover .tl-label { color: var(--accent); }

.tl-panel {
  display: none;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  animation: tlFade 0.2s ease;
}
.tl-panel.visible { display: grid; }

@keyframes tlFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tl-panel-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: #c8d0d8;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tl-panel-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-panel-img-caption {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  text-align: center;
  padding: 1rem;
}

.tl-panel-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
}

.tl-panel-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.tl-panel-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.tl-panel-summary {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: var(--ink-2);
  line-height: 1.7;
}

.tl-more {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.15rem;
  transition: opacity 0.15s;
}
.tl-more:hover { opacity: 0.7; }

/* ── BROAD INTRO ── */
.broad-intro {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.broad-img {
  width: 100%;
  height: 375px;
  background: #c8d0d8;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.broad-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.broad-lead {
  font-weight: 500;
  color: var(--ink);
}

.broad-text p {
  font-family: 'EB Garamond', serif;
  font-size: 1.25rem;
  color: var(--ink-2);
  line-height: 1.75;
  margin-bottom: 0.8rem;
}
.broad-text p:last-child { margin-bottom: 0; }

.img-hover-wrap { position: relative; }
.img-hover-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 0.85rem 0.75rem;
  background: linear-gradient(to top, rgba(10,10,8,0.95) 0%, rgba(10,10,8,0.7) 40%, transparent 100%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
  opacity: 1;
  transition: opacity 0.2s;
}


/* ── DETAIL SECTIONS ── */
.rd-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.research-detail {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  align-items: start;
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 72px;
}
.research-detail.flip { grid-template-columns: 340px 1fr; }
.research-detail.flip .rd-img { order: -1; }
.research-detail:last-of-type { border-bottom: none; }

.rd-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}

.rd-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 1rem;
}

.rd-body p {
  font-family: 'EB Garamond', serif;
  font-size: 1.15rem;
  color: var(--ink-2);
  line-height: 1.75;
  margin-bottom: 0.8rem;
}
.rd-body p:last-child { margin-bottom: 0; }
.rd-body p a {
  color: var(--accent);
  text-decoration: underline;
}

.rd-img {
  width: 100%;
  height: auto;
  background: #c8d0d8;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.rd-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── CAROUSEL ── */
.carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 3/5;
  align-self: start;
  border-radius: 3px;
  overflow: hidden;
}

#carousel-coldspray { aspect-ratio: 1/1; }

.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.carousel-slide.active { opacity: 1; }

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 0.85rem 0.75rem;
  background: linear-gradient(to top, rgba(10,10,8,0.95) 0%, rgba(10,10,8,0.6) 50%, transparent 100%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10,10,8,0.35);
  border: none;
  color: white;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
  /* Larger tap target on mobile */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-btn:hover { background: rgba(10,10,8,0.65); }
.carousel-btn.prev { left: 0; border-radius: 0 3px 3px 0; }
.carousel-btn.next { right: 0; border-radius: 3px 0 0 3px; }

.carousel-dots {
  position: absolute;
  bottom: 0.6rem;
  right: 0.85rem;
  display: flex;
  gap: 0.35rem;
  z-index: 10;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-dot.active { background: white; }

/* ── Results block inside rd-body ── */
.rd-results {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.rd-results-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.45rem;
}
.rd-result-item {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.7;
}


  /* ── Sub-section structure Projects ── */
    .sub-section {
      margin-top: 2rem;
      padding-top: 1rem;
      border-top: 1px solid var(--border);
    }
    .sub-section:first-of-type {
      margin-top: 0rem;
      border-top: none;
    }
    .section-label {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 0.9rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--ink-3);
      margin-bottom: 0.1rem;
    }
    .sub-section h3 {
      font-family: 'EB Garamond', serif;
      font-size: 1.25rem;
      font-weight: 500;
      color: var(--ink);
      margin: 0 0 3rem 0;
    }
    /* Two-column grid: image + text */
    .project-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1.75rem;
      align-items: start;
      margin-top: 1rem;
    }
    .project-grid.reverse {
      direction: rtl;
    }
    .project-grid.reverse > * {
      direction: ltr;
    }
    /* Full-width image */
    .full-img-wrap {
      margin: 1rem 0;
    }
    .full-img-wrap img,
    .project-img-wrap img {
      width: 100%;
      border-radius: 3px;
      display: block;
    }
    /* Placeholder figure */
    .img-placeholder {
      width: 100%;
      aspect-ratio: 4/3;
      background: var(--surface, #f4f4f2);
      border: 1px dashed var(--border);
      border-radius: 3px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      color: var(--ink-3);
    }
    .img-placeholder .ph-icon {
      font-size: 1.6rem;
      opacity: 0.4;
    }
    .img-placeholder .ph-label {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      opacity: 0.5;
      text-align: center;
      padding: 0 1rem;
    }
    .full-img-wrap .img-placeholder {
      aspect-ratio: 16/7;
    }
    /* Responsive */
    @media (max-width: 680px) {
      .project-grid {
        grid-template-columns: 1fr;
      }
      .project-grid.reverse {
        direction: ltr;
      }
    }

/* ═══════════════════════════════════════════════
   RESPONSIVE — TABLET (max 900px)
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .research-detail,
  .research-detail.flip {
    grid-template-columns: 1fr 280px;
  }

  .broad-intro {
    grid-template-columns: 200px 1fr;
    gap: 1.75rem;
  }

  .broad-img { height: 300px; }

  .tl-panel { grid-template-columns: 180px 1fr; gap: 1.5rem; }
}


/* ═══════════════════════════════════════════════
   RESPONSIVE — MOBILE (max 680px)
   ═══════════════════════════════════════════════ */
@media (max-width: 680px) {

  /* ── Timeline: smaller text so all 5 nodes fit ── */
  .timeline-section { padding-top: 2rem; }

  .tl-node { min-width: 60px; padding: 0.4rem 0; }

  .tl-year {
    font-size: 0.58rem;
    margin-bottom: 0.35rem;
  }

  .tl-label {
    font-size: 0.58rem;
    margin-top: 0.35rem;
    letter-spacing: 0.03em;
  }

  /* Timeline panel: stack image above text */
  .tl-panel {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.5rem 0 2rem;
  }

  .tl-panel-img {
    aspect-ratio: 16/9; /* wider + shorter feels better stacked */
    max-height: 200px;
  }

  .tl-panel-title { font-size: 1.1rem; }
  .tl-panel-summary { font-size: 0.92rem; }

  /* ── Broad intro: stack image above text ── */
  .broad-intro {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
  }

  .broad-img {
    height: 240px;
    /* Show hover caption permanently on mobile (no hover state) */
  }
  .broad-img .img-hover-caption { opacity: 1; }

  .broad-text p { font-size: 1.1rem; }

  /* ── rd-divider: scale down logos and text ── */
  .rd-divider {
    font-size: 1.35rem;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
  }
  .rd-divider img {
    height: 3rem !important; /* override inline style */
  }

  /* ── Research details: stack carousel below text ── */
  .research-detail,
  .research-detail.flip {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
  }
  .research-detail.flip .rd-img { order: 0; }

  .rd-title { font-size: 1.4rem; }
  .rd-body p { font-size: 1.05rem; }


  /* ── Carousels: shorter on mobile so they don't eat the whole screen ── */
  .carousel,
  #carousel-coldspray {
    aspect-ratio: 3/5;
  }

  /* CubeSat static image — just let it be natural height */
  .rd-img img { max-height: 280px; object-fit: contain; }
}


/* ═══════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (max 400px)
   ═══════════════════════════════════════════════ */
@media (max-width: 400px) {
  .tl-node { min-width: 52px; }
  .tl-year, .tl-label { font-size: 0.52rem; }

  .rd-divider { font-size: 1.1rem; }
  .rd-divider img { height: 2.25rem !important; }

  .carousel,
  #carousel-coldspray {
    aspect-ratio: 1/1;
  }

  .broad-img { height: 200px; }
}