@property --research-progress {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}

:root {
  color-scheme: dark;
  --canvas: #090b18;
  --ink: #f7f4f6;
  --accent: #f0a571;
  --muted: #c6c0cb;
  --rule: #303142;
  --button-fill: #f7f1f0;
  --button-ink: #171225;
  --gold: #ffbd64;
  --coral: #ff876c;
  --rose: #ef7fae;
  --glass: #16182bd9;
  --edge: #6e62786e;
  --gutter: clamp(1rem, 5.5vw, 6.5rem);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

:root:has(#light-mode:checked) {
  color-scheme: light;
  --canvas: #fff;
  --ink: #101e2c;
  --accent: #87264f;
  --muted: #46515d;
  --rule: #e4dfdc;
  --button-fill: #101e2c;
  --button-ink: #fff;
  --gold: #ae6a21;
  --coral: #be5040;
  --rose: #9a345f;
  --glass: #fffcf9d9;
  --edge: #bc9d9d60;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }

.skip-link {
  position: absolute;
  z-index: 1;
  top: .75rem;
  left: .75rem;
  padding: .6rem .9rem;
  background: var(--ink);
  color: #fff;
  transform: translateY(-180%);
}

.skip-link:focus { transform: none; }

.site-header, .hero, .research-inner {
  width: min(100% - 2 * var(--gutter), 84rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.35rem;
  scroll-snap-align: start;
}

.wordmark, nav {
  display: flex;
  align-items: center;
}

.wordmark {
  gap: .4rem;
  white-space: nowrap;
  font-weight: 600;
  text-decoration: none;
}

.wordmark img {
  display: block;
  width: clamp(5.5rem, 8.7vw, 7.25rem);
  height: auto;
  filter: brightness(0) invert(1);
}

:root:has(#light-mode:checked) .wordmark img { filter: none; }

nav { gap: clamp(.65rem, 2vw, 1.7rem); }
nav a { display: block; padding-block: .5rem; text-decoration: none; }
nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .3em; }

.theme-switch {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  cursor: pointer;
}

.theme-switch:hover { border-color: var(--accent); color: var(--accent); }
.theme-switch:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.theme-switch svg { width: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.theme-moon, .attractor-light { display: none; }
.theme-switch:has(:checked) .theme-sun, :root:has(#light-mode:checked) .attractor-dark { display: none; }
.theme-switch:has(:checked) .theme-moon, :root:has(#light-mode:checked) .attractor-light { display: block; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.75rem, 4.5vw, 5rem);
  min-height: min(66svh, 43rem);
  padding-block: clamp(1rem, 2vw, 2rem) clamp(2.25rem, 5vw, 5rem);
}

.hero h1 {
  max-width: 27ch;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4.35rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.037em;
  text-wrap: pretty;
}

.hero-accent { color: var(--accent); }

.hero-subtitle {
  max-width: 36ch;
  margin: .9rem 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 1.85vw, 1.6rem);
  line-height: 1.55;
}

.attractor, .attractor img { width: 100%; }
.attractor { max-width: 36rem; justify-self: center; }
.attractor img { height: auto; }

.research-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 1.65rem;
  padding: .55rem .95rem;
  border: 1px solid var(--button-fill);
  border-radius: .25rem;
  color: var(--button-ink);
  background: var(--button-fill);
  text-decoration: none;
  font-weight: 550;
}

.research-link:hover { background: var(--accent); border-color: var(--accent); color: var(--canvas); }

.research {
  padding-block: clamp(2.3rem, 4.5vw, 4rem) max(2.3rem, 23svh);
  scroll-margin-top: .5rem;
  scroll-snap-align: start;
}

.research h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3.55vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -.04em;
}

.research-areas {
  position: relative;
  display: grid;
  grid-auto-rows: 1fr;
  max-width: 78rem;
  margin: 1.6rem auto 0;
  isolation: isolate;
}

.research-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke-linecap: round;
}

.research-route-narrow { display: none; }
.route-gold { stop-color: var(--gold); }
.route-coral { stop-color: var(--coral); }
.route-rose { stop-color: var(--rose); }
.route-base { stroke: url("#research-ink"); stroke-width: 1.6; opacity: .42; }
.research-route-narrow :is(.route-base, .route-trail) { stroke: url("#research-rail-ink"); }
.route-echo { stroke: url("#research-ink"); stroke-width: .75; opacity: .28; }
.route-echo-fine { opacity: .18; }
.route-trail, .route-point { display: none; }

.research-stop {
  --node: 36.6667%;
  --stop-ink: var(--gold);
  position: relative;
  display: grid;
  align-items: center;
  min-height: clamp(22rem, 72svh, 44rem);
  padding: .95rem 0 .95rem calc(var(--node) + 1.5rem);
  scroll-snap-align: center;
}

.research-stop:nth-of-type(2) {
  --node: 63.3333%;
  --stop-ink: var(--coral);
  padding-inline: 0 calc(100% - var(--node) + 1.5rem);
}

.research-stop:nth-of-type(3) { --stop-ink: var(--rose); }

.research-stop::before {
  content: "";
  position: absolute;
  left: var(--node);
  top: 50%;
  width: .85rem;
  height: .85rem;
  border: 1px solid var(--stop-ink);
  border-radius: 50%;
  background: var(--canvas);
  transform: translate(-50%, -50%);
}

.research-panel {
  padding: clamp(1.25rem, 3vw, 2.75rem);
  border: 1px solid var(--edge);
  border-radius: .85rem;
  background:
    repeating-linear-gradient(121deg, transparent 0 19px, #c68d9810 20px, transparent 21px 44px),
    linear-gradient(130deg, color-mix(in srgb, var(--stop-ink) 10%, transparent), transparent 58%),
    var(--glass);
  backdrop-filter: blur(14px);
}

.research-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 640;
  letter-spacing: -.025em;
}

.research-panel p {
  margin: .45rem 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.5;
}

.research-panel .research-example {
  border-top: 1px solid var(--edge);
  padding-top: .6rem;
  margin-top: .65rem;
}

@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; scroll-snap-type: y proximity; }
  .research-link { transition: background-color .2s, border-color .2s; }

  @supports (animation-timeline: view()) and (animation-range: entry 50% exit 50%) {
    .research-areas {
      animation: follow-research-path linear both;
      animation-timeline: view();
      animation-range: entry 50% exit 50%;
    }

    .route-trail, .route-point { display: inline; }
    .route-fill-window { height: var(--research-progress); }
    .route-tip-window {
      y: max(0%, calc(var(--research-progress) - 1.2%));
      height: min(var(--research-progress), 1.2%);
    }

    .route-trail {
      stroke: url("#research-ink");
      stroke-width: 2.5;
    }

    .route-point {
      stroke: var(--gold);
      stroke-width: 4.5;
    }

    .research-panel {
      animation: arrive-research-panel ease-out both;
      animation-timeline: view();
      animation-range: entry 0% entry 68%;
    }

    .route-echo {
      stroke-dasharray: 28 12 7 10;
    }

    .route-echo-fine { stroke-dashoffset: 12; }
  }
}

@keyframes arrive-research-panel {
  from { opacity: .18; transform: translateY(.7rem); }
  to { opacity: 1; transform: none; }
}

@keyframes follow-research-path {
  from { --research-progress: 0%; }
  to { --research-progress: 100%; }
}

@media (max-width: 700px) {
  .site-header { gap: .65rem; }
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 1.45rem; }
  .hero h1 { font-size: clamp(1.85rem, 5.7vw, 2.65rem); }
  .attractor { width: 90%; max-width: 24rem; }
  .research-route-wide { display: none; }
  .research-route-narrow { display: block; width: 1.5rem; }
  .research-stop, .research-stop:nth-of-type(2) {
    --node: .75rem;
    min-height: clamp(19rem, 67svh, 35rem);
    padding-inline: 1.75rem 0;
  }
}

@media (max-width: 390px) {
  .wordmark img { width: 4.4rem; }
  nav { gap: .55rem; }
  .theme-switch { width: 2.5rem; }
}

.home-footer .footer-inner {
  width: min(100% - 2 * var(--gutter), 84rem);
  margin-inline: auto;
  padding-block: 1.6rem;
  color: var(--muted);
}

.home-footer .footer-brand { color: var(--ink); font-weight: 620; text-decoration: none; }
.home-footer p { margin: .3rem 0 0; }
