/* Side A: the J-card insert, the cassette and the deck under it.
   Phones stack them (J-card cover on top, cassette slid over its lower edge);
   wide screens lay the J-card open on the left and the cassette beside it.
   Before PLAY only the J-card spine shows; PLAY unfolds the cover. */

.stage {
  --cover-h: clamp(220px, 40svh, 440px);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 12px var(--gutter) 28px;
}

/* ---------- the J-card ---------- */
.jcard {
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
}
.spine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px 8px 0 0;
  background: var(--ink);
  color: var(--paper);
  font: 800 13px / 1 var(--print);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
#hero-eyebrow {
  white-space: normal;
  text-wrap: balance;
}
.spine-date {
  font-variant-numeric: tabular-nums;
}
.cover {
  height: var(--cover-h);
  overflow: hidden;
  background: var(--paper);
}
.cover-print {
  height: var(--cover-h);
  padding: 10px 10px 0;
}
.cover-print img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 16%;
  background: var(--ink);
}
/* folded: the closed cover shows as a paper flap with its crease printed */
body.locked .cover {
  height: 22px;
  border-radius: 0 0 8px 8px;
  box-shadow:
    inset 0 -9px 0 var(--paper),
    inset 0 -10px 0 var(--ink);
}
body.locked .cover-print img {
  visibility: hidden;
}

/* ---------- the cassette ---------- */
.player {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  margin-top: -64px;
}
body.locked .player {
  margin-top: 28px;
}
.cassette {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1000 / 640;
  color: var(--ink);
  transform: rotate(-2deg);
}
.shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 14px 18px rgb(8 12 70 / 0.38));
}
.shell .screw circle {
  fill: var(--paper);
}
.shell .screw path {
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
}

/* label sticker copy, positioned in the shell's 1000 × 640 units */
.label-names {
  position: absolute;
  left: 8.4%;
  bottom: 70%;
  width: 83.2%;
  font: 700 7cqw / 1.08 var(--hand);
  font-variation-settings: "INFM" 70;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.label-names .name,
.label-names .name-lead {
  white-space: nowrap;
}
.label-names .amp {
  color: var(--cobalt);
}
.label-side {
  position: absolute;
  top: 31.8%;
  left: 8.4%;
  width: 83.2%;
  font: 800 max(12px, 3cqw) / 1.1 var(--print);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.band {
  position: absolute;
  top: 50.6%;
  width: 22.4%;
  color: var(--paper);
  text-align: center;
  text-transform: uppercase;
  transform: translateY(-50%);
}
.band--left {
  left: 5.6%;
  font: 800 max(13px, 4.6cqw) / 1 var(--print);
  font-variant-numeric: tabular-nums;
}
.band--right {
  right: 5.6%;
  padding: 0 2%;
  font: 800 max(12px, 3.1cqw) / 1.15 var(--print);
  letter-spacing: 0.03em;
}
.label-foot {
  position: absolute;
  top: 62.2%;
  left: 5.6%;
  display: grid;
  place-items: center;
  width: 88.8%;
  height: 12.2%;
  font: 700 max(12px, 3.9cqw) / 1 var(--hand);
  font-variation-settings: "INFM" 70;
}

/* ---------- the deck ---------- */
.deck {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.counter-block {
  display: grid;
  gap: 8px;
}
.counter {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px 10px;
  border-radius: 8px;
  background: var(--ink);
}
.count {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.digits {
  display: flex;
  font: 800 30px / 1 var(--print);
  font-variant-numeric: tabular-nums;
}
.digits .d {
  width: 0.84em;
  text-align: center;
}
.unit {
  font: 700 12px / 1 var(--print);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* Latin unit words run longer than the digits: set them in title case */
:lang(en) .unit,
:lang(fr) .unit {
  letter-spacing: 0;
  text-transform: none;
}
.counter-label {
  font: 600 12px / 1.3 var(--print);
}
.transport {
  display: grid;
  grid-template-columns: 1fr 1.55fr;
  gap: 10px;
}
.key--play {
  min-height: 64px;
}
.key--play .key-icon {
  width: 20px;
  height: 20px;
}
.key--play.is-down,
.key--play[aria-pressed="true"] {
  transform: translateY(3px);
  background: #000;
}
.transport .key--rec {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  column-gap: 12px;
  row-gap: 4px;
  min-height: 64px;
  text-align: left;
}
.transport .key-note {
  white-space: nowrap;
}
.transport .key--rec .rec-dot {
  grid-row: 1 / 3;
  align-self: center;
}
.open-hint {
  display: none;
  align-items: flex-start;
  gap: 6px;
  max-width: 30ch;
  font: 700 17px / 1.3 var(--hand);
  font-variation-settings: "INFM" 70;
}
body.locked .open-hint {
  display: flex;
}
.open-arrow {
  width: 40px;
  height: 30px;
  flex: none;
  margin-top: -6px;
  transform: scaleX(-1);
}

/* ---------- the unfold, played only once PLAY is pressed ---------- */
body.is-unfolding .cover {
  transition: height var(--unfold) var(--ease-out);
}
body.is-unfolding .player {
  transition: margin var(--unfold) var(--ease-out);
}

/* ---------- wide screens: J-card laid open beside the cassette ---------- */
@media (min-width: 900px) and (min-height: 600px) {
  .stage {
    --pw: clamp(420px, 50vw, 740px);
    --jh: min(780px, calc(100svh - 96px));
    --cover-w: min(calc(var(--jh) * 0.6), 34vw);
    flex-direction: row;
    padding: 48px 56px;
  }
  .jcard {
    flex-direction: row;
    width: auto;
    height: var(--jh);
  }
  /* folded: the case spine plus the paper edge of the closed cover, the
     height of the cassette it holds */
  body.locked .jcard {
    height: calc(var(--pw) * 0.64);
    margin-bottom: 196px;
  }
  .spine,
  body.locked .spine {
    width: 64px;
    min-height: 0;
    padding: 24px 0;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }
  .cover {
    width: var(--cover-w);
    height: auto;
    border-radius: 0 8px 8px 0;
  }
  .cover-print {
    width: var(--cover-w);
    height: 100%;
    padding: 14px;
  }
  body.locked .cover {
    width: 30px;
    height: auto;
    box-shadow:
      inset -10px 0 0 var(--paper),
      inset -11px 0 0 var(--ink);
  }
  .player {
    width: var(--pw);
    margin: 0 0 0 -72px;
  }
  body.locked .player {
    margin: 0 0 0 32px;
  }
  .deck {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 30px 0 0 92px;
  }
  body.locked .deck {
    margin-left: 0;
  }
  .counter-block {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 18px;
  }
  .counter-label {
    max-width: 13ch;
    text-wrap: balance;
    font-size: 13px;
  }
  .digits {
    font-size: 40px;
  }
  .unit {
    font-size: 12px;
  }
  .transport .key {
    min-height: 78px;
    font-size: 22px;
  }
  .transport .key-icon {
    width: 24px;
    height: 24px;
  }
  .transport .key-note {
    font-size: 15px;
  }
  .transport .key--rec .rec-dot {
    width: 20px;
    height: 20px;
  }
  body.is-unfolding .jcard {
    transition:
      height var(--unfold) var(--ease-out),
      margin var(--unfold) var(--ease-out);
  }
  body.is-unfolding .cover {
    transition: width var(--unfold) var(--ease-out);
  }
  body.is-unfolding .deck {
    transition: margin var(--unfold) var(--ease-out);
  }
}

@media (max-width: 359px) {
  .digits {
    font-size: 25px;
  }
  .counter {
    gap: 6px;
    padding: 10px 10px 8px;
  }
  .key {
    font-size: 15px;
    padding: 0 12px;
  }
}
