/* Shared palette, typography, layouts, gallery, and responsive styles. */
:root {
  --paper:#f8f7f3;
  --ink:#252c29;
  --muted:#616b64;
  --green:#365946;
  --rule:#d8dcd4;
  --serif:Georgia,'Times New Roman',serif;
  --sans:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

* {
  box-sizing:border-box;
}

html {
  scroll-behavior:smooth;
  /* Short pages reserve scrollbar space so the header never shifts between pages. */
  scrollbar-gutter:stable;
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:16px/1.65 var(--sans);
  -webkit-font-smoothing:antialiased;
}

a {
  color:inherit;
  text-underline-offset:5px;
  text-decoration-thickness:1px;
}

a:hover {
  color:var(--green);
}

button {
  font:inherit;
  cursor:pointer;
}

button,a {
  -webkit-tap-highlight-color:transparent;
}

:focus-visible {
  outline:2px solid var(--green);
  outline-offset:6px;
}

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

/* Text fills its layout column; long URLs can wrap on narrow screens. */
main {
  overflow-wrap: break-word;
}

figure {
  margin:0;
}

p {
  margin:0 0 1.2em;
}

h1,h2,h3 {
  font-family:var(--serif);
  font-weight:400;
  line-height:1.15;
  margin:0 0 .65em;
}

h1 {
  font-size:clamp(40px,4.5vw,68px);
  letter-spacing:-.045em;
}

h2 {
  font-size:clamp(29px,3vw,40px);
  letter-spacing:-.025em;
}

h3 {
  font-size:27px;
}

em {
  font-weight:400;
  color:var(--green);
}

.site-header,main,.site-footer {
  width:min(1240px,calc(100% - 112px));
  margin-inline:auto;
}

.site-header {
  font-family: Helvetica, Arial, sans-serif;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:33px 0;
  border-bottom:1px solid var(--rule);
  gap:30px;
}

.wordmark {
  font:700 23px Helvetica,Arial,sans-serif;
  text-decoration:none;
  white-space:nowrap;
  letter-spacing:-1px;
}

.wordmark-dot {
  color:var(--green);
}

nav {
  display:flex;
  gap:32px;
}

nav a {
  text-decoration:none;
  font-size:14px;
}

nav a[aria-current=page] {
  text-decoration:underline;
  color:var(--green);
}

.site-footer {
  display:flex;
  justify-content:space-between;
  border-top:1px solid var(--rule);
  padding:27px 0 34px;
  margin-top:80px;
  font-size:12px;
  color:var(--muted);
}

.site-footer a {
  text-decoration:none;
}

.skip-link {
  position:absolute;
  left:12px;
  top:-90px;
  z-index:100;
  background:var(--paper);
  padding:12px;
}

.skip-link:focus {
  top:12px;
}

#title-block-header {
  display:none;
}

body>header#title-block-header {
  display:none;
}

.eyebrow {
  text-transform:uppercase;
  letter-spacing:.15em;
  font-size:10px;
  font-weight:600;
  color:var(--muted);
  margin-bottom:26px;
}

.intro {
  display:grid;
  grid-template-columns:1.1fr 1fr;
  gap:70px;
  align-items:center;
  padding:85px 0 82px;
}

.intro h1 {
  font-size:clamp(40px,4.3vw,64px);
}

.lead {
  font-size:20px;
  line-height:1.65;
}

.bio {
  font-size:15px;
  color:var(--muted);
}

.intro-photo img {
  aspect-ratio:4/5;
  object-fit:cover;
  object-position:42% center;
}

.intro-photo figcaption {
  display:flex;
  justify-content:space-between;
  gap:15px;
  font-size:10px;
  color:var(--muted);
  margin-top:12px;
}

.intro-photo figcaption a {
  white-space:nowrap;
}

.text-links {
  display:flex;
  flex-wrap:wrap;
  gap:24px;
  margin-top:30px;
  font-size:14px;
}

.arrow-link {
  color:var(--green);
  text-decoration:underline;
}

.home-research {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:70px;
  border-top:1px solid var(--rule);
  padding-top:45px;
}

.home-research h2 {
  font-size:31px;
}

.home-research .eyebrow {
  margin-bottom:20px;
}

.research-links a {
  display:grid;
  grid-template-columns:25px 1fr 20px;
  gap:18px;
  align-items:center;
  text-decoration:none;
  padding:20px 0;
  border-bottom:1px solid var(--rule);
  font-size:17px;
}

.research-links a:first-child {
  padding-top:0;
}

.index-number {
  font-size:11px;
  color:var(--muted);
}

.page-intro {
  padding:75px 0 65px;
}

.page-intro .lead {
  color:var(--muted);
  margin-bottom:0;
}

.project {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:75px;
  align-items:center;
  border-top:1px solid var(--rule);
  padding:65px 0;
  scroll-margin-top:25px;
}

.project-copy h2 {
  font-size:36px;
}

.project-methods,.status {
  font-size:12px;
  color:var(--muted);
}

.research-figure img {
  width:100%;
  background:white;
}

.research-figure figcaption {
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
  margin-top:18px;
}

.reading-page {
  max-width:920px;
}

.publication-section,.cv-section {
  border-top:1px solid var(--rule);
  padding:32px 0;
  display:grid;
  grid-template-columns:180px 1fr;
  gap:25px;
}

.publication-section>h2,.cv-section>h2 {
  font-family:var(--sans);
  font-size:13px;
  letter-spacing:.03em;
  margin-top:6px;
}

/* Additional papers in a section stack in the content column. */
.publication-section>.publication {
  grid-column:2;
}

.publication+.publication {
  margin-top:20px;
}

.publication p {
  font-size:14px;
  margin-bottom:8px;
}

.publication .eyebrow {
  font-size:10px;
  margin-bottom:16px;
}

.publication .text-links {
  margin-top:24px;
  font-size:12px;
}

.muted {
  color:var(--muted);
}

.button-link {
  display:inline-flex;
  gap:8px;
  align-items:center;
  background:var(--green);
  color:#fff;
  text-decoration:none;
  font-size:14px;
  padding:13px 20px;
  margin-top:28px;
}

.button-link:hover {
  background:#273f32;
  color:white;
}

.cv-row {
  grid-column:2;
  display:grid;
  grid-template-columns:110px 1fr;
  gap:25px;
}

.cv-row>.muted {
  font-size:12px;
  margin-top:6px;
}

.cv-row h3 {
  font-size:24px;
}

.cv-row p {
  font-size:14px;
  margin-bottom:8px;
}

.cv-section>p,.cv-section>.arrow-link {
  grid-column:2;
}

.photo-intro {
  max-width:none;
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:40px;
  padding-bottom:45px;
}

.photo-intro h1 {
  font-size:clamp(36px,4vw,58px);
  margin-bottom:0;
}

.photo-intro>p {
  font-size:13px;
  color:var(--muted);
  margin-bottom:6px;
}

.gallery-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-top:1px solid var(--rule);
  padding:20px 0 35px;
  gap:20px;
}

.filters {
  display:flex;
  gap:25px;
}

.filters button {
  background:none;
  border:0;
  border-bottom:1px solid transparent;
  padding:5px 0;
  color:var(--muted);
  font-size:13px;
}

.filters button[aria-pressed=true] {
  border-color:var(--green);
  color:var(--green);
}

.gallery-count {
  font-size:11px;
  color:var(--muted);
}

/* Layout comes from data/gallery-layout.json (edit it with scripts/arrange_photos.py). */
.gallery {
  --photo-gap:40px; /* between rows */
  --photo-gap-x:32px; /* between photos side by side */
  display:flex;
  flex-direction:column;
  gap:var(--photo-gap);
}

/* Rows: photos grow in proportion to their aspect ratio, so a row shares one height and fills the width. */
.gallery-row {
  display:flex;
  gap:var(--photo-gap-x);
}

.gallery-row:not(:has(.photo:not([hidden]))) {
  display:none;
}

.gallery-row .photo {
  flex:var(--ratio) 1 0;
  min-width:0;
}

.gallery-row .photo a {
  aspect-ratio:var(--ratio);
}

.gallery-row .photo img {
  height:100%;
  object-fit:cover;
}

/* Columns: one or two hand-arranged columns below the top photo. */
.gallery-columns {
  display:grid;
  grid-template-columns:repeat(var(--columns),minmax(0,1fr));
  column-gap:var(--photo-gap-x);
  align-items:start;
}

.gallery-columns .photo-feature {
  grid-column:1/-1;
}

.gallery-column {
  display:flex;
  flex-direction:column;
  gap:var(--photo-gap);
  min-width:0;
}

.photo-feature img {
  aspect-ratio:2/1;
  object-fit:cover;
}

.photo a {
  display:block;
  overflow:hidden;
}

.photo img {
  width:100%;
}

.photo figcaption {
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:10px;
  font-size:11px;
  color:var(--muted);
}

[hidden] {
  display:none!important;
}

.gallery-note {
  font-size:12px;
  color:var(--muted);
  margin-top:40px;
}

dialog {
  border:0;
  padding:0;
  background:#161c19;
  color:#f4f5ef;
  max-width:none;
  max-height:none;
  width:100vw;
  height:100dvh;
  margin:0;
}

dialog::backdrop {
  background:#161c19;
}

.viewer {
  height:100%;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:56px minmax(0,1fr) auto;
  padding:15px 32px 25px;
  gap:16px;
}

.viewer-bar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:12px;
  color:#bbc3bd;
}

.viewer button {
  background:none;
  color:inherit;
  border:1px solid #66756a;
  padding:7px 15px;
  min-height:44px;
}

.viewer :focus-visible {
  outline-color:#e0e9da;
}

.viewer-image {
  height:100%;
  width:100%;
  object-fit:contain;
  min-height:0;
}

.viewer-bottom {
  display:flex;
  justify-content:space-between;
  gap:30px;
  align-items:center;
}

.viewer h2 {
  font:23px var(--serif);
  margin:0 0 8px;
}

.viewer-bottom > div:first-child {
  min-width:0;
  flex:1;
}

#viewer-description {
  font-family:var(--sans);
  font-size:13px;
  line-height:1.55;
  max-height:4.65em;
  overflow-y:auto;
  overflow-wrap:anywhere;
  white-space:pre-line;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
  color:#bbc3bd;
  margin:0;
}

.viewer-actions {
  display:flex;
  gap:10px;
}

.viewer-meta {
  display:flex;
  flex-wrap:wrap;
  gap:8px 22px;
  font-size:11px;
  color:#bbc3bd;
  margin:10px 0 0;
}

.viewer-meta div {
  display:flex;
  gap:6px;
}

.viewer-meta dt {
  color:#a4afa6;
}

.viewer-meta dd {
  margin:0;
  color:#f4f5ef;
}

body:has(dialog[open]) {
  overflow:hidden;
}

@media(min-width:1500px) {
  .intro {
    gap:100px;
  }
  .intro-photo img {
    aspect-ratio:1/1.15;
  }
}

@media(max-width:1000px) {
  .site-header,main,.site-footer {
    width:calc(100% - 64px);
  }
  .intro,.project,.home-research {
    gap:40px;
  }
  .intro h1 {
    font-size:44px;
  }
  .lead {
    font-size:18px;
  }
  .intro-photo figcaption {
    display:block;
  }
  .intro-photo figcaption a {
    display:block;
    margin-top:4px;
  }
  .photo-intro {
    display:block;
  }
  .photo-intro>p {
    margin-top:25px;
  }
  .publication-section,.cv-section {
    grid-template-columns:130px 1fr;
  }
}

@media(max-width:760px) {
  .site-header,main,.site-footer {
    width:calc(100% - 40px);
  }
  .site-header {
    align-items:start;
    flex-direction:column;
    gap:20px;
    padding:24px 0;
  }
  nav {
    width:100%;
    justify-content:space-between;
    gap:12px;
  }
  nav a {
    font-size:13px;
  }
  .intro {
    grid-template-columns:1fr;
    padding:48px 0;
    gap:35px;
  }
  .intro h1 {
    font-size:clamp(39px,7.8vw,57px);
  }
  .intro .eyebrow {
    font-size:9px;
  }
  .intro-photo img {
    aspect-ratio:4/3;
  }
  .intro-photo figcaption {
    display:flex;
  }
  .intro-photo figcaption a {
    margin:0;
  }
  .home-research,.project {
    grid-template-columns:1fr;
    gap:28px;
  }
  .home-research h2 {
    font-size:30px;
  }
  .page-intro {
    padding:50px 0 40px;
  }
  .page-intro h1 {
    font-size:42px;
  }
  .project {
    padding:40px 0;
  }
  .project-copy h2 {
    font-size:32px;
  }
  .publication-section,.cv-section {
    display:block;
  }
  .publication-section>h2,.cv-section>h2 {
    margin-bottom:25px;
  }
  .publication+.publication {
    margin-top:45px;
  }
  .cv-row {
    grid-template-columns:90px 1fr;
    gap:15px;
    margin-bottom:25px;
  }
  .gallery {
    --photo-gap:28px;
    --photo-gap-x:22px;
  }
  .photo-feature img {
    aspect-ratio:3/2;
  }
  .photo figcaption {
    font-size:10px;
    display:block;
  }
  .photo figcaption span {
    display:block;
  }
  .filters {
    gap:20px;
  }
  .gallery-count {
    font-size:10px;
  }
  .site-footer {
    margin-top:55px;
  }
  .viewer {
    padding:10px 15px 20px;
    gap:10px;
  }
  .viewer-bottom {
    display:block;
  }
  .viewer-actions {
    margin-top:18px;
  }
  .viewer-meta {
    gap:5px 12px;
  }
  .photo-intro h1 {
    font-size:38px;
  }
}

@media(max-width:480px) {
  /* Phones: one photo per line, in reading order. */
  .gallery {
    --photo-gap:24px;
  }
  .gallery-row {
    flex-direction:column;
  }
  .gallery-row .photo {
    flex:none;
  }
  .gallery-columns {
    display:flex;
    flex-direction:column;
    align-items:stretch;
  }
  .gallery-column {
    display:contents;
  }
  .gallery-count {
    display:none;
  }
  .photo figcaption {
    display:flex;
  }
  .photo figcaption span {
    display:inline;
  }
  .viewer-meta {
    font-size:10px;
  }
}

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

/* Academic pages: restrained Helvetica typography and quiet page colors. */
body:has(.academic-page) {
  --sans: Helvetica, Arial, sans-serif;
  font-family: var(--sans);
  --paper: #fafaf8;
  --ink: #202522;
}
.home.academic-page h1 {
  font-weight: 400;
}

.academic-page h1, .academic-page h2, .academic-page h3 {
  font-family: var(--sans);
}
body.research-page {
  --paper: #fff;
}
.academic-page {
  max-width: 1100px;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}
.academic-page h1 {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.015em;
}
.academic-page h2 {
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}
.academic-page h3 {
  font-size: 22px;
  line-height: 1.35;
}
.academic-page em {
  color: inherit;
}
.academic-page .page-intro {
  padding: 46px 0 36px;
}
.academic-page .lead, .academic-page .bio {
  font-size: 17px;
  color: var(--ink);
}
.academic-page .affiliation {
  color: var(--muted);
  margin-bottom: 26px;
}
.academic-page .intro {
  grid-template-columns: 1.6fr 1fr;
  gap: 65px;
  padding: 55px 0;
}
.academic-page .intro-photo img {
  aspect-ratio: 4/3;
}
/* Simple rectangular portrait; the source image is unchanged. */
.academic-page .portrait img {
  aspect-ratio: 1;
  object-fit: contain;
  border: 6px solid #fff;
}
.academic-page .portrait figcaption {
  display: block;
  text-align: center;
}
.academic-page .home-research {
  grid-template-columns: 200px 1fr;
  gap: 35px;
  padding-top: 30px;
}
.academic-page .research-links a {
  font-size: 17px;
}
.academic-page .project {
  grid-template-columns: 1fr 1.3fr;
  gap: 40px;
  padding: 36px 0;
  align-items: start;
}
.academic-page .project-copy h2 {
  margin-bottom: 20px;
}
.academic-page .research-figure {
  margin-top: 8px;
}
.research-video {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}
.academic-page .text-links, .academic-page .project-methods,
.academic-page .status, .academic-page figcaption {
  font-family: var(--sans);
}
.academic-page .button-link {
  display: inline-block;
  background: none;
  color: var(--green);
  text-decoration: underline;
  padding: 0;
  margin-top: 20px;
}
@media (max-width: 760px) {
  .academic-page .intro, .academic-page .home-research,
  .academic-page .project {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  .academic-page .intro {
    padding: 36px 0;
  }
  .academic-page .intro-photo {
    max-width: 420px;
  }
}

/* Compact spacing for the two short pages. */
.home-page .site-footer, .cv-page .site-footer {
  margin-top: 28px;
}
.home-page .research-links a:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.cv-page .page-intro {
  padding-bottom: 12px;
}
.cv-page .button-link {
  margin-top: 8px;
}

/* Native cross-document dissolve; ordinary navigation is the fallback. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: ease-in-out;
}
/* The header is its own layer so it holds still while the page dissolves beneath it. */
.site-header {
  view-transition-name: site-header;
}
::view-transition-group(site-header) {
  animation-duration: 320ms;
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  ::view-transition-old(root), ::view-transition-new(root) {
    animation: none;
  }
}

/* Lowercase is a reversible visual experiment; source wording is preserved. */
body, button, input, select, textarea { text-transform: lowercase; }
.eyebrow { text-transform: lowercase; }
.keep-case, math, .math, mjx-container, code, pre, .viewer-meta dd {
  text-transform: none;
}

/* Optional photography navigation font; remove photo-nav-serif to revert. */
.photo-nav-serif .site-header,
.photo-nav-serif .wordmark {
  font-family: Georgia, 'Times New Roman', serif;
}

/* Alternate the second project on desktop; source order stays text first. */
@media (min-width: 761px) {
  .academic-page #exploration {
    grid-template-columns: 1.3fr 1fr;
  }
  #exploration .research-figure {
    grid-column: 1;
    grid-row: 1;
  }
  #exploration .project-copy {
    grid-column: 2;
    grid-row: 1;
  }
}

.viewer h2 .viewer-location {
  font:400 16px/1.5 var(--sans);
  color:#a4afa6;
  letter-spacing:0;
}
