/* ==========================================================================
   UCLA HCI Research — main stylesheet
   Modernized 2026: CSS Grid/Flexbox layout, no JS-driven sizing.
   ========================================================================== */

:root {
  --ink: #333;
  --ink-soft: #666;
  --muted: #999;
  --line: #e6e6e6;
  --accent: #2d68c4;          /* UCLA blue */
  --bg: #ffffff;
  --overlay-bg: rgba(20, 20, 20, 0.55);
  --maxw: 1200px;
  --radius: 10px;
  font-size: 17px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Assistant", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}

/* ---------- Header / nav ---------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand img { height: 64px; }
.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.nav a {
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 1rem;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--accent); background: #f2f5fb; }
.nav a.active { color: #000; font-weight: 700; }

/* ---------- Section headings ----------------------------------------------- */
.page-title {
  margin: 40px 0 4px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
.section-title {
  margin: 56px 0 8px;
  font-size: 1.5rem;
}
.lede { color: var(--ink-soft); margin-top: 0; }

/* ---------- Card grids (projects & team) ----------------------------------- */
.grid {
  display: grid;
  gap: clamp(20px, 3vw, 40px);
  margin: 32px 0 8px;
}
.grid.projects {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.grid.team {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

/* grid children must be allowed to shrink below their content's intrinsic
   width, or wide images blow out the track and overflow the page */
.grid > * { min-width: 0; }

/* Project card */
.card {
  text-align: center;
}
.card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  filter: grayscale(85%);
  transition: filter .25s, transform .25s;
  cursor: pointer;
  background: #f3f3f3;
}
.card:hover .thumb { filter: none; transform: translateY(-3px); }
.card .name { font-weight: 700; margin: 12px 0 2px; }
.card .meta { color: var(--muted); font-size: .85rem; }

/* Team member card — grayscale portrait, color photo on hover */
.member { text-align: center; }
.portrait {
  position: relative;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.portrait .primary { filter: grayscale(70%); transition: opacity .3s; }
.portrait .alt { opacity: 0; transition: opacity .3s; }
.member:hover .portrait .primary { opacity: 0; }
.member:hover .portrait .alt { opacity: 1; }
.member .name { font-weight: 700; margin: 12px 0 2px; }
.member .role { font-size: .9rem; }
.member .expertise { color: var(--muted); font-size: .85rem; }

/* ---------- About ----------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  margin-top: 32px;
}
.about-grid .photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.about-grid .photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  filter: grayscale(70%);
  transition: filter .25s;
}
.about-grid .photos img:hover { filter: none; }
.contact { margin-top: 24px; color: var(--ink-soft); }
.sponsors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  margin: 16px 0 40px;
}
.sponsors img {
  max-height: 60px;
  max-width: 130px;
  width: auto;
  filter: grayscale(100%);
  opacity: .7;
  transition: filter .25s, opacity .25s;
}
.sponsors a:hover img { filter: none; opacity: 1; }
.map iframe { width: 100%; border: 0; border-radius: var(--radius); }

/* ---------- Project detail overlay (CSS :target, JS enhances media) -------- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--overlay-bg);
  overflow-y: auto;
  padding: 4vh 16px;
}
.overlay:target { display: block; }
.overlay .panel {
  background: #fff;
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 56px);
  position: relative;
}
.overlay .close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--muted);
}
.overlay .close:hover { color: var(--ink); }
.overlay h2 { margin: 0 8% 8px 0; }
.authors { font-style: italic; color: var(--ink-soft); margin-bottom: 20px; }
.overlay .media { margin: 20px 0; }
.overlay .media iframe { max-width: 100%; border: 0; border-radius: 6px; }

/* Publication + BibTeX block */
.pub {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 18px;
  align-items: start;
  background: #f5f6f8;
  border-radius: 8px;
  padding: 18px;
  margin-top: 24px;
  font-family: "Overpass Mono", ui-monospace, monospace;
  font-size: .82rem;
  color: var(--ink-soft);
}
.pub .paper-thumb { width: 70px; border: 1px solid #ccc; border-radius: 3px; }
.pub .bibtex {
  grid-column: 1 / -1;
  white-space: normal;
  border-top: 1px solid #e0e1e4;
  padding-top: 14px;
  line-height: 1.5;
}

/* ---------- Footer ---------------------------------------------------------- */
.site-footer {
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  padding: 48px 0 32px;
  margin-top: 48px;
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ------------------------------------------------------ */
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; }
  .site-header .container {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .nav { justify-content: center; }
  .brand img { height: 52px; }
  .grid.projects,
  .grid.team { grid-template-columns: 1fr 1fr; }
  .pub { grid-template-columns: 1fr; }
  .pub .paper-thumb { width: 60px; }
}
