/* Обучающие ролики (задача 327).
 *
 * Отдельный файл: ни один существующий CSS проекта не редактируется, поэтому
 * подключение на трёх экранах не может утащить за собой чужую вёрстку.
 *
 * Правила, которые здесь проверяются числом в UI-proof (REVIEWS/ui_327/proof.json),
 * а не «на глаз»:
 *   - цель нажатия ≥ 48×48 px;
 *   - контраст текста к фону ≥ 4.5:1;
 *   - на 390 px нет горизонтального переполнения.
 */

.tv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
  margin: 4px 0 4px 8px;
  vertical-align: middle;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  /* #1e1b4b на #eef2ff ≈ 14.9:1 */
  color: #1e1b4b;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
}

.tv-btn:hover { background: #e0e7ff; }
.tv-btn:focus-visible { outline: 3px solid #3730a3; outline-offset: 2px; }
.tv-btn__play { font-size: 12px; line-height: 1; }

/* Плитка админ-панели: кнопка притворяется карточкой соседних быстрых разделов. */
.tv-btn--tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 16px;
}

/* --- публичные карточки /how-it-works ------------------------------------- */

.tv-section { margin: 28px 0; }
.tv-section__title { margin: 0 0 6px; font-size: 22px; line-height: 1.3; color: #1e1b4b; }
.tv-section__sub { margin: 0 0 16px; font-size: 15px; line-height: 1.5; color: #334155; }

.tv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.tv-card { min-width: 0; }

.tv-card__btn {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 48px;
  padding: 0;
  font: inherit;
  text-align: left;
  color: #1e1b4b;
  background: #ffffff;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
}

.tv-card__btn:hover { border-color: #818cf8; }
.tv-card__btn:focus-visible { outline: 3px solid #3730a3; outline-offset: 2px; }

.tv-card__poster {
  position: relative;
  display: block;
  width: 100%;
  background: #0f172a;
}

.tv-card__poster img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.tv-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  font-size: 20px;
  /* #ffffff на #3730a3 ≈ 10.3:1 */
  color: #ffffff;
  background: #3730a3;
  border-radius: 50%;
}

.tv-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.tv-card__title { font-size: 16px; font-weight: 600; line-height: 1.3; color: #1e1b4b; }
.tv-card__summary { font-size: 14px; line-height: 1.5; color: #334155; }
.tv-card__duration { font-size: 13px; color: #4338ca; }

.tv-card__noscript {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}

/* --- окно с плеером -------------------------------------------------------- */

.tv-modal {
  position: fixed;
  inset: 0;
  /* ⛔ Выше баннера про cookies (`.cookie-consent-banner`, z-index: 10000). При
     равном значении выигрывал баннер: он дописывается в конец `body` скриптом и
     по правилам наложения рисуется поверх окна с роликом, перекрывая на узком
     экране нижнюю часть кадра вместе с органами управления плеера. Проверка на
     390 px — `tools/ui_proof_327_training_video.py`, замер
     `cookie_banner_clear_of_modal_390`. */
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tv-modal[data-tv-open] { display: flex; }

.tv-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.tv-modal__window {
  position: relative;
  width: 100%;
  max-width: min(920px, 100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.32);
}

.tv-modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tv-modal__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  color: #1e1b4b;
}

.tv-modal__close {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  font-size: 18px;
  line-height: 1;
  /* #1e1b4b на #eef2ff ≈ 14.9:1 */
  color: #1e1b4b;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  cursor: pointer;
}

.tv-modal__close:hover { background: #e0e7ff; }
.tv-modal__close:focus-visible { outline: 3px solid #3730a3; outline-offset: 2px; }

.tv-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  background: #000000;
  border-radius: 10px;
}

.tv-video[hidden] { display: none; }

.tv-error {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  /* #7f1d1d на #fef2f2 ≈ 11.1:1 */
  color: #7f1d1d;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
}

.tv-error[hidden] { display: none; }

.tv-modal__foot {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}

@media (max-width: 480px) {
  .tv-btn { width: 100%; margin-left: 0; justify-content: flex-start; }
  .tv-modal { padding: 8px; }
  .tv-modal__window { padding: 12px; max-height: 94vh; }
  .tv-video { max-height: 56vh; }
}

@media (prefers-reduced-motion: reduce) {
  .tv-modal,
  .tv-modal__window,
  .tv-card__btn { transition: none !important; animation: none !important; }
}
