:root {
  --gold: #e9bd77;
  --gold-2: #ffdca0;
  --wine: #6e0f18;
  --text: #f5e9d8;
  --text-dim: rgba(245, 233, 216, .62);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: #070302;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  overscroll-behavior: none;
}

body { position: relative; }

/* ---- background layers ---- */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.haze {
  position: fixed;
  inset: -10%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(42% 34% at 50% 68%, rgba(233, 189, 119, .26), transparent 72%),
    radial-gradient(40% 30% at 85% 20%, rgba(110, 15, 24, .32), transparent 70%),
    radial-gradient(40% 30% at 12% 18%, rgba(110, 15, 24, .28), transparent 70%);
  filter: blur(8px);
  animation: drift 7s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: .9; }
  50%  { transform: translate3d(-1%, -1%, 0) scale(1.03); opacity: 1; }
  100% { transform: translate3d(1%, 0, 0) scale(1.01); opacity: .92; }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 58%, transparent 38%, rgba(4, 1, 1, .6) 82%, rgba(2, 0, 0, .95) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(60% 50% at 50% 55%, rgba(255, 220, 160, .9), rgba(255, 180, 90, .2) 55%, transparent 78%);
  opacity: 0;
}

/* ---- preloader ---- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #070302;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity .7s ease, visibility .7s ease;
}

#loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-icon {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* outer rotating ring */
.loader-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--gold);
  border-right-color: rgba(233, 189, 119, .3);
  animation: loaderSpin 1.1s linear infinite;
}

/* inner pulsing glow */
.loader-icon::after {
  content: '✦';
  font-size: 16px;
  color: var(--gold-2);
  text-shadow: 0 0 12px rgba(255, 190, 110, .8), 0 0 28px rgba(233, 189, 119, .5);
  animation: loaderPulse 1.6s ease-in-out infinite;
}

@keyframes loaderSpin {
  to { transform: rotate(360deg); }
}

@keyframes loaderPulse {
  0%, 100% { opacity: .5; transform: scale(.85); }
  50%       { opacity: 1;  transform: scale(1.1);  }
}

.loader-text {
  font-size: 10px;
  letter-spacing: .45em;
  text-transform: uppercase;
  color: rgba(245, 233, 216, .3);
}

/* ---- decorative frame ---- */

.frame {
  position: fixed;
  inset: 14px;
  z-index: 6;
  pointer-events: none;
  border: 1px solid rgba(233, 189, 119, .35);
}

.frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(233, 189, 119, .16);
}

.frame i {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.frame i.tl { top: -5px;    left: -5px;  }
.frame i.tr { top: -5px;    right: -5px; }
.frame i.bl { bottom: -5px; left: -5px;  }
.frame i.br { bottom: -5px; right: -5px; }

/* ---- scroll scaffolding ---- */

.scenes {
  position: relative;
  z-index: 5;
  height: 420vh;
}

.pin {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 8vw;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

#panelStage1 { z-index: 1; }
#panelStage2 { z-index: 2; transform: scale(.45); }
#panelStage3 { z-index: 3; transform: scale(.45); }

/* ---- text elements ---- */

.eyebrow {
  font-size: 11.5px;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before,
.eyebrow::after {
  content: '';
  width: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.eyebrow::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.headline {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(42px, 12.5vw, 100px);
  line-height: .9;
  letter-spacing: .01em;
  color: var(--gold-2);
  margin: 0;
  white-space: nowrap;
  text-shadow: 0 0 20px rgba(255, 190, 110, .55), 0 0 50px rgba(233, 189, 119, .35);
}

.headline .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(26px);
}

.subhead {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(19px, 5.4vw, 27px);
  letter-spacing: .08em;
  color: var(--text);
  margin: 10px 0 30px 0;
  opacity: 0;
}

.bullets {
  list-style: none;
  margin: 0 0 26px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bullets li {
  font-family: 'Playfair Display', serif;
  font-size: clamp(18px, 5vw, 22px);
  color: var(--gold-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(14px);
  /* тёмная pill — читаемость поверх свечей */
  background: rgba(4, 1, 1, .52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 7px 20px 7px 16px;
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
}

.bullets .spark {
  color: var(--gold);
  font-size: .85em;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 220px;
  max-width: 60vw;
  margin: 6px 0 24px;
  opacity: 0;
}

.divider span:not(.dot) {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 189, 119, .5), transparent);
}

.divider .dot {
  color: var(--gold);
  font-size: 14px;
}

.tagline {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(17px, 4.6vw, 21px);
  line-height: 1.4;
  color: var(--text-dim);
  max-width: 20ch;
  opacity: 0;
}

.stage2-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1.35;
  color: var(--gold-2);
  max-width: 14ch;
  text-shadow: 0 0 24px rgba(255, 180, 90, .4);
}

.stage2-eyebrow { margin-bottom: 22px; }

.stage3-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(20px, 6vw, 26px);
  line-height: 1.4;
  color: var(--text);
  max-width: 17ch;
  margin-bottom: 34px;
}

/* ---- CTA button (inline in panel 3) ---- */

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 17px 30px;
  border-radius: 999px;
  border: 1px solid rgba(233, 189, 119, .4);
  background: rgba(20, 8, 6, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-2);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.cta .ring {
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  padding: 1px;
  background: linear-gradient(120deg, var(--gold), var(--wine), var(--gold-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .9;
}

.cta .glow {
  position: absolute;
  inset: -18px;
  border-radius: 999px;
  background: radial-gradient(closest-side, rgba(233, 189, 119, .4), transparent 72%);
  z-index: -1;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .5; transform: scale(.96); }
  50%       { opacity: 1;  transform: scale(1.08); }
}

.cta-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.cta:active { transform: scale(.94); }

.footnote {
  margin-top: 18px;
  font-size: 10.5px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: rgba(245, 233, 216, .36);
}

/* ---- scroll hint ---- */

.hint {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(245, 233, 216, .4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hint .arrow {
  font-size: 16px;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0);   opacity: .5; }
  50%       { transform: translateY(6px); opacity: 1;  }
}

/* ---- no-webgl fallback (статичная версия) ---- */

.no-webgl #bg { display: none; }

.no-webgl body {
  background:
    radial-gradient(ellipse 80% 60% at 50% 70%, rgba(110, 15, 24, .35), transparent 70%),
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(110, 15, 24, .2), transparent 60%),
    #070302;
}

.no-webgl .scenes { height: auto; }

.no-webgl .pin {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.no-webgl .panel {
  position: relative;
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  pointer-events: auto !important;
  min-height: 100dvh;
  padding-top: calc(env(safe-area-inset-top) + 60px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 100px);
}

/* убираем дублирующую inline-кнопку на fallback — хватит sticky */
.no-webgl #panelStage3 .cta { display: none; }
.no-webgl #panelStage3 .footnote { display: none; }

/* ---- prefers-reduced-motion ---- */

@media (prefers-reduced-motion: reduce) {
  .haze,
  .hint .arrow,
  .cta .glow,
  .sticky-cta .glow,
  .sticky-cta .ring,
  .loader-icon::before,
  .loader-icon::after {
    animation: none !important;
  }
  .panel {
    will-change: auto;
  }
  /* панели сразу видны без scale-transition */
  #panelStage1 { opacity: 1 !important; transform: none !important; }
}

/* ---- tap ripple ---- */

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 220, 160, .5);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: rip .6s ease-out forwards;
}

@keyframes rip { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* ---- sticky CTA (always visible, bottom of screen) ---- */

.sticky-cta-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  /* tall fade so the button sits in a pool of darkness */
  background: linear-gradient(
    to top,
    rgba(5, 2, 1, .96) 0%,
    rgba(7, 3, 2, .80) 44%,
    rgba(7, 3, 2, .30) 72%,
    transparent 100%
  );
  padding: 32px 24px 0;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  pointer-events: none;
  /* slide-up on load */
  transform: translateY(100%);
  opacity: 0;
}

.sticky-cta-wrap.is-visible {
  /* JS adds this class */
  transform: translateY(0);
  opacity: 1;
  transition: transform .65s cubic-bezier(.22, 1, .36, 1), opacity .5s ease;
}

/* subtle top separator line */
.sticky-cta-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 189, 119, .18), transparent);
}

.sticky-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 16px 32px;
  border-radius: 999px;
  /* no border — ring pseudo handles it */
  border: none;
  background: rgba(12, 5, 3, .68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--gold-2);
  font-family: 'Inter', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  /* shimmer ring animation */
  --ring-angle: 120deg;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow:
    0 0 0 1px rgba(233, 189, 119, .28),
    0 8px 32px rgba(0, 0, 0, .55),
    0 0 28px rgba(233, 189, 119, .08);
}

/* animated gradient ring */
.sticky-cta .ring {
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  padding: 1.5px;
  background: linear-gradient(var(--ring-angle), var(--gold), var(--wine) 42%, var(--gold-2) 68%, var(--gold));
  background-size: 200% 200%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .95;
  animation: ringShimmer 3.5s linear infinite;
}

@keyframes ringShimmer {
  0%   { background-position: 0% 50%;   }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%;   }
}

/* large soft glow beneath the pill */
.sticky-cta .glow {
  position: absolute;
  inset: -22px -16px;
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 70%, rgba(233, 189, 119, .28) 0%, transparent 68%);
  z-index: -1;
  animation: pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

.sticky-cta:active {
  transform: scale(.92);
  box-shadow:
    0 0 0 1px rgba(233, 189, 119, .5),
    0 4px 16px rgba(0, 0, 0, .4),
    0 0 36px rgba(233, 189, 119, .18);
}

/* tiny legal line under the button */
.sticky-footnote {
  margin-top: 9px;
  font-size: 9.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(245, 233, 216, .25);
  pointer-events: none;
}
