/* Allezroma Landing — сцены сервисов (инкремент 02).
 * Одна услуга = одна полноширинная сцена с собственным интерактивным фоном
 * (canvas из js/scenes.js) и скриншотом продукта в 3D-рамке.
 * Токены — css/tokens.css; фирменные диапазоны сервисов — только внутри
 * своих сцен (Дизайн.md §2, §6). */

/* ============ Каркас сцены ============ */

.scene {
  --a1: var(--meta);
  --a2: var(--accent);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}
.scene[data-accent="wt"]    { --a1: var(--svc-wt-1);    --a2: var(--svc-wt-2); }
.scene[data-accent="poll"]  { --a1: var(--svc-poll-1);  --a2: var(--svc-poll-2); }
.scene[data-accent="thera"] { --a1: var(--svc-thera-1); --a2: var(--svc-thera-2); }
.scene[data-accent="orga"]  { --a1: var(--svc-orga-1);  --a2: var(--svc-orga-2); }
.scene[data-accent="bots"]  { --a1: var(--svc-bots-1);  --a2: var(--svc-bots-2); }

.scene + .scene { border-top: 1px solid var(--border-soft); }

/* Слои фона: атмосферная подложка (видна и без JS) → canvas → scrim читаемости */
.scene-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.scene[data-accent="wt"] .scene-base {
  background:
    radial-gradient(760px 460px at 78% 26%, rgba(59, 109, 255, 0.14), transparent 65%),
    radial-gradient(560px 420px at 12% 88%, rgba(95, 208, 255, 0.07), transparent 60%);
}
.scene[data-accent="poll"] .scene-base {
  background:
    radial-gradient(720px 440px at 18% 24%, rgba(201, 139, 255, 0.13), transparent 65%),
    radial-gradient(620px 420px at 86% 82%, rgba(255, 95, 174, 0.08), transparent 62%);
}
.scene[data-accent="thera"] .scene-base {
  background:
    radial-gradient(700px 440px at 76% 18%, rgba(95, 224, 196, 0.10), transparent 64%),
    radial-gradient(540px 400px at 20% 92%, rgba(43, 182, 163, 0.07), transparent 60%);
}
.scene[data-accent="orga"] .scene-base {
  background:
    radial-gradient(720px 440px at 20% 28%, rgba(139, 92, 246, 0.14), transparent 65%),
    radial-gradient(600px 420px at 84% 86%, rgba(99, 102, 241, 0.09), transparent 62%);
}
.scene[data-accent="bots"] .scene-base {
  background:
    radial-gradient(760px 500px at 50% 112%, rgba(255, 122, 69, 0.12), transparent 68%),
    radial-gradient(560px 380px at 82% 12%, rgba(255, 194, 95, 0.08), transparent 60%);
}

/* Scrim: затемнение под текстовой колонкой, чтобы контраст не зависел от фона */
.scene-bg::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(11, 16, 32, 0.92) 0%,
    rgba(11, 16, 32, 0.62) 36%,
    rgba(11, 16, 32, 0) 66%);
}
.scene--flip .scene-bg::after {
  background: linear-gradient(270deg,
    rgba(11, 16, 32, 0.92) 0%,
    rgba(11, 16, 32, 0.62) 36%,
    rgba(11, 16, 32, 0) 66%);
}

/* ============ Сетка сцены ============ */

.scene-inner {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(68px, 10vh, 124px) clamp(var(--container-gutter-phone), 4vw, var(--container-gutter-desktop));
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: center;
}
.scene--flip .scene-inner { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.scene--flip .scene-copy { order: 2; }
.scene--flip .scene-stage { order: 1; }

/* ============ Текстовая колонка ============ */

.scene-eyebrow {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--a1);
  margin-bottom: var(--space-5);
}
.scene[data-accent="orga"] .scene-eyebrow { color: color-mix(in oklab, var(--svc-orga-1), white 32%); }
.scene-eyebrow svg { flex-shrink: 0; }
.scene-domain { color: var(--muted); }
.scene-domain::before { content: "·"; margin-right: 10px; color: var(--muted); opacity: .7; }

.scene-title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(38px, 4.4vw, 58px);
  line-height: 1.04; letter-spacing: -0.02em;
  color: var(--fg);
}
.scene-lead {
  margin: 0 0 var(--space-6);
  color: var(--fg-2);
  font-size: clamp(16.5px, 1.25vw, 18px);
  line-height: 1.66;
  max-width: 46ch;
}

.scene-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 28px; }
.scene-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--fg-2);
  padding: 6px 13px; border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--a1) 9%, transparent);
  border: 1px solid color-mix(in oklab, var(--a1) 22%, transparent);
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.scene-chip .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  flex-shrink: 0;
}
.scene:hover .scene-chip { background: color-mix(in oklab, var(--a1) 14%, transparent); color: var(--fg); }

.scene-actions { display: flex; align-items: center; gap: var(--space-4); }
.scene-cta { min-width: 0; }
.scene-cta .cta-arrow { color: var(--muted); transition: color var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard); }
.scene-cta:hover { border-color: color-mix(in oklab, var(--a2) 45%, var(--border)); }
.scene-cta:hover .cta-arrow { color: var(--a1); transform: translateX(3px); }
.scene-cta:focus-visible { box-shadow: var(--focus-ring); }

/* ============ Сцена сцены: 3D-рамка скриншота ============ */

.scene-stage { position: relative; perspective: 1400px; min-width: 0; }

.shot-tilt {
  position: relative;
  transform: translate3d(0, calc((0.5 - var(--sp, 0.5)) * 44px), 0);
  will-change: transform;
}

.shot-frame {
  --tilt-y: -7deg;
  --tilt-x: 2.5deg;
  --tilt-z: -0.6deg;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--a2) 30%, var(--border));
  box-shadow:
    0 34px 90px -26px rgba(3, 6, 18, 0.85),
    0 26px 90px -34px color-mix(in oklab, var(--a1) 30%, transparent);
  transform: rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) rotateZ(var(--tilt-z));
  transition: transform var(--motion-base) var(--ease-standard),
              border-color var(--motion-base) var(--ease-standard),
              box-shadow var(--motion-base) var(--ease-standard);
}
.scene--flip .shot-frame { --tilt-y: 7deg; --tilt-z: 0.6deg; }
.shot-frame:hover {
  transform: rotateY(calc(var(--tilt-y) * 0.4)) rotateX(calc(var(--tilt-x) * 0.35)) rotateZ(var(--tilt-z)) translateY(-4px);
  border-color: color-mix(in oklab, var(--a2) 55%, var(--border));
}
.shot-frame:focus-visible { box-shadow: var(--focus-ring), 0 34px 90px -26px rgba(3, 6, 18, 0.85); outline: none; }

.shot-chrome {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 14px;
  background: color-mix(in oklab, var(--surface-warm) 72%, var(--surface));
  border-bottom: 1px solid var(--border-soft);
}
.shot-dots { display: inline-flex; gap: 6px; }
.shot-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}
.shot-url {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; color: var(--muted);
  padding: 3px 12px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}

.shot-img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 10; object-fit: cover;
  background: var(--surface-warm);
}

/* Отражение-свечение под рамкой — глубина сцены */
.shot-tilt::after {
  content: "";
  position: absolute; left: 10%; right: 10%; bottom: -26px; height: 40px;
  background: radial-gradient(50% 100% at 50% 0%, color-mix(in oklab, var(--a1) 22%, transparent), transparent 72%);
  filter: blur(6px);
  pointer-events: none;
}

/* Плавающие чипы задач (сцена Orga) — второй слой параллакса */
.float-chip {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12.5px; color: var(--fg-2);
  box-shadow: 0 14px 40px -14px rgba(3, 6, 18, 0.8);
  transform: translate3d(0, calc((0.5 - var(--sp, 0.5)) * 84px), 0);
  pointer-events: none;
}
.float-chip .status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.float-chip--ok .status-dot { background: var(--success); box-shadow: 0 0 10px color-mix(in oklab, var(--success) 60%, transparent); }
.float-chip--warn .status-dot { background: var(--warn); box-shadow: 0 0 10px color-mix(in oklab, var(--warn) 60%, transparent); }
.float-chip--1 { top: -20px; right: -18px; }
.float-chip--2 { bottom: 14%; left: -34px; }

/* ============ Лента ботов ============ */

.bots-field {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  align-content: center;
  min-width: 0;
}
.bot-tile {
  display: inline-flex; align-items: center; gap: 11px;
  min-height: 52px; padding: 12px 16px;
  background: color-mix(in oklab, var(--surface) 86%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg-2); font-size: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard),
              color var(--motion-fast) var(--ease-standard);
}
.bot-tile .bot-icon { font-size: 19px; line-height: 1; }
.bot-tile .bot-name { font-weight: 600; }
.bot-tile .bot-arrow { color: var(--muted); flex-shrink: 0; transition: color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard); }
.bot-tile:hover {
  border-color: color-mix(in oklab, var(--a1) 55%, var(--border));
  background: color-mix(in oklab, var(--surface) 96%, transparent);
  color: var(--fg);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -18px rgba(3, 6, 18, 0.9);
}
.bot-tile:hover .bot-arrow { color: var(--a1); transform: translate(1px, -1px); }
.bot-tile:focus-visible { box-shadow: var(--focus-ring); }

/* ============ Адаптив ============ */

@media (max-width: 1024px) {
  .scene-inner,
  .scene--flip .scene-inner { grid-template-columns: 1fr; gap: var(--space-8); }
  .scene--flip .scene-copy { order: 0; }
  .scene--flip .scene-stage { order: 0; }
  .scene-stage { max-width: 720px; }
  .scene-bg::after,
  .scene--flip .scene-bg::after {
    background: linear-gradient(180deg,
      rgba(11, 16, 32, 0.72) 0%,
      rgba(11, 16, 32, 0.34) 30%,
      rgba(11, 16, 32, 0) 55%,
      rgba(11, 16, 32, 0.42) 100%);
  }
  .float-chip--2 { left: -10px; }
}

@media (max-width: 768px) {
  .scene-title { font-size: clamp(34px, 9vw, 44px); }
  .scene-lead { font-size: 16.5px; }
  .float-chip { display: none; }
  .shot-frame { border-radius: 12px; }
  .shot-chrome { height: 32px; }
}

@media (max-width: 560px) {
  .scene-inner { padding-top: var(--section-y-phone); padding-bottom: var(--section-y-phone); }
  .shot-frame { --tilt-y: 0deg; --tilt-x: 0deg; --tilt-z: 0deg; }
  .shot-frame:hover { transform: none; }
  .shot-tilt::after { display: none; }
  .scene-actions .btn { width: 100%; }
  .bots-field { gap: var(--space-2); }
  .bot-tile { min-height: 48px; padding: 10px 13px; font-size: 13.5px; }
}

/* ============ Reduced motion / no-JS ============ */

@media (prefers-reduced-motion: reduce) {
  .shot-tilt, .float-chip { transform: none; }
  .shot-frame { transition: none; }
  .shot-frame:hover {
    transform: rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) rotateZ(var(--tilt-z));
  }
  .scene-cta .cta-arrow, .bot-tile .bot-arrow { transition: none; }
  .bot-tile:hover { transform: none; }
}

.no-js .shot-tilt { transform: none; }
.no-js .float-chip { transform: none; }
