/* Layout: one calm reading column, research themes as wide figure + text rows that alternate sides. */
:root {
  --paper: #fbfaf6;        /* warm white page */
  --paper-2: #f3f1ea;      /* figure wells, quiet bands */
  --ink: #16233f;          /* dark navy text */
  --ink-soft: #4a5672;     /* secondary text */
  --rule: #dcd8cc;         /* hairlines */
  --accent: #2f6d86;       /* restrained blue-teal accent (links, labels) */
  --accent-ink: #ffffff;
  --status: #8a5a14;       /* "in preparation" / "submitted" marker */
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --measure: 66ch;
  --wide: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10172a; --paper-2: #18213a; --ink: #e9ecf3; --ink-soft: #aab3c8;
    --rule: #2c3753; --accent: #7fbdd6; --accent-ink: #0d1424; --status: #e0b25e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10172a; --paper-2: #18213a; --ink: #e9ecf3; --ink-soft: #aab3c8;
  --rule: #2c3753; --accent: #7fbdd6; --accent-ink: #0d1424; --status: #e0b25e;
  color-scheme: dark;
}

* { 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: 1.0625rem; line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: var(--wide); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.75rem 2rem; padding-block: 1.25rem; }
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand small { display: block; font-family: var(--sans); font-size: 0.8125rem; font-weight: 400; color: var(--ink-soft); }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; }
.nav a { color: var(--ink-soft); text-decoration: none; padding-block: 0.25rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--accent); }

/* Page intro */
.page-intro { padding-block: 4rem 2.5rem; }
.eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.75rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.25rem, 4.5vw, 3.25rem); letter-spacing: -0.01em; }
.lede { max-width: var(--measure); font-size: 1.1875rem; color: var(--ink-soft); margin: 1.25rem 0 0; }

/* Theme index */
.theme-index { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 1.25rem 0 0; margin: 2rem 0 0; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.theme-index a { display: inline-block; padding: 0.5rem 1rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 600; transition: background-color .15s, color .15s, border-color .15s; }
.theme-index a:hover, .theme-index a:focus-visible { background: var(--ink); color: var(--paper); }

/* Theme sections */
.theme { padding-block: 4rem; border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
.theme-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem 3.5rem; align-items: start; }
.theme:nth-of-type(even) .theme-figure { order: 2; }
.theme-text { min-width: 0; }
.theme h2 { font-size: clamp(1.625rem, 3vw, 2.125rem); }
.theme .intro { max-width: var(--measure); margin: 1rem 0 0; }

.theme-figure { margin: 0; min-width: 0; }
.fig-frame {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px;
  aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center; overflow: hidden;
}
.fig-frame img { width: 100%; height: 100%; object-fit: contain; background: #ffffff; }
.fig-missing { padding: 1.5rem; text-align: center; font-size: 0.875rem; color: var(--ink-soft); }
.fig-missing strong { display: block; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--status); margin-bottom: 0.5rem; }
.theme-figure figcaption { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.625rem; line-height: 1.5; }

/* Featured papers */
.papers-label { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 2rem 0 0.25rem; }
.papers { list-style: none; margin: 0; padding: 0; }
.paper { padding-block: 0.875rem; border-bottom: 1px solid var(--rule); }
.paper:last-child { border-bottom: 0; }
.paper-stage { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.25rem; }
.paper-title { font-family: var(--serif); font-size: 1.0625rem; font-weight: 600; line-height: 1.35; margin: 0; }
.paper-title a { color: var(--ink); text-decoration: none; }
.paper-title a:hover { color: var(--accent); text-decoration: underline; }
.paper-ref { font-size: 0.875rem; color: var(--ink-soft); margin: 0.25rem 0 0; }
.paper-ref a { white-space: nowrap; }
.tag { display: inline-block; font-size: 0.75rem; line-height: 1.4; padding: 0.05rem 0.45rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-soft); margin-left: 0.25rem; vertical-align: 0.05em; }
.tag.status { border-color: var(--status); color: var(--status); }

.explore { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1.5rem; font-weight: 600; text-decoration: none; }
.explore:hover { text-decoration: underline; }
.explore[aria-disabled="true"] { color: var(--ink-soft); cursor: default; text-decoration: none; }
.explore .soon { font-weight: 400; font-size: 0.8125rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 2rem; }
.site-footer .wrap { padding-block: 2rem 3rem; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; font-size: 0.875rem; color: var(--ink-soft); }

@media (max-width: 820px) {
  .theme-grid { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .theme:nth-of-type(even) .theme-figure { order: 0; }
  .page-intro { padding-block: 2.5rem 1.5rem; }
  .theme { padding-block: 3rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- Publications page ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.chip { font: inherit; font-size: 0.875rem; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; color: var(--ink-soft); margin-left: auto; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.count { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); margin: 1rem 0 0; }
.pub-section { padding-block: 2.5rem 0.5rem; }
.pub-section > h2 { font-size: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.year { font-family: var(--mono); font-size: 0.8125rem; color: var(--accent); letter-spacing: 0.06em; margin: 1.75rem 0 0; }
.pub-list { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.pub { padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.pub-title { font-family: var(--serif); font-weight: 600; font-size: 1.0625rem; line-height: 1.35; margin: 0; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { font-size: 0.9375rem; margin: 0.3rem 0 0; color: var(--ink-soft); }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: center; font-size: 0.875rem; color: var(--ink-soft); margin: 0.3rem 0 0; }
.pub-meta a { white-space: nowrap; }
.tag.lead { border-color: var(--accent); color: var(--accent); margin-left: 0; }
.tag.theme { margin-left: 0; }
.pub details { margin-top: 0.6rem; }
.pub summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--accent); }
.pub-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.25rem; margin-top: 0.75rem; }
.pub-body p { margin: 0 0 0.75rem; font-size: 0.9375rem; }
.pub-body .fig-frame { aspect-ratio: 4 / 3; }
.pub-body figcaption { font-size: 0.75rem; color: var(--ink-soft); margin-top: 0.4rem; line-height: 1.45; }
.pub-body figure { margin: 0; min-width: 0; }
.pub-body .text { min-width: 0; }
.other-block { max-width: 860px; border-top: 1px solid var(--rule); padding-block: 0.75rem; }
.other-block > summary { cursor: pointer; font-family: var(--serif); font-weight: 600; font-size: 1.125rem; }
.other-block .pub { padding-block: 0.6rem; }
.other-block .pub-title { font-size: 0.9375rem; }
.empty { color: var(--ink-soft); font-style: italic; }
@media (max-width: 700px) { .pub-body { grid-template-columns: minmax(0, 1fr); } .toggle { margin-left: 0; } }
.record { max-width: 640px; margin-top: 1.5rem; padding: 1.25rem 1.5rem; background: transparent; border: 1px solid var(--rule); border-top: 3px solid var(--ink); border-radius: 0; }
.record h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.record p { margin: 0.5rem 0 0; font-size: 0.9375rem; }
.record-table { margin: 1rem 0 0; display: grid; gap: 0.35rem; }
.record-table > div { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 1rem; padding-block: 0.3rem; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); font-size: 0.9375rem; }
.record-table > div:last-child { border-bottom: 0; }
.record-table dt { color: var(--ink); }
.record-table dd strong, .record-metrics strong { color: var(--ink); font-weight: 600; }
.record-table dd { margin: 0; font-variant-numeric: tabular-nums; }
.record-metrics { font-size: 1rem !important; }
.muted { color: var(--ink-soft); font-size: 0.875rem; }
@media (max-width: 500px) { .record-table > div { grid-template-columns: minmax(0, 1fr); gap: 0; } .record { padding: 1.25rem; } }
.theme-note { margin: 1rem 0 0; font-size: 0.9375rem; }
.filters .toggle { margin-left: 0; }
.pub-body.single { grid-template-columns: minmax(0, 1fr); max-width: 72ch; }

/* ---------- Home page ---------- */
.hero { padding-block: 4rem 3rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2.5rem 4rem; align-items: start; }
.hero .lede { margin-top: 1.25rem; }
.body-text { max-width: var(--measure); margin: 1rem 0 0; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 2rem; }
.button { display: inline-block; background: var(--ink); color: var(--paper); padding: 0.55rem 1.1rem; border-radius: 3px; text-decoration: none; font-weight: 600; }
.button:hover { background: var(--accent); }
.portrait { margin: 0; }
.portrait-frame { aspect-ratio: 4 / 5; }
.home-band { border-top: 1px solid var(--rule); padding-block: 3rem; }
.home-band h2 { font-size: 1.625rem; }
.theme-cards { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.theme-cards a { display: block; height: 100%; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-top: 3px solid var(--accent); text-decoration: none; color: var(--ink); }
.theme-cards a:hover { border-color: var(--accent); }
.theme-cards strong { display: block; font-family: var(--serif); font-size: 1.0625rem; line-height: 1.3; }
.theme-cards span { display: block; margin-top: 0.4rem; font-size: 0.9375rem; color: var(--ink-soft); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.5rem 3rem; }
.contact-grid p { margin: 0.75rem 0 0; color: var(--ink-soft); }
.contact-list { margin: 0; display: grid; gap: 1rem; }
.contact-list > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; }
.contact-list dt { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding-top: 0.2rem; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .hero-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 280px; order: -1; }
  .hero { padding-block: 2.5rem 2rem; }
}
@media (max-width: 500px) { .contact-list > div { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; } }

/* ---------- CV page ---------- */
.cv-download { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.5rem; }
.button.disabled { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--rule); cursor: default; }
.cv { max-width: 900px; }
.cv-section { padding-block: 2.25rem 0.5rem; scroll-margin-top: 1rem; }
.cv-section > h2 { font-size: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.cv-list { list-style: none; margin: 0; padding: 0; }
.cv-list li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.25rem; padding-block: 0.7rem; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); font-size: 0.9875rem; }
.cv-when { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-soft); padding-top: 0.15rem; font-variant-numeric: tabular-nums; }
.cv-what strong { font-weight: 600; }
.cv-section .muted { margin-top: 1rem; }
@media (max-width: 560px) { .cv-list li { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; } }
.portrait-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 4px; }
.theme-art { display: block; width: 100%; height: auto; aspect-ratio: 208 / 112; margin-bottom: 0.85rem; background: var(--paper-2); border-radius: 3px; }
.theme-cards a:hover .theme-art { outline: 1px solid var(--accent); }
/* Real figures: show the whole image at its natural shape, never cropped */
.fig-frame:has(> img) { aspect-ratio: auto; display: block; background: #ffffff; padding: 0.5rem; }
.fig-frame > img { width: 100%; height: auto; max-height: 560px; object-fit: contain; }
.pub-body .fig-frame:has(> img) { aspect-ratio: auto; }
.pub-body .fig-frame > img { max-height: 440px; }
.cv-sub { display: grid; grid-template-columns: 4.25em minmax(0, 1fr); margin-top: 0.3rem; color: var(--ink-soft); font-size: 0.9375rem; }
.cv-sub + .cv-sub { margin-top: 0; }
.section-intro { color: var(--ink-soft); max-width: var(--measure); margin: 0.75rem 0 1rem; }
.section-intro:empty { display: none; }
.gallery { display: grid; gap: 1.5rem; margin: 1rem 0 1.5rem; }
.photo-row-fig { margin: 0; }
.photo-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.photo-row img { min-width: 0; width: 100%; height: auto; border-radius: 4px; background: var(--paper-2); }
.photo-row-fig figcaption { font-size: 0.875rem; color: var(--ink-soft); margin-top: 0.5rem; line-height: 1.5; contain: inline-size; }
.photo-row-fig:has(img:only-child) { width: fit-content; max-width: 100%; }
@media (max-width: 560px) { .photo-row { flex-wrap: wrap; } .photo-row img { flex-basis: 100% !important; } }
.photo-row img:only-child { flex: 0 1 auto !important; width: auto; max-width: 100%; max-height: 460px; }

.contact-grid > div .contact-list { margin-top: 1.5rem; }
.contact-form { display: grid; gap: 1rem; align-content: start; }
.contact-form label { display: grid; gap: 0.35rem; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.contact-form input, .contact-form textarea { font: inherit; font-family: var(--sans, inherit); font-size: 1rem; letter-spacing: normal; text-transform: none; color: var(--ink); background: var(--paper, #fff); border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.75rem; width: 100%; box-sizing: border-box; }
.contact-form textarea { resize: vertical; min-height: 8rem; }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.contact-form button { justify-self: start; cursor: pointer; border: 0; font: inherit; }
.contact-form button:disabled { opacity: 0.6; cursor: wait; }
.contact-form .hp { display: none; }
.form-status { margin: 0; color: var(--ink-soft); min-height: 1.5em; }

/* Research page: telescopes across the spectrum */
.observatories { border-top: 1px solid var(--rule); padding-block: 3rem; }
.observatories h2 { font-size: clamp(1.5rem, 2.6vw, 1.875rem); }
.obs-intro { max-width: var(--measure); color: var(--ink-soft); margin: 0.75rem 0 1.5rem; }
.spectrum-bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #8a3b2c 0%, #c8642f 22%, #d9a43a 45%, #6f63c4 70%, #2f6d86 100%); }
.spectrum-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; margin-top: 0.4rem; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }
.spectrum-scale span { text-align: center; }
.band-wl { display: none; }
.bands { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.band h3 { font-family: var(--mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 0.5rem; }
.band ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.band a { color: var(--ink); text-decoration: none; font-size: 0.9375rem; }
.band a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 820px) { .bands { grid-template-columns: repeat(2, minmax(0, 1fr)); } .spectrum-bar, .spectrum-scale { display: none; } .band-wl { display: block; margin-top: 0.15rem; text-transform: none; letter-spacing: 0; } .band { border-left: 3px solid var(--rule); padding-left: 0.75rem; } .band-radio { border-color: #8a3b2c; } .band-ir { border-color: #c8642f; } .band-opt { border-color: #d9a43a; } .band-uv { border-color: #6f63c4; } .band-xray { border-color: #2f6d86; } }
.band-img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 4px; margin-bottom: 0.75rem; background: var(--paper-2); }
.band-img-missing { display: grid; place-items: center; font-size: 0.75rem; color: var(--ink-soft); border: 1px dashed var(--rule); text-align: center; padding: 0.5rem; }
.obs-credit { font-size: 0.8125rem; color: var(--ink-soft); margin: 1.25rem 0 0; }
.themes-head { border-top: 1px solid var(--rule); padding-block: 3rem 0; }
.themes-head h2 { font-size: clamp(1.5rem, 2.6vw, 1.875rem); }
.themes-head .obs-intro { margin-bottom: 0; }
.themes-head + .theme { border-top: 0; padding-top: 2.5rem; }
/* Section headings above theme titles */
.observatories h2, .themes-head h2 { font-size: clamp(1.875rem, 3.6vw, 2.5rem); }
.theme h2 { font-size: clamp(1.375rem, 2.4vw, 1.75rem); }
/* Publications: figure mosaic and per-paper thumbnails */
.pub-intro-grid { display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); gap: 2rem; align-items: start; margin-top: 1.5rem; }
.pub-intro-grid .record { margin-top: 0; }
.pub-mosaic { margin: 0; }
.mosaic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.mosaic-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 0.35rem; }
.pub-mosaic figcaption { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.5rem; line-height: 1.5; }
.pub.has-thumb { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 0 1.25rem; align-items: start; }
.pub.has-thumb .pub-main { min-width: 0; }
.pub-thumb { width: 120px; height: 90px; object-fit: contain; background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 3px; cursor: pointer; }
.pub-thumb:hover { border-color: var(--accent); }
@media (max-width: 900px) { .pub-intro-grid { grid-template-columns: minmax(0, 1fr); } .pub-mosaic { max-width: 520px; } }
@media (max-width: 560px) { .pub.has-thumb { grid-template-columns: minmax(0, 1fr) 72px; gap: 0 0.75rem; } .pub-thumb { width: 72px; height: 56px; } }
