/* ============================================================
   IDEAL Lab — static site stylesheet
   Light theme · Carolina blue · IBM Plex Sans body + Space Grotesk display
   ============================================================ */

:root {
  --blue: #4b9cd3;          /* Carolina blue */
  --blue-dark: #2f7db3;
  --navy: #13294b;          /* UNC navy */
  --ink: #24313d;
  --muted: #5f6e7c;
  --line: #dde5ec;
  --dash: #b7c6d4;
  --bg: #ffffff;
  --bg-soft: #f5f8fb;
  --coral: #ff7b54;
  --maxw: 1020px;
  --header-h: 64px;
  --body-font: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body-font);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16.5px;
}

b, strong { font-weight: 600; }

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--navy);
  line-height: 1.15;
  font-weight: 600;
}

a {
  color: var(--blue-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(75, 156, 211, 0.55);
}
a:hover { color: var(--navy); text-decoration-color: var(--navy); }

img { max-width: 100%; display: block; }

code {
  font-family: Menlo, Monaco, "Courier New", monospace;
  font-size: 0.78em;
  background: #eef3f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  color: var(--navy);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------------- Header / nav ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

/* The wordmark itself, not set type — see assets/logo/. */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand img {
  height: 38px;
  width: auto;
  display: block;
}
.brand:hover img { opacity: 0.82; }

.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--blue-dark); }
.nav-links a.active { color: var(--blue-dark); border-bottom-color: var(--blue); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
}

/* ---------------- Full-screen hero scene ---------------- */

/* Home page: the nav rides transparently over the title scene so the 3D
   simulation reads edge to edge, then picks up its bar once you scroll past */
body.home .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  transition: background 0.3s ease, border-color 0.3s ease;
}
body.home .site-header.scrolled {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--line);
  backdrop-filter: blur(8px);
}

.hero-scene {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  /* Clean simulator-viewport sky; the 3D scene's fog blends into this */
  background:
    radial-gradient(1100px 600px at 50% 108%, rgba(75, 156, 211, 0.16), transparent 65%),
    linear-gradient(180deg, #d9e9f6 0%, #ecf3fa 55%, #f2f6fa 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  /* clears the fixed nav that now sits over the scene */
  padding: calc(var(--header-h) + 2.5rem) 1.25rem 4.5rem;
  max-width: 1440px;
}

.kicker {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 1.3rem;
}

/* Lab wordmark. Kept well short of the full hero width on purpose: the 3D
   scene lives in the left and right thirds, and a full-bleed logo buries it. */
.logo-slot {
  margin: 0 auto 1.6rem;
  display: flex;
  justify-content: center;
}
.logo-slot img {
  width: min(620px, 72vw);
  height: auto;
  /* navy line art over a pale scene — a soft halo keeps it legible wherever a
     robot passes behind it */
  filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.95))
          drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
}

.hero-scene .lede {
  font-size: clamp(1rem, 1.9vw, 1.15rem);
  color: var(--muted);
  max-width: 40rem;
  margin: 0 auto 2rem;
}
.hero-scene .lede b { color: var(--ink); }

/* 3D simulation background canvas. It stays invisible until every robot has
   loaded, so the scene appears once, complete, instead of assembling itself. */
.sim-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.sim-bg.ready { opacity: 1; }
.sim-bg canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.btn-row { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }

.btn {
  display: inline-block;
  font-family: var(--display);
  padding: 0.65rem 1.4rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1.5px solid var(--navy);
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #1d3a66; color: #fff; }
.btn-ghost { color: var(--navy); background: rgba(255, 255, 255, 0.6); }
.btn-ghost:hover { background: rgba(19, 41, 75, 0.07); color: var(--navy); }

.scroll-cue {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 26px;
  height: 42px;
  border: 2px solid var(--muted);
  border-radius: 14px;
  display: block;
}
.scroll-cue span {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--blue-dark);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue span { animation: none; }
}

/* ---------------- Sections ---------------- */

/* the home page nav is fixed, so anchor targets have to clear it */
.section, .hero-scene { scroll-margin-top: var(--header-h); }

.section { padding: 3.2rem 0; }
.section + .section .container { border-top: 1px dashed var(--dash); padding-top: 3.2rem; }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.section-head h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
.section-head .more {
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.section-head .more:hover { text-decoration: underline; }

.section-intro { color: var(--muted); max-width: 46rem; margin: -0.6rem 0 2rem; }

.page-title { padding: 3rem 0 0.5rem; }
.page-title h1 { font-size: 2.3rem; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.page-title p { color: var(--muted); max-width: 46rem; font-size: 0.95rem; }

.section-title {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.8rem;
}

/* ---------------- Research areas (zigzag, unboxed) ---------------- */

/* Half and half rather than the 0.8/1.2 the line art wanted: these are paper
   figures now — a task suite of 60 panels, a CAD assembly — and they need the
   room more than the paragraph does. */
.area-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 2.8rem 0;
}
.area-row + .area-row { border-top: 1px dashed var(--dash); }
.area-row.flip .area-art { order: 2; }

.area-art { display: grid; place-items: center; padding: 0.4rem; }

/* Figures lifted from the papers (tools/build_images.py, research stage), shown
   whole. Width is whatever the column gives them; the height cap only exists to
   stop the one portrait figure towering over its paragraph. No shadow — they
   carry their own white page, and a drop-shadow on an opaque rectangle just
   draws a card edge. */
.area-art img {
  /* height: auto is load-bearing. The tags carry width/height so the row does
     not reflow as the figures arrive, and that height attribute counts as a
     specified height — with only width: auto here, the browser had both
     dimensions and squashed a 1.9:1 plate into the 453x420 box. */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 420px;
}

.area-num {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--blue);
}
.area-text h3 { font-size: 1.7rem; letter-spacing: -0.02em; margin: 0.3rem 0 0.8rem; }
.area-text p { color: var(--muted); font-size: 0.95rem; }
.area-tags {
  margin-top: 1rem;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--blue-dark);
}

/* ---------------- Research reel (home) ----------------
   A full-bleed strip of project teasers that scrolls itself. js/main.js clones
   the row of tiles and measures the width of one set into --reel-shift, so the
   keyframe can travel exactly one set and wrap invisibly; --reel-duration comes
   out of that width to keep the speed constant however many tiles there are. */

.reel-viewport {
  overflow: hidden;
  /* soft edges instead of hard cuts, so tiles fade in and out of the strip */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.reel-track {
  display: flex;
  gap: 1.1rem;
  width: max-content;
  padding: 0 0.5rem 0.2rem;
  animation: reel var(--reel-duration, 90s) linear infinite;
}
@keyframes reel {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--reel-shift, 0px))); }
}

/* Hover anywhere in the strip to stop it and read a caption; focus-within keeps
   keyboard tabbing through the links from scrolling them out from under you.
   The hover half is a class js/main.js toggles from pointer events, not :hover
   — see the note there about coming back from a project page. */
.reel-viewport.paused .reel-track,
.reel-viewport:focus-within .reel-track { animation-play-state: paused; }

.reel-item {
  flex: 0 0 auto;
  display: block;
  text-decoration: none;
}

.reel-item img,
.reel-item video {
  /* fixed height, natural width: the teasers run from 16:9 clips to very wide
     paper figures, and cropping them all to one box loses half the panels */
  height: clamp(112px, 15vw, 178px);
  width: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.reel-item:hover img,
.reel-item:hover video {
  border-color: var(--blue);
  box-shadow: 0 10px 22px rgba(19, 41, 75, 0.16);
  transform: translateY(-2px);
}

.reel-item > span {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
}
.reel-item:hover > span { color: var(--blue-dark); }

@media (prefers-reduced-motion: reduce) {
  /* park the strip and hand it over to the scrollbar */
  .reel-track { animation: none; }
  .reel-viewport { overflow-x: auto; }
}

/* ---------------- News ---------------- */

.news-list { list-style: none; }

.news-list li {
  display: flex;
  gap: 1.6rem;
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--line);
}
.news-list li:last-child { border-bottom: none; }

.news-date {
  flex: 0 0 6.2rem;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-dark);
  padding-top: 0.15rem;
}
.news-body { font-size: 0.94rem; }
.news-body b { color: var(--navy); }

/* ---------------- Publications ---------------- */

.year-heading {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  border-bottom: 2px solid var(--blue);
  display: inline-block;
  padding-bottom: 0.2rem;
  margin: 2.2rem 0 0.6rem;
}

.pub { padding: 1.1rem 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: none; }

.pub h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0.25rem; }
.pub .authors { font-size: 0.88rem; color: var(--muted); }
.pub .pubmeta { font-size: 0.88rem; margin-top: 0.3rem; }
.award { font-weight: 600; color: #c22a2a; }
.pub .pubmeta a {
  font-family: var(--display);
  font-size: 0.82rem;
  margin-left: 0.35rem;
  text-decoration: none;
}
.pub .pubmeta a:hover { text-decoration: underline; }

/* ---------------- Photo carousel (People page) ---------------- */

/* 16:9 all the way down, matching the files the group stage bakes: these are
   dinner tables with people at both edges of the frame, so any ratio the photo
   does not already have would crop someone out of the shot. */
.photo-carousel {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(19, 41, 75, 0.1);
  margin-bottom: 2.6rem;
  background: var(--navy);
}

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

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

.car-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.85);
  color: var(--navy);
  font-size: 1.4rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.car-btn:hover { background: #fff; }
.car-btn.prev { left: 0.9rem; }
.car-btn.next { right: 0.9rem; }

.car-dots {
  position: absolute;
  bottom: 0.9rem;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  /* the dots used to sit on a flat gradient; over a photo they need an edge of
     their own to stay findable against a pale tablecloth */
  filter: drop-shadow(0 1px 3px rgba(19, 41, 75, 0.65));
}
.car-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  padding: 0;
}
.car-dot.active { background: #fff; }

/* ---------------- People ---------------- */

.person-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem 1.6rem;
}

.person { text-align: left; }

/* Either a photo or, until there is one, the person's initials. */
.avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.7rem;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue-dark);
  background: linear-gradient(150deg, #e8f1f9, #d3e5f3);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person h3 { font-size: 1.02rem; letter-spacing: -0.01em; }
.person h3 a { color: var(--navy); text-decoration: none; }
.person h3 a:hover { color: var(--blue-dark); text-decoration: underline; }
.person .role {
  font-family: var(--display);
  font-size: 0.8rem;
  color: var(--blue-dark);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.person .blurb { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
.person .note { font-size: 0.78rem; color: var(--ink); font-style: italic; margin-top: 0.25rem; }

.pi-card {
  display: flex;
  gap: 2.2rem;
  align-items: flex-start;
  padding: 0 0 2.6rem;
  border-bottom: 1px dashed var(--dash);
  margin-bottom: 2.6rem;
}
.pi-card .avatar {
  /* one .person-grid column wide, so the PI's photo matches the students'.
     .pi-card and .person-grid are siblings in the same .container, so 100%
     here is the width the grid divides up — keep in step with the column
     count and column gap above. */
  width: calc((100% - 4.8rem) / 4);
  aspect-ratio: 1;
  font-size: 2.6rem;
  margin: 0;
  flex-shrink: 0;
}
.pi-card h3 { font-size: 1.5rem; letter-spacing: -0.02em; }
.pi-card .role {
  font-family: var(--display);
  font-size: 0.88rem;
  color: var(--blue-dark);
  font-weight: 600;
  margin: 0.15rem 0 0.7rem;
}
.pi-card p { font-size: 0.93rem; color: var(--muted); }

/* ---------------- Join / callout ---------------- */

.callout {
  border-top: 1px dashed var(--dash);
  border-bottom: 1px dashed var(--dash);
  padding: 2.4rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.callout h2 { font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.callout p { color: var(--muted); max-width: 36rem; font-size: 0.95rem; }

.join-block { padding: 1.8rem 0; border-bottom: 1px dashed var(--line); }
.join-block:last-child { border-bottom: none; }
.join-block h2 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.join-block p { font-size: 0.95rem; margin-bottom: 0.6rem; }
.join-block p:last-child { margin-bottom: 0; }

.info-list { list-style: none; margin-top: 0.6rem; }
.info-list li { padding: 0.3rem 0; font-size: 0.93rem; }
.info-list b { color: var(--navy); }

/* ---------------- Footer ---------------- */

.site-footer {
  background: var(--navy);
  color: #b9c6d8;
  margin-top: 4rem;
  padding: 2.6rem 0;
  font-size: 0.85rem;
  text-align: center;
}
.site-footer p { margin: 0.2rem 0; }
.foot-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}
/* the wordmark is navy line art, so knock it out to white for the navy footer */
.foot-brand img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.foot-brand span {
  font-family: var(--display);
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}
.foot-links { margin-top: 0.5rem; }
.site-footer a { color: #cfdcea; }
.site-footer a:hover { color: #fff; }
.foot-copy { margin-top: 1rem; font-size: 0.75rem; color: #8fa2ba; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .person-grid { grid-template-columns: repeat(3, 1fr); }
  .pi-card .avatar { width: calc((100% - 3.2rem) / 3); }
  .area-row { grid-template-columns: 1fr; gap: 1.2rem; padding: 2.2rem 0; }
  .area-row.flip .area-art { order: 0; }
  .area-art svg { width: min(40%, 170px); }
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1.25rem 1rem;
  }
  .nav-links.open { display: flex; align-items: flex-start; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 0.6rem 0; }

  .person-grid { grid-template-columns: 1fr 1fr; }
  .pi-card { flex-direction: column; }
  .pi-card .avatar { width: calc((100% - 1.6rem) / 2); }
  .news-list li { flex-direction: column; gap: 0.1rem; }
  /* the date's 6.2rem basis is a column width in the row layout, but stacking
     turns the main axis vertical and it becomes a 6.2rem-tall box holding one
     line of text — the date has to size to its content here */
  .news-date { flex-basis: auto; }
}
