/* =====================================================================
   Carta — card-deck storefront (update-32). Loaded after carta.css + carta-v2.css only when ui_theme = v3.
   A flick deck of Carta playing cards opens the homepage. Everything here is scoped (.ui-v3 / .fx-*),
   so switching back to the update-31 look leaves no trace.
   ===================================================================== */

/* ---------- CUSTOMISE: colours and sizes of the deck ---------- */
:root {
  --fx-stage-bg: #050505;                                    /* the stage behind the deck */
  --fx-stage-fade: var(--bg);                                /* the stage melts into the page below */
  --fx-card-w: clamp(150px, min(30vw, 50vh), 380px);         /* card width; height follows --fx-card-ratio */
  --fx-card-ratio: 3 / 4.1;                                  /* portrait playing card */
  --fx-card-radius: 14px;
  --fx-card-frame: max(7px, calc(var(--fx-card-w) * .035));  /* ivory border around the picture */
  --fx-card-face: var(--card-face);                          /* Carta ivory */
  --fx-card-ink: var(--card-ink);
  --fx-suit-red: var(--red);
  --fx-perspective: 1400px;
  --fx-name-size: clamp(16px, calc(var(--fx-card-w) * .085), 30px); /* front card product name (~8.5% of the card width) */
  --fx-name-color: #FFFFFF;
  --fx-cta-bg: rgba(18, 18, 22, .88);                        /* dark pill button */
  --fx-cta-fg: #FFFFFF;
  --fx-cta-h: 40px;
  --fx-glow-blur: 90px;                                      /* ambient copy of the active picture */
  --fx-glow-opacity: .16;
  --fx-nav-size: 52px;                                       /* round prev / next buttons */
  --fx-nav-bg: rgba(245, 241, 230, .08);
  --fx-nav-border: rgba(245, 241, 230, .18);
}

/* ---------- stage ---------- */
.fx-stage { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: var(--space-6);
  padding-block: var(--space-10) var(--space-8); background: linear-gradient(180deg, var(--fx-stage-bg) 0%, var(--fx-stage-bg) 70%, var(--fx-stage-fade) 100%); }
/* blur is drawn on a 1/8-size copy and scaled up: the same look as a full-size 90px blur at a fraction of the cost */
.fx-glow { position: absolute; inset: -10%; z-index: -1; pointer-events: none; overflow: hidden; }
.fx-glow__img { position: absolute; left: 43.75%; top: 43.75%; width: 12.5%; height: 12.5%; object-fit: cover; filter: blur(calc(var(--fx-glow-blur) / 8)) saturate(1.3); opacity: 0; transform: scale(9); will-change: opacity; }
.fx-glow__img.is-on { opacity: var(--fx-glow-opacity); }

.fx-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.fx-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 4.4vw, 52px); line-height: 1.25; text-wrap: balance; }
.fx-head__lead { color: var(--text-muted); font-size: 16px; line-height: 28px; max-width: 40em; }

/* ---------- deck ---------- */
.fx-deck { position: relative; width: 100%; height: calc(var(--fx-card-w) * 4.1 / 3 + 40px); perspective: var(--fx-perspective); perspective-origin: 50% 40%; touch-action: pan-y; }
.fx-card { position: absolute; top: 20px; left: 50%; width: var(--fx-card-w); aspect-ratio: var(--fx-card-ratio); margin-left: calc(var(--fx-card-w) / -2);
  transform-style: preserve-3d; will-change: transform;
  /* first frame before the script runs (same formula; GSAP takes over) */
  transform: translate3d(calc(var(--fx-card-w) * var(--fx-x, 0)), calc(var(--fx-card-w) * var(--fx-y, 0)), var(--fx-z, 0)) rotateY(var(--fx-ry, 0)) rotateZ(var(--fx-rz, 0)) scale(var(--fx-s, 1));
  z-index: var(--fx-zi, 1); visibility: var(--fx-vis, visible); user-select: none; -webkit-user-select: none; }
.fx-card.is-front { cursor: grab; }
.fx-card.is-dragging { cursor: grabbing; }
.fx-card__face { position: absolute; inset: 0; overflow: hidden; border-radius: var(--fx-card-radius); background: var(--fx-card-face); padding: var(--fx-card-frame);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 24px 48px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .25); }
.fx-card__art { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: calc(var(--fx-card-radius) - 5px); background: #1A1A20; }
/* every supplier picture shape fits: blurred cover behind, whole picture in front */
.fx-card__bg { position: absolute; left: 37.5%; top: 37.5%; width: 25%; height: 25%; object-fit: cover; filter: blur(4px) saturate(1.2); transform: scale(5); opacity: .9; }
.fx-card__img { position: absolute; top: 8%; left: 6%; width: 88%; height: 58%; object-fit: contain; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .45)); pointer-events: none; }
.fx-card__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 5, 5, 0) 38%, rgba(5, 5, 5, .55) 66%, rgba(5, 5, 5, .9) 100%); }
.fx-card__noimg { position: absolute; inset: 0; display: grid; place-items: center; background: var(--card-back); }
.fx-card__noimg .ct-cardback__seal { width: 34%; height: auto; aspect-ratio: 1; }

/* playing-card pips on the ivory frame corners */
.fx-card__pip { position: absolute; z-index: 2; width: calc(var(--fx-card-w) * .075); height: calc(var(--fx-card-w) * .075); display: grid; place-items: center; padding: 3px; border-radius: 6px; background: var(--fx-card-face); color: var(--fx-card-ink); }
.fx-card__pip svg { width: 100%; height: 100%; fill: currentColor; }
.fx-card__pip.is-red { color: var(--fx-suit-red); }
.fx-card__pip--top { top: calc(var(--fx-card-frame) + 6px); inset-inline-start: calc(var(--fx-card-frame) + 6px); }
.fx-card__pip--bottom { bottom: calc(var(--fx-card-frame) + 6px); inset-inline-end: calc(var(--fx-card-frame) + 6px); transform: rotate(180deg); }

/* front card text: name, kind, price; hidden on back cards */
.fx-card__text { position: absolute; z-index: 2; inset-inline: calc(var(--fx-card-frame) + 10px); bottom: calc(var(--fx-card-frame) + 12px + var(--fx-cta-h) + 10px); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; color: var(--fx-name-color); }
.fx-card__name { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--fx-name-size); line-height: 1.25; text-wrap: balance; text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fx-card__kind { font-size: clamp(11px, calc(var(--fx-card-w) * .036), 13px); line-height: 1.4; font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, .78); }
.fx-card__price { font-size: clamp(12px, calc(var(--fx-card-w) * .04), 15px); color: rgba(255, 255, 255, .86); }
.fx-card__price b { color: #FFFFFF; font-weight: 700; }
.fx-card__cta { position: absolute; z-index: 3; left: 50%; bottom: calc(var(--fx-card-frame) + 12px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  min-height: var(--fx-cta-h); padding: 0 18px; border-radius: 10px; background: var(--fx-cta-bg); color: var(--fx-cta-fg); font-family: var(--font-sans); font-size: clamp(12px, calc(var(--fx-card-w) * .042), 15px); font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset; }
.ct-root a.fx-card__cta { color: var(--fx-cta-fg); text-decoration: none; }
.fx-card__cta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fx-suit-red); }
.fx-card__cta:hover { background: var(--red); }
.fx-card__cta:hover::before { background: #FFFFFF; }
.fx-card__cta:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.fx-card:not(.is-front) .fx-card__text, .fx-card:not(.is-front) .fx-card__cta { opacity: 0; visibility: hidden; }
.fx-card__shade { position: absolute; inset: 0; z-index: 4; border-radius: var(--fx-card-radius); background: #000; opacity: var(--fx-shade, 0); pointer-events: none; }

/* ---------- controls ---------- */
.fx-nav { position: absolute; z-index: 30; top: calc(50% - var(--fx-nav-size) / 2); width: var(--fx-nav-size); height: var(--fx-nav-size); border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--fx-nav-bg); border: 1px solid var(--fx-nav-border); color: var(--text); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s ease, border-color .15s ease; }
.fx-nav:hover { background: var(--red); border-color: var(--red); }
.fx-nav:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.fx-nav .ct-ico { width: 24px; height: 24px; }
.fx-nav--prev { left: max(16px, 4vw); }
.fx-nav--next { right: max(16px, 4vw); }
.fx-count { margin: calc(-1 * var(--space-2)) 0 0; font-family: var(--font-mono); font-size: 13px; letter-spacing: .12em; color: var(--text-muted); direction: ltr; }
.fx-count b { color: var(--text); font-weight: 500; }

.fx-foot { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.fx-search { width: min(560px, 100%); }
.fx-chips { justify-content: center; margin-top: 0; }

@media (max-width: 880px) {
  .fx-stage { padding-block: var(--space-6); gap: var(--space-4); }
  .fx-head__lead { display: none; }
  .fx-nav { --fx-nav-size: 44px; top: auto; bottom: calc(var(--space-6) + 150px); }
}
@media (max-width: 720px) {
  :root { --fx-card-w: clamp(172px, 50vw, 250px); --fx-cta-h: 34px; } /* phones: a bigger card reads better than the desktop formula */
  .fx-card__price { display: none; }
  .fx-card__cta { padding: 0 12px; }
  .fx-nav { display: none; } /* swipe on phones; the count shows where you are */
  .fx-chips { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-nav, .fx-card__cta { transition: none; }
}
