/* ==========================================================================
   MEDFILM — Film Comparison Viewer
   Uses the site's own design tokens (assets/css/style.css) so it reads as a
   native part of the site rather than a bolted-on widget.
   ========================================================================== */

.fc-widget {
  --fc-mono: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', monospace;
}

.fc-frame {
  position: relative;
  background: var(--gradient-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
}

.fc-hint {
  position: absolute;
  top: -14px;
  right: 22px;
  background: var(--color-white);
  color: var(--color-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 2;
}

.fc-pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-secondary);
  position: relative;
  flex-shrink: 0;
}
.fc-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--color-secondary);
  opacity: 0.5;
  animation: fc-pulse 1.6s ease-out infinite;
}
@keyframes fc-pulse {
  0% { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(2.1); opacity: 0; }
}

.fc-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  border-radius: calc(var(--radius-lg) - 10px);
  overflow: hidden;
  background: var(--color-dark);
  border: 1px solid rgba(255,255,255,0.08);
  user-select: none;
  touch-action: none;
  cursor: ew-resize;
}

.fc-viewer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
  transition: opacity 0.32s ease;
}

.fc-img-right { filter: grayscale(1) contrast(1.05); }

.fc-img-left-wrap { position: absolute; inset: 0; overflow: hidden; width: 50%; }
.fc-img-left-wrap img { width: var(--fc-viewer-w, 100%); max-width: none; }

/* divider */
.fc-divider {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 3px;
  background: var(--color-accent);
  transform: translateX(-1.5px);
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.15);
}

.fc-handle {
  position: absolute;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--color-white);
  border: 2px solid var(--color-accent);
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
  font-size: 15px;
  box-shadow: var(--shadow-md);
}

.fc-viewer:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 3px; }

/* corner readouts — a light nod to a PACS overlay, without the dark theme */
.fc-tag {
  position: absolute;
  font-family: var(--fc-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--color-white);
  background: rgba(11, 32, 56, 0.55);
  backdrop-filter: blur(3px);
  padding: 6px 9px;
  border-radius: 8px;
  pointer-events: none;
  white-space: pre;
}

.fc-tag-tl { top: 12px; left: 12px; }
.fc-tag-tr { top: 12px; right: 12px; text-align: right; opacity: 0.85; }

.fc-side-label {
  position: absolute;
  bottom: 12px;
  font-family: var(--fc-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
}

.fc-side-label.left {
  left: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
}
.fc-side-label.right {
  right: 12px;
  color: var(--color-dark);
  background: rgba(255, 255, 255, 0.85);
}

/* rotation progress */
.fc-progress-track {
  margin-top: 12px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}
.fc-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 2px;
}

/* filmstrip */
.fc-filmstrip {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.fc-thumb {
  flex: 0 0 auto;
  width: 92px; height: 68px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255,255,255,0.14);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: rgba(0,0,0,0.3);
  padding: 0;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.fc-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0.65; transition: opacity var(--t-fast);
}

.fc-thumb.active { border-color: var(--color-accent); transform: translateY(-2px); }
.fc-thumb.active img, .fc-thumb:hover img { opacity: 1; }

.fc-thumb-label {
  position: absolute; bottom: 3px; left: 5px;
  font-family: var(--fc-mono);
  font-size: 8.5px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

.fc-footnote {
  margin-top: 4px;
  padding: 0 4px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .fc-viewer { aspect-ratio: 4 / 3; }
  .fc-tag { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-pulse-dot::after { animation: none; opacity: 0; }
  .fc-viewer img { transition: opacity 0.6s ease; }
}

/* -------------------- compact variant: homepage hero -------------------- */
/* The hero-visual-frame already supplies the border-radius, border, shadow
   and overflow:hidden that .fc-frame provides elsewhere, so here the widget
   just fills that existing frame edge-to-edge — no extra chrome, no
   filmstrip/progress bar, matching the footprint of the image it replaced. */
.hero-visual-frame #film-compare-home,
.hero-visual-frame .fc-widget {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-visual-frame .fc-viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border: none;
}
.hero-visual-frame .fc-progress-track,
.hero-visual-frame .fc-filmstrip {
  display: none;
}
