/**
 * Syntro Health — Loom Player & 16:9 Motion Graphics Stylesheet
 * Architectural Standard: emil-design-eng & high-end-visual-design
 * Strict: 16:9 Aspect Ratio Lock · Obsidian Theme · Fluid Typography
 */

/* Modal Backdrop */
.loom-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10500;
  background: color-mix(in srgb, var(--color-shadow-ink) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 1;
  animation: loomFadeIn 240ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loomFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Modal Dialog Box */
.loom-modal-dialog {
  width: 100%;
  max-width: 1140px;
  background: var(--color-obsidian);
  border: 1px solid color-mix(in srgb, var(--color-slate-700) 70%, transparent);
  box-shadow: 0 25px 60px -15px color-mix(in srgb, var(--color-shadow-ink) 80%, transparent), 0 0 40px color-mix(in srgb, var(--color-emerald-500) 12%, transparent);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.loom-modal-header {
  padding: 0.85rem 1.25rem;
  background: color-mix(in srgb, var(--color-slate-900) 85%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-slate-700) 50%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.loom-live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-emerald-500);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--color-emerald-500);
  animation: loomPulse 2s infinite ease-in-out;
}

@keyframes loomPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.loom-brand-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-slate-50);
  letter-spacing: -0.01em;
}

.loom-badge-ratio {
  background: color-mix(in srgb, var(--color-emerald-500) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-emerald-500) 35%, transparent);
  color: var(--color-emerald-500);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem var(--space-xs);
  border-radius: 6px;
}

.loom-badge-vnb {
  background: color-mix(in srgb, var(--color-cyan-400) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-cyan-400) 35%, transparent);
  color: var(--color-cyan-400);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem var(--space-xs);
  border-radius: 6px;
}

.loom-btn-close {
  background: color-mix(in srgb, var(--color-slate-800) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 10%, transparent);
  color: var(--color-slate-300);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms ease-out, background 160ms ease-out;
}

.loom-btn-close:hover {
  background: color-mix(in srgb, var(--color-rose-500) 20%, transparent);
  color: var(--color-rose-500);
  transform: scale(1.05);
}

.loom-btn-close:active {
  transform: scale(0.95);
}

/* 16:9 Stage Aspect Box */
.loom-stage-wrapper {
  background: var(--color-shadow-ink);
  width: 100%;
}

.loom-stage-aspect-box {
  width: 100%;
  aspect-ratio: 16 / 9; /* CRITICAL: Locks strict 16:9 Full HD ratio, eradicating distortion */
  position: relative;
  overflow: hidden;
  background: var(--color-obsidian);
}

.loom-motion-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.loom-native-video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Prevents stretching */
  background: var(--color-shadow-ink);
}

/* Floating HUD Overlay */
.loom-hud-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.loom-hud-chip {
  background: color-mix(in srgb, var(--color-slate-900) 85%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-700) 80%, transparent);
  backdrop-filter: blur(8px);
  padding: var(--space-xs) 0.85rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--color-shadow-ink) 50%, transparent);
  pointer-events: auto;
}

.loom-chip-badge {
  background: var(--color-emerald-500);
  color: var(--color-obsidian);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.loom-chip-text strong {
  display: block;
  color: var(--color-slate-50);
  font-size: 0.85rem;
  font-family: var(--font-body);
  line-height: 1.2;
}

.loom-chip-text small {
  display: block;
  color: var(--color-slate-400);
  font-size: 0.72rem;
  line-height: 1.2;
}

.loom-hud-watermark {
  background: color-mix(in srgb, var(--color-slate-950) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

/* Controls Bar */
.loom-controls-bar {
  padding: 0.85rem 1.25rem;
  background: var(--color-slate-900);
  border-top: 1px solid color-mix(in srgb, var(--color-slate-700) 60%, transparent);
}

.loom-progress-track {
  width: 100%;
  height: 6px;
  background: var(--color-slate-800);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: none;
}

.loom-progress-track:hover {
  height: 8px;
}

.loom-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-emerald-500), var(--color-cyan-400));
  border-radius: 3px;
  position: relative;
}

.loom-progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: var(--color-slate-50);
  border: 2px solid var(--color-emerald-500);
  border-radius: 50%;
  box-shadow: 0 0 8px color-mix(in srgb, var(--color-emerald-500) 60%, transparent);
}

.loom-marker {
  position: absolute;
  top: -2px;
  width: 3px;
  height: 10px;
  background: color-mix(in srgb, var(--color-slate-50) 30%, transparent);
  pointer-events: none;
}

.loom-control-btn {
  background: color-mix(in srgb, var(--color-slate-800) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 10%, transparent);
  color: var(--color-slate-100);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms ease-out, background 160ms ease-out;
}

.loom-control-btn:hover {
  background: var(--color-slate-800);
  color: var(--color-emerald-500);
  transform: scale(1.05);
}

.loom-control-btn:active {
  transform: scale(0.95);
}

.loom-time-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-emerald-500);
  font-weight: 600;
  margin-left: var(--space-xs);
}

.loom-pill-btn {
  background: color-mix(in srgb, var(--color-slate-800) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  color: var(--color-slate-400);
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  padding: var(--space-2xs) 0.6rem;
  border-radius: 20px;
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out, opacity 160ms ease-out, transform 160ms ease-out;
}

.loom-pill-btn:hover {
  color: var(--color-slate-50);
  border-color: color-mix(in srgb, var(--color-slate-50) 25%, transparent);
  background: color-mix(in srgb, var(--color-slate-700) 60%, transparent);
}

.loom-pill-btn.active {
  background: color-mix(in srgb, var(--color-emerald-500) 20%, transparent);
  border-color: var(--color-emerald-500);
  color: var(--color-emerald-500);
  font-weight: 700;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .loom-modal-backdrop {
    padding: var(--space-xs);
  }
  .loom-chapter-pills {
    display: none !important;
  }
  .loom-badge-ratio, .loom-badge-vnb {
    display: none;
  }
  .loom-hud-chip {
    padding: 0.35rem 0.6rem;
  }
  .loom-chip-text strong {
    font-size: 0.75rem;
  }
  .loom-chip-text small {
    display: none;
  }
}
