/* ——— Главная: анимации и parallax ——— */

.hero__particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero__particles::before,
.hero__particles::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: float-glow 8s ease-in-out infinite alternate;
}

.hero__particles::before {
  width: 320px;
  height: 320px;
  background: rgba(212, 175, 55, 0.25);
  top: 10%;
  left: 5%;
}

.hero__particles::after {
  width: 240px;
  height: 240px;
  background: rgba(65, 90, 119, 0.4);
  bottom: 15%;
  right: 10%;
  animation-delay: -4s;
}

.hero__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    520px circle at var(--mouse-x, 50%) var(--mouse-y, 40%),
    rgba(212, 175, 55, 0.07),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hero--lawyer:hover .hero__glow {
  opacity: 1;
}

.hero__bg {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.hero__photo {
  will-change: transform;
}

.hero__photo-inner {
  position: relative;
  width: 100%;
  animation: float-photo 6s ease-in-out infinite;
}

.hero__photo-inner .hero__badge {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .hero__photo-inner { animation: none; }
}

.hero__badge {
  animation: pulse-badge 2.5s ease-in-out infinite;
}

/* Без JS контент виден */
.page-home:not(.js-ready) .reveal,
.page-home:not(.js-ready) .anim-item {
  opacity: 1;
  transform: none;
}

/* Hero entrance */
.page-home.js-ready .anim-item {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-home.js-ready .anim-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.page-home.js-ready .hero__photo.anim-item {
  transform: translateY(36px) scale(0.97);
}

.page-home.js-ready .hero__photo.anim-item.is-visible {
  transform: translateY(0) scale(1);
}

.hero__photo-inner {
  will-change: transform;
}

/* Reveal (только после инициализации JS) */
.page-home.js-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.page-home.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--scale {
  transform: translateY(24px) scale(0.95);
}

.reveal--scale.is-visible {
  transform: translateY(0) scale(1);
}

.reveal--left {
  transform: translateX(-28px);
}

.reveal--left.is-visible {
  transform: translateX(0);
}

.reveal--right {
  transform: translateX(28px);
}

.reveal--right.is-visible {
  transform: translateX(0);
}

.reveal--blur {
  transform: translateY(24px);
  filter: blur(8px);
}

.reveal--blur.is-visible {
  transform: translateY(0);
  filter: blur(0);
}

/* Секции при появлении в viewport */
.page-home.js-ready [data-scroll-section],
.page-home.js-ready .cta {
  opacity: 0.92;
  transform: translateY(24px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-home.js-ready [data-scroll-section].section-in-view,
.page-home.js-ready .cta.section-in-view {
  opacity: 1;
  transform: translateY(0);
}

.page-home.js-ready .section-in-view .section__title--underline::after {
  animation: line-grow-scroll 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

@keyframes line-grow-scroll {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Parallax backgrounds */
.section--parallax-bg::before {
  transform: translate3d(0, var(--parallax-bg-y, 0), 0);
  will-change: transform;
}

/* Stats */
.stat.reveal {
  transform: translateY(20px);
}

.stat.reveal.is-visible .stat__icon {
  animation: icon-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

/* Urgency cards stagger hover boost */
.urgency-card.reveal.is-visible {
  animation: none;
}

.urgency-card.reveal.is-visible:hover {
  transform: translateY(-6px);
}

/* Section title line draw */
.page-home .section__title--underline::after {
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}

.page-home .section__header.reveal.is-visible .section__title--underline::after,
.page-home .reveal.is-visible > .section__title--underline::after {
  transform: scaleX(1);
}

/* Keyframes */
@keyframes float-glow {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(24px, -18px) scale(1.08); }
}

@keyframes float-photo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 8px 24px rgba(212, 175, 55, 0.35); }
  50% { box-shadow: 0 8px 32px rgba(212, 175, 55, 0.55); transform: scale(1.03); }
}

@keyframes icon-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes line-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ——— Дополнительные эффекты ——— */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 10002;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold));
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
  transition: width 0.08s linear;
}

.fx-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.5);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
  animation: particle-float linear infinite;
  opacity: 0;
}

.hero__scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.015) 2px,
    rgba(255, 255, 255, 0.015) 4px
  );
  opacity: 0.4;
}

.hero--lawyer .hero__bg {
  animation: hero-bg-breathe 18s ease-in-out infinite alternate;
}

@keyframes hero-bg-breathe {
  from { filter: brightness(0.95) saturate(1); }
  to { filter: brightness(1.05) saturate(1.1); }
}

.hero__title--shine {
  background: linear-gradient(
    120deg,
    var(--white) 0%,
    var(--gold-light) 40%,
    var(--white) 60%,
    var(--gold) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine-text 6s linear infinite;
}

.hero__photo-inner--glow {
  position: relative;
}

.hero__photo-inner--glow img {
  position: relative;
  z-index: 1;
}

.hero__photo-inner--glow .hero__badge {
  z-index: 2;
}

/* 3D tilt cards */
[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

[data-tilt].is-tilting {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateY(-6px) scale(1.02);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
}

.fx-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.5), transparent 50%, rgba(212, 175, 55, 0.2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.fx-card:hover::before,
.fx-card.is-tilting::before {
  opacity: 1;
}

.urgency-card.fx-card { position: relative; overflow: hidden; }

.urgency-card.fx-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: rotate(25deg);
  animation: card-sheen 5s ease-in-out infinite;
}

/* Кнопки */
.btn--fx {
  position: relative;
  overflow: hidden;
}

.btn--fx::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: btn-shine 3.5s ease-in-out infinite;
}

.btn-ripple {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: ripple-out 0.7s ease-out forwards;
  pointer-events: none;
}

/* Секции — плавающие символы */
.section--fx {
  position: relative;
  overflow: hidden;
}

.section-floater {
  position: absolute;
  font-size: clamp(2rem, 5vw, 4rem);
  color: rgba(212, 175, 55, 0.04);
  pointer-events: none;
  animation: floater-drift linear infinite;
  user-select: none;
}

/* Статистика — свечение */
.stat.reveal.is-visible {
  animation: stat-glow 2s ease-in-out 0.5s 1;
}

.stat.reveal.is-visible .stat__value {
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.25);
}

/* FAQ */
.page-home .faq-item.reveal.is-visible {
  animation: faq-slide-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-home .faq-item.open .faq-item__answer p {
  animation: faq-fade-in 0.4s ease;
}

/* Форма — пульсирующая рамка */
.form-card--elevated {
  animation: form-border-pulse 4s ease-in-out infinite;
}

/* CTA */
.cta--bg .btn--gold.reveal.is-visible {
  animation: cta-pulse 2.5s ease-in-out infinite 0.5s;
}

/* Разделители секций */
.page-home .section--dark,
.page-home .section--panel {
  position: relative;
}

.page-home .section--dark::after,
.page-home .section--panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: min(200px, 40%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
}

.page-home .section--dark.section-in-view::after,
.page-home .section--panel.section-in-view::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 0.45;
}

/* Keyframes extra */
@keyframes particle-float {
  0% { opacity: 0; transform: translateY(20px) scale(0.5); }
  15% { opacity: 0.8; }
  85% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-120px) scale(1); }
}

@keyframes shine-text {
  to { background-position: 200% center; }
}

@keyframes card-sheen {
  0%, 100% { left: -60%; }
  50% { left: 120%; }
}

@keyframes btn-shine {
  0%, 100% { left: -120%; }
  50% { left: 140%; }
}

@keyframes ripple-out {
  to { transform: scale(28); opacity: 0; }
}

@keyframes floater-drift {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(20px, -30px) rotate(8deg); }
  100% { transform: translate(-10px, -60px) rotate(-5deg); }
}

@keyframes stat-glow {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.06); }
}

@keyframes faq-slide-in {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes faq-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes form-border-pulse {
  0%, 100% { box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 24px rgba(212, 175, 55, 0.15); }
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25); }
  50% { box-shadow: 0 12px 40px rgba(212, 175, 55, 0.45); transform: translateY(-2px); }
}

@media (max-width: 768px) {
  .hero__photo-inner { animation: none; }

  .hero__title--shine {
    -webkit-text-fill-color: var(--white);
    background: none;
    animation: none;
  }

  .page-home.js-ready [data-scroll-section],
  .page-home.js-ready .cta {
    opacity: 1;
    transform: none;
    transition: none;
  }

  [data-tilt].is-tilting,
  [data-tilt]:hover {
    transform: none !important;
    box-shadow: none;
  }

  .urgency-card.reveal.is-visible:hover,
  .service-card--law.reveal.is-visible:hover {
    transform: none;
  }

  .section-floater { display: none; }

  .form-card--elevated,
  .cta--bg .btn--gold.reveal.is-visible {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress,
  .fx-particle,
  .section-floater,
  .hero__scanline { display: none !important; }

  .hero__title--shine {
    -webkit-text-fill-color: var(--white);
    background: none;
    animation: none;
  }

  .hero__particles::before,
  .hero__particles::after,
  .hero__badge,
  .hero__photo-inner {
    animation: none !important;
  }

  .anim-item,
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .hero__bg,
  .hero__photo,
  [data-parallax],
  [data-parallax-float] {
    transform: none !important;
    animation: none !important;
    filter: none !important;
  }

  .section--parallax-bg::before {
    transform: none !important;
  }

  [data-tilt].is-tilting { transform: none !important; }

  .btn--fx::after { display: none; }

  .page-home [data-scroll-section],
  .page-home .cta {
    opacity: 1 !important;
    transform: none !important;
  }
}
