.shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

html.is-stage,
html.is-stage body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.is-stage .shell {
  position: fixed;
  inset: 0;
  min-height: 0;
}

.scenes {
  position: relative;
  min-height: 0;
}

html.is-stage .scenes {
  overflow: hidden;
  touch-action: pinch-zoom;
}

.scene {
  display: grid;
  align-content: center;
  padding-block: var(--section);
}

.scene + .scene {
  border-top: 1px solid var(--line);
}

html.is-stage .scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  align-content: safe center;
  padding-block: var(--s-7);
  border-top: 0;
  visibility: hidden;
}

html.is-stage .scene[data-active],
html.is-stage .scene[data-leaving] {
  visibility: visible;
}

html.is-stage .scene[data-leaving] {
  pointer-events: none;
}

.scene-body {
  container-type: inline-size;
}

.scene-term .scene-body {
  display: grid;
  grid-template-columns: 8ch minmax(0, 1.618fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--s-7);
}

.numeral {
  padding-top: var(--s-4);
}

.term h2 {
  font-size: var(--t-h1);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.outcome {
  max-width: 34ch;
  margin-top: var(--s-6);
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--muted);
}

.fact {
  display: grid;
  gap: var(--s-3);
  padding-top: var(--s-4);
}

.fact .label {
  margin-bottom: var(--s-3);
}

.record {
  font-size: var(--t-lead);
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

a.record {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  width: fit-content;
  min-height: 44px;
}

a.record:hover,
a.record:focus-visible {
  text-decoration: underline;
}

.metric {
  font-size: var(--t-small);
  font-variant-numeric: tabular-nums;
}

.note {
  font-size: var(--t-small);
  color: var(--muted);
}

.command {
  font-size: var(--t-small);
  overflow-wrap: anywhere;
}

.command::before {
  content: "$ ";
  color: var(--muted);
}

.commit-line a {
  display: block;
  min-height: 44px;
  padding-block: var(--s-3);
  font-size: var(--t-small);
  line-height: 1.5;
  text-decoration: none;
}

.commit-line .mono {
  margin-right: var(--s-3);
  color: var(--muted);
}

.commit-line a:hover,
.commit-line a:focus-visible,
.note-link:hover,
.note-link:focus-visible {
  text-decoration: underline;
}

.note-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  width: fit-content;
  min-height: 44px;
  font-size: var(--t-small);
  text-decoration: none;
}

.scene-signed .scene-body {
  display: grid;
  grid-template-columns: 8ch minmax(0, 1fr);
  align-items: start;
  gap: var(--s-7);
}

.signatures {
  display: grid;
  gap: var(--s-7);
  width: fit-content;
  text-decoration: none;
}

.faces {
  display: flex;
  gap: var(--s-4);
  max-width: 100%;
}

.faces img {
  display: block;
  flex: 0 1 var(--s-10);
  min-width: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity var(--d-3) var(--ease-std);
}

.signed-by {
  font-size: var(--t-h2);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.signatures:hover .faces img,
.signatures:focus-visible .faces img {
  opacity: 1;
}

.signatures:hover .signed-by,
.signatures:focus-visible .signed-by {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.address {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  font-size: min(var(--t-display), 10cqi);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
  text-decoration: none;
}

.address:hover,
.address:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: max(1px, 0.02em);
  text-underline-offset: 0.12em;
}

.stage-bar {
  display: none;
}

html.is-stage .stage-bar {
  display: block;
}

.stage-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  min-height: var(--s-8);
  border-top: 1px solid var(--line);
}

.scene-index {
  position: relative;
}

.scene-index ol {
  display: flex;
}

.scene-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--d-3) var(--ease-std);
}

.scene-index a:hover,
.scene-index a:focus-visible,
.scene-index a[aria-current] {
  color: var(--fg);
}

.scene-index .marker {
  position: absolute;
  top: var(--s-4);
  left: calc(22px - var(--s-3) / 2);
  width: var(--s-3);
  height: var(--s-3);
  color: var(--fg);
  pointer-events: none;
  transform: translateX(calc(var(--at, 0) * 44px));
  transition: transform var(--d-5) var(--ease-leap);
}

.stage-copy {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  color: var(--muted);
}

.scene-name {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 999px) {
  .scene-term .scene-body {
    grid-template-columns: 5ch minmax(0, 1fr);
    gap: var(--s-6);
  }

  .fact {
    grid-column: 2;
    padding-top: 0;
  }

  .scene-signed .scene-body {
    grid-template-columns: 5ch minmax(0, 1fr);
    gap: var(--s-6);
  }
}

@media (max-width: 559px) {
  .scene-term .scene-body,
  .scene-signed .scene-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-5);
  }

  .fact {
    grid-column: auto;
  }

  .stage-copy,
  .scene-name {
    display: none;
  }
}
