/* The pages beyond the homepage (/cv/, /projects/, /research/): plain pages under the same
   menu as the film, in the site's shadcn/ui neutral (zinc) tokens, light and dark. */
/* Geist, served from this site (fonts/, SIL Open Font License): one variable file covers every weight. */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/geist-latin.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: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/geist-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --background: #ffffff; --foreground: #09090b; --muted: #f4f4f5; --muted-foreground: #71717a;
  --ink2: #52525b; --border: #e4e4e7; --ring: rgba(161, 161, 170, 0.5); --radius: 0.625rem;
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --background: #09090b; --foreground: #fafafa; --muted: #27272a; --muted-foreground: #a1a1aa; --ink2: #d4d4d8; --border: #27272a; }
}
/* Native parts (scrollbars, video controls) follow the same light or dark. */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] { --background: #09090b; --foreground: #fafafa; --muted: #27272a; --muted-foreground: #a1a1aa; --ink2: #d4d4d8; --border: #27272a; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The scrollbar's room is kept even when a page is too short to scroll, so opening a row or a window never nudges the page sideways. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { background: var(--background); color: var(--foreground); font: 15px/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 4px; }

/* The menu: the same three places as on the film. */
.site-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: clamp(1rem, 3vw, 2rem); }
.site-nav .brand { font-weight: 500; font-size: 0.95rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.site-nav nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 1.75rem); font-size: 0.9rem; }
/* The light/dark switch (theme.js): a bare sun or moon to the right of Contact, on every screen. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin: -0.25rem; padding: 0; border: 0;
  border-radius: 6px; background: none; color: var(--muted-foreground); cursor: pointer; transition: color 0.15s; }
.theme-toggle:hover { color: var(--foreground); }
.nav-divider { width: 1px; height: 1rem; flex: none; background: var(--border); }
/* Bigger tap areas than the words: the name, each menu link and the switch answer a tap about 44px tall, with no change to how they look. */
.site-nav .brand, .site-nav nav a, .theme-toggle { position: relative; }
.site-nav .brand::before, .site-nav nav a::before, .theme-toggle::before { content: ""; position: absolute; inset: -0.85rem -0.25rem; }
.theme-toggle::before { inset: -0.7rem -0.4rem; }
.theme-toggle svg { width: 1rem; height: 1rem; }
@media print { .theme-toggle { display: none !important; } }
.site-nav nav a { color: var(--muted-foreground); text-decoration: none; }
.site-nav nav a:hover, .site-nav nav a[aria-current="page"] { color: var(--foreground); }
.site-nav nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--border); }
/* Four menu items and the switch: closer together and a touch smaller on a narrow phone, so they stay on one line with the name, and under the name on the narrowest. */
@media (max-width: 429px) { .site-nav nav { gap: 0.6rem; font-size: 0.8rem; } .site-nav .brand { font-size: 0.9rem; } .theme-toggle { margin: -0.25rem; } .nav-divider { margin: 0 -0.2rem 0 -0.1rem; } }
@media (max-width: 379px) { .site-nav nav { gap: 0.5rem; } }
@media (max-width: 359px) { .site-nav { flex-wrap: wrap; row-gap: 0.4rem; } }

main { max-width: 720px; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) 16px 5rem; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.lede { margin-top: 0.75rem; font-size: 1.05rem; color: var(--ink2); max-width: 36rem; }
.back { display: inline-block; margin-bottom: 1.25rem; font-size: 0.875rem; color: var(--muted-foreground); }
section { margin-top: 2.75rem; }
h2 { font-size: 1rem; font-weight: 600; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
section p { color: var(--ink2); }
.placeholder { color: var(--muted-foreground); font-style: italic; }

/* An entry: a role, a course or a project, with its place and dates on the right. */
.entry { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.entry:last-child { border-bottom: 0; }
.entry h3 { font-size: 0.95rem; font-weight: 600; }
.entry .when { font-size: 0.85rem; color: var(--muted-foreground); white-space: nowrap; }
.entry p { grid-column: 1 / -1; font-size: 0.9rem; }

footer { max-width: 720px; margin: 0 auto; padding: 0 16px 2.5rem; font-size: 0.8rem; color: var(--muted-foreground); }

/* Projects and Research: a name and a link to it, and what it is, opened under it. */
.project-list { list-style: none; border-top: 1px solid var(--border); margin-top: 2.5rem; }
.project-list li { border-bottom: 1px solid var(--border); scroll-margin-top: 1rem; }
.project-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.85rem 0; }
.project-name { font-weight: 500; }
.project-actions { display: flex; align-items: center; gap: 0.75rem; flex: none; }
/* Actions read as links, not buttons: a Lucide icon, then the words, underlined. No boxes. */
.text-link { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0; border: 0; background: none; color: var(--foreground);
  font: 500 0.875rem/1.4 var(--font-sans); text-decoration: none; cursor: pointer; width: fit-content; }
.text-link svg { width: 0.95rem; height: 0.95rem; flex: none; color: var(--muted-foreground); transition: color 0.15s, transform 0.2s; }
.text-link span { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 28%, transparent); text-underline-offset: 4px; transition: text-decoration-color 0.15s; }
.text-link:hover span { text-decoration-color: currentColor; }
.text-link:hover svg { color: var(--foreground); }
/* An action that is only an icon: the Lucide icon alone, no square around it. */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 0; background: none;
  color: var(--muted-foreground); cursor: pointer; text-decoration: none; transition: color 0.15s; }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.icon-btn:hover { color: var(--foreground); }
.text-link:disabled, .icon-btn:disabled { opacity: 0.35; cursor: default; }
.text-link:disabled span { text-decoration-color: color-mix(in srgb, currentColor 28%, transparent); }
.icon-btn:disabled { color: var(--muted-foreground); }
.project-list li.open .text-link[aria-expanded] svg { transform: rotate(180deg); }
/* Opening slides the text open rather than snapping it in. */
.project-info { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease; }
.project-info > div { overflow: hidden; }
.project-list li.open .project-info { grid-template-rows: 1fr; }
.project-info p { color: var(--ink2); font-size: 0.925rem; max-width: 36rem; padding: 0 0 1rem; }
@media (prefers-reduced-motion: reduce) { .project-info { transition: none; } }
/* A project's GitHub icon sits beside its name, so the actions on the right line up row by row. */
.name-line { display: inline-flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.name-icon { width: 1.5rem; height: 1.5rem; margin: -0.25rem 0; }
.name-icon svg { width: 1rem; height: 1rem; }
/* A project's status under its name. */
.project-status { display: block; margin-top: 0.15rem; font-weight: 400; font-size: 0.875rem; line-height: 1.45; color: var(--muted-foreground); }
.project-info p.info-action { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; padding-top: 0; }
.project-info .post-list { max-width: 36rem; margin-bottom: 1rem; font-size: 0.925rem; }
/* A project's posts: each title a link, with its date on the right, newest first. */
.post-list { list-style: none; }
.post-list li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0.15rem 1.25rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.post-list li:first-child { padding-top: 0.15rem; }
.post-list a { font-weight: 500; color: var(--foreground); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 28%, transparent); text-underline-offset: 4px; }
.post-list a:hover { text-decoration-color: currentColor; }
.post-list .post-meta { font-size: 0.85rem; color: var(--muted-foreground); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .post-list li { grid-template-columns: 1fr; } }
/* A project's latest post: a card with its picture, the whole card one link, so it stands out from the text around it. */
.post-card { display: grid; grid-template-columns: minmax(0, 15rem) 1fr; gap: 1.25rem; align-items: center; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--background); color: var(--foreground); text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s; }
.post-card:hover { border-color: color-mix(in srgb, var(--foreground) 28%, var(--border)); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); }
.post-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius); background: #0b1220; }
.post-card-body { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; min-width: 0; }
.post-card-meta { font-size: 0.8rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.post-card-title { font-size: 1.125rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
.post-card-sum { font-size: 0.9rem; line-height: 1.55; color: var(--ink2); }
.post-card-more { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.25rem; font-size: 0.875rem; font-weight: 500; }
.post-card-more span { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 28%, transparent); text-underline-offset: 4px; transition: text-decoration-color 0.15s; }
.post-card-more svg { width: 0.95rem; height: 0.95rem; color: var(--muted-foreground); transition: transform 0.2s, color 0.15s; }
.post-card:hover .post-card-more span { text-decoration-color: currentColor; }
.post-card:hover .post-card-more svg { color: var(--foreground); transform: translateX(2px); }
.post-card-compact { grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.6rem; max-width: 36rem; margin-bottom: 1rem; }
.post-card-compact .post-card-title { font-size: 0.975rem; }
.posts .post-card + .post-list { margin-top: 1rem; }
@media (max-width: 560px) {
  .post-card { grid-template-columns: 1fr; }
  .post-card-compact { grid-template-columns: 6.5rem 1fr; align-items: start; }
}
@media (prefers-reduced-motion: reduce) { .post-card-more svg { transition: none; } }
/* A project's title with its GitHub icon beside it. */
.title-row { display: flex; align-items: center; gap: 0.4rem 0.6rem; flex-wrap: wrap; }
.title-row .icon-btn { margin-top: 0.2rem; }
.project-about .article-body { margin-top: 0; }
.project-cta { margin-top: 1.5rem; }
/* A post's pictures: a dark one (the radar) sits edge to edge, without the white frame; the video is the width of the text. */
.fig-dark img, .fig-dialog.fig-dark img { padding: 0; background: #0b1220; }
.fig-video video { display: block; width: 100%; height: auto; background: #0b1220; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); }
.post-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
/* Research: a paper's subtitle under its title, run-in headings in its summary, and a quiet line about it. */
.paper-sub { display: block; margin-top: 0.1rem; font-weight: 400; font-size: 0.875rem; line-height: 1.45; color: var(--muted-foreground); }
.project-info p strong { font-weight: 500; color: var(--foreground); }
.after-list { margin-top: 1.75rem; font-size: 0.925rem; color: var(--ink2); max-width: 36rem; }
.after-list .text-link { margin-top: 0.5rem; }

/* A paper's own page (/research/<paper>/): its title, the link to the PDF, a line of facts about it,
   a write-up to read, and how to cite it. */
.article .back { display: inline-flex; align-items: center; gap: 0.3rem; text-decoration: none; }
.article .back svg { width: 0.95rem; height: 0.95rem; }
.article .back:hover { color: var(--foreground); }
.kicker { font-size: 0.8rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: 0.75rem; }
.article h1 { font-size: clamp(1.75rem, 4.6vw, 2.4rem); text-wrap: balance; }
.article-sub { margin-top: 0.6rem; font-size: clamp(1.05rem, 2.6vw, 1.25rem); line-height: 1.4; color: var(--ink2); text-wrap: balance; }
.article .read { margin-top: 1.4rem; font-size: 0.95rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.5rem; margin: 2rem 0 0; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.facts dt { color: var(--muted-foreground); }
.facts dd { color: var(--foreground); min-width: 0; overflow-wrap: anywhere; }
/* A link to code in a page's facts: the GitHub icon, then the repository's name. */
.facts .code-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.facts .code-link svg { width: 0.95rem; height: 0.95rem; flex: none; color: var(--muted-foreground); }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; gap: 0.1rem; } .facts dd + dt { margin-top: 0.55rem; } }
.article-body { margin-top: 2.25rem; font-size: 1.0625rem; line-height: 1.7; color: var(--ink2); }
.article-body > p + p, .article-body > ul + p, .article-body > p + ul { margin-top: 1.1rem; }
.article-body > p:first-child { font-size: 1.15rem; line-height: 1.6; color: var(--foreground); }
.article-body h2 { margin: 2.6rem 0 0.75rem; padding: 0; border: 0; font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.3; color: var(--foreground); }
.article-body ul { padding-left: 1.25rem; }
.article-body li + li { margin-top: 0.5rem; }
.article-body li::marker { color: var(--muted-foreground); }
.article-body strong { font-weight: 600; color: var(--foreground); }
.article-body a { text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.article-body a:hover { text-decoration-color: currentColor; }
/* A figure from the paper, on white in both themes, as it was drawn. */
.fig { margin: 1.75rem 0; }
.fig img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); padding: 0.75rem; }
.fig figcaption { margin-top: 0.6rem; font-size: 0.85rem; line-height: 1.5; color: var(--muted-foreground); }
/* How to cite it, and where the files are. */
.article .after { margin-top: 3.25rem; }
.article .after h2 { margin-bottom: 0.9rem; }
.article .after p { font-size: 0.925rem; color: var(--ink2); }
.article .after p + p { margin-top: 0.75rem; }
.cite-tools { display: flex; align-items: center; gap: 1.25rem; }
.cite-text { margin-top: 0.25rem; padding: 0.9rem 1rem; background: var(--muted); border-radius: calc(var(--radius) - 2px); color: var(--foreground); }
.article .after p.cite-text { margin-top: 0.25rem; font-size: 0.9rem; line-height: 1.65; color: var(--foreground); overflow-wrap: anywhere; }
.cite-text a { text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.bibtex { overflow-x: auto; font: 0.8rem/1.6 ui-monospace, 'Geist Mono', SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2; }
.cite-text[hidden] { display: none; }
.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; }
/* The format list: shadcn's Select without React, as on the CV's flight map. A link-style trigger opens a popover list. */
.pick { position: relative; }
.pick-trigger { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0 0.1rem; border: 0; border-bottom: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  background: none; color: var(--foreground); font: 500 0.875rem/1.4 var(--font-sans); cursor: pointer; }
.pick-trigger svg { width: 0.85rem; height: 0.85rem; flex: none; color: var(--muted-foreground); }
.pick-trigger:hover, .pick-trigger[aria-expanded="true"] { border-bottom-color: currentColor; }
.pick-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 9rem; padding: 4px; background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); animation: pick-pop 0.12s ease-out; }
@keyframes pick-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .pick-pop { animation: none; } }
.pick-list { list-style: none; outline: none; }
.pick-list:focus-visible { box-shadow: none; }
.pick-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.5rem; border-radius: calc(var(--radius) - 4px); font-size: 0.875rem; cursor: pointer; user-select: none; }
.pick-list li[data-active] { background: var(--muted); }
.pick-list li svg { width: 1rem; height: 1rem; flex: none; visibility: hidden; }
.pick-list li[aria-selected="true"] svg { visibility: visible; }
.cite-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.cite-head h2 { border: 0; padding: 0; margin: 0; }
/* Pointing at a picture shows the zoom cursor; open, it's the normal one, with the window's own close and download. */
.fig a, .fig a img { cursor: -webkit-zoom-in; cursor: zoom-in; }
.fig a { display: block; position: relative; border-radius: calc(var(--radius) + 2px); }
/* A small expand badge (Lucide maximize-2) in the picture's corner says it opens full size: it fades in on hover or keyboard focus,
   and stays shown on touch screens, which have no hover. */
.fig a::after { content: ""; position: absolute; top: 1.15rem; right: 1.15rem; width: 1.9rem; height: 1.9rem; border-radius: 999px; pointer-events: none;
  background: rgba(9, 9, 11, 0.62) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cpolyline points='9 21 3 21 3 15'/%3E%3Cline x1='21' x2='14' y1='3' y2='10'/%3E%3Cline x1='3' x2='10' y1='21' y2='14'/%3E%3C/svg%3E") center / 0.95rem no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); opacity: 0; transform: scale(0.9); transition: opacity 0.15s, transform 0.15s; }
.fig-dark a::after { top: 0.75rem; right: 0.75rem; }
.fig a:hover::after, .fig a:focus-visible::after { opacity: 1; transform: none; }
.fig a img { transition: border-color 0.15s, box-shadow 0.15s; }
.fig a:hover img { border-color: color-mix(in srgb, var(--foreground) 22%, var(--border)); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); }
@media (hover: none) {
  .fig a::after { top: 0.45rem; right: 0.45rem; width: 1.5rem; height: 1.5rem; background-size: 0.75rem; opacity: 0.85; transform: none; }
  .fig-dark a::after { top: 0.4rem; right: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) { .fig a::after, .fig a img { transition: none; } }
.fig-dialog, .fig-dialog img { cursor: default; }
/* The figure full size, in a window over the page (research/figure.js), with download and close icons. */
dialog.fig-dialog { margin: auto; width: fit-content; max-width: min(1200px, calc(100% - 2rem)); max-height: calc(100svh - 2rem); overscroll-behavior: contain;
  padding: 1.25rem 1.5rem 1.5rem; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  background: var(--background); color: var(--foreground); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
dialog.fig-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.fig-dialog[open] { animation: fig-rise 0.2s ease-out; }
@keyframes fig-rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { dialog.fig-dialog[open] { animation: none; } }
:root:has(dialog.fig-dialog[open]), :root:has(dialog.fig-dialog[open]) body { overflow: hidden; }
.fig-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0 -0.4rem 0.75rem 0; }
.fig-dialog-title { min-width: 0; font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fig-dialog-actions { display: flex; align-items: center; gap: 0.25rem; flex: none; }
.fig-dialog img { display: block; max-width: 100%; max-height: calc(100svh - 12rem); width: auto; height: auto; margin: 0 auto;
  background: #fff; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); padding: 0.75rem; }
.fig-dialog-cap { max-width: 46rem; margin-top: 0.75rem; font-size: 0.85rem; line-height: 1.5; color: var(--muted-foreground); }
@media (max-width: 560px) {
  dialog.fig-dialog { max-width: calc(100% - 1rem); padding: 1rem; }
  .fig-dialog img { padding: 0.4rem; }
}
/* A phone on its side: the figure gets the height, and the caption stays on the page. */
@media (max-height: 500px) {
  dialog.fig-dialog { max-height: calc(100svh - 1rem); padding: 0.6rem 1rem 1rem; }
  .fig-dialog-head { margin-bottom: 0.4rem; }
  .fig-dialog img { max-height: calc(100svh - 5.5rem); padding: 0.4rem; }
  .fig-dialog-cap { display: none; }
}
