/* =========================================================
   ANIMATIONS & HOVERS
   ========================================================= */

/* ---- Базовые easing-переменные ---- */
:root {
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-back:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --reveal-time:  0.8s;
}

/* ---- SCROLL-REVEAL ----
   Базовое состояние: невидимо, чуть смещено.
   IntersectionObserver добавит класс .is-visible — и поедет. */
[data-reveal] {
  opacity: 0;
  transition:
    opacity var(--reveal-time) var(--ease-out),
    transform var(--reveal-time) var(--ease-out);
  will-change: opacity, transform;
}
[data-reveal="up"]    { transform: translateY(40px); }
[data-reveal="down"]  { transform: translateY(-40px); }
[data-reveal="left"]  { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="zoom"]  { transform: scale(0.92); }
[data-reveal="fade"]  { transform: none; }

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* staggered delays — добавляются JS из data-reveal-delay */

/* ---- HERO: пуск при загрузке ---- */
.hero__title,
.hero .btn {
  opacity: 0;
  animation: hero-rise 0.9s var(--ease-out) 0.25s forwards;
}
.hero .btn { animation-delay: 0.55s; }

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

/* Фон героя — мягкий зум при появлении */
.hero__bg {
  animation: hero-bg 1.6s var(--ease-out) both;
}
@keyframes hero-bg {
  from { opacity: 0; transform: scale(1.08); }
  to   { opacity: 1; transform: none; }
}

/* ---- HOVER: НАВИГАЦИЯ В ШАПКЕ ---- */
.hero__nav a {
  position: relative;
  padding: 4px 2px;
}
.hero__nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}
.hero__nav a:hover::after { transform: scaleX(1); }

/* ---- HOVER: кнопки ---- */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out),
              box-shadow 0.3s var(--ease-out),
              background 0.3s ease;
}
.btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  transform: translateX(-110%);
  transition: transform 0.6s var(--ease-out);
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(147, 24, 26, 0.28);
}
.btn--white:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
.btn:hover::before { transform: translateX(110%); }
.btn:active { transform: translateY(-1px); }

/* ---- HOVER: иконки связи в hero ---- */
.hero__action {
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease, transform 0.3s var(--ease-back);
}
.hero__action::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  transition: transform 0.45s var(--ease-out);
}
.hero__action:hover {
  transform: translateY(-3px) rotate(-4deg);
}
.hero__action:hover::before { transform: scale(2.2); }

/* ---- HOVER: карточки «Наш подход» ---- */
.approach__cell {
  transition: transform 0.4s var(--ease-out), background 0.3s ease;
}
.approach__cell:hover {
  background: rgba(147,24,26,0.03);
  transform: translateY(-4px);
}
.approach__cell h3 {
  transition: color 0.3s ease;
}
.approach__cell:hover h3 { color: var(--c-red); }

.approach__icon {
  transition: transform 0.6s var(--ease-back), filter 0.3s ease;
}
.approach__cell:hover .approach__icon {
  transform: rotate(-8deg) scale(1.12);
  filter: drop-shadow(0 6px 14px rgba(147,24,26,0.25));
}

/* ---- HOVER: карточка услуг ---- */
.service-card {
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
.service-card img {
  transition: transform 0.7s var(--ease-out), filter 0.4s ease;
}
.service-card::after {
  transition: opacity 0.4s ease, background 0.4s ease;
}
.service-card__title {
  transition: transform 0.4s var(--ease-out), color 0.3s ease;
  display: inline-block;
}
.service-card__desc {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease-out),
              opacity 0.4s ease 0.05s;
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px rgba(0,0,0,0.32);
}
.service-card:hover img {
  transform: scale(1.08);
  filter: brightness(0.9);
}
.service-card:hover::after {
  background: linear-gradient(to top, rgba(15,15,15,0.88) 0%, rgba(15,15,15,0.45) 55%, rgba(0,0,0,0.15) 100%);
}
.service-card:hover .service-card__title { transform: translateY(-4px); }
.service-card:hover .service-card__desc  { max-height: 80px; opacity: 1; }

/* ---- HOVER: портфолио — только zoom + лёгкая тень ---- */
.portfolio__item {
  position: relative;
  display: block;
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
.portfolio__item img {
  transition: transform 0.6s var(--ease-out);
}
.portfolio__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 40px rgba(0,0,0,0.22);
}
.portfolio__item:hover img { transform: scale(1.08); }

/* ---- LIGHTBOX (галерея фото портфолио) ---- */
.lightbox {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  padding: 60px 20px;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox__stage {
  position: relative;
  max-width: 1200px;
  max-height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.4s var(--ease-out), opacity 0.3s ease;
}
.lightbox.is-open .lightbox__img {
  transform: scale(1);
  opacity: 1;
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s var(--ease-back);
  border: 1px solid rgba(255,255,255,0.18);
}
.lightbox__close:hover,
.lightbox__nav:hover {
  background: var(--c-red, #93181a);
  transform: scale(1.08);
}
.lightbox__close {
  top: 20px; right: 20px;
  font-size: 22px;
}
.lightbox__nav--prev { left: -64px; }
.lightbox__nav--next { right: -64px; }
.lightbox__counter {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  letter-spacing: 0.04em;
}
@media (max-width: 991.98px) {
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
}
@media (max-width: 575.98px) {
  .lightbox__nav { width: 40px; height: 40px; font-size: 18px; }
  .lightbox__close { top: 10px; right: 10px; }
}
body.is-lightbox-open { overflow: hidden; }

/* ---- HOVER: FAQ ---- */
.faq__item {
  transition: background 0.3s ease, padding 0.3s ease;
}
.faq__q {
  transition: padding-left 0.35s var(--ease-out), color 0.2s ease;
}
.faq__item:hover {
  background: rgba(255,255,255,0.04);
}
.faq__item:hover .faq__q {
  padding-left: 12px;
}
.faq__item.is-open {
  background: rgba(0,0,0,0.08);
}

/* ---- HOVER: футер-ссылки ---- */
.footer__col a {
  position: relative;
  padding: 2px 0;
  transition: color 0.2s ease, padding-left 0.3s var(--ease-out);
}
.footer__col a::before {
  content: "→";
  position: absolute;
  left: -16px;
  opacity: 0;
  transition: opacity 0.3s, left 0.3s var(--ease-out);
  color: var(--c-red);
}
.footer__col a:hover {
  color: #fff;
  padding-left: 16px;
}
.footer__col a:hover::before { opacity: 1; left: 0; }

/* ---- HOVER: контакт-карточки ---- */
.contact__detail {
  transition: transform 0.3s var(--ease-out);
}
.contact__detail svg {
  transition: transform 0.45s var(--ease-back);
}
.contact__detail:hover { transform: translateX(4px); }
.contact__detail:hover svg { transform: rotate(-10deg) scale(1.1); }
.contact__detail-value {
  transition: color 0.2s ease;
}
.contact__detail-value:hover { color: var(--c-red); }

/* ---- HOVER: поля формы ---- */
.form__field {
  transition: transform 0.2s var(--ease-out);
}
.form__input, .form__textarea {
  transition: border-color 0.25s ease, background 0.25s ease,
              transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.form__input:hover,
.form__textarea:hover {
  border-color: rgba(147,24,26,0.4);
}
.form__input:focus,
.form__textarea:focus {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(147,24,26,0.15);
}

/* ---- ЛЁГКИЕ ФЛОАТЫ И ПУЛЬСАЦИИ ---- */
/* Декор «Летнее меню» — мягкое покачивание */
.summer__decor img {
  animation: gentle-float 6s ease-in-out infinite;
}
.summer__decor--right img { animation-delay: -3s; }
@keyframes gentle-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-12px) rotate(1deg); }
}

/* Pulse-индикатор у CTA hero (мягкое сияние) */
.hero__center .btn {
  animation: hero-rise 0.9s var(--ease-out) 0.55s forwards,
             cta-glow 3.4s ease-in-out 1.6s infinite;
}
@keyframes cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.0), 0 6px 18px rgba(0,0,0,0.2); }
  50%      { box-shadow: 0 0 0 14px rgba(255,255,255,0.0), 0 8px 22px rgba(0,0,0,0.28); }
}

/* Scroll-prompt стрелка под hero (опциональный декор) */
.hero::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 22px; height: 36px;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 12px;
  transform: translateX(-50%);
  pointer-events: none;
}
.hero::before { z-index: -1; }
@keyframes mouse-dot {
  0%   { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 14px); }
}

/* Логотип — лёгкое вращение иконки при hover */
.logo:hover .logo__icon {
  animation: logo-spin 0.7s var(--ease-back);
}
@keyframes logo-spin {
  0%   { transform: rotate(0); }
  60%  { transform: rotate(-12deg) scale(1.08); }
  100% { transform: rotate(0); }
}

/* ---- Когда уже прокрутили вниз — JS добавляет body.is-scrolled.
       Шапка превращается в плавающую капсулу: с отступами по бокам,
       не прилегает к краям, аккуратно стоит над контентом
       и пропускает прокрутку под собой. */
body.is-scrolled .hero__top {
  top: 16px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: calc(var(--container, 1352px) + 32px);
  z-index: 900;                                   /* всегда над контентом, ниже lightbox (1000) */
  padding: 14px 28px;
  background: rgba(17, 17, 17, 0.78);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
}
body.is-scrolled .logo            { height: 44px; }
body.is-scrolled .logo__img       { height: 44px; }
body.is-scrolled .hero__action    { width: 48px; height: 48px; }
body.is-scrolled .hero__action img{ width: 32px; height: 32px; }

@media (max-width: 991.98px) {
  body.is-scrolled .hero__top {
    top: 10px;
    width: calc(100% - 16px);
    padding: 10px 14px;
    border-radius: 24px;                          /* на мобиле — мягкий прямоугольник, не пилюля */
  }
  body.is-scrolled .logo, body.is-scrolled .logo__img { height: 36px; }
  body.is-scrolled .hero__action     { width: 40px; height: 40px; }
  body.is-scrolled .hero__action img { width: 26px; height: 26px; }
}

/* ---- Уважение к prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero__title, .hero .btn, .hero__bg { animation: none; opacity: 1; }
  .summer__decor img { animation: none; }
  .hero__center .btn { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
