@font-face {
  font-family: "Bebas Neue";
  src: url("./assets/bebas-neue.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f5f3ef;
  --ink: #182235;
  --muted: #585754;
  --accent: #a03222;
  --rule: #b3aba0;
  --green: #e3ebde;
  --rose: #f5ddd4;
  --gutter: clamp(1.125rem, 3.5vw, 4rem);
  --frame: 91rem;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.77, 0.21, 1);
  -webkit-tap-highlight-color: #a0322228;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.52;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(#f5f3efed, #f5f3efed), var(--paper) url("./assets/paper-grain.webp") repeat;
  background-size: auto, 27rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

.visually-hidden,
.demo-switch input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.frame {
  width: min(calc(100% - 2 * var(--gutter)), var(--frame));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 3;
  inset: 0.75rem auto auto var(--gutter);
  padding: 0.55rem 0.85rem;
  background: var(--paper);
  transform: translateY(calc(-100% - 1rem));
}

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

.page-header {
  border-bottom: 1px solid var(--accent);
}

.page-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 clamp(0.7rem, 2.5vw, 1.7rem);
  font-size: 0.9rem;
  font-weight: 630;
}

.page-header a,
.ask-trigger:not([hidden]),
.sound-toggle:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 3.25rem;
  text-decoration: none;
}

.page-header a:hover,
.ask-trigger:hover,
.sound-toggle:hover,
.text-link:hover {
  color: var(--accent);
}

.ask-trigger,
.sound-toggle {
  padding: 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.portfolio-ask {
  inset: clamp(3.8rem, 8vh, 6rem) var(--gutter) auto auto;
  width: min(32rem, calc(100% - 2 * var(--gutter)));
  max-height: calc(100dvh - 7rem);
  margin: 0;
  padding: clamp(1rem, 3.2vw, 1.75rem);
  overflow: auto;
  color: var(--ink);
  background: #fbf8f0;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  box-shadow: 0 1rem 3rem #18223530;
}

.portfolio-ask::backdrop {
  background: #18223545;
}

.ask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ask-header h2 {
  font-size: clamp(1.27rem, 4vw, 1.7rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.ask-close,
.ask-submit {
  min-height: 2.75rem;
  font: inherit;
  cursor: pointer;
}

.ask-close {
  width: 2.75rem;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  font-size: 1.35rem;
}

.ask-form,
.ask-answer,
.ask-faq {
  margin-top: 1rem;
}

.ask-form label,
.ask-faq h3 {
  font-size: 0.9rem;
  font-weight: 700;
}

.ask-input-row {
  display: flex;
  gap: 0.45rem;
  margin: 0.3rem 0;
}

.ask-input-row input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--rule);
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

.ask-submit {
  padding-inline: 0.75rem;
  color: white;
  background: var(--accent);
  border: 0;
  font-weight: 660;
}

.ask-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ask-form p,
.ask-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.ask-status:not(:empty) {
  margin-top: 0.7rem;
}

.ask-answer {
  padding: 0.75rem;
  background: #eee9df;
  overflow-wrap: anywhere;
}

.ask-links {
  margin: 0.55rem 0 0;
  padding-inline-start: 1.2rem;
  color: var(--accent);
  font-size: 0.88rem;
}

.ask-links:empty {
  margin: 0;
}

.ask-faq h3 {
  margin-bottom: 0.3rem;
}

.ask-faq details {
  border-top: 1px solid var(--rule);
}

.ask-faq summary {
  min-height: 2.75rem;
  padding-block: 0.65rem;
  font-size: 0.91rem;
  cursor: pointer;
}

.ask-faq p {
  padding-block-end: 0.65rem;
  color: var(--muted);
  font-size: 0.91rem;
}

.ask-faq a {
  color: var(--accent);
}

.hero {
  padding-block: clamp(1.55rem, min(4.2vw, 6vh), 4.4rem)
    clamp(2.8rem, 7vw, 6.4rem);
  scroll-margin-block-start: 3.5rem;
}

.hero-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(1.05rem, 4.2vw, 4.4rem);
  margin-block-end: clamp(1.6rem, min(4.4vw, 6vh), 4.1rem);
}

.hero h1 {
  display: flex;
  align-items: baseline;
  gap: 0.14em;
  margin-inline-start: -0.014em;
  font: 400 min(22.4vw, 41vh, 23rem) / 0.8 "Bebas Neue", Impact, sans-serif;
  letter-spacing: -0.011em;
  text-transform: uppercase;
  white-space: nowrap;
}

.title-word {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  padding-inline: 0.018em;
}

.title-word > span {
  display: block;
}

.name-ripple {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.14em;
  overflow: clip;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.name-ripple:not(:disabled) {
  cursor: pointer;
}

.name-letter {
  display: inline-block;
}

.name-echo {
  position: absolute;
  inset: 0 auto auto 0;
  display: flex;
  gap: 0.14em;
  color: transparent;
  opacity: 0;
  -webkit-text-stroke: 1px #a03222a8;
  pointer-events: none;
}

.name-ripple-mark {
  position: absolute;
  z-index: 2;
  inset: 0.35rem 0.4rem auto auto;
  color: var(--accent);
  font: 700 clamp(0.95rem, 1.4vw, 1.18rem) / 1 system-ui, sans-serif;
}

.name-ripple:disabled .name-ripple-mark {
  visibility: hidden;
}

.name-wave {
  position: absolute;
  z-index: 1;
  border: 2px solid #bd513a;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #d1836773, inset 0 0 0 4px #fdcfaa88;
  pointer-events: none;
}

.name-ripple[data-press] .name-ripple-mark {
  color: #db7656;
}

@media (prefers-reduced-motion: reduce) {
  .name-ripple[data-press] {
    color: var(--accent);
  }
}

.hero-heading p {
  max-width: 25ch;
  padding-block-end: clamp(0.25rem, 1.6vw, 1.45rem);
  font-size: clamp(1.2rem, 2.65vw, 2.75rem);
  font-weight: 490;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}

.hero-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(9.25rem, 15.5vw, 14rem);
  align-items: end;
  gap: clamp(0.65rem, 1.5vw, 1.5rem);
}

.three-body-mark {
  min-width: 0;
}

.orbit-art {
  position: relative;
  aspect-ratio: 1.34;
  overflow: hidden;
  background: #e9e5db;
  border: 1px solid #c6beb177;
}

.orbit-fallback,
.orbit-canvas:not([hidden]) {
  display: block;
  width: 100%;
  height: 100%;
}

.three-body-mark[data-ready] .orbit-fallback {
  display: none;
}

.orbit-fallback path,
.orbit-guide {
  fill: none;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.65;
}

.orbit-fallback .orbit-guide {
  stroke: #8b9286;
  stroke-dasharray: 1 5;
  opacity: 0.3;
}

.orbit-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.orbit-toggle,
.orbit-new {
  color: var(--muted);
  font: 650 0.62rem / 1.3 var(--mono);
  white-space: nowrap;
}

.orbit-toggle:not([hidden]),
.orbit-new:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.orbit-toggle:hover,
.orbit-new:hover {
  color: var(--accent);
}

@media (pointer: coarse) {
  .orbit-toggle:not([hidden]),
  .orbit-new:not([hidden]) {
    min-height: 2.75rem;
  }
}

.portfolio-index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.7rem, 1.1vw, 1.2rem);
}

.index-entry {
  --plate-delay: 180ms;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  align-items: start;
  column-gap: 0.45rem;
  text-decoration: none;
}

.index-entry:nth-child(2) {
  --plate-delay: 250ms;
}

.index-entry:nth-child(3) {
  --plate-delay: 320ms;
}

.index-plate {
  position: relative;
  grid-column: 1 / -1;
  overflow: hidden;
  width: 100%;
  height: min(32vh, 20vw, 20rem);
  min-height: 9.25rem;
  background: #e5dbca;
}

.index-plate img,
.project-image img,
.chapter-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.research-plate {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
}

.plate-pose {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.plate-pose img,
.plate-pose-guide,
.pose-guide {
  object-position: 51% 48%;
}

.plate-pose-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plate-eeg {
  min-width: 0;
  border-inline-start: 2px solid var(--paper);
  object-position: 60% 50%;
}

.project-plate {
  isolation: isolate;
  background: #232638;
}

.index-plate .plate-film {
  position: absolute;
  inset: 0 0 0 auto;
  width: 87%;
  object-position: 60% 45%;
}

.index-plate .plate-workbook {
  position: absolute;
  inset: 13% auto auto -4%;
  width: 58%;
  height: 64%;
  border: 5px solid #faf5e9;
  object-position: top left;
  transform: rotate(-7deg);
  box-shadow: 0 0.35rem 1.2rem #161b2e42;
}

.plate-terminal {
  position: absolute;
  inset: auto 6% 9% 1%;
  overflow: hidden;
  padding: 0.55rem 0.6rem;
  color: #f5e7d1;
  background: #20283b;
  font: 500 clamp(0.5rem, 0.87vw, 0.74rem) / 1.2 var(--mono);
  transform: rotate(-3deg);
  white-space: nowrap;
}

.plate-terminal code,
.diff-line code {
  font-family: inherit;
}

.contribution-plate {
  background:
    linear-gradient(150deg, #e1ddd38c, #d2cec4d9),
    #e7e3da url("./assets/paper-grain.webp");
  background-size: auto, 23rem;
}

.plate-diff {
  position: absolute;
  inset: 13% -2% auto 7%;
  padding: clamp(0.6rem, 2vw, 1.55rem);
  border: 1px solid #bbb6ab;
  background: #fbfaf6;
  box-shadow: 0.15rem 0.5rem 1.3rem #2c24351a;
  transform: rotate(-4deg);
}

.plate-diff-header {
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 0.9vw, 0.9rem);
  margin-block-end: clamp(0.5rem, 1.55vw, 1.4rem);
  color: var(--muted);
  font: 600 clamp(0.58rem, 1.1vw, 0.85rem) / 1.3 var(--mono);
}

.merge-mark {
  padding: 0.18em 0.5em;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.diff-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.42rem 0.58rem;
  font: 550 clamp(0.66rem, 1vw, 0.86rem) / 1.38 var(--mono);
}

.diff-line + .diff-line {
  margin-block-start: 0.25rem;
}

.diff-added {
  background: linear-gradient(var(--green), var(--green)) left / 100% 100% no-repeat;
}

.diff-removed {
  background: var(--rose);
}

.diff-added .diff-sign {
  color: #315639;
}

.diff-removed .diff-sign {
  color: var(--accent);
}

.plate-diff .diff-line code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
}

.index-label {
  padding-block: 0.82rem 0.58rem;
}

.index-label strong,
.index-label span {
  display: block;
}

.index-label strong {
  font-size: clamp(1.25rem, 2.45vw, 2.2rem);
  font-weight: 720;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.index-label span {
  margin-block-start: 0.25rem;
  color: var(--muted);
  font-size: clamp(0.77rem, 1.22vw, 1.04rem);
}

.entry-arrow {
  padding-block-start: 0.72rem;
  color: var(--accent);
  font-size: clamp(1.18rem, 2.55vw, 2.25rem);
  line-height: 1;
}

.index-entry:hover .index-label strong,
.index-entry:focus-visible .index-label strong {
  color: var(--accent);
}

.index-entry:hover .entry-arrow,
.index-entry:focus-visible .entry-arrow {
  transform: translate(0.14em, -0.13em);
}

.section {
  padding-block: clamp(2.9rem, 6.8vw, 6.2rem);
  border-top: 1px solid var(--ink);
  scroll-margin-block-start: 0.85rem;
}

.section:focus-visible {
  outline: none;
  border-top-color: var(--accent);
  box-shadow: 0 -1px 0 var(--accent);
}

.chapter {
  padding-block-start: 0;
}

.chapter-back {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2.75rem;
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.chapter-back span,
.chapter-back:hover {
  color: var(--accent);
}

.chapter-banner {
  display: grid;
  grid-template-columns: minmax(0, 0.83fr) minmax(0, 1.17fr);
  min-height: clamp(19rem, 54vh, 37rem);
  margin-block-end: clamp(1.65rem, 4vw, 3.75rem);
  color: var(--chapter-ink);
  background: var(--chapter-background);
}

.research-chapter {
  --chapter-background: #182f34;
  --chapter-ink: #f0f4e9;
  --chapter-accent: #b8e3d0;
}

.projects-chapter {
  --chapter-background: #192138;
  --chapter-ink: #f9efe1;
  --chapter-accent: #f1bf9b;
}

.contributions-chapter {
  --chapter-background: #eaddd1;
  --chapter-ink: var(--ink);
  --chapter-accent: var(--accent);
}

.chapter-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.65rem, 1.5vw, 1.35rem);
  padding: clamp(1.1rem, 4.25vw, 4.35rem);
  container-type: inline-size;
}

.chapter-topic {
  color: var(--chapter-accent);
  font: 630 clamp(0.69rem, 1vw, 0.87rem) / 1.45 var(--mono);
}

.chapter .chapter-copy h2 {
  font: 400 min(7.85rem, 26cqi) / 0.9 "Bebas Neue", Impact, sans-serif;
  letter-spacing: -0.014em;
  text-transform: uppercase;
}

.contributions-chapter .chapter-copy h2 {
  font-size: min(6.35rem, 19.8cqi);
}

.chapter-description {
  max-width: 28ch;
  font-size: clamp(1.04rem, 1.95vw, 1.72rem);
  letter-spacing: -0.025em;
  line-height: 1.24;
  text-wrap: pretty;
}

.chapter-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
}

.chapter-links .text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: 2.75rem;
  color: inherit;
}

.chapter-links .text-link:hover {
  color: var(--chapter-accent);
}

.chapter-copy :focus-visible {
  outline-color: var(--chapter-accent);
}

.chapter-visual {
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.chapter-visual img,
.chapter-visual .pose-framing {
  position: absolute;
  inset: 0;
}

.chapter-eeg {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.chapter-eeg img {
  border-inline-start-color: #e9d6ac86;
  object-position: 60% 50%;
}

.chapter-film img {
  object-position: 50% 47%;
}

.chapter-visual .plate-diff {
  inset: 50% 6% auto 8%;
  padding: clamp(0.78rem, 2.2vw, 1.85rem);
  transform: translateY(-50%) rotate(-4deg);
}

.chapter-visual .plate-diff .diff-line code {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.research-item > p:not(.field-label),
.contribution p:not(.field-label),
.chapter-demo > p,
.page-footer p {
  max-width: 46ch;
  color: var(--muted);
}

.section h3 {
  margin-block: 0.42rem 0.5rem;
  font-size: clamp(1.45rem, 2.8vw, 2.7rem);
  font-weight: 720;
  line-height: 1.09;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.field-label {
  color: var(--accent);
  font: 650 clamp(0.72rem, 1.01vw, 0.85rem) / 1.35 var(--mono);
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.7vw, 2.65rem);
}

.research-item-heading {
  margin-block-end: 0.68rem;
}

.project-preview figcaption {
  color: var(--muted);
  font: 550 clamp(0.67rem, 1vw, 0.79rem) / 1.34 var(--mono);
}

.pose-reveal {
  --unfold: 1;
  --pose-reveal: 100%;
}

.pose-framing {
  position: relative;
  width: 100%;
  height: 100%;
  clip-path: inset(calc((1 - var(--unfold)) * 4%) calc((1 - var(--unfold)) * 25%));
  transform: scale(calc(1.065 - var(--unfold) * 0.065));
}

.pose-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: clamp(0, (var(--unfold) - 0.31) * 2.4, 1);
  clip-path: inset(0 calc(100% - var(--pose-reveal)) 0 0);
  pointer-events: none;
}

.pose-framing[data-interactive] {
  cursor: ew-resize;
  touch-action: pan-y;
}

.pose-framing[data-dragging] {
  cursor: grabbing;
}

.pose-divider {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.pose-divider::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 var(--pose-reveal);
  width: 1px;
  background: #e5f4eb90;
}

.pose-hint {
  position: absolute;
  top: 50%;
  left: clamp(1.1rem, var(--pose-reveal), calc(100% - 1.1rem));
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.05rem 0.3rem 0.12rem;
  border-radius: 1rem;
  color: #f0f8f1d9;
  background: #19342b55;
  font: 500 1rem / 1 system-ui, sans-serif;
  transform: translate(-50%, -50%);
}

.pose-hint span {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

.pose-reveal:focus-within::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0.25rem;
  outline: 2px solid #d8f1e6;
  outline-offset: -2px;
  pointer-events: none;
}

.text-link {
  display: inline-block;
  color: var(--ink);
  font-size: 0.91rem;
  font-weight: 670;
}

.research-item .text-link,
.page-footer .text-link {
  margin-block-start: 0.68rem;
}

.publications {
  margin-block-start: clamp(2.8rem, 5.4vw, 5rem);
  scroll-margin-block-start: 1.25rem;
}

.chapter-demo {
  margin-block-start: clamp(2.8rem, 5.6vw, 5rem);
  scroll-margin-block-start: 1.25rem;
}

.demo-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.28rem 1rem;
  margin-block-end: 0.8rem;
}

.demo-heading h3 {
  margin: 0;
}

.eeg-console {
  padding: clamp(0.85rem, 2.2vw, 1.75rem);
  background: #182f34;
  color: #f0f4e9;
}

.eeg-console > p {
  margin-block-end: 1rem;
  color: #d3e4db;
  font-size: 0.9rem;
  text-wrap: pretty;
}

.eeg-plots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.5vw, 1.3rem);
}

.eeg-plot {
  min-width: 0;
  padding: clamp(0.52rem, 1.3vw, 1.12rem);
  background: #112328;
  border: 1px solid #5d726d;
}

.eeg-plot figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.22rem 0.65rem;
  margin-block-end: 0.24rem;
  font-size: 0.86rem;
}

.eeg-plot figcaption span {
  color: #aac2b8;
  font: 550 0.72rem / 1.5 var(--mono);
}

.eeg-plot canvas {
  display: block;
  width: 100%;
  height: clamp(7.65rem, 14vw, 12rem);
}

.eeg-plot [data-eeg-wave] {
  cursor: crosshair;
  touch-action: pan-y;
}

.eeg-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem clamp(0.85rem, 3vw, 2.75rem);
  margin-block-start: 1rem;
}

.eeg-controls label > span {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.eeg-controls label > span span {
  color: #b8e3d0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.eeg-controls input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  accent-color: #b8e3d0;
}

.eeg-controls input:focus-visible {
  outline-color: #f1bf9b;
}

.eeg-listen:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.8rem;
  margin-block-start: 0.65rem;
}

.eeg-listen button {
  min-height: 2.75rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid currentColor;
  color: inherit;
  background: transparent;
  font: 650 0.85rem / 1.4 system-ui, sans-serif;
  cursor: pointer;
}

.eeg-listen button:hover {
  color: #f1bf9b;
}

.eeg-listen p {
  color: #b8e3d0;
  font: 550 0.78rem / 1.4 var(--mono);
}

.eeg-peak {
  display: grid;
  gap: 0.12rem;
  padding-inline-start: clamp(0.85rem, 3vw, 2.5rem);
  border-inline-start: 1px solid #5d726d;
  color: #d3e4db;
  font-size: 0.81rem;
}

.eeg-peak strong {
  color: #f1bf9b;
  font: 650 clamp(1.16rem, 2.1vw, 1.7rem) / 1.15 var(--mono);
}

.publications h3 {
  margin-block-end: clamp(0.8rem, 1.75vw, 1.55rem);
}

.publication-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.publication {
  display: grid;
  grid-template-columns: clamp(8.25rem, 15vw, 12rem) minmax(0, 1fr);
  align-items: baseline;
  gap: 0.4rem clamp(1rem, 3vw, 3rem);
  padding-block: clamp(0.8rem, 1.65vw, 1.4rem);
  border-top: 1px solid var(--rule);
}

.publication:last-child {
  border-bottom: 1px solid var(--rule);
}

.publication-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.7rem;
  font-size: clamp(1rem, 1.65vw, 1.35rem);
  font-weight: 660;
  line-height: 1.25;
  text-decoration: none;
}

.publication-title:hover,
.publication-title:focus-visible,
.publication-title span {
  color: var(--accent);
}

.publication-authors,
.publication-detail {
  color: var(--muted);
  font: 450 0.84rem / 1.48 system-ui, sans-serif;
}

.publication-authors {
  margin-block-start: 0.28rem;
}

.publication-authors strong {
  color: var(--ink);
  font-weight: 680;
}

.publication-detail {
  display: block;
  margin-block-start: 0.12rem;
}

.project-showcase {
  position: relative;
  scroll-margin-block-start: 1.25rem;
}

.project {
  border-top: 1px solid var(--rule);
}

.project:last-child {
  border-bottom: 1px solid var(--rule);
}

.project summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 0.8rem;
  padding: 1.05rem 0.5rem 1.05rem 0;
  list-style: none;
  cursor: pointer;
}

.project summary::-webkit-details-marker {
  display: none;
}

.project-name {
  font-size: clamp(1.28rem, 2.15vw, 1.77rem);
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.038em;
}

.project-description {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.92rem;
}

#ai-mv,
#sticker-maker,
#torcheeg-layout {
  scroll-margin-block-start: 1.25rem;
}

.project[open] .project-name,
.project summary:hover .project-name {
  color: var(--accent);
}

.project-indicator {
  position: relative;
  grid-row: 1;
  grid-column: 2;
  width: 1rem;
  height: 1rem;
  margin-block-start: 0.26em;
  color: var(--accent);
}

.project-indicator::before,
.project-indicator::after {
  position: absolute;
  inset: 50% auto auto 0.03rem;
  width: 0.9rem;
  height: 1px;
  background: currentColor;
  content: "";
}

.project-indicator::after {
  transform: rotate(90deg);
}

.project[open] .project-indicator::after {
  transform: rotate(0);
}

.project-preview {
  margin-block-end: 0.85rem;
  padding: clamp(0.55rem, 1.15vw, 0.95rem);
  border: 1px solid var(--rule);
  background: #fcfbf8b8;
}

.sticker-stage {
  padding: clamp(0.6rem, 2vw, 1.1rem);
  background: #f3ede3;
}

.sticker-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: clamp(0.35rem, 1.3vw, 1rem);
}

.sticker-step p {
  margin-block-end: 0.45rem;
  font-size: 0.86rem;
  font-weight: 640;
}

.sticker-frame {
  display: grid;
  place-items: center;
  min-height: clamp(6rem, 15vw, 11.5rem);
  border: 1px solid #c7b7a9;
}

.sticker-frame img {
  display: block;
  width: min(88%, 10.5rem);
  height: auto;
  image-rendering: pixelated;
}

.sticker-reference {
  background: #fff9ee;
}

.sticker-output {
  background: conic-gradient(#e6dbd2 25%, #faf4eb 25% 50%, #e6dbd2 50% 75%, #faf4eb 75%) 0 0 / 20px 20px;
}

.sticker-arrow {
  align-self: center;
  color: var(--accent);
  font-size: 1.35rem;
  transform: translateY(0.6rem);
}

.sticker-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-block-start: 0.95rem;
}

.sticker-controls p {
  font-size: 0.91rem;
}

.sticker-controls p span {
  display: block;
  color: var(--muted);
  font: 600 0.74rem / 1.4 var(--mono);
}

.sticker-play {
  min-height: 2.75rem;
  padding: 0.38rem 0.75rem;
  border: 1px solid var(--accent);
  color: #fff9ee;
  background: var(--accent);
  font: 650 0.85rem / 1.4 system-ui, sans-serif;
  cursor: pointer;
}

.sticker-play:hover {
  background: #872b1d;
}

.project-image {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e9dfd0;
}

.workbook-image img {
  object-position: top center;
}

.film-image {
  position: relative;
}

.film-play {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  width: clamp(3rem, 5vw, 4.1rem);
  aspect-ratio: 1;
  border: 1px solid #f5f3efb0;
  border-radius: 50%;
  color: var(--paper);
  background: #182235e6;
  transform: translate(-50%, -50%);
}

.film-play::before {
  margin-inline-start: 0.16rem;
  border-block: 0.44rem solid transparent;
  border-inline-start: 0.72rem solid currentColor;
  content: "";
}

.film-image:hover .film-play,
.film-image:focus-visible .film-play {
  background: var(--accent);
}

.film-player {
  width: 100%;
  border: 0;
  background: var(--ink);
}

.project-preview figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 0.8rem;
  margin-block-start: 0.6rem;
}

.project-preview .text-link {
  font-family: system-ui, sans-serif;
}

.project-preview-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
}

.project-repository {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 560;
}

.demo-switch {
  min-inline-size: 0;
  margin: 0.9rem 0 0;
  padding: 0;
  border: 0;
}

.demo-switch label {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin: 0 0.3rem 0.55rem 0;
  padding: 0.32rem clamp(0.52rem, 1.1vw, 0.92rem);
  border: 1px solid var(--rule);
  font-size: 0.83rem;
  font-weight: 660;
  cursor: pointer;
}

.demo-switch label:hover {
  border-color: var(--accent);
}

.demo-switch input:checked + label {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}

.demo-switch input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-content {
  padding: clamp(0.8rem, 2vw, 1.7rem);
  border: 1px solid var(--rule);
  background: #ebe5db;
}

.dialoglingo-sheet {
  background: #e7e5dd;
}

.dialoglingo-conversation,
.dialoglingo-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(0.62rem, 1.5vw, 1.25rem);
}

.chat-turn,
.study-card {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  min-width: 0;
  min-height: 10.2rem;
  padding: clamp(0.78rem, 2vw, 1.65rem);
  border: 1px solid #adaea2;
  background: #fcfaf5;
}

.chat-turn:last-child {
  border-color: #829286;
  background: #e7efe7;
}

.demo-label {
  color: #416252;
  font: 650 0.78rem / 1.4 var(--mono);
}

.chat-turn mark {
  color: inherit;
  background: #f3ddb3;
  box-decoration-break: clone;
}

.study-card h4 {
  margin: 0;
  font-size: clamp(1.04rem, 1.7vw, 1.38rem);
  line-height: 1.25;
}

.study-context {
  color: var(--muted);
  font-size: 0.82rem;
}

#dialoglingo-chat:checked ~ .switch-content .dialoglingo-cards,
#dialoglingo-workbook:checked ~ .switch-content .dialoglingo-conversation,
#torcheeg-before:checked ~ .switch-content .topomap-after,
#torcheeg-after:checked ~ .switch-content .topomap-before {
  display: none;
}

.skill-preview {
  display: grid;
  align-content: center;
  gap: clamp(0.55rem, 1.25vw, 1rem);
  width: 100%;
  min-width: 0;
  min-height: 16rem;
  aspect-ratio: 16 / 9;
  padding: clamp(0.95rem, 3vw, 2.85rem);
  color: #f6ede1;
  background: linear-gradient(141deg, #203048, #1a2031 78%);
}

.skill-path {
  color: #f2b295;
  font: 550 clamp(0.66rem, 1.13vw, 0.88rem) / 1.3 var(--mono);
}

.skill-title {
  font-size: clamp(1.42rem, 3vw, 2.55rem);
  font-weight: 685;
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.skill-preview ul {
  margin: 0;
  padding-inline-start: 1.23rem;
  color: #e7e1d8;
  font-size: clamp(0.82rem, 1.27vw, 1rem);
}

.skill-preview li + li {
  margin-block-start: 0.25rem;
}

.skill-preview code {
  width: fit-content;
  max-width: 100%;
  padding: 0.42rem 0.56rem;
  border-inline-start: 2px solid #d18367;
  background: #f8ead516;
  font: 500 clamp(0.66rem, 0.91vw, 0.83rem) / 1.45 var(--mono);
  overflow-wrap: anywhere;
}

.all-prs {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.36rem 0.74rem;
  border: 1px solid var(--rule);
  font-size: 0.85rem;
  font-weight: 660;
  text-decoration: none;
}

.all-prs span {
  color: var(--accent);
}

.all-prs:hover,
.all-prs:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.contribution-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contribution {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem clamp(1.15rem, 4.5vw, 4.5rem);
  padding-block: clamp(1.12rem, 2.5vw, 1.85rem);
  border-top: 1px solid var(--rule);
}

.contribution:last-child {
  border-bottom: 1px solid var(--rule);
}

.contribution h3 {
  font-size: clamp(1.25rem, 2.3vw, 2rem);
}

.contribution-evidence {
  min-width: 0;
}

.contribution-evidence .text-link {
  margin-block-start: 0.47rem;
}

.contribution .diff-line code {
  overflow-wrap: anywhere;
}

.topomap-switch {
  margin-block-start: 0;
}

.topomap-figure {
  container-type: inline-size;
  padding: clamp(0.64rem, 1.55vw, 1.28rem);
  background: #eee9df;
}

.topomap-grid {
  --map-gap: clamp(0.25rem, 1vw, 0.68rem);
  --map-width: min(7.35rem, calc((100cqi - 3 * var(--map-gap)) / 4));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, var(--map-width)));
  justify-content: center;
  gap: var(--map-gap);
}

#torcheeg-after:checked ~ .topomap-figure .topomap-grid {
  grid-template-columns: repeat(2, minmax(0, var(--map-width)));
}

.topomap {
  text-align: center;
  font: 630 clamp(0.66rem, 1.02vw, 0.84rem) / 1.45 var(--mono);
}

.topomap span {
  display: block;
  aspect-ratio: 1;
  background-image: url("./assets/torcheeg-band-maps.webp");
  background-position: var(--map-position, 0%) 0;
  background-size: 400% 100%;
  background-repeat: no-repeat;
}

.topomap:nth-child(2) {
  --map-position: 33.333%;
}

.topomap:nth-child(3) {
  --map-position: 66.667%;
}

.topomap:nth-child(4) {
  --map-position: 100%;
}

.topomap-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.28rem 0.8rem;
  margin-block-start: 0.74rem;
  padding-block-start: 0.56rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.77rem;
}

.topomap-figure code {
  color: var(--ink);
  overflow-wrap: anywhere;
  font: 630 0.75rem / 1.5 var(--mono);
}

.page-footer {
  padding-block: clamp(2.6rem, 5vw, 4.5rem);
  border-top: 1px solid var(--ink);
  background: #e7e4dea8;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.7rem;
}

.page-footer h2 {
  margin-block-end: 0.42rem;
  font-size: 1.12rem;
}

@media (min-width: 53rem) {
  .project-showcase {
    --index-width: 40%;
    --preview-gap: clamp(1.35rem, 4vw, 4.2rem);
    min-height: clamp(19.5rem, 35.5vw, 32rem);
  }

  .project {
    width: var(--index-width);
  }

  #ai-mv {
    scroll-margin-block-start: min(68vh, clamp(17rem, 37vw, 31rem));
  }

  .project-preview-area {
    position: absolute;
    inset: 0 0 0 calc(var(--index-width) + var(--preview-gap));
    pointer-events: none;
  }

  .project-preview {
    position: sticky;
    inset-block-start: 1.25rem;
    margin: 0;
    pointer-events: auto;
  }
}

@media (max-width: 48rem) {
  .hero-heading {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.68rem;
    margin-block-end: 1.55rem;
  }

  .hero h1 {
    font-size: clamp(5.05rem, 29vw, 12rem);
  }

  .hero-heading p {
    max-width: 32ch;
    padding-block-end: 0;
  }

  .hero-intro {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) clamp(8.75rem, 39vw, 12rem);
  }

  .portfolio-index {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .index-entry {
    grid-template-columns: clamp(5.6rem, 27vw, 10rem) minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: clamp(0.55rem, 2.6vw, 1rem);
    padding-block: 0.64rem;
    border-top: 1px solid var(--rule);
  }

  .index-entry:last-child {
    border-bottom: 1px solid var(--rule);
  }

  .index-plate {
    grid-column: 1;
    height: auto;
    min-height: 0;
    aspect-ratio: 1.48;
  }

  .index-label,
  .entry-arrow {
    padding: 0;
  }

  .plate-diff {
    inset: 8% -18% auto 3%;
    padding: 0.35rem;
  }

  .plate-diff-header {
    margin-block-end: 0.25rem;
    font-size: clamp(0.46rem, 1.52vw, 0.64rem);
  }

  .plate-diff .diff-line {
    gap: 0.14rem;
    padding: 0.13rem 0.18rem;
    font-size: clamp(0.38rem, 1.22vw, 0.52rem);
  }

  .plate-diff .diff-line + .diff-line {
    margin-block-start: 0.12rem;
  }

  .index-plate .plate-workbook {
    border-width: 2px;
  }

  .plate-terminal {
    padding: 0.18rem 0.32rem;
    font-size: clamp(0.4rem, 1.35vw, 0.57rem);
  }

  .research-grid,
  .publication,
  .contribution,
  .chapter-banner,
  .eeg-plots,
  .dialoglingo-conversation,
  .dialoglingo-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-banner {
    min-height: 0;
  }

  .chapter-visual {
    aspect-ratio: 1.55;
  }

  .chapter-visual .plate-diff-header,
  .chapter-visual .plate-diff .diff-line {
    font-size: clamp(0.63rem, 2vw, 0.85rem);
  }

  .eeg-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .eeg-peak {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.55rem 0 0;
    border: 0;
    border-top: 1px solid #5d726d;
  }

  .chat-turn,
  .study-card {
    min-height: 0;
  }

  .publication-detail {
    display: inline-block;
    margin-inline-start: 0.45rem;
  }

  .research-grid {
    gap: 2.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .title-word > span {
    animation: title-in 590ms var(--ease) both;
  }

  .title-word + .title-word > span {
    animation-delay: 75ms;
  }

  .index-plate {
    animation: plate-in 470ms var(--ease) var(--plate-delay) both;
  }

  html[data-chapter-transition]::view-transition {
    background: var(--paper);
  }

  html[data-chapter-transition]::view-transition-group(chapter-art) {
    animation-duration: 500ms;
    animation-timing-function: var(--ease);
  }

  html[data-chapter-transition]::view-transition-old(root) {
    animation: chapter-out 150ms ease-out both;
    mix-blend-mode: normal;
  }

  html[data-chapter-transition]::view-transition-new(root) {
    animation: chapter-in 270ms var(--ease) 125ms both;
    mix-blend-mode: normal;
  }

  .entry-arrow {
    transition: transform 170ms var(--ease);
  }

  .page-header a,
  .index-label strong,
  .project-name,
  .all-prs,
  .text-link {
    transition: color 160ms ease, border-color 160ms ease;
  }

  .project-indicator::after {
    transition: transform 170ms var(--ease);
  }

  .project[open] .project-preview {
    animation: preview-in 255ms var(--ease) both;
  }

  #dialoglingo-workbook:checked ~ .switch-content .study-card,
  #torcheeg-after:checked ~ .topomap-figure .topomap-grid {
    animation: preview-in 250ms var(--ease) both;
  }

  .contribution.in-view .diff-added {
    animation: mark-change 480ms var(--ease) both;
  }

  @keyframes title-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  @keyframes plate-in {
    from { clip-path: inset(9% 0 9% 0); opacity: 0.62; transform: translateY(10px); }
    to { clip-path: inset(0); opacity: 1; transform: translateY(0); }
  }

  @keyframes chapter-out {
    from { opacity: 1; }
    to { opacity: 0; }
  }

  @keyframes chapter-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes preview-in {
    from { opacity: 0.56; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes mark-change {
    from { background-size: 2% 100%; }
    to { background-size: 100% 100%; }
  }
}
