/*
  Pratyush Potu — personal site
  Hand-written HTML and CSS, no framework.

  Layout: one grid shared by every page. A narrow left column holds marginal
  headings (set flush right against the gutter) and the portrait; the right
  column holds the text at a comfortable reading measure. On phones the two
  columns collapse into one.

  Type: STIX Two Text, the typeface developed by scientific publishers for
  mathematical journals, self-hosted from /fonts (SIL Open Font License).
*/

/* ---------- Fonts ---------- */

@font-face {
  font-family: "STIX Two Web";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "STIX Two Web";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "STIX Two Web";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-wght-normal.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "STIX Two Web";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "STIX Two Web";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "STIX Two Web";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-wght-italic.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* ---------- Tokens ---------- */

:root {
  --paper: #ffffff;
  --ink: #1b2129;
  --muted: #5a6470;
  --rule: #e1e4e8;
  --link: #1a4f7a;        /* Prussian blue */
  --link-hover: #0d3454;
  --accent: #dc9a35;      /* saffron: active page, shaded simplices */
  --accent-fill: rgb(224 160 60 / 0.3);

  --serif: "STIX Two Web", "STIX Two Text", "Times New Roman", Times, serif;

  --margin-col: 11rem;
  --gutter: 2.75rem;
  --measure: 38rem;

  color-scheme: light;
}

/* Dark theme. It applies when the reader's system is set to dark and they
   have not picked light with the switch, or when they have picked dark.
   (theme.js sets data-theme on <html>.) Keep the two blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15181c;
    --ink: #e2e5e9;
    --muted: #9ba5b1;
    --rule: #2b3139;
    --link: #93bde9;
    --link-hover: #c3dbf5;
    --accent: #e8b052;
    --accent-fill: rgb(232 176 82 / 0.24);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15181c;
  --ink: #e2e5e9;
  --muted: #9ba5b1;
  --rule: #2b3139;
  --link: #93bde9;
  --link-hover: #c3dbf5;
  --accent: #e8b052;
  --accent-fill: rgb(232 176 82 / 0.24);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;          /* 18px */
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}

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

p { margin: 0 0 0.9em; }

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
}
a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 { font-weight: 600; }

sup, sub { font-size: 0.7em; line-height: 0; }

/* stacked super/subscript, e.g. V with 1 above and h below */
.ss {
  display: inline-flex;
  flex-direction: column;
  vertical-align: 0.62em;        /* raises the top script; the bottom one hangs below the baseline */
  font-size: 0.68em;
  line-height: 1.02;
  margin-left: 0.04em;
}
.ss > span { display: block; }

.op { font-style: normal; }   /* upright operator names: grad, curl, div */

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.4rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- Grid ---------- */

.wrap {
  max-width: calc(var(--margin-col) + var(--gutter) + var(--measure) + 3rem);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, var(--measure));
  column-gap: var(--gutter);
}
.grid > .margin { grid-column: 1; text-align: right; }
.grid > .body   { grid-column: 2; min-width: 0; }

/* ---------- Header ---------- */

.site-header {
  padding-top: 2.1rem;
  align-items: baseline;
}
.site-name {
  grid-column: 1;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.site-name:hover { color: var(--link); }

/* the nav links, with the light/dark switch at the far end of the row */
.header-bar {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.7rem;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 0.1rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--link);
  border-bottom-color: color-mix(in srgb, var(--link) 35%, transparent);
}
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* light/dark switch: a moon in light mode, a sun in dark mode */
.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin: -0.4rem -0.45rem -0.4rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--link);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
/* the switch needs theme.js; without scripts the page simply follows the system */
:root:not([data-theme]) .theme-toggle { display: none; }

/* ---------- Sections ---------- */

.section { margin-top: 3.4rem; }

.section > h2 {
  grid-column: 1;
  margin: 0;
  padding-top: 0.05rem;
  font-size: 1.3125rem;          /* 21px */
  line-height: 1.3;
  text-align: right;
  text-wrap: balance;
}
.section > .body > :last-child { margin-bottom: 0; }

.body h3 {
  font-size: 1.125rem;
  line-height: 1.4;
  margin: 1.6rem 0 0.5rem;
}

.lede { font-size: 1.1875rem; }

.more { margin-top: 0.4rem; }

/* page title on inner pages */
.page-head { margin-top: 3rem; }
.page-head h1 {
  font-size: 2.25rem;            /* 36px */
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 1.1rem;
}

/* ---------- Home: introduction ---------- */

.hero {
  margin-top: 3.1rem;
  grid-template-rows: auto 1fr;
}
.portrait { grid-row: 1 / span 2; }
.portrait img {
  display: block;
  width: 100%;
  margin-left: auto;
  border-radius: 2px;
}
.intro-head { grid-row: 1; }
.intro-text { grid-row: 2; }

.hero h1 {
  font-size: 3rem;               /* 48px */
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
  margin: -0.06em 0 0.55rem;
}
.role {
  font-style: italic;
  color: var(--muted);
  font-size: 1.1875rem;
  line-height: 1.4;
  margin: 0 0 1.5rem;
}

.contact {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1.1rem;
  row-gap: 0.2rem;
  margin: 1.4rem 0 0;
  font-size: 1rem;
}
.contact dt { color: var(--muted); font-style: italic; }
.contact dd { margin: 0; }
.contact .inline-links a + a { margin-left: 1rem; }

/* ---------- Lists ---------- */

.themes {
  margin: 0.2rem 0 1.1rem;
  padding-left: 1.15rem;
}
.themes li { margin: 0 0 0.45rem; padding-left: 0.25rem; }
.themes li::marker { color: var(--muted); }

.plain { list-style: none; margin: 0; padding: 0; }

/* compact publication list (home) */
.pubs li { margin: 0 0 1.15rem; }
.pub-title { display: block; font-weight: 600; line-height: 1.4; }
.pub-meta  { display: block; color: var(--muted); font-size: 1rem; margin-top: 0.1rem; }
.pub-links { display: block; font-size: 1rem; }
.pub-links a + a { margin-left: 1rem; }

/* dated list (talks, workshops) */
.dated li {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  column-gap: 1rem;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}
.dated time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.note { color: var(--muted); font-style: italic; }

/* scroll boxes (news and publications on the home page): a fixed-height list
   that scrolls. The soft shadow at the top or bottom edge appears only when
   there is more to scroll in that direction. */
.news-scroll, .pubs-scroll {
  max-height: 20.5rem;
  overflow-y: auto;
  padding: 0.9rem 0.6rem 0.9rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 28%, transparent) transparent;
  background:
    linear-gradient(var(--paper) 35%, transparent) top / 100% 2.75rem no-repeat local,
    linear-gradient(transparent, var(--paper) 65%) bottom / 100% 2.75rem no-repeat local,
    linear-gradient(color-mix(in srgb, var(--ink) 10%, transparent), transparent) top / 100% 0.9rem no-repeat scroll,
    linear-gradient(transparent, color-mix(in srgb, var(--ink) 10%, transparent)) bottom / 100% 0.9rem no-repeat scroll;
  background-color: var(--paper);
}
.news-scroll:focus-visible, .pubs-scroll:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 4px;
}
.pubs-scroll { max-height: 24rem; }   /* about three papers at a time */
.pubs-scroll + .more { margin-top: 0.9rem; }
.news li:last-child, .pubs-scroll li:last-child { margin-bottom: 0; }
.news-section > h2, .pubs-section > h2 { padding-top: calc(0.95rem + 1px); }   /* line up with the first item */
.news li.is-upcoming time { color: var(--ink); font-weight: 600; }

/* service list */
.roles li { margin: 0 0 0.55rem; }

/* ---------- Papers page ---------- */
/* the lists use the same .pubs styles as the home page */

.pubs li { scroll-margin-top: 1.5rem; }
.pubs li:last-child { margin-bottom: 0; }
.pubs li:target .pub-title {          /* an entry reached through a link like publications.html#dec-whitney */
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 0.22em;
}

/* related papers at the end of a research theme */
.related {
  margin-top: 1.1rem;
  font-size: 1rem;
  line-height: 1.5;
}
.related p { margin: 0 0 0.3rem; color: var(--muted); font-style: italic; }
.related ul { margin: 0; padding-left: 1.15rem; }
.related li { margin: 0 0 0.3rem; padding-left: 0.2rem; }
.related li::marker { color: var(--muted); }

/* ---------- Figures ---------- */

.figure { margin: 1.9rem 0 2.1rem; }
.figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}
.figure figcaption i, .figure figcaption .op { color: var(--ink); }

svg.mesh { display: block; width: 100%; height: auto; }

.m-edge {
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.4;
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.m-edge-strong { stroke-opacity: 0.95; stroke-width: 1.3; }
.m-fill  { fill: var(--accent-fill); stroke: none; }
.m-split {
  fill: none;
  stroke: var(--link);
  stroke-width: 1.1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.m-dual {
  fill: none;
  stroke: var(--link);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}
.m-bary   { fill: var(--link); }
.m-vertex { fill: var(--ink); }
.m-hl-primal, .m-hl-dual {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.m-hl-primal { stroke: var(--ink); }
.m-hl-dual   { stroke: var(--link); }
.m-right {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

/* two pictures side by side inside a figure */
.panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.panel-label {
  margin: 0.25rem 0 0;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}
.panel-label i { color: var(--ink); }
.figure-center svg.mesh { max-width: 30rem; margin: 0 auto; }

/* discrete vector potential */
.m-edge-faint { stroke-opacity: 0.2; }
.f-pos { fill: var(--accent); }
.f-neg { fill: var(--link); }
.vp-shaft {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.vp-head { fill: var(--ink); }
.vp-z {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.fig-label {
  fill: var(--ink);
  font-style: italic;
  font-size: 17px;
  paint-order: stroke;          /* a halo in the page color keeps the label clear of arrows */
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* the counterexample triangulation */
.st-edge {
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.85;
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.st-axis {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}
.st-central { fill: var(--accent-fill); }
.st-c, .st-corner { fill: var(--ink); }
.st-a { fill: var(--link); }
.st-b { fill: var(--paper); stroke: var(--link); stroke-width: 1.6; }
.st-r { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }

/* ---------- Commuting diagram ---------- */
/* Items are placed by --i (position along the complex, 1..7) and
   --j (1 continuous row, 2 projections, 3 discrete row, 4 names).
   On phones the diagram is transposed so it reads top to bottom. */

.cd {
  display: grid;
  grid-template-columns: auto minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr) auto;
  grid-template-rows: auto 3.6rem auto auto;
  align-items: center;
  justify-items: center;
  font-size: 1.1875rem;
  padding-top: 1.4rem;
}
.cd > * { grid-column: var(--i); grid-row: var(--j); }

.cd-obj { white-space: nowrap; line-height: 1.25; padding: 0 0.1rem; }
.cd-name {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.25;
  text-align: center;
  margin-top: 0.45rem;
}

.arr {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--ink);
}
.arr .shaft { flex: 1 1 auto; background: currentColor; }
.arr svg { flex: none; width: 10px; height: 10px; overflow: visible; }
.arr svg path { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.arr .lab {
  position: absolute;
  font-size: 0.8125rem;
  line-height: 1;
  white-space: nowrap;
}
.arr.p .lab { font-size: 0.9375rem; }

/* horizontal arrow */
.cd .d {
  flex-direction: row;
  justify-self: stretch;
  align-self: center;
  height: 10px;
  padding: 0 0.5rem;
}
.cd .d .shaft { height: 1px; width: auto; }
.cd .d svg { margin-left: -9px; transform: none; }
.cd .d .lab {
  left: 50%;
  top: auto;
  bottom: calc(100% + 0.2rem);
  transform: translateX(-50%);
}

/* vertical arrow */
.cd .p {
  flex-direction: column;
  justify-self: center;
  align-self: stretch;
  width: 10px;
  padding: 0.45rem 0;
}
.cd .p .shaft { width: 1px; height: auto; }
.cd .p svg { margin-left: 0; margin-top: -9px; transform: rotate(90deg); }
.cd .p .lab {
  left: calc(100% + 0.4rem);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- Photos ---------- */
/* Photo bands span the full width of the grid. Each image links to a larger copy. */

.photo-band { grid-column: 1 / -1; margin: 0; }
.photo-band figure { margin: 0; }
.photo-band a { display: block; }
.photo-band img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: var(--rule);
}
.photo-band figcaption {
  margin-top: 0.7rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}

/* three square photos in a row */
.photo-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

/* a portrait and a landscape photo; column widths follow the aspect ratios
   (640/835 and 1000/750) so the two images come out the same height */
.photo-pair {
  display: grid;
  grid-template-columns: minmax(0, 0.7665fr) minmax(0, 1.3333fr);
  gap: 1rem;
  align-items: start;
}

/* ---------- Tables (teaching) ---------- */

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
  margin: 0.4rem 0 1.2rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 1rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
th:last-child, td:last-child { padding-right: 0; }
th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9375rem;
  border-bottom-color: color-mix(in srgb, var(--ink) 30%, transparent);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.when { color: var(--muted); }

.course { margin: 0 0 1.5rem; }
.course h3 { margin: 0 0 0.15rem; }
.course .when { color: var(--muted); font-style: italic; margin: 0 0 0.35rem; }
.course p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 4.5rem;
  padding: 1.2rem 0 2.6rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.site-footer .body {
  border-top: 1px solid var(--rule);
  padding-top: 1.1rem;
}
.site-footer p { margin: 0; }

/* ---------- Phones and narrow windows ---------- */

@media (max-width: 47.5rem) {
  body { font-size: 1.0625rem; line-height: 1.55; }   /* 17px */

  .wrap { padding: 0 1rem; }

  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid > .margin,
  .grid > .body,
  .section > h2,
  .site-name,
  .header-bar { grid-column: 1; text-align: left; }

  .site-header { padding-top: 1.25rem; row-gap: 0.35rem; }
  .site-nav ul { gap: 0.2rem 1.25rem; }

  .section { margin-top: 2.6rem; }
  .section > h2 { margin-bottom: 0.55rem; }

  .page-head { margin-top: 2rem; }
  .page-head h1 { font-size: 2rem; }

  .hero.grid {
    margin-top: 1.9rem;
    grid-template-columns: 6.25rem minmax(0, 1fr);
    column-gap: 1rem;
    grid-template-rows: auto auto;
  }
  .hero > .portrait   { grid-column: 1; grid-row: 1; }
  .hero > .intro-head { grid-column: 2; grid-row: 1; align-self: end; }
  .hero > .intro-text { grid-column: 1 / -1; grid-row: 2; margin-top: 1.25rem; }
  .hero h1 { font-size: 2.125rem; margin: 0 0 0.4rem; }
  .role { font-size: 1.0625rem; margin: 0; }

  .contact { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .contact dd { margin-bottom: 0.45rem; }

  .dated li { grid-template-columns: minmax(0, 1fr); }
  .dated time { font-size: 0.9375rem; }
  .news-scroll, .pubs-scroll { padding-right: 0.25rem; }
  .news-scroll { max-height: 25rem; }
  .pubs-scroll { max-height: 28rem; }
  .news-section > h2, .pubs-section > h2 { padding-top: 0.05rem; }

  .panels { grid-template-columns: minmax(0, 1fr); gap: 1rem; }

  .photo-row, .photo-pair { grid-template-columns: minmax(0, 1fr); }
  .photo-pair { row-gap: 1.6rem; }

  /* transposed diagram */
  .cd {
    grid-template-columns: auto 4.5rem auto auto;
    grid-template-rows: auto 2.7rem auto 2.7rem auto 2.7rem auto;
    justify-content: start;
    font-size: 1.0625rem;
    padding-top: 0.5rem;
  }
  .cd > * { grid-column: var(--j); grid-row: var(--i); }
  .cd-name { justify-self: start; text-align: left; margin: 0 0 0 0.9rem; }

  .cd .d {
    flex-direction: column;
    justify-self: center;
    align-self: stretch;
    width: 10px;
    height: auto;
    padding: 0.3rem 0;
  }
  .cd .d .shaft { width: 1px; height: auto; }
  .cd .d svg { margin-left: 0; margin-top: -9px; transform: rotate(90deg); }
  .cd .d .lab {
    left: calc(100% + 0.4rem);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
  }

  .cd .p {
    flex-direction: row;
    justify-self: stretch;
    align-self: center;
    width: auto;
    height: 10px;
    padding: 0 0.45rem;
  }
  .cd .p .shaft { height: 1px; width: auto; }
  .cd .p svg { margin-left: -9px; margin-top: 0; transform: none; }
  .cd .p .lab {
    left: 50%;
    top: auto;
    bottom: calc(100% + 0.25rem);
    transform: translateX(-50%);
  }
}

/* ---------- Print ---------- */

@media print {
  /* always print in light colors, whatever theme is on screen */
  :root:root, :root[data-theme] {
    --paper: #fff; --ink: #000; --muted: #333; --rule: #ccc; --link: #000; --link-hover: #000;
    color-scheme: light;
  }
  .site-nav, .theme-toggle, .skip { display: none; }
  a { text-decoration: none; }
  .section { break-inside: avoid-page; }
}
