@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/font-2.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #fcf9f5;
  --hero-paper: #fff5ea;
  --white: #fffdfa;
  --ink: #2b2225;
  --muted: #5b5053;
  --accent: #b91738;
  --accent-deep: #93122d;
  --line: #ded2cc;
  --vanilla: #ffeacc;
  --blush: #efbcae;
  --wash: #fff3e2;
  --band: #f8f0e9;
  --surface-rule: #d7afb4;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --header: 70px;
  --gutter: clamp(1rem, 4.5vw, 3.5rem);
  font: 100%/1.6 Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header) + 1rem); }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-deep); }
button, input, select { font: inherit; color: inherit; }
button:not(:disabled), summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 3px; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.14; letter-spacing: -.035em; }
h2 { font-size: clamp(2.05rem, 4.15vw, 3.6rem); font-weight: 600; line-height: 1.04; }
h3 { font-size: 1.3rem; }
.wrap { width: min(100% - var(--gutter) * 2, 70rem); margin-inline: auto; }
.section { padding-block: clamp(3rem, 6vw, 5rem); }
.band { background: var(--band); border-block-start: 1px solid var(--surface-rule); }
#video { background: var(--paper); }
#about > .wrap { border-block-start: 1px solid var(--line); }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus { position: fixed; z-index: 20; top: .5rem; left: 1rem; background: var(--white); padding: .5rem .8rem; }
.eyebrow { color: var(--accent-deep); font: 500 .875rem/1.5 var(--mono); }
.meta, .micro { color: var(--muted); font-size: .875rem; }

.site-header { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: calc(var(--header) - 1px); }
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.wordmark img { width: 42px; height: 42px; border-radius: 2px; transition: box-shadow .18s ease; }
.wordmark:hover img { box-shadow: 0 0 13px #b9173840; }
.wordmark:hover span { text-decoration: underline; text-underline-offset: .2em; }
#main-nav { display: flex; align-items: center; gap: clamp(.9rem, 2.3vw, 2rem); font-size: .92rem; }
#main-nav a {
  text-decoration: underline 2px transparent; text-underline-offset: .35em;
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 550; color: var(--muted); white-space: nowrap;
}
#main-nav a:hover, #main-nav a[aria-current] { color: var(--accent-deep); text-decoration-color: var(--accent); }
#main-nav .nav-contact { color: var(--accent-deep); }
.menu-toggle { display: none; }

#main {
  --hero-art-start: 51%;
  --trace-one: .17;
  --trace-two: .66;
  --ribbon-lead: 3.5px;
  --ribbon-follow: 1.5px;
  --ribbon-lead-seam: #a55062;
  --ribbon-follow-seam: #d39ca6;
}
.hero {
  position: relative; isolation: isolate;
  background: var(--hero-paper);
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0; z-index: 1; height: 2px; pointer-events: none;
  background: linear-gradient(to right, var(--surface-rule) 0 48%, #b45e71 100%);
}
.hero-layout {
  display: grid; align-items: center;
  min-height: clamp(25rem, 39vw, 32rem); padding-block: clamp(2.5rem, 5vw, 4.75rem);
}
.hero-copy { position: relative; width: 51%; }
.hero h1 {
  font-size: clamp(3.25rem, 8vw, 7.35rem); font-weight: 700;
  letter-spacing: -.063em; word-spacing: .045em; line-height: 1; margin: 0 0 1.15rem; white-space: nowrap;
}
.hero h1 span { color: var(--accent-deep); }
.hero-description {
  max-width: 27rem; font-size: clamp(1.08rem, 1.75vw, 1.3rem); color: var(--muted);
}
.hero .actions { margin-top: 1.7rem; gap: .85rem 1.2rem; }
.hero-research-link {
  display: inline-flex; align-items: center; min-height: 44px; font-size: .94rem; font-weight: 650;
}
.hero-art {
  position: absolute; z-index: -1; inset: 0 0 0 var(--hero-art-start); overflow: hidden; pointer-events: none;
  background: var(--blush); clip-path: polygon(24% 0, 100% 0, 100% 100%, 0 100%);
}
.hero-art::before, .hero-art::after {
  content: ""; position: absolute; inset: 0;
}
.hero-art::before {
  background: var(--accent);
  clip-path: polygon(41% 0, 100% 0, 100% 100%, 17% 100%);
}
.hero-art::after {
  background: var(--accent-deep);
  clip-path: polygon(90% 0, 100% 0, 100% 100%, 66% 100%);
}
.hero-traces { position: absolute; z-index: 1; inset: 0; }
.hero-traces::before, .hero-traces::after {
  content: ""; position: absolute; inset: 0;
  --trace-bottom: calc(100% * var(--trace));
  --trace-high: calc(var(--trace-bottom) + 11.52%);
  background: linear-gradient(transparent 52%, var(--trace-color) 100%);
  clip-path: polygon(var(--trace-high) 52%, calc(var(--trace-high) + var(--trace-width) * .32) 52%,
    calc(var(--trace-bottom) + var(--trace-width)) 100%, var(--trace-bottom) 100%);
}
.hero-traces::before {
  --trace: var(--trace-one);
  --trace-width: var(--ribbon-lead);
  --trace-color: var(--ribbon-lead-seam);
}
.hero-traces::after {
  --trace: var(--trace-two);
  --trace-width: var(--ribbon-follow);
  --trace-color: var(--ribbon-follow-seam);
}
.hero-monogram {
  position: absolute; z-index: 1; top: 50%; left: 61%;
  width: min(73%, 29rem); height: 80%; transform: translate(-50%, -50%);
  background: var(--vanilla);
  mask: url("assets/brand/liam-kruer-mark.svg") center / contain no-repeat;
}
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.button, .menu-toggle {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center;
  padding: .55rem .9rem; border: 1px solid transparent; border-radius: 4px;
  font-size: .9rem; font-weight: 650; line-height: 1.3; text-align: center; text-decoration: none;
}
.primary { background: var(--accent); color: var(--vanilla); }
.primary:hover { background: var(--accent-deep); color: var(--vanilla); }
.secondary, .menu-toggle { color: var(--accent-deep); background: var(--white); border-color: var(--line); }
.secondary:hover, .menu-toggle:hover { border-color: var(--accent); background: var(--band); }
.menu-toggle { display: none; }
.section-heading { margin-bottom: 1.6rem; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  #main-nav a { transition: color .22s ease, text-decoration-color .22s ease; }
  .section-arrival { animation: section-arrival .56s cubic-bezier(.2, .7, .25, 1) both; }

}
@keyframes section-arrival {
  from { transform: translateY(12px); opacity: .76; }
  to { transform: translateY(0); opacity: 1; }
}
.section-heading p, .about-section p:not(.meta) { color: var(--muted); max-width: 43rem; margin-top: .6rem; }
.heading-with-link { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }


.thread-section { position: relative; isolation: isolate; }
.thread-section > .wrap { position: relative; z-index: 1; }
.section-rail {
  position: absolute; left: 0; top: calc(0px - var(--rail-border, 0px));
  width: 100%; height: calc(100% + var(--rail-border, 0px));
  overflow: hidden; pointer-events: none; fill: none;
}
.band, .contact-section { --rail-border: 1px; }
.section-rail polyline { stroke: var(--ribbon-lead-seam); stroke-width: var(--ribbon-lead); }
.section-rail polyline + polyline { stroke: var(--ribbon-follow-seam); stroke-width: var(--ribbon-follow); }
#contact .section-rail { mask-image: linear-gradient(#000, transparent 96%); }

@media (min-width: 921px) {
  #math > .section { padding-block-start: 6.75rem; }
  #games > .section { padding-block-end: 6.75rem; }
}

@property --route-drawn {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}
@keyframes trace-route {
  from { --route-drawn: 4%; }
  to { --route-drawn: 100%; }
}
@media (min-width: 921px) and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .edge-route { view-timeline: --edge-route block; }
    .edge-route .section-rail {
      mask-image: linear-gradient(to bottom, #000 var(--route-drawn),
          #0008 min(100%, calc(var(--route-drawn) + 3.5rem))),
        linear-gradient(to bottom, transparent calc(100% - 2.25rem), #000);
      animation: trace-route linear both;
      animation-timeline: --edge-route;
      animation-range: cover 0% cover 80%;
    }
  }
}

#engineering > .section { padding-block-start: clamp(3.25rem, 6vw, 5.5rem); }
@media (min-width: 921px) {
  :is(#engineering, #math) .section-heading {
    display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.25rem); align-items: end;
    margin-bottom: 2.15rem;
  }
  :is(#engineering, #math) .section-heading p { margin: 0; }
}
.engineering-layout {
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1.8rem clamp(2rem, 5vw, 4.25rem); align-items: start;
}
.pass-study {
  min-width: 0; border: 1px solid #ccb9a7; background: #f6ecdc;
}
.study-header, .pass-study figcaption {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem;
  padding-inline: clamp(.8rem, 2vw, 1.25rem);
}
.study-header { background: #382b2e; color: var(--white); min-height: 3.2rem; }
.study-header h3 { font-size: 1.2rem; font-weight: 500; letter-spacing: -.025em; }
.study-switch { display: flex; gap: .25rem; }
.study-switch button {
  background: transparent; color: #f2dbcf; border: 0; min-height: 44px; padding: .25rem .55rem;
  font: 500 .875rem/1.2 var(--mono);
}
.study-switch button[aria-pressed="true"] { color: white; text-decoration: underline 2px #efbcae; text-underline-offset: .45rem; }
.study-switch button:hover { color: white; background: #503a3f; }
.study-switch button:focus-visible { outline-color: white; outline-offset: -3px; }
.pass-study img { width: 100%; aspect-ratio: 640 / 315; object-fit: contain; }
.pass-study figcaption {
  min-height: 2.8rem; padding-block: .45rem; font: 400 .82rem/1.5 var(--mono);
  color: #594337; border-top: 1px solid #ccb9a7;
}
.build-notes-heading { padding: .15rem 0 .85rem; }
.build-log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.build-entry {
  display: grid; grid-template-columns: minmax(0, 1fr) 1rem; gap: .7rem; align-items: center;
  width: 100%; padding: 1rem .1rem; color: var(--ink); text-align: left;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
}
.build-entry > span:first-child { display: grid; gap: .25rem; }
.build-entry strong { font-size: 1.14rem; letter-spacing: -.025em; }
.build-entry > span > span { color: var(--muted); font-size: .96rem; }
.build-entry:hover strong { color: var(--accent-deep); text-decoration: underline; text-underline-offset: .2em; }
.note-icon { width: .5rem; height: .5rem; border: solid var(--accent); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }

.game-feature {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  background: var(--white); border: 1px solid var(--line);
}
.game-visual {
  display: block; position: relative; overflow: hidden; width: 100%; padding: 0; border: 0; background: #252239;
}
.game-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 58% 62%; transition: transform .3s ease; }
.game-visual:hover img { transform: scale(1.025); }
.game-visual:focus-visible { z-index: 1; outline-offset: -4px; }
.game-copy { align-self: center; padding: clamp(1.4rem, 2.8vw, 2.4rem); }
.game-intro h3 { margin: .3rem 0 .75rem; font-size: clamp(2.25rem, 4.3vw, 3.8rem); }
.game-intro p:not(.eyebrow) { max-width: 42ch; color: var(--muted); }
.game-details { margin-top: 1.05rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.game-details .actions { margin-block: .8rem .7rem; }
.project-details { margin: 0; padding-left: 1.13rem; color: var(--muted); font-size: .91rem; }
@media (prefers-reduced-motion: reduce) {
  .game-visual img { transition: none; }
  .game-visual:hover img { transform: none; }
}
.game-list { display: grid; gap: .75rem; margin-top: 1.5rem; }

.video-program { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(1.4rem, 3.5vw, 3rem); align-items: start; }
.video-card { width: 100%; color: var(--ink); text-align: left; background: transparent; padding: 0; border: 0; }
.video-card:hover h3 { color: var(--accent-deep); text-decoration: underline; text-underline-offset: .16em; }
.video-image { width: 100%; aspect-ratio: 16 / 9; position: relative; }
.video-image img { width: 100%; height: 100%; object-fit: cover; }
.video-length { position: absolute; right: .35rem; bottom: .35rem; background: #241d20; color: white; padding: .08rem .36rem; font: .8rem/1.45 var(--mono); }
.featured-video { display: block; }
.featured-video-copy { padding: 1.1rem .1rem 0; }
.featured-video-copy h3 { margin: .35rem 0 .6rem; font-size: clamp(1.6rem, 2.8vw, 2.35rem); line-height: 1.1; }
.featured-video-copy p:not(.eyebrow) { color: var(--muted); }
.featured-video-action { display: inline-block; margin-top: .7rem; color: var(--accent-deep); font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }
.video-grid { display: grid; border-top: 1px solid var(--ink); }
.video-grid .video-card {
  display: grid; grid-template-columns: minmax(0, .68fr) minmax(0, 1fr);
  gap: .16rem 1rem; align-items: start; padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.video-grid .video-image { grid-row: span 2; align-self: center; }
.video-grid .micro { align-self: end; }
.video-grid h3 { font-size: clamp(1.05rem, 1.7vw, 1.4rem); line-height: 1.18; }

.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.25rem;
  flex-wrap: wrap;
  padding: .8rem;
  background: var(--band);
}
.seed-presets > button, .page-toolbar > button, #media-fullscreen {
  min-height: 44px; padding: .35rem .72rem; border: 1px solid var(--line); border-radius: 4px; background: var(--white);
}
.seed-presets > button.selected { background: var(--accent-deep); color: var(--white); border-color: var(--accent-deep); }
.archive-search { width: min(100%, 26rem); }
input, select { min-height: 44px; padding: .45rem .65rem; background: var(--white); border: 1px solid #b9a9a9; border-radius: 4px; }
.archive-search input { width: 100%; }
.archive-status { color: var(--muted); font-size: .9rem; }
.research-archive { border-block: 1px solid var(--ink); }
.collection-title { display: grid; gap: .15rem; color: var(--ink); font: 600 clamp(1.1rem, 2vw, 1.42rem)/1.3 var(--display); }
.collection-title small { color: var(--muted); font: 400 .94rem/1.5 Inter, sans-serif; }
.research-group { border-top: 1px solid var(--line); }
.research-group > summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto .65rem; align-items: center; column-gap: .75rem;
  color: var(--accent-deep); padding: 1rem .85rem; font-weight: 650; list-style: none;
}
.research-group > summary::-webkit-details-marker { display: none; }
.research-group > summary::after {
  content: ""; width: .48rem; height: .48rem; border: solid var(--accent-deep); border-width: 0 2px 2px 0;
  transform: translateY(-.11rem) rotate(45deg);
}
.research-group > summary:hover, .research-group[open] > summary { background: var(--band); }
.research-group[open] > summary::after { transform: translateY(.11rem) rotate(225deg); }
.group-count { color: var(--accent-deep); font: 500 .875rem/1.5 var(--mono); white-space: nowrap; }
.paper-list { margin: 0; padding: 0; list-style: none; }
.paper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .3rem 1.2rem;
  border-top: 1px solid var(--line);
  padding: .68rem .6rem;
}
.paper-row-info { min-width: 0; }
.paper-row-info h3 { margin: 0; font-size: 1.1rem; font-weight: 650; line-height: 1.3; }
.paper-row-info .meta { margin-top: .15rem; }
.paper-row-actions { display: flex; flex: none; gap: 0 1.05rem; flex-wrap: wrap; max-width: 100%; }
.paper-row-actions > *, .paper-downloads a, .note-downloads a {
  min-height: 44px; display: inline-flex; align-items: center; padding: .22rem 0;
  color: var(--accent-deep); border: 0; background: none; font-size: .9rem; font-weight: 650;
  text-decoration: underline; text-underline-offset: .2em;
}
.paper-row-actions > :hover, .paper-downloads a:hover, .note-downloads a:hover { color: var(--accent); }
.archive-colophon { padding: .7rem .6rem 1rem; color: var(--muted); font-size: .9rem; }
.archive-empty { padding: 1rem .8rem; }
.archive-empty button { margin-top: .5rem; }
.paper-section > h3, .research-provenance > summary {
  color: var(--muted); font-size: .93rem; font-weight: 650; letter-spacing: normal;
  padding: .75rem .6rem; border-top: 1px solid var(--line);
}
.research-provenance { background: var(--band); }
.research-provenance p { max-width: 53rem; margin: .35rem .6rem .65rem; color: var(--muted); font-size: .9rem; }
.hexagon-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .15rem .6rem .95rem; font-size: .9rem; }
#paper-summary { margin-top: .5rem; max-width: 54rem; }

.math-lab { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 2rem; background: var(--band); border: 1px solid var(--line); padding: clamp(1.1rem, 4vw, 2.25rem); margin-top: 2.2rem; }
.lab-copy h3 { font-size: 1.6rem; }
.lab-copy > p { margin-top: .55rem; color: var(--muted); }
.lab-copy form { margin-top: 1rem; }
.lab-copy form label { font-size: .9rem; font-weight: 650; }
.number-entry { display: flex; gap: .45rem; margin-top: .35rem; flex-wrap: wrap; }
.number-entry input { width: 8rem; max-width: 100%; }
.number-entry button { min-height: 44px; background: var(--accent-deep); color: var(--white); border: 0; border-radius: 4px; padding-inline: .75rem; }
.input-error:not(:empty) { color: var(--accent-deep); margin-top: .4rem; }
.seed-presets { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; font-size: .88rem; }
.seed-presets span { color: var(--muted); text-transform: lowercase; }
.lab-plot { background: var(--white); border: 1px solid var(--line); padding: .75rem; min-width: 0; }
.plot-header, .plot-stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .86rem; }
#collatz-canvas { width: 100%; height: 205px; display: block; }
.plot-stats { border-top: 1px solid var(--line); padding-block: .65rem; }
.plot-stats > div { display: grid; }
.plot-stats strong { font-size: 1.22rem; color: var(--accent-deep); }
.plot-note { font-size: .82rem; color: var(--muted); }

.about-section .section { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about-copy p { font-size: 1.08rem; }
.credentials { border-block-start: 2px solid var(--ink); padding-block-start: .85rem; }
.credentials h3, .build-notes-heading { font-size: 1.12rem; }
.credentials .meta { padding-top: .55rem; }
.credentials ul { padding: 0; list-style: none; margin: .5rem 0; }
.credentials li { display: grid; grid-template-columns: 3.4rem 1fr; gap: .5rem; padding-block: .48rem; border-bottom: 1px solid var(--line); }
.credentials li strong { color: var(--accent-deep); font-family: var(--mono); font-weight: 500; }
.contact-section { background: var(--accent-deep); color: var(--vanilla); border-top: 1px solid var(--surface-rule); border-bottom: 1px solid var(--line); }
.contact-layout .primary { background: var(--vanilla); color: #70162b; }
.contact-layout .secondary { background: transparent; color: var(--white); border-color: #cf8795; }
.contact-layout .button:hover { background: white; color: var(--accent-deep); }
.contact-layout :focus-visible { outline-color: white; }
.contact-layout { padding-block: clamp(2rem, 5vw, 4rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer { display: flex; justify-content: space-between; gap: .7rem; flex-wrap: wrap; padding-block: 1.15rem; color: var(--muted); font-size: .88rem; }

dialog {
  position: fixed; width: min(94vw, 46rem); max-height: 90dvh; background: var(--white);
  color: var(--ink); border: 1px solid #b7a5a7; border-radius: 5px; overflow: auto;
}
dialog::backdrop { background: #24161cab; }
dialog button:disabled { opacity: .45; cursor: default; }
#article-dialog { padding: 0; }
#article-dialog .viewer-header { position: sticky; top: 0; z-index: 1; background: var(--white); }
#article-content { padding: 1.35rem clamp(1.2rem, 4vw, 2rem); }
#article-content .article-note { margin-top: .8rem; }
button.dialog-close, button.viewer-close { background: var(--band); border: 1px solid var(--line); border-radius: 4px; width: 44px; height: 44px; font-size: 1.4rem; flex: 0 0 44px; }
.dialog-kicker, .article-note { color: var(--muted); font-size: .9rem; }
#article-title { margin-block: .15rem 0; }
#article-content h3 { margin-top: 1rem; }
#article-content p + p, #article-content h3 + p { margin-top: .45rem; }
.note-downloads, .paper-downloads, .media-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.note-downloads { margin-top: .8rem; }
.reader-document { min-height: 0; min-width: 0; overflow: auto; padding: 1rem 1.2rem; }
.viewer-header { display: flex; flex: none; align-items: center; justify-content: space-between; gap: .55rem; border-bottom: 1px solid var(--line); padding: .65rem 1rem; }
.viewer-header h2 { font-size: clamp(1.05rem, 2.4vw, 1.65rem); }
.research-dialog { width: min(96vw, 77rem); height: 90dvh; padding: 0; }
.research-dialog[open] { display: flex; flex-direction: column; }
.research-reader { min-width: 0; min-height: 0; display: grid; grid-template-columns: 14rem minmax(0, 1fr); flex: 1; }
.reader-sidebar { overflow: auto; background: var(--band); border-right: 1px solid var(--line); padding: .85rem; }
.reader-sidebar label { font-size: .875rem; font-weight: 650; }
#paper-select { display: none; }
#paper-nav { display: grid; gap: .2rem; }
#paper-nav button { display: grid; text-align: left; background: transparent; border: 1px solid transparent; padding: .45rem; }
#paper-nav button:hover, #paper-nav button.selected { background: var(--white); border-color: var(--line); }
#paper-nav button > span { color: var(--muted); font-size: .8rem; }
#paper-nav button > strong { font-size: .9rem; }
.collection-download { display: inline-block; margin-top: .7rem; font-size: .9rem; }
.paper-heading > p { color: var(--muted); }
.paper-heading h3 { margin-block: .15rem; font-size: clamp(1.18rem, 2vw, 1.6rem); }
.page-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .4rem 0; background: var(--white); position: sticky; top: -1rem; z-index: 1; }
.page-toolbar input { width: 3.75rem; }
#page-zoom { margin-left: auto; }
.paper-stage { background: var(--band); border: 1px solid var(--line); padding: .6rem; }
.paper-stage img { width: auto; max-width: 100%; max-height: 70dvh; margin-inline: auto; }
.paper-stage.zoomed { max-height: 55dvh; overflow: auto; }
.paper-stage.zoomed img { width: max(100%, 50rem); max-width: none; max-height: none; }
.paper-text { padding-top: .6rem; }
.paper-text pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.media-dialog { width: min(96vw, 74rem); padding: 0; }
.media-dialog[data-kind="video"] { width: min(94vw, 58rem, 140dvh); }
#media-stage { background: #101819; }
#media-stage iframe { display: block; width: 100%; height: min(70dvh, 48rem); border: 0; }
.media-dialog[data-kind="video"] iframe { height: auto; aspect-ratio: 16 / 9; }
#media-stage:fullscreen iframe { width: 100%; height: 100%; }
#media-help { padding: .55rem 1rem; font-size: .875rem; color: var(--muted); }

@media (max-width: 920px) {
  .game-feature { grid-template-columns: 1fr; }
  .game-visual { aspect-ratio: 1536 / 800; }
  #main {
    --trace-one: .66;
    --ribbon-lead: 1.5px;
    --ribbon-lead-seam: #c99ba4;
  }
  .section-rail polyline + polyline, .hero-traces::after { display: none; }
}

@media (max-width: 800px) {
  .engineering-layout, .about-section .section, .video-program { grid-template-columns: minmax(0, 1fr); }
  .pass-study { max-width: 45rem; }
  .study-header { padding-block: .18rem; }
  #paper-select { width: 100%; min-width: 0; max-width: 100%; }
  .reader-sidebar { min-width: 0; }
  :root { --header: 62px; }
  .menu-toggle { display: inline-flex; }
  #main-nav { display: none; }
  #main-nav.open {
    position: absolute; left: 0; right: 0; top: 100%; display: grid; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: .3rem var(--gutter) .7rem;
  }
  #main-nav a { padding-block: .55rem; }
  .paper-row { align-items: start; flex-direction: column; gap: 0; padding-bottom: .25rem; }
  .research-reader { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .reader-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .5rem .65rem; }
  #paper-select { display: block; width: 100%; }
  #paper-nav, .reader-sidebar .collection-download { display: none; }
  .reader-document { padding-inline: .65rem; }
}
@media (max-width: 680px) {
  #main { --hero-art-start: 0%; }
  .hero-layout { min-height: auto; padding-block-end: 2rem; }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: clamp(2.8rem, 12vw, 5.15rem); }
  .hero-art { position: relative; inset: auto; height: clamp(9rem, 41vw, 15rem); }
  .hero-monogram { left: 61%; height: 86%; }

}
@media (max-width: 600px) {
  .math-lab { grid-template-columns: minmax(0, 1fr); }
  .video-grid .video-card { grid-template-columns: minmax(6rem, 34%) minmax(0, 1fr); gap: .12rem .85rem; }
  .video-grid .video-length { font-size: .75rem; }
  .heading-with-link { align-items: start; flex-direction: column; }
  .archive-search { width: 100%; }
  .paper-row-actions { column-gap: .8rem; }
  .math-lab { gap: 1rem; }
  #page-zoom { margin-left: 0; }
}

@media (max-width: 420px) {
  .research-group > summary { grid-template-columns: minmax(0, 1fr) .65rem; gap: .35rem .75rem; }
  .research-group > summary::after { grid-column: 2; grid-row: 1 / span 2; }
  .group-count { grid-column: 1; grid-row: 2; }
  .study-header { column-gap: .3rem; }
  .study-header h3 { font-size: 1.05rem; }
  .study-switch button { padding-inline: .38rem; }
}
