.header-tools {
  display: flex;
  align-items: center;
  gap: 24px;
}

.theme-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--black) 72%, transparent);
}

.theme-switch button {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: 11px/1 Inter, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.theme-icon {
  display: none;
}

.research-page .theme-switch button[aria-pressed="true"],
.publications-page .theme-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--black);
}

.imaging-page .theme-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--black);
}

.theme-switch button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

html[data-theme="light"] {
  color-scheme: light;
  background: #f3f6fa;
}

html[data-theme="light"] body.research-page,
html[data-theme="light"] body.publications-page {
  --black: #f3f6fa;
  --panel: rgba(250, 252, 254, 0.86);
  --text: #142033;
  --muted: #52627a;
  --line: rgba(42, 67, 99, 0.22);
  --blue: #245eaa;
  --cyan: #007b84;
  --amber: #9c6000;
  background:
    linear-gradient(rgba(246, 249, 252, 0.9), rgba(238, 243, 248, 0.92)),
    #f3f6fa url("ppt-background.png") center center / cover fixed no-repeat;
}

html[data-theme="light"] body.research-page::before,
html[data-theme="light"] body.publications-page::before {
  background-image:
    repeating-linear-gradient(0deg, rgba(42, 67, 99, 0.08) 0, rgba(42, 67, 99, 0.08) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, rgba(42, 67, 99, 0.08) 0, rgba(42, 67, 99, 0.08) 1px, transparent 1px, transparent 40px);
  opacity: 0.6;
}

html[data-theme="light"] body.research-page .site-header,
html[data-theme="light"] body.publications-page .site-header,
html[data-theme="light"] body.imaging-page .site-header {
  border-bottom-color: rgba(42, 67, 99, 0.18);
  background: rgba(248, 250, 252, 0.8);
}

html[data-theme="light"] body.research-page .scroll-progress,
html[data-theme="light"] body.publications-page .scroll-progress {
  background: rgba(42, 67, 99, 0.1);
}

html[data-theme="light"] body.research-page .field-key {
  color: rgba(20, 32, 51, 0.62);
}

html[data-theme="light"] body.research-page .research-band {
  background: rgba(250, 252, 254, 0.88);
}

html[data-theme="light"] body.research-page .methods {
  background: rgba(240, 245, 250, 0.78);
}

html[data-theme="light"] body.research-page .research-footer {
  background: rgba(247, 250, 253, 0.92);
}

html[data-theme="light"] body.research-page .research-row::before,
html[data-theme="light"] body.research-page .method-link:hover,
html[data-theme="light"] body.research-page .method-link:focus-visible {
  background: rgba(36, 94, 170, 0.07);
}

html[data-theme="light"] body.publications-page .publication-list {
  background: rgba(248, 251, 253, 0.92);
}

html[data-theme="light"] body.publications-page .publication-entry:nth-child(even) {
  background: rgba(36, 94, 170, 0.025);
}

html[data-theme="light"] body.publications-page .publication-entry--upcoming {
  background: rgba(0, 123, 132, 0.045);
}

html[data-theme="light"] body.publications-page .publication-media a {
  background: rgba(225, 232, 240, 0.58);
}

html[data-theme="light"] body.publications-page .publication-media figcaption {
  color: rgba(20, 32, 51, 0.56);
}

html[data-theme="light"] body.publications-page .publication-footer {
  background: rgba(238, 243, 248, 0.96);
}

html[data-theme="light"] body.imaging-page {
  --black: #f4f6f8;
  --ink: #18222f;
  --muted: #5d6978;
  --line: rgba(35, 53, 74, 0.22);
  --cyan: #087d87;
  --yellow: #a47e00;
  --orange: #b94e20;
  background: #f4f6f8;
}

html[data-theme="light"] body.imaging-page .stories,
html[data-theme="light"] body.imaging-page .archive {
  background: #edf1f5;
}

html[data-theme="light"] body.imaging-page .story {
  border-color: rgba(35, 53, 74, 0.25);
  background: #dfe5eb;
  color: #f5f7f9;
}

html[data-theme="light"] body.imaging-page .story.is-active {
  border-color: rgba(35, 53, 74, 0.52);
}

html[data-theme="light"] body.imaging-page .story-copy > span:last-child,
html[data-theme="light"] body.imaging-page .archive-item-copy span {
  color: rgba(245, 247, 249, 0.76);
}

html[data-theme="light"] body.imaging-page .story-progress {
  background: rgba(35, 53, 74, 0.16);
}

html[data-theme="light"] body.imaging-page .archive-item {
  border-color: rgba(35, 53, 74, 0.2);
  background: #dfe5eb;
  color: #f5f7f9;
}

html[data-theme="light"] body.imaging-page .closing {
  background: #ffffff;
  color: #101820;
}

html[data-theme="light"] body.imaging-page .hero h1,
html[data-theme="light"] body.imaging-page .hero-summary,
html[data-theme="light"] body.imaging-page .hero-next {
  color: #f5f7f9;
}

html[data-theme="light"] body.imaging-page .hero .eyebrow {
  color: #75e7ef;
}

html[data-theme="light"] body.imaging-page .hero-next {
  border-color: rgba(255, 255, 255, 0.55);
}

html[data-theme="light"] body.imaging-page .hero-next:hover,
html[data-theme="light"] body.imaging-page .hero-next:focus-visible {
  background: #f5f7f9;
  color: #101820;
}

html[data-theme="light"] body.imaging-page .lightbox {
  color: #f5f7f9;
}

html[data-theme="light"] body.imaging-page .lightbox-close,
html[data-theme="light"] body.imaging-page .lightbox-arrow {
  border-color: rgba(255, 255, 255, 0.35);
  color: #f5f7f9;
}

html[data-theme="light"] body.imaging-page .lightbox-copy #lightbox-description {
  color: rgba(245, 247, 249, 0.76);
}

@media (max-width: 820px) {
  .header-tools {
    gap: 10px;
  }

  .mode-nav {
    gap: 13px;
  }

  .theme-switch button {
    min-height: 26px;
    padding: 0 6px;
    font-size: 10px;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding-right: 30px;
  }

  .theme-switch button {
    width: 28px;
    padding: 0;
    font-size: 13px;
  }

  .theme-icon {
    display: inline;
  }

  .theme-label {
    display: none;
  }
}

@media (max-width: 380px) {
  .site-header {
    padding-right: 26px;
    padding-left: 12px;
  }

  .brand {
    font-size: 13px;
  }

  .mode-nav a {
    font-size: 12px;
  }
}
