/* Robert Penchovsky website, 2026 redesign.
   Section colours follow the nucleotide colours used in sequence viewers:
   A green = Research, C blue = Publications, G amber = Tools, U red = Teaching. */

:root {
  --paper: #fbfcfd;
  --panel: #f1f4f7;
  --ink: #17202e;
  --muted: #566273;
  --rule: #dce2e9;
  --link: #2457b8;
  --link-hover: #173f8c;
  --a: #2e8b4f;
  --c: #2a5fbf;
  --g: #b8690c;
  --u: #c4392e;
  --a-soft: #e6f3ea;
  --c-soft: #e6eefb;
  --g-soft: #fbf0e1;
  --u-soft: #fbe9e7;
  --focus: #2a5fbf;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --wrap: 1160px;
  --measure: 70ch;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171f; --panel: #1a212c; --ink: #e8ecf1; --muted: #a3adbb; --rule: #2c3644;
    --link: #8db4ff; --link-hover: #b9d0ff;
    --a: #5cc485; --c: #7aa6f5; --g: #e6a14a; --u: #f07a6f;
    --a-soft: #183225; --c-soft: #1a2844; --g-soft: #3a2a14; --u-soft: #3d1c19; --focus: #8db4ff;
  }
}
:root[data-theme="dark"] {
  --paper: #12171f; --panel: #1a212c; --ink: #e8ecf1; --muted: #a3adbb; --rule: #2c3644;
  --link: #8db4ff; --link-hover: #b9d0ff;
  --a: #5cc485; --c: #7aa6f5; --g: #e6a14a; --u: #f07a6f;
  --a-soft: #183225; --c-soft: #1a2844; --g-soft: #3a2a14; --u-soft: #3d1c19; --focus: #8db4ff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.328125rem/1.65 var(--serif);
  font-optical-sizing: auto;
}
/* Enlarge browser-default control text too; component rules below retain their sizes. */
input, button, select, textarea { font-size: 1.041666667rem; }
img, video, iframe { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; font-family: var(--sans); }
.skip:focus { left: 8px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(2.5rem, 1.75rem + 3vw, 3.75rem); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 2.1875rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.625rem; margin: 1.8rem 0 0.5rem; }
h4 { font-size: 1.375rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1em; }
small, .small { font-size: 1.09375rem; }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); }
.head-row { display: flex; align-items: center; gap: 24px; min-height: 76px; flex-wrap: wrap; }
.wordmark { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; padding: 10px 0; margin-right: auto; }
.wm-name { font: 600 1.6875rem/1.1 var(--serif); letter-spacing: -0.005em; }
.wm-sub { font: 400 1rem/1.3 var(--sans); color: var(--muted); margin-top: 3px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  display: block; padding: 8px 10px; font: 500 1.1875rem/1 var(--sans); color: var(--ink);
  text-decoration: none; border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--link); }
.site-nav a.is-current { border-bottom-color: var(--ink); }
.site-nav a.b-a.is-current { border-bottom-color: var(--a); }
.site-nav a.b-c.is-current { border-bottom-color: var(--c); }
.site-nav a.b-g.is-current { border-bottom-color: var(--g); }
.site-nav a.b-u.is-current { border-bottom-color: var(--u); }
.nav-toggle { display: none; font: 500 1.1875rem var(--sans); background: none; border: 1px solid var(--rule); color: var(--ink); padding: 8px 14px; border-radius: 6px; cursor: pointer; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; padding-bottom: 12px; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { padding: 12px 4px; border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; }
  .site-nav a.is-current { border-bottom-color: var(--rule); border-left-color: var(--ink); padding-left: 10px; }
  .site-nav a.b-a.is-current { border-left-color: var(--a); }
  .site-nav a.b-c.is-current { border-left-color: var(--c); }
  .site-nav a.b-g.is-current { border-left-color: var(--g); }
  .site-nav a.b-u.is-current { border-left-color: var(--u); }
}

/* ---------- Page header with base tile ---------- */
.page-head { padding: 44px 0 28px; border-bottom: 1px solid var(--rule); }
.page-head h1 { display: flex; align-items: center; gap: 16px; }
.page-head .lead { max-width: var(--measure); font-size: 1.5rem; color: var(--muted); margin: 14px 0 0; }
.tile {
  flex: none; display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%;
  font: 500 0.55em/1 var(--mono); color: #fff; background: var(--ink);
}
.t-a { background: var(--a); } .t-c { background: var(--c); } .t-g { background: var(--g); } .t-u { background: var(--u); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile { color: #12171f; } }

/* ---------- Layout ---------- */
.page-body { padding: 36px 0 64px; }
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
@media (max-width: 960px) { .with-aside { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
.prose { max-width: var(--measure); }
.prose img { display: block; margin: 0.8em 0 1.2em; border-radius: 4px; max-height: 720px; width: auto; }
.prose video, .prose iframe { display: block; margin: 0.8em 0 1.2em; border-radius: 4px; background: #000; }
.prose video { width: 100%; max-width: 720px; height: auto; }
.prose audio { width: 100%; max-width: 520px; display: block; margin: 0.6em 0 1.2em; }
.prose table { border-collapse: collapse; width: 100%; font: 1.1875rem/1.45 var(--sans); margin: 1em 0 1.6em; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 600; background: var(--panel); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.25em 0; }
.prose h3:first-child, .prose h2:first-child, .prose p:first-child { margin-top: 0; }
.legacy b { font-weight: 600; }
.legacy p > b { font-weight: 500; }
.legacy br + br { display: none; }
.back { font: 500 1.1875rem var(--sans); display: inline-block; margin: 0 0 18px; }

/* Aside lists: "In this section" */
.aside { font-family: var(--sans); font-size: 1.1625rem; line-height: 1.45; }
.aside h2 { font: 600 1.1875rem/1.3 var(--sans); margin: 28px 0 8px; padding-top: 12px; border-top: 2px solid var(--ink); }
.aside h2:first-child { margin-top: 0; }
.sec-a .aside h2 { border-top-color: var(--a); }
.sec-c .aside h2 { border-top-color: var(--c); }
.sec-g .aside h2 { border-top-color: var(--g); }
.sec-u .aside h2 { border-top-color: var(--u); }
.aside ul { list-style: none; margin: 0; padding: 0; }
.aside li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.aside li a { font-weight: 500; }
.aside .note { display: block; color: var(--muted); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: 500 1.25rem/1 var(--sans); padding: 12px 18px; border-radius: 6px;
  text-decoration: none; border: 1px solid var(--ink); color: var(--ink); background: transparent; cursor: pointer;
}
.btn:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--link-hover); border-color: var(--link-hover); color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* ---------- Home ---------- */
.hero { padding: 56px 0 48px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(3rem, 1.875rem + 4.5vw, 5.125rem); font-weight: 500; letter-spacing: -0.02em; }
.hero .role { font: 400 1.3125rem/1.5 var(--sans); color: var(--muted); margin: 12px 0 22px; max-width: 46ch; }
.hero .pitch { font-size: 1.65rem; line-height: 1.5; max-width: 34ch; margin: 0; }
.fold { justify-self: center; width: 100%; max-width: 300px; }
.fold svg { display: block; width: 100%; height: auto; overflow: visible; }
.fold .bp { stroke: var(--muted); stroke-width: 2; }
.fold .bb { fill: none; stroke: var(--rule); stroke-width: 3; }
.fold circle { stroke: var(--paper); stroke-width: 2; }
.fold text.n { font: 500 18.75px var(--mono); fill: #fff; text-anchor: middle; dominant-baseline: central; }
.fold text.end { font: 500 16.25px var(--mono); fill: var(--muted); }
.fold .A circle { fill: var(--a); } .fold .C circle { fill: var(--c); } .fold .G circle { fill: var(--g); } .fold .U circle { fill: var(--u); }
.fold-caption { font: 400 1.025rem/1.5 var(--sans); color: var(--muted); text-align: center; margin-top: 8px; }
.dotbracket { font: 400 1.1875rem/1.35 var(--mono); text-align: center; margin: 14px 0 0; white-space: pre; color: var(--ink); }
.dotbracket span { display: block; }
.fold .pair { opacity: 0; transform-box: fill-box; transform-origin: center; animation: zip 0.45s ease-out forwards; }
.fold .loop { opacity: 0; animation: zip 0.5s ease-out forwards; animation-delay: 1.35s; }
@keyframes zip { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .fold .pair, .fold .loop { animation: none; opacity: 1; } }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; } .fold { max-width: 190px; } }

.band { padding: 48px 0; border-bottom: 1px solid var(--rule); }
.band h2 { margin-top: 0; }
.band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.band-head h2 { margin: 0; }
.band-head a { font: 500 1.1875rem var(--sans); }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--rule); }
.facts div { padding: 18px 20px 18px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font: 600 2rem/1.1 var(--serif); }
.facts dd { margin: 6px 0 0; font: 400 1.15rem/1.4 var(--sans); color: var(--muted); }
@media (max-width: 820px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.theme { display: grid; grid-template-columns: 44px 1fr; gap: 0 16px; padding: 22px 0; border-top: 1px solid var(--rule); }
.theme .tile { font-size: 18.75px; width: 36px; height: 36px; }
.theme h3 { margin: 4px 0 6px; font-size: 1.5625rem; }
.theme p { margin: 0 0 8px; color: var(--ink); }
.theme .more { font: 500 1.1625rem var(--sans); }
@media (max-width: 820px) { .themes { grid-template-columns: 1fr; } }

.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.news time { font: 500 1.125rem/1.6 var(--sans); color: var(--muted); }
.news p { margin: 0; }
@media (max-width: 600px) { .news li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Tools ---------- */
.tool-groups h2 { font-size: 1.75rem; margin: 36px 0 6px; }
.tool-groups h2:first-child { margin-top: 0; }
.tool-groups > p { color: var(--muted); max-width: var(--measure); }
.tool-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 32px; }
.tool-list li { border-top: 1px solid var(--rule); padding: 14px 0; }
.tool-list a { font: 600 1.25rem/1.3 var(--sans); text-decoration: none; }
.tool-list a:hover { text-decoration: none; }
.tool-list span { display: block; font: 400 1.15rem/1.45 var(--sans); color: var(--muted); margin-top: 4px; }
.tool-list .tl-g a { color: var(--g); }

.tool { font-family: var(--sans); font-size: 1.225rem; line-height: 1.5; }
.tool .intro { font-family: var(--serif); font-size: 1.35rem; max-width: var(--measure); }
.tool fieldset { border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px 18px; margin: 0 0 18px; }
.tool legend { font-weight: 600; padding: 0 6px; }
.tool label { cursor: pointer; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 0; }
.choices label { display: inline-flex; align-items: center; gap: 7px; }
.field { margin: 12px 0; }
.field > label, .field > .label { display: block; font-weight: 500; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 1.125rem; margin: 4px 0 0; }
.tool input[type=text], .tool input[type=number], .tool select, .tool textarea {
  font: 400 1.225rem/1.4 var(--sans); color: var(--ink); background: var(--paper);
  border: 1px solid #a9b4c2; border-radius: 6px; padding: 9px 11px; max-width: 100%;
}
.tool input[type=text] { width: 100%; max-width: 560px; }
.tool input.short { width: 140px; }
.tool textarea { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 1.15rem; line-height: 1.5; resize: vertical; }
.tool select[multiple] { width: 100%; max-width: 360px; min-height: 240px; font-family: var(--mono); }
.tool .row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; max-width: 760px; }
@media (max-width: 640px) { .tool .row2 { grid-template-columns: 1fr; } }
.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; font-size: 1.15rem; color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.cite { border-left: 3px solid var(--g); padding: 4px 0 4px 16px; margin: 28px 0 0; color: var(--muted); max-width: var(--measure); }
.sec-g .cite { border-left-color: var(--g); }
.help { margin-top: 28px; }
.help summary { cursor: pointer; font-weight: 600; }
.help .prose { margin-top: 12px; font-family: var(--serif); }
.iub { font: 400 1.1rem/1.6 var(--mono); color: var(--muted); }

.result { font-family: var(--sans); }
.result .out {
  border: 1px solid var(--rule); border-radius: 8px; padding: 18px 20px; overflow-x: auto; background: var(--paper);
  font-size: 1.1875rem; line-height: 1.55;
}
.result .out pre, .result .out textarea { font-family: var(--mono); font-size: 1.1rem; }
.result .out textarea { width: 100%; }
.result .out h2, .result .out h3, .result .out h4 { font-family: var(--sans); font-weight: 500; font-size: 1.25rem; margin: 0.6em 0; }
.result .out table { border-collapse: collapse; }
.result .out td, .result .out th { padding: 4px 8px; border: 1px solid var(--rule); }
.result .empty { padding: 18px 20px; background: var(--g-soft); border-radius: 8px; }
.result .chartWrapper { overflow-x: auto; }

/* ---------- Publications ---------- */
.pub-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 0 0 18px; font-family: var(--sans); }
.pub-tools label { display: flex; flex-direction: column; gap: 4px; font-size: 1.1rem; color: var(--muted); }
.pub-tools input, .pub-tools select { font: 400 1.225rem var(--sans); padding: 9px 11px; border: 1px solid #a9b4c2; border-radius: 6px; background: var(--paper); color: var(--ink); }
.pub-tools input { width: 280px; max-width: 100%; }
.pub-count { font: 400 1.125rem var(--sans); color: var(--muted); margin: 0 0 8px; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; padding: 18px 0; border-top: 1px solid var(--rule); }
.pub img { width: 64px; height: 84px; object-fit: contain; object-position: top; background: var(--panel); border-radius: 3px; }
.pub .t { font-size: 1.375rem; line-height: 1.35; margin: 0 0 4px; font-weight: 500; }
.pub .t a { color: var(--ink); text-decoration: none; }
.pub .t a:hover { color: var(--link); text-decoration: none; }
.pub .au { font: 400 1.15rem/1.45 var(--sans); color: var(--muted); margin: 0 0 4px; }
.pub .au b { color: var(--ink); font-weight: 600; }
.pub .v { font: 400 1.15rem/1.45 var(--sans); margin: 0; }
.pub .v i { font-style: italic; font-family: var(--serif); font-size: 1.25rem; }
.pub .kind { display: inline-block; font: 500 0.975rem/1 var(--sans); padding: 4px 7px; border-radius: 4px; background: var(--c-soft); color: var(--c); margin-left: 6px; vertical-align: 1px; }
.pub[hidden] { display: none; }
.stats { font-family: var(--sans); font-size: 1.1875rem; }
.stats table { width: 100%; border-collapse: collapse; }
.stats td { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.stats td + td { text-align: right; font-weight: 600; }

/* ---------- Misc ---------- */
.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.person img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; }
.person h3 { margin: 10px 0 2px; font-size: 1.375rem; }
.person p { font: 400 1.125rem/1.45 var(--sans); color: var(--muted); margin: 0; }
.portrait { float: right; width: 190px; margin: 4px 0 16px 28px; border-radius: 4px; }
@media (max-width: 600px) { .portrait { float: none; margin: 0 0 16px; } }
.map { width: 100%; height: 360px; border: 0; border-radius: 6px; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.form .field input, .form .field textarea { width: 100%; font: 400 1.25rem var(--sans); padding: 10px 12px; border: 1px solid #a9b4c2; border-radius: 6px; background: var(--paper); color: var(--ink); }
.form .field textarea { min-height: 160px; }
.hp { position: absolute; left: -5000px; }
.notice { padding: 14px 18px; border-radius: 8px; background: var(--a-soft); margin: 0 0 18px; font-family: var(--sans); }
.notice.err { background: var(--u-soft); }
.yt { aspect-ratio: 16 / 9; width: 100%; max-width: 720px; border: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 220px; object-fit: cover; border-radius: 4px; margin: 0; }
.gallery figcaption { font: 400 1.0625rem/1.4 var(--sans); color: var(--muted); margin-top: 6px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--rule); background: var(--panel); padding: 40px 0 48px; font: 400 1.15rem/1.55 var(--sans); color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot-name { color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.foot-h { color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.foot-links { list-style: none; margin: 0; padding: 0; columns: 2; }
.foot-links li { margin: 2px 0; }
.foot-meta { margin-top: 12px; font-size: 1.0625rem; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }

@media print {
  .site-head, .site-foot, .aside, .nav-toggle, .btn-row, .actions { display: none !important; }
  body { background: #fff; color: #000; }
  .with-aside { display: block; }
}
.seqbox { width: 100%; font: 400 1.1rem/1.5 var(--mono); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; background: var(--panel); color: var(--ink); resize: vertical; }
.result .out img { max-width: 100%; height: auto; }
.legacy-widget textarea { width: auto; min-height: 0; }
.legacy-widget table { border-collapse: separate; }
.legacy-widget input[type=button] { font: 500 1.1875rem var(--sans); padding: 6px 10px; border-radius: 4px; border: 1px solid #a9b4c2; background: var(--panel); color: var(--ink); cursor: pointer; min-width: 44px; }
.legacy-widget h3 { display: none; }
.tool { max-width: 920px; }
.stats td + td { white-space: nowrap; padding-left: 12px; }
/* Tool output comes from the Perl scripts as loose HTML, so style the whole result area. */
.is-result main { font-family: var(--sans); font-size: 1.2125rem; }
.is-result main .page-body h2, .is-result main .page-body h3, .is-result main .page-body h4, .is-result main .page-body h5 { font-family: var(--sans); font-size: 1.25rem; font-weight: 500; margin: 0.7em 0; }
.result .out { border: 0; padding: 18px 0 0; border-top: 1px solid var(--rule); border-radius: 0; overflow-x: auto; }
.is-result main textarea { max-width: 100%; font-family: var(--mono); font-size: 1.1rem; border: 1px solid var(--rule); border-radius: 6px; padding: 8px; background: var(--panel); color: var(--ink); }
.is-result main pre { white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: 1.1rem; }

/* Site search (Google) in the main menu, after Contact */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.site-nav ul { align-items: center; }
.nav-search form { display: flex; align-items: center; margin-left: 8px; border: 1px solid #a9b4c2; border-radius: 6px; background: var(--paper); overflow: hidden; }
.nav-search form:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.nav-search input[type=search] { border: 0; background: transparent; color: var(--ink); font: 400 1.125rem/1 var(--sans); padding: 8px 4px 8px 10px; width: 150px; outline: none; }
.nav-search button { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; cursor: pointer; display: grid; place-items: center; }
.nav-search button:hover { color: var(--link); }
@media (max-width: 900px) {
  .nav-search { padding: 12px 0 4px; }
  .nav-search form { margin-left: 0; width: 100%; }
  .nav-search input[type=search] { width: 100%; padding: 11px 4px 11px 12px; font-size: 1.25rem; }
}
.wm-sub { max-width: 32ch; }
.nav-search input[type=search] { width: 130px; }
@media (max-width: 1200px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; padding-bottom: 12px; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; align-items: stretch; }
  .site-nav a { padding: 12px 4px; border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; }
  .site-nav a.is-current { border-bottom-color: var(--rule); border-left-color: var(--ink); padding-left: 10px; }
  .site-nav a.b-a.is-current { border-left-color: var(--a); }
  .site-nav a.b-c.is-current { border-left-color: var(--c); }
  .site-nav a.b-g.is-current { border-left-color: var(--g); }
  .site-nav a.b-u.is-current { border-left-color: var(--u); }
  .nav-search { padding: 12px 0 4px; }
  .nav-search form { margin-left: 0; width: 100%; }
  .nav-search input[type=search] { width: 100%; padding: 11px 4px 11px 12px; font-size: 1.25rem; }
}

/* Portrait before the name in the header */
.wordmark { flex-direction: row; align-items: center; gap: 12px; }
.wm-text { display: flex; flex-direction: column; }
.wm-photo { width: 119.025px; height: 132.25px; border-radius: 0; object-fit: cover; object-position: 50% 18%; flex: none; border: 1px solid var(--line, #dde3ea); }
@media (max-width: 600px) { .wm-photo { width: 99.981px; height: 111.09px; } }
@media (min-width: 1201px) {
  .head-row { gap: 16px; }
  .wordmark { gap: 10px; }
  .wm-photo { width: 119.025px; height: 132.25px; }
  .site-nav a { padding: 8px 6px; }
  .nav-search input[type=search] { width: 174.5px; }
}

/* Photo on the right of the home page hero */
.hero-photo { justify-self: center; width: 100%; max-width: 529px; margin: 0; }
.hero-photo img { display: block; width: 100%; height: auto; border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.10); }
@media (max-width: 820px) { .hero-photo { max-width: 396.75px; justify-self: start; } }

/* Keep long links and wide legacy tables inside the page on narrow screens. */
.prose { min-width: 0; overflow-wrap: anywhere; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
.legacy-widget { max-width: 100%; overflow-x: auto; }
.tool fieldset { min-width: 0; }

/* Remove underlining from links, legacy output and all interaction states. */
*, *::before, *::after { text-decoration-line: none !important; }

/* Display the About-page robi.jpg portrait at 150% of its original 191px width. */
.prose img.portrait { width: 286.5px; }

/* Lab identity on the right of the header, with navigation on its own row. */
.head-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; padding-top: 12px; padding-bottom: 12px; }
.wordmark { grid-column: 1; grid-row: 1; min-width: 0; margin-right: 0; }
.wm-text { min-width: 0; }
.lab-logo { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; display: block; border-radius: 6px; background: #fff; }
.lab-logo img { display: block; width: auto; height: calc((119.025px - 2px) * 262 / 191 + 2px); object-fit: contain; border-radius: 6px; }
.site-nav { grid-column: 1 / -1; grid-row: 2; }
.nav-toggle { grid-column: 1; grid-row: 2; justify-self: start; }
.profile-links { columns: auto; display: grid; grid-template-columns: 1fr; gap: 8px; }
.profile-links li { margin: 0; break-inside: avoid; }
.profile-links a { display: inline-flex; align-items: center; gap: 10px; }
.profile-icon { flex: none; width: 28px; height: 28px; object-fit: contain; border-radius: 4px; }
@media (max-width: 1200px) { .site-nav { grid-row: 3; padding-bottom: 0; } }
@media (max-width: 600px) {
  .head-row { gap: 12px; align-items: start; }
  .lab-logo { align-self: start; margin-top: 10px; }
  .lab-logo img { width: auto; height: calc((99.981px - 2px) * 262 / 191 + 2px); }
  .wm-name { overflow-wrap: anywhere; }
}

/* Keep the portrait, header text and lab logo together in the center. */
.head-row { grid-template-columns: minmax(0, 1fr); }
.header-identity { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; justify-content: center; gap: 24px; min-width: 0; }
.wordmark { flex: 0 1 auto; text-align: center; }
.wm-sub { align-self: center; }
.lab-logo { flex: none; align-self: center; margin-top: 0; }
.site-nav ul { justify-content: center; }
.site-nav a { text-align: center; }
.nav-toggle { grid-column: 1 / -1; justify-self: center; }
@media (max-width: 600px) { .header-identity { gap: 12px; } }

/* Large teaching photographs, with related text below each image. */
.teaching-prose .teaching-block { display: flow-root; clear: both; margin-bottom: 1.2em; }
.teaching-prose img { float: none; width: 100%; max-width: 720px; height: auto; max-height: none; margin: 0 auto 1em; }
.teaching-course-gallery { float: none; width: 100%; max-width: 720px; margin: 0 auto 1em; }
.teaching-course-gallery figure { margin: 0 0 1em; }
.teaching-prose .teaching-course-gallery img { float: none; width: 100%; max-width: 100%; max-height: none; margin: 0; }
.teaching-course-gallery figcaption { margin-top: 6px; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.4; color: var(--muted); }

/* Space for the full academic and social profile list. */
.foot-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.65fr) minmax(0, 0.75fr); }
.profile-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.profile-links a { min-width: 0; }
.profile-links span { overflow-wrap: anywhere; }
.profile-icon { background: #fff; }
.profile-icon-loop { object-fit: cover; object-position: 14% center; }
@media (max-width: 960px) { .foot-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .profile-links { grid-template-columns: minmax(0, 1fr); } }

/* Video and audio recordings. */
.media-jump { display: flex; flex-wrap: wrap; gap: 12px 24px; font-family: var(--sans); margin-bottom: 24px; }
.media-section { scroll-margin-top: 20px; margin-bottom: 48px; }
.media-section > h2 { margin-top: 0; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.media-card { min-width: 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--paper); }
.media-card video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #111; }
.media-card-body { padding: 20px; }
.media-card h3 { margin: 0 0 12px; }
.media-card p { margin-bottom: 12px; }
.media-details { color: var(--muted); font: 400 1.0625rem/1.5 var(--sans); overflow-wrap: anywhere; }
.media-card audio { display: block; width: 100%; margin: 16px 0; }
.media-download { font: 400 1.0625rem/1.5 var(--sans); }
@media (max-width: 760px) { .media-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

/* Front-page artwork in the right-hand image position. */
.hero-photo a { display: block; }
.hero-photo figcaption { margin-top: 12px; text-align: center; color: var(--muted); font: 400 1.0625rem/1.4 var(--sans); }

/* Audit repairs: readable headings and contained sequence output on phones. */
.page-head h1 > span:not(.tile) { min-width: 0; overflow-wrap: anywhere; }
.result .out { width: 100%; max-width: 100%; min-width: 0; }
.result { min-width: 0; }
.aside { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .header-identity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .header-identity .wordmark { display: contents; }
  .wm-photo { grid-column: 1; grid-row: 1; justify-self: end; margin-right: 8px; }
  .header-identity .lab-logo { grid-column: 2; grid-row: 1; justify-self: start; }
  .wm-text { grid-column: 1 / -1; grid-row: 2; text-align: center; }
  .wm-name { overflow-wrap: normal; }
}

.result .out { overflow-wrap: anywhere; }
.result .out [id="left2"] { max-width: 100%; overflow-x: auto; }

/* Icons for the shared footer navigation. */
.footer-site-links { columns: auto; display: grid; gap: 10px; }
.footer-site-links li { margin: 0; }
.footer-site-links a { display: inline-flex; align-items: center; gap: 10px; }

/* Social sharing controls below the footer site links. */
.footer-share { margin-top: 24px; }
.footer-share-buttons { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3.5px; }
.footer-share-buttons a, .footer-share-buttons button { display: grid; grid-template-columns: 14px minmax(0, 1fr) 8px; align-items: center; gap: 4.5px; width: 50%; min-width: 0; height: 22px; padding: 3px 4.5px; border: 0.5px solid var(--rule); border-radius: 4px; background: #fff; color: var(--link); font: 500 0.75rem/1.2 var(--sans); text-align: left; cursor: pointer; }
.footer-share-buttons img { display: block; width: 14px; height: 14px; object-fit: contain; border-radius: 2.5px; }
.footer-share-buttons a:hover, .footer-share-buttons button:hover { border-color: var(--link); }
.share-status { margin: 10px 0 0; color: var(--muted); font: 400 0.9375rem/1.45 var(--sans); overflow-wrap: anywhere; }
.share-status:empty { display: none; }
.footer-share-url { display: block; width: 100%; margin-top: 10px; font: 400 0.9375rem/1.4 var(--sans); padding: 6px; }
.footer-share-url[hidden] { display: none; }

.footer-share-buttons .share-label { min-width: 0; white-space: nowrap; }
.footer-share-buttons .share-symbol { display: block; width: 8px; height: 8px; opacity: 0.75; }

/* Institution emblems beside the education and training row labels. */
.prose .education-table { display: table; table-layout: fixed; }
.education-table th { width: 36%; }
.education-heading { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; }
.education-icons { display: grid; gap: 8px; }
.education-icons a { display: block; width: 48px; height: 48px; }
.prose .education-icons img { display: block; width: 48px; height: 48px; max-height: none; margin: 0; object-fit: contain; border-radius: 4px; }
@media (max-width: 600px) {
  .prose .education-table, .education-table tbody, .education-table tr { display: block; }
  .education-table th, .education-table td { display: block; width: 100%; }
  .education-table th { border-bottom: 0; }
  .education-table td { padding-top: 10px; padding-bottom: 16px; }
}
/* Recordings alongside their conference entries. */
.prose .conference-video { max-width: 720px; margin: 24px 0; }
.prose .conference-video iframe, .prose .conference-video video { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; margin: 0; border: 0; }
.conference-video figcaption { margin-top: 10px; font: 400 1rem/1.45 var(--sans); color: var(--muted); }

/* Research recordings and the paired SUMMIT conference posters. */
.prose .research-video { max-width: 720px; margin: 24px 0; }
.prose .research-video video { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; margin: 0; }
.research-video figcaption { margin-top: 10px; font: 400 1rem/1.45 var(--sans); color: var(--muted); }
.conference-poster-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin: 24px 0; }
.conference-poster-pair a { min-width: 0; }
.prose .conference-poster-pair img { width: 100%; max-width: 100%; height: auto; max-height: none; margin: 0; }
/* Five equally sized research photographs in a single row. */
.research-image-gallery { width: calc(100% + 356px); max-width: none; margin: 24px 0 32px; overflow-x: auto; }
.research-image-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.research-image-row figure { min-width: 0; margin: 0; padding: 10px; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; }
.research-image-row figcaption { display: flex; align-items: center; justify-content: center; min-height: 2.8em; margin: 0 0 10px; font: 600 1.0625rem/1.4 var(--sans); text-align: center; }
.prose .research-image-row img { display: block; width: 100%; height: 180px; max-width: 100%; max-height: none; margin: 0; object-fit: cover; border-radius: 4px; }
@media (max-width: 960px) { .research-image-gallery { width: 100%; } }
@media (max-width: 700px) { .research-image-row { grid-template-columns: repeat(5, 180px); } }
