/* Card pictures in 3D (Trevor, Dec 3 2026): bigger card pictures, a slow idle tilt, follow-the-pointer 3D on hover or
   a finger drag, and a holo sheen on holofoil printings only. Driven by /site/js/cardbit-site-card3d.js. */

/* One box for front and back, shaped like the front scan (--c3-ar), filling the stage whatever the scan's pixel size.
   Before: each side showed at its own file's pixel size, so a small front scan sat smaller than the card back. */
#cardbit-store .cb-card-view { --c3-ar: .716; padding: 8px 8px 12px; gap: 12px; }
#cardbit-store .cb-card-view :is(.cb-inspect-front, .cb-inspect-back, .cb-unverified) > .cb-scan-mount { place-items: center; }
#cardbit-store .cb-card-view .cb-scan-mount > .cb-scan-hit {
  width: min(var(--scan-width), calc(var(--scan-height) * var(--c3-ar)));
  aspect-ratio: var(--c3-ar);
  justify-self: center; align-self: center;
}
#cardbit-store .cb-card-view .cb-scan-face { width: 100%; height: 100%; }
#cardbit-store .cb-card-view .cb-card-image.cb-scan-mount .cb-scan-face > img {
  width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover;
}
#cardbit-store .cb-unverified .cb-card-image { min-width: 0; width: 100%; height: 100%; }

/* Bigger pictures: Card Shop single and My Vault copy pages, the card page, and Inspect Card. */
#cardbit-store .cb-single-stage { aspect-ratio: .9; max-height: min(780px, calc(100dvh - 120px)); }
#cardbit-store .cp-hero { grid-template-columns: minmax(300px, 540px) minmax(0, 1fr); }
#cardbit-store .cp-art .cb-card-view { height: clamp(440px, min(56vw, calc(100dvh - 215px)), 760px); }
#cardbit-store .cb-dialog:has(.cc-zoom) { width: min(660px, calc(100vw - 28px)); }
#cardbit-store .cb-dialog:has(.cc-zoom) h2 { margin: 4px 0 6px; }
#cardbit-store .cc-zoom { max-width: none; }
#cardbit-store .cc-zoom .cb-card-view { height: clamp(320px, calc(100dvh - 250px), 860px); }
#cardbit-store .cb-sample-image { width: min(100%, 300px); }
@media (max-width: 700px) {
  #cardbit-store .cb-single-stage { aspect-ratio: .74; max-height: min(640px, calc(100dvh - 150px)); }
  #cardbit-store .cc-zoom .cb-card-view { height: clamp(300px, calc(100dvh - 230px), 640px); }
}
@media (max-width: 760px) {
  #cardbit-store .cp-hero { grid-template-columns: minmax(0, 1fr); }
  #cardbit-store .cp-art { width: min(100%, 460px); }
  #cardbit-store .cp-art .cb-card-view { height: min(136vw, 600px); }
}

/* Tilt. The perspective wrapper (or the scan itself when there's no back) turns; Show Back still flips inside it. */
#cardbit-store .c3-on .cb-inspect-perspective,
#cardbit-store .c3-on.cb-unverified .cb-scan-hit {
  transform: perspective(1200px) rotateX(var(--c3-rx, 0deg)) rotateY(var(--c3-ry, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
  touch-action: none; /* a finger drag on the card tilts it instead of scrolling */
  outline: none;
  cursor: grab;
}
#cardbit-store .c3-on[data-c3-active] :is(.cb-inspect-perspective, .cb-scan-hit) { cursor: grabbing; }
#cardbit-store .c3-on :is(.cb-inspect-perspective, .cb-scan-hit):focus-visible .cb-scan-face {
  outline: 3px solid #00e6e1; outline-offset: 4px;
}
/* The card lifts a little while you hold it. */
#cardbit-store .c3-on .cb-scan-face { transition: box-shadow .3s ease-out; box-shadow: 0 10px 26px #03071099, 0 2px 6px #0307106b; }
#cardbit-store .c3-on[data-c3-active] .cb-scan-face { box-shadow: 0 22px 44px #030710b3, 0 4px 10px #03071080; }
/* The old flat pointer highlight steps aside for the 3D light below. */
#cardbit-store .c3-on [data-cb-scan] .cb-scan-face::after { display: none; }

/* Light: a soft glare that follows the tilt (every card, very faint), plus holo bands on holofoil printings only. */
#cardbit-store .c3-on .c3-glare,
#cardbit-store .c3-on .c3-holo {
  position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
}
#cardbit-store .c3-on .c3-glare {
  background: radial-gradient(farthest-corner circle at var(--c3-gx, 50%) var(--c3-gy, 30%), #ffffff38 0%, #ffffff12 28%, #ffffff00 60%);
  mix-blend-mode: soft-light;
  opacity: calc(.35 + var(--c3-i, .4) * .65);
}
#cardbit-store .c3-holo-on .c3-holo {
  background:
    repeating-linear-gradient(112deg,
      #ffffff00 0%, #ffffff00 18%, #ff6fb1 23%, #ffd27a 27%, #7df3ea 31%, #8fa2ff 35%, #c6acfc 39%, #ffffff00 44%, #ffffff00 60%),
    repeating-linear-gradient(28deg, #ffffff00 0 6px, #ffffff1f 6px 7px);
  background-size: 260% 260%, 100% 100%;
  background-position: var(--c3-px, 50%) var(--c3-py, 50%), center;
  mix-blend-mode: color-dodge;
  filter: saturate(1.1) brightness(.9);
  opacity: calc(.05 + var(--c3-i, .4) * .24);
}
#cardbit-store .cb-show-back .c3-holo, #cardbit-store .cb-show-back .c3-glare { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  #cardbit-store .c3-on .cb-inspect-perspective,
  #cardbit-store .c3-on.cb-unverified .cb-scan-hit { transform: none; will-change: auto; touch-action: auto; cursor: default; }
  #cardbit-store .c3-on .c3-glare { display: none; }
  #cardbit-store .c3-holo-on .c3-holo { opacity: .1; }
}

/* My Vault copy page: the held/shipped badge and the Cardbits value sit on one line under the set name (they floated
   apart before, the value centered on its own). */
#cardbit-store .cb-detail-copy > .cb-vault-status { display: inline-flex; vertical-align: middle; margin: 6px 10px 6px 0; }
#cardbit-store .cb-detail-copy > .cb-vault-status + .cb-art-value { display: inline-flex; vertical-align: middle; text-align: left; margin: 6px 0; font-family: var(--cb-display, inherit); font-weight: 800; font-size: 22px; }
#cardbit-store .cb-detail-copy > .cb-vault-status + .cb-art-value .cb-reference img { width: 22px; height: auto; }
