/* ==========================================================================
   Lesson videos (components/lesson-video.js)

   A card at the top of EEG Fundamentals lessons for the matching
   Introduction to EEG video: a thumbnail, the title and summary, and links
   that play it in the lesson or open the videos page for the transcript and
   quiz.
   ========================================================================== */

.lv {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--surface-1);
}

.lv-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-2);
}
.lv-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lv-play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(30, 24, 40, 0.72);
  transition: background-color 150ms ease, transform 150ms ease;
}
.lv-play-icon::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 14px;
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #fff;
}
.lv-thumb:hover .lv-play-icon { background: var(--accent-color); transform: scale(1.06); }

.lv-text { min-width: 0; }
.lv-text p { margin: 0; }
.lv-kicker {
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lv-title { margin-top: 0.15rem !important; color: var(--text-color); font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.lv-summary { margin-top: 0.3rem !important; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }
.lv-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.6rem !important; }
.lv-watch {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: rgba(163, 43, 120, 0.11);
  background: color-mix(in srgb, var(--accent-color) 12%, transparent);
  color: var(--accent-color) !important;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 160ms ease;
}
.lv-watch:hover { background: color-mix(in srgb, var(--accent-color) 20%, transparent); }
.lv-more { color: var(--accent-color); font-size: 0.875rem; font-weight: 600; }

/* playing: the video takes the card's full width, the text stays below */
.lv.is-playing { grid-template-columns: minmax(0, 1fr); align-items: start; }
.lv.is-playing .lv-thumb, .lv.is-playing .lv-watch { display: none; }
.lv-player { display: grid; gap: 0.5rem; justify-items: end; }
.lv-player video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  background: #000;
}
.lv-close {
  min-height: 34px;
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-color);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.lv-close:hover { background: var(--surface-2); }

/* phones: a compact row, thumbnail beside the title, so the lesson text
   starts on the first screen */
@media (max-width: 640px) {
  .lv { grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
  .lv:not(.is-playing) { grid-template-columns: 120px minmax(0, 1fr); gap: 0.75rem; padding: 0.55rem; }
  .lv:not(.is-playing) .lv-summary { display: none; }
  .lv:not(.is-playing) .lv-title { font-size: 0.98rem; }
  .lv:not(.is-playing) .lv-play-icon { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
  .lv:not(.is-playing) .lv-play-icon::after { left: 13px; top: 10px; border-width: 7px 0 7px 11px; }
  .lv:not(.is-playing) .lv-actions { gap: 0.35rem 0.75rem; margin-top: 0.4rem !important; }
  .lv-watch { min-height: 40px; }
}
@media (pointer: coarse) {
  .lv-watch { min-height: 44px; }
  /* the transcript link is a tap target too */
  .lv-more { display: inline-flex; align-items: center; min-height: 44px; }
}

/* the course welcome points to the full series */
.course-videos-note { margin: 1rem 0 0; color: var(--text-secondary); font-size: 0.92rem; line-height: 1.55; }

body.dark .lv-play-icon { background: rgba(10, 8, 16, 0.72); }

/* shown only if the browser cannot play the video in the lesson */
.lv-problem { justify-self: stretch; margin: 0; color: var(--text-secondary); font-size: 0.9rem; }
.lv-problem a { color: var(--accent-color); font-weight: 600; }
.lv-problem[hidden] { display: none; }
