/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --paper: #EDEFF2;
  --paper-raised: #F6F7F9;
  --ink: #14202B;
  --ink-soft: #4A5560;
  --ink-faint: #7C8790;
  --line: #C7CDD4;
  --line-strong: #9AA4AD;
  --accent: #2C6E8E;
  --accent-soft: #DCE7EC;
  --rust: #B5502D;
  --rust-soft: #F2E1D8;
  --led: #4C7A5E;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans-cond: "IBM Plex Sans Condensed", var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --unit: 8px;
  --max-w: 920px;
  --radius: 2px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

h1, h2, h3, h4 { font-family: var(--sans-cond); font-weight: 700; margin: 0; color: var(--ink); }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.sheet-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper-raised);
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
.sheet-header::after {
  content: "";
  display: block;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px);
}
.sheet-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--unit) * 1.5) calc(var(--unit) * 3);
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 4);
}
.sheet-header__mark {
  display: flex;
  align-items: baseline;
  gap: var(--unit);
  color: var(--ink);
}
.sheet-header__mark:hover { text-decoration: none; }
.mark-code {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 5px;
  border-radius: var(--radius);
}
.mark-name { font-family: var(--sans-cond); font-weight: 700; font-size: 1.05rem; }

.sheet-nav {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--unit) * 1.5) calc(var(--unit) * 3);
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.sheet-nav a { color: var(--ink-soft); padding: 4px 2px; border-bottom: 2px solid transparent; }
.sheet-nav a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--line-strong); }
.sheet-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.sheet-nav__toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-left: auto;
  cursor: pointer;
}
.sheet-nav__toggle span { width: 18px; height: 2px; background: var(--ink); display: block; }

@media (max-width: 720px) {
  .sheet-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper-raised);
    border-bottom: 2px solid var(--ink);
    flex-direction: column;
    gap: 0;
    padding: var(--unit) 0;
    display: none;
  }
  .sheet-nav.is-open { display: flex; }
  .sheet-nav a { padding: 10px calc(var(--unit) * 3); border-bottom: 1px solid var(--line); }
  .sheet-nav__toggle { display: flex; }
  .sheet-header__inner { position: relative; }
}

/* ==========================================================================
   Page shell
   ========================================================================== */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--unit) * 5) calc(var(--unit) * 3) calc(var(--unit) * 8);
}

/* ==========================================================================
   Title block
   ========================================================================== */
.title-block {
  position: relative;
  border: 2px solid var(--ink);
  background: var(--paper-raised);
  margin-bottom: calc(var(--unit) * 4);
  overflow: hidden;
}
.title-block__main {
  padding: calc(var(--unit) * 3) calc(var(--unit) * 3) calc(var(--unit) * 2);
  border-bottom: 1px solid var(--line-strong);
}
.tb-doctype {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: var(--radius);
  margin-bottom: var(--unit);
}
.tb-title {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.15;
}
.tb-subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 62ch;
}
.title-block__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.tb-cell {
  padding: calc(var(--unit) * 1.25) calc(var(--unit) * 3);
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.tb-cell:first-child { border-top: none; }
.tb-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.tb-value { font-family: var(--mono); font-size: 0.88rem; color: var(--ink); }

.stamp {
  position: absolute;
  top: 14px;
  right: -34px;
  transform: rotate(8deg);
  background: var(--rust-soft);
  color: var(--rust);
  border: 1.5px solid var(--rust);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 3px 40px;
  z-index: 2;
}

/* ==========================================================================
   Sheet body (specs sidebar + content)
   ========================================================================== */
.sheet-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: calc(var(--unit) * 4);
}
.sheet-body--single { grid-template-columns: 1fr; }

@media (max-width: 720px) {
  .sheet-body { grid-template-columns: 1fr; }
}

.specs {
  border-left: 2px solid var(--line-strong);
  padding-left: calc(var(--unit) * 2);
  height: fit-content;
  position: sticky;
  top: calc(var(--unit) * 12);
}
@media (max-width: 720px) {
  .specs { position: static; border-left: none; border-bottom: 1px solid var(--line); padding: 0 0 var(--unit) 0; }
}
.specs__row { margin-bottom: calc(var(--unit) * 2); }

.tag-list, .link-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 2px 7px;
  color: var(--ink-soft);
}
.tag--pending { color: var(--rust); border-color: var(--rust); background: var(--rust-soft); }
.link-list { flex-direction: column; }

/* Skill chips: same shape as .tag, but they are links to /skills/. */
a.tag--skill {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
a.tag--skill:hover, a.tag--skill:focus { background: var(--accent); color: var(--paper-raised); }

/* Stack chips: the specifics. Linked like skill chips, but in the neutral ink so a page's
   two rows read as different kinds of thing. */
a.tag--stack {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper);
  text-decoration: none;
}
a.tag--stack:hover, a.tag--stack:focus { border-color: var(--accent); color: var(--accent); }

.skills-index__label {
  font-family: var(--sans-cond);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.section-heading--major { margin-top: calc(var(--unit) * 5); }
.skill__kind--stack { color: var(--accent); }

/* "+N more" when a page caps its chips with skills_show. */
a.tag--skill-more {
  color: var(--ink-soft);
  border-style: dashed;
  text-decoration: none;
}
a.tag--skill-more:hover { color: var(--accent); border-color: var(--accent); }

/* Skill filter above the /projects/ table. */
.skill-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 calc(var(--unit) * 2);
}
.skill-filter__label {
  font-family: var(--sans-cond);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-right: 2px;
}
.skill-filter button {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 9px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.skill-filter button:hover { border-color: var(--accent); color: var(--accent); }
.skill-filter button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper-raised);
}
.skill-filter__n { opacity: 0.65; }
.skill-filter__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.project-table tr.is-hidden { display: none; }

/* /skills/ */
.skills-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: calc(var(--unit) * 2) 0 calc(var(--unit) * 3);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.skill-group { margin-bottom: calc(var(--unit) * 4); }
.content .skill {
  border-top: 1px solid var(--line);
  padding: calc(var(--unit) * 1.5) 0;
  scroll-margin-top: calc(var(--unit) * 12);
}
.content .skill:target { border-left: 2px solid var(--accent); padding-left: calc(var(--unit) * 1.5); }
.content .skill__name { font-weight: 700; margin: 0; max-width: none; }
.content .skill__summary { color: var(--ink-soft); font-size: 0.92rem; margin: 2px 0 6px; }
.content .skill__evidence {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.content .skill__evidence li { margin: 0; font-size: 0.92rem; }
.skill__kind {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-right: 5px;
}
.content .skill__filter-link { margin: 6px 0 0; font-size: 0.85rem; }

.content h2, .content h3 { margin-top: calc(var(--unit) * 4); margin-bottom: var(--unit); }
.content h3 { font-size: 1.15rem; }
.content p { margin: 0 0 calc(var(--unit) * 2); max-width: 72ch; }
.content ul, .content ol { padding-left: 1.3em; max-width: 70ch; }
.content li { margin-bottom: 6px; }
.content img { max-width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); }

/* Spec tables inside a sheet body. Wide tables scroll rather than push the page. */
.content .table-scroll { overflow-x: auto; margin: 0 0 calc(var(--unit) * 3); }
.content table {
  border-collapse: collapse;
  width: 100%;
  max-width: 72ch;
  margin: 0 0 calc(var(--unit) * 3);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.content .table-scroll table { margin-bottom: 0; }
.content th {
  font-family: var(--sans-cond);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-align: left;
  padding: 6px calc(var(--unit) * 1.5) 6px 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.content td {
  padding: 8px calc(var(--unit) * 1.5) 8px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.content tr:last-child td { border-bottom: 1px solid var(--line-strong); }

.highlight-list { list-style: none; padding: 0; margin: 0 0 calc(var(--unit) * 3); }
.highlight-list li {
  padding: 8px 0 8px calc(var(--unit) * 2);
  border-left: 2px solid var(--accent);
  margin-bottom: 6px;
  background: var(--paper-raised);
}

.callout {
  margin-top: calc(var(--unit) * 3);
  padding: calc(var(--unit) * 2);
  border: 1px dashed var(--line-strong);
  background: var(--paper-raised);
}
.callout p { margin: 4px 0 0; }

.attach-list { list-style: none; padding: 0; margin: 6px 0 0; }
.attach-list li { margin-bottom: 4px; font-size: 0.92rem; }
.attach-list--offsite li { color: var(--ink-soft); }
.attach-note { color: var(--ink-faint); font-size: 0.85rem; }

.pub-entry {
  padding: calc(var(--unit) * 2) 0;
  border-bottom: 1px solid var(--line);
  overflow: auto;
}
.pub-entry:first-of-type { border-top: 1px solid var(--line); }
.pub-title { margin: 0 0 4px; font-weight: 600; color: var(--ink); max-width: 68ch; }
.pub-meta { margin: 0; font-size: 0.88rem; color: var(--ink-soft); max-width: 68ch; }
.pub-links { margin: 6px 0 0; font-family: var(--mono); font-size: 0.8rem; }

/* ==========================================================================
   Hero / index sheet (home page)
   ========================================================================== */
.hero {
  border: 2px solid var(--ink);
  background: var(--paper-raised);
  padding: calc(var(--unit) * 4) calc(var(--unit) * 3);
  margin-bottom: calc(var(--unit) * 5);
}
.hero__id h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hero__tagline {
  font-family: var(--mono);
  color: var(--accent);
  margin: 6px 0 0;
  font-size: 0.95rem;
}
.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--unit) * 2.5);
  font-family: var(--mono);
  font-size: 0.82rem;
  margin-top: calc(var(--unit) * 2);
}
.hero__summary { margin-top: calc(var(--unit) * 3); max-width: 68ch; color: var(--ink-soft); }
.hero__summary img {
  display: block;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  margin: calc(var(--unit) * 2) 0;
}

/* Home: portrait + lab photo side by side at a shared height. Each image's flex-grow is its
   aspect ratio (w/h) on a zero basis, so the row divides width in proportion and both come
   out the same height. Capped so the lab photo stays at its previous ~440px width. */
.hero__photos {
  display: flex;
  align-items: flex-start;  /* no stretch: each image keeps its own aspect ratio */
  gap: calc(var(--unit) * 1.5);
  max-width: 640px;
  margin: calc(var(--unit) * 2) 0;
}
.hero__photos img {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0;
}
.hero__photos img:nth-child(1) { flex-grow: 0.6667; }  /* 800 x 1200 */
.hero__photos img:nth-child(2) { flex-grow: 1.4996; }  /* 1600 x 1067 */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Sheet lists written inside page content (lathe write-ups, Miscellaneous). */
.content .sheet-list { padding-left: 0; max-width: none; }
.content .sheet-list li { margin-bottom: 0; }

/* Home page: projects as tiles. */
.project-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: calc(var(--unit) * 2);
}
.project-tile a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.project-tile a:hover { border-color: var(--accent); text-decoration: none; }
.project-tile a:hover .project-tile__title { color: var(--accent); }
.project-tile__img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.project-tile__img--empty { border-bottom-style: dashed; }
.project-tile__title { padding: 8px 10px 2px; font-weight: 600; font-size: 0.92rem; line-height: 1.3; }
.project-tile__year {
  margin-top: auto;
  padding: 2px 10px 10px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* /projects/: four-column list. */
.project-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.project-table th {
  text-align: left;
  font-family: var(--sans-cond);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.project-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.project-table__num { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); white-space: nowrap; }
.project-table__thumb { width: 96px; }
.project-table__thumb img,
.project-table__thumb-empty {
  display: block;
  width: 96px;
  height: 64px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.project-table__thumb-empty { border-style: dashed; border-color: var(--line); }
.project-table__name a { color: var(--ink); font-weight: 600; }
.project-table__name a:hover { color: var(--accent); }
.project-table__meta { font-size: 0.85rem; color: var(--ink-soft); }
.project-table__course { display: block; color: var(--ink); }
.project-table__where { display: block; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); }
@media (max-width: 640px) {
  .project-table thead { display: none; }
  .project-table, .project-table tbody { display: block; }
  .project-table tr {
    display: grid;
    grid-template-columns: 66px 1fr;
    column-gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .project-table td { display: block; border: 0; padding: 0; }
  .project-table__thumb { grid-column: 1; grid-row: 1 / span 3; width: 66px; }
  .project-table__thumb img, .project-table__thumb-empty { width: 66px; height: 44px; }
  .project-table__num, .project-table__name, .project-table__meta { grid-column: 2; }
}

.index-block { margin-bottom: calc(var(--unit) * 5); }
.section-heading {
  font-size: 1.2rem;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--unit);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-heading .count { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-faint); font-weight: 400; }

.sheet-list { list-style: none; margin: 0; padding: 0; }
.sheet-list__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: calc(var(--unit) * 1.5);
  row-gap: 2px;
  padding: calc(var(--unit) * 1.25) 4px;
  border-bottom: 1px solid var(--line);
}
.sheet-list__thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  align-self: center;
}
.sheet-list__thumb--empty { border-style: dashed; border-color: var(--line); }
@media (max-width: 640px) {
  .sheet-list__thumb { width: 66px; height: 44px; }
}
.sheet-list__code { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); flex: 0 0 auto; }
/* Education rows: the degree reads at the same weight and size as the field beside it. */
.sheet-list__degree { color: var(--ink); font-weight: 600; flex: 0 0 auto; }
.sheet-list__subtitle {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}
.sheet-list__title { color: var(--ink); font-weight: 600; flex: 1 1 240px; min-width: 160px; }
.sheet-list__title:hover { color: var(--accent); }
.sheet-list__meta { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); flex: 0 0 auto; white-space: nowrap; }
.sheet-list__meta--degree {
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1px 6px;
  font-size: 0.72rem;
}
.sheet-list__desc {
  flex: 1 1 100%;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 2px 0 0;
}

@media (max-width: 640px) {
  .sheet-list__row { column-gap: var(--unit); }
  .sheet-list__title { flex-basis: 100%; }
}

/* ==========================================================================
   Pager
   ========================================================================== */
.pager {
  display: flex;
  justify-content: space-between;
  margin-top: calc(var(--unit) * 5);
  padding-top: calc(var(--unit) * 2);
  border-top: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.sheet-footer {
  border-top: 2px solid var(--ink);
  background: var(--paper-raised);
}
.sheet-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--unit) * 4) calc(var(--unit) * 3);
  display: grid;
  gap: calc(var(--unit) * 3);
}
.rev-block { font-family: var(--mono); font-size: 0.78rem; border: 1px solid var(--line-strong); max-width: 420px; }
.rev-block__row {
  display: grid;
  grid-template-columns: 40px 1fr 90px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
}
.rev-block__row:last-child { border-bottom: none; }
.rev-block__row--head { color: var(--ink-faint); font-weight: 600; background: var(--paper); }
.footer-note { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); margin: 0; }

/* Education degrees link to the research page for that degree; keep the sheet look. */
.sheet-list__degree a { color: inherit; text-decoration: none; }
.sheet-list__degree a:hover, .sheet-list__degree a:focus { color: var(--accent); }

/* YouTube Shorts (9:16), alone or several side by side in .shorts-row. */
.yt-embed--vertical { display: block; aspect-ratio: 9 / 16; width: 100%; max-width: 240px; border: 1px solid var(--line-strong); margin: 8px 0; }
.shorts-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 12px; }
.shorts-row .yt-embed--vertical { flex: 0 1 180px; width: 180px; margin: 0; }

/* Looping MATLAB simulation clips hosted on the site. */
.sim-video { display: block; width: 100%; border: 1px solid var(--line-strong); background: #fff; margin: 8px 0 4px; }

/* Figures on long write-ups: centred, capped so tall diagrams don't fill the screen. */
.content img.fig { display: block; margin: 16px auto; max-width: min(100%, 760px); max-height: 520px; width: auto; height: auto; }

/* A data plot with the video it came from, side by side (stacks on phones). */
.fig-video { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: center; margin: 16px 0; }
.fig-video img { display: block; width: 100%; height: auto; margin: 0; }
.fig-video .yt-embed--vertical { width: 100%; max-width: none; margin: 0; }
@media (max-width: 640px) {
  .fig-video { grid-template-columns: 1fr; }
  .fig-video .yt-embed--vertical { max-width: 260px; margin: 0 auto; }
}

/* Two photos side by side (stack on phones). */
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.fig-pair img { display: block; width: 100%; height: auto; margin: 0; }
@media (max-width: 640px) { .fig-pair { grid-template-columns: 1fr; } }

/* Small captioned photos, e.g. team and event pictures at the foot of a page. */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 16px 0; }
.photo-grid figure { margin: 0; }
.photo-grid img { display: block; width: 100%; height: 170px; object-fit: cover; margin: 0; }
.photo-grid figcaption { margin-top: 6px; font-size: 0.82rem; color: var(--ink-faint); }
.photo-grid__wide { grid-column: 1 / -1; }
.photo-grid__wide img { height: auto; object-fit: contain; }
/* Show each photo whole instead of cropping to a common height. */
.photo-grid--whole img { height: 240px; object-fit: contain; background: var(--paper); }
