:root {
  color-scheme: dark;
  --bg: #101517;
  --text: #f5f0e4;
  --mint: #a5edc6;
  --amber: #ffd291;
  --serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 56%, #1b2923, transparent 58%), var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent, var(--mint));
  outline-offset: .28rem;
}

.opening {
  display: grid;
  align-content: center;
  min-height: 100svh;
  width: min(100%, 76rem);
  margin-inline: auto;
  padding: clamp(4rem, 8vh, 5.4rem) clamp(1rem, 5vw, 3rem) clamp(2.5rem, 7vh, 4rem);
}

.scene {
  --sequence: 4.55s;
  text-align: center;
}

h1 {
  margin: 0;
  font: 400 clamp(3.2rem, 11vw, 8.15rem)/.94 var(--serif);
  letter-spacing: -.082em;
}

h1 em { font-weight: inherit; }
h1 span { color: var(--mint); }

.experience {
  width: min(100%, 44rem);
  margin: clamp(.75rem, 2.7vh, 1.45rem) auto 0;
}

.microcosm {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.microcosm path { stroke-linejoin: round; }
.instrument-ring {
  fill: none;
  stroke: #749485;
  stroke-width: .8;
  opacity: .48;
}

.brain-still { opacity: 1; }
.still-contour {
  fill: #a5edc6;
  fill-opacity: .046;
  stroke: #8bbea4;
  stroke-opacity: .49;
  stroke-width: 1.15;
}

.still-folds {
  fill: none;
  stroke: #8bbea4;
  stroke-opacity: .28;
  stroke-linecap: round;
}

.seed-stage, .brain-stage, .neuron-stage { opacity: 0; }

.brain-stage {
  transform-origin: 375px 109px;
  transform-box: view-box;
}

.brain-contour {
  fill: none;
  stroke: #c1f6d6;
  stroke-width: 1.65;
}

.brain-folds {
  fill: none;
  stroke: #bdedcf;
  stroke-opacity: .72;
  stroke-width: 1.25;
  stroke-linecap: round;
}

.focus-lens { opacity: 0; }

.neuron-stage, .molecule-stage {
  transform-box: view-box;
  transform-origin: 320px 148px;
}

.neuron-twigs, .neuron-branches {
  fill: none;
  stroke: #a4eac4;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: .43;
}

.neuron-branches { stroke-width: 1.55; opacity: .8; }
.cell { fill: #325849; stroke: #b0f5ce; stroke-width: 1.45; }
.cell-core { fill: #edfff4; }
.nerve-signal {
  fill: none;
  stroke: #f0fff7;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-dasharray: .13 1;
  opacity: .8;
}

.molecule-frame {
  fill: #101e19;
  fill-opacity: .4;
  stroke: #83c49f;
  stroke-width: .95;
  stroke-dasharray: 2 5;
  stroke-opacity: .6;
}

.bonds {
  fill: none;
  stroke: #a7ebc6;
  stroke-width: 1.45;
  stroke-opacity: .91;
}

.atoms { fill: #c0f7d7; }
.atoms.smaller { fill: #1f382b; stroke: #a5edc6; stroke-width: 1.4; }
.atoms.smaller circle:nth-child(3) { stroke: var(--amber); }

.route {
  stroke: var(--mint);
  stroke-width: 1.25;
  stroke-dasharray: 1;
  opacity: .68;
}

.book-route { stroke: var(--amber); }

.experience:has(.choices a:nth-child(1):is(:hover, :focus-visible)) .route:nth-child(1),
.experience:has(.choices a:nth-child(2):is(:hover, :focus-visible)) .route:nth-child(2),
.experience:has(.choices a:nth-child(3):is(:hover, :focus-visible)) .route:nth-child(3),
.experience:has(.choices a:nth-child(4):is(:hover, :focus-visible)) .route:nth-child(4) {
  opacity: 1;
  stroke-width: 2;
}

.choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  place-items: start center;
}

.choices a {
  --accent: var(--mint);
  display: grid;
  justify-items: center;
  gap: .25rem;
  width: min(calc(100% - .22rem), 8.3rem);
  min-height: 2.75rem;
  padding: .4rem .12rem .62rem;
  border: 1px solid transparent;
  border-radius: .68rem;
  color: var(--accent);
  font-size: clamp(.875rem, 1.8vw, 1.05rem);
  font-weight: 560;
  line-height: 1.25;
  transition: background .2s, border-color .2s;
}

.choices .books { --accent: var(--amber); }
.choices a:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.choices svg {
  width: clamp(2.15rem, 6vw, 3.05rem);
  height: auto;
}

.book-page { transform-box: fill-box; }
.book-page.left { transform-origin: right center; }
.book-page.right { transform-origin: left center; }

.is-playing .seed-stage { animation: seed var(--sequence) both; }
.is-playing .brain-stage { animation: brain-zoom var(--sequence) both; }
.is-playing .focus-lens { animation: locate var(--sequence) both; }
.is-playing .neuron-stage { animation: neuron-zoom var(--sequence) both; }
.is-playing .nerve-signal { animation: signal var(--sequence) linear both; }
.is-playing .brain-still { animation: still var(--sequence) both; }
.is-playing .molecule-stage { animation: molecule var(--sequence) both; }
.is-playing .route { animation: connect var(--sequence) both; }
.is-playing:not(.has-revealed) .choices { animation: reveal-links var(--sequence) both; }
.is-playing:not(.has-revealed) .book-page { animation: unfold var(--sequence) both; }

@keyframes seed {
  0% { opacity: .25; }
  7% { opacity: 1; }
  18%, 100% { opacity: 0; }
}

@keyframes brain-zoom {
  0%, 5% { opacity: 0; transform: translate(-51px, 40px) scale(.09); }
  10% { opacity: 1; }
  26% { opacity: 1; transform: translate(0, 0) scale(1); }
  34% { opacity: 1; transform: translate(0, 0) scale(1.04); }
  46% { opacity: .97; }
  53%, 100% { opacity: 0; transform: translate(-52px, 38px) scale(3.65); }
}

@keyframes locate {
  0%, 24% { opacity: 0; }
  33%, 43% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes neuron-zoom {
  0%, 43% { opacity: 0; transform: scale(.39); }
  53%, 63% { opacity: 1; transform: scale(1); }
  68% { opacity: .85; }
  75%, 100% { opacity: 0; transform: scale(2.45); }
}

@keyframes signal {
  0%, 45% { stroke-dashoffset: .16; opacity: 0; }
  54%, 64% { opacity: .9; }
  72%, 100% { stroke-dashoffset: -1; opacity: 0; }
}

@keyframes molecule {
  0%, 66% { opacity: 0; transform: scale(.35); }
  74% { opacity: 1; }
  84%, 100% { opacity: 1; transform: scale(1); }
}

@keyframes still {
  0%, 72% { opacity: 0; }
  88%, 100% { opacity: 1; }
}

@keyframes connect {
  0%, 77% { stroke-dashoffset: 1; }
  94%, 100% { stroke-dashoffset: 0; }
}

@keyframes reveal-links {
  0%, 82% { opacity: 0; pointer-events: none; }
  83% { opacity: .03; pointer-events: auto; }
  98%, 100% { opacity: 1; pointer-events: auto; }
}

@keyframes unfold {
  0%, 85% { transform: scaleX(.08); }
  100% { transform: scaleX(1); }
}

@media (max-width: 460px) {
  .opening { padding-inline: 1rem; }
  .experience { margin-top: 1.1rem; }
  .choices a { min-height: 3.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scene *, .choices a { animation: none !important; transition: none; }
}
