/* vs-card — depthfield shelf CARD face (HOUSE-RESERVED)
   Spec: docs/ops/2026-08-02-HANDS-OBJECTS-MASTER-SPEC.md §4
   Geometry law: docs/ops/2026-08-04-MANY-MC-LL-VS-ELITE-FORCE.md + DESIGN-BIBLE #15
   One engine, CARD face: media front · receipt back · FOUR paper edges = thickness.
   Slot 330×230 · half-W 165 · half-H 115 · thickness 18 (faces at ±9). */

.vs-shelf {
  --vs-night-0: #0b0f1a;
  --vs-night-1: #111726;
  --vs-paper-0: #e9e6dd;
  --vs-paper-1: #cfccc2;
  --vs-glow: rgba(127, 216, 232, 0.28);
  --vs-accent: #7fd8e8;
  --vs-half-w: 165px;
  --vs-half-h: 115px;
  --vs-thick: 18px;
  --vs-thick-half: 9px;
  background: linear-gradient(165deg, var(--vs-night-0), var(--vs-night-1));
  color: #e8e6e0;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.25rem;
  position: relative;
  overflow: hidden;
}

.vs-shelf h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  max-width: 28ch;
}
.vs-shelf h2 em {
  font-style: normal;
  color: var(--vs-accent);
}
.vs-shelf .vs-lead {
  max-width: 56ch;
  opacity: 0.72;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 1.75rem;
}

.vs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  perspective: 1400px;
}

.vs-slot {
  width: 330px;
  height: 230px;
  position: relative;
}
/* light under the door — sanctioned night glow */
.vs-slot::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -8px;
  height: 28px;
  background: radial-gradient(50% 100% at 50% 0%, var(--vs-glow), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

.vs-card3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: vs-spin 18s linear infinite;
  z-index: 1;
}
.vs-slot:nth-child(2) .vs-card3d { animation-delay: -6s; }
.vs-slot:nth-child(3) .vs-card3d { animation-delay: -12s; }
.vs-slot:hover .vs-card3d,
.vs-slot:focus-within .vs-card3d {
  animation-play-state: paused;
}

.vs-card3d.is-flip {
  animation: none;
  transition: transform 700ms cubic-bezier(0.32, 0.72, 0, 1);
  transform: rotateY(180deg) rotateX(8deg);
}

/* Faces only — overflow hidden OK on media/receipt planes */
.vs-face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
/* Edges must NOT share face overflow:hidden (clips thickness quads) */
.vs-edge {
  position: absolute;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: none;
  border-radius: 0;
  overflow: visible;
  pointer-events: none;
}

.vs-face-front {
  transform: translateZ(var(--vs-thick-half));
  background: #141820;
  display: grid;
  place-items: center;
}
.vs-face-back {
  transform: rotateY(180deg) translateZ(var(--vs-thick-half));
  background: #171b24;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.4;
}
.vs-face-back strong {
  font-size: 14px;
  font-weight: 650;
}
.vs-face-back .vs-rowmeta {
  opacity: 0.65;
  font-size: 11.5px;
}
.vs-face-back .vs-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}
.vs-face-back .vs-actions a,
.vs-face-back .vs-actions button {
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  color: var(--vs-accent);
  background: transparent;
  border: 1px solid rgba(127, 216, 232, 0.35);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  text-decoration: none;
}

/* Visible flip control — primary door (long-hold is secondary only) */
.vs-flip-ctrl {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--vs-accent) 40%, transparent);
  background: color-mix(in srgb, var(--vs-night-0) 72%, transparent);
  color: var(--vs-accent);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transform: translateZ(calc(var(--vs-thick-half) + 1px));
  backface-visibility: hidden;
}
.vs-flip-ctrl:focus-visible {
  outline: 2px solid var(--vs-accent);
  outline-offset: 2px;
}
.vs-card3d.is-flip .vs-flip-ctrl {
  /* stay on the front chrome space; hide when back is up */
  visibility: hidden;
}

/* ── Thickness proof: FOUR edges (L R T B) ──
   Canonical CSS 3D box:
   left  = rotateY(-90deg) translateZ(halfW)
   right = rotateY( 90deg) translateZ(halfW)
   top   = rotateX( 90deg) translateZ(halfH)
   bottom= rotateX(-90deg) translateZ(halfH)
   With ambient rotateX(6deg), bottom is the critical missing face. */

.vs-edge-l,
.vs-edge-r {
  width: var(--vs-thick);
  height: calc(100% + 1px);
  top: -0.5px;
  left: 50%;
  margin-left: calc(var(--vs-thick-half) * -1);
  background: linear-gradient(180deg, var(--vs-paper-0), var(--vs-paper-1));
}
/* FIXED: names match sides (was swapped) */
.vs-edge-l { transform: rotateY(-90deg) translateZ(var(--vs-half-w)); }
.vs-edge-r { transform: rotateY(90deg) translateZ(var(--vs-half-w)); }

.vs-edge-t,
.vs-edge-b {
  width: calc(100% + 1px);
  height: var(--vs-thick);
  left: -0.5px;
  top: 50%;
  margin-top: calc(var(--vs-thick-half) * -1);
  background: linear-gradient(90deg, var(--vs-paper-0), var(--vs-paper-1));
}
.vs-edge-t { transform: rotateX(90deg) translateZ(var(--vs-half-h)); }
/* Bottom is the one rotateX(6deg) always reveals — never ship without it */
.vs-edge-b { transform: rotateX(-90deg) translateZ(var(--vs-half-h)); }

.vs-face-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vs-face-front .vs-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  /* 11px floor (Design Chief 2026-08-05); fleet resync owed — see CREW-CHANNEL. */
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
}

/* Ambient tilt token — fleet default 6deg (geometry law). A .many stage may raise it
   (e.g. 10deg) so the bottom paper edge reads at rest without a PRM freeze.
   One camera sees one horizontal edge: tilt exposes bottom; top quad ships in DOM
   (4-edge law) and reads in flip transit. Elite Force §1.2 / EYES-RECEIPT raise 4. */
@keyframes vs-spin {
  from { transform: rotateY(0deg) rotateX(var(--vs-ambient-x, 6deg)); }
  to { transform: rotateY(360deg) rotateX(var(--vs-ambient-x, 6deg)); }
}

@media (prefers-reduced-motion: reduce) {
  .vs-card3d {
    animation: none;
    transform: rotateY(32deg) rotateX(var(--vs-ambient-x, 6deg));
  }
  .vs-slot:nth-child(2) .vs-card3d { transform: rotateY(-28deg) rotateX(var(--vs-ambient-x, 6deg)); }
  .vs-slot:nth-child(3) .vs-card3d { transform: rotateY(148deg) rotateX(var(--vs-ambient-x, 6deg)); }
  .vs-card3d.is-flip { transform: rotateY(180deg) rotateX(var(--vs-ambient-x, 6deg)); transition: none; }
}
