:root {
  color-scheme: dark;
  --ink: #f3f5f7;
  --muted: #d3dce2;
  --accent: #b7dfea;
  --line: #56636c;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 9rem; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #101820 url("../../images/mice_galaxies_2.png") center / cover fixed no-repeat;
  color: var(--ink);
  font: 1.05rem/1.7 system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.khi-background {
  background-image: linear-gradient(rgba(16, 24, 32, 0.5), rgba(16, 24, 32, 0.5)), url("../../images/khi_stone_rotated.jpg");
}

body.alma-background { background-image: url("../../images/dsharp_alma.png"); }
body.dust-background {
  background-image: linear-gradient(rgba(16, 24, 32, 0.5), rgba(16, 24, 32, 0.5)), url("../../images/research_background.png");
  background-position: center top;
  background-attachment: fixed;
}
body.khi-background, body.alma-background, body.dust-background { background-size: 100% auto; }

a { color: #b7e5f4; text-underline-offset: 0.18em; }
a:hover { color: #fff; }
a:focus-visible, summary:focus-visible { outline: 3px solid #ffd080; outline-offset: 4px; }

.skip-link {
  position: absolute;
  top: -10rem;
  left: 1rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: white;
  color: #17283b;
}
.skip-link:hover { color: #17283b; }
.skip-link:focus { top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: #17212b; }
.header-inner, .footer-inner {
  max-width: 72rem;
  margin: auto;
  padding: 1.1rem 2rem;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.site-name { color: var(--ink); font-weight: 750; font-size: 1.15rem; text-decoration: none; }
nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; margin: 0; padding: 0; }
nav a { color: var(--ink); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }

.page-content { flex: 1 0 auto; width: 100%; padding: 4rem max(2rem, calc(50% - 34rem)) 6rem; background: rgba(25, 30, 35, 0.9); }
.page-content > p, .page-content > ul, .page-content > details { max-width: 52rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.025em; }
h1 { margin: 0 0 1.2rem; font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { margin: 2.8rem 0 1rem; font-size: clamp(1.7rem, 3vw, 2.2rem); }
h3 { max-width: 52rem; margin: 2.2rem 0 0.6rem; font-size: 1.25rem; }
p { margin: 0 0 1.25rem; }
.eyebrow { margin-bottom: 0.8rem; color: var(--accent); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.eyebrow.section-title { font-size: 1.56rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 23rem); align-items: center; gap: clamp(2rem, 6vw, 6rem); }
.hero h1 { font-size: clamp(3rem, 7vw, 5.5rem); }
.hero-subtitle { color: var(--muted); font-weight: 600; }
.lead { max-width: 35rem; font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.5; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem; }
.button { display: inline-block; padding: 0.7rem 1.1rem; border-radius: 0.3rem; background: #165f78; color: white; font-weight: 700; text-decoration: none; }
.button:hover { background: #003e54; color: white; }
img { display: block; max-width: 100%; height: auto; }
.portrait, figure img { border-radius: 0.4rem; }
.portrait { width: 100%; }
.intro-section { max-width: 52rem; margin-top: 5rem; }
.intro-section h2 { margin-top: 0; }

details { padding: 0.9rem 1.1rem; border-left: 3px solid #a4c4ca; background: rgba(43, 53, 61, 0.95); }
.page-content > details + details { margin-top: 1rem; }
summary { color: #b7e5f4; cursor: pointer; font-weight: 700; }
summary h3 { display: inline; }
details[open] summary { margin-bottom: 1rem; }
details p:last-child { margin-bottom: 0; }
figure { max-width: 40rem; margin: 2rem 0; }
figcaption { margin-top: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.site-footer { border-top: 1px solid var(--line); background: #17212b; color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 2rem; }
.footer-inner p { margin: 0; }
.background-credit { font-size: 8pt; }

@media (max-width: 42rem) {
  .header-inner, .footer-inner { padding: 1rem 1.25rem; }
  .page-content { padding: 2.5rem 1.25rem 4rem; }
  .hero { grid-template-columns: 1fr; }
  .portrait { max-width: 24rem; }
  .intro-section { margin-top: 3rem; }
}

/* Interactive disk visual */
.disk-viz { margin: 2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(16, 24, 32, 0.8); }
.dv-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.dv-tabs button { font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 0.2rem 0.8rem; cursor: pointer; }
.dv-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.dv-controls { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; border: 0; margin: 0 0 0.75rem; padding: 0; }
.dv-controls legend { font-weight: 600; padding: 0; margin-bottom: 0.3rem; }
.dv-controls label { cursor: pointer; }
.dv-stage { display: flex; gap: 1rem; align-items: stretch; }
.dv-canvas { flex: 1; min-width: 0; aspect-ratio: 4 / 3; cursor: grab; }
.dv-colorbar { display: grid; grid-template-columns: 1rem 1.5rem; grid-template-rows: 1fr auto; column-gap: 0.3rem; font-size: 0.8rem; min-width: 7rem; }
.dv-bar { border: 1px solid var(--line); }
.dv-ticks { position: relative; }
.dv-ticks span { position: absolute; transform: translateY(-50%); line-height: 1; }
.dv-barlabel { grid-column: 1 / -1; line-height: 1.2; margin-top: 0.3rem; }
.dv-caption { font-size: 0.85rem; color: var(--muted); margin: 0.75rem 0 0; }
