/* Card embed: just the card mechanics (holder, tilt, flip, faces, loupe) from the card lab, with no page shell,
   so one card style can sit inside another page. Pair with cards.css (the styles) and embed.js (the engine). */
.ce-stage {
  position: relative; display: grid; place-items: center; width: 100%;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.ce-stage .cl-holder {
  position: relative; container-type: size;
  width: min(var(--ce-show, 340px), 100%);
  aspect-ratio: var(--ar);
  perspective: 1500px;
}
/* the tilt, the flip, the shadow and the loupe are written as transforms by CardKit.rig (cardlab/kit.js) every frame;
   the var() forms here are only the resting state before the script runs */
.ce-stage .cl-tilt {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  will-change: transform;
}
.ce-stage .cl-card {
  --tx: 0; --ty: 0; --lx: 62%; --ly: 38%;
  position: absolute; inset: 0; transform-style: preserve-3d; cursor: pointer; outline: none;
  touch-action: pan-y;                                 /* a vertical swipe over the card scrolls the page */
  -webkit-touch-callout: none;
}
.ce-stage .cl-card.is-back { transform: rotateY(180deg); }
.ce-stage .cl-card.is-loupe { touch-action: none; }
.ce-stage .cl-card:focus-visible .cl-face { outline: 1px solid #777; outline-offset: 5px; }
.ce-stage .cl-face {
  --u: calc(100cqw / 400);
  position: absolute; inset: 0; overflow: hidden; box-sizing: border-box;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.ce-stage .cl-back { transform: rotateY(180deg); }
/* WebKit does not honour backface-visibility on these faces (it paints the back, mirrored, over the front), so only the
   face that is up is visible: the flip runs in the frame loop and moves .is-up across exactly as the card passes edge-on. */
.ce-stage .cl-face { visibility: hidden; }
.ce-stage .cl-face.is-up { visibility: visible; }
/* on a host page the card's sans and caps-label faces are the page's own (its --ui / --label), not the lab's Geist */
.ce-stage .cl-face { --sans: var(--ui, 'Helvetica Neue', Arial, sans-serif); --gmono: var(--label, ui-monospace, Menlo, monospace); }
.ce-stage .cl-face canvas[data-surf] { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ce-stage .cl-shadow {
  position: absolute; left: 6%; right: 6%; bottom: -5%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.07), transparent); filter: blur(10px); pointer-events: none;
  transform: translateX(calc(var(--sx, 0) * 1px));
}
.ce-stage .cl-loupe {
  --d: 172px;
  position: absolute; left: 0; top: 0; width: var(--d); height: var(--d); border-radius: 50%; overflow: hidden; z-index: 6;
  pointer-events: none; opacity: 0; transition: opacity .15s linear;
  background: #0b0b0b;
  box-shadow: 0 0 0 1px #000, 0 0 0 5px #1c1c1c, 0 0 0 6px #3b3b3b, 0 18px 40px rgba(0,0,0,.7);
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
}
.ce-stage .cl-loupe.on { opacity: 1; }
.ce-stage .cl-loupe::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 0 22px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.12);
  background: radial-gradient(120% 80% at 30% 12%, rgba(255,255,255,.13), transparent 46%);
}
.ce-stage .cl-loupe-in { position: absolute; left: 0; top: 0; container-type: size; transform-origin: 0 0; }
.ce-stage .cl-loupe-in .cl-card { transform: none !important; transition: none; }
.ce-stage .cl-loupe-in .cl-face { transform: none; -webkit-backface-visibility: visible; backface-visibility: visible; visibility: visible; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .ce-stage .cl-loupe { transition: none; }
}