/*
 * TryonLoader — стили слоёв поверх canvas-сцены ожидания генерации.
 * Дизайн-система Clinical Botany: ель #10251F, мох #3F745E/#8EB8A0, pollen #A9C52C/#D9E95B.
 * Значения токенов задублированы как fallback в var() — контейнер живёт внутри
 * страницы с shared/styles.css, но лоадер должен корректно рисоваться и автономно.
 */

.tl-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none; /* клики (крестик оверлея) проходят насквозь; кнопка звука — исключение */
  /* Тёмно-еловый фон: виден до/вместо canvas (reduced-motion) и по краям */
  background: radial-gradient(120% 100% at 50% 44%, #183328 0%, #10251F 44%, #0A1A15 100%);
  color: #F8FAF6;
  font-family: var(--font-head, "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* --- Статичный слой для reduced-motion --- */
.tl-static {
  position: absolute;
  inset: 0;
  display: none;
}
.tl-dot {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #D9E95B 0%, #A9C52C 42%, rgba(63, 116, 94, 0) 72%);
  /* Пульс-опасити — это и есть запрошенный reduced-motion fallback, поэтому не гасим */
  animation: tl-pulse 2.6s ease-in-out infinite;
}
@keyframes tl-pulse {
  0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(0.9); }
  50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.16); }
}

.tl-root--rm .tl-canvas { display: none; }
.tl-root--rm .tl-static { display: block; }

/* --- Текстовые слои --- */
.tl-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 540px;
  padding: 24px 28px;
  text-align: center;
  transform: translateY(-3%); /* чуть выше центра — низ отдан эквалайзеру */
}

.tl-title {
  margin: 0;
  font-size: clamp(22px, 4.4vw, 30px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: #F8FAF6;
}

.tl-progress {
  margin: 12px 0 0;
  min-height: 1.5em; /* нет прыжка при смене фразы */
  font-size: clamp(16px, 2.2vw, 18px);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: #8EB8A0; /* мох-300 — читаемо на тёмном */
  transition: opacity 0.42s ease;
}

/* Карточка-факт: полупрозрачная моховая подложка, лабораторная разметка */
.tl-fact {
  margin: 30px auto 0;
  max-width: 440px;
  padding: 16px 20px 18px;
  text-align: left;
  background: rgba(63, 116, 94, 0.14);
  border: 1px solid rgba(142, 184, 160, 0.26);
  border-radius: var(--radius-asym, 1.15rem 1.15rem 1.15rem 0.34rem);
  transition: opacity 0.42s ease;
}
.tl-fact.is-out,
.tl-progress.is-out { opacity: 0; }

.tl-fact__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tl-fact__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8EB8A0; /* eyebrow-мох */
}
/* Лаб-индекс «01 / 06»: моно-цифры Manrope, тонкая рамка */
.tl-fact__num {
  flex: none;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #D9E95B; /* pollen-300, читаемо на тёмном */
  border: 1px solid rgba(217, 233, 91, 0.4);
  border-radius: 6px;
  white-space: nowrap;
}
.tl-fact__text {
  margin: 0;
  font-size: clamp(17px, 2.4vw, 19px); /* ≥17px — аудитория 60+ */
  font-weight: 600;
  line-height: 1.5;
  color: #EAF2EA;
}

/* --- Кнопка звука (угол, полупрозрачная) --- */
.tl-sound {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 3;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #DCEAE0;
  background: rgba(16, 37, 31, 0.55);
  border: 1px solid rgba(142, 184, 160, 0.34);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.tl-sound:hover {
  border-color: rgba(169, 197, 44, 0.6);
  background: rgba(16, 37, 31, 0.78);
}
.tl-sound:focus-visible {
  outline: 2px solid rgba(169, 197, 44, 0.7);
  outline-offset: 2px;
}
.tl-sound[aria-pressed="true"] {
  border-color: rgba(169, 197, 44, 0.65);
  color: #EAF2C0;
}
.tl-sound svg { flex: none; display: block; }

@media (max-width: 480px) {
  .tl-content { padding: 20px; transform: translateY(-2%); }
  .tl-fact { margin-top: 24px; }
  .tl-sound { left: 12px; bottom: 12px; }
}
