/* ==========================================================================
   enhance.css — доработка к боевому запуску
   1. Фиксированная шапка «матовое стекло»
   2. Кнопка «Наверх» сбоку
   3. Галерея услуг без скролл-джека на мобильных
   4. Cookie-баннер, согласие на обработку ПДн, реквизиты в подвале
   5. Конверсионные блоки
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ШАПКА: фиксируем и включаем матовое стекло после первого экрана
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  /* ниже прелоадера (20), выше секций контента (максимум 6) */
  z-index: 18;
  padding-bottom: clamp(0.55rem, 1.4vh, 0.95rem);
  border-bottom: 1px solid transparent;
  transition:
    padding 420ms var(--ease-premium),
    border-color 420ms ease,
    backdrop-filter 420ms ease,
    transform 520ms var(--ease-premium);
}

.site-header::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: oklch(0.09 0 0 / 0.62);
  content: "";
  opacity: 0;
  transition: opacity 420ms ease;
  pointer-events: none;
}

.site-header.is-stuck {
  padding-top: clamp(0.55rem, 1.4vh, 0.95rem);
  border-bottom-color: oklch(0.75 0 0 / 0.16);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.site-header.is-stuck::before {
  opacity: 1;
}

/* логотип уменьшается, когда шапка «схлопнулась» */
.brand-mark {
  transition: width 420ms var(--ease-premium), height 420ms var(--ease-premium), opacity 250ms ease;
}

.site-header.is-stuck .brand-mark {
  width: clamp(3.4rem, 3.6vw, 4.4rem);
  height: clamp(3.4rem, 3.6vw, 4.4rem);
}

/* шапка вынесена из .hero (там isolation: isolate), поэтому вступительную
   анимацию воспроизводим от класса на body */
body.hero-enter .brand-mark,
body.hero-enter .phone-link,
body.hero-enter .outline-action--header {
  animation: header-reveal 650ms 450ms var(--ease-premium) both;
}

body.hero-enter .site-nav a {
  animation: nav-reveal 600ms calc(450ms + (var(--item-index) * 55ms)) var(--ease-premium) both;
}

/* якорные переходы не должны прятать заголовок под шапку */
#features,
#reviews,
#lead,
#contacts,
#faq,
#why,
#services,
#projects,
#about {
  scroll-margin-top: clamp(4rem, 8vh, 6rem);
}

/* полоса прогресса чтения по низу шапки */
.site-header__progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, oklch(0.95 0 0 / 0.85), var(--color-metal));
  opacity: 0;
  transform: scaleX(var(--read-progress, 0));
  transform-origin: left center;
  transition: opacity 320ms ease;
  pointer-events: none;
}

.site-header.is-stuck .site-header__progress {
  opacity: 0.9;
}

/* активный пункт меню */
.site-nav a.is-current {
  color: white;
}

.site-nav a.is-current::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* --------------------------------------------------------------------------
   2. БОКОВАЯ КНОПКА «НАВЕРХ»
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  z-index: 16;
  right: clamp(1rem, 2.2vw, 2.25rem);
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid oklch(0.85 0 0 / 0.32);
  border-radius: 50%;
  background: oklch(0.1 0 0 / 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: oklch(0.92 0 0);
  cursor: pointer;
  place-items: center;
  opacity: 0;
  transform: translate3d(0, 1rem, 0) scale(0.92);
  transition:
    opacity 420ms var(--ease-premium),
    transform 420ms var(--ease-premium),
    background 260ms ease,
    color 260ms ease;
  pointer-events: none;
}

.to-top.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}

.to-top:hover,
.to-top:focus-visible {
  background: oklch(0.95 0 0 / 0.92);
  color: var(--color-void);
}

.to-top__ring {
  position: absolute;
  top: -1px;
  right: -1px;
  bottom: -1px;
  left: -1px;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-metal) calc(var(--read-progress, 0) * 360deg),
    transparent 0
  );
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  opacity: 0.85;
  pointer-events: none;
}

.to-top svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
}

@media (max-width: 767px) {
  .to-top {
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: 3rem;
    height: 3rem;
  }
}

/* --------------------------------------------------------------------------
   3. УСЛУГИ: на мобильных — обычный свайп вместо скролл-джека
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .services-section {
    height: auto;
    min-height: 0;
    padding-bottom: clamp(2.5rem, 7svh, 4rem);
  }

  .services-sticky {
    position: static;
    height: auto;
    min-height: 0;
    padding-top: clamp(3.5rem, 9svh, 5rem);
    overflow: visible;
  }

  .services-viewport {
    position: static;
    height: auto;
    margin-top: clamp(1.5rem, 4svh, 2.5rem);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .services-viewport::-webkit-scrollbar {
    display: none;
  }

  .services-track {
    /* сбрасываем сдвиг, которым раньше управлял скролл страницы */
    height: min(52svh, 24rem);
    transform: none !important;
  }

  .service-card {
    width: 78vw;
    scroll-snap-align: center;
  }

  /* подсказка больше не висит поверх карточки, а стоит над галереей */
  .services-scroll-hint {
    position: static;
    display: flex;
    width: max-content;
    margin: clamp(1.25rem, 3svh, 2rem) var(--section-edge) 0 auto;
    opacity: 1 !important;
  }
}

/* точки-индикаторы галереи */
.services-dots {
  display: none;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.15rem;
}

@media (max-width: 900px) {
  .services-dots {
    display: flex;
  }
}

.services-dots button {
  width: 1.5rem;
  height: 2px;
  padding: 0;
  border: 0;
  background: oklch(0.75 0 0 / 0.28);
  cursor: pointer;
  transition: background 280ms ease, width 280ms var(--ease-premium);
}

.services-dots button.is-active {
  width: 2.6rem;
  background: oklch(0.95 0 0 / 0.9);
}

/* --------------------------------------------------------------------------
   4. ЮРИДИЧЕСКИЙ БЛОК
   -------------------------------------------------------------------------- */
.cookie-bar {
  position: fixed;
  z-index: 19;
  right: clamp(0.75rem, 2vw, 2rem);
  bottom: clamp(0.75rem, 2.5vh, 2rem);
  left: clamp(0.75rem, 2vw, 2rem);
  display: none;
  max-width: 62rem;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2.5rem);
  margin-inline: auto;
  padding: clamp(1.1rem, 2vw, 1.5rem) clamp(1.2rem, 2.4vw, 1.9rem);
  border: 1px solid oklch(0.8 0 0 / 0.22);
  border-radius: 1rem;
  background: oklch(0.1 0 0 / 0.86);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: oklch(0.84 0 0);
  font-size: 0.82rem;
  line-height: 1.55;
  opacity: 0;
  transform: translate3d(0, 1.2rem, 0);
  transition: opacity 520ms var(--ease-premium), transform 520ms var(--ease-premium);
}

.cookie-bar.is-shown {
  display: flex;
  opacity: 1;
  transform: none;
}

.cookie-bar.is-leaving {
  opacity: 0;
  transform: translate3d(0, 1.2rem, 0);
}

.cookie-bar p {
  margin: 0;
}

.cookie-bar a {
  color: white;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.cookie-bar__actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.6rem;
}

.cookie-bar button {
  min-height: 2.7rem;
  padding: 0 1.35rem;
  border: 1px solid oklch(0.88 0 0 / 0.55);
  border-radius: 999px;
  color: oklch(0.9 0 0);
  background: transparent;
  cursor: pointer;
  font: 400 0.76rem var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 240ms ease, color 240ms ease;
}

.cookie-bar button[data-cookie-accept] {
  color: var(--color-void);
  background: oklch(0.95 0 0);
}

.cookie-bar button:hover {
  color: var(--color-void);
  background: oklch(0.95 0 0 / 0.88);
}

@media (max-width: 767px) {
  .cookie-bar {
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 1.1rem;
    font-size: 0.78rem;
  }

  .cookie-bar__actions button {
    flex: 1;
    padding: 0 0.9rem;
  }

  /* чтобы кнопка «наверх» не налезала на баннер */
  body.cookie-visible .to-top {
    bottom: 11rem;
  }
}

/* согласие на обработку ПДн в форме */
.consent {
  display: grid;
  margin-top: -0.4rem;
  align-items: start;
  gap: 0.75rem;
  grid-template-columns: 1.15rem 1fr;
  color: oklch(0.64 0 0);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1.55;
}

.consent input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.1rem 0 0;
  accent-color: oklch(0.9 0 0);
  cursor: pointer;
}

.consent a {
  color: oklch(0.86 0 0);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.consent.is-invalid {
  color: oklch(0.72 0.16 28);
}

.form-status a {
  color: white;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.form-note {
  margin: -0.6rem 0 0;
  color: oklch(0.58 0 0);
  font-size: 0.72rem;
  line-height: 1.55;
}

/* реквизиты в подвале */
.footer-legal {
  display: grid;
  margin-top: clamp(1.5rem, 3vh, 2.25rem);
  padding-top: clamp(1.5rem, 3vh, 2.25rem);
  gap: 0.85rem;
  border-top: 1px solid oklch(0.4 0 0 / 0.28);
  color: oklch(0.55 0 0);
  font-size: 0.72rem;
  line-height: 1.65;
}

.footer-legal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.footer-legal__links a {
  color: oklch(0.72 0 0);
  text-decoration: underline;
  text-underline-offset: 0.25em;
  transition: color 220ms ease;
}

.footer-legal__links a:hover {
  color: white;
}

.footer-legal__disclaimer {
  max-width: 68rem;
}

/* подпись разработчика и блок об авторских правах */
.footer-bottom {
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.footer-credit {
  color: oklch(0.62 0 0);
  text-decoration: none;
  transition: color 220ms ease;
}

.footer-credit:hover,
.footer-credit:focus-visible {
  color: white;
}

@media (max-width: 767px) {
  .footer-bottom {
    /* каждый пункт на своей строке, снизу — место под плавающую кнопку */
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 4.75rem;
  }
}

/* --------------------------------------------------------------------------
   5. КОНВЕРСИОННЫЕ БЛОКИ
   -------------------------------------------------------------------------- */
.guarantee-strip {
  display: grid;
  margin-top: clamp(1.75rem, 3.5vh, 2.75rem);
  gap: 1px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block: 1px solid var(--section-line, oklch(0.4 0 0 / 0.28));
  background: var(--section-line, oklch(0.4 0 0 / 0.28));
}

.guarantee-strip > div {
  display: grid;
  gap: 0.5rem;
  padding: clamp(1.6rem, 3vw, 2.6rem) clamp(1.1rem, 2vw, 2rem);
  background: var(--color-void);
}

.guarantee-strip strong {
  color: white;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 0.95;
}

.guarantee-strip span {
  color: oklch(0.66 0 0);
  font-size: clamp(0.76rem, 0.9vw, 0.92rem);
  line-height: 1.5;
}

@media (max-width: 479px) {
  .guarantee-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   6. ТИХИЙ РЕЖИМ
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .to-top,
  .cookie-bar {
    transition: none;
  }
}
