/* Nandy Lab — site styles
   Layout: one left-aligned column (max 1120px). The laminar raster on the home
   page is the single bold element; every other page stays quiet. */

:root {
  /* color */
  --paper:   #f4f6f9;   /* page ground, faintly cool */
  --surface: #ffffff;   /* raised panels */
  --ink:     #142030;   /* text */
  --muted:   #5a6879;   /* secondary text */
  --rule:    #d9e0e8;   /* hairlines, borders */
  --accent:  #00356b;   /* Yale blue: links, active nav */
  --accent-soft: #e3ebf5;
  --sink:    #c2412d;   /* CSD "sink" red, used for data marks only */
  --source:  #2f6fb5;   /* CSD "source" blue, used for data marks only */
  --figure-ground: #ffffff; /* data figures are drawn on white in both themes */

  /* type */
  --font-ui:   "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-text: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;

  --step--1: 0.875rem;
  --step-0:  1.0625rem;
  --step-1:  1.25rem;
  --step-2:  1.625rem;
  --step-3:  2.25rem;
  --step-4:  clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);

  --wrap: 1120px;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0e1620;
    --surface: #152030;
    --ink:     #e5ebf2;
    --muted:   #9aa8b8;
    --rule:    #26364a;
    --accent:  #8db6ea;
    --accent-soft: #1c2c42;
    --sink:    #f07a62;
    --source:  #6fa6e6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:   #0e1620;
  --surface: #152030;
  --ink:     #e5ebf2;
  --muted:   #9aa8b8;
  --rule:    #26364a;
  --accent:  #8db6ea;
  --accent-soft: #1c2c42;
  --sink:    #f07a62;
  --source:  #6fa6e6;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--step-4); font-weight: 650; }
h2 { font-size: var(--step-3); font-weight: 600; }
h3 { font-size: var(--step-1); font-weight: 600; }
p { margin: 0; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--paper); padding: 8px 12px; font-family: var(--font-ui);
}
.skip:focus { left: 12px; top: 12px; z-index: 50; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 10px;
}
.brand {
  display: flex; align-items: center; gap: 14px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-ui);
}
.brand-logo { width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 1px var(--rule); }
@media (max-width: 560px) { .brand-logo { width: 52px; height: 52px; } }
.brand-name { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); letter-spacing: 0; }

.nav { display: flex; gap: 4px; font-family: var(--font-ui); }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius);
}
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  font: 500 0.95rem var(--font-ui); color: var(--ink);
  background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 6px 12px; cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: 8px max(20px, env(safe-area-inset-right, 0px)) 16px max(20px, env(safe-area-inset-left, 0px));
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 8px; font-size: 1.05rem; }
}

/* ---------- page scaffolding ---------- */
main { display: block; }
.page-head { padding-block: 56px 32px; display: grid; gap: 14px; }
.page-head p { color: var(--muted); max-width: 62ch; font-size: var(--step-1); line-height: 1.5; }
.section { padding-block: 40px; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.section-head a { font-family: var(--font-ui); font-weight: 500; font-size: 0.95rem; }
.prose { max-width: 68ch; display: grid; gap: 1.1em; }
.prose h3 { margin-top: 0.6em; }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 0.4em; }

/* ---------- home hero ---------- */
.hero { padding-block: 48px 40px; }
.hero .wrap {
  display: grid; gap: 40px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr);
  align-items: center;
}
.hero-text { display: grid; gap: 20px; min-width: 0; }
.hero-text .lede { font-size: var(--step-1); line-height: 1.55; max-width: 52ch; }
.hero-text .tools { color: var(--muted); max-width: 54ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--font-ui); }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--accent);
}
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-quiet { color: var(--accent); background: transparent; }
.btn-quiet:hover { background: var(--accent-soft); }

.raster-fig { margin: 0; display: grid; gap: 10px; min-width: 0; }
.raster-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  aspect-ratio: 5 / 4;
  max-width: 100%;
  overflow: hidden;
}
.raster-frame canvas { width: 100%; height: 100%; display: block; }
.video-panel {
  background: var(--figure-ground); border: 1px solid var(--rule); border-radius: 10px;
  overflow: hidden; max-width: 100%;
}
.video-panel video { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 834; }
.raster-fig figcaption { font-family: var(--font-ui); font-size: var(--step--1); color: var(--muted); line-height: 1.45; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .raster-frame { aspect-ratio: 4 / 3; }
}

/* ---------- research themes ---------- */
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.theme {
  display: grid; gap: 12px; align-content: start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: 24px;
}
.theme p { color: var(--muted); }
.theme .model { font-family: var(--font-ui); font-size: var(--step--1); color: var(--muted); }
@media (max-width: 760px) { .themes { grid-template-columns: minmax(0, 1fr); } }

/* ---------- news ---------- */
.news-list { list-style: none; margin: 0; padding: 0; display: grid; }
.news-item {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 16px;
  padding-block: 14px; border-top: 1px solid var(--rule);
}
.news-item:last-child { border-bottom: 1px solid var(--rule); }
.news-date { font-family: var(--font-ui); font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.news-body { display: grid; gap: 4px; min-width: 0; }
.news-body strong { font-family: var(--font-ui); font-weight: 600; }
@media (max-width: 560px) { .news-item { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* ---------- publications ---------- */
.pub-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-family: var(--font-ui); }
.pub-tools input[type="search"] {
  flex: 1 1 260px; min-width: 0;
  font: 400 1rem var(--font-ui); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 12px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: 500 0.9rem var(--font-ui); color: var(--muted);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pub-meta { font-family: var(--font-ui); font-size: var(--step--1); color: var(--muted); margin-bottom: 20px; }
.pub-meta .count { font-variant-numeric: tabular-nums; }

.pub-year { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 16px; padding-block: 18px; border-top: 1px solid var(--rule); }
.pub-year > h2 {
  font-size: var(--step-1); color: var(--muted); font-weight: 600;
  font-variant-numeric: tabular-nums; padding-top: 2px;
}
.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.pub { display: grid; gap: 4px; min-width: 0; }
.pub-title { font-family: var(--font-ui); font-weight: 600; font-size: 1.075rem; line-height: 1.35; }
.pub-authors { font-size: 0.97rem; line-height: 1.5; color: var(--ink); }
.pub-authors b {
  font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 0 4px; border-radius: 3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.pub-venue { font-size: 0.97rem; color: var(--muted); }
.pub-venue em {
  font-family: var(--font-ui); font-style: italic; font-weight: 700;
  font-size: 1.02rem; color: var(--ink);
}
.status { font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }
.pub-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-family: var(--font-ui); }
.pub-links a {
  font-size: 0.82rem; font-weight: 500; text-decoration: none;
  border: 1px solid var(--rule); border-radius: 4px; padding: 2px 8px;
}
.pub-links a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pub-legend { font-family: var(--font-ui); font-size: var(--step--1); color: var(--muted); }
.empty { color: var(--muted); font-family: var(--font-ui); padding-block: 24px; }
@media (max-width: 560px) { .pub-year { grid-template-columns: minmax(0, 1fr); gap: 8px; } }

/* ---------- people ---------- */
.pi {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start;
}
.pi .photo { border-radius: 10px; }
.pi-text { display: grid; gap: 12px; min-width: 0; }
.pi-text .role { font-family: var(--font-ui); color: var(--muted); }
.link-row { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--font-ui); font-weight: 500; font-size: 0.95rem; }
@media (max-width: 620px) { .pi { grid-template-columns: minmax(0, 1fr); } .pi .photo { max-width: 220px; } }

.people-grid {
  display: grid; gap: 28px 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
}
.person { display: grid; gap: 10px; align-content: start; min-width: 0; }
.person h3 { font-size: 1.05rem; }
.person .role { font-family: var(--font-ui); font-size: 0.92rem; color: var(--muted); line-height: 1.4; }
.person .note { font-size: 0.9rem; color: var(--muted); line-height: 1.45; }

.photo {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  background: var(--accent-soft); border-radius: 8px;
}
.initials {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 4 / 5; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font: 600 2rem var(--font-ui); letter-spacing: 0.02em;
}

.alumni { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.alum { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center; padding-block: 12px; border-top: 1px solid var(--rule); }
.alum .photo, .alum .initials { width: 52px; height: 52px; aspect-ratio: 1; border-radius: 50%; font-size: 1rem; }
.alum-name { font-family: var(--font-ui); font-weight: 600; }
.alum-role { font-size: 0.92rem; color: var(--muted); line-height: 1.4; }
@media (max-width: 680px) { .alumni { grid-template-columns: minmax(0, 1fr); } }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--accent-soft); }
.gallery .initials { aspect-ratio: 4 / 3; font-size: 1rem; font-weight: 500; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); }
dialog.lightbox::backdrop { background: rgb(8 14 22 / 0.85); }
dialog.lightbox img { max-height: 86vh; width: auto; border-radius: 6px; }
dialog.lightbox button {
  position: absolute; top: 8px; right: 8px;
  font: 600 0.9rem var(--font-ui); color: #fff; background: rgb(0 0 0 / 0.55);
  border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer;
}

/* ---------- research ---------- */
.video-fig { margin: 0; display: grid; gap: 10px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--accent-soft); border: 1px solid var(--rule); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font: 600 1rem var(--font-ui); color: var(--accent); text-decoration: none; }
.video-fig figcaption { font-family: var(--font-ui); font-size: var(--step--1); color: var(--muted); }
.banner { width: 100%; border-radius: 10px; aspect-ratio: 908 / 278; object-fit: cover; background: var(--accent-soft); }
.questions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.questions li {
  font-family: var(--font-ui); font-weight: 500; font-size: 1.05rem; line-height: 1.4;
  padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 6px 6px 0;
}

/* ---------- contact / join ---------- */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
@media (max-width: 760px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
address { font-style: normal; line-height: 1.6; }
.email-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-family: var(--font-ui); }
.email-line code { font-family: var(--font-ui); font-size: 1rem; background: var(--accent-soft); padding: 4px 8px; border-radius: 4px; user-select: all; }
.copy-btn { font: 500 0.85rem var(--font-ui); color: var(--accent); background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 4px 10px; cursor: pointer; }

.join {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: 28px; display: grid; gap: 14px;
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 48px; }
.site-footer .wrap {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding-block: 28px 40px; font-family: var(--font-ui); font-size: 0.9rem; color: var(--muted);
}
.site-footer address { line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
