/* Plate-Plex — Source Serif 4 + IBM Plex Sans. Toggleable light/dark. */

/* Defaults (dark). [data-theme="light"] overrides; toggle script in base.html. */
:root {
  color-scheme: dark light;
  --bg: #181410;
  --bg-2: #1f1a14;
  --panel: #221c15;
  --line: #2c241c;
  --ink: #ece4d6;
  --ink-2: #d2c8b6;
  --muted: #908573;
  --accent: #bfa46a;
  --accent-2: #d6bf85;
  --hero-fade-rgb: 24, 20, 16;
  --max: 72rem;
  --serif: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", Georgia, ui-serif, serif;
  --sans: "IBM Plex Sans", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
[data-theme="light"] {
  --bg: #f5f0e3;
  --bg-2: #ece5d3;
  --panel: #efe7d2;
  --line: #d8cdb1;
  --ink: #1a1611;
  --ink-2: #36302a;
  --muted: #6b6356;
  --accent: #8a6d2f;
  --accent-2: #a3853f;
  --hero-fade-rgb: 245, 240, 227;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
[data-theme="light"] a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
[data-theme="light"] a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--accent); color: var(--bg); padding: .5rem .9rem; z-index: 100; }
.skip-link:focus { top: 1rem; }

.shell { width: min(calc(100% - 2.5rem), var(--max)); margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* Masthead */
.masthead { padding: 1rem 0 0; border-bottom: 1px solid var(--line); padding-bottom: .9rem; }
.masthead-row { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.masthead-end { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: .65rem; }
[data-theme="light"] .brand { text-decoration: none; }
.brand-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: -.005em; }
.brand-affil { color: var(--muted); font-size: .88rem; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.3rem; flex-wrap: wrap; }
.nav a { color: var(--ink-2); font-size: .94rem; text-decoration: none; }
[data-theme="light"] .nav a { color: var(--ink); }
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: .95rem;
  width: 2.1rem; height: 2.1rem;
  display: inline-grid; place-items: center;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Headings */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.18; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin: 0 0 .65rem; }
h2 { font-size: clamp(1.35rem, 2.1vw, 1.7rem); margin: 0 0 .55rem; }
h3 { font-size: 1.1rem; margin: 0 0 .3rem; }
.section-title { margin-bottom: 1.1rem; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; color: var(--accent); margin: 0 0 .35rem; }
.lede { font-family: var(--serif); font-size: clamp(1rem, 1.25vw, 1.1rem); line-height: 1.55; color: var(--ink-2); }
.prose { max-width: 38em; }
.prose p { margin: 0 0 .85rem; }

/* Hero */
.hero { position: relative; padding: 0; }
.hero-bg { margin: 0; position: relative; isolation: isolate; }
.hero-bg img { width: 100%; max-height: 56vh; aspect-ratio: 21/9; object-fit: cover; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(var(--hero-fade-rgb), 0) 35%,
    rgba(var(--hero-fade-rgb), .55) 75%,
    var(--bg) 100%);
}
.hero-content {
  position: relative;
  width: min(calc(100% - 2.5rem), var(--max));
  margin: -5.5rem auto 0;
  padding: 2rem 0 .5rem;
  z-index: 1;
  text-align: center;
}
@media (max-width: 48rem) { .hero-content { margin-top: -3rem; padding-top: 1.5rem; } }
.hero-content h1 { max-width: none; margin-left: auto; margin-right: auto; }
.hero-content .lede { max-width: 56em; margin-left: auto; margin-right: auto; }

.btn { display: inline-block; background: var(--accent); color: var(--bg); text-decoration: none; padding: .6rem 1rem; font-weight: 600; font-size: .92rem; border-radius: 2px; }
.btn:hover { background: var(--accent-2); color: var(--bg); }
.link { color: var(--accent); }

/* Sections */
.section { padding: 2.75rem 0; }
.section.panel { background: var(--bg-2); }
.section-head { margin-bottom: 1.25rem; }
.section-head.between { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }
.page-head { padding: 2.75rem 0 1.75rem; border-bottom: 1px solid var(--line); }
.page-head h1, .page-head .lede, h1.wide, .lede.wide { max-width: none; }

/* Two-col */
.two-col { display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
@media (min-width: 56rem) { .two-col { grid-template-columns: 1.1fr 1fr; gap: 2.5rem; } }

/* Home current research grid */
.program-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; margin-top: 1rem; }
@media (min-width: 56rem) { .program-grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; } }
a.program {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
a.program:hover { transform: translateY(-2px); border-color: var(--accent); }
a.program:hover h3 { color: var(--accent); }
.program-figure { margin: 0; position: relative; isolation: isolate; }
.program-figure img {
  width: 100%; aspect-ratio: 4/3; object-fit: contain; background: transparent; display: block;
}
.program-body { padding: .9rem 1rem 1rem; }
.program h3 { font-size: 1.1rem; line-height: 1.25; margin: 0 0 .35rem; }
.program p { font-size: .92rem; margin: 0 0 .5rem; max-width: none; color: var(--ink-2); }
.program .link { font-size: .9rem; }

/* Prior work */
.prior-list { list-style: none; padding: 0; margin: 0; }
.prior-list li { display: grid; grid-template-columns: 4rem 1fr auto; gap: 1rem; align-items: baseline; padding: .7rem 0; border-top: 1px solid var(--line); }
.prior-list li:first-child { border-top: 0; }
.prior-list .year { font-family: var(--serif); color: var(--accent); font-size: 1rem; }
.prior-list .title { font-family: var(--serif); font-size: 1rem; color: var(--ink); }
.prior-list .venue { font-style: italic; font-size: .9rem; }
@media (max-width: 40rem) { .prior-list li { grid-template-columns: 3.5rem 1fr; } .prior-list .venue { grid-column: 2; } }

/* Research two-column with alternation */
.research-row {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 56rem) {
  .research-row { grid-template-columns: 1.2fr 1fr; gap: 2.25rem; }
  .research-section.alt > .shell > .research-row,
  .subsection.alt .research-row { grid-template-columns: 1fr 1.2fr; }
  .research-section.alt > .shell > .research-row > .research-text,
  .subsection.alt .research-row > .research-text { order: 2; }
  .research-section.alt > .shell > .research-row > .research-figs,
  .subsection.alt .research-row > .research-figs { order: 1; }
}
.research-text .prose { max-width: none; }
.research-figs { display: grid; gap: .9rem; align-self: start; }
.research-figs figure { margin: 0; position: relative; isolation: isolate; }
.research-figs img { width: 100%; height: auto; display: block; object-fit: contain; }
.subsection { margin-top: 2rem; padding-top: 1.5rem; }
.subsection + .subsection { border-top: 1px dashed var(--line); }
.citation { background: var(--panel); padding: .8rem 1rem; border-left: 3px solid var(--accent); font-size: .92rem; margin-top: .9rem; color: var(--ink-2); }
.citation a { color: var(--accent); }

/* Subtle edge feather — barely-there in either palette, tracks surrounding bg */
.research-figs figure::after,
.program-figure::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 .5rem .1rem var(--bg);
}
.section.panel .research-figs figure::after { box-shadow: inset 0 0 .5rem .1rem var(--bg-2); }
a.program .program-figure::after { box-shadow: inset 0 0 .5rem .1rem var(--bg-2); }

/* People grid (non-alumni) */
.people-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 36rem) { .people-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .people-grid { grid-template-columns: repeat(4, 1fr); } }
.person h3 { font-family: var(--serif); margin-top: .7rem; font-size: 1.05rem; }
.role { color: var(--accent); font-weight: 600; margin: 0 0 .1rem; font-size: .92rem; }
.portrait img { aspect-ratio: 1/1; object-fit: cover; }
.inline-links { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; gap: .9rem; font-size: .9rem; }

/* Alumni list */
.alumni-list { list-style: none; padding: 0; margin: 0; }
.alumni-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: .15rem .9rem;
  padding: .8rem 0;
  border-top: 1px solid var(--line);
  font-size: .96rem;
}
.alumni-list li:first-child { border-top: 0; }
@media (min-width: 48rem) {
  .alumni-list li { grid-template-columns: 12rem 1fr auto; align-items: baseline; }
}
.alum-name { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.alum-role { color: var(--ink-2); }
.alum-affil { color: var(--muted); font-style: italic; font-size: .9rem; }

/* Publications */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.pub:first-child { border-top: 0; }
.pub-year { font-family: var(--serif); font-size: 1.15rem; color: var(--accent); margin: 0; }
.pub-title { font-family: var(--serif); font-size: 1.02rem; margin: 0 0 .2rem; }
.pub-title a { color: var(--ink); border-bottom: 1px solid transparent; }
.pub-title a:hover { border-color: var(--accent); color: var(--accent); }
.pub-authors { margin: 0; color: var(--muted); font-size: .86rem; }
.pub-venue { margin: .15rem 0 0; font-size: .88rem; color: var(--ink-2); }

/* Gallery */
.gallery-grid { columns: 1; column-gap: 1rem; }
@media (min-width: 40rem) { .gallery-grid { columns: 2; } }
@media (min-width: 64rem) { .gallery-grid { columns: 3; } }
.gallery-item { break-inside: avoid; margin: 0 0 1rem; }
.gallery-item img { width: 100%; }
.gallery-item figcaption { font-size: .86rem; color: var(--muted); margin-top: .4rem; }

/* Contact */
.contact-grid { align-items: start; }
.contact-figure img { aspect-ratio: 4/3; object-fit: cover; }

/* Footer */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); padding: 2.25rem 0 1.5rem; background: var(--bg-2); }
.footer-grid { display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }
.footer-name { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 .3rem; color: var(--ink); }
.footer-heading { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 600; margin: 0 0 .4rem; color: var(--muted); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; font-size: .92rem; }
.colophon { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Stony Brook wordmark in the masthead */
.brand { gap: .8rem; }
.brand-logo {
  height: 1.5rem; width: auto; display: block;
  border-left: 1px solid var(--line, var(--rule));
  padding-left: .8rem;
  opacity: .9;
}
[data-theme="dark"] .brand-logo,
:root:not([data-theme]) .brand-logo { filter: brightness(0) invert(1); opacity: .85; }

/* ----- v7: dual logo, fix vertical alignment ----- */
.brand { align-items: center; gap: .85rem; }
.brand-logo {
  height: 1.85rem; width: auto; display: block;
  border-left: 0; padding-left: 0; opacity: 1; filter: none;
}
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }

/* News & gallery feed (chronological) */
.feed { list-style: none; padding: 0; margin: 0; }
.feed-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: .35rem 1.75rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.feed-item:first-child { border-top: 0; }
@media (min-width: 56rem) {
  .feed-item { grid-template-columns: 9rem 1fr; align-items: start; }
}
.feed-date {
  font-family: var(--serif);
  font-feature-settings: "tnum";
  color: var(--accent);
  font-size: .98rem;
  white-space: nowrap;
  padding-top: .15rem;
}
.feed-body { display: grid; gap: .65rem; max-width: 50rem; }
.feed-figure { margin: 0; position: relative; isolation: isolate; }
.feed-figure img { width: 100%; height: auto; display: block; }
.feed-figure::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 .5rem .1rem var(--bg);
}
.feed-title { font-size: 1.15rem; line-height: 1.25; margin: 0; }
.feed-caption { color: var(--ink-2); margin: 0; font-size: .96rem; }
.feed-text { color: var(--ink-2); margin: 0; }
.feed-note .feed-body { padding-top: .15rem; }
.feed-note { background: linear-gradient(to right, var(--bg-2) 0, transparent 1px) no-repeat; }
.feed-video video { width: 100%; height: auto; display: block; }
.feed-figure img[src*="/people/"] { width: auto; max-width: 14rem; }
.feed-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}
.feed-thumb {
  display: block; width: 100%; padding: 0; margin: 0;
  border: 0; background: none; cursor: zoom-in;
  position: relative; isolation: isolate;
}
.feed-thumb img {
  width: 100%; height: 100%; aspect-ratio: 4 / 3;
  object-fit: cover; display: block;
}
.feed-thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.zoom-dialog {
  border: 0; padding: 0; background: transparent;
  max-width: 95vw; max-height: 95vh;
  color: #fff;
}
.zoom-dialog::backdrop { background: rgba(0,0,0,.88); }
.zoom-frame { margin: 0; display: grid; gap: .6rem; }
.zoom-dialog img {
  max-width: 95vw; max-height: 80vh;
  display: block; margin: 0 auto;
  background: #000;
}
.zoom-caption {
  max-width: 60rem; margin: 0 auto;
  text-align: center; font-size: .95rem; line-height: 1.45;
  color: rgba(255,255,255,.92);
  padding: 0 1rem;
}
.zoom-caption a { color: inherit; text-decoration: underline; }
.zoom-close, .zoom-nav {
  position: fixed; width: 2.75rem; height: 2.75rem;
  font-size: 1.5rem; line-height: 1;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #000;
  cursor: pointer;
}
.zoom-close { top: 1rem; right: 1rem; }
.zoom-nav { top: 50%; transform: translateY(-50%); }
.zoom-prev { left: 1rem; }
.zoom-next { right: 1rem; }
.zoom-nav[hidden] { display: none; }
