/*
 * Загрузка до скриптов — один вид для первой загрузки студии (index.html) и
 * приёма фрагмента (import.html), тот же, что карточка загрузки в редакторе
 * (src/ui/EditorBoot.tsx): логотип по центру, под ним карточка с заливкой,
 * бликом, значком загрузки и подписью «этап · 35%» (владелец, 12.10).
 * Цвета — из src/styles/tokens.css.
 */
@font-face {
  font-family: "Google Sans Flex";
  src: url("/fonts/google-sans-flex-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}
@font-face {
  font-family: "Google Sans";
  src: url("/fonts/google-sans-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+2116;
}
.yb {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  /* Не меньше выреза и полоски «Домой» (viewport-fit=cover, аудит 12.10). */
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #1a2026;
  color: #e8e8e8;
  font-family: "Google Sans Flex", "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.yb-logo { font-weight: 700; font-size: 30px; letter-spacing: -0.01em; line-height: 1; }
.yb-logo b { color: #0485f7; font-weight: 700; } /* синий логотипа (владелец, 12.10); логотипу контраст текста не обязателен */
.yb-card {
  position: relative;
  overflow: hidden;
  width: min(360px, 100%);
  box-sizing: border-box;
  border: 1px solid #2e3945;
  border-radius: 10px;
  background: #1c2229;
  padding: 14px 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}
.yb-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  /* Во всю ширину и сдвинута влево на недостающую долю: едет transform, а не
     ширина (аудит 12.10). Карточка обрезает лишнее. */
  width: 100%;
  transform: translateX(-97%);
  overflow: hidden;
  background: rgba(4, 133, 247, 0.25);
  box-shadow: inset -2px 0 0 rgba(4, 133, 247, 0.7);
  transition: transform var(--dur-slow, 300ms) var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1));
}
.yb-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + 160px);
  background: repeating-linear-gradient(90deg, transparent 0, transparent 50px, rgba(255, 255, 255, 0.14) 80px, transparent 110px, transparent 160px);
  animation: yb-sweep var(--dur-sweep, 1.5s) linear infinite;
  will-change: transform;
}
/* Без процента (первая загрузка): заливка во всю ширину, бегут только полосы. */
.yb-fill.yb-indeterminate { transform: none; background: rgba(4, 133, 247, 0.12); box-shadow: none; }
@keyframes yb-sweep {
  from { transform: translate3d(-160px, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
.yb-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}
.yb-spin {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid rgba(232, 232, 232, 0.25);
  border-top-color: #e8e8e8;
  border-radius: 50%;
  animation: yb-spin var(--dur-spin, 0.8s) linear infinite;
}
@keyframes yb-spin { to { transform: rotate(360deg); } }
.yb-detail { min-height: 18px; font-size: 13px; color: #bdc8d3; text-align: center; }
.yb.yb-err .yb-spin, .yb.yb-err .yb-fill { display: none; }
.yb.yb-err .yb-row { color: #ff9a9a; }
@media (prefers-reduced-motion: reduce) {
  .yb-fill::after, .yb-spin { animation: none; }
}

/*
 * Ничего не прыгает (владелец, 12.10): процент — в своём месте постоянной
 * ширины, подпись не сдвигает значок при смене цифр; строка под карточкой
 * всегда занимает свою высоту, появится в ней текст или нет.
 */
.yb-label { white-space: nowrap; }
.yb-row { height: 20px; line-height: 20px; }
.yb-pct { display: inline-block; min-width: 3.4em; text-align: left; white-space: nowrap; }
.yb-detail { height: 36px; display: flex; align-items: flex-start; justify-content: center; }
.yb-detail button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #bdc8d3;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.yb-detail button:hover { background: #2a333d; color: #e8e8e8; }
/* Редактор готов — карточка растворяется поверх него. Длительность и кривая —
   токены движения (src/styles/tokens.css), до их загрузки — те же запасные. */
.yb { transition: opacity var(--dur-slow, 300ms) var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)); }
.yb.yb-out { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .yb, .yb-fill { transition: none; } .yb-veil.yb-from-boot::before { animation: none; } }

/* Пришли со страницы приёма (?import=, public/boot.js): та же полоса с 72 %. */
.yb-for-import { display: none; }
.yb-import .yb-for-start { display: none; }
.yb-import .yb-for-import { display: inline-block; }
.yb-import .yb-fill.yb-indeterminate { transform: translateX(-28%); background: rgba(4, 133, 247, 0.25); box-shadow: inset -2px 0 0 rgba(4, 133, 247, 0.7); transition: none; }

/*
 * Та же карточка поверх очертаний редактора (src/ui/EditorBoot.tsx, аудит
 * 12.10): логотип и карточка остаются ровно на своём месте, а сплошной фон
 * первой загрузки плавно редеет до размытия — один вид от первого кадра до
 * готового редактора, без пустого кадра и без второй карточки.
 */
.yb.yb-veil {
  isolation: isolate;
  background: transparent;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.yb-veil::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #1a2026;
  opacity: 0.4;
}
.yb-veil.yb-from-boot::before { animation: yb-thin var(--dur-slow, 300ms) var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)); }
@keyframes yb-thin {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

/* Открываем проект (/p/<id>, ?project=, ?clip=; public/boot.js): 0 %, дальше только вперёд. */
.yb-for-open { display: none; }
.yb-open .yb-for-start { display: none; }
.yb-open .yb-for-open { display: inline-block; }
.yb-open .yb-fill.yb-indeterminate { transform: translateX(-98%); background: rgba(4, 133, 247, 0.25); box-shadow: inset -2px 0 0 rgba(4, 133, 247, 0.7); transition: none; }

/* «К проектам» под карточкой: зона нажатия 44 px, а строка своей высоты (ревью, 13.10). */
.yb-detail button { position: relative; }
.yb-detail button::before { content: ""; position: absolute; inset: -6px -4px; }

/*
 * Что умеет студия (09.11, владелец открыл главную для поиска): видимый текст в
 * HTML до скриптов, для робота без JS и для человека на медленной загрузке.
 * Внизу, вне потока .yb: логотип и карточка не сдвигаются. Проявляется не сразу,
 * чтобы на быстрой загрузке не мелькал. React заменяет #root целиком, блок уходит.
 */
.yb-about {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(560px, calc(100% - 32px));
  color: #8b97a4;
  font-family: "Google Sans Flex", "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  animation: yb-about-in var(--dur-slow, 300ms) var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)) 900ms forwards;
}
.yb-about h1 { margin: 0 0 4px; color: #bdc8d3; font-size: 14px; font-weight: 600; }
.yb-about p { margin: 0 0 8px; }
.yb-about ul { margin: 0; padding-left: 18px; }
.yb-about li + li { margin-top: 2px; }
@keyframes yb-about-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .yb-about { animation: none; opacity: 1; } }
/* Проект и приём фрагмента открываются не с главной; на низком экране блок наехал бы на карточку. */
.yb-open .yb-about, .yb-import .yb-about { display: none; }
@media (max-height: 640px) { .yb-about { display: none; } }
.yb-about p.yb-about-more { margin: 8px 0 0; }
.yb-about a { color: #bdc8d3; text-decoration: underline; text-underline-offset: 2px; }
.yb-about a:hover { color: #e8e8e8; }
