/* Subhrajit Dey: one stylesheet, no framework.
   Look: system sans, near-black on warm off-white, one accent, thin rules, no card chrome
   (after wholistic.janelia.org). Change the accent in one place: --accent. */

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

:root {
  --fg: #1c1c1c;
  --bg: #f7f7f6;
  --muted: color-mix(in srgb, var(--fg) 70%, var(--bg));
  --rule: color-mix(in srgb, var(--fg) 15%, transparent);
  --surface: color-mix(in srgb, var(--fg) 5%, var(--bg));
  --accent: #57068c;            /* NYU violet */
  --inset: clamp(1rem, 4vw, 4.5rem);
  --measure: none;
  --nav-h: 3.75rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --fg: #f2f2f0;
  --bg: #0b0c0c;
  --muted: color-mix(in srgb, var(--fg) 82%, var(--bg));
  --rule: color-mix(in srgb, var(--fg) 22%, transparent);
  --accent: #c9a2ff;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #f2f2f0;
    --bg: #0b0c0c;
    --muted: color-mix(in srgb, var(--fg) 82%, var(--bg));
    --rule: color-mix(in srgb, var(--fg) 22%, transparent);
    --accent: #c9a2ff;
    color-scheme: dark;
  }
}

html { font-size: clamp(16px, 0.3vw + 12.5px, 20px); scroll-padding-top: calc(var(--nav-h) + 1rem); }
html, body { margin: 0; color: var(--fg); background: var(--bg); overflow-x: clip; }
body {
  min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--nav-h);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 1.0625rem; line-height: 1.6;
}

h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 3.4vw, 3.25rem); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 1.8vw, 1.85rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; display: block; }

a, a:visited { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.14em; }
.prose a, .accent-links a { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
/* external-link arrow drawn as a mask (some system fonts lack the arrow glyph) */
.external::after {
  content: ""; display: inline-block; width: .62em; height: .62em; margin-left: .25em; vertical-align: .05em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 9L9 3M4.5 3H9v4.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 9L9 3M4.5 3H9v4.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--inset); top: .5rem; z-index: 2000; background: var(--bg); padding: .25rem .5rem; }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 1030; height: var(--nav-h);
  display: flex; align-items: center; gap: 1.5rem; padding-inline: var(--inset);
  background: var(--bg); border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 650; font-size: 1.05rem; letter-spacing: 0.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; align-items: center; gap: 0 1.5rem; margin: 0; padding: 0; list-style: none; }
.site-nav a { display: inline-block; padding-block: .45rem; font-size: .95rem; line-height: 1.2; white-space: nowrap; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .3em; }
.icon-btn {
  display: grid; place-items: center; min-width: 2rem; min-height: 2rem; padding: .25rem;
  font: inherit; color: inherit; background: transparent; border: 1px solid currentColor; cursor: pointer;
}
.icon-btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .theme .sun, :root:not([data-theme="dark"]) .theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme .moon { display: block; }
  :root:not([data-theme]) .theme .sun { display: none; }
}
.menu-toggle { display: none; margin-left: auto; }

@media (max-width: 860px) {
  .menu-toggle { display: grid; }
  .site-nav { position: fixed; inset: var(--nav-h) 0 auto 0; margin: 0; background: var(--bg); border-bottom: 1px solid var(--rule);
              padding: .5rem var(--inset) 1rem; display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: flex-start; }
  .site-nav a { font-size: 1.05rem; padding-block: .55rem; }
}

/* ---------- layout ---------- */
main { flex: 1; width: 100%; padding-inline: var(--inset); padding-bottom: clamp(3rem, 8vh, 5rem); }
section.block { padding-top: clamp(1.5rem, 4vh, 2.5rem); margin-top: clamp(2rem, 6vh, 3.5rem); border-top: 1px solid var(--rule); }
section.block > h2 { margin-bottom: 1.25rem; }
.head-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: 1.25rem; }
.head-row h2 { margin: 0; }
.head-row a { font-size: .95rem; }

.hero { max-width: 62rem; margin: clamp(1.5rem, 6vh, 4rem) 0 clamp(1rem, 4vh, 2.5rem); }
.announce { display: inline-block; margin: 0 0 1.75rem; padding: .35rem .75rem; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; line-height: 1.3; }
.announce a { margin-left: .5em; color: var(--fg); font-weight: 500; }
.eyebrow { margin: 0 0 .75rem; color: var(--muted); }
.hero h1 { margin: 0 0 1rem; max-width: 22em; }
.lede { max-width: var(--measure); font-size: 1.1rem; }
.link-row { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.link-row a { font-weight: 600; }

.page-head { max-width: 62rem; margin: clamp(1.5rem, 6vh, 3.5rem) 0 0; }
.page-head h1 { margin-bottom: .75rem; }
.page-head p { max-width: var(--measure); }

/* themes / research list: two columns of plain text, separated by rules */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 clamp(1.5rem, 3vw, 3rem); margin: 0; padding: 0; list-style: none; }
.themes li { padding: 1rem 0; border-top: 1px solid var(--rule); }
.themes h3 { margin-bottom: .35rem; }
.themes p { margin: 0; color: var(--muted); max-width: var(--measure); }
.themes .collab { margin-top: .4rem; font-size: .9rem; }

/* PI */
.pi { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
.pi .portrait { aspect-ratio: 4 / 5; overflow: hidden; background: var(--surface); }
.pi .portrait img { width: 100%; height: 100%; object-fit: cover; }
.pi .bio { max-width: var(--measure); }
.pi h3 { font-size: 1.3rem; margin-bottom: .2rem; }
.pi .role { color: var(--muted); margin-bottom: 1rem; }
@media (max-width: 600px) { .pi { grid-template-columns: minmax(0, 1fr); } .pi .portrait { max-width: 12rem; } }

/* people grid (wholistic team strip) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 1.5rem clamp(1rem, 2vw, 1.75rem); margin: 0; padding: 0; list-style: none; }
.people .portrait { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--surface); }
.people img { width: 100%; height: 100%; object-fit: cover; transition: filter .2s; }
.people a:hover img { filter: brightness(1.06); }
.people .name { display: block; margin-top: .45rem; font-weight: 600; line-height: 1.25; }
.people .meta { display: block; font-size: .85rem; line-height: 1.35; color: var(--muted); }
.people.compact { grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); }
.people.compact .name { font-size: .9rem; }
@media (max-width: 559.98px) {
  .people, .people.compact { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .people li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); column-gap: 1rem; align-items: center; padding-block: .6rem; border-top: 1px solid var(--rule); }
  .people li:last-child { border-bottom: 1px solid var(--rule); }
  .people .name { margin-top: 0; }
}

/* publications */
.pub-years { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 1rem; padding: 0; list-style: none; font-size: .95rem; }
.pub-year { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); margin-top: 1rem; }
.pub-year h2 { font-size: 1.2rem; }
.pubs { margin: 0; padding: 0; list-style: none; }
.pubs li { margin-bottom: .9rem; }
.pubs .t { display: block; font-weight: 600; }
.pubs .a, .pubs .v { display: block; font-size: .92rem; color: var(--muted); }
.pubs .v { font-style: italic; }
.pubs .me { color: var(--fg); font-weight: 600; }
@media (max-width: 600px) { .pub-year { grid-template-columns: minmax(0, 1fr); gap: .25rem; } }

/* simple key/value list (contact, course info) */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1.25rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* openings / courses: rows separated by rules */
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li { padding: 1.1rem 0; border-top: 1px solid var(--rule); max-width: var(--measure); }
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
.rows h3 { margin-bottom: .4rem; }
.rows p:last-child { margin-bottom: 0; }

.logos { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2.5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.logos img { height: 2.75rem; width: auto; }
:root[data-theme="dark"] .logos img { filter: grayscale(1) invert(1) brightness(1.6); mix-blend-mode: screen; }

/* ---------- footer ---------- */
.site-footer { padding: 1.5rem var(--inset) 2rem; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--muted);
               display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; }
.site-footer address { font-style: normal; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: var(--fg); }

/* ---------- featured media (home): 3D brain + video, two columns like the reference site ---------- */
:root { --probe-allen: #0d8a8a; --probe-ibl: #e0701b; --brain-surface: #8f99ad; }
:root[data-theme="dark"] { --probe-allen: #3fd6c9; --probe-ibl: #ffa64d; --brain-surface: #c7cfdf; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --probe-allen: #3fd6c9; --probe-ibl: #ffa64d; --brain-surface: #c7cfdf; } }
.media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem);
         padding-top: clamp(1.5rem, 4vh, 2.5rem); border-top: 1px solid var(--rule); }
.media figure { margin: 0; min-width: 0; }
.media video, .brain { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.brain { position: relative; background: radial-gradient(ellipse at 50% 45%, var(--surface), var(--bg) 75%); cursor: grab; touch-action: none; overflow: hidden; }
.brain:active { cursor: grabbing; }
.brain canvas { display: block; width: 100%; height: 100%; }
.brain-fallback { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .9rem; }
.brain.ready .brain-fallback { display: none; }
.media figcaption { margin-top: .6rem; max-width: var(--measure); color: var(--muted); font-size: .95rem; }
.media figcaption strong { display: block; color: var(--fg); font-size: 1.02rem; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .5rem; }
.legend button { display: inline-flex; align-items: center; gap: .45rem; padding: .15rem 0; font: inherit; font-size: .9rem; color: var(--fg); background: none; border: 0; cursor: pointer; }
.legend button[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.sw { display: inline-block; width: 1.4rem; height: 3px; border-radius: 2px; }
.sw.allen { background: var(--probe-allen); } .sw.ibl { background: var(--probe-ibl); height: 4px; }
@media (max-width: 760px) { .media { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .media video { animation: none; } }

/* ---------- home hero: background media on a turning wheel ---------- */
.hero-wheel {
  --probe-allen: #3fd6c9; --probe-ibl: #ffa64d; --brain-surface: #c7cfdf; --surface: #15181c; --bg: #050607;
  position: relative; overflow: hidden; margin-inline: calc(-1 * var(--inset)); height: clamp(32rem, 84vh, 52rem);
  background: #050607; color: #f4f4f2; isolation: isolate;
}
.hero-wheel .stage { position: absolute; inset: 0; perspective: 2200px; perspective-origin: 50% 50%; }
.hero-wheel .wheel { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 1.3s cubic-bezier(.65, 0, .25, 1); }
.hero-wheel .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #050607; overflow: hidden; }
.hero-wheel .face video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-wheel .face .brain { width: 100%; height: 100%; aspect-ratio: auto; background: radial-gradient(ellipse at 66% 50%, #1a1f27, #050607 70%); }
.hero-wheel .face .brain-fallback { color: #9aa3b0; }
.hero-wheel .scrim { position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgba(5,6,7,.88) 0%, rgba(5,6,7,.62) 34%, rgba(5,6,7,0) 62%), linear-gradient(0deg, rgba(5,6,7,.7), rgba(5,6,7,0) 28%); }
.hero-copy { position: absolute; z-index: 2; left: var(--inset); right: var(--inset); top: 50%; transform: translateY(-55%); max-width: 36rem; pointer-events: none; }
.hero-copy a, .hero-copy .announce { pointer-events: auto; }
.hero-copy .eyebrow { color: #c6cad1; }
.hero-copy h1 { color: #fff; margin: 0 0 1rem; }
.hero-copy .lede { color: #e4e6ea; }
.hero-copy .scroll { margin-top: 1.25rem; font-weight: 600; color: #fff; }
.hero-copy .announce { border-color: #c9a2ff; color: #c9a2ff; background: rgba(5,6,7,.4); }
.hero-copy .announce a { color: #fff; }
.wheel-bar { position: absolute; z-index: 2; left: var(--inset); right: var(--inset); bottom: 1.1rem; display: flex; align-items: center; gap: .9rem 1.25rem; flex-wrap: wrap; font-size: .9rem; color: #d7dae0; }
.wheel-dots { display: flex; gap: .45rem; }
.wheel-dots button { width: 1.9rem; height: .32rem; padding: 0; border: 0; border-radius: 2px; background: rgba(255,255,255,.35); cursor: pointer; }
.wheel-dots button[aria-current="true"] { background: #fff; }
.wheel-pause { font: inherit; font-size: .85rem; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.6); padding: .1rem .55rem; cursor: pointer; }
.wheel-pause[aria-pressed="true"]::before { content: "▶ "; } .wheel-pause[aria-pressed="false"]::before { content: "❚❚ "; font-size: .75em; }
.wheel-cap { flex: 1 1 16rem; }
@media (prefers-reduced-motion: reduce) {
  .hero-wheel .wheel { transition: none; }
  .hero-wheel .face { opacity: 0; transition: opacity .4s; } .hero-wheel .face.on { opacity: 1; z-index: 1; }
}
@media (max-width: 700px) {
  .hero-wheel { height: clamp(34rem, 92vh, 44rem); }
  .hero-wheel .scrim { background: linear-gradient(0deg, rgba(5,6,7,.92) 0%, rgba(5,6,7,.7) 55%, rgba(5,6,7,.15) 100%); }
  .hero-copy { top: auto; bottom: 4.2rem; transform: none; }
}

/* home sections */
.overview { max-width: var(--measure); }
.overview p { margin-bottom: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
.gallery a { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery a:hover img { transform: scale(1.04); }
@media (min-width: 901px) { .hero-wheel .face video { transform: translateX(15%); } }
@media (max-width: 700px) {
  .hero-copy .scroll, .wheel-cap { display: none; }
  .hero-copy { bottom: 3.4rem; }
}

/* ---------- personal site additions ---------- */
.hero-copy .link-row { pointer-events: auto; margin-top: 1rem; }
.hero-copy .link-row a { color: #fff; }
.pi { grid-template-columns: minmax(16rem, 2fr) minmax(0, 3fr); align-items: stretch; }
.pi .portrait { aspect-ratio: auto; height: 100%; min-height: 30rem; }
.pi .portrait img { object-position: 50% 45%; }
.pi .bio { max-width: none; }
.pi .portrait picture { display: block; width: 100%; height: 100%; }
@media (max-width: 760px) { .pi { grid-template-columns: minmax(0, 1fr); } .pi .portrait { max-width: 100%; height: auto; min-height: 0; aspect-ratio: 4 / 5; } }

/* research projects: media on top, plain text below */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2rem clamp(1.5rem, 3vw, 3rem); margin: 0; padding: 0; list-style: none; }
.projects .thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; border: 1px solid var(--rule); }
.projects .thumb img, .projects .thumb video { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .5s ease; }
.projects .thumb.dark { background: #050607; }
.projects .thumb.contain img { object-fit: contain; }
.projects a.thumb:hover img, .projects a.thumb:hover video { transform: scale(1.03); }
.projects h3 { margin: .8rem 0 .25rem; }
.projects .venue { margin: 0 0 .4rem; font-size: .9rem; color: var(--accent); font-weight: 600; }
.projects p { margin: 0; color: var(--muted); max-width: var(--measure); }

/* link chips under papers and projects */
.links { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin: .35rem 0 0; padding: 0; list-style: none; font-size: .9rem; font-weight: 600; }
.links a { color: var(--accent); }
.pubs .links { margin-top: .15rem; }
.pubs > li { margin-bottom: 1.15rem; }
.links li { margin: 0; padding: 0; border: 0; display: block; max-width: none; }

/* news: date column + text */
.news { margin: 0; padding: 0; list-style: none; }
.news > li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.news time { color: var(--muted); font-variant-numeric: tabular-nums; }
.news .links { margin-top: .2rem; }
.news > li.more { display: none; }
.news.open > li.more { display: grid; }
.more-btn { margin-top: .75rem; font: inherit; font-size: .95rem; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
@media (max-width: 600px) { .news > li { grid-template-columns: minmax(0, 1fr); gap: .1rem; } }

/* experience */
.exp { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.25rem clamp(1rem, 3vw, 2.5rem); margin: 0; padding: 0; list-style: none; }
.exp li { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); gap: .9rem; align-items: center; padding-top: 1rem; border-top: 1px solid var(--rule); }
.exp img { width: 3.25rem; height: 3.25rem; object-fit: contain; background: #fff; padding: .2rem; border-radius: 2px; }
.exp .role { display: block; font-weight: 600; line-height: 1.3; }
.exp .meta { display: block; font-size: .88rem; color: var(--muted); line-height: 1.35; }

/* contact row (About) */
.contact { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.contact a { display: inline-flex; align-items: center; gap: .45rem; color: var(--fg); font-weight: 600; }
.contact a:hover { color: var(--accent); }
.contact svg { width: 1.15rem; height: 1.15rem; fill: currentColor; flex: none; }
.contact svg.o { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.address { font-size: .92rem; margin-bottom: 1.25rem; }
