/* TALKING SCIENTIST HOLOGRAPHIC DIALOG & AVATAR STYLES
   2026 Enhanced Glassmorphic UI with dynamic soundwave frequency visualizer,
   karaoke sentence highlighting, and smartboard ergonomic controls. */

.sci-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above the floating quick-tools orb (99999), so the orb never covers the Listen button */
  background: rgba(10, 18, 22, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sci-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sci-modal-dialog {
  background: var(--panel, #ffffff);
  color: var(--ink, #1e293b);
  border-radius: 28px;
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 40px rgba(11, 110, 121, 0.25);
  padding: 2rem;
  position: relative;
  transform: translateY(28px) scale(0.95);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sci-modal-dialog {
    background: rgba(22, 34, 38, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

:root[data-theme="dark"] .sci-modal-dialog {
  background: rgba(22, 34, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sci-modal-backdrop.open .sci-modal-dialog {
  transform: translateY(0) scale(1);
}

.sci-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--panel2, #f1f5f9);
  color: var(--muted, #64748b);
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  z-index: 2;
}

.sci-modal-close:hover {
  background: var(--danger, #dc2626);
  color: #ffffff;
  border-color: var(--danger, #dc2626);
  transform: scale(1.08) rotate(90deg);
}

.sci-modal-header {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

@media (max-width: 620px) {
  .sci-modal-header {
    flex-direction: column;
    text-align: center;
  }
}

/* Holographic Avatar Aura */
.sci-avatar-container {
  position: relative;
  flex: none;
  width: 140px;
  height: 140px;
}

.sci-pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent, #0b6e79);
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.35s ease;
  pointer-events: none;
}

.sci-modal-dialog.speaking .sci-pulse-ring {
  opacity: 0.85;
  animation: sci-hologram-pulse 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes sci-hologram-pulse {
  0% { transform: scale(0.95); opacity: 0.9; box-shadow: 0 0 0 0 rgba(76, 195, 207, 0.5); }
  50% { transform: scale(1.08); opacity: 0.4; box-shadow: 0 0 25px 8px rgba(76, 195, 207, 0.35); }
  100% { transform: scale(0.95); opacity: 0.9; box-shadow: 0 0 0 0 rgba(76, 195, 207, 0.5); }
}

.sci-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--panel, #ffffff);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 0 2px var(--accent, #0b6e79);
  background: var(--panel2, #e2e8f0);
  transition: transform 0.3s ease, filter 0.3s ease;
}

.sci-modal-dialog.speaking .sci-avatar {
  filter: contrast(1.06) brightness(1.03);
}

/* Audio Visualizer Soundwave Bars */
.sci-audio-wave {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 26px;
  padding: 3px 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sci-audio-wave span {
  width: 4px;
  height: 5px;
  background: var(--accent, #4cc3cf);
  border-radius: 2px;
  transition: height 0.08s ease;
}

.sci-modal-dialog.speaking .sci-audio-wave span:nth-child(1) { animation: sci-wave 0.75s ease-in-out infinite 0.1s; }
.sci-modal-dialog.speaking .sci-audio-wave span:nth-child(2) { animation: sci-wave 0.75s ease-in-out infinite 0.25s; }
.sci-modal-dialog.speaking .sci-audio-wave span:nth-child(3) { animation: sci-wave 0.75s ease-in-out infinite 0.05s; }
.sci-modal-dialog.speaking .sci-audio-wave span:nth-child(4) { animation: sci-wave 0.75s ease-in-out infinite 0.35s; }
.sci-modal-dialog.speaking .sci-audio-wave span:nth-child(5) { animation: sci-wave 0.75s ease-in-out infinite 0.18s; }

@keyframes sci-wave {
  0%, 100% { height: 5px; }
  50% { height: 22px; background: #6bcb8b; }
}

.sci-meta {
  flex: 1;
  min-width: 0;
}

.sci-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(11, 110, 121, 0.15);
  color: var(--accent, #0b6e79);
}

.sci-title {
  margin: 0.35rem 0 0.15rem;
  font-size: clamp(1.4rem, 2.8vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
}

.sci-dates {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #64748b);
  font-family: var(--f-mono, monospace);
}

.sci-tagline {
  margin: 0.4rem 0 0;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink, #1e293b);
  line-height: 1.4;
}

.sci-exp-chip {
  margin-top: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: color-mix(in srgb, var(--accent, #0b6e79) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #0b6e79) 30%, transparent);
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent, #0b6e79);
}

/* Quote box */
.sci-quote-box {
  background: var(--panel2, #f8fafc);
  border-left: 4px solid var(--accent, #0b6e79);
  border-radius: 0 16px 16px 0;
  padding: 1rem 1.25rem;
  font-style: italic;
  font-size: 0.98rem;
  color: var(--ink, #334155);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.sci-quote-mark {
  font-size: 1.5rem;
  color: var(--accent, #0b6e79);
  font-family: Georgia, serif;
  line-height: 0;
}

/* Audio control bar */
.sci-audio-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--panel2, #f1f5f9);
  border-radius: 16px;
  border: 1px solid var(--line, #e2e8f0);
}

.sci-btn {
  border: none;
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 42px;
}

.sci-btn-primary {
  background: linear-gradient(135deg, var(--accent, #0b6e79), #1898a8);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(11, 110, 121, 0.35);
}

.sci-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(11, 110, 121, 0.45);
}

.sci-btn-secondary {
  background: var(--panel, #ffffff);
  color: var(--ink, #1e293b);
  border: 1px solid var(--line, #cbd5e1);
}

.sci-btn-secondary:hover {
  background: var(--panel2, #e2e8f0);
}

.sci-btn-ghost {
  background: transparent;
  color: var(--muted, #64748b);
}

.sci-btn-ghost:hover {
  color: var(--danger, #dc2626);
  background: rgba(220, 38, 38, 0.1);
}

.sci-rate-selector {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
}

.sci-select {
  border: 1px solid var(--line, #cbd5e1);
  background: var(--panel, #ffffff);
  color: var(--ink, #1e293b);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

/* Karaoke-style synchronized transcript */
.sci-transcript-panel {
  background: var(--panel2, #f8fafc);
  border-radius: 16px;
  border: 1px solid var(--line, #e2e8f0);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sci-transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sci-transcript-note {
  font-size: 0.75rem;
  color: var(--accent, #0b6e79);
}

.sci-transcript-text {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink, #334155);
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sci-sentence {
  display: inline;
  padding: 2px 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.sci-sentence.active {
  background: color-mix(in srgb, var(--accent, #0b6e79) 25%, transparent);
  color: var(--accent, #0b6e79);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(11, 110, 121, 0.2);
}

/* Gallery of more scientists */
.sci-gallery-section {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line, #e2e8f0);
}

.sci-gallery-title {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--muted, #64748b);
  font-weight: 700;
}

.sci-gallery-scroll {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 0.75rem;
}

.sci-gallery-item {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel2, #f1f5f9);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  width: 96px;
  text-align: center;
}

.sci-gallery-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent, #0b6e79);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  background: var(--panel, #ffffff);
}

.sci-gallery-item.active {
  border-color: var(--accent, #0b6e79);
  background: color-mix(in srgb, var(--accent, #0b6e79) 15%, var(--panel, #ffffff));
}

.sci-gallery-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--panel, #ffffff);
}

.sci-gallery-name {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink, #1e293b);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* inside a lesson tab: the same panel, placed in the page instead of over it */
.sci-modal-backdrop.inline { position: relative; inset: auto; z-index: auto; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; opacity: 1; pointer-events: auto; display: block; }
.sci-modal-backdrop.inline .sci-modal-dialog { transform: none; max-width: none; max-height: none; overflow: visible; box-shadow: none; padding: 1.25rem; border-radius: 20px; }
.sci-modal-backdrop.inline .sci-modal-close { display: none; }
