/* ============================================================
   Matchbox: sleeve + tray, pure CSS 3D slide
   ============================================================ */

.plate {
  position: relative;
  display: block;
  margin: 0;
  perspective: 1100px;
  perspective-origin: 30% 50%;
}

/* the checkbox that keeps a box open (touch) */
.plate__toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.plate__stage {
  position: relative;
  display: block;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.7s var(--spring);
}

.plate__stage:hover { transform: translateY(-4px); }

/* ---------- Tray (inner wooden box) ---------- */
.tray {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 4px;
  background:
    linear-gradient(180deg, var(--wood) 0%, var(--wood) 62%, var(--wood-dark) 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(35, 32, 30, 0.28),
    inset 0 10px 18px -12px rgba(35, 32, 30, 0.6),
    0 10px 18px -14px rgba(35, 32, 30, 0.75);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* wood grain */
.tray::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    92deg,
    rgba(176, 143, 94, 0.35) 0 1px,
    transparent 1px 7px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* striker strip along the tray's top edge */
.striker {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26%;
  background-color: var(--striker);
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}

.striker::after {
  content: "PHOSPHORUS — STRIKE HERE";
  position: absolute;
  left: 6px;
  bottom: 4px;
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.14em;
  color: rgba(255, 240, 220, 0.6);
}

/* hidden interior print on the tray floor */
.tray__print {
  position: relative;
  z-index: 2;
  padding: 0.45rem 0.6rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(35, 32, 30, 0.78);
  background: linear-gradient(180deg, transparent, rgba(247, 242, 231, 0.55) 55%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s var(--spring) 0.12s, transform 0.55s var(--spring) 0.12s;
}

.tray__print b {
  display: block;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: 0.1em;
}

/* matchsticks */
.sticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 6%;
  z-index: 1;
}

.stick {
  width: 5%;
  height: 58px;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(90deg, #F2DDB8, #E0C39A 55%, #C9A97C);
  box-shadow: 0 1px 2px rgba(35, 32, 30, 0.3);
  position: relative;
  transform-origin: bottom center;
}

.stick::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -1px;
  right: -1px;
  height: 10px;
  border-radius: 4px 4px 2px 2px;
  background: var(--head, var(--pink));
  box-shadow: inset -2px -2px 0 rgba(35, 32, 30, 0.22);
}

.stick:nth-child(3n + 1) { --head: var(--pink); }
.stick:nth-child(3n + 2) { --head: var(--cobalt); }
.stick:nth-child(3n + 3) { --head: var(--marigold); }

/* ---------- Sleeve (printed cardboard) ---------- */
.sleeve {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--newsprint);
  transform: translateX(0) rotateY(0deg);
  transform-origin: left center;
  transition: transform 0.72s var(--spring), box-shadow 0.72s var(--spring);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 -3px 0 var(--cardboard-dark) inset,
    0 12px 22px -16px rgba(35, 32, 30, 0.9);
  will-change: transform;
}

/* cardboard bevel edge on the right of the sleeve */
.sleeve::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(90deg, var(--cardboard), var(--cardboard-dark));
  box-shadow: inset -1px 0 0 rgba(35, 32, 30, 0.35);
}

.sleeve__art {
  display: block;
  width: 100%;
  height: 100%;
}

/* paper grain over the print */
.sleeve__grain {
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  mix-blend-mode: multiply;
  opacity: 0.55;
  pointer-events: none;
}

/* label band across the sleeve */
.sleeve__band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.32rem 0.55rem 0.36rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(247, 242, 231, 0.9);
  border-top: 1.5px solid var(--charcoal);
  font-family: var(--font-mono);
  font-size: 0.46rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--charcoal);
}

.sleeve__band span:last-child { opacity: 0.6; }

/* ---------- Open state: hover, focus, or checked ---------- */
.plate__stage:hover .sleeve,
.plate__toggle:focus-visible + .plate__stage .sleeve,
.plate__toggle:checked + .plate__stage .sleeve {
  transform: translateX(46%) rotateY(-16deg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 -3px 0 var(--cardboard-dark) inset,
    14px 16px 26px -18px rgba(35, 32, 30, 0.95);
}

.plate__stage:hover .tray__print,
.plate__toggle:focus-visible + .plate__stage .tray__print,
.plate__toggle:checked + .plate__stage .tray__print {
  opacity: 1;
  transform: translateY(0);
}

.plate__stage:hover .stick,
.plate__toggle:checked + .plate__stage .stick {
  animation: none;
}

/* tiny fan of the sticks as the sleeve clears */
.plate__stage:hover .stick:nth-child(odd),
.plate__toggle:checked + .plate__stage .stick:nth-child(odd) {
  transform: rotate(-1.2deg);
}
.plate__stage:hover .stick:nth-child(even),
.plate__toggle:checked + .plate__stage .stick:nth-child(even) {
  transform: rotate(1.2deg);
}

/* ---------- Caption under each box ---------- */
.plate__caption {
  display: block;
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1.5px solid var(--rule);
}

.plate__cat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.plate__cat .ink-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.35rem;
  transform: translateY(-1px);
}

.plate__name {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1.15;
}

.plate__meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

/* open hint */
.plate__hint {
  position: absolute;
  top: -0.1rem;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.85;
}

/* ---------- Filtering ---------- */
.plate[data-cat] { transition: opacity 0.4s var(--spring), transform 0.4s var(--spring); }

#f-all:checked ~ .wall .plate,
#f-tokyo:checked ~ .wall .plate,
#f-prague:checked ~ .wall .plate,
#f-maritime:checked ~ .wall .plate {
  display: none;
}

#f-all:checked ~ .wall .plate { display: block; }
#f-tokyo:checked ~ .wall .plate[data-cat="tokyo"] { display: block; }
#f-prague:checked ~ .wall .plate[data-cat="prague"] { display: block; }
#f-maritime:checked ~ .wall .plate[data-cat="maritime"] { display: block; }

/* tab active states */
#f-all:checked ~ .wall .tab[for="f-all"],
#f-tokyo:checked ~ .wall .tab[for="f-tokyo"],
#f-prague:checked ~ .wall .tab[for="f-prague"],
#f-maritime:checked ~ .wall .tab[for="f-maritime"] {
  background: var(--charcoal);
  color: var(--newsprint);
  box-shadow: 0 3px 0 var(--pink);
}

#f-all:checked ~ .wall .tab[for="f-all"] .count,
#f-tokyo:checked ~ .wall .tab[for="f-tokyo"] .count,
#f-prague:checked ~ .wall .tab[for="f-prague"] .count,
#f-maritime:checked ~ .wall .tab[for="f-maritime"] .count {
  opacity: 0.8;
}

/* collection head count swaps with the filter */
.count-line { display: none; }
#f-all:checked ~ .wall .count-line--all { display: inline; }
#f-tokyo:checked ~ .wall .count-line--tokyo { display: inline; }
#f-prague:checked ~ .wall .count-line--prague { display: inline; }
#f-maritime:checked ~ .wall .count-line--maritime { display: inline; }

/* empty-ish note never needed: every filter has plates */

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .stick { height: 44px; }
  .plate__stage:hover .sleeve,
  .plate__toggle:checked + .plate__stage .sleeve { transform: translateX(42%) rotateY(-12deg); }
  .tray__print { font-size: 0.44rem; }
}
