/* =============================================
   SUBTITLES
   ============================================= */

/* Backdrop gradient */
.sub-backdrop {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 240px; z-index: 198; pointer-events: none;
  background: linear-gradient(0deg, rgba(1,8,20,0.9) 0%, rgba(1,8,20,0.5) 40%, transparent 100%);
  opacity: 0;
  transition: opacity 0.5s;
}
.sub-backdrop.visible { opacity: 1; }

/* Container */
.subtitles {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 199;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 32px 36px; gap: 10px;
  opacity: 0; transition: opacity 0.4s;
}
.subtitles.visible { opacity: 1; }

/* Words line */
.subtitles__line {
  max-width: 700px; width: 100%; text-align: center;
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  justify-content: center; align-items: baseline;
  min-height: 48px;
}

/* Individual word */
.sub-word {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.4rem);
  font-weight: 600; letter-spacing: 0.05em;
  display: inline-block; white-space: nowrap;
  /* State: hidden by default */
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  transition: opacity 0.2s cubic-bezier(0.16,1,0.3,1),
              transform 0.2s cubic-bezier(0.16,1,0.3,1),
              color 0.15s, text-shadow 0.15s;
  /* Text shadow to separate from background content */
  text-shadow: 0 2px 12px rgba(1,6,16,0.9), 0 0 24px rgba(1,6,16,0.8);
}

/* Word becomes visible */
.sub-word.appear {
  opacity: 0.5;
  transform: translateY(0) scale(1);
  color: var(--text-secondary);
}

/* Currently spoken word */
.sub-word.active {
  opacity: 1;
  color: #ffffff;
  transform: translateY(-1px) scale(1.06);
  text-shadow:
    0 2px 12px rgba(1,6,16,0.95),
    0 0 20px var(--accent-glow-strong),
    0 0 40px var(--accent-glow);
}

/* Already spoken */
.sub-word.spoken {
  opacity: 0.25;
  color: var(--text-muted);
  transform: translateY(0) scale(1);
}

/* Fading out */
.sub-word.fade-out {
  opacity: 0 !important;
  transform: translateY(-8px) scale(0.95) !important;
  transition: opacity 0.3s, transform 0.3s !important;
}

/* Progress bar */
.subtitles__progress {
  width: 100%; max-width: 320px;
  height: 1px; background: rgba(111,169,214,0.1);
  border-radius: 1px; overflow: hidden;
}
.subtitles__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  width: 0%; transition: width 0.15s linear; border-radius: 1px;
}
