/* ============================================================
   Pill preview popover — TEST BUILD (not deployed)
   Desktop: hover a pill → anchored preview scales up from the pill.
   Mobile:  tap a pill → centred lightbox with backdrop + close.
   ============================================================ */

/* Pills become interactive */
.card-tags li {
  cursor: pointer;
}
.card-tags li.pill-active {
  border-color: var(--accent);
  color: var(--accent);
}
.card-tags li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Shared popover shell ---------- */
.pill-preview {
  position: fixed;
  z-index: 90;
  width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 24px 60px -18px rgba(30, 20, 10, 0.35),
    0 4px 14px -6px rgba(30, 20, 10, 0.18);
  overflow: hidden;
  pointer-events: none;           /* hover preview: never steals the mouse */
  opacity: 0;
  transform: scale(0.86) translateY(10px);
  /* transform-origin set inline by JS to point at the pill */
  /* closing: slightly quicker than opening, still soft */
  transition:
    opacity 0.28s ease-in,
    transform 0.28s cubic-bezier(0.4, 0.1, 0.6, 1),
    visibility 0s linear 0.28s;
  will-change: transform, opacity;
  visibility: hidden;
}
.pill-preview.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
  /* opening: slow, fade-led, gentle settle */
  transition:
    opacity 0.38s ease-out,
    transform 0.42s cubic-bezier(0.22, 0.8, 0.3, 1),
    visibility 0s;
}
.pill-preview img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff; /* dashboard art is light; keep it true in dark mode */
}
.pill-preview .pill-preview-caption {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--faint);
  padding: 0.5em 1em 0.6em;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
}
.pill-preview .pill-preview-caption strong {
  color: var(--accent);
  font-weight: 600;
}

/* Reduced motion: fade only */
@media (prefers-reduced-motion: reduce) {
  .pill-preview {
    transition: opacity 0.15s ease-out;
    transform: none;
  }
  .pill-preview.is-open { transform: none; }
}

/* ---------- Mobile lightbox mode ---------- */
.pill-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(15, 15, 14, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out;
}
.pill-preview-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.pill-preview.mode-lightbox {
  pointer-events: auto;           /* needs taps for the close button */
  left: 50% !important;
  top: 50% !important;
  width: min(560px, calc(100vw - 28px));
  transform: translate(-50%, -50%) scale(0.6);
  transform-origin: center center !important;
}
.pill-preview.mode-lightbox.is-open {
  transform: translate(-50%, -50%) scale(1);
}

.pill-preview .pill-preview-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink, #1a1a1a);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.pill-preview.mode-lightbox .pill-preview-close {
  display: flex;
}

/* Dark theme: soften the light screenshot panel so it doesn't glare
   against the dark page. Light theme is untouched. */
html[data-theme="dark"] .pill-preview img {
  filter: brightness(0.85) contrast(1.02);
}
