/* ============================================================
   MATCHBOX — sleeve slides right in 3D, tray stays put
   ============================================================ */

.box {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  perspective-origin: 60% 50%;
  -webkit-tap-highlight-color: transparent;
}

.box input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.stage {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  width: 100%;
}

/* ---------- inner wooden tray ---------- */
.tray {
  position: absolute;
  inset: 8% 4% 8% 4%;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg,
      rgba(35, 32, 30, 0.06) 0 2px,
      rgba(35, 32, 30, 0) 2px 7px),
    linear-gradient(180deg, #E8D9BC 0%, #DCC9A4 55%, #CBB488 100%);
  box-shadow:
    inset 0 0 0 var(--hair) rgba(35, 32, 30, 0.55),
    inset 0 6px 10px rgba(35, 32, 30, 0.22);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.55rem 0.7rem 0.6rem;
  overflow: hidden;
}

/* striker strip along the top of the tray */
.tray::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 17%;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, 0.14) 0 1px,
      rgba(0, 0, 0, 0.16) 1px 3px),
    linear-gradient(180deg, #6B3A22, #4A2716);
  border-bottom: var(--hair) solid rgba(35, 32, 30, 0.7);
}

/* ---------- matches ---------- */
.matches {
  display: flex;
  gap: 7%;
  align-items: flex-end;
  height: 58%;
  padding: 0 2%;
}

.stick {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(90deg, #E3C79A, #F3E2C4 40%, #D2B183);
  box-shadow: inset -1px 0 0 rgba(35, 32, 30, 0.28);
}

.stick::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 150%;
  aspect-ratio: 1 / 1.35;
  border-radius: 46% 46% 40% 40% / 60% 60% 30% 30%;
  background: var(--head, #FF4F8B);
  box-shadow: inset -2px -2px 0 rgba(35, 32, 30, 0.28);
}

.stick:nth-child(2n) { height: 92%; }
.stick:nth-child(3n) { height: 96%; }

/* hidden interior print on the tray floor */
.tray-print {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 0.35rem;
  border-top: var(--hair) dashed rgba(35, 32, 30, 0.45);
  font-family: var(--mono);
  font-size: clamp(0.5rem, 1.6vw, 0.6rem);
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3A2F22;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--spring) 0.12s, transform 0.5s var(--spring) 0.12s;
}

.tray-print span { color: #8A2A1E; font-weight: 700; }

/* ---------- outer printed sleeve ---------- */
.sleeve {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
  transform-style: preserve-3d;
  transform: translate3d(0, 0, 0) rotateY(0deg);
  transform-origin: left center;
  transition: transform 0.62s var(--spring), box-shadow 0.62s var(--spring);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 10px 18px -12px rgba(35, 32, 30, 0.55);
  background: #F2EADB;
}

.sleeve::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 var(--hair) rgba(35, 32, 30, 0.65),
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -6px 12px rgba(35, 32, 30, 0.18);
  background-image: var(--grain);
  background-size: 140px 140px;
  mix-blend-mode: multiply;
  opacity: 0.55;
}

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

/* sleeve label text printed under the art */
.sleeve-tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #23201E;
  background: rgba(247, 242, 231, 0.86);
  border-top: var(--hair) solid #23201E;
}

/* ---------- the slide ---------- */
.box:hover .sleeve,
.box:focus-within .sleeve,
.box input:checked ~ .stage .sleeve {
  transform: translate3d(34%, -2%, 0) rotateY(-16deg);
  box-shadow:
    -14px 14px 26px -16px rgba(35, 32, 30, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.box:hover .tray-print,
.box:focus-within .tray-print,
.box input:checked ~ .stage .tray-print {
  opacity: 1;
  transform: none;
}

.box input:focus-visible ~ .stage .sleeve {
  outline: var(--hair) solid var(--ink);
  outline-offset: 3px;
}

/* keep-open hint */
.box-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.box-hint::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border: var(--hair) solid currentColor;
  border-radius: 1px;
  transition: background 0.25s var(--spring);
}

.box input:checked ~ .box-hint { color: var(--ink); }
.box input:checked ~ .box-hint::before { background: var(--ink-pink); border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .tray-print { opacity: 1 !important; transform: none !important; }
}
