.sx {
  --ink: rgb(22 18 14);
  --pen: #fff6e4;
  --pink: #ff3d93;
  --stamp: #c4261a;
  --typed: "Courier Prime", monospace;
  --lay: drop-shadow(1.5px 2px 1px rgb(0 0 0 / 0.55));
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: #0d0b0a url("./floor.jpg") center / cover;
  color: var(--ink);
  font-family: "Permanent Marker", cursive;
}

.sx *,
.sx *::before,
.sx *::after {
  box-sizing: border-box;
}

.sx p {
  margin: 0;
}

/* one grain over boards, paper and tape alike */
.sx::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  mix-blend-mode: overlay;
  opacity: 0.22;
}

/* the stage light falls off from the upper left, over the paper as over the boards */
.sx::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(135% 135% at 4% 0%, #fff3e2 0%, #f3e6da 36%, #decfc8 72%, #d0c0be 100%);
  mix-blend-mode: multiply;
}

/* the running order: eight lines of 48 px; more than that and the list moves up a line at a time */
.sx-list {
  position: absolute;
  left: 0;
  top: 0;
  width: 540px;
  height: 400px;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
  scroll-padding-top: 16px;
}

.sx-list::-webkit-scrollbar {
  display: none;
}

.sx-sheet {
  position: relative;
  min-height: 400px;
}

.sx-editor {
  position: relative;
  z-index: 1;
  min-height: 400px;
  padding: 16px 16px 48px 66px;
  outline: 0;
  font-size: 31px;
  line-height: 48px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: pre-wrap;
  color: var(--ink);
  caret-color: transparent;
  cursor: text;
}

/* selected letters turn tape pink; a selected strip lifts instead */
.sx-editor::selection {
  background: transparent;
  color: var(--pink);
}

.sx-editor *::selection {
  background: transparent;
}

.sx-editor .sx-encore::selection {
  color: var(--pen);
}

/* one strip to a line */
.sx-editor [data-slot="token-input-host"] {
  display: inline-block;
  width: 100%;
  vertical-align: top;
  scroll-snap-align: start;
  pointer-events: none;
}

.sx-editor .sx-strip,
.sx-editor .sx-encore {
  pointer-events: auto;
}

/* a song: a strip torn from a roll of kraft, its ends kept as torn however long the title is */
.sx-strip {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  margin: 2px 0 2px -34px;
  padding: 0 0 0 14px;
  border-style: solid;
  border-width: 0 20px;
  border-image: url("./strip-1.webp") 0 44 fill / 0 20px stretch;
  vertical-align: top;
  font-size: 31px;
  line-height: 44px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  transform-origin: 0 50%;
  transform: rotate(var(--tilt));
  filter: var(--lay);
  cursor: default;
}

.sx-strip[data-paper="2"] {
  border-image-source: url("./strip-2.webp");
}

.sx-strip[data-paper="3"] {
  border-image-source: url("./strip-3.webp");
}

.sx-strip[data-paper="4"] {
  border-image-source: url("./strip-4.webp");
}

.sx-strip[data-paper="5"] {
  border-image-source: url("./strip-5.webp");
}

.sx-defs {
  position: absolute;
}

/* the title for screen readers; the lettering beside it is drawn */
.sx-said {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sx-title,
.sx-word {
  white-space: pre;
  color: rgb(20 16 13 / 0.93);
  mix-blend-mode: multiply;
  filter: url("#sx-ink");
}

.sx-title {
  padding-top: 3px;
  line-height: 41px;
}

.sx-letter {
  display: inline-block;
  white-space: pre;
}

/* what to retune, in white paint pen; how long it runs, in biro */
.sx-note,
.sx-time {
  font-family: "Reenie Beanie", cursive;
  letter-spacing: 0;
  text-transform: none;
  line-height: 30px;
}

.sx-note {
  margin-left: 14px;
  font-size: 29px;
  color: var(--pen);
  transform: rotate(-5deg);
}

.sx-time {
  align-self: flex-end;
  margin: 0 0 3px 16px;
  font-size: 26px;
  color: rgb(22 18 14 / 0.82);
}

/* the gaffer tape that holds a strip down; press it to pull the strip up */
.sx-tape {
  position: absolute;
  left: -44px;
  top: calc(50% - 11px + var(--tape-drop, 0px));
  width: 52px;
  height: 22px;
  background: url("./tape-1.webp") center / 100% 100% no-repeat;
  transform: rotate(var(--tape-tilt, 0deg));
  filter: drop-shadow(0.5px 1px 0.6px rgb(0 0 0 / 0.5));
  transition:
    transform 0.16s cubic-bezier(0.3, 0, 0.2, 1),
    filter 0.16s linear;
  cursor: pointer;
}

.sx-tape[data-tape="2"] {
  background-image: url("./tape-2.webp");
}

.sx-tape[data-tape="3"] {
  background-image: url("./tape-3.webp");
}

.sx-editor .sx-tape:hover {
  transform: translate(-2px, -3px) rotate(calc(var(--tape-tilt, 0deg) - 5deg));
  filter: drop-shadow(2px 4px 2px rgb(0 0 0 / 0.5)) brightness(1.08);
}

/* a strip in the selection comes up off the boards */
.sx-strip[data-selected] {
  transform: translate(-1px, -2px) rotate(calc(var(--tilt) - 1.3deg));
  filter: drop-shadow(4px 7px 3px rgb(0 0 0 / 0.5)) brightness(1.06);
}

/* the encore break: a length of the same tape laid across, with the word on it */
.sx-encore {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin: 9px 0 9px -58px;
  padding: 2px 132px 0 42px;
  border-style: solid;
  border-width: 0 16px;
  border-image: url("./tape-long.webp") 0 34 fill / 0 16px stretch;
  vertical-align: top;
  font-size: 20px;
  line-height: 28px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgb(22 18 14 / 0.92);
  transform-origin: 0 50%;
  transform: rotate(-0.7deg);
  filter: drop-shadow(1px 1.5px 0.8px rgb(0 0 0 / 0.5));
  cursor: default;
}

.sx-encore[data-selected] {
  transform: translate(-1px, -2px) rotate(-1.6deg);
  filter: drop-shadow(4px 6px 3px rgb(0 0 0 / 0.5)) brightness(1.06);
}

/* the next strip, blank, under whatever is being written */
.sx-blank {
  position: absolute;
  height: 44px;
  margin: 2px 0 0 -34px;
  border-style: solid;
  border-width: 0 20px;
  border-image: url("./strip-3.webp") 0 44 fill / 0 20px stretch;
  filter: var(--lay) brightness(0.72);
  transform-origin: 0 50%;
  transform: rotate(0.4deg);
  transition:
    width 0.14s cubic-bezier(0.3, 0, 0.2, 1),
    filter 0.16s linear;
  pointer-events: none;
}

.sx-sheet:focus-within .sx-blank {
  filter: var(--lay);
}

/* the pen: where the next letter goes */
.sx-pen {
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 32px;
  margin: 8px 0 0 1px;
  border-radius: 2px;
  background: var(--ink);
  transform: rotate(4deg);
  animation: sx-blink 1.1s steps(1, end) infinite;
  pointer-events: none;
}

@keyframes sx-blink {
  55% {
    opacity: 0;
  }
}

/* a strip laid just now flutters down, and its tape goes on after it */
.sx-strip[data-fresh],
.sx-encore[data-fresh] {
  animation: sx-land 0.46s cubic-bezier(0.25, 0.7, 0.3, 1) both;
}

.sx-strip[data-fresh] .sx-tape {
  animation: sx-slap 0.2s 0.36s cubic-bezier(0.3, 0, 0.2, 1) both;
}

@keyframes sx-land {
  0% {
    opacity: 0;
    transform: translate(16px, -24px) rotate(-8deg) scale(1.08);
    filter: drop-shadow(9px 16px 7px rgb(0 0 0 / 0.35));
  }
  25% {
    opacity: 1;
  }
  55% {
    transform: translate(-2px, 1px) rotate(1.9deg) scale(1.01);
    filter: drop-shadow(3px 5px 3px rgb(0 0 0 / 0.45));
  }
  78% {
    transform: translate(0, 0) rotate(-0.9deg) scale(1);
  }
}

@keyframes sx-slap {
  0% {
    opacity: 0;
    transform: translate(-3px, -12px) rotate(calc(var(--tape-tilt, 0deg) - 9deg)) scale(1.25);
  }
}

/* a strip pulled up: it peels at the tape end and is gone */
.sx-gone {
  position: absolute;
  z-index: 3;
  margin: 2px 0 0;
  pointer-events: none;
  animation: sx-tear 0.44s cubic-bezier(0.5, 0, 0.8, 0.5) both;
}

.sx-encore.sx-gone {
  margin: 9px 0 0;
}

@keyframes sx-tear {
  0% {
    filter: drop-shadow(3px 5px 3px rgb(0 0 0 / 0.5));
  }
  35% {
    opacity: 1;
    transform: translate(6px, -9px) rotate(-5deg) scale(1.03);
    filter: drop-shadow(7px 12px 5px rgb(0 0 0 / 0.4));
  }
  100% {
    opacity: 0;
    transform: translate(92px, -30px) rotate(13deg) scale(1.06);
    filter: drop-shadow(12px 20px 8px rgb(0 0 0 / 0.2));
  }
}

/* the catalogue: half a ruled index card, typed, that comes up under the pen. One song to a rule. */
.sx-card {
  width: 296px;
  height: 131px;
  margin: 0;
  padding: 0;
  border: 0;
  background: url("./ruled.webp") 0 0 / 100% 100% no-repeat;
  color: #2b2621;
  font-family: var(--typed);
  font-size: 13.5px;
  overflow: visible;
  transform-origin: 20px 0;
  transform: rotate(-1.1deg);
  filter: drop-shadow(3px 6px 5px rgb(0 0 0 / 0.6)) brightness(0.95);
  transition:
    opacity 0.12s linear,
    transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sx-card[data-starting-style],
.sx-card[data-ending-style] {
  opacity: 0;
  transform: translate(4px, -8px) rotate(-3.5deg);
}

/* the band's rubber stamp, above the red rule */
.sx-band {
  position: absolute;
  left: 16px;
  top: 8px;
  padding: 3px 6px 0 7px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  color: #34306b;
  font-size: 11px;
  font-weight: 700;
  line-height: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.72;
  mix-blend-mode: multiply;
  transform: rotate(-1.6deg);
  filter: url("#sx-ink");
}

.sx-songs {
  position: absolute;
  left: 12px;
  right: 10px;
  top: 32.2px;
  display: block;
  outline: 0;
}

.sx-song {
  position: relative;
  display: flex;
  align-items: baseline;
  height: 18.65px;
  padding: 0 4px 0 5px;
  line-height: 20px;
  white-space: pre;
  cursor: pointer;
}

.sx-song-title {
  text-transform: uppercase;
}

.sx-song-dots {
  color: #7d7165;
}

/* the song the keys are on: one pull of a highlighter */
.sx-song[data-highlighted]::before {
  content: "";
  position: absolute;
  inset: 2.5px -4px 1.5px -3px;
  border-radius: 3px 8px 4px 7px / 6px 3px 7px 4px;
  background: var(--pink);
  opacity: 0.78;
  mix-blend-mode: multiply;
  transform: rotate(-0.5deg);
}

/* the day sheet: a corner torn off a ruled card, typed by the venue one line to a rule, taped down at the
   foot of the list, with the length of the set written across the last two rules */
.sx-day {
  position: absolute;
  right: 8px;
  bottom: 12px;
  width: 190px;
  height: 122px;
  background: url("./slip.webp") 0 0 / 100% 100% no-repeat;
  transform: rotate(2.2deg);
  filter: drop-shadow(2px 3px 1.5px rgb(0 0 0 / 0.55));
}

.sx-day::before {
  content: "";
  position: absolute;
  left: 34px;
  top: -7px;
  width: 58px;
  height: 24px;
  background: url("./tape-3.webp") center / 100% 100% no-repeat;
  transform: rotate(-6deg);
  filter: drop-shadow(0.5px 1px 0.6px rgb(0 0 0 / 0.45));
}

.sx-typed {
  position: absolute;
  left: 17px;
  top: 30.2px;
  font-family: var(--typed);
  font-size: 11.5px;
  line-height: 15.6px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #2b2621;
}

.sx-set {
  position: absolute;
  left: 15px;
  top: 77px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: rgb(20 16 13 / 0.93);
  mix-blend-mode: multiply;
  transform-origin: 0 100%;
  transform: rotate(-2deg);
  filter: url("#sx-ink");
}

.sx-set-label {
  font-size: 18px;
  line-height: 38px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sx-set-time {
  font-size: 40px;
  line-height: 38px;
  font-variant-numeric: tabular-nums;
}

/* past the curfew, the house stamps it */
.sx-stamp {
  position: absolute;
  right: 5px;
  top: 11px;
  padding: 5px 8px 0;
  border: 3px solid var(--stamp);
  border-radius: 4px;
  color: var(--stamp);
  font-family: var(--typed);
  font-size: 19px;
  font-weight: 700;
  line-height: 21px;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  mix-blend-mode: multiply;
  opacity: 0.84;
  transform: rotate(-13deg);
  animation: sx-stamp 0.2s cubic-bezier(0.3, 0, 0.1, 1) both;
}

@keyframes sx-stamp {
  0% {
    opacity: 0;
    transform: rotate(-9deg) scale(1.7);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sx-strip[data-fresh],
  .sx-encore[data-fresh],
  .sx-strip[data-fresh] .sx-tape,
  .sx-stamp,
  .sx-pen {
    animation: none;
  }

  .sx-gone {
    animation-duration: 1ms;
  }

  .sx-tape,
  .sx-blank,
  .sx-card {
    transition: none;
  }
}
