/* Piano Roll (v22): a player piano roll running down the page. */

:root {
  --paper: #efe2c2;
  --ink: #211a13;
  --ink-soft: #5b4d3d;
  --red: #a3301c;
  --hole: #150d09;
  --lamp: #ffc864;
  --wood: #1b100b;
  --brass-hi: #f6dc8e;
  --brass: #c4953a;
  --brass-lo: #6c4816;
  --display: "Linden Hill", "Iowan Old Style", Georgia, serif;
  --text: "Old Standard TT", "Iowan Old Style", Georgia, serif;

  --u: 16px;
  --paper-w: min(1040px, calc(100% - 64px));
  --m-w: 300px;
  --l-w: 112px;
  --gap: 22px;
  --pad: 44px;
  --hw: 1.75%;
  --plate-h: 76px;
  --keys-h: 24px;
  --bar-y: 58vh;
  --px: 32px;
  --pw: calc(100vw - 64px);
  --fx: 50vw;
  --fw: 40vw;
}

* { box-sizing: border-box; }

html {
  background: var(--wood);
  scroll-padding-bottom: calc(var(--plate-h) + 24px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--text);
}

/* The case of the instrument stays still while the paper moves. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90% 55% at 50% 58%, rgba(255, 170, 80, .07), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .016) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .14) 0 3px, transparent 3px 29px),
    repeating-linear-gradient(90deg, rgba(120, 60, 30, .08) 0 40px, transparent 40px 97px),
    linear-gradient(90deg, #0e0704, #23140c 18%, #1c110a 50%, #25150d 82%, #0e0704);
}

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }

.case {
  overflow-x: hidden;
  overflow-x: clip;
  padding-bottom: calc(var(--plate-h) + 40px + env(safe-area-inset-bottom));
}

/* Paper */
.sheet {
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .27 0 0 0 0 .14 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='600'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5 .006' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, rgba(126, 92, 40, .2), rgba(126, 92, 40, 0) 3.5%, rgba(126, 92, 40, 0) 96.5%, rgba(126, 92, 40, .2));
  background-size: 240px 240px, 300px 600px, 100% 100%;
}

.paper {
  position: relative;
  z-index: 1;
  width: var(--paper-w);
  margin: -16px auto 0;
}
.paper .roll,
.paper .ghost { box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 0 46px rgba(0, 0, 0, .55); }

/* Spool at the head of the roll */
.spool {
  position: relative;
  z-index: 3;
  height: 46px;
  width: min(1124px, calc(100% - 6px));
  margin: 0 auto;
}
.spool .rod {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 11px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(to bottom, #120a06 0%, #5d3b22 22%, #93653f 38%, #4c2e19 70%, #120a06 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .55);
}
.fl {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi) 40%, var(--brass) 66%, var(--brass-lo));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
}
.spool .fl { top: 0; width: 22px; height: 46px; }
.spool .fl.l { left: 8px; }
.spool .fl.r { right: 8px; }
.spool .hook {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 8px;
  height: 24px;
  margin-left: -4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi), var(--brass-lo));
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}

/* Leader: the tapered start of the roll with its printed label */
.leader {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 150px var(--pad) 36px;
  clip-path: polygon(44% 0, 56% 0, 56% 30px, 100% 150px, 100% 100%, 0 100%, 0 150px, 44% 30px);
}
.eyelet {
  position: absolute;
  left: 50%;
  top: 22px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hole) 0 4px, var(--brass-hi) 4.5px 6px, var(--brass-lo) 7px 8.5px, transparent 9px);
}
.label {
  display: inline-block;
  max-width: 100%;
  padding: 28px clamp(18px, 4vw, 60px) 24px;
  border: 1.5px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}
.label h1 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(44px, 7.2vw, 102px);
  line-height: .95;
  letter-spacing: -.005em;
}
.label .line {
  margin: 16px 0 0;
  font-style: italic;
  font-size: clamp(17px, 1.6vw, 21px);
}
.label .count {
  margin: 14px 0 0;
  font-size: 12.5px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--red);
}

/* Passages */
.roll { list-style: none; margin: 0; padding: 0; }
.pgrid {
  display: grid;
  grid-template-columns: var(--m-w) var(--l-w) minmax(0, 1fr);
  column-gap: var(--gap);
  padding: 0 var(--pad);
}
.passage {
  position: relative;
  color: inherit;
  text-decoration: none;
  border-top: 3px double rgba(33, 26, 19, .3);
}
.roll li:first-child .passage { border-top-color: transparent; }
.passage::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--red);
  opacity: 0;
  transition: opacity .2s;
}
.passage:hover::after { opacity: .85; }
.passage:hover .title,
.passage:focus-visible .title {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}
.passage:focus-visible { outline: 2px solid var(--red); outline-offset: -6px; }

.note {
  min-width: 0;
  padding: calc(var(--u) * 1.3) 0 calc(var(--u) * 2.5);
}
.no {
  display: block;
  font-family: var(--display);
  font-size: 56px;
  line-height: 1;
  color: var(--red);
}
.no-pre {
  font-family: var(--text);
  font-size: .3em;
  letter-spacing: .14em;
  text-transform: uppercase;
  vertical-align: .9em;
  margin-right: .15em;
}
.title {
  margin: 10px 0 14px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.04;
  overflow-wrap: break-word;
}
.kind {
  display: inline-block;
  padding: 5px 8px 4px 10px;
  border: 1px solid currentColor;
  font-size: 12.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--red);
}
.tag {
  margin: 16px 0 0;
  max-width: 30ch;
  font-style: italic;
  font-size: 18px;
  line-height: 1.45;
}
.tempo {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
}

/* Words printed beside their notes, as on a word roll */
.lyrics { position: relative; min-width: 0; }
.ly {
  position: absolute;
  right: 0;
  top: calc(var(--y) * var(--u) - 3px);
  font-style: italic;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-soft);
}

/* The hole field */
.field {
  position: relative;
  min-width: 0;
  height: calc(var(--units) * var(--u));
}
.expr {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.expr path {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.4;
  opacity: .72;
  vector-effect: non-scaling-stroke;
}
.h {
  position: absolute;
  top: calc(var(--y) * var(--u));
  height: calc(var(--l) * var(--u));
  left: calc((var(--c) + .5) * 3.125% - var(--hw) / 2);
  width: var(--hw);
  border-radius: 999px;
  background-color: var(--hole);
  box-shadow: inset 0 2px 1px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 250, 232, .6);
  transition: background-color .9s ease-out, box-shadow .9s ease-out;
}
.h.p {
  --hw: 2.7%;
  border-radius: 4px;
}
.h.lit {
  background-color: var(--lamp);
  box-shadow: 0 0 5px 1px rgba(255, 205, 110, .95), 0 0 18px 5px rgba(255, 160, 60, .45);
  transition: none;
}

/* The unpunched end of the roll: pencil marks for the next passage */
.ghost .note { padding-bottom: 0; }
.ghost .no { color: rgba(80, 66, 50, .42); font-style: italic; }
.pencil {
  height: calc(var(--u) * 22);
  background-image: radial-gradient(circle, rgba(72, 60, 46, .3) 0 1px, transparent 1.7px);
  background-size: 3.125% calc(var(--u) * 2);
  -webkit-mask-image: linear-gradient(#000 25%, transparent 95%);
  mask-image: linear-gradient(#000 25%, transparent 95%);
}

/* Supply spool: the rest of the roll, still wound */
.supply { position: relative; height: 136px; margin-top: 0; }
.wound {
  position: relative;
  width: var(--paper-w);
  height: 100%;
  margin: 0 auto;
  border-radius: 0 0 14px 14px / 0 0 26px 26px;
  background: linear-gradient(to bottom, #8e7a52 0%, #e6d8b4 12%, #faf2dc 30%, #efe2c2 52%, #c9b488 78%, #6f5b38 100%);
  box-shadow: 0 26px 40px rgba(0, 0, 0, .6);
}
.wound .fl { top: -20px; bottom: -20px; width: 26px; }
.wound .fl.l { left: -20px; }
.wound .fl.r { right: -20px; }

/* Tracker bar, fixed across the paper */
.bar {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--bar-y) - 60px);
  height: 120px;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}
.bar > * { position: absolute; }
.bar-glow {
  left: var(--px);
  width: var(--pw);
  top: 0;
  height: 120px;
  background: radial-gradient(55% 46% at 50% 50%, rgba(255, 196, 100, .2), rgba(255, 196, 100, 0) 72%);
}
.bar-crest {
  left: var(--px);
  width: var(--pw);
  top: 34px;
  height: 52px;
  background: linear-gradient(to bottom,
    rgba(80, 52, 18, 0) 0%,
    rgba(80, 52, 18, .1) 36%,
    rgba(255, 249, 228, .5) 50%,
    rgba(80, 52, 18, .17) 58%,
    rgba(80, 52, 18, 0) 100%);
}
.bar-end {
  top: 50px;
  height: 20px;
  width: 70px;
  border-radius: 4px;
  background: linear-gradient(to bottom, var(--brass-lo), var(--brass-hi) 32%, var(--brass) 60%, var(--brass-lo));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .6);
}
.bar-end::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-hi), var(--brass-lo) 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.bar-end.l { left: calc(var(--px) - 62px); }
.bar-end.l::after { left: 18px; }
.bar-end.r { left: calc(var(--px) + var(--pw) - 8px); }
.bar-end.r::after { right: 18px; }
.bar-holes {
  left: var(--fx);
  width: var(--fw);
  top: 60px;
  height: 0;
}
.bar-holes i {
  position: absolute;
  top: -2px;
  left: calc((var(--c) + .5) * 3.125%);
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: rgba(60, 38, 14, .32);
}
.bar-holes i.on {
  background: var(--lamp);
  box-shadow: 0 0 6px 2px rgba(255, 190, 90, .9);
}

/* Plate: keys and controls, fixed at the foot of the screen */
.plate {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: calc(var(--plate-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .02) 0 1px, transparent 1px 11px),
    linear-gradient(#2c180e, #150b06);
  border-top: 1px solid rgba(246, 220, 142, .38);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .5);
}
.keys {
  position: absolute;
  top: 0;
  left: var(--fx);
  width: var(--fw);
  height: var(--keys-h);
  overflow: hidden;
  border-radius: 0 0 3px 3px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5);
}
.key {
  position: absolute;
  top: 0;
  border-radius: 0 0 2px 2px;
  transition: transform .08s, background .25s;
}
.key.w {
  height: 100%;
  background: linear-gradient(#f5eedc, #e2d4b2);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .35);
}
.key.b {
  z-index: 1;
  height: 62%;
  background: linear-gradient(#2d241c, #0c0805);
}
.key.w.down { background: linear-gradient(#ffe2a0, #f2b956); transform: translateY(1px); }
.key.b.down { background: linear-gradient(#b07c2c, #6a4512); transform: translateY(1px); }

.plate-row {
  position: absolute;
  left: var(--px);
  width: var(--pw);
  top: var(--keys-h);
  height: calc(var(--plate-h) - var(--keys-h));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  color: #f1e5c8;
  text-decoration: none;
}
.readout:hover .ro-title { text-decoration: underline; text-underline-offset: 4px; }
.ro-no {
  display: inline-block;
  flex: none;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  color: var(--brass-hi);
}
.ro-no.tick { animation: tick .38s ease-out; }
@keyframes tick {
  from { transform: translateY(60%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ro-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-style: italic;
  font-size: 18px;
}
.controls { display: flex; flex: none; gap: 10px; }
.switch,
.play {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(246, 220, 142, .5);
  border-radius: 999px;
  background: rgba(0, 0, 0, .25);
  color: #f1e5c8;
  font-size: 12.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.switch:hover,
.play:hover { border-color: var(--brass-hi); }
.sw-track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #0b0603;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9);
  transition: background .2s, box-shadow .2s;
}
.sw-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(var(--brass-hi), var(--brass-lo));
  transition: transform .2s;
}
.switch[aria-checked="true"] .sw-track { background: #4a3210; box-shadow: inset 0 0 7px rgba(255, 196, 100, .7); }
.switch[aria-checked="true"] .sw-knob { transform: translateX(14px); }
.sw-state { min-width: 2.1em; text-align: left; color: var(--brass-hi); }
.play::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 9px solid var(--brass-hi);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.play[aria-pressed="true"]::before {
  width: 10px;
  height: 10px;
  border: 0;
  background: var(--brass-hi);
}
.play[hidden] { display: none; }

/* Middle widths */
@media (max-width: 899px) {
  :root {
    --u: 15px;
    --paper-w: calc(100% - 40px);
    --m-w: 220px;
    --l-w: 84px;
    --gap: 16px;
    --pad: 24px;
    --hw: 1.9%;
  }
  .no { font-size: 46px; }
  .title { font-size: 32px; }
  .tag { font-size: 17px; }
  .ly { font-size: 14px; }
}

/* Phone: a narrower roll, larger margin print */
@media (max-width: 599px) {
  :root {
    --u: 13px;
    --paper-w: calc(100% - 28px);
    --gap: 12px;
    --pad: 12px;
    --hw: 2.3%;
    --plate-h: 70px;
    --keys-h: 20px;
  }
  .pgrid { grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); }
  .lyrics { display: none; }
  .leader {
    padding-top: 112px;
    padding-bottom: 28px;
    clip-path: polygon(40% 0, 60% 0, 60% 26px, 100% 112px, 100% 100%, 0 100%, 0 112px, 40% 26px);
  }
  .eyelet { top: 20px; }
  .label { padding: 22px 16px 20px; }
  .no { font-size: 40px; }
  .title { font-size: clamp(22px, 6.8vw, 27px); margin: 8px 0 12px; }
  .kind { font-size: 11.5px; letter-spacing: .18em; padding: 4px 6px 3px 8px; }
  .tag { font-size: 16.5px; line-height: 1.42; margin-top: 12px; }
  .tempo { font-size: 11.5px; letter-spacing: .16em; margin-top: 12px; }
  .wound .fl { width: 18px; }
  .wound .fl.l { left: -12px; }
  .wound .fl.r { right: -12px; }
  .bar-end { width: 60px; height: 16px; top: 52px; }
  .bar-end::after { display: none; }
  .bar-end.l { left: calc(var(--px) - 56px); }
  .bar-end.r { left: calc(var(--px) + var(--pw) - 4px); }
  .plate-row { gap: 10px; }
  .ro-no { font-size: 24px; }
  .ro-title { font-size: 16px; }
  .controls { gap: 8px; }
  .switch,
  .play { height: 40px; padding: 0 11px; gap: 7px; font-size: 11.5px; letter-spacing: .12em; }
  .sw-state { display: none; }
}

@media (max-width: 359px) {
  .sw-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .h, .key, .sw-knob, .sw-track, .passage::after { transition: none; }
  .ro-no.tick { animation: none; }
}

/* Fallback chapter page */
.chapter .ch-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: var(--paper-w);
  margin: 0 auto;
  padding: 22px 0 12px;
  color: #f1e5c8;
}
.home-link {
  font-family: var(--display);
  font-style: italic;
  font-size: 26px;
  text-decoration: none;
}
.home-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.basket {
  font-size: 12.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.ch-paper {
  margin-top: -16px;
  padding-top: 30px;
  padding-bottom: 50px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 0 46px rgba(0, 0, 0, .55);
}
.chapter .head .note { padding-top: calc(var(--u) * 1); }
.chapter .head .title { font-size: clamp(30px, 4.6vw, 56px); }
.ch-play {
  display: flex;
  justify-content: flex-end;
  padding: 10px var(--pad) 0;
}
.ch-play .play {
  border-color: rgba(33, 26, 19, .5);
  background: transparent;
  color: var(--ink);
}
.ch-play .play::before { border-left-color: var(--red); }
.ch-play .play[aria-pressed="true"]::before { background: var(--red); }
.playhead {
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0;
  height: 2px;
  background: var(--lamp);
  box-shadow: 0 0 8px 2px rgba(255, 180, 80, .7);
  opacity: 0;
  pointer-events: none;
}
.playhead.on { opacity: 1; }

.ch-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px var(--pad) 0;
  font-size: 19px;
  line-height: 1.62;
}
.ch-body .lede {
  margin: 30px 0 36px;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.22;
}
.ch-body h2 {
  margin: 44px 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 2.6vw, 32px);
  line-height: 1.15;
}
.ch-body p { margin: 0 0 14px; }
.ch-body .sec { margin: 0; }
.pic {
  margin: 36px 0;
  padding: 10px;
  border: 1px solid rgba(33, 26, 19, .45);
  background: rgba(255, 255, 255, .25);
}
.pic img { display: block; width: 100%; height: auto; }
.posters {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px;
}
.posters li { min-width: 0; font-size: 15px; line-height: 1.4; }
.posters img {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.posters .pt { display: block; font-family: var(--display); font-size: 20px; }
.posters .pp { display: block; color: var(--red); }
.posters .pe { display: block; color: var(--ink-soft); }
.stickers {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.stickers li {
  padding: 14px 18px;
  background: #fbf8ef;
  border: 1px solid rgba(33, 26, 19, .25);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  font-family: var(--display);
  font-style: italic;
  font-size: 24px;
  line-height: 1.1;
}
.stickers li:nth-child(odd) { transform: rotate(-2deg); }
.stickers li:nth-child(even) { transform: rotate(1.5deg); }
.details {
  list-style: none;
  counter-reset: d;
  margin: 10px 0 0;
  padding: 0;
}
.details li {
  counter-increment: d;
  position: relative;
  padding: 8px 0 8px 40px;
  border-bottom: 1px solid rgba(33, 26, 19, .18);
}
.details li::before {
  content: counter(d, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 11px;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--red);
}
.buy {
  margin: 52px 0 0;
  padding: 26px 26px 22px;
  border: 1.5px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 5px;
  text-align: center;
}
.buy .price { display: block; font-family: var(--display); font-size: 44px; line-height: 1; }
.buy .ed {
  display: block;
  margin-top: 10px;
  font-size: 12.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
}
.buy button {
  margin-top: 18px;
  min-height: 46px;
  padding: 0 26px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
}
.buy button:hover { background: var(--red); border-color: var(--red); }
.buy button[disabled] { background: transparent; color: var(--ink); cursor: default; }
.buy .ok { margin: 12px 0 0; min-height: 1.4em; font-style: italic; }
.ch-nav {
  max-width: 700px;
  margin: 56px auto 0;
  padding: 26px var(--pad) 0;
  border-top: 3px double rgba(33, 26, 19, .3);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}
.ch-nav a { text-decoration: none; min-width: 0; }
.ch-nav .home { font-family: var(--display); font-style: italic; font-size: 22px; }
.ch-nav .next { text-align: right; }
.ch-nav .nx-label {
  display: block;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
}
.ch-nav .nx-title { display: block; font-family: var(--display); font-size: 26px; line-height: 1.15; overflow-wrap: break-word; }
.ch-nav a:hover .nx-title,
.ch-nav .home:hover { text-decoration: underline; text-underline-offset: 5px; }
.chapter { --u: 10px; }
.chapter .case { padding-bottom: 60px; }

@media (max-width: 599px) {
  .chapter { --u: 7px; }
  .chapter .head .title { font-size: clamp(23px, 7.2vw, 29px); }
  .chapter .ch-top { padding-top: 16px; }
  .home-link { font-size: 22px; }
  .ch-body { font-size: 17px; line-height: 1.6; padding-top: 12px; }
  .buy { padding: 22px 16px 18px; }
  .buy .price { font-size: 38px; }
  .ch-nav { flex-direction: column; align-items: stretch; }
  .ch-nav .next { text-align: left; }
}
