/*
 * psc_print_carousel_3d.css — composition.print_carousel_3d atom.
 * 3D coverflow of print photos. Tokens only (--bk-*), 44px controls,
 * focus-visible rings, prefers-reduced-motion collapse. Behaviour in
 * psc_print_carousel_3d.js.
 */
.psc-carousel3d {
  --psc-c3d-radius: 300px;
  --psc-c3d-aspect: 3 / 4;
  position: relative;
  padding: var(--bk-space-4, 1rem) 0 var(--bk-space-2, .5rem);
  font-family: var(--bk-font, inherit);
}

.psc-carousel3d-empty {
  text-align: center;
  color: var(--bk-text-muted, #6c6c7a);
  font-size: var(--bk-text-sm, .85rem);
  padding: var(--bk-space-6, 1.5rem);
  border: 1px dashed var(--bk-border, #d1d1d9);
  border-radius: var(--bk-radius-md, 10px);
}

/* stage + ring */
.psc-c3d-stage {
  position: relative;
  height: 300px;
  perspective: 1150px;
}
.psc-c3d-ring {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .55s var(--bk-ease-deliberate, cubic-bezier(.22, .61, .36, 1));
}

/* cards */
.psc-c3d-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--c3d-card-w, 190px);
  aspect-ratio: var(--psc-c3d-aspect);
  margin: 0;
  transform: translate(-50%, -50%);
  translate: -50% -50%;
  border-radius: var(--bk-radius-md, 12px);
  overflow: hidden;
  cursor: pointer;
  background: var(--bk-card, #fff);
  border: 3px solid var(--bk-card, #fff);
  box-shadow: var(--bk-shadow-lg, 0 12px 30px rgba(20, 20, 40, .35));
  transition:
    transform .55s var(--bk-ease-deliberate, cubic-bezier(.22, .61, .36, 1)),
    opacity .45s ease,
    filter .45s ease,
    border-color .3s ease;
  backface-visibility: hidden;
  will-change: transform;
}
/* keep the ring's rotateY origin centered without JS margins */
.psc-c3d-card { transform-origin: 50% 50%; }

.psc-c3d-card:not(.is-focused) { filter: brightness(.62) saturate(.85); }
.psc-c3d-card.is-focused {
  border-color: var(--bk-gold, #c29954);
  box-shadow: 0 0 0 1px var(--bk-gold, #c29954), var(--bk-shadow-lg, 0 22px 50px rgba(194, 153, 84, .4));
}
.psc-c3d-card:focus-visible {
  outline: 3px solid var(--bk-focus-ring, var(--bk-gold, #c29954));
  outline-offset: 3px;
}

.psc-c3d-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.psc-c3d-tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: .4rem .5rem;
  font-size: var(--bk-text-sm, .66rem);
  font-weight: 700;
  /* intentional media-overlay colors: white text over a dark scrim burned
     onto the print photo (no --bk-on-media token exists in the palette). */
  color: #fff;
  text-align: center;
  background: linear-gradient(0deg, rgba(0, 0, 0, .72), transparent);
}

/* nav controls — 44px hit targets */
.psc-c3d-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 1px solid var(--bk-gold, #c29954);
  background: var(--bk-navy, #1a1a2e);
  color: var(--bk-gold, #c29954);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.psc-c3d-nav:hover { background: var(--bk-gold, #c29954); color: var(--bk-navy, #1a1a2e); }
.psc-c3d-nav:focus-visible {
  outline: 3px solid var(--bk-focus-ring, var(--bk-gold, #c29954));
  outline-offset: 2px;
}
.psc-c3d-prev { left: .25rem; }
.psc-c3d-next { right: .25rem; }

/* caption + dots + hint */
.psc-c3d-caption {
  text-align: center;
  margin-top: .4rem;
  min-height: 1.4rem;
  font-weight: 700;
  color: var(--bk-text, #2d2d3a);
}
/* ── Pick bar (pickable mode) — two compact rows: controls, then filter pills ── */
.psc-c3d-pickbar {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .3rem 0 .45rem;
  margin-bottom: .3rem;
  border-bottom: 1px solid var(--bk-border, #e2e4e8);
}
.psc-c3d-bar-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.psc-c3d-spacer { flex: 1 1 auto; }

/* Layout switch — compact icon group. */
.psc-c3d-layouts {
  display: inline-flex;
  border: 1px solid var(--bk-border-strong, #c8ccd4);
  border-radius: 8px;
  overflow: hidden;
  flex: 0 0 auto;
}
.psc-c3d-lbtn {
  min-width: 32px;
  min-height: 30px;
  padding: 0 .35rem;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  border: 0;
  border-left: 1px solid var(--bk-border-strong, #c8ccd4);
  background: var(--bk-surface, #fff);
  color: var(--bk-text-muted, #72727e);
}
.psc-c3d-lbtn:first-child { border-left: 0; }
.psc-c3d-lbtn.is-active { background: var(--bk-tier-blue, #3B82F6); color: #fff; }
.psc-c3d-thumbsize { width: 66px; align-self: center; margin: 0 .2rem; }

/* Selection buttons + live count. */
.psc-c3d-selbtn {
  min-height: 30px;
  padding: 0 .6rem;
  border: 1px solid var(--bk-tier-blue, #3B82F6);
  border-radius: 7px;
  background: var(--bk-surface, #fff);
  color: var(--bk-tier-blue, #3B82F6);
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.psc-c3d-selbtn:hover { background: var(--bk-tier-blue-weak, #eaf1fe); }
.psc-c3d-selcount { font-size: .74rem; color: var(--bk-text-muted, #72727e); white-space: nowrap; }
.psc-c3d-selcount b { color: var(--bk-text, #2d2d3a); }

/* Filter pills — ONE horizontally scrollable row (All · Selected · categories). */
.psc-c3d-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: .3rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.psc-c3d-chip {
  flex: 0 0 auto;
  min-height: 21px;
  line-height: 1;
  padding: 2px .4rem;
  border: 1px solid var(--bk-border, #e2e4e8);
  border-radius: 999px;
  background: transparent;
  color: var(--bk-text-muted, #72727e);
  font-size: .64rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.psc-c3d-chip:hover { border-color: var(--bk-border-strong, #c8ccd4); color: var(--bk-text, #2d2d3a); }
.psc-c3d-chip.is-active {
  background: var(--bk-navy, #1a1a2e);
  color: #fff;
  border-color: var(--bk-navy, #1a1a2e);
  font-weight: 600;
}
.psc-c3d-chip--sel.is-active {
  background: var(--bk-gold-dark, #a07d3f);
  border-color: var(--bk-gold-dark, #a07d3f);
}
.psc-c3d-chip-n { opacity: .55; font-weight: 600; margin-left: .12rem; font-size: .7em; }
.psc-c3d-chip.is-active .psc-c3d-chip-n { opacity: .8; }
.psc-c3d-chip:focus-visible, .psc-c3d-selbtn:focus-visible, .psc-c3d-lbtn:focus-visible {
  outline: 2px solid var(--bk-focus-ring, var(--bk-gold, #c29954));
  outline-offset: 2px;
}

/* Per-card select checkbox — small square, top-left of the frame. */
.psc-c3d-check {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;   /* bare, no box (founder: transparent) */
  cursor: pointer;
}
.psc-c3d-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--bk-tier-blue, #3B82F6);
}
/* Picked card — clear selection border. */
.psc-c3d-card.is-picked { outline: 3px solid var(--bk-tier-blue, #3B82F6); outline-offset: -3px; border-radius: 6px; }

/* Done card (e.g. already deposited into the catalog) — green badge + border. */
.psc-c3d-done {
  position: absolute;
  left: 6px;
  bottom: 26px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bk-tier-emerald, #10b981);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.psc-c3d-card.is-done { border-color: var(--bk-tier-emerald, #10b981); }
.psc-carousel3d.is-grid .psc-c3d-card.is-done {
  outline: 2px solid var(--bk-tier-emerald, #10b981);
  outline-offset: -2px;
}

/* Empty filtered view (e.g. Selected with 0 picked). */
.psc-c3d-emptyhint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  font-size: var(--bk-text-sm, .8rem);
  color: var(--bk-text-muted, #72727e);
}

/* Flat thumbnail grid (operator layout choice) — CSS owns the whole layout so
   every card is fully visible, upright, and its checkbox reliably clickable
   (no coverflow overlap). This is the efficient multi-select surface. */
.psc-carousel3d.is-grid .psc-c3d-nav,
.psc-carousel3d.is-grid .psc-c3d-spinbar,
.psc-carousel3d.is-grid .psc-c3d-caption,
.psc-carousel3d.is-grid .psc-c3d-hint { display: none; }
.psc-carousel3d.is-grid .psc-c3d-stage {
  height: auto;
  min-height: 300px;
  max-height: 62vh;
  perspective: none;
  overflow: hidden;
}
.psc-carousel3d.is-grid .psc-c3d-ring {
  position: absolute;
  inset: 0;
  transform: none !important;
  transform-style: flat;
  transition: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--c3d-thumb, 140px), 1fr));
  grid-auto-rows: min-content;
  gap: 10px;
  padding: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}
.psc-carousel3d.is-grid .psc-c3d-card {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  translate: none !important;
  filter: none !important;
  opacity: 1 !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  will-change: auto;
  border-color: var(--bk-card, #fff);
  box-shadow: var(--bk-shadow-sm, 0 1px 4px rgba(0, 0, 0, .15));
  transition: box-shadow .2s ease, outline-color .2s ease;
}
.psc-carousel3d.is-grid .psc-c3d-card.is-picked {
  outline: 3px solid var(--bk-tier-blue, #3B82F6);
  outline-offset: -3px;
}
.psc-c3d-hint {
  text-align: center;
  font-size: var(--bk-text-sm, .7rem);
  color: var(--bk-text-muted, #8a8a9a);
  margin: .3rem 0 0;
}

/* First encounters earn a moment; repeats stay instant — reduced-motion
   collapses all rotation/scale transitions to a quick opacity fade. */
@media (prefers-reduced-motion: reduce) {
  .psc-c3d-ring,
  .psc-c3d-card {
    transition: opacity .2s ease !important;
  }
}

/* ── Auto-wide the popup for the carousel (pure CSS :has(), mirrors the
   engagement.picker auto-wide) — the 3D coverflow needs a screen line to
   breathe; the default 400px popup crops the flanking cards. ── */
.kb-step-popup:has(.psc-carousel3d) {
  width: 820px !important;
  max-width: 92vw !important;
}

/* Bigger, responsive stage now that there's room. */
.kb-step-popup:has(.psc-carousel3d) .psc-c3d-stage { height: clamp(300px, 44vh, 440px); }
.kb-step-popup:has(.psc-carousel3d) .psc-c3d-card { width: var(--c3d-card-w, 230px); }

/* Small screens (mobile) — shrink cards + stage so nothing overflows. */
@media (max-width: 520px) {
  .psc-c3d-stage { height: 260px; }
  .psc-c3d-card { width: 150px; }
  .psc-c3d-nav { width: 44px; height: 44px; }
}

/* Inline images count — sits just before the "N selected" count in the pick bar. */
.psc-c3d-imgcount { font-size: .74rem; color: var(--bk-text-muted, #72727e); white-space: nowrap; }
.psc-c3d-imgcount b { color: var(--bk-text, #2d2d3a); }

/* ── spin bar (play/pause + speed) ── */
.psc-c3d-spinbar {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin: .3rem 0 .1rem;
}
.psc-c3d-spin-toggle {
  min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--bk-gold, #c29954); background: transparent;
  color: var(--bk-gold, #c29954); cursor: pointer; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.psc-c3d-spin-toggle:hover { background: var(--bk-gold, #c29954); color: var(--bk-navy, #1a1a2e); }
.psc-c3d-spin-toggle:focus-visible {
  outline: 2px solid var(--bk-focus-ring, var(--bk-gold, #c29954)); outline-offset: 2px;
}
.psc-c3d-speed-lbl {
  font-size: var(--bk-text-sm, .7rem); color: var(--bk-text-muted, #9a9aab);
  text-transform: uppercase; letter-spacing: .05em;
}
.psc-c3d-speed { accent-color: var(--bk-gold, #c29954); min-height: 44px; cursor: pointer; }
.psc-c3d-speed:focus-visible { outline: 2px solid var(--bk-focus-ring, var(--bk-gold, #c29954)); outline-offset: 3px; }

/* ── click-to-zoom — fills the POPUP/app card (appended to the popup container,
   which JS makes a positioning context). Big enough to inspect a print, within
   the app, no full-browser takeover. ── */
.psc-c3d-lightbox {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  cursor: zoom-out;
  border-radius: var(--bk-radius-md, 10px);
}
.psc-c3d-lightbox-media {
  /* Original size, aspect intact — never upscale (that just blurs small source
     prints). Caps to the popup so it stays within the app. */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
  cursor: default;
}
.psc-c3d-lightbox-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.psc-c3d-lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.psc-c3d-lightbox-close:focus-visible {
  outline: 2px solid var(--bk-gold, #c29954);
  outline-offset: 2px;
}
