.cover {
  --tear-start: 571px;
  --suffix-indent: 38px;
  --cover-title-top: 358px;
  --cover-title-size: 144px;
  --cover-title-tracking: -8px;
  --paper-edge: polygon(
    1.2% 0, 100% 0, 100% 100%, 1.7% 100%, 1.3% 97.6%, 2% 95.1%,
    .9% 93%, 1.1% 91.8%, .3% 89.5%, .9% 87%, 1.4% 85.9%, .6% 83.7%,
    1.9% 80.4%, 1.6% 79.3%, 2.2% 77.5%, 1.5% 74.9%, 1.8% 73.4%,
    .7% 70.2%, 1.1% 68.7%, .4% 65.8%, .8% 64.1%, 1.7% 61%,
    1.2% 59.8%, 1.5% 57.7%, .5% 54.6%, .8% 52.3%, .1% 49.4%,
    .7% 47.3%, .4% 45.1%, 1.6% 41.7%, 1.2% 39.6%, 2.1% 37.2%,
    1.4% 34.8%, 1.7% 32.7%, .6% 29.6%, 1% 28.1%, .4% 26.3%,
    1.2% 22.8%, .9% 21.2%, 2% 18.5%, 1.6% 15.9%, 2.3% 14.2%,
    1.6% 11.4%, 1.8% 10.2%, .7% 7.8%, 1.2% 5.3%, .6% 2.7%
  );
  isolation: isolate;
  overflow: hidden;
}

#stage:has(.cover.active) .topline { z-index: 1; }

.cover .cover-heading {
  position: absolute;
  inset: var(--cover-title-top) var(--slide-gutter) auto;
  z-index: 1;
  font-size: var(--cover-title-size);
  letter-spacing: var(--cover-title-tracking);
  line-height: 1;
  white-space: nowrap;
}

.cover-suffix {
  position: absolute;
  top: 0;
  left: calc(var(--tear-start) + var(--suffix-indent) - var(--slide-gutter));
}

.cover-underlay {
  position: absolute;
  inset: 0 0 0 var(--tear-start);
  visibility: hidden;
  filter: drop-shadow(-2px 0 3px #463d3029);
  pointer-events: none;
}

.cover-underlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e9e1d5, #fffdfa 34px);
  clip-path: var(--paper-edge);
}

.cover-replacement { visibility: hidden; }
.cover-replacement.shown { visibility: visible; }
.cover:has(.cover-replacement.shown) .cover-start { visibility: hidden; }
.cover:has(.cover-replacement.shown) .cover-underlay { visibility: visible; }

.cover-scrap { display: none; }

@media screen {
  :root[data-motion="full"] .cover.active:has(.cover-replacement.shown) .cover-scrap {
    position: absolute;
    inset: 0 0 0 var(--tear-start);
    z-index: 2;
    display: block;
    pointer-events: none;
    transform-origin: left bottom;
    filter: drop-shadow(7px 8px 13px #3c302e3b);
    animation: cover-rip 1.42s cubic-bezier(.35, .08, .42, 1) both;
  }

  :root[data-motion="full"] .cover-scrap-paper {
    position: absolute;
    inset: 0;
    background: linear-gradient(94deg, #fffdfa, #e9e1d5 23px, var(--paper) 106px);
    clip-path: var(--paper-edge);
  }

  :root[data-motion="full"] .cover-scrap-paper span {
    position: absolute;
    top: var(--cover-title-top);
    left: var(--suffix-indent);
    font-size: var(--cover-title-size);
    font-weight: 700;
    letter-spacing: var(--cover-title-tracking);
    line-height: 1;
    white-space: nowrap;
  }

  :root[data-motion="full"] .cover.active .cover-replacement.shown { animation: cover-reveal 520ms 390ms ease-out both; }
}

@keyframes cover-rip {
  0% { transform: perspective(1300px) translate(0, 0) rotate(0deg) rotateY(0deg); }
  28% { transform: perspective(1300px) translate(0, -2px) rotate(3deg) rotateY(-6deg); }
  57% { transform: perspective(1300px) translate(9px, 0) rotate(9deg) rotateY(-12deg); }
  75% { transform: perspective(1300px) translate(245px, 62px) rotate(13deg) rotateY(-19deg); }
  100% { transform: perspective(1300px) translate(1140px, 306px) rotate(21deg) rotateY(-27deg); }
}

@keyframes cover-reveal {
  from { opacity: 0; }
  to { transform: none; opacity: 1; }
}

.control h2,
.pyramid h2 {
  position: absolute;
  left: var(--slide-gutter);
  top: 260px;
  margin: 0;
  width: 765px;
  font-size: 92px;
}

.control-figure {
  position: absolute;
  top: 233px;
  right: 85px;
  width: 555px;
}

.control-dependencies { stroke-width: 3.6px; }
.dependency-cross { stroke-width: 3px; }
.dependency-knot { stroke-width: 2.8px; }

@media screen {
  :root[data-motion="full"] .control.active .control-dependencies.shown {
    --dependency-cycle: 10s;
    animation: dependency-reset var(--dependency-cycle) linear infinite;
  }

  :root[data-motion="full"] .control.active .control-dependencies.shown path {
    stroke-dasharray: 1 1;
    animation: var(--dependency-draw) var(--dependency-cycle) linear infinite;
  }

  :root[data-motion="full"] .dependency-first { --dependency-draw: dependency-draw-first; }
  :root[data-motion="full"] .dependency-spread { --dependency-draw: dependency-draw-spread; }
  :root[data-motion="full"] .dependency-cross { --dependency-draw: dependency-draw-cross; }
  :root[data-motion="full"] .dependency-knot { --dependency-draw: dependency-draw-knot; }
}

@keyframes dependency-draw-first {
  0% { stroke-dashoffset: 1; }
  17%, 100% { stroke-dashoffset: 0; }
}

@keyframes dependency-draw-spread {
  0%, 13% { stroke-dashoffset: 1; }
  35%, 100% { stroke-dashoffset: 0; }
}

@keyframes dependency-draw-cross {
  0%, 29% { stroke-dashoffset: 1; }
  53%, 100% { stroke-dashoffset: 0; }
}

@keyframes dependency-draw-knot {
  0%, 46% { stroke-dashoffset: 1; }
  69%, 100% { stroke-dashoffset: 0; }
}

@keyframes dependency-reset {
  0%, 88% { opacity: 1; }
  96%, 100% { opacity: 0; }
}

.control-figure svg,
.complexity-figure svg,
.distribution-art svg {
  display: block;
  width: 100%;
}

.complexity h2,
.distribution h2 {
  margin-top: 46px;
  font-size: 88px;
}

.complexity-figure {
  position: absolute;
  inset: 310px var(--slide-gutter) auto;
  margin: 0;
}

.chart-axis {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}

.chart-essential { stroke: var(--ink); }
.chart-total { stroke: var(--red); }
.chart-gap { fill: var(--red); fill-opacity: .12; }
.chart-label { font-size: 27px; fill: var(--ink); }
.chart-total-label { fill: var(--red); }

.complexity-figure figcaption {
  margin-top: 7px;
  font-size: 18px;
  color: var(--muted);
}

.content h2 {
  max-width: 1300px;
  margin-top: 52px;
  font-size: 88px;
}

.course-list {
  position: absolute;
  inset: 450px 120px auto;
  display: grid;
}

.course-list-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 36px;
}

.course-list p {
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
  font-size: 34px;
  line-height: 1.2;
}

.tag-cloud .course-list {
  inset: 345px 165px 170px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 34px 40px;
}

.tag-cloud .course-list p {
  padding: 22px 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wash);
  font-size: 30px;
}

.tag-cloud .course-list p:nth-child(1) { rotate: -4deg; }
.tag-cloud .course-list p:nth-child(2) { rotate: 3deg; }
.tag-cloud .course-list p:nth-child(3) { rotate: -2deg; }

.closing-reveal,
.test-result {
  position: absolute;
  left: 120px;
  bottom: 138px;
  max-width: 1200px;
  font-size: 34px;
  line-height: 1.3;
  color: var(--red);
}

.has-code h2 {
  margin-top: 40px;
  font-size: 76px;
  line-height: 1.06;
}

.code-example {
  position: absolute;
  inset: 365px 120px auto;
  padding: 25px 30px;
  margin: 0;
  border-left: 3px solid var(--red);
  background: #e7eae354;
  font: 27px/1.55 'Courier New', monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.test-result { font: 29px/1.4 'Courier New', monospace; }
.test-passed { color: var(--success); }
.refactor-code { visibility: hidden; }
.refactor-code.shown { visibility: visible; }
.slide:has(.refactor-code.shown) .code-before-refactor { visibility: hidden; }
.quote-attribution {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 22px;
}
.closing-reveal:has(.red) { color: var(--ink); }

.agent-stack h2 {
  margin-top: 44px;
  font-size: 88px;
}

.agent-stack-figure {
  position: absolute;
  inset: 302px var(--slide-gutter) auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 475px;
  align-items: center;
  gap: 90px;
}

.agent-stack-legend { margin: 0; }

.agent-layer {
  padding: 17px 0 17px 22px;
  border-left: 4px solid var(--ring-color);
}

.agent-layer + .agent-layer { margin-top: 12px; }
.agent-layer dt { font-size: 32px; font-weight: 700; }
.agent-layer dd { margin: 6px 0 0; font-size: 25px; line-height: 1.3; }

.agent-stack-rings {
  position: relative;
  aspect-ratio: 1;
}

.agent-ring {
  position: absolute;
  inset: calc((100% - var(--ring-size)) / 2);
  border: 4px solid var(--ring-color);
  border-radius: 50%;
}

.agent-stack-rings [data-reveal] { transform: none; }
.agent-layer-model { --ring-color: #a87818; --ring-size: 18%; }
.agent-layer-harness { --ring-color: #336c9c; --ring-size: 39%; }
.agent-layer-agent { --ring-color: var(--ink); --ring-size: 58%; }
.agent-ring.agent-layer-agent { border-style: dashed; }
.agent-layer-environment { --ring-color: var(--red); --ring-size: 100%; }


.pyramid-art {
  position: absolute;
  top: 252px;
  right: 108px;
  width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pyramid-tier {
  display: grid;
  place-items: center;
  height: 108px;
  font-size: 31px;
}

.pyramid-tier.e2e {
  width: 190px;
  height: 170px;
  padding-top: 72px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: var(--red);
  color: var(--paper);
}

.pyramid-tier.integration {
  width: 370px;
  clip-path: polygon(24% 0, 76% 0, 100% 100%, 0 100%);
  background: var(--wash);
}

.pyramid-tier.unit {
  width: 560px;
  clip-path: polygon(17% 0, 83% 0, 100% 100%, 0 100%);
  background: #d7ded3;
}

.distribution-art {
  position: absolute;
  inset: 390px 160px auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 44px;
}

.distribution-art figure {
  display: grid;
  justify-items: center;
  margin: 0;
}

.distribution-art svg {
  width: 340px;
  font-size: 17px;
}

.distribution-art figcaption {
  margin-top: 18px;
  font-size: 29px;
}

.tdd-cycle {
  position: absolute;
  inset: 434px 120px auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 55px;
}

.tdd-cycle > div {
  border-top: 3px solid var(--red);
  padding-top: 26px;
}

.tdd-cycle > div:nth-child(2) { border-color: var(--success); }
.tdd-cycle > div:nth-child(3) { border-color: var(--ink); }
.tdd-cycle strong { font-size: 53px; letter-spacing: -2px; }
.tdd-cycle p { margin-top: 14px; font-size: 24px; color: var(--muted); }

.statement h2 {
  position: absolute;
  top: 230px;
  left: var(--slide-gutter);
  margin: 0;
  max-width: 1368px;
  font-size: 105px;
}

.statement .closing-reveal {
  bottom: 177px;
  font-size: 42px;
}

.bridge h2 {
  position: absolute;
  top: 295px;
  left: var(--slide-gutter);
  max-width: 730px;
  margin: 0;
  font-size: 100px;
}

.bridge-art {
  position: absolute;
  top: 190px;
  right: 36px;
  width: 790px;
  height: auto;
}

.bridge-incoming { visibility: hidden; }

@media screen {
  :root[data-motion="full"] .bridge.active .bridge-incoming { visibility: visible; }

  :root[data-motion="full"] .bridge.active .bridge-incoming path {
    stroke-dasharray: 1 1;
    animation: bridge-trace 2.7s .15s ease-in-out both;
  }

  :root[data-motion="full"] .bridge.active .bridge-incoming path:nth-child(2) { animation-delay: .5s; }
  :root[data-motion="full"] .bridge.active .bridge-incoming path:nth-child(3) { animation-delay: 1.55s; }
  :root[data-motion="full"] .bridge.active .bridge-incoming path:nth-child(4) { animation-delay: 1.85s; }
  :root[data-motion="full"] .bridge.active .bridge-incoming path:nth-child(5) { animation-delay: 2.8s; }

  :root[data-motion="full"] .bridge.active .bridge-timber {
    animation: bridge-assemble 1.3s 1.95s ease-out both;
  }

  :root[data-motion="full"] .bridge.active .bridge-timber[data-assembly="2"] { animation-delay: 3.45s; }
  :root[data-motion="full"] .bridge.active .bridge-timber[data-assembly="3"] { animation-delay: 4.75s; }

  :root[data-motion="full"] .bridge.active .bridge-guides {
    animation: bridge-assemble 1.1s 5.75s ease-out backwards;
  }
}

@keyframes bridge-trace {
  0% { stroke-dashoffset: 1; opacity: 0; }
  8% { opacity: 1; }
  70% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes bridge-assemble {
  from { opacity: 0; }
}

@media print {
  .cover-start, .code-before-refactor { display: none; }
  .refactor-code { visibility: visible; }
  .cover-underlay, .cover-replacement { visibility: visible; }
}
