/*
 * passion · web/styles.css
 *
 * Прелоудер: оверлей (.all), кольцо SVG, анимации текста.
 * Цвета: фон #050505 (совпадает с Flutter-темой → нет вспышки),
 * кольцо прогресса — #E3C192 (золото из Flutter TemplateThemePreset.passion).
 */

:root {
  --preloader-bg:   #050505;
  --preloader-fill: #E3C192;
  --preloader-text: #ffffff;
  --preloader-track: rgba(255, 255, 255, 0.12);
  --preloader-backdrop:
    radial-gradient(circle at 50% 38%, rgba(227, 193, 146, 0.10) 0%, rgba(227, 193, 146, 0) 50%),
    linear-gradient(180deg, #050505 0%, #0d0c0b 100%);
}

html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  overflow: hidden;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--preloader-backdrop);
  background-color: var(--preloader-bg);
}

body.ready {
  background: var(--preloader-backdrop);
  background-color: var(--preloader-bg);
  transition: background 0.3s ease;
}

flt-glass-pane, flt-scene-host, flt-scene, canvas[id^="flutter-view"] {
  width: 100vw !important; height: 100vh !important;
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  transform: translateZ(0);
}

/* ── Оверлей ────────────────────────────────────────────────────────────────── */

.all {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background: var(--preloader-backdrop);
  background-color: var(--preloader-bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.4s ease;
  opacity: 1;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.all.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Кольцо + логотип ────────────────────────────────────────────────────────── */

.loading {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  scale: 0;
}

.logo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 170px;
  height: 65.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

#logoFallback {
  position: absolute;
  top: 50%; left: 50%;
  width: 150px;
  height: 50px;
  display: block;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.percent svg {
  position: absolute;
  top: 50%; left: 50%;
  width: 200px; height: 200px;
  transform: translate(-100px, -100px);
}

.percent svg path {
  fill: none;
  stroke-width: 8.5;
  stroke-linecap: round;
}

.percent svg path#preloaderRemainder {
  stroke: var(--preloader-track);
}

.percent svg path#preloaderProgress {
  stroke: var(--preloader-fill);
}

/* ── Otree-лого внизу ────────────────────────────────────────────────────────── */

.logoOtree {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 0);
  padding: 20px;
  opacity: 0;
}

/* ── Текст загрузки ──────────────────────────────────────────────────────────── */

.loadingTextWrap {
  position: fixed;
  top: max(24px, env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  width: min(92vw, 560px);
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  opacity: 0;
}

#loadingText {
  position: static;
  width: 100%;
  color: var(--preloader-text);
  font-size: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: center;
  user-select: none;
  opacity: 0.82;
  letter-spacing: 0.2px;
}

/* ── Анимации ─────────────────────────────────────────────────────────────────── */

.fade-in      { opacity: 1; transition: opacity 0.5s ease-in; }
.fade-inScale {
  opacity: 1; scale: 1;
  transition:
    opacity 0.5s cubic-bezier(0.42, 0.0, 0.58, 1.0),
    scale   0.5s cubic-bezier(0.42, 0.0, 0.58, 1.0);
}

@keyframes slideOutLeft {
  from { transform: translateX(0);     opacity: 1; }
  to   { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.slide-out-left { animation: slideOutLeft 0.5s forwards; }
.slide-in-right { animation: slideInRight 0.5s forwards; }

/* ── SEO / bot-mode ──────────────────────────────────────────────────────────── */

.visually-hidden,
.seo-h1,
.seo-prerender {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.bot-content { display: none; }

.bot-mode .percent,
.bot-mode .logoOtree { display: none !important; }

.bot-mode .loading { opacity: 1 !important; scale: 1 !important; }

.bot-mode #logoFallback { display: block !important; }

.bot-mode #loadingText { color: #111111; }

seo-text, seo-image, seo-widget, seo-widget-container {
  position: absolute !important;
  width: 0 !important; height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: -9999 !important;
}

video {
  pointer-events: none !important;
}

video::-webkit-media-controls,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-overlay-play-button,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-picture-in-picture-button {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Мобильная адаптация ─────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .logo { width: 148px; height: 57px; }

  #logoFallback { width: 130px; height: 44px; }

  .percent svg {
    width: 176px; height: 176px;
    transform: translate(-88px, -88px);
  }

  .logoOtree {
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 8px);
  }

  #loadingText { font-size: 13px; }
}
