/* ============================================================
   CVS Infographic component — figure + lightbox (zoom / pan)
   Tiffany Glass design system. Dependency-free.
   Pairs with infographic.js and the generated markup.
   ============================================================ */

.cvs-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2, 12px);
}

/* ---- frame ---- */
.cvs-figure__frame {
  position: relative;
  display: block;
  width: 100%;
  border-radius: var(--r-lg, 16px);
  overflow: hidden;
  background: var(--panel, #0d0f13);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  cursor: zoom-in;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.cvs-figure__frame:hover,
.cvs-figure__frame:focus-visible {
  border-color: rgba(10, 186, 181, 0.5);
  box-shadow: 0 0 0 1px rgba(10, 186, 181, 0.35), 0 12px 40px -12px rgba(10, 186, 181, 0.25);
  outline: none;
}

.cvs-figure__img {
  display: block;
  width: 100%;
  height: auto;
  /* keep a stable box before load to avoid layout shift */
  aspect-ratio: var(--cvs-ar, 16 / 9);
  object-fit: contain;
  background: #0a0b0e;
}

/* zoom affordance badge */
.cvs-figure__zoom {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.cvs-figure__frame:hover .cvs-figure__zoom,
.cvs-figure__frame:focus-visible .cvs-figure__zoom { opacity: 1; transform: none; }
.cvs-figure__zoom svg { width: 14px; height: 14px; }

/* ---- caption ---- */
.cvs-figure__caption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-3, rgba(255, 255, 255, 0.62));
}
.cvs-figure__caption b { color: var(--fg-2, rgba(255, 255, 255, 0.86)); font-weight: 600; }
.cvs-figure__longdesc { display: none; } /* exposed to AT via aria-describedby */

/* ---- placeholder (slot not yet generated) ---- */
.cvs-figure--placeholder .cvs-figure__frame {
  cursor: default;
  border-style: dashed;
  border-color: rgba(10, 186, 181, 0.28);
}
.cvs-figure--placeholder .cvs-figure__frame:hover {
  box-shadow: none;
  border-color: rgba(10, 186, 181, 0.28);
}
.cvs-figure__ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  aspect-ratio: var(--cvs-ar, 16 / 9);
  padding: clamp(16px, 4vw, 40px);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(10, 186, 181, 0.06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 12px, transparent 12px 24px);
}
.cvs-figure__ph-icon {
  width: 40px; height: 40px;
  color: rgba(10, 186, 181, 0.7);
  opacity: 0.9;
}
.cvs-figure__ph-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg-2, rgba(255, 255, 255, 0.86));
  max-width: 38ch;
}
.cvs-figure__ph-note {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(10, 186, 181, 0.75);
  display: inline-flex; align-items: center; gap: 7px;
}
.cvs-figure__ph-note::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(10, 186, 181, 0.9);
  box-shadow: 0 0 0 0 rgba(10, 186, 181, 0.5);
  animation: cvs-ph-pulse 2s ease-out infinite;
}
@keyframes cvs-ph-pulse {
  0% { box-shadow: 0 0 0 0 rgba(10, 186, 181, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(10, 186, 181, 0); }
}

/* ============================================================
   Lightbox overlay
   ============================================================ */
.cvs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 7, 0.92);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cvs-lightbox[data-open="true"] { display: flex; opacity: 1; }

.cvs-lightbox__stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none; /* we handle pan/pinch */
  cursor: grab;
}
.cvs-lightbox__stage[data-grabbing="true"] { cursor: grabbing; }

.cvs-lightbox__img {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  max-width: none;
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  /* sized & positioned by JS */
}

.cvs-lightbox__bar {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px clamp(16px, 4vw, 32px);
  background: linear-gradient(180deg, rgba(9,9,11,0.85), transparent);
  z-index: 2;
}
.cvs-lightbox__title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-inline-end: auto;
}
.cvs-lightbox__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cvs-lightbox__btn:hover {
  background: rgba(10,186,181,0.16);
  border-color: rgba(10,186,181,0.5);
  color: #fff;
}
.cvs-lightbox__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cvs-lightbox__btn svg { width: 18px; height: 18px; }

.cvs-lightbox__zoomlabel {
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

/* expandable long-description drawer at the bottom */
.cvs-lightbox__desc {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 2;
  max-height: 42vh;
  overflow: auto;
  padding: 18px clamp(16px, 4vw, 32px) 24px;
  background: linear-gradient(0deg, rgba(9,9,11,0.92), transparent);
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  line-height: 1.6;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.cvs-lightbox__desc[data-open="true"] { transform: none; }
.cvs-lightbox__desc h4 { margin: 0 0 6px; color: #fff; font-size: 14px; }

@media (max-width: 640px) {
  .cvs-lightbox__title { font-size: 13px; }
  .cvs-lightbox__btn { width: 44px; height: 44px; } /* larger touch targets */
}

@media (prefers-reduced-motion: reduce) {
  .cvs-lightbox, .cvs-lightbox__desc, .cvs-figure__frame, .cvs-figure__zoom { transition: none; }
  .cvs-figure__ph-note::before { animation: none; }
}
