:root {
  --paper: #eef0e8;
  --ink: #2b1d15;
  --heading: #4a2a18;
  --muted: #665f55;
  --rule: #d6d9cc;
  --accent: #3d6b34;
  --slot: #e1e4d8;
  --slot-ink: #81877a;
  --btn: rgba(255, 255, 255, 0.88);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15110e;
    --ink: #eee6e0;
    --heading: #e3c8b3;
    --muted: #ab9d93;
    --rule: #2f2721;
    --accent: #9cc98f;
    --slot: #211b17;
    --slot-ink: #85786f;
    --btn: rgba(21, 17, 14, 0.8);
  }
}
:root[data-theme="dark"] {
  --paper: #15110e;
  --ink: #eee6e0;
  --heading: #e3c8b3;
  --muted: #ab9d93;
  --rule: #2f2721;
  --accent: #9cc98f;
  --slot: #211b17;
  --slot-ink: #85786f;
  --btn: rgba(21, 17, 14, 0.8);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.05rem/1.65 "Archivo", "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: "Archivo", "Helvetica Neue", Arial, sans-serif; font-weight: 800; font-stretch: 112%; line-height: 1.05; letter-spacing: -0.01em; margin: 0; color: var(--heading); }
p { margin: 0 0 0.9em; }

/* header */
.top {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  max-width: 1120px; margin: 0 auto; padding: 1.25rem 16px; font-size: 0.95rem;
}
.top .mark { color: var(--ink); text-decoration: none; font-weight: 800; font-stretch: 112%; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--accent); }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
section { padding: 4rem 0 1rem; border-top: 1px solid var(--rule); }
section > h2 { font-size: 1.9rem; margin-bottom: 2.25rem; }
h3 { font-size: 1.3rem; }

/* intro */
.intro { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: end; border-top: 0; padding-top: 2.5rem; }
.intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.intro h1 span { color: var(--muted); font-weight: 400; font-stretch: 100%; }
.lede { font-size: 1.3rem; color: var(--muted); margin: 0.8rem 0 1.4rem; }
.intro-links a { margin-right: 1.4rem; font-weight: 600; }

/* placeholder slots */
.ph {
  position: relative; margin: 0; background: var(--slot); overflow: hidden; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; text-align: center; aspect-ratio: 3 / 2;
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.ph figcaption {
  flex: 1; align-self: stretch; display: flex; align-items: center; justify-content: center;
  margin: 6px; padding: 0.5rem; border: 1px dashed var(--slot-ink); color: var(--slot-ink); font-size: 0.8rem; line-height: 1.35;
}
.ph-portrait { aspect-ratio: 4 / 5; }
.ph-logo { width: 72px; height: 72px; aspect-ratio: auto; flex: none; background: transparent; }
.ph-logo img { object-fit: contain; }
.ph-logo figcaption { font-size: 0.6rem; padding: 0.25rem; margin: 0; }

/* carousels */
.carousel { outline-offset: 4px; }
.carousel .frame { position: relative; aspect-ratio: 3 / 2; background: var(--slot); border-radius: 3px; overflow: hidden; }
.carousel .frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.carousel .frame img[hidden] { display: none; }
.carousel .nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--btn); color: var(--heading);
}
.carousel .nav:hover { color: var(--accent); }
.carousel .prev { left: 10px; }
.carousel .next { right: 10px; }
.carousel .meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; font-size: 0.9rem; color: var(--muted); min-height: 1.4em; }
.carousel .count { flex: none; }
.carousel .captions { display: none; }

/* shared bits */
.role { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0.4rem 0 1rem; }
.results { font-weight: 600; }
.note { font-size: 0.95rem; color: var(--muted); font-style: italic; }
.links a { margin-right: 1.2rem; font-weight: 600; font-size: 0.95rem; }
.links.big a { font-size: 1.15rem; }

/* projects: four large, alternating; research slightly smaller */
.feature, .project { display: grid; gap: 2.5rem; align-items: start; margin-bottom: 4.5rem; }
.feature { grid-template-columns: 1.15fr 1fr; }
.feature h3 { font-size: 2rem; }
.feature.flip .carousel { order: 2; }
.project { grid-template-columns: 0.9fr 1fr; padding-top: 3rem; border-top: 1px solid var(--rule); }
.project h3 { font-size: 1.6rem; }

/* beyond projects, summers, recognition: one per row, big photos, alternating sides */
.stack article { display: grid; grid-template-columns: 1.15fr 1fr; gap: 2.5rem; align-items: start; margin-bottom: 4rem; }
.stack article:nth-child(even) .carousel { order: 2; }
.stack h3 { font-size: 1.7rem; }
.row-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.row-head .role { margin: 0.3rem 0 0; }

/* recognition lists */
.awards h3 { margin-bottom: 1rem; }
.awards ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.awards li { font-size: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.awards li.todo { color: var(--slot-ink); font-size: 0.85rem; border-bottom-style: dashed; }

/* media */
.press { display: grid; grid-template-columns: 72px 1fr; gap: 0.3rem 1.25rem; text-decoration: none; color: var(--ink); max-width: 760px; }
.press .ph-logo { grid-row: span 2; }
.press-meta { font-size: 0.85rem; color: var(--muted); }
.press-title { font-weight: 800; font-stretch: 112%; font-size: 1.4rem; line-height: 1.25; color: var(--heading); }
.press:hover .press-title { color: var(--accent); }

#contact p { max-width: 640px; font-size: 1.2rem; }
footer { max-width: 1120px; margin: 3rem auto 0; padding: 1.5rem 16px 2.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; }

@media (max-width: 860px) {
  .intro, .feature, .project, .stack article { grid-template-columns: 1fr; gap: 1.5rem; }
  .feature.flip .carousel, .stack article:nth-child(even) .carousel { order: 0; }
}
@media (max-width: 560px) {
  section { padding-top: 3rem; }
}

/* international involvement */
.intro-note { max-width: 760px; font-size: 1.1rem; margin-bottom: 2rem; }
.intl { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.intl li { display: grid; grid-template-columns: 1fr 1.8fr; gap: 0.5rem 2rem; align-items: baseline; padding: 1.1rem 0; border-top: 1px solid var(--rule); }
.intl li:last-child { border-bottom: 1px solid var(--rule); }
.intl h3 { font-size: 1.15rem; }
.intl p { margin: 0; }
.intl .where { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
@media (max-width: 760px) {
  .intl li { grid-template-columns: 1fr; }
  }

/* certificates (collapsed under recognition) */
.certs { margin: 0 0 3rem; }
.certs summary {
  display: inline-block; cursor: pointer; list-style: none; font-weight: 600; color: var(--accent);
  border: 1px solid currentColor; border-radius: 999px; padding: 0.45rem 1.1rem;
}
.certs summary::-webkit-details-marker { display: none; }
.certs[open] summary { margin-bottom: 1.5rem; }
.certs .captions { display: none; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.25rem; }
.cert-grid a { color: var(--muted); text-decoration: none; font-size: 0.85rem; line-height: 1.35; }
.cert-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--slot); border-radius: 3px; display: block; margin-bottom: 0.4rem; }
.cert-grid a:hover span { color: var(--accent); }

/* rows whose optional carousel had no photos */
.stack article.no-photo { grid-template-columns: 1fr; max-width: 760px; margin-bottom: 2.5rem; }

/* full-screen photo viewer */
.carousel .frame img, .cert-grid img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(14, 11, 9, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 2px; }
.lb-meta { color: #e8e2db; font-size: 0.95rem; margin: 0.9rem 0 0; text-align: center; }
.lb-count { color: #a89f96; margin-left: 0.6rem; }
.lightbox .nav, .lb-close {
  position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); color: #fff;
}
.lightbox .nav { top: 50%; transform: translateY(-50%); }
.lightbox .nav:hover, .lb-close:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox .nav[hidden] { display: none; }
.lightbox .prev { left: 16px; }
.lightbox .next { right: 16px; }
.lb-close { top: 12px; right: 16px; }
