/* Hallmark · route: custom (bespoke) · structure: manga chapter (cover spread → gag strip → yonkoma → panel pages → beta-flash finale → colophon)
 * idea: "the word mouths its own name off-beat" · nav: N7 brutal slab · footer: Ft4 dense colophon
 * paper: oklch(95.8% 0.007 95) · accent: none, ink only · display: Dela Gothic One · body: Shantell Sans
 * axes: light / display-heavy / neutral · tokens: tokens.css
 */

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-letter);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
figure,
dl,
dd,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

a,
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: var(--z-modal);
  padding: 0.6em 1em;
  background: var(--color-ink);
  color: var(--color-paper);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ------------------------------------------------------------------ ink classes used inside the SVG art */
.logo,
.sfx {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.f-ink { fill: var(--color-ink); }
.f-paper { fill: var(--color-paper); }

.f-tone2 { fill: url(#tone2); }

.nf { fill: none; }
.s-ink { stroke: var(--color-ink); }

/* ------------------------------------------------------------------ logo: ink letters, paper gap, ink edge, halftone drop */
.logo {
  overflow: visible;
  height: auto;
}

.logo .lf-shadow {
  fill: url(#tone-shadow);
  stroke: url(#tone-shadow);
  stroke-width: 20px;
}

.logo .lf-edge {
  fill: var(--color-ink);
  stroke: var(--color-ink);
  stroke-width: 24px;
}

.logo .lf-gap {
  fill: var(--color-ink);
  stroke: var(--color-paper);
  stroke-width: 10.5px;
}

.logo .lf-fill {
  fill: var(--color-ink);
}

.lf-mouth {
  transform-box: fill-box;
  transform-origin: 50% 0;
}

.logo--hero {
  width: min(100%, 31rem);
  filter: url(#ink-rough);
}

.logo--nav {
  width: 8.5rem;
}

.logo--stacked {
  width: 11rem;
}

/* ------------------------------------------------------------------ page + chapters */
.page {
  --page-pad: clamp(16px, 4vw, 40px);
  position: relative;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.chapter {
  padding-block: var(--space-2xl) var(--space-lg);
}

.chapter--cover {
  padding-block: var(--space-lg) var(--space-lg);
}

.chapter__title {
  min-width: 0;
  text-wrap: balance;
  margin-bottom: var(--space-xl);
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.chapter__head {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.chapter__head .chapter__title {
  margin-bottom: 0;
}

.chapter__sub {
  max-width: 46ch;
  font-size: var(--text-md);
}

/* Folios: page numbers in the outer corner, like a printed volume */
.folio {
  width: fit-content;
  margin-top: var(--space-lg);
  padding: 0 var(--space-2xs);
  background: var(--color-paper);
  font-family: var(--font-display);
  font-size: var(--text-sm);
}

.folio--odd {
  margin-inline-start: auto;
}

/* ------------------------------------------------------------------ masthead (N7 slab) */
.masthead {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--color-paper);
  border-bottom: var(--rule-panel) solid var(--color-ink);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  max-width: 1240px;
  margin-inline: auto;
  padding: var(--space-xs) clamp(16px, 4vw, 40px);
}

.masthead__brand {
  display: block;
  flex: none;
}

.masthead .btn--dl {
  margin-inline-start: auto;
}

.is-mobile .masthead .btn--dl {
  display: none;
}

@media (max-width: 26rem) {
  .masthead__inner {
    gap: var(--space-md);
  }

  .logo--nav {
    width: 7rem;
  }

  .masthead .btn--sm {
    padding: 0.45em 0.75em;
    font-size: var(--text-sm);
  }
}

/* ------------------------------------------------------------------ panels
 * A panel is ink with a paper body inset by the rule width. Angled panels clip
 * both layers with the same polygon; the inset shift draws the slanted border. */
.panel {
  position: relative;
  padding: var(--rule-panel);
  background: var(--color-ink);
}

.panel__body {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--color-paper);
}

/* narration box */
.caption {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: var(--z-raised);
  max-width: min(78%, 22rem);
  padding: 0.4em 0.7em;
  background: var(--color-paper);
  border: var(--rule-thin) solid var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.caption--ink {
  background: var(--color-ink);
  color: var(--color-paper);
  border-color: var(--color-paper);
  outline: var(--rule-thin) solid var(--color-ink);
}

/* ------------------------------------------------------------------ speech bubbles: real text, drawn edges */
.bubble {
  --bw: 3px;
  position: absolute;
  top: var(--ym, var(--y, 0));
  left: var(--xm, var(--x, 0));
  z-index: var(--z-raised);
  width: max-content;
  max-width: min(var(--w, 14em), 100%);
  padding: 1em 1.35em;
  background: var(--color-paper);
  border: var(--bw) solid var(--color-ink);
  border-radius: 50%;
  color: var(--color-ink);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.16;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}

.bubble--static {
  position: relative;
  top: auto;
  left: auto;
}

.bubble--sm {
  font-size: var(--text-sm);
  padding: 0.9em 1.15em;
}

/* tails: an ink wedge, with a paper wedge over it that hides the border joint */
.tail-bl::before,
.tail-bl::after,
.tail-br::before,
.tail-br::after,
.tail-l::before,
.tail-l::after,
.tail-r::before,
.tail-r::after {
  content: "";
  position: absolute;
}

.tail-bl::before,
.tail-br::before {
  top: 100%;
  width: 22px;
  height: 28px;
  background: var(--color-ink);
}

.tail-bl::after,
.tail-br::after {
  top: calc(100% - 5px);
  width: 18px;
  height: 25px;
  background: var(--color-paper);
}

.tail-bl::before { left: 32%; clip-path: polygon(0 0, 100% 0, 0 100%); }
.tail-bl::after { left: calc(32% + 3px); clip-path: polygon(0 0, 100% 0, 0 100%); }
.tail-br::before { right: 32%; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.tail-br::after { right: calc(32% + 3px); clip-path: polygon(0 0, 100% 0, 100% 100%); }

.tail-l::before,
.tail-r::before {
  top: calc(50% - 9px);
  width: 30px;
  height: 18px;
  background: var(--color-ink);
}

.tail-l::after,
.tail-r::after {
  top: calc(50% - 6px);
  width: 30px;
  height: 11px;
  background: var(--color-paper);
}

.tail-l::before { right: calc(100% - 4px); clip-path: polygon(100% 0, 100% 100%, 0 80%); }
.tail-l::after { right: calc(100% - 9px); clip-path: polygon(100% 0, 100% 100%, 0 95%); }
.tail-r::before { left: calc(100% - 4px); clip-path: polygon(0 0, 0 100%, 100% 80%); }
.tail-r::after { left: calc(100% - 9px); clip-path: polygon(0 0, 0 100%, 100% 95%); }

/* whisper: dashed and wobbly, lower-case; thought tail = trailing circles */
.bubble--whisper {
  border-style: dashed;
  border-radius: 47% 53% 44% 56% / 56% 45% 55% 44%;
  font-weight: 500;
  text-transform: none;
}

.tail-thought-l::before,
.tail-thought-l::after {
  content: "";
  position: absolute;
  background: var(--color-paper);
  border: 2.5px solid var(--color-ink);
  border-radius: 50%;
}

.tail-thought-l::before { top: calc(100% + 4px); left: 26%; width: 16px; height: 12px; }
.tail-thought-l::after { top: calc(100% + 20px); left: 18%; width: 9px; height: 7px; }

/* burst: shouting. Ink star with a paper star inset over it. */

/* ------------------------------------------------------------------ SFX lettering */
.sfx {
  position: absolute;
  z-index: var(--z-raised);
  overflow: visible;
  pointer-events: none;
  filter: url(#ink-rough);
}

.sfx-text {
  fill: var(--color-ink);
  stroke: var(--color-paper);
  stroke-width: 9px;
  paint-order: stroke;
  font-family: var(--font-display);
}

/* ------------------------------------------------------------------ buttons
 * Face in ::before, halftone print-offset in ::after, so the label sits on top. */
.btn {
  --btn-bg: var(--color-paper);
  --btn-fg: var(--color-ink);
  --btn-edge: var(--color-ink);
  --btn-shadow: var(--tone-2);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.72em 1.35em;
  background: none;
  border: 0;
  border-radius: var(--radius-none);
  color: var(--btn-fg);
  font-family: var(--font-letter);
  font-size: var(--text-md);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-micro) var(--ease-out);
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
}

.btn::before {
  z-index: -1;
  background: var(--btn-bg);
  border: var(--rule-panel) solid var(--btn-edge);
}

.btn::after {
  z-index: -2;
  background: var(--btn-shadow);
  transform: translate(var(--offset), var(--offset));
  transition: transform var(--dur-micro) var(--ease-out);
}

.btn--ink {
  --btn-bg: var(--color-ink);
  --btn-fg: var(--color-paper);
}

.btn--sm {
  min-height: 40px;
  padding: 0.5em 1em;
  font-size: var(--text-base);
}

.btn--lg {
  min-height: 60px;
  max-width: 100%;
  padding: 0.8em clamp(0.9em, 3vw, 1.6em);
  font-size: clamp(1.05rem, 0.75rem + 1.2vw, var(--text-lg));
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
  white-space: normal;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translate(-2px, -2px);
  }

  .btn:hover::after {
    transform: translate(calc(var(--offset) + 3px), calc(var(--offset) + 3px));
  }
}

.btn:active {
  transform: translate(3px, 3px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

/* until the installer is up the button is pencilled in, like a panel in the storyboard */
.btn.is-soon {
  --btn-bg: transparent;
  --btn-fg: currentColor;
  --btn-edge: currentColor;
  cursor: default;
  pointer-events: none;
}

.btn.is-soon::before {
  border-style: dashed;
}

.btn.is-soon::after,
.dl-wrap:has(.is-soon)::before {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
.btn::after {
    transition: none;
  }
}

.btn:active::after {
  transform: translate(2px, 2px);
}

.btn[data-state="copied"] .btn__label,
.btn[data-state="failed"] .btn__label {
  display: none;
}

.btn[data-state="copied"]::selection {
  background: none;
}

.btn[data-state="copied"] > .btn__done,
.btn[data-state="failed"] > .btn__fail {
  display: inline;
}

.btn__done,
.btn__fail {
  display: none;
}

/* ------------------------------------------------------------------ CTA block */
.cta {
  margin-top: var(--space-xl);
}

.cta__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md) var(--space-lg);
}

/* speed lines streak behind the download button on hover */
.dl-wrap {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  max-width: 100%;
}

.dl-wrap::before {
  content: "";
  position: absolute;
  inset: -18px -16px -18px -48px;
  z-index: -1;
  background: var(--color-ink);
  -webkit-mask: url("assets/art/speed.svg") 0 0 / 100% 100% no-repeat;
  mask: url("assets/art/speed.svg") 0 0 / 100% 100% no-repeat;
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: 100% 50%;
  transition: transform var(--dur-short) var(--ease-out), opacity var(--dur-micro) linear;
  pointer-events: none;
}

.dl-wrap:has(.btn--dl:focus-visible)::before {
  opacity: 1;
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .dl-wrap:has(.btn--dl:hover)::before {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dl-wrap::before {
    transform: none;
    transition: opacity var(--dur-micro) linear;
  }
}

.cta__alt {
  margin-top: var(--space-md);
  font-size: var(--text-sm);
}

.cta__alt:empty {
  display: none;
}

/* The note under the cover's download button is filled in by script (and changes once the
 * installer check answers), so its line is reserved from the start: the cover never jumps. */
.cover .cta__alt,
.cover .cta__alt:empty {
  display: block;
  min-height: 1.6em;
  min-height: 1lh;
}

@media (min-width: 60rem) and (max-width: 63.99rem) {
  /* the text column is narrowest here: the note takes two lines */
  .cover .cta__alt {
    min-height: 3.2em;
    min-height: 2lh;
  }
}

.cta__alt a,
.colophon__links a {
  font-weight: 700;
  text-underline-offset: 0.25em;
}

.cta__alt a:hover,
.colophon__links a:hover {
  text-decoration-thickness: 3px;
}

.cta__mobile {
  display: none;
}

.is-mobile .cta__mobile {
  display: block;
}

.is-mobile .cta__desktop {
  display: none;
}

.cta__mobile-title {
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.15;
}

.cta__mobile-text {
  max-width: 34ch;
  margin-block: var(--space-xs) var(--space-lg);
}

.cta__url {
  font-weight: 700;
  border-bottom: var(--rule-thin) solid currentColor;
  user-select: all;
}

/* the logo mouths along, half a beat late, when someone reaches for download */
@keyframes lf-flap {
  0% { transform: scaleY(0.12); }
  25% { transform: scaleY(1); }
  50% { transform: scaleY(0.12); }
  75% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: no-preference) {
  body:has(.btn--dl:focus-visible) .logo .lf-mouth {
    animation: lf-flap 440ms steps(1, end) 130ms 2;
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  body:has(.btn--dl:hover) .logo .lf-mouth {
    animation: lf-flap 440ms steps(1, end) 130ms 2;
  }
}

/* ------------------------------------------------------------------ cover: a manga volume cover
 * The scene is a real panel with our dub in its balloon; the logo and the blurb sit on top of the
 * art the way a cover title does. */
.cover {
  position: relative;
}

.cover__body {
  display: flex;
  flex-direction: column;
  background: var(--tone-1);
  background-color: var(--color-paper);
}

.cover__title {
  position: relative;
  z-index: 3;
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
}

.cover__scene {
  position: relative;
  order: 2;
  aspect-ratio: 1200 / 933;
  overflow: hidden;
  border-block: var(--rule-panel) solid var(--color-ink);
  container-type: size;
}

.cover__blurb {
  position: relative;
  z-index: 3;
  order: 3;
  padding: var(--space-lg);
  background: var(--color-paper);
}

.cover__aside {
  font-size: var(--text-xs);
}

.cover__layer {
  position: absolute;
  inset: 0;
}

.cover__kana {
  display: none;
}

.cover__credit {
  order: 4;
  padding: var(--space-2xs) var(--space-lg) var(--space-sm);
  background: var(--color-paper);
  font-size: var(--text-xs);
  font-style: normal;
}

.cover__credit cite,
.colophon__credit cite {
  font-style: normal;
  font-weight: 700;
}

.hero__title {
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.1vw + 1.05rem, 2.15rem);
  font-weight: 400;
  line-height: 1.12;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.hero__lede {
  max-width: 44ch;
  margin-top: var(--space-sm);
  font-size: var(--text-md);
  line-height: 1.45;
}

.cover .cta {
  margin-top: var(--space-lg);
}

.sfx--flop {
  display: none;
}

@media (min-width: 60rem) {
  .cover__body {
    container-type: inline-size;
    display: grid;
    grid-template-columns: minmax(0, 37fr) minmax(0, 63fr);
    grid-template-rows: auto 1fr;
    min-height: 0;
  }

  .cover__scene {
    grid-column: 2;
    grid-row: 1 / span 2;
    --fx: 0.62;
    place-self: stretch;
    aspect-ratio: 1200 / 933;
    min-height: 0;
    border-block: 0;
    border-inline-start: var(--rule-panel) solid var(--color-ink);
  }

  /* the logo reaches over into the scene, like a title stamped across the panel border */
  .cover__title {
    grid-column: 1;
    grid-row: 1;
    width: 127%;
    padding: var(--space-md) 0 var(--space-sm) var(--space-lg);
  }

  .cover__blurb {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    margin: var(--space-sm) var(--space-md) var(--space-lg) var(--space-lg);
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    border: var(--rule-panel) solid var(--color-ink);
  }

  .cover__kana {
    position: absolute;
    top: var(--space-md);
    right: var(--space-sm);
    z-index: 3;
    display: block;
    color: var(--color-paper);
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 1.6vw + 0.6rem, 2.3rem);
    letter-spacing: 0.08em;
    paint-order: stroke fill;
    -webkit-text-stroke: 7px var(--color-ink);
    writing-mode: vertical-rl;
  }

  .cover__credit {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 0.15em 0.6em;
    border-top: var(--rule-thin) solid var(--color-ink);
    border-left: var(--rule-thin) solid var(--color-ink);
  }

  .cover__aside {
    font-size: var(--text-sm);
  }

  .sfx--flop {
    display: block;
    right: 36%;
    bottom: -38px;
    width: 220px;
  }
}

/* ------------------------------------------------------------------ scene panels
 * The stage keeps the image's own aspect ratio and covers the panel (like object-fit: cover),
 * so our dub lines stay inside the original balloons at any panel size. --fx/--fy pick the focus. */
.scene {
  aspect-ratio: var(--ar);
}

.scene > .panel__body {
  container-type: size;
  overflow: hidden;
}

.stage {
  --sw: max(100cqw, 100cqh * var(--ar));
  --sh: max(100cqh, 100cqw / var(--ar));
  position: absolute;
  top: clamp(100cqh - var(--sh), 50cqh - var(--fy, 0.5) * var(--sh), 0px);
  left: clamp(100cqw - var(--sw), 50cqw - var(--fx, 0.5) * var(--sw), 0px);
  width: var(--sw);
  height: var(--sh);
  container-type: inline-size;
}

.stage > img {
  display: block;
  width: 100%;
  height: 100%;
}

/* our line, lettered inside the manga's own balloon */
.dub {
  position: absolute;
  top: var(--y);
  left: var(--x);
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--w);
  height: var(--h);
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-letter);
  font-size: calc(var(--fs, 3) * 1cqi);
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
  text-transform: uppercase;
  hyphens: manual;
  overflow-wrap: normal;
}

.dub > span {
  max-width: 100%;
}

.w {
  white-space: nowrap;
}

.ch {
  display: inline-block;
}

/* manga impact burst, played once over the cover scene */
.cover__scene::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 2;
  background: var(--color-paper);
  -webkit-mask: url("assets/art/focus-tight.svg") 50% 45% / 120% auto no-repeat;
  mask: url("assets/art/focus-tight.svg") 50% 45% / 120% auto no-repeat;
  opacity: 0;
  pointer-events: none;
}

/* a strip of screentone that sweeps across a panel on hover */
.scene > .panel__body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--tone-2);
  -webkit-mask: linear-gradient(100deg, transparent 38%, #000 46%, #000 54%, transparent 62%);
  mask: linear-gradient(100deg, transparent 38%, #000 46%, #000 54%, transparent 62%);
  opacity: 0;
  transform: translateX(-120%);
  pointer-events: none;
}

.dub--shout {
  letter-spacing: 0.01em;
}

.dub--whisper {
  font-weight: 500;
  text-transform: none;
}

/* ------------------------------------------------------------------ gag strip: three real panels, one row, same height */
.gag {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
  margin-top: var(--gutter);
}

.gag__b {
  aspect-ratio: 4 / 5;
  --fy: 0.74;
}

.sfx--gogo { top: 18%; right: 5%; width: clamp(44px, 9vw, 70px); }
.sfx--paku { right: 4%; bottom: 4%; width: 70%; }

@media (min-width: 48rem) {
  .gag {
    display: flex;
    align-items: stretch;
  }

  .gag > .scene {
    flex: var(--ar) 1 0;
    aspect-ratio: var(--ar);
    min-width: 0;
  }

  .gag__b {
    --fy: 0.5;
  }
}

/* ------------------------------------------------------------------ yonkoma
 * A real 4-koma: one vertical strip under a title box, read top to bottom.
 * The explanations live in the margin like an editor's pencil notes. */
.yonkoma {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  counter-reset: none;
}

.yon {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-sm);
}

.panel--yon {
  aspect-ratio: 16 / 9.5;
}

.sfx--kachi { right: 5%; bottom: 10%; width: 30%; }

.sfx--waha { right: 5%; bottom: 8%; width: 36%; }

.yon__note {
  position: relative;
  max-width: 36ch;
  padding-inline-start: var(--space-xs);
}

.yon__arrow {
  display: none;
}

.yon__title {
  min-width: 0;
  overflow-wrap: anywhere;
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-family: var(--font-letter);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.15;
}

.yon__n {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  border: var(--rule-thin) solid var(--color-ink);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.72em;
  translate: 0 -0.1em;
}

.yon__text {
  margin-top: var(--space-2xs);
  font-size: var(--text-md);
  line-height: 1.4;
}

@media (min-width: 52rem) {
  .yonkoma {
    gap: var(--space-sm);
    width: min(100%, 64rem);
  }

  .yon {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    align-items: center;
    gap: var(--space-xl);
  }

  .yon__note {
    rotate: -1.5deg;
  }

  .yon:nth-child(even) .yon__note {
    rotate: 1.2deg;
  }

  .yon__arrow {
    position: absolute;
    top: 0.4em;
    left: calc(var(--space-xl) * -1 - 4px);
    display: block;
    width: 44px;
  }
}

/* ------------------------------------------------------------------ section titles: a different manga device each time */
.title--box {
  width: min(100%, 64rem);
  margin-bottom: var(--space-sm);
  padding: 0.3em 0.6em 0.4em;
  border: var(--rule-panel) solid var(--color-ink);
  font-size: var(--text-2xl);
  text-align: center;
}

.title--slab {
  display: inline-block;
  padding: 0.25em 0.6em 0.35em;
  background: var(--color-ink);
  color: var(--color-paper);
  rotate: -1.5deg;
}

.title--burst {
  position: relative;
  isolation: isolate;
  display: inline-grid;
  place-items: center;
  padding: 1.25em 1.9em 1.35em;
  font-size: var(--text-2xl);
  --burst: polygon(97.3% 48.8%, 89.5% 55.3%, 96.8% 61.6%, 87.4% 69%, 89.4% 76.8%, 80.3% 76.5%, 82.1% 84.7%, 73.9% 85%, 69% 95.6%, 60.1% 88.7%, 57.9% 98.2%, 49% 92.2%, 41.5% 96.5%, 37.9% 89.8%, 30.2% 93.2%, 28.7% 83.4%, 15.9% 86%, 19.4% 76.3%, 8% 74.6%, 11% 66%, 3.7% 63.6%, 9.6% 55.4%, 2.1% 51.6%, 11.1% 43.2%, 2.5% 38.4%, 12.2% 33.7%, 9.5% 24.2%, 21.1% 22.3%, 18.5% 14.3%, 28.7% 15.8%, 28.9% 5.5%, 37.7% 10.7%, 45.2% 2.9%, 48.2% 9.9%, 58.2% 1.9%, 60.4% 10.9%, 68.7% 5.4%, 70.9% 14%, 84.1% 13.6%, 82.8% 22.9%, 89% 22.2%, 88.9% 34.4%, 97.7% 35.5%, 91.7% 44.5%);
}

.title--burst::before,
.title--burst::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: var(--burst);
}

.title--burst::before {
  inset: 0;
  background: var(--color-ink);
}

.title--burst::after {
  inset: 5px;
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  background: var(--color-paper);
  -webkit-mask: none;
  mask: none;
}

.title--bubble {
  position: relative;
  display: inline-block;
  padding: 0.55em 1.2em 0.6em;
  border: var(--rule-panel) solid var(--color-ink);
  border-radius: 50%;
  font-size: var(--text-2xl);
}

.title--bubble::after {
  position: absolute;
  top: calc(100% - 2px);
  left: 18%;
  width: 26px;
  height: 30px;
  margin: 0;
  background: var(--color-ink);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  -webkit-mask: none;
  mask: none;
}

/* ------------------------------------------------------------------ features: a manga page of six real panels, each with its own narration box */
.chapter--toned {
  position: relative;
  isolation: isolate;
  background-color: var(--color-paper);
  border-block: var(--rule-panel) solid var(--color-ink);
}

/* line tone behind the page, graded out toward the middle like a hand-cut tone sheet */
.chapter--toned::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tone-lines);
  -webkit-mask: linear-gradient(to bottom, #000, transparent 38%, transparent 62%, #000);
  mask: linear-gradient(to bottom, #000, transparent 38%, transparent 62%, #000);
  pointer-events: none;
}

.features {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
}

.feat:first-child {
  aspect-ratio: 4 / 5;
}

.feat__note {
  position: absolute;
  z-index: 3;
  max-width: min(64%, 24rem);
  padding: 0.5em 0.75em 0.6em;
  background: var(--color-paper);
  border: var(--rule-thin) solid var(--color-ink);
}

.at-tl { top: var(--space-sm); left: var(--space-sm); }
.at-tr { top: var(--space-sm); right: var(--space-sm); }
.at-bl { bottom: var(--space-sm); left: var(--space-sm); }
.at-br { bottom: var(--space-sm); right: var(--space-sm); }

.feat__title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 0.9vw + 0.9rem, 1.6rem);
  font-weight: 400;
  line-height: 1.1;
  text-wrap: balance;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.feat__text {
  margin-top: 0.3em;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.feat:first-child .feat__note {
  max-width: min(84%, 24rem);
}

.sfx--feat {
  position: absolute;
  z-index: 3;
  width: auto;
  height: clamp(36px, 3.2vw, 52px);
}

/* tablets: two panels a row, every panel the same height, the first one a wide splash */
@media (min-width: 40rem) and (max-width: 59.99rem) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 330px;
  }

  .feat,
.feat:first-child {
    aspect-ratio: auto;
  }

  .feat:first-child {
    grid-column: 1 / -1;
    grid-row: span 1;
    --fy: 0.32;
  }

  .feat .feat__note {
    max-width: min(60%, 17rem);
  }

  .feat:nth-child(3) {
    --fx: 0.95;
  }
}

@media (min-width: 60rem) {
  .features {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: 270px 270px 400px;
    grid-auto-rows: 360px;
  }

  .feat:nth-child(n + 4) .feat__note {
    max-width: 62%;
    font-size: 0.92em;
  }

  .feat {
    aspect-ratio: auto;
  }

  .feat:nth-child(1) { grid-column: 1 / span 5; grid-row: span 2; aspect-ratio: auto; }
  .feat:nth-child(2) { grid-column: 6 / -1; --fy: 0.35; }
  .feat:nth-child(3) { grid-column: 6 / -1; --fy: 0.3; }
  .feat:nth-child(4) { grid-column: 1 / span 4; }
  .feat:nth-child(5) { grid-column: 5 / span 4; --fy: 0.3; }
  .feat:nth-child(6) { grid-column: 9 / -1; }
  .feat:nth-child(6n + 7) { grid-column: span 6; }
}

/* ------------------------------------------------------------------ example dubs: real scenes, our lines in their balloons */
.flops {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
}

.flop--a {
  aspect-ratio: 2 / 1;
  --fx: 0.86;
}

.flop--d {
  aspect-ratio: 16 / 10;
  --fx: 0.63;
}

.take {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-xs);
  z-index: var(--z-raised);
  padding: 0.1em 0.5em;
  background: var(--color-ink);
  color: var(--color-paper);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

/* the night-shift panel has balloons along its top edge: its narration box always sits at the bottom */
.flop--b .caption {
  top: auto;
  bottom: var(--space-xs);
  max-width: min(58%, 18rem);
}

/* phones: the narration box drops to the bottom so it never sits on a balloon */
@media (max-width: 47.99rem) {
  .flop .caption {
    top: auto;
    bottom: var(--space-xs);
  }

  .flop .take {
    display: none;
  }

  .flop--b .caption {
    left: auto;
    right: var(--space-xs);
  }
}

@media (min-width: 48rem) {
  .flops {
    display: flex;
    flex-wrap: wrap;
  }

  .flop {
    flex: var(--ar) 1 0;
    min-width: 0;
    aspect-ratio: var(--ar);
  }

  .flop--a,
.flop--d {
    flex-basis: 100%;
    aspect-ratio: var(--ar);
  }
}

/* ------------------------------------------------------------------ the booth: a film reel of viral formats, one panel to dub */
.title--reel {
  --holes: repeating-linear-gradient(90deg, var(--color-paper) 0 9px, transparent 9px 20px);
  justify-self: start;
  display: inline-block;
  padding: 0.72em 0.9em 0.78em;
  background:
    var(--holes) 6px 7px / 100% 7px no-repeat,
    var(--holes) 6px calc(100% - 7px) / 100% 7px no-repeat,
    var(--color-ink);
  color: var(--color-paper);
  rotate: 1deg;
}

.reel {
  --hole: linear-gradient(90deg, var(--color-paper) 0 9px, transparent 9px);
  margin: 0 calc(var(--page-pad) * -1) var(--space-lg);
  padding: 22px 0 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--page-pad);
  scrollbar-width: none;
  background:
    var(--hole) 6px 7px / 21px 7px repeat-x local,
    var(--hole) 6px calc(100% - 7px) / 21px 7px repeat-x local,
    var(--color-ink);
}

.reel::-webkit-scrollbar {
  display: none;
}

.reel__strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 9.25rem;
  gap: 12px;
  width: max-content;
  padding-inline: var(--page-pad);
}

.reel__item {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: start;
  min-width: 0;
  gap: 7px;
  scroll-snap-align: start;
}

.reel__item > .reel__frame {
  align-self: start;
  width: 100%;
}

.reel__frame {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--color-paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* the link to the original scene's official home */
.reel__src {
  padding: 0.1em 0.45em 0.15em;
  border: 1px solid currentColor;
  color: var(--color-paper);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
  transition: opacity var(--dur-micro) linear, background-color var(--dur-micro) linear, color var(--dur-micro) linear;
}

.reel__src:hover {
  background: var(--color-paper);
  color: var(--color-ink);
  opacity: 1;
}

.reel__src:focus-visible {
  outline: 2px dashed var(--color-paper);
  outline-offset: 3px;
  opacity: 1;
}

.reel__shot {
  display: block;
  aspect-ratio: 16 / 9;
  margin-bottom: 3px;
  overflow: hidden;
  border: 2px solid var(--color-paper);
  background: var(--color-ink);
}

.reel__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1) brightness(1.18);
  opacity: 0.75;
  transition: filter var(--dur-long) var(--ease-out), opacity var(--dur-short) linear, scale var(--dur-long) var(--ease-out);
}

.reel__name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  line-height: 1.1;
}

.reel__meme {
  font-size: var(--text-xs);
  line-height: 1.25;
  opacity: 0.78;
}

.reel__frame[aria-checked="true"] .reel__shot {
  outline: 3px solid var(--color-paper);
  outline-offset: 3px;
}

.reel__frame[aria-checked="true"] .reel__shot img {
  opacity: 1;
  filter: none;
}

.reel__frame[aria-checked="true"] .reel__name {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.2em;
}

.reel__frame:focus-visible {
  outline: 3px dashed var(--color-paper);
  outline-offset: 5px;
}

@media (hover: hover) and (pointer: fine) {
  .reel__frame:hover .reel__shot img {
    opacity: 1;
    filter: none;
    scale: 1.06;
  }
}

@media (min-width: 70rem) {
  .reel {
    margin-inline: 0;
    scroll-padding-inline: 16px;
  }

  .reel__strip {
    grid-auto-columns: 10rem;
    padding-inline: 16px;
  }
}

.reel__wrap {
  position: relative;
}

/* arrows sit on the film's edges; they only appear where there is more to scroll */
.reel__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 3px solid var(--color-ink);
  border-radius: 50%;
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  translate: 0 -50%;
  box-shadow: 3px 3px 0 var(--color-ink);
}

.reel__nav--prev {
  left: -0.6rem;
}

.reel__nav--next {
  right: -0.6rem;
}

.reel__nav:focus-visible {
  outline: 3px dashed var(--color-ink);
  outline-offset: 3px;
}

.reel__nav[hidden] {
  display: none;
}

@media (hover: none), (max-width: 47.99rem) {
  .reel__nav {
    display: none;
  }
}

/* the last frame: there's more where these came from */
.reel__more {
  grid-column: span 2;
  grid-template-rows: none;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 0.9rem 0.8rem;
  border: 2px dashed var(--color-paper);
  color: var(--color-paper);
}

.reel__more-big {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1;
}

.reel__more-text {
  font-size: var(--text-xs);
  line-height: 1.3;
  opacity: 0.85;
}

.reel__more .reel__src {
  white-space: normal;
}

.booth__deck {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 60rem) {
  .booth__deck {
    grid-template-columns: minmax(0, 1.75fr) minmax(17rem, 1fr);
    align-items: start;
  }
}

.booth__panel {
  justify-self: center;
  scroll-margin: 5.5rem 0 1rem;
  width: min(100%, calc(var(--ar) * 68svh));
  margin: 0;
  aspect-ratio: var(--ar);
}

.booth__panel > .panel__body {
  container-type: size;
}

.booth__scene {
  position: absolute;
  inset: 0;
}

.booth__scene[hidden] {
  display: none;
}

/* our line, lettered in the panel; letters ink in at speaking pace during a take */
.say {
  position: absolute;
  top: var(--y);
  left: var(--x);
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--w);
  height: var(--h);
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-letter);
  font-size: calc(var(--fs, 3) * 1cqi);
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: normal;
  scale: calc(1 + var(--amp, 0) * 0.16);
}

.say > span {
  max-width: 100%;
}

.say--free {
  paint-order: stroke fill;
  -webkit-text-stroke: 0.2em var(--color-paper);
}

.say--free.say--shout {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  rotate: -4deg;
}

.booth[data-state="count"] .say .ch {
  opacity: 0.16;
}

.booth[data-state="take"] .say .ch,
.booth[data-state="play"] .say .ch {
  opacity: 0.16;
  animation: say-ch 140ms var(--ease-out) calc(var(--start, 0ms) + var(--k) * var(--step, 60ms)) forwards;
}

@keyframes say-ch {
  to { opacity: 1; }
}

/* the slate claps once before the countdown */
.booth__slate {
  position: absolute;
  top: var(--space-sm);
  left: 50%;
  z-index: 7;
  display: none;
  width: min(42cqw, 13rem);
  translate: -50% 0;
  pointer-events: none;
}

.booth[data-state="count"] .booth__slate {
  display: block;
}

.booth__clap {
  display: block;
  height: 1.1rem;
  border: 3px solid var(--color-ink);
  background: repeating-linear-gradient(-60deg, var(--color-ink) 0 12px, var(--color-paper) 12px 24px);
  transform-origin: 3px 100%;
}

.booth__slate-body {
  display: block;
  margin-top: 2px;
  padding: 0.25em 0.6em 0.3em;
  border: 3px solid var(--color-ink);
  background: var(--color-ink);
  color: var(--color-paper);
  font-family: var(--font-display);
  font-size: var(--text-md);
  letter-spacing: 0.06em;
  text-align: center;
}

.booth__kachi {
  position: absolute;
  top: -0.9em;
  right: -1.4em;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  paint-order: stroke fill;
  -webkit-text-stroke: 0.18em var(--color-paper);
  rotate: 12deg;
}

.booth__count {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: min(42cqh, 30cqw);
  line-height: 1;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.09em var(--color-paper);
  pointer-events: none;
}

.booth__count:empty {
  display: none;
}

.booth__rec {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 6;
  display: none;
  align-items: center;
  gap: 0.45em;
  margin: 0;
  padding: 0.2em 0.55em;
  background: var(--color-ink);
  color: var(--color-paper);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
}

.booth__rec::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--color-paper);
}

.booth[data-state="take"] .booth__rec {
  display: inline-flex;
}

.booth[data-state="play"] .booth__rec {
  display: inline-flex;
}

.booth[data-state="play"] .booth__rec::before {
  border-radius: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.booth__cue {
  position: absolute;
  inset: auto 0 0;
  z-index: 6;
  height: 7px;
  margin: 0;
  background: var(--color-paper);
  border-top: var(--rule-thin) solid var(--color-ink);
  opacity: 0;
}

.booth__cue span {
  display: block;
  height: 100%;
  background: var(--color-ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.booth:is([data-state="take"], [data-state="play"]) .booth__cue {
  opacity: 1;
}

.booth:is([data-state="take"], [data-state="play"]) .booth__cue span {
  animation: cue var(--dur, 4s) linear forwards;
}

@keyframes cue {
  to { transform: none; }
}

.booth__stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  margin: 0;
  padding: 0.08em 0.4em 0.12em;
  border: 5px solid var(--color-ink);
  background: var(--color-paper);
  font-family: var(--font-display);
  font-size: min(15cqw, 5rem);
  line-height: 1;
  translate: -50% -50%;
  rotate: -8deg;
  opacity: 0;
  pointer-events: none;
}

.booth[data-state="cut"] .booth__stamp {
  opacity: 1;
}

.booth__script {
  display: grid;
  justify-items: start;
  gap: var(--space-sm);
}

.booth__tag {
  padding: 0.15em 0.6em;
  background: var(--color-ink);
  color: var(--color-paper);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  rotate: -2deg;
}

.booth__name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.02;
}

.booth__meme {
  margin-top: calc(var(--space-xs) * -1);
  color: var(--color-ink-soft);
}

.booth__lines {
  justify-self: stretch;
  display: grid;
  gap: var(--space-xs);
  margin: var(--space-xs) 0 0;
  padding: var(--space-sm) var(--space-md);
  border: var(--rule-thin) solid var(--color-ink);
  box-shadow: var(--offset) var(--offset) 0 var(--color-ink);
  counter-reset: line;
  list-style: none;
  font-weight: 700;
  line-height: 1.3;
}

.booth__lines li {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  align-items: baseline;
  counter-increment: line;
}

.booth__lines li::before {
  content: counter(line);
  font-family: var(--font-display);
  font-size: var(--text-xs);
}

.booth__lines li {
  padding: 0.1em 0.35em;
  margin-inline: -0.35em;
  transition: background-color var(--dur-micro) linear, color var(--dur-micro) linear;
}

.booth__lines li.is-now {
  background: var(--color-ink);
  color: var(--color-paper);
}

.booth__lines li.booth__beat {
  counter-increment: none;
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  font-style: italic;
  font-weight: 500;
}

.booth__lines li.booth__beat::before {
  content: "";
}

.booth__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
}

.booth__dot {
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

.booth__verdict {
  padding: 0.45em 0.8em;
  background: var(--color-ink);
  color: var(--color-paper);
  font-weight: 700;
  rotate: -1deg;
}

.booth__note {
  max-width: 40ch;
  color: var(--color-ink-soft);
  font-size: var(--text-xs);
}

html:not(.js) .booth__controls,
html:not(.js) .booth__note {
  display: none;
}

/* ------------------------------------------------------------------ FAQ as a conversation */
.faq {
  display: grid;
  gap: var(--space-lg);
  max-width: 64rem;
}

.qa {
  display: grid;
  gap: var(--space-2xs);
}

.qa__q,
.qa__a {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.qa__a {
  justify-content: flex-end;
  margin-inline-start: auto;
}

.qa__q .bubble,
.qa__a .bubble {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 34rem;
  border-radius: 46% / 50%;
  padding: 1.05em 1.8em;
}

/* long answers: rounder corners keep text inside the outline */
.qa__a .bubble {
  padding: 1em 1.6em;
  border-radius: 2.2em;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.qa__who {
  flex: none;
  width: 60px;
  height: 70px;
  overflow: hidden;
  background: var(--color-paper);
  border: var(--rule-panel) solid var(--color-ink);
}

.qa__guy {
  display: block;
  width: 100%;
  height: 100%;
}

.qa__who--lf {
  display: grid;
  place-items: center;
  background: var(--tone-1);
  background-color: var(--color-paper);
}

.logo-mouth {
  width: 52px;
}

@media (max-width: 40rem) {
  .qa__who {
    width: 52px;
    height: 62px;
  }

  .qa__q,
.qa__a {
    gap: var(--space-md);
  }

  .logo-mouth {
    width: 40px;
  }
}

/* ------------------------------------------------------------------ beta flash finale (ベタフラ) */
.chapter--beta {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-4xl);
  background: var(--color-ink);
  color: var(--color-paper);
  text-align: center;
}

.beta__lines {
  position: absolute;
  inset: 0;
  background: var(--color-paper);
  -webkit-mask: url("assets/art/focus.svg") 50% 50% / max(125%, 1300px) auto no-repeat;
  mask: url("assets/art/focus.svg") 50% 50% / max(125%, 1300px) auto no-repeat;
}

.beta__page {
  position: relative;
  display: grid;
  justify-items: center;
}

.beta__title {
  text-wrap: balance;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 400;
  line-height: 1;
  overflow-wrap: anywhere;
}

.beta__text {
  max-width: 30ch;
  margin-top: var(--space-md);
  font-size: var(--text-md);
}

.cta--on-ink {
  --color-focus: var(--color-paper);
}

.cta--on-ink .cta__row {
  justify-content: center;
}

.cta--on-ink .dl-wrap::before {
  background: var(--color-paper);
}

.cta--on-ink .btn--paper {
  --btn-edge: var(--color-paper);
  --btn-shadow: radial-gradient(circle, var(--color-paper) 1.45px, transparent 1.85px) 0 0 / 6px 6px;
}

.cta--on-ink .btn--ghost {
  --btn-bg: var(--color-ink);
  --btn-fg: var(--color-paper);
  --btn-edge: var(--color-paper);
  --btn-shadow: none;
}

.cta--on-ink .cta__mobile-text {
  margin-inline: auto;
}

/* ------------------------------------------------------------------ colophon (Ft4) */
.colophon {
  padding-block: var(--space-2xl) var(--space-xl);
  border-top: var(--rule-panel) solid var(--color-ink);
}

.colophon__grid {
  display: grid;
  gap: var(--space-xl);
  align-items: end;
}

.colophon__end {
  font-size: var(--text-md);
  font-weight: 600;
}

.colophon__kan {
  display: block;
  margin-bottom: var(--space-xs);
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 1;
}

.colophon__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
}

.colophon__links a {
  font-weight: 700;
  white-space: nowrap;
  text-underline-offset: 0.25em;
}

.colophon__links--small,
.colophon__copy {
  font-size: var(--text-sm);
}

.colophon__credit {
  max-width: 52ch;
  font-size: var(--text-xs);
}

.colophon__meta {
  display: grid;
  gap: var(--space-md);
  align-content: end;
}

@media (min-width: 60rem) {
  .colophon__grid {
    grid-template-columns: 1.3fr auto 1fr;
    column-gap: var(--space-3xl);
  }
}

/* ------------------------------------------------------------------ trailer lightbox */
.trailer {
  overscroll-behavior: contain;
  width: min(960px, 92vw);
  max-width: none;
  padding: var(--space-2xl) 0 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.trailer::backdrop {
  background: color-mix(in oklch, var(--color-ink) 86%, transparent);
}

.trailer__frame {
  aspect-ratio: 16 / 9;
}

.trailer iframe,
.trailer video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--color-ink);
}

.trailer__close {
  position: absolute;
  top: 0;
  right: 0;
}

@keyframes burst {
  0% { opacity: 0; transform: rotate(var(--r)) scale(0.5); }
  25% { opacity: 1; transform: rotate(var(--r)) translateY(-14px) scale(1.2); }
  100% { opacity: 0; transform: rotate(var(--r)) translateY(-40px) scale(1); }
}

.slam {
  display: inline-block;
}

/* sits in the gap above the title, never on top of it */
.sfx--beta {
  position: absolute;
  bottom: calc(100% + var(--space-xs));
  left: max(var(--space-sm), 50% - 20rem);
  width: clamp(100px, 14vw, 200px);
}

.sfx--beta .sfx-text {
  fill: var(--color-paper);
  stroke: var(--color-ink);
}

/* brush-stroke underline that inks in under section titles */
.chapter__title::after {
  content: "";
  display: block;
  width: min(3.4em, 70%);
  height: 0.22em;
  margin-top: 0.12em;
  background: var(--color-ink);
  -webkit-mask: url("assets/art/brush.svg") 0 0 / 100% 100% no-repeat;
  mask: url("assets/art/brush.svg") 0 0 / 100% 100% no-repeat;
}

.chapter--toned .chapter__title::after {
  display: none;
}

/* SVG parts that move get their own transform box */
.lf-l,
.glyph {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.lf-l,
.lf-bang {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

/* ------------------------------------------------------------------ motion
 * Everything here is gated twice: prefers-reduced-motion (nothing moves) and
 * .is-live (loops only run while their page is on screen, set in main.js).
 * Character loops use steps() on purpose: limited animation, like anime on 2s and 3s. */

@keyframes stamp {
  from { opacity: 0; transform: scale(1.4) rotate(-6deg); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes lf-drop {
  0% { opacity: 0; transform: translateY(-110%) rotate(-14deg); }
  55% { opacity: 1; transform: translateY(5%) scale(1.06, 0.88); }
  75% { transform: translateY(-4%) scale(0.98, 1.03); }
  100% { transform: none; }
}

/* the exclamation mark beats like a heart: two quick beats, then a rest */
@keyframes bang-beat {
  0%, 46%, 100% { transform: none; }
  6% { transform: scale(1.32) rotate(8deg); }
  14% { transform: scale(0.9) rotate(-2deg); }
  22% { transform: scale(1.2) rotate(5deg); }
  32% { transform: scale(0.97); }
  40% { transform: none; }
}

@keyframes slate {
  from { opacity: 0; transform: translateY(-14px) rotate(-24deg); }
  to { opacity: 1; transform: none; }
}

@keyframes slam {
  0% { opacity: 0; transform: scale(2.6) rotate(-8deg); }
  60% { opacity: 1; transform: scale(0.9); }
  100% { opacity: 1; transform: none; }
}

@keyframes quake {
  0%, 18%, 36%, 54%, 72%, 100% { transform: none; }
  4%, 40%, 76% { transform: translate(-6px, 4px); }
  8%, 44%, 80% { transform: translate(5px, -4px); }
  12%, 48%, 84% { transform: translate(-3px, 2px); }
}

@keyframes hanko {
  0% { opacity: 0; transform: scale(2.2) rotate(-30deg); }
  70% { opacity: 1; transform: scale(0.92) rotate(-4deg); }
  100% { opacity: 1; transform: rotate(-6deg); }
}

@media (prefers-reduced-motion: no-preference) {
  /* our lines letter in once their panel is in (the cover's as soon as the page opens) */
  .js .chapter .dub .ch {
    opacity: 0;
  }

  .js .panel.scene.is-on .dub .ch,
  .js .chapter--cover.is-inked .cover__scene .dub .ch {
    animation: ch-in 260ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 500ms) + var(--k) * var(--step, 26ms)) both;
  }

  /* the cover: impact lines once, the logo drops in, the katakana follows */
  .js .chapter--cover.is-inked .cover__scene::after {
    animation: impact 700ms var(--ease-out) 180ms both;
  }

  .logo--hero .lf-l,
.logo--hero .lf-bang {
    animation: lf-drop 560ms var(--ease-out) both;
    animation-delay: calc(var(--n) * 80ms + 120ms);
  }

  .is-live .logo--hero .lf-bang {
    animation:
      lf-drop 560ms var(--ease-out) both,
      bang-beat 2.2s var(--ease-out) infinite;
    animation-delay: calc(var(--n) * 80ms + 120ms), 1.4s;
  }

  .logo--hero .lf-shadow {
    animation: fade-in 320ms linear 900ms both;
  }

  .js .cover__kana .ch {
    opacity: 0;
  }

  .js .chapter--cover.is-inked .cover__kana .ch {
    animation: kana-drop 420ms var(--ease-pop) calc(900ms + var(--k) * var(--step, 70ms)) both;
  }

  /* the booth */
  .booth[data-state="take"] .say .ch,
.booth[data-state="play"] .say .ch {
    animation-name: say-pop;
  }

  .booth__count:not(:empty) {
    animation: count-pop 600ms var(--ease-out) both;
  }

  .booth[data-state="cut"] .booth__stamp {
    animation: hanko 380ms var(--ease-pop) both;
  }

  .booth[data-state="take"] .booth__rec::before {
    animation: rec-blink 1s steps(1, end) infinite;
  }
}

@keyframes ch-in {
  from { opacity: 0; transform: scale(1.8) translateY(-0.2em) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes impact {
  0% { opacity: 0; transform: scale(1.6); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes kana-drop {
  from { opacity: 0; transform: translateY(-120%) scale(1.3); }
  to { opacity: 1; transform: none; }
}

/* titles that are boxes or slabs carry no brush underline */
.chapter__title.title--box::after,
.chapter__title.title--slab::after {
  display: none;
}

.chapter__title.title--burst {
  justify-self: start;
}

@media (min-width: 48rem) {
  .chapter__title.title--burst {
    margin-inline-start: max(-1.2em, calc(8px - var(--page-pad)));
  }
}

.chapter__title.title--burst::after {
  inset: 5px;
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  background: var(--color-paper);
  transform: none;
  -webkit-mask: none;
  mask: none;
  clip-path: var(--burst);
  animation: none;
}

.chapter__title.title--bubble::after {
  position: absolute;
  top: calc(100% - 3px);
  left: 18%;
  display: block;
  width: 26px;
  height: 30px;
  margin: 0;
  background: var(--color-ink);
  transform: none;
  -webkit-mask: none;
  mask: none;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  animation: none;
}

@keyframes say-pop {
  from { opacity: 0.16; transform: translateY(0.25em) scale(1.35); }
  to { opacity: 1; transform: none; }
}

@keyframes count-pop {
  0% { opacity: 0; transform: scale(2.2) rotate(-10deg); }
  30% { opacity: 1; transform: scale(0.94) rotate(3deg); }
  55% { transform: none; }
  100% { opacity: 0.85; transform: scale(0.9); }
}

@keyframes rec-blink {
  50% { opacity: 0.15; }
}

/* ------------------------------------------------------------------ extra motion: parallax cover, live film, booth effects */
@property --dot {
  syntax: "<length>";
  inherits: false;
  initial-value: 12px;
}

@media (prefers-reduced-motion: no-preference) {

  /* the film runs while a take records or plays back */
  .booth:is([data-state="take"], [data-state="play"]) .reel {
    animation: film-run 0.28s linear infinite;
  }

  /* clapperboard: drops in, claps, then the countdown takes over */
  .booth[data-state="count"] .booth__slate {
    animation: slate-drop 260ms var(--ease-pop) both;
  }

  .booth[data-state="count"] .booth__clap {
    animation: clap 300ms var(--ease-in) 260ms both;
  }

  .booth[data-state="count"] .booth__kachi {
    animation: stamp 220ms var(--ease-out) 540ms both;
  }

  /* switching scenes: the new panel prints through growing screentone dots */
  .booth__panel.is-switching .booth__scene:not([hidden]) {
    -webkit-mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.5px)) 50% 50% / 16px 16px;
    mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.5px)) 50% 50% / 16px 16px;
    animation: halftone-in 560ms var(--ease-out) both;
  }

  /* a shouted line shakes the panel when it lands */
  .booth:is([data-state="take"], [data-state="play"]) .booth__panel.has-shout > .panel__body {
    animation: quake 420ms linear var(--shout-at, 0ms) 1 both;
  }

  /* the verdict lands like a stamp */
  .booth__verdict:not([hidden]) {
    animation: verdict-in 420ms var(--ease-pop) both;
  }

}

@keyframes film-run {
  to { background-position: -15px 7px, -15px calc(100% - 7px), 0 0; }
}

@keyframes slate-drop {
  from { opacity: 0; transform: translateY(-140%) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes clap {
  from { transform: rotate(-24deg); }
  to { transform: none; }
}

@keyframes halftone-in {
  from { --dot: 0px; }
  to { --dot: 12px; }
}

@keyframes verdict-in {
  0% { opacity: 0; transform: scale(1.8) rotate(-8deg); }
  60% { opacity: 1; transform: scale(0.94) rotate(1deg); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {

  /* the play button breathes, and jumps under the pointer */

  /* playback looks like a projector: a flicker and a scratch running down the film */
  .booth[data-state="play"] .booth__scene {
    animation: projector 0.16s steps(2, end) infinite;
  }

  .booth[data-state="play"] .booth__scene::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 30%;
    z-index: 3;
    width: 2px;
    background: color-mix(in oklch, var(--color-ink) 45%, transparent);
    animation: scratch 1.3s steps(9, end) infinite;
    pointer-events: none;
  }
}

@keyframes streak {
  to { -webkit-mask-position: 0 0, 0 130px; mask-position: 0 0, 0 130px; }
}

@keyframes projector {
  0% { opacity: 1; }
  50% { opacity: 0.94; }
}

@keyframes scratch {
  0% { left: 22%; opacity: 0; }
  20% { opacity: 1; }
  50% { left: 61%; }
  80% { opacity: 0.6; }
  100% { left: 38%; opacity: 0; }
}

.booth__lines li.booth__beat.is-now {
  color: var(--color-paper);
}

/* ------------------------------------------------------------------ booth: live meter and the drawn take */
.booth__meter {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  z-index: 6;
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 1.7rem;
  margin: 0;
  padding: 4px 6px;
  background: var(--color-ink);
}

.booth:is([data-state="take"], [data-state="play"]) .booth__meter {
  display: flex;
}

/* a ladder of bars: each one lights when the voice gets past its step */
.booth__meter i {
  width: 4px;
  height: calc((var(--i) + 1) / 7 * 100%);
  background: var(--color-paper);
  opacity: clamp(0.22, calc((var(--amp, 0) * 1.8 - var(--i) * 0.13) * 6), 1);
  transition: opacity 80ms linear;
}

.booth__wave {
  position: relative;
  justify-self: stretch;
  height: 3rem;
  border: var(--rule-thin) solid var(--color-ink);
  background: var(--color-paper);
  overflow: hidden;
  --p: 1;
}

.booth__wave svg {
  display: block;
  width: 100%;
  height: 100%;
}

.booth__wave rect {
  fill: var(--color-ink);
}

/* the part of the take still to come is pencil-light; the playhead moves across it */
.booth__wave::after {
  content: "";
  position: absolute;
  inset: 0 0 0 calc(var(--p) * 100%);
  background: color-mix(in oklch, var(--color-paper) 62%, transparent);
  pointer-events: none;
}

.booth__head {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--p) * 100%);
  z-index: 1;
  width: 2px;
  margin-left: -1px;
  background: var(--color-ink);
}

.booth__wave-label {
  position: absolute;
  top: 2px;
  left: 4px;
  z-index: 2;
  padding: 0 0.3em;
  background: var(--color-paper);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ------------------------------------------------------------------ premium motion: small, purposeful */
@media (prefers-reduced-motion: no-preference) {
  /* the take is drawn in, bar by bar, the moment the director shouts cut */
  .booth__wave.is-drawn rect {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: wave-in 460ms var(--ease-out) calc(var(--i) * 9ms) both;
  }

  /* picking a scene: the frame snaps onto the card */
  .reel__shot {
    outline: 3px solid transparent;
    outline-offset: 10px;
    transition: outline-offset 260ms var(--ease-out), outline-color 160ms linear;
  }

  /* panels print in through screentone dots when their image arrives */
  .js img.is-pending {
    opacity: 0;
  }

  img.is-printed {
    -webkit-mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.5px)) 0 0 / 10px 10px;
    mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.5px)) 0 0 / 10px 10px;
    animation: print-in 520ms var(--ease-out) both;
  }

  /* the logo's O mouths along when you point at it */
  @media (hover: hover) and (pointer: fine) {
    .masthead__brand:hover .lf-mouth {
      animation: lf-flap 440ms steps(1, end) 2;
    }
  }

  /* switching scenes: the panel morphs to its new shape, the script cross-fades */
  .booth__panel {
    view-transition-name: booth-panel;
  }

  .booth__script {
    view-transition-name: booth-script;
  }

  ::view-transition-group(booth-panel),
  ::view-transition-group(booth-script) {
    animation-duration: 380ms;
    animation-timing-function: var(--ease-out);
  }

  ::view-transition-old(booth-script) {
    animation: vt-out 180ms linear both;
  }

  ::view-transition-new(booth-script) {
    animation: vt-in 260ms var(--ease-out) 90ms both;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

@keyframes wave-in {
  from { transform: scaleY(0.05); }
  to { transform: none; }
}

@keyframes print-in {
  from { --dot: 0px; }
  to { --dot: 8px; }
}

@keyframes vt-out {
  to { opacity: 0; }
}

@keyframes vt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ manga motion
 * The page assembles like a manga page being read: each panel is cut in when it reaches the
 * screen, then its balloons, sound effects and lines land in order. Everything plays once;
 * the only loops are the sound effects that would move in a manga (rumble, chomp, laugh),
 * in short bursts and only while their page is on screen. Hidden states exist only with JS on
 * and motion allowed, and use clip-path/opacity, so nothing shifts the layout. */
@media (prefers-reduced-motion: no-preference) {
  /* panels: a diagonal cut, left to right, staggered with whatever arrives with them.
   * (Waiting panels are hidden with opacity, not clip-path: Chrome's IntersectionObserver
   * counts a fully clipped element as off screen, so it would never be cut in.) */
  .js .panel.scene:not(.is-on) {
    opacity: 0;
  }

  .js .panel.scene.is-on {
    animation: panel-cut 620ms var(--ease-out) var(--d, 0ms) backwards;
  }

  /* extra balloons pop out of their tails */
  .js .panel.scene.is-on .bubble,
  .js .chapter--cover.is-inked .cover__aside {
    animation: bubble-pop 460ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms)) backwards;
  }

  .js .chapter--cover:not(.is-inked) :is(.cover__aside, .sfx--flop) {
    opacity: 0;
  }

  .bubble.tail-bl { transform-origin: 18% 115%; }
  .bubble.tail-br { transform-origin: 82% 115%; }
  .bubble:is(.tail-l, .tail-thought-l) { transform-origin: -8% 60%; }
  .bubble.tail-r { transform-origin: 108% 60%; }

  /* sound effects land like a stamp; lettered ones come in glyph by glyph */
  .js .panel.scene.is-on .sfx:not(:has(.glyph)),
  .js .chapter--cover.is-inked .sfx--flop {
    animation: sfx-stamp 420ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms)) backwards;
  }

  .js .panel.scene.is-on .sfx .glyph {
    animation: glyph-in 320ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + var(--k) * 110ms) backwards;
  }

  /* …and keep going the way they would in a manga, in bursts, while their page is on screen */
  .is-live .panel.scene.is-on .sfx--gogo .glyph {
    animation:
      glyph-in 320ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + var(--k) * 110ms) backwards,
      rumble 2.6s linear calc(var(--d, 0ms) + var(--pop-delay, 600ms) + 900ms + var(--k) * 90ms) infinite;
  }

  .is-live .panel.scene.is-on .sfx--paku .glyph {
    animation:
      glyph-in 320ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + var(--k) * 110ms) backwards,
      chomp 2s steps(1, end) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + 1000ms + var(--k) * 130ms) infinite;
  }

  .is-live .panel.scene.is-on .sfx--waha .glyph {
    animation:
      glyph-in 320ms var(--ease-pop) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + var(--k) * 110ms) backwards,
      laugh 2.8s var(--ease-out) calc(var(--d, 0ms) + var(--pop-delay, 600ms) + 900ms + var(--k) * 140ms) infinite;
  }

  /* narration captions are taped on; the take number is stamped after the last line */
  .js .panel.scene.is-on .caption {
    animation: tape 440ms var(--ease-out) calc(var(--d, 0ms) + 360ms) backwards;
  }

  .js .panel.scene.is-on .take {
    animation: take-stamp 380ms var(--ease-pop) calc(var(--d, 0ms) + var(--take-at, 1400ms)) backwards;
  }

  /* section titles, each its own device */
  .js .chapter__title:not(.is-on) {
    opacity: 0;
  }

  .chapter__title.title--box.is-on {
    animation: title-drop 640ms var(--ease-out) var(--d, 0ms) backwards;
  }

  .chapter__title.title--slab.is-on {
    animation: tape 520ms var(--ease-out) var(--d, 0ms) backwards;
  }

  .chapter__title.title--reel.is-on {
    animation:
      reel-in 640ms var(--ease-out) var(--d, 0ms) backwards,
      reel-run 640ms var(--ease-out) var(--d, 0ms) backwards;
  }

  .chapter__title.title--burst.is-on {
    animation: burst-pop 560ms var(--ease-pop) var(--d, 0ms) backwards;
  }

  .chapter__title.title--bubble.is-on {
    transform-origin: 18% 120%;
    animation: bubble-pop 520ms var(--ease-pop) var(--d, 0ms) backwards;
  }

  /* how a round goes: the arrow is drawn to its panel, the step number is stamped, then the note */
  .yon__arrow path {
    stroke-dasharray: 1;
  }

  .js .yon__note:not(.is-on) :is(.yon__arrow path, .yon__title, .yon__text) {
    opacity: 0;
  }

  .js .yon__note.is-on .yon__arrow path {
    animation: draw 360ms var(--ease-in-out) calc(var(--d, 0ms) + 380ms) backwards;
  }

  .js .yon__note.is-on .yon__arrow path.yon__head {
    animation-duration: 200ms;
    animation-delay: calc(var(--d, 0ms) + 720ms);
  }

  .js .yon__note.is-on .yon__n {
    animation: take-stamp 360ms var(--ease-pop) calc(var(--d, 0ms) + 820ms) backwards;
  }

  .js .yon__note.is-on .yon__title {
    animation: note-in 420ms var(--ease-out) calc(var(--d, 0ms) + 780ms) backwards;
  }

  .js .yon__note.is-on .yon__text {
    animation: note-in 420ms var(--ease-out) calc(var(--d, 0ms) + 900ms) backwards;
  }

  /* FAQ: the question man asks (and tilts his head), a beat later the mouth answers */
  .js .qa:not(.is-in) :is(.bubble, .qa__who) {
    opacity: 0;
  }

  .qa.is-in .qa__q .qa__who {
    animation: huh 520ms var(--ease-out) backwards;
  }

  .qa.is-in .qa__q .bubble {
    transform-origin: -6% 50%;
    animation: bubble-pop 440ms var(--ease-pop) 160ms backwards;
  }

  .qa.is-in .qa__a .qa__who {
    animation: who-in 320ms var(--ease-out) 560ms backwards;
  }

  .qa.is-in .qa__a .bubble {
    transform-origin: 106% 50%;
    animation: bubble-pop 440ms var(--ease-pop) 680ms backwards;
  }

  .qa.is-in .logo-mouth {
    transform-origin: 50% 70%;
    animation: talk 150ms steps(1, end) 760ms 6;
  }

  /* the finale: focus lines burst, ドン lands and shakes the page, the line slams in word by word */
  .js .chapter--beta:not(.is-inked) :is(.beta__lines, .sfx--beta, .slam, .beta__text, .cta) {
    opacity: 0;
  }

  .chapter--beta.is-inked .beta__lines {
    animation: lines-in 760ms var(--ease-out) backwards;
  }

  .chapter--beta.is-inked .sfx--beta {
    animation: sfx-stamp 420ms var(--ease-pop) 240ms backwards;
  }

  .chapter--beta.is-inked .beta__page {
    animation: quake 460ms linear 420ms 1;
  }

  .chapter--beta.is-inked .slam {
    animation: slam 440ms var(--ease-out) calc(560ms + var(--k) * 160ms) backwards;
  }

  .chapter--beta.is-inked .beta__text {
    animation: note-in 460ms var(--ease-out) 1120ms backwards;
  }

  .chapter--beta.is-inked .cta {
    animation: note-in 460ms var(--ease-out) 1260ms backwards;
  }

  /* the end: 完 is stamped like a seal */
  .js .colophon:not(.is-inked) .colophon__kan {
    opacity: 0;
  }

  .colophon.is-inked .colophon__kan {
    animation: seal 460ms var(--ease-pop) 160ms backwards;
  }

  /* pointing at a panel nudges its sound effect */
  @media (hover: hover) and (pointer: fine) {
    .panel.scene .sfx:not(:has(.glyph)) {
      transition: scale 220ms var(--ease-pop), rotate 220ms var(--ease-pop);
    }

    .panel.scene.is-on:hover .sfx:not(:has(.glyph)) {
      scale: 1.14;
      rotate: -5deg;
    }
  }
}

@keyframes panel-cut {
  from { clip-path: polygon(0 0, 0 0, -16% 100%, 0 100%); }
  to { clip-path: polygon(0 0, 116% 0, 100% 100%, 0 100%); }
}

@keyframes bubble-pop {
  0% { opacity: 0; transform: scale(0.15); }
  55% { opacity: 1; transform: scale(1.08); }
  78% { transform: scale(0.97); }
  100% { opacity: 1; transform: none; }
}

@keyframes sfx-stamp {
  0% { opacity: 0; transform: scale(2.4) rotate(-14deg); }
  55% { opacity: 1; transform: scale(0.9) rotate(3deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes glyph-in {
  from { opacity: 0; scale: 2.1; translate: 0 -35%; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}

@keyframes rumble {
  0%, 26%, 100% { translate: 0 0; }
  4% { translate: -2px 1px; }
  8% { translate: 2px -1px; }
  12% { translate: -1px -2px; }
  16% { translate: 2px 1px; }
  20% { translate: -2px 0; }
}

@keyframes chomp {
  0%, 30%, 100% { scale: 1; }
  8% { scale: 1.14 0.8; }
  16% { scale: 1; }
  24% { scale: 1.1 0.84; }
}

@keyframes laugh {
  0%, 24%, 100% { translate: 0 0; }
  7% { translate: 0 -22%; }
  14% { translate: 0 0; }
  19% { translate: 0 -9%; }
}

@keyframes tape {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes take-stamp {
  0% { opacity: 0; transform: scale(2.3) rotate(-16deg); }
  65% { opacity: 1; transform: scale(0.92) rotate(2deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes title-drop {
  0% { opacity: 0; transform: translateY(-60%); }
  55% { opacity: 1; transform: translateY(4%) scale(1.03, 0.92); }
  78% { transform: translateY(-2%) scale(0.99, 1.02); }
  100% { opacity: 1; transform: none; }
}

@keyframes reel-in {
  from { opacity: 0; transform: translateX(28%); }
  to { opacity: 1; transform: none; }
}

@keyframes reel-run {
  from { background-position: 66px 7px, 66px calc(100% - 7px), 0 0; }
}

@keyframes burst-pop {
  0% { opacity: 0; transform: scale(0.2) rotate(-24deg); }
  60% { opacity: 1; transform: scale(1.1) rotate(3deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes note-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes huh {
  0% { opacity: 0; transform: translateX(-40%); }
  45% { opacity: 1; transform: none; }
  62% { transform: rotate(-12deg); }
  80% { transform: rotate(5deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes who-in {
  from { opacity: 0; transform: translateX(40%); }
  to { opacity: 1; transform: none; }
}

@keyframes talk {
  50% { transform: scale(1.06, 0.8); }
}

@keyframes lines-in {
  from { opacity: 0; transform: scale(1.45); }
}

@keyframes seal {
  0% { opacity: 0; transform: scale(2.6) rotate(-24deg); }
  65% { opacity: 1; transform: scale(0.9) rotate(4deg); }
  100% { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ finishing touches */

/* printed paper: a faint grain over the whole page, like ink on newsprint (static, no motion) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: url("assets/art/grain.webp") 0 0 / 180px 180px;
  pointer-events: none;
}

@media print, (forced-colors: active) {
  body::after {
    display: none;
  }
}

::selection {
  background: var(--color-ink);
  color: var(--color-paper);
}

html {
  scrollbar-color: var(--color-ink) var(--color-paper);
}

/* the cover's retake stamp: a two-part label, take number in ink, the action on paper */
.retake {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-sm);
  z-index: 4;
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  border: var(--rule-thin) solid var(--color-ink);
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  line-height: 1;
  box-shadow: 3px 3px 0 var(--color-ink);
  cursor: pointer;
  transition: translate var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}

.retake[hidden] {
  display: none;
}

.retake__n,
.retake__go {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.5em 0.65em;
}

.retake__n {
  background: var(--color-ink);
  color: var(--color-paper);
  font-variant-numeric: tabular-nums;
}

.retake__icon {
  display: inline-block;
  font-size: 1.15em;
  transition: rotate 320ms var(--ease-out);
}

.retake:hover {
  translate: -2px -2px;
  box-shadow: 5px 5px 0 var(--color-ink);
}

.retake:hover .retake__icon {
  rotate: -200deg;
}

.retake:active {
  translate: 2px 2px;
  box-shadow: 1px 1px 0 var(--color-ink);
}

.retake:focus-visible {
  outline: 3px solid var(--color-paper);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--color-ink);
}

@media (min-width: 60rem) {
  /* above the scene credit */
  .retake {
    bottom: calc(var(--space-sm) + 1.9rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .retake,
  .retake__icon {
    transition: none;
  }
}

/* the end: 完, and a way back to page one */
.colophon__fin {
  display: grid;
  justify-items: start;
  gap: var(--space-sm);
}

.colophon__again {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.colophon__again span {
  display: inline-block;
  transition: rotate 320ms var(--ease-out);
}

.colophon__again:hover span {
  rotate: -200deg;
}

/* how a round goes, on wide screens: the four panels run down the middle as one strip and the
 * notes sit in the margins on alternate sides, like an editor's notes on a yonkoma page
 * (from 75rem: below that the margins are too narrow for the notes) */
@media (min-width: 75rem) {
  #how .title--box {
    width: min(100%, 36rem);
    margin-inline: auto;
  }

  .yonkoma {
    width: 100%;
  }

  .yon {
    grid-template-columns: minmax(0, 1fr) minmax(0, 36rem) minmax(0, 1fr);
    gap: var(--space-lg);
  }

  .yon__arrow {
    left: calc(var(--space-lg) * -1 - 4px);
  }

  .yon > .panel--yon {
    grid-column: 2;
    grid-row: 1;
  }

  .yon > .yon__note {
    grid-column: 3;
    grid-row: 1;
  }

  .yon:nth-child(even) > .yon__note {
    grid-column: 1;
    justify-self: end;
    padding-inline: 0 var(--space-xs);
    text-align: right;
  }

  /* mirrored: the step number sits on the strip side, next to the arrow */
  .yon:nth-child(even) .yon__title {
    flex-direction: row-reverse;
  }

  .yon:nth-child(even) .yon__arrow {
    right: calc(var(--space-lg) * -1 - 4px);
    left: auto;
    scale: -1 1;
  }
}
