.lab-page .sheet {
  color: var(--ink);
  font-size: clamp(.875rem, 1.112cqw, 1rem);
  line-height: 1.65;
}

:where(.lab-page) :where(h2, h3, p, ol) { margin: 0; }
.lab-page ol { padding: 0; list-style: none; counter-reset: item; }
.lab-page li { counter-increment: item; }
.lab-page img { display: block; height: auto; pointer-events: none; }

.lab-heading, .doors-lead, .doors-art, .doors-note, .intro-copy, .intro-art,
.intro-caption, .intro-rule, .log-lead, .log-art, .log-list, .log-note,
.open-art, .open-rule, .open-caption, .open-copy { position: absolute; }

.lab-heading { top: 18.7%; left: 7.78%; }
.lab-label, .ribbon-copy small, .log-list li::before, .principles li::before {
  font-family: var(--mono);
}

.lab-label {
  display: flex;
  align-items: center;
  gap: .95cqw;
  color: #59745c;
  font-size: max(.64rem, .695cqw);
  line-height: 1.4;
  letter-spacing: .13em;
  font-weight: 700;
}
.lab-label::before {
  content: "";
  display: block;
  width: .72em;
  height: .72em;
  border: 1px solid #77917a;
  border-radius: 50%;
  background: radial-gradient(circle, #77917a 24%, transparent 29%);
}

.lab-heading h2 {
  margin-top: .75cqw;
  margin-left: -.035em;
  font-size: 4.72cqw;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
}
.lab-heading h2 > span {
  display: block;
  font-size: .618em;
  line-height: 1.25;
  color: #41564a;
}
.lab-heading h2 em { color: #b77e66; font-style: normal; }
.lab-heading h2 i {
  color: #d78f77;
  font-family: var(--serif);
  font-style: normal;
}
.lab-page .lab-deck, .principles h3 {
  font-size: clamp(1.125rem, 1.806cqw, 1.625rem);
  font-weight: 500;
  line-height: 1.6;
}

/* The two diagonal bands each carry one link; the type repeats as part of the print. */
#doors { overflow: hidden; }
.doors-lead { top: 40.7%; left: 7.78%; color: var(--muted); }
.doors-art { width: 27.92%; left: 61.8%; top: 60.37%; }
.doors-note { right: 7.8%; top: 86.3%; max-width: 58%; color: var(--muted); }
.door-ribbons {
  position: absolute;
  left: 50%;
  top: 39.5%;
  width: 155%;
  transform: translateX(-50%) rotate(-15deg);
  transform-origin: center top;
}
.door-ribbon {
  position: relative;
  display: flex;
  align-items: center;
  height: 8.2cqw;
  border-top: 1px solid #d8d9d4;
  color: #344d3b;
  text-decoration: none;
}
.error-ribbon {
  height: 9.65cqw;
  border-bottom: 1px solid #d8d9d4;
  color: #493e3a;
}
.ribbon-copy {
  --repeat: 38.6cqw;
  position: absolute;
  left: calc(50% - 28.1cqw);
  display: flex;
  align-items: flex-end;
  gap: 1.35cqw;
  font-size: 1.67cqw;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: var(--repeat) 0 currentColor, calc(-1 * var(--repeat)) 0 currentColor;
}
.error-ribbon .ribbon-copy { --repeat: 41.1cqw; left: calc(50% - 9.15cqw); }
.ribbon-copy strong {
  font: 700 4.8cqw/1 var(--serif);
  letter-spacing: -.035em;
}
.ribbon-copy small {
  display: block;
  margin-bottom: .2em;
  font-size: max(.57rem, .69cqw);
  letter-spacing: .095em;
  font-weight: 700;
}
.flow-band {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, #dce8d9 0 46%, #f0e0d6 46% 100%);
  clip-path: inset(50% 0 50%);
  pointer-events: none;
}
.door-ribbon { overflow: hidden; }
.flow-track {
  display: flex;
  align-items: center;
  flex: none;
  width: max-content;
  animation: flow-type var(--flow-duration, 16s) linear infinite paused;
}
.flow-track .ribbon-copy {
  position: static;
  flex: none;
  padding-right: max(1.5rem, 3.4cqw);
  text-shadow: none;
}
.error-ribbon .flow-track { animation-direction: reverse; }
.flow-visible .flow-track { animation-play-state: running; }
.door-ribbon:focus-visible .flow-track { animation-play-state: paused; }
@keyframes flow-type { to { transform: translateX(calc(0px - var(--flow-step))); } }
@media (prefers-reduced-motion: reduce) {
  .flow-track { animation: none; }
}

.door-ribbon:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }

#about .lab-heading em { position: relative; }
#about .lab-heading em::after {
  content: "";
  position: absolute;
  bottom: -.08em;
  left: 4%;
  width: 90%;
  border-bottom: 1px solid #daa88f;
  border-radius: 60%;
}
.intro-copy { top: 19.45%; left: 56.5%; right: 5.9%; color: var(--muted); }
.intro-copy .lab-deck { margin-bottom: 2.7cqw; color: var(--ink); }
.intro-copy > p:nth-child(3) { margin-top: 1.9cqw; line-height: 1.8; }
.intro-footnote {
  margin-top: 1.5cqw;
  padding-top: 2cqw;
  background: linear-gradient(#c2d0bc, #c2d0bc) no-repeat left top / 2.5cqw 1px;
  font-size: max(.685rem, .695cqw);
}
.intro-footnote::before { content: "✳"; margin-right: .7em; color: #b27b50; }
.intro-copy .intro-signoff {
  margin-top: 3.3cqw;
  color: #b77e66;
  font: italic 1.04em/1.6 "Times New Roman", var(--serif);
}
.intro-art { top: 52.47%; left: 7.99%; width: 30.42%; }
.intro-caption, .open-caption {
  left: 7.78%;
  color: var(--muted);
  font-family: var(--serif);
}
.intro-caption { top: 75.25%; }
.intro-rule {
  left: 7.78%;
  right: 7.78%;
  top: 87%;
  border-top: 1px solid #c2d0bc;
}
.intro-rule::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  height: 8px;
  border-left: 1px solid #b4c6b1;
}

.log-lead { left: 8%; top: 42.4%; }
.log-art { top: 55.7%; left: 8.125%; width: 24.03%; }
.log-list { left: 38.47%; right: 7.78%; top: 20.12%; border-top: 1px solid #c2d0bc; }
.log-list li {
  display: grid;
  grid-template-columns: 1.85cqw 4.8cqw minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.8cqw;
  min-height: 8.37cqw;
  padding-right: 1.1cqw;
  border-bottom: 1px solid #c2d0bc;
}
.log-list li::before, .principles li::before { content: counter(item, decimal-leading-zero); }
.log-list li::before, .log-list small, .log-note { color: var(--muted); font-size: max(.685rem, .7cqw); }
.log-list small { white-space: nowrap; }
.log-list img { width: 100%; }
.log-list h3 {
  font: 700 clamp(1.05rem, 1.805cqw, 1.625rem)/1.2 var(--serif);
  letter-spacing: -.025em;
}
.log-list p { margin-top: 1.1cqw; line-height: 1.5; color: var(--muted); }
.log-note { top: 88.5%; left: 38.7%; right: 7%; }

#open .lab-heading h2, #open .lab-heading h2 > span { color: var(--ink); font-weight: 700; }
.open-art { top: 48.15%; left: 10.97%; width: 25%; }
.open-rule {
  top: 78.75%;
  left: 7.78%;
  width: 31.67%;
  height: 7px;
  border: solid #bacab4;
  border-width: 0 1px 1px;
  background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), #bacab4 0 25%) bottom/100% 3px no-repeat;
}
.open-caption { top: 83.8%; }
.open-copy { left: 49.58%; right: 7.78%; top: 19.45%; }
.open-copy > p + p { margin-top: .1cqw; }
.principles { margin-top: .6cqw; }
.principles li {
  position: relative;
  min-height: 8.78cqw;
  padding: 1.28cqw 0 1.36cqw 4cqw;
  border-top: 1px solid #d4ddce;
}
.principles li:first-child { min-height: 9.2cqw; }
.principles li::before {
  position: absolute;
  top: 1.95cqw;
  left: 0;
  color: #a76348;
  font-size: .95em;
  letter-spacing: .05em;
}
.principles p { margin-top: .62cqw; }
.lab-github {
  display: inline-block;
  margin-top: 1.1cqw;
  color: var(--muted);
  font-size: max(.73rem, .7cqw);
  text-underline-offset: .2em;
}

@media (min-width: 761px) and (max-width: 1000px) {
  #open .sheet { aspect-ratio: auto; min-height: 40rem; }
}

@media (max-width: 760px) {
  .lab-page .sheet { padding: 5.5rem 7% 3.5rem; font-size: 1rem; }
  .lab-page .sheet > :not(.door-ribbons), .door-ribbons { position: static; }
  .lab-label { gap: .65rem; }
  .lab-heading h2 { margin-top: .9rem; font-size: clamp(2.1rem, 7.8vw, 3.8rem); }
  .lab-heading h2 > span { margin-bottom: .2em; }
  .doors-lead, .log-lead { margin-top: 1.4rem; }
  .door-ribbons {
    width: auto;
    margin: 2.3rem -2% 1.3rem;
    transform: rotate(-4deg);
    transform-origin: center;
  }
  .door-ribbon { height: auto; min-height: 5.4rem; padding: .85rem 0; }
  .flow-track .ribbon-copy { padding-inline: .5rem 2rem; white-space: nowrap; }
  .ribbon-copy {
    position: static;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .875rem;
    text-shadow: none;
    white-space: normal;
  }
  .ribbon-copy strong { font-size: clamp(2.35rem, 8.5vw, 3.5rem); }
  .ribbon-copy small { margin-bottom: .4em; font-size: .62rem; line-height: 1.4; }
  .doors-art { width: min(56%, 16rem); margin: 1.6rem 0 1rem auto; }
  .doors-note { max-width: none; }
  .intro-copy, .open-copy { margin-top: 2rem; }
  .intro-copy .lab-deck { margin-bottom: 1.4rem; }
  .intro-copy > p:nth-child(3) { margin-top: 1rem; }
  .intro-copy br, .open-copy br { display: none; }
  .intro-footnote { margin-top: 1.3rem; font-size: .8rem; }
  .intro-footnote { padding-top: .8rem; background-size: 2.5rem 1px; }
  .intro-copy .intro-signoff { margin-top: 1.1rem; }
  .intro-art { width: min(77%, 24rem); margin: 2rem 0 1rem; }
  .intro-rule { margin-top: 2.4rem; }
  .intro-rule::before { display: none; }
  .log-art { width: min(65%, 18rem); margin: 1.25rem 0; }
  .log-list li {
    grid-template-columns: 1.2rem 2.7rem minmax(0, 1fr);
    gap: .15rem .7rem;
    min-height: 0;
    padding: 1.05rem 0;
  }
  .log-list li::before, .log-list img { grid-row: span 2; }
  .log-list li small { grid-column: 3; font-size: .72rem; }
  .log-list h3 { font-size: 1.25rem; }
  .log-list p { margin-top: .35rem; font-size: .9rem; }
  .log-note { margin-top: 1.3rem; font-size: .78rem; }
  .open-art { width: min(60%, 16rem); margin: 2rem 0 .8rem; }
  .open-rule { width: min(73%, 22rem); }
  .open-caption { margin-top: .8rem; }
  .open-copy > p + p { margin-top: .7rem; }
  .principles { margin-top: 1.35rem; }
  .principles li { min-height: 0; padding: 1rem 0 1.2rem 2.1rem; }
  .principles li:first-child { min-height: 0; }
  .principles li::before { top: 1.3rem; }
  .principles p { margin-top: .35rem; }
  .lab-github { margin-top: .65rem; font-size: .8rem; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .flow-track { width: 100%; }
  .flow-track .ribbon-copy { width: 100%; padding-inline: .4rem; white-space: normal; }
  .flow-track .ribbon-copy[aria-hidden] { display: none; }
}
