:root {
  --bg-0: #f3f7f6;
  --bg-1: #fefcf7;
  --ink: #1f2426;
  --ink-soft: #5d676b;
  --line: #d3ddd8;
  --accent: #0a7b63;
  --accent-2: #f4a259;
  --panel: #ffffffcc;
  --shadow: 0 10px 30px rgba(20, 36, 34, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  color: var(--ink);
  background: linear-gradient(130deg, var(--bg-0), var(--bg-1));
  line-height: 1.6;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.background-caption {
  position: fixed;
  right: 1.5rem;
  bottom: 0.75rem;
  z-index: 2;
  color: #686868;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

.page-bg::before,
.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 220ms ease;
}

body.is-home .page-bg.has-page-bg::before { opacity: 1; }
body.is-home .page-bg::after { opacity: 0; }

.page-bg::before {
  background-image: var(--page-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
}

.page-bg.has-page-bg::before {
  opacity: 0.78;
}

.page-bg::after {
  background:
    linear-gradient(130deg, rgba(243, 247, 246, 0.45), rgba(254, 252, 247, 0.35)),
    radial-gradient(circle at 10% 15%, rgba(10, 123, 99, 0.08), transparent 35%),
    radial-gradient(circle at 80% 35%, rgba(244, 162, 89, 0.1), transparent 45%);
}

.container {
  width: min(1680px, calc(100% - 3rem));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-header {
  position: relative;
  z-index: 30;
  border: 0;
  background: transparent;
}

.header-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.eyebrow {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.site-header .menu-toggle {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 32;
  display: block;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 700;
  box-shadow: var(--shadow);
}

#site-nav.site-menu {
  display: none;
  position: fixed;
  top: 4.75rem;
  right: 1.5rem;
  z-index: 31;
  width: min(1100px, calc(100vw - 3rem));
  max-height: calc(100dvh - 6rem);
  overflow-y: auto;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}
#site-nav.site-menu.open:not([hidden]) { display: block; }
#site-nav > .nav-list { align-items: start; }
.site-header :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

@media (max-width: 600px) {
  .site-header .menu-toggle { right: 1rem; }
  #site-nav.site-menu { right: 1rem; width: calc(100vw - 2rem); }
}

.layout {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 1.4rem;
  margin-top: 1.2rem;
  margin-bottom: 2rem;
}

.sidebar,
.content-panel {
  background: var(--panel);
  border: 1px solid #ffffff;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.search-label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

#site-search {
  width: 100%;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 0.8rem;
}

.nav-list,
.nav-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list > li {
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
  margin-top: 0.55rem;
}

.nav-list > li:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.site-menu > .nav-list {
  display: grid;
  grid-template-columns: minmax(70px, 0.55fr) repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: center;
}

.site-menu .nav-list > li {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.site-menu .nav-group-toggle { align-items: center; text-align: left; line-height: 1.35; }
.site-menu .nav-topic { list-style: none; margin-left: 1.1rem; position: relative; }
.site-menu .nav-topic::before {
  content: "•";
  position: absolute;
  left: -1rem;
  top: 0.3rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.site-menu .nav-topic .nav-link { display: block; padding-left: 0; }
.site-menu .nav-sublist { display: block; }
.site-menu .nav-sublist[hidden] { display: none; }
.book-nav-row { display: flex; align-items: center; }
.book-submenu-toggle { flex: 0 0 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 4px; background: white; color: inherit; cursor: pointer; }
.book-submenu-toggle[aria-expanded="true"] { transform: rotate(180deg); }
.book-submenu { margin: 0; padding-left: 1rem; }
.book-submenu[hidden] { display: none; }
.book-section-link { display: block; padding: .5rem 0; line-height: 1.45; overflow-wrap: anywhere; }
.book-submenu-toggle:focus-visible, .book-section-link:focus-visible { outline: 3px solid #174e75; outline-offset: 2px; }
.content:not(:empty) { margin-top: 2rem; }
.portrait-panel { align-self: start; }

@media (max-width: 1100px) {
  .site-menu > .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .site-menu > .nav-list { grid-template-columns: 1fr; }
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.15rem 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nav-group-toggle::after {
  content: "▾";
  color: var(--ink-soft);
  font-size: 0.95rem;
  transition: transform 0.16s ease;
}

.nav-group.collapsed .nav-group-toggle::after {
  transform: rotate(-90deg);
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible {
  color: var(--accent);
}

.nav-link {
  text-decoration: none;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.3rem 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
}

.nav-link.active {
  color: var(--accent);
  font-weight: 700;
}

.nav-home-link {
  display: block;
  padding: 0.15rem 0;
  font-weight: 700;
  line-height: 1.35;
}

.nav-list ul {
  margin-top: 0.35rem;
}

.nav-sublist[hidden] {
  display: none;
}

.nav-list ul .nav-link {
  padding-left: 0.6rem;
  font-size: 0.95rem;
}

.edit-tip {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.content-panel {
  position: relative;
  align-self: start;
  padding: 0.75rem 1.2rem;
  background: var(--panel);
}

body.is-home .content-panel {
  display: contents;
}

body.is-home .site-menu {
  background: rgba(255, 255, 255, 0.5);
  padding: 0.75rem 1.2rem;
  border: 1px solid #ffffff;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

body.is-home .content {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  min-width: 0;
  width: 100%;
  margin: 0;
  background: #fff;
  padding: 1rem 1.2rem;
  border-radius: 14px;
}

body.is-home .content > :first-child { margin-top: 0; }
body.is-home .content > :last-child { margin-bottom: 0; }

body.is-home .layout {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  grid-template-rows: min-content auto;
  column-gap: 2rem;
  row-gap: 1.2rem;
  align-items: start;
}
body.is-home .portrait-panel { grid-column: 1; grid-row: 1; }
body.is-home .menu-portrait { margin-bottom: 0; }
body.is-home .content p { font-size: 1.15625rem; overflow-wrap: anywhere; }
body.is-home .page-bg,
body.is-home .background-caption { display: none; }
.home-castle { display: none; }
body.is-home .home-castle {
  display: block;
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  min-width: 0;
}
.home-castle img { display: block; width: 100%; height: auto; border-radius: 14px; }
.home-castle figcaption { margin-top: 0.5rem; color: var(--ink-soft); font-size: 0.9rem; }
@media (max-width: 920px) {
  body.is-home .layout { grid-template-columns: minmax(0, 1fr); }
  body.is-home .home-castle { grid-column: 1; grid-row: 3; }
}

.content h1,
.content h2,
.content h3 {
  line-height: 1.25;
}

.study-subtitle {
  display: block;
  font-size: 0.85em;
  font-weight: 700;
  margin-top: 0.2em;
}

.content .doctorate-subtitle {
  font-size: calc(1.32rem * 0.85);
}

.content h1 {
  margin-top: 0;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
}

.content h2 {
  margin-top: 1.4rem;
  font-size: 1.32rem;
}

.content h3 {
  margin-top: 1rem;
  font-size: 1.08rem;
}

.content p,
.content li {
  font-size: 1.03rem;
}

.content a {
  color: var(--accent);
  text-decoration-thickness: 0.1em;
}

.content-film {
  margin: 1rem 0;
}

.content-video {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  background: #000;
}

.content-film:has(source[src$="film-mvi-9309.mp4"]) {
  width: 33.3333%;
  margin-inline: auto;
}

.content-image {
  display: block;
  width: min(100%, 420px);
  height: auto;
}

.content-image-wide { width: 66.6667%; margin-inline: auto; }
.content-image.hersenspinsels-frame {
  /* Source bounds: x42..804, y141..661. Keep 42px of white on each side. */
  width: 39.212962963%;
  aspect-ratio: 847 / 605;
  margin-inline: auto;
  position: relative;
  overflow: hidden;
}
.hersenspinsels-frame > img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 127.508854782%;
  max-width: none;
  height: auto;
  transform: translateY(-12.222222222%);
}
.content-image[src$="foto-7a-beker.jpg"],
.content-image[data-media="foto-7a-beker.jpg"] { width: 21.666645%; }
.content-image[src$="foto-10-cytopatch.png"],
.content-image[data-media="foto-10-cytopatch.png"] { margin-inline: auto; }
.content-figure { margin: 1rem 0; }
.content-figure.content-image-wide { margin-inline: auto; }
.content-figure > img { display: block; width: 100%; height: auto; }
.content-figure figcaption,
.content-film figcaption { margin-top: 0.5rem; font-size: 0.9rem; line-height: 1.5; overflow-wrap: anywhere; }
.content-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 66.6667%;
  gap: 1rem;
  align-items: start;
  margin: 1rem auto;
}
.content-image-pair .content-image { width: 100%; }
.content-image-pair > .content-figure { margin: 0; min-width: 0; }
.content-image-pair:has(img[src$="foto-2-groepsfoto-1986-1987.jpg"]) {
  grid-template-columns: minmax(0, 1.5125553914fr) minmax(0, 1.9827586207fr);
}

.content-image-pair:has(img[src$="foto-7-onstream-drive.jpg"]) {
  /* Keep the drive at 125% of its former width; match the tape's image height. */
  width: calc(64.7112760378% + 0.0293313448rem);
  grid-template-columns: minmax(0, 2.0224719101fr) minmax(0, 1.1185682327fr);
}
.content-image-pair:has(img[src$="foto-9a-cytocentrics-chip.jpg"]) {
  width: 100%;
  grid-template-columns: 32.5% 18.75%;
  justify-content: center;
}

@media (max-width: 600px) {
  /* Keep the requested photo sizes; give their captions room to read. */
  #content > .content-figure { width: 100%; margin-inline: 0; }
  #content > .content-figure > img { width: min(100%, 420px); margin-inline: auto; }
  #content > .content-figure.content-image-wide > img { width: 66.6667%; }
  #content > .content-figure[data-media="foto-7a-beker.jpg"] > img {
    width: 21.666645%;
    margin-inline: 0;
  }
  .content-image-pair > .content-figure { display: contents; }
  .content-image-pair > .content-figure > img { grid-row: 1; }
  .content-image-pair > .content-figure:first-child > img { grid-column: 1; }
  .content-image-pair > .content-figure:nth-child(2) > img { grid-column: 2; }
  .content-image-pair > .content-figure > figcaption { grid-column: 1 / -1; }
  .content-image-pair > .content-figure:first-child > figcaption { grid-row: 2; }
  .content-image-pair > .content-figure:nth-child(2) > figcaption { grid-row: 3; }
}

.content blockquote {
  margin: 1rem 0;
  padding: 0.4rem 0.9rem;
  border-left: 4px solid var(--accent-2);
  background: #fff9ef;
}

.content code {
  background: #eef2f1;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
}

.home-layout { display: block; }
.menu-portrait { margin: 0 0 1.2rem; }
.menu-portrait img {
  display: block;
  width: min(100%, 200px);
  height: auto;
  border: 3px solid #fff;
  border-radius: 0.7rem;
  box-shadow: 0 0 0 1px rgba(31, 36, 38, 0.3), 0 4px 12px rgba(0, 0, 0, 0.22);
}
.home-theme summary { cursor: pointer; color: var(--accent); }
.home-theme summary h2 { display: inline; margin: 0; }
.home-theme summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.home-theme .theme-overview { margin: 0.9rem 0; }
.home-portrait { margin: 0; position: sticky; top: 1.5rem; }
.home-portrait img { display: block; width: 100%; max-width: 340px; border-radius: 0.7rem; box-shadow: var(--shadow); }
.home-intro { margin-top: 0; color: var(--ink-soft); font-size: 1.05rem; }
.home-themes { display: grid; gap: 1rem; }
.home-theme { padding: 1.25rem 1.4rem; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 0.55rem; background: #fffffff0; box-shadow: var(--shadow); }
.home-theme h2 { margin: 0 0 0.65rem; font-size: clamp(1.15rem, 2.2vw, 1.45rem); }
.home-theme ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.45rem 1.25rem; margin: 0; padding-left: 1.1rem; }
.home-theme a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
.home-theme a:hover, .home-theme a:focus-visible { color: #075846; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0;
  padding: 0.9rem 0 1.2rem;
  font-size: 0.9rem;
}

@media (max-width: 920px) {
  .home-layout { grid-template-columns: 1fr; }
  .home-portrait { position: static; }
  .home-portrait img { max-width: 260px; }

  .menu-toggle {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: block;
  }

  .sidebar.open {
    display: block;
  }
}
