/* ============================================================
   MATCHBOX — sleeve, tray, striker, matches, hidden print
   ============================================================ */

.plate {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* the inspection checkbox stays visually hidden but focusable */
.plate-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: inset(50%);
  pointer-events: none;
}

.box {
  position: relative;
  display: block;
  cursor: pointer;
  padding: 0.35rem 0 1.6rem;
  perspective: 1100px;
  perspective-origin: 50% 60%;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- tray (underneath, slides out to the left) ---------- */
.tray {
  position: relative;
  margin: 0 auto;
  width: 88%;
  height: clamp(150px, 15vw, 186px);
  border-radius: 3px;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 0.7rem 0.75rem 0.6rem;
  background-color: #C9A26B;
  background-image:
    repeating-linear-gradient(90deg, rgba(90, 58, 26, 0.16) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(255, 240, 205, 0.14) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #D8B37C, #B98F55);
  box-shadow:
    inset 0 2px 0 rgba(255, 245, 220, 0.55),
    inset 0 -3px 6px rgba(70, 42, 12, 0.35),
    0 10px 18px -10px rgba(35, 32, 30, 0.55);
  transform: translateX(0) translateZ(0);
  transition: transform 0.75s var(--spring);
  z-index: 1;
}

/* inner floor print, revealed as the sleeve clears it */
.tray-floor {
  align-self: end;
  font-family: var(--mono);
  font-size: clamp(0.55rem, 0.42rem + 0.32vw, 0.66rem);
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3A2A16;
  opacity: 0.9;
  padding-right: 0.4rem;
}
.tray-floor strong { display: block; color: #7A1B2E; letter-spacing: 0.08em; }

/* wooden tray edge peeking at the right */
.tray::after {
  content: "";
  position: absolute;
  top: 0;
  right: -7px;
  width: 7px;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #A87C43, #8A6231);
  box-shadow: inset -1px 0 0 rgba(255, 240, 205, 0.35);
}

/* ---------- matches ---------- */
.matches {
  display: flex;
  align-items: flex-start;
  gap: clamp(3px, 0.55vw, 6px);
  padding: 0.15rem 0.1rem 0.35rem;
}

.match {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.match-head {
  width: clamp(9px, 1.1vw, 12px);
  aspect-ratio: 1 / 1.35;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: var(--head, var(--pink));
  box-shadow:
    inset -2px -2px 2px rgba(0, 0, 0, 0.35),
    inset 2px 2px 2px rgba(255, 255, 255, 0.4),
    0 1px 1px rgba(35, 32, 30, 0.35);
  position: relative;
}
.match-head::after {
  content: "";
  position: absolute;
  left: 22%;
  top: 18%;
  width: 26%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.match-stick {
  width: clamp(3px, 0.42vw, 4px);
  height: clamp(52px, 6.4vw, 78px);
  border-radius: 0 0 2px 2px;
  background:
    linear-gradient(90deg, #E2C79B 0%, #F4E2C0 38%, #D6B583 100%);
  box-shadow: 0 2px 3px -1px rgba(50, 30, 8, 0.35);
}

/* ---------- striker strip ---------- */
.striker {
  height: clamp(14px, 1.6vw, 18px);
  border-radius: 2px;
  background-color: #4A2A1E;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.16) 0.6px, transparent 0.8px),
    radial-gradient(rgba(0, 0, 0, 0.35) 0.7px, transparent 0.9px),
    linear-gradient(180deg, #6B3A28, #3B2016);
  background-size: 3px 3px, 4px 4px, 100% 100%;
  background-position: 0 0, 1px 1px, 0 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 220, 180, 0.18);
}

/* ---------- sleeve (printed cardboard, slides right) ---------- */
.sleeve {
  position: absolute;
  top: 0;
  left: 50%;
  width: 88%;
  height: clamp(150px, 15vw, 186px);
  transform: translateX(-50%) translateZ(0);
  transform-origin: 50% 50%;
  transition: transform 0.75s var(--spring), box-shadow 0.75s var(--spring);
  z-index: 3;
  border-radius: 2px;
  background-color: var(--newsprint);
  background-image:
    radial-gradient(rgba(35, 32, 30, 0.09) 0.5px, transparent 0.7px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(35, 32, 30, 0.07));
  background-size: 3px 3px, 100% 100%;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 -2px 0 rgba(35, 32, 30, 0.10) inset,
    0 14px 22px -12px rgba(35, 32, 30, 0.6);
  overflow: hidden;
}

/* cardboard bevel: a folded lip along the top and bottom */
.sleeve::before,
.sleeve::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(180deg, rgba(35, 32, 30, 0.16), transparent);
  pointer-events: none;
  z-index: 5;
}
.sleeve::before { top: 0; }
.sleeve::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(35, 32, 30, 0.18), transparent);
}

/* the printed label artwork */
.label {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  mix-blend-mode: multiply;
}

/* ink layers: each group is offset by a hair to fake the drum misregistration */
.ink-pink   { color: var(--pink); }
.ink-blue   { color: var(--blue); }
.ink-yellow { color: var(--yellow); }
.ink-green  { color: var(--green); }
.ink-char   { color: var(--char); }

.layer { mix-blend-mode: multiply; }
.layer--a { transform: translate(-1.5px, 1px); }
.layer--b { transform: translate(1.5px, -1px); }
.layer--c { transform: translate(0.5px, 1.5px); }

/* ---------- open state: hover, keyboard focus, or checked ---------- */
.box:hover .sleeve,
.plate-toggle:focus-visible ~ .box .sleeve,
.plate-toggle:checked ~ .box .sleeve {
  transform: translateX(calc(-50% + 46%)) translateZ(14px) rotateY(-9deg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 26px 34px -18px rgba(35, 32, 30, 0.7);
}

.box:hover .tray,
.plate-toggle:focus-visible ~ .box .tray,
.plate-toggle:checked ~ .box .tray {
  transform: translateX(-16%) translateZ(-6px);
}

/* a small "inspect" tab on the sleeve edge */
.inspect {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 6;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--char);
  color: var(--newsprint);
  padding: 0.2rem 0.45rem;
  border-top-left-radius: 2px;
  transition: opacity 0.3s var(--spring);
}
.plate-toggle:checked ~ .box .inspect { content: "OPEN"; background: var(--blue); }
.plate-toggle:checked ~ .box .inspect span { display: none; }
.plate-toggle:checked ~ .box .inspect::after { content: "OPEN"; }

/* ---------- caption ---------- */
.caption {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  align-items: baseline;
  border-top: 1px solid var(--char);
  padding-top: 0.6rem;
}

.cat-no {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--char);
  background: var(--yellow);
  padding: 0.05rem 0.35rem;
  align-self: start;
}

.plate-title {
  font-size: clamp(0.95rem, 0.85rem + 0.35vw, 1.08rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.plate-meta {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

@media (max-width: 420px) {
  .box:hover .sleeve,
  .plate-toggle:focus-visible ~ .box .sleeve,
  .plate-toggle:checked ~ .box .sleeve {
    transform: translateX(calc(-50% + 40%)) translateZ(10px) rotateY(-7deg);
  }
}
