/* ==========================================================================
   Prism Hero — баннер с WebGL-призмой и светом
   Все селекторы изолированы внутри .prism-hero и имеют префикс ph-,
   чтобы не конфликтовать со стилями существующего сайта.
   ========================================================================== */

.prism-hero {
  /* --- Настраиваемые переменные --- */
  --ph-white: #f9f9f7;
  --ph-muted: #929292;
  --ph-bg: #030303;
  --ph-font: Arial, Helvetica, sans-serif;
  --ph-height: 100vh;               /* высота баннера; можно задать, напр., calc(100svh - 80px) под шапку сайта */
  --ph-min-height: 700px;           /* десктоп */
  --ph-min-height-short: 620px;     /* низкие экраны (высота ≤ 760px) */
  --ph-min-height-mobile: 780px;    /* мобильные (ширина ≤ 760px) */

  /* --- Служебные переменные, обновляются из JS --- */
  --ph-bg-a: 255,4,48;
  --ph-bg-b: 255,79,14;
  --ph-bg-c: 71,5,158;
  --ph-shift-x: 0px;
  --ph-shift-y: 0px;
  --ph-depth-x: 0px;
  --ph-depth-y: 0px;
  --ph-pulse: 1;
  --ph-rotate: 0deg;
  --ph-opacity: .24;

  position: relative;
  width: 100%;
  height: var(--ph-height);
  min-height: var(--ph-min-height);
  overflow: hidden;
  isolation: isolate;
  color-scheme: dark;
  color: var(--ph-white);
  background: var(--ph-bg);
  font-family: var(--ph-font);
  -webkit-font-smoothing: antialiased;
}
@supports (height: 100svh) {
  .prism-hero { --ph-height: 100svh; }
}

.prism-hero *,
.prism-hero *::before,
.prism-hero *::after { box-sizing: border-box; }
.prism-hero [hidden] { display: none !important; }
.prism-hero button,
.prism-hero a { -webkit-tap-highlight-color: transparent; }
.prism-hero button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; }
.prism-hero button:focus-visible,
.prism-hero a:focus-visible { outline: 2px solid var(--ph-white); outline-offset: 7px; }

/* ---------- Сцена (WebGL / Canvas 2D) ---------- */
.ph-scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -2; image-rendering: auto; filter: blur(.12px); }

/* ---------- Фоновое свечение (CSS-слой под призмой) ---------- */
.ph-aura { position: absolute; inset: -18%; z-index: -4; pointer-events: none; overflow: hidden; transform: translate3d(var(--ph-depth-x),var(--ph-depth-y),0) rotate(var(--ph-rotate)); opacity: var(--ph-opacity); will-change: transform,opacity; }
.ph-aura::before,
.ph-aura::after { content: ""; position: absolute; inset: 0; }
.ph-aura::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--ph-bg-b),.08) 0, rgba(var(--ph-bg-b),.035) 18%, rgba(var(--ph-bg-b),0) 56%),
    radial-gradient(circle at 50% 50%, rgba(var(--ph-bg-a),.04) 0, rgba(var(--ph-bg-a),0) 72%);
  filter: blur(28px);
  opacity: .9;
}
.ph-aura::after { background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.055) 0, rgba(255,255,255,.015) 18%, rgba(255,255,255,0) 42%); filter: blur(70px); opacity: .42; }
.ph-aura__layer { position: absolute; border-radius: 50%; mix-blend-mode: screen; filter: blur(100px); will-change: transform,opacity; }
.ph-aura__layer--one { width: min(68vw,980px); height: min(68vw,980px); left: max(-10vw,-120px); top: max(-8vh,-70px); background: radial-gradient(circle, rgba(var(--ph-bg-a),.055) 0, rgba(var(--ph-bg-a),.028) 28%, rgba(var(--ph-bg-b),.018) 46%, rgba(var(--ph-bg-a),0) 74%); transform: translate3d(calc(var(--ph-shift-x) * -.52), calc(var(--ph-shift-y) * -.52), 0) scale(var(--ph-pulse)); animation: ph-aura-drift-one 12s ease-in-out infinite; }
.ph-aura__layer--two { width: min(60vw,860px); height: min(60vw,860px); right: max(-8vw,-100px); bottom: max(-10vh,-90px); background: radial-gradient(circle, rgba(var(--ph-bg-b),.045) 0, rgba(var(--ph-bg-b),.024) 24%, rgba(var(--ph-bg-c),.018) 48%, rgba(var(--ph-bg-b),0) 75%); transform: translate3d(calc(var(--ph-shift-x) * .62), calc(var(--ph-shift-y) * .58), 0) scale(calc(.98 + (var(--ph-pulse) - 1) * 1.45)); animation: ph-aura-drift-two 13.5s ease-in-out infinite; }
.ph-aura__layer--three { width: min(46vw,640px); height: min(46vw,640px); left: 34%; top: 10%; background: radial-gradient(circle, rgba(var(--ph-bg-c),.040) 0, rgba(var(--ph-bg-c),.022) 32%, rgba(var(--ph-bg-a),.017) 52%, rgba(var(--ph-bg-c),0) 76%); transform: translate3d(calc(var(--ph-shift-x) * .25), calc(var(--ph-shift-y) * -.35), 0) scale(calc(1.02 + (var(--ph-pulse) - 1) * .95)); animation: ph-aura-drift-three 11s ease-in-out infinite; }
.ph-aura__veil { position: absolute; inset: -8%; background: radial-gradient(circle at 50% 42%, rgba(var(--ph-bg-b),.035) 0, rgba(var(--ph-bg-a),.014) 24%, rgba(0,0,0,0) 60%); filter: blur(48px); opacity: .9; transform: translate3d(calc(var(--ph-shift-x) * .18), calc(var(--ph-shift-y) * .18), 0) scale(calc(1.01 + (var(--ph-pulse) - 1) * .5)); }

@keyframes ph-aura-drift-one {
  0%,100% { transform: translate3d(calc(var(--ph-shift-x) * -.52), calc(var(--ph-shift-y) * -.52), 0) scale(var(--ph-pulse)); }
  50% { transform: translate3d(calc(var(--ph-shift-x) * -.35 + 12px), calc(var(--ph-shift-y) * -.65 - 8px), 0) scale(calc(var(--ph-pulse) * 1.04)); }
}
@keyframes ph-aura-drift-two {
  0%,100% { transform: translate3d(calc(var(--ph-shift-x) * .62), calc(var(--ph-shift-y) * .58), 0) scale(calc(.98 + (var(--ph-pulse) - 1) * 1.45)); }
  50% { transform: translate3d(calc(var(--ph-shift-x) * .78 - 10px), calc(var(--ph-shift-y) * .44 + 12px), 0) scale(calc(1.02 + (var(--ph-pulse) - 1) * 1.75)); }
}
@keyframes ph-aura-drift-three {
  0%,100% { transform: translate3d(calc(var(--ph-shift-x) * .25), calc(var(--ph-shift-y) * -.35), 0) scale(calc(1.02 + (var(--ph-pulse) - 1) * .95)); }
  50% { transform: translate3d(calc(var(--ph-shift-x) * .12 - 8px), calc(var(--ph-shift-y) * -.48 + 10px), 0) scale(calc(1.08 + (var(--ph-pulse) - 1) * 1.2)); }
}

.ph-scrim { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg,rgba(0,0,0,.23),transparent 48%); }

/* ---------- Точки-переключатели слайдов ---------- */
.ph-rail { position: absolute; top: 18.5%; left: calc(7.8% - 16px); display: flex; flex-direction: column; z-index: 3; }
.ph-dot { display: flex; align-items: center; justify-content: center; width: 44px; height: 39px; padding: 0; border: 0; background: none; }
.ph-dot span { display: block; width: 6px; height: 6px; background: #747474; transition: width 600ms,height 600ms,background 600ms,box-shadow 600ms; }
.ph-dot:nth-child(1) span,
.ph-dot:nth-child(3) span { width: 8px; height: 8px; }
.ph-dot:hover span { background: #eee; }
.ph-dot[aria-pressed="true"] span { width: 13px; height: 13px; background: white; box-shadow: 0 0 16px #ffffff15; }

/* ---------- Заголовок и текст ---------- */
.ph-hero-copy { position: absolute; left: 13.5%; top: 44%; width: 79%; pointer-events: none; }
.ph-title { margin: 0; font-size: clamp(80px,8.05vw,160px); font-weight: 700; line-height: .98; letter-spacing: -.058em; color: inherit; }
.ph-title.ph-changing { animation: ph-title-in 900ms cubic-bezier(.2,.65,.2,1) both; }
@keyframes ph-title-in {
  0% { opacity: 0; transform: translateY(22px); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.ph-intro { position: absolute; left: 13.5%; top: 66%; width: min(33%,625px); z-index: 2; }
.ph-intro p { margin: 0 0 28px; font-size: clamp(16px,1.25vw,25px); line-height: 1.27; text-transform: uppercase; letter-spacing: -.022em; text-wrap: pretty; }
.ph-more { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 170px; min-height: 46px; padding: 12px 24px; background: rgba(255,255,255,.085); border: 1px solid #494949; font-size: 15px; color: var(--ph-white); text-decoration: none; overflow: hidden; transition: background 300ms,border-color 300ms; }
.ph-more:hover { background: rgba(255,255,255,.16); border-color: #aaa; color: var(--ph-white); }

/* ---------- Управление: счётчик, таймер, стрелки, пауза ---------- */
.ph-transport { position: absolute; bottom: 7%; right: 5.2%; display: flex; align-items: center; gap: 24px; z-index: 3; }
.ph-count { display: flex; gap: 10px; align-items: baseline; font-size: 15px; font-variant-numeric: tabular-nums; }
.ph-count-total,
.ph-slash { color: #777; }
.ph-timer { width: 78px; height: 1px; background: #ffffff24; overflow: hidden; }
.ph-timer-fill { width: 100%; height: 100%; background: #e1e1e1; transform: scaleX(0); transform-origin: left; }
.ph-arrows { display: flex; gap: 8px; }
.ph-arrow,
.ph-pause { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; background: none; border: 1px solid #ffffff29; transition: border-color 250ms,background 250ms; }
.ph-arrow:hover,
.ph-pause:hover { border-color: #ffffffaa; background: #ffffff0d; }
.ph-arrow svg,
.ph-pause svg { width: 20px; height: 20px; }
.ph-pause { border: 0; width: 28px; margin-left: -12px; }
.ph-pause .ph-play-icon { display: none; }
.ph-pause[aria-pressed="true"] .ph-play-icon { display: block; }
.ph-pause[aria-pressed="true"] .ph-pause-icon { display: none; }

/* ---------- Служебное ---------- */
.ph-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ph-render-note { position: absolute; bottom: 15px; left: 20px; margin: 0; max-width: 65%; font-size: 12px; line-height: 1.4; color: #888; }

/* ==========================================================================
   Адаптация
   ========================================================================== */

/* Большие экраны */
@media (min-width: 1800px) {
  .ph-more { width: 202px; min-height: 52px; font-size: 18px; }
  .ph-intro p { margin-bottom: 34px; }
  .ph-dot { height: 46px; }
  .ph-dot[aria-pressed="true"] span { width: 16px; height: 16px; }
}

/* Планшеты / небольшие ноутбуки */
@media (max-width: 1100px) {
  .ph-intro { width: 39%; }
  .ph-intro p { font-size: 16px; }
  .ph-transport { gap: 16px; }
  .ph-timer { width: 50px; }
}

/* Мобильные */
@media (max-width: 760px) {
  .prism-hero { min-height: var(--ph-min-height-mobile); }
  .ph-rail { top: 140px; left: 10px; }
  .ph-dot { height: 38px; }
  .ph-hero-copy { top: 55%; left: 26px; width: calc(100% - 52px); }
  .ph-title { font-size: clamp(39px,10.1vw,76px); letter-spacing: -.052em; }
  .ph-intro { top: 65%; left: 28px; width: calc(100% - 58px); max-width: 440px; }
  .ph-intro p { font-size: 14px; line-height: 1.35; max-width: 355px; margin-bottom: 22px; }
  .ph-more { width: 154px; min-height: 44px; font-size: 14px; }
  .ph-transport { bottom: 28px; right: 25px; gap: 18px; }
  .ph-arrow { width: 40px; height: 40px; }
  .ph-timer { width: 45px; }
  .ph-count { font-size: 14px; }
  .ph-scrim { background: linear-gradient(0deg,#000a,transparent 53%); }
}

/* Низкие экраны (широкие, но невысокие окна) */
@media (max-height: 760px) and (min-width: 761px) {
  .prism-hero { min-height: var(--ph-min-height-short); }
  .ph-intro { top: 65%; width: 42%; }
  .ph-intro p { font-size: 15px; margin-bottom: 20px; }
  .ph-title { font-size: clamp(75px,7.7vw,110px); }
}

@media (prefers-reduced-motion: reduce) {
  .prism-hero *,
  .prism-hero *::before,
  .prism-hero *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
