/* ==========================================================================
   Hero Section - Оновлена структура з формою та зображенням
   ========================================================================== */

.hero-section {
  display: flex;
  flex-direction: column;
  max-height: 65vh; /* Fallback */
  max-height: 65dvh;
  max-width: 91vw;
  max-width: 91dvw;
  padding: var(--section-padding-desktop);
  margin-bottom: var(--section-spacing-desktop);
  contain: layout style paint; /* Ізоляція для продуктивності */
  overflow: hidden;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-top: 9vh;
  margin-top: 9dvh;
}

.hero-section__header {
  text-align: center;
}

.hero-section__header h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem); /* 40-56px */
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-white);
  text-shadow:
    0 3px 6px rgba(0, 0, 0, 0.5),
    0 6px 12px rgba(0, 0, 0, 0.4),
    0 9px 18px rgba(0, 0, 0, 0.3),
    0 12px 24px rgba(0, 0, 0, 0.2);
}

/* Виключити тіні з золотого акценту, щоб не конфліктувало з градієнтом */
.hero-section__header h1 .hero-section__price-accent {
  text-shadow: none;
}

/* Загальний клас для червоних акцентів */
.text-accent {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 700;
  background-color: var(--color-white);
  padding: 0.25em 0.5em;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Золотий текст з блистками та білим контуром для "180 грн" */
.hero-section__price-accent {
  display: inline-block;
  font-weight: 700;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 3px var(--color-white);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  position: relative;

  /* Анімація на opacity замість filter для краще продуктивності */
  animation: glitter-glow 3s ease-in-out infinite;
}

/* Glow ефект через ::after (заміст filter) */
.hero-section__price-accent::after {
  content: '';
  position: absolute;
  inset: -8px -5px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 215, 0, 0.3) 0%,
    rgba(255, 165, 0, 0.15) 30%,
    transparent 70%
  );
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  animation: glitter-glow-opacity 3s ease-in-out infinite;
  z-index: -1;
}

/* Оптимізована анімація: тільки opacity, без filter */
@keyframes glitter-glow {
  0%, 100% {
    text-shadow: 0 0 0 rgba(255, 215, 0, 0);
  }

  50% {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  }
}

@keyframes glitter-glow-opacity {
  0%, 100% {
    opacity: 0;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Вимкнути анімацію на мобільних для продуктивності */
@media (width <= 767px) {
  .hero-section__price-accent {
    animation: none;
    filter: brightness(1.1);
  }
}

/* Вимкнути анімацію при prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hero-section__price-accent {
    animation: none;
  }
}

/* Зелений акцент для "БЕЗКОШТОВНО" */
.hero-section__free-accent {
  display: inline-block;
  color: var(--color-success);
  font-weight: 700;
  background-color: var(--color-white);
  padding: 0.25em 0.5em;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-section__header p {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem); /* 18-22px */
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-white);
}

/* Мобільна оптимізація заголовка */
@media (width <= 767px) {
  .hero-section__header {
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
  }

  .hero-section__header h1 {
    /* Адаптивний розмір шрифту для малих екранів */
    font-size: clamp(1.75rem, 8vw, 2.5rem); /* 28-40px на мобільних */
    line-height: 1.3;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);

    /* Переконаємося, що текст не обрізається */
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hero-section__header p {
    /* Адаптивний розмір для параграфа */
    font-size: clamp(0.875rem, 3vw, 1.125rem); /* 14-18px на мобільних */
    line-height: 1.5;

    /* Додаємо margin для spacing */
    margin-top: clamp(0.5rem, 1.5vw, 0.75rem);
  }
}

.hero-section__cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 100%;
  margin-left: 15vw; /* Fallback */
  margin-left: 15dvw; /* iOS Dynamic Viewport */
  overflow: hidden;
}

.hero-section__form {
  padding: 0;
  width: 100%;
  max-width: 400px;
  justify-self: end;
  margin-left: auto;
}

/* Перекриваємо glassmorphism для форми */
.hero-section__form.glass-card {
  background: transparent;
  border: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.hero-section__image {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  width: 100%;
  max-width: 70%;
  justify-self: start;
  margin-right: auto;
}

.hero-section__image img {
  width: 17vh;
  max-width: 20vh;
  height: auto;
  object-fit: contain;
  display: block;
}

/* iOS Safari специфічні фікси */
@supports (-webkit-touch-callout: none) {
  .hero-section__cta {
    margin-left: 15dvw;

    /* Fallback для iOS < 15 */
    margin-left: calc(var(--parallax-vh, 1vh) * 15);
  }
}

@media (width >= 1024px) {
  .hero-section {
    max-width: min(var(--content-width-desktop), var(--content-max-width));
  }
}

/* Мобільна версія */
@media (width <= 767px) {
  .hero-section {
    overflow: visible;
    padding: clamp(1rem, 4vw, var(--section-padding-mobile));
    margin-bottom: var(--section-spacing-mobile);
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-top: clamp(1rem, 2vh, 2rem);
    scroll-margin-top: calc(var(--header-height, 80px) + env(safe-area-inset-top, 0px) + 1rem);
  }

  .hero-section__cta {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-left: 0;
    width: 100%;
    overflow: visible;
  }

  .hero-section__form {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
  }

  /* Приховуємо зображення на мобільних */
  .hero-section__image {
    display: none;
  }

  /* Адаптивні капсули для акцентів на мобільних */
  .hero-section__free-accent {
    padding: 0.2em 0.4em;
    font-size: clamp(0.75em, 2.5vw, 0.9em);
  }

  .hero-section__price-accent {
    font-size: clamp(3.5rem, 5vw, 2em);
  }
}

/* Додаткові медіа-запити для дуже малих екранів */
@media (width <= 374px) {
  .hero-section {
    padding: clamp(0.75rem, 3vw, 1rem);
    gap: clamp(0.75rem, 2.5vw, 1rem);
  }

  .hero-section__header h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
    line-height: 1.25;
  }

  .hero-section__header p {
    font-size: clamp(0.8125rem, 2.5vw, 1rem);
  }
}

/* Landscape орієнтація на мобільних */
@media (width <= 767px) and (orientation: landscape) {
  .hero-section {
    padding: clamp(0.75rem, 2vh, 1rem);
    gap: clamp(0.5rem, 1.5vh, 0.75rem);
    margin-top: clamp(0.5rem, 1vh, 1rem);
  }

  .hero-section__header {
    margin-bottom: clamp(0.5rem, 1.5vh, 0.75rem);
  }

  .hero-section__header h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin-bottom: clamp(0.5rem, 1vh, 0.75rem);
  }

  .hero-section__header p {
    font-size: clamp(0.8125rem, 2.5vw, 1rem);
    margin-top: clamp(0.25rem, 1vh, 0.5rem);
  }

  .hero-section__cta {
    gap: clamp(0.5rem, 1.5vh, 0.75rem);
  }

  .trial-form--hero .form-group {
    margin-bottom: clamp(0.5rem, 1.5vh, 0.75rem);
  }

  .trial-form--hero .form-group:last-of-type {
    margin-bottom: clamp(0.75rem, 2vh, 1rem);
  }
}

