/* Движок деки Ириды: сцена 1920×1080, хореография появления, режимы показа.
   Бренд переопределяет только переменные (engine/brands/*.css), вёрстка слайдов — свободная. */
@import url('fonts/fonts.css');

:root {
  /* движение */
  --ease: cubic-bezier(.16, 1, .3, 1);          /* expo-out: резкий старт, мягкая посадка */
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur: 950ms;
  --step: 90ms;                                   /* шаг между data-d="1", "2"… */
  --lead: 140ms;                                  /* пауза после смены слайда */

  /* палитра по умолчанию, бренд перекрывает */
  --bg: #ffffff;
  --ink: #111214;
  --ink-2: rgba(17, 18, 20, .64);
  --ink-3: rgba(17, 18, 20, .56);
  --accent: #FFDD2D;          /* заливки, маркер, CTA */
  --accent-ink: #111214;      /* текст поверх акцента */
  --accent-2: #126DF7;        /* надзаголовки, линии, галочки */
  --surface: #F4F5F6;
  --surface-2: #E9EBED;
  --line: rgba(0, 16, 36, .12);
  --dark: #101218;
  --on-dark: #ffffff;
  --on-dark-2: rgba(255, 255, 255, .66);
  --on-dark-3: rgba(255, 255, 255, .4);
  --radius: 32px;
  --radius-sm: 16px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .10);

  --font-head: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --head-weight: 700;
  --head-tracking: -0.03em;

  --pad-x: 128px;
  --pad-y: 112px;
  --letterbox: #0b0c0f;
}

html, body { margin: 0; height: 100%; background: var(--letterbox); overflow: hidden; }
/* мобильный браузер сам «раздувает» мелкий текст и ломает вёрстку сцены — запрещаем */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.deck { position: fixed; inset: 0; overflow: hidden; }
.stage {
  position: absolute; left: 0; top: 0; width: 1920px; height: 1080px;
  transform-origin: 0 0;
  transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--s, 1));
}

/* ── слайд ─────────────────────────────────────────── */
.slide {
  position: absolute; inset: 0; width: 1920px; height: 1080px; overflow: hidden;
  box-sizing: border-box;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 30px; line-height: 1.4;
  visibility: hidden; opacity: 0;
  transition: opacity 520ms var(--ease-io), transform 700ms var(--ease), visibility 0s 520ms;
}
.slide.is-active { visibility: visible; opacity: 1; z-index: 2; transition: opacity 520ms var(--ease-io), transform 700ms var(--ease), visibility 0s; }
.slide *, .slide *::before, .slide *::after { box-sizing: border-box; }
.motion .slide.is-leaving { transform: scale(.985); }
.motion .slide[data-tr="zoom"]:not(.is-in) { transform: scale(1.04); }

.slide.dark {
  --bg: var(--dark); --ink: var(--on-dark); --ink-2: var(--on-dark-2); --ink-3: var(--on-dark-3);
  --surface: rgba(255, 255, 255, .06); --surface-2: rgba(255, 255, 255, .1); --line: rgba(255, 255, 255, .14);
}
.slide.accent { --bg: var(--accent); --ink: var(--accent-ink); --ink-2: color-mix(in srgb, var(--accent-ink) 70%, transparent); --ink-3: color-mix(in srgb, var(--accent-ink) 50%, transparent); }

/* ── типографика: крупно по умолчанию, мельче 22px на сцене не бывает ── */
.slide h1, .slide h2, .slide h3, .display, .h1, .h2, .h3 {
  font-family: var(--font-head); font-weight: var(--head-weight);
  letter-spacing: var(--head-tracking); line-height: 1.02; margin: 0; text-wrap: balance;
}
.display { font-size: 168px; line-height: .94; letter-spacing: calc(var(--head-tracking) - .01em); }
.h1 { font-size: 112px; }
.h2 { font-size: 76px; line-height: 1.04; }
.h3 { font-size: 46px; line-height: 1.12; }
.lead { font-size: 38px; line-height: 1.34; color: var(--ink-2); text-wrap: pretty; }
.body { font-size: 30px; line-height: 1.42; }
.small { font-size: 25px; line-height: 1.4; color: var(--ink-2); }
.caption { font-size: 22px; line-height: 1.35; color: var(--ink-3); }
.eyebrow { font-size: 24px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.num { font-family: var(--font-head); font-weight: var(--head-weight); font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: .9; }
.mono { font-family: var(--font-mono); }
.slide p, .slide ul, .slide ol, .slide figure { margin: 0; }
.slide ul, .slide ol { padding: 0; list-style: none; }

/* ── каркас: минимальный набор, дальше пиши свою вёрстку ── */
.pad { position: absolute; inset: var(--pad-y) var(--pad-x); }
.stack { display: flex; flex-direction: column; gap: var(--g, 32px); }
.row { display: flex; gap: var(--g, 32px); }
.grid { display: grid; gap: var(--g, 32px); }
.fill { flex: 1 1 0; min-width: 0; min-height: 0; }
.center { display: grid; place-items: center; }
.card { background: var(--surface); border-radius: var(--radius); padding: 48px; }
.pill { display: inline-flex; align-items: center; gap: 12px; padding: 10px 24px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 24px; font-weight: 600; }
.cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.contain { width: 100%; height: 100%; object-fit: contain; display: block; }
.rule { height: 2px; background: var(--line); border: 0; margin: 0; }

/* колонтитул, который движок вставляет из <template id="slide-chrome">;
   data-chrome="left" — только левая часть (справа фото под обрез), "none" — без колонтитула */
.slide[data-chrome="left"] .chrome > :last-child { visibility: hidden; }
.chrome { position: absolute; left: var(--pad-x); right: var(--pad-x); bottom: 44px; display: flex; align-items: center; justify-content: space-between; font-size: 20px; color: var(--ink-3); pointer-events: none; }

/* ── хореография появления ─────────────────────────────
   data-in="rise" data-d="2": тип появления и шаг задержки.
   Скрытое состояние действует только при .motion на <html> и пока слайд не вошёл. */
[data-in] {
  transition-property: opacity, transform, clip-path, filter;
  transition-duration: var(--dur);
  transition-timing-function: var(--ease);
  transition-delay: calc(var(--lead) + var(--d, 0) * var(--step));
}
.motion .slide:not(.is-in) [data-in] { transition-duration: 0s; transition-delay: 0s; }
.motion .slide:not(.is-in) [data-in="fade"] { opacity: 0; }
.motion .slide:not(.is-in) [data-in="rise"] { opacity: 0; transform: translateY(56px); }
.motion .slide:not(.is-in) [data-in="drop"] { opacity: 0; transform: translateY(-56px); }
.motion .slide:not(.is-in) [data-in="left"] { opacity: 0; transform: translateX(-96px); }
.motion .slide:not(.is-in) [data-in="right"] { opacity: 0; transform: translateX(96px); }
.motion .slide:not(.is-in) [data-in="scale"] { opacity: 0; transform: scale(.9); }
.motion .slide:not(.is-in) [data-in="zoom"] { opacity: 0; transform: scale(1.14); }
.motion .slide:not(.is-in) [data-in="pop"] { opacity: 0; transform: scale(.55); }
.motion .slide:not(.is-in) [data-in="blur"] { opacity: 0; filter: blur(28px); transform: scale(1.05); }
.motion .slide:not(.is-in) [data-in="mask"] { clip-path: inset(-12% -6% 100% -6%); transform: translateY(40px); }
.motion .slide:not(.is-in) [data-in="wipe"] { clip-path: inset(-6% 100% -6% -6%); }
.motion .slide:not(.is-in) [data-in="wipe-up"] { clip-path: inset(100% -6% -6% -6%); }
.motion .slide:not(.is-in) [data-in="bar"] { transform: scaleX(0); }
.motion .slide:not(.is-in) [data-in="bar-up"] { transform: scaleY(0); }
.motion .slide:not(.is-in) [data-in="kb"] { opacity: 0; transform: scale(1.16); }
[data-in="pop"] { transition-timing-function: var(--ease-spring); }
[data-in="mask"], [data-in="wipe"], [data-in="wipe-up"] { clip-path: inset(-12% -6% -12% -6%); }
[data-in="bar"] { transform-origin: left center; transition-duration: 1400ms; }
[data-in="bar-up"] { transform-origin: center bottom; transition-duration: 1400ms; }
[data-in="kb"] { transition: opacity 1200ms var(--ease-io) calc(var(--lead) + var(--d, 0) * var(--step)), transform 9s cubic-bezier(.2, .6, .2, 1) calc(var(--lead) + var(--d, 0) * var(--step)); }

/* слова заголовка по одному: движок режет текст на .w */
[data-in="words"] { transition: none; }
[data-in="words"] .w { display: inline-block; transition: opacity 900ms var(--ease), transform 900ms var(--ease), filter 900ms var(--ease); transition-delay: calc(var(--lead) + var(--d, 0) * var(--step) + var(--i, 0) * 55ms); }
.motion .slide:not(.is-in) [data-in="words"] .w { opacity: 0; transform: translateY(.45em); filter: blur(8px); transition-duration: 0s; transition-delay: 0s; }

/* шторка заголовка (сайт new.borfi.ru): плашка акцента закрывает строку слева направо,
   под ней проявляется текст, плашка уходит вправо; строки со сдвигом 100 мс.
   Цвет плашки — var(--shutter), по умолчанию акцент бренда */
.w.w-mark { display: inline !important; }   /* маркер не блок: перенос строк как в статике */
[data-in="shutter"] { position: relative; transition: none; }
[data-in="shutter"] .w { transition: opacity 0s linear calc(var(--lead) + var(--d, 0) * var(--step) + var(--ln, 0) * 100ms + 470ms); }
.motion .slide:not(.is-in) [data-in="shutter"] .w { opacity: 0; transition: none; }
.shutter-bar { position: absolute; z-index: 1; pointer-events: none; background: var(--shutter, var(--accent)); transform: scaleX(0); transform-origin: left center; }
.motion .slide.is-in .shutter-bar { animation: deck-shutter 1000ms cubic-bezier(.87, 0, .13, 1) calc(var(--lead) + var(--d, 0) * var(--step) + var(--ln, 0) * 100ms) both; }
@keyframes deck-shutter {
  0% { transform: scaleX(0); transform-origin: left center; }
  45% { transform: scaleX(1); transform-origin: left center; }
  55% { transform: scaleX(1); transform-origin: right center; }
  100% { transform: scaleX(0); transform-origin: right center; }
}

/* луч-сканер: по каждой строке заголовка бежит светящаяся черта, слова проявляются за ней.
   Цвет черты — var(--scan), по умолчанию акцент бренда. Один раз на слайд, на главном заголовке */
[data-in="scan"] { position: relative; transition: none; }
[data-in="scan"] .w { transition: opacity 320ms linear, filter 320ms linear, transform 500ms var(--ease); transition-delay: calc(var(--lead) + var(--d, 0) * var(--step) + var(--sd, 0) * 1ms); }
.motion .slide:not(.is-in) [data-in="scan"] .w { opacity: 0; filter: blur(7px); transform: translateX(-.12em); transition: none; }
.scan-beam { position: absolute; z-index: 1; width: 5px; margin-left: -2px; border-radius: 3px; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, transparent, var(--scan, var(--accent)) 12%, var(--scan-hot, #fff) 50%, var(--scan, var(--accent)) 88%, transparent);
  box-shadow: 0 0 22px 6px color-mix(in srgb, var(--scan, var(--accent)) 60%, transparent), 0 0 80px 24px color-mix(in srgb, var(--scan, var(--accent)) 30%, transparent); }
.motion .slide.is-in .scan-beam { animation: deck-scan var(--sdur, 1000ms) linear calc(var(--lead) + var(--d, 0) * var(--step) + var(--sd, 0) * 1ms) both; }
@keyframes deck-scan { 0% { transform: translateX(0); opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } 100% { transform: translateX(var(--lw)); opacity: 0; } }

/* линии SVG рисуются: движок ставит pathLength="1" */
[data-in="draw"] :is(path, line, polyline, polygon, circle, ellipse, rect) { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1800ms var(--ease-io) calc(var(--lead) + var(--d, 0) * var(--step)); }
.motion .slide:not(.is-in) [data-in="draw"] :is(path, line, polyline, polygon, circle, ellipse, rect) { stroke-dashoffset: 1; transition-duration: 0s; }

/* шаги внутри слайда: появляются по стрелке, до перехода на следующий */
[data-step] { transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.motion .slide [data-step]:not(.is-shown) { opacity: 0; transform: translateY(24px); }

/* фоновое движение: медленно и едва заметно */
@keyframes deck-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes deck-spin { to { transform: rotate(360deg); } }
@keyframes deck-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.motion .slide.is-in .float { animation: deck-float 6s var(--ease-io) infinite; }
.motion .slide.is-in .spin-slow { animation: deck-spin 60s linear infinite; }
.motion .slide.is-in .pulse { animation: deck-pulse 3.2s var(--ease-io) infinite; }

/* ── заметки докладчика не видны ── */
.slide .notes, .slide aside.notes { display: none !important; }

/* ── обзор (O) и прокрутка на телефоне: слайды ужимаются zoom'ом ── */
.deck.overview, .deck.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.overview .stage, .scroll .stage { position: static; transform: none; width: auto; height: auto; }
.overview .stage { display: grid; grid-template-columns: repeat(var(--cols, 4), max-content); gap: 20px; justify-content: center; padding: 28px; }
.overview .slide, .scroll .slide { position: relative; visibility: visible; opacity: 1; transform: none; zoom: var(--z, .2); transition: none; }
.overview .slide { cursor: pointer; border-radius: 24px; outline: 6px solid transparent; }
.overview .slide.is-active { outline-color: var(--accent); }
.scroll .stage { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 80px; }

/* ── статика: экспорт, печать, «без анимации» ── */
.static .slide, .static [data-in], .static [data-in] .w, .static [data-step] { transition: none !important; animation: none !important; }
.static .slide mark { transition: none !important; }
.static .float, .static .spin-slow, .static .pulse { animation: none !important; }

/* печать и PDF: каждая сцена — страница 1920×1080 */
@page { size: 1920px 1080px; margin: 0; }
@media print {
  html, body { overflow: visible; height: auto; background: none; }
  .deck { position: static; overflow: visible; }
  .stage { position: static; transform: none; width: 1920px; height: auto; }
  .slide { position: relative; visibility: visible !important; opacity: 1 !important; transform: none !important; break-after: page; page-break-after: always; zoom: 1 !important; }
  .slide [data-in], .slide [data-in] .w, .slide [data-step] { opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
  .slide [data-in="draw"] :is(path, line, polyline, polygon, circle, ellipse, rect) { stroke-dashoffset: 0 !important; }
  .hud, .deck-toast, .deck-menu, .edit-bar, .progress { display: none !important; }
  .slide:last-child { break-after: auto; page-break-after: auto; }
}

/* ── панель управления (вне сцены, не масштабируется) ── */
.hud { position: fixed; z-index: 50; right: 18px; bottom: 16px; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 14px; background: rgba(18, 19, 22, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: #fff; font: 500 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; transition: opacity .35s ease, transform .35s ease; }
.hud.is-idle { opacity: 0; transform: translateY(8px); pointer-events: none; }
.hud button, .hud a { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hud button:hover, .hud a:hover { background: rgba(255, 255, 255, .14); }
.hud .cnt { padding: 0 8px; font-variant-numeric: tabular-nums; opacity: .8; }
.hud svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.progress { position: fixed; z-index: 40; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 0) * 100%); background: var(--accent); transition: width .6s var(--ease); }
.scroll ~ .progress, .overview ~ .progress { display: none; }
.deck-menu { position: fixed; z-index: 60; right: 18px; bottom: 64px; min-width: 280px; padding: 8px; border-radius: 16px; background: rgba(18, 19, 22, .92); backdrop-filter: blur(16px); color: #fff; font: 500 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.deck-menu[hidden] { display: none; }
.deck-menu a, .deck-menu button { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; padding: 11px 14px; border-radius: 10px; }
.deck-menu a:hover, .deck-menu button:hover { background: rgba(255, 255, 255, .12); }
.deck-menu small { display: block; opacity: .6; font-size: 12px; margin-top: 3px; }
.deck-toast { position: fixed; z-index: 70; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: rgba(18, 19, 22, .9); color: #fff; font: 500 14px/1.3 system-ui, sans-serif; transition: opacity .3s; }
.deck-toast[hidden] { display: none; }

/* правка в браузере (E) */
.editing .slide [data-edit] { outline: 2px dashed transparent; outline-offset: 6px; border-radius: 4px; cursor: text; }
.editing .slide [data-edit]:hover { outline-color: rgba(18, 109, 247, .45); }
.editing .slide [data-edit]:focus { outline: 2px solid #126DF7; }
.edit-bar { position: fixed; z-index: 60; left: 50%; top: 14px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 16px; border-radius: 14px; background: #126DF7; color: #fff; font: 500 14px/1 system-ui, sans-serif; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.edit-bar button { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 9px; background: rgba(255, 255, 255, .18); }
.edit-bar button:hover { background: rgba(255, 255, 255, .3); }

@media (hover: none) { .hud.is-idle { opacity: .85; transform: none; pointer-events: auto; } }
