/* ============================================================================
   HYPE THEME — активируется через body[data-style="hype"]
   ----------------------------------------------------------------------------
   Перехватывает .scene-text и фон сцены, не трогая остальной UI плеера и
   горизонтальные проекты. Все селекторы префиксованы [data-style="hype"] —
   если флаг не выставлен, файл фактически no-op.

   См. также _briefs/HYPE/CLAUDE.md и backend/scenario_builder_hype.py.
   ========================================================================== */

/* ── Inter Black через Google Fonts ──────────────────────────────────────
   Inter не установлен на Windows по дефолту, без этого @import шрифт
   сваливается на Segoe UI / system-ui — это уже не "хайповый плотный
   display", а обычный sans. weight 700/800/900 = bold/extrabold/black. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@700;800;900&display=swap');

/* ── Stage chrome: тёмный фон, off-white ink ──────────────────────────── */

/* `!important` нужен потому что #stage[data-theme="light"] из основного
   styles.css имеет ту же categori specificity (id + attr) и пересиливает по
   порядку загрузки. Использовать data-theme="hype" вариант мы не хотим —
   тогда builder VPR-задач, переключающий theme через UI, переставал бы
   работать. Так что hype-стиль перебиваем явно. */
body[data-style="hype"] #stage {
  background: #0F0F1A !important;
  --stage-ink: #F5F5FF !important;
  --stage-muted: #9090A8 !important;
  --arrow-color: #FF006E;  /* стрелки по умолчанию розовые, можно перебить через scene.color */
  color: #F5F5FF !important;
}

/* ── Typography override: огромный жирный uppercase ──────────────────── */

body[data-style="hype"] .scene-text {
  /* Inter / Helvetica Bold-stack. Загружен через @import выше — fallback на
     системный sans с весом 900 если Google Fonts недоступен. */
  font-family: "Inter", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.0;
  /* uppercase управляется через scene.uppercase = true в JSON — не форсим тут */

  /* КРИТИЧНО: nowrap, иначе .scene-text без явного width схлопывается в
     shrink-to-fit и большая фраза («WARP DRIVE», «НЕ СУЩЕСТВУЕТ») wrap'ится
     посреди слова. Базовый styles.css ставит pre-line — для горизонтальных
     академических сцен это ок (короткие фразы), для хайпа критично иначе. */
  white-space: nowrap !important;

  /* Контрастный glow в цвет акцента. Подсветка делает текст «светящимся»
     даже на маленьком экране телефона. */
  text-shadow:
    0 0 16px rgba(0, 245, 255, 0.55),
    0 0 32px rgba(255, 0, 110, 0.30),
    0 2px 0 rgba(0, 0, 0, 0.85);
}

body[data-style="hype"] .scene-label {
  /* Подписи под графикой — мельче, плотнее, без glow */
  font-family: "Inter", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #9090A8;
  text-transform: uppercase;
}

/* ── Pop-in keyframe — bounce поверх стандартного fade-in ──────────── */
/*
   ВНИМАНИЕ: в render-mode эту анимацию отключаем (см. ниже). Render заново
   мoнтирует каждый кадр через __seekRender → animation проигрывалась бы на
   каждом скриншоте, что дало бы мерцание/искажение pop'а в финальном MP4.
   В живом превью же она и нужна — здесь сцены mount'ятся один раз.
*/
@keyframes hype-pop {
  0%   { transform: scale(0.55) translateY(8px); }
  55%  { transform: scale(1.07) translateY(0); }
  78%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

body[data-style="hype"]:not(.render-mode) .scene-text,
body[data-style="hype"]:not(.render-mode) .scene-raster,
body[data-style="hype"]:not(.render-mode) .scene-draw_svg {
  animation: hype-pop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: center center;
}

/* В render-mode анимации выключены — каждая сцена сразу в финальном
   состоянии. JSON-плеер сам отвечает за «когда сцена видна». */
body[data-style="hype"].render-mode .scene-text,
body[data-style="hype"].render-mode .scene-raster,
body[data-style="hype"].render-mode .scene-draw_svg {
  animation: none !important;
}

/* ── Hide speaker overlay in HYPE mode ───────────────────────────────── */
/*
   HYPE-ролики full-frame, без говорящей головы в кадре. Если когда-то
   понадобится — задаём отдельный scene-type или маленькую «маску» в углу
   через fade_video, но НЕ через стандартный speaker-overlay.
*/
body[data-style="hype"] #speaker-slot {
  display: none !important;
}

/* ── Output-frame в preview: вертикальный phone-mockup без зума ────── */

body[data-style="hype"] #output-frame[data-mode="vertical"] {
  background: #000;
  /* Canvas уже 1080×1920 — нет смысла зумить как для горизонтального canvas
     в вертикальном composite. Стейдж должен заполнить рамку 1:1. */
}

body[data-style="hype"] #output-frame[data-mode="vertical"] #stage-wrapper {
  width: 100% !important;
  margin: 0 !important;
}

body[data-style="hype"] #output-frame[data-mode="vertical"] #stage {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 9 / 16 !important;
}

/* ── Render-mode: стейдж заполняет весь playwright viewport ──────────── */
/*
   КРИТИЧНО: HYPE-overrides для #output-frame[data-mode="vertical"] выше
   имеют specificity (0,2,2,1), что ВЫШЕ чем `body.render-mode #stage`
   (0,1,1,2) из основного styles.css. Без явного сброса в render-mode стейдж
   остался бы в phone-mockup рамке 420px и кадр обрезался бы — текст шёл бы
   за края canvas. Поэтому в render-mode явно расширяем всё до 100vw/100vh.
*/
body[data-style="hype"].render-mode #output-frame,
body[data-style="hype"].render-mode #output-frame[data-mode="vertical"] {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: auto !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

body[data-style="hype"].render-mode #output-frame[data-mode="vertical"] #stage-wrapper {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}

body[data-style="hype"].render-mode #output-frame[data-mode="vertical"] #stage,
body[data-style="hype"].render-mode #stage {
  width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: auto !important;
  max-width: none !important;
  max-height: none !important;
  background: #0F0F1A !important;
  border-radius: 0 !important;
  border: 0 !important;
}
