/* Why-us секція - 3 ілюстрації з м'яким hover (GPU-only)
 *
 * Desktop: рівні колонки; hover = scale + opacity контенту + dim сусідів
 * Tablet/Mobile: статичні блоки без hover-motion
 *
 * ПРАВИЛА:
 * - НЕ використовувати !important
 * - НЕ дублювати правила з normalize.css
 * - Використовувати CSS variables з base.css
 * - Анімувати лише transform/opacity (Emil / review_animations)
 */

/* ============================================================================ */

/* БАЗОВІ СТИЛІ                                                                */

/* ============================================================================ */

.why-us {
  --why-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --why-duration-in: 0.28s;
  --why-duration-out: 0.18s;

  position: relative;
  background-color: #010101;
}

.why-us__overlay {
  display: none;

  /* Приховано за замовчуванням (mobile-first) */
}

.why-us__slider {
  display: flex;
  min-height: 90vh;
}

.why-us__slide {
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
  flex: 1 0 0;
  min-width: 0;
}

/* ============================================================================ */

/* ЗОБРАЖЕННЯ                                                                   */

/* ============================================================================ */

.why-us__image {
  height: 70%;
  width: auto;
  object-fit: cover;
  object-position: center;
  display: block;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scale(1);
  transform-origin: center bottom;
  transition:
    transform var(--why-duration-out) var(--why-ease-out),
    opacity var(--why-duration-out) var(--why-ease-out);
  will-change: transform, opacity;
}

/* ============================================================================ */

/* НАПИСИ НА ЗОБРАЖЕННЯХ                                                        */

/* ============================================================================ */

.why-us__image-label {
  /* Приховано за замовчуванням (mobile-first) */
  display: none;
}

/* ============================================================================ */

/* КОНТЕНТ В БЛОКАХ                                                             */

/* ============================================================================ */

.why-us__slide-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%);
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition:
    opacity var(--why-duration-out) var(--why-ease-out),
    transform var(--why-duration-out) var(--why-ease-out);
  pointer-events: none;
  z-index: 5;
}

.why-us__slide-title {
  font-family: var(--font-family-display);
  font-size: clamp(0.95rem, 1.15vw, 1.25rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.why-us__slide-description {
  font-family: var(--font-family-base);
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1rem;
}

.why-us__slide-button {
  display: inline-block;
  margin: 0;
}

/* ============================================================================ */

/* DESKTOP (>1024px): рівні колонки + м'який hover                            */

/* ============================================================================ */

.why-us__title {
  display: none;
}

@media (width >= 1025px) {
  .why-us__slider {
    display: flex;
    min-height: 90vh;
    gap: 0;
  }

  .why-us__slide {
    flex: 1 1 0;
    min-width: 0;
  }

  .why-us__image-label {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-family: var(--font-family-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 4;
    opacity: 1;
    transition: opacity var(--why-duration-out) var(--why-ease-out);
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    line-height: 1.2;
  }

  .why-us__overlay {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 28%;
    background-color: #010101;
    z-index: 10;
    pointer-events: none;
  }

  .why-us__overlay-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    font-family: var(--font-family-hero);
  }

  /* Hover лише на точних pointer (не touch) — GPU: transform/opacity */
  @media (hover: hover) and (pointer: fine) {
    .why-us__slider:hover .why-us__slide:not(:hover) .why-us__image {
      opacity: 0.45;
      transform: translateX(-50%) scale(0.97);
    }

    .why-us__slide:hover .why-us__image {
      opacity: 1;
      transform: translateX(-50%) scale(1.04);
      transition-duration: var(--why-duration-in);
    }

    .why-us__slide:hover .why-us__slide-content {
      opacity: 1;
      transform: translate3d(0, 0, 0);
      pointer-events: auto;
      transition-duration: var(--why-duration-in);
    }

    .why-us__slide:hover .why-us__image-label {
      opacity: 0;
      transition-duration: var(--why-duration-in);
    }
  }

  /* Клавіатура: focus-within = той самий стан, що hover */
  .why-us__slide:focus-within .why-us__image {
    opacity: 1;
    transform: translateX(-50%) scale(1.04);
  }

  .why-us__slide:focus-within .why-us__slide-content {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  .why-us__slide:focus-within .why-us__image-label {
    opacity: 0;
  }
}

/* ============================================================================ */

/* TABLET/MOBILE (<1024px): Статичні блоки                                    */

/* ============================================================================ */

@media (width <= 1024px) {
  .why-us {
    min-height: auto;
    padding: var(--spacing-xl) 0;
  }

  .why-us__title {
    display: block;
    text-align: center;
    font-size: clamp(2.4rem, 8vw, 4rem);
    font-family: var(--font-family-hero);
    color: #ffffff;
    margin: 0 0 var(--spacing-xl) 0;
    padding: 0 var(--spacing-md);
  }

  .why-us__slider {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    max-width: 100%;
    width: 100%;
    padding: 0 var(--spacing-sm);
    margin: 0 auto;
    box-sizing: border-box;
  }

  .why-us__slide {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    min-height: auto;
    overflow: visible;
  }

  .why-us__image {
    position: relative;
    width: 100%;
    max-width: 200px;
    height: auto;
    min-height: 180px;
    object-fit: contain;
    margin: 0 auto;
    bottom: auto;
    left: auto;
    transform: none;
    transition: none;
    will-change: auto;
  }

  .why-us__slide-content {
    display: block;
    position: relative;
    width: 100%;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.95) 100%);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
  }

  .why-us__slide-title {
    font-size: 1.5rem;
  }

  .why-us__slide-description {
    font-size: 1rem;
  }

  .why-us__overlay {
    display: none;
  }

  .why-us__image-label {
    display: none;
  }
}

/* ============================================================================ */

/* МАЛІ ЕКРАНИ (≤480px)                                                         */

/* ============================================================================ */

@media (width <= 480px) {
  .why-us__title {
    font-size: clamp(2rem, 10vw, 3rem);
    margin-bottom: var(--spacing-md);
    padding: 0 var(--spacing-sm);
  }

  .why-us__slider {
    padding: 0 var(--spacing-xs);
    gap: var(--spacing-lg);
  }

  .why-us__slide-content {
    padding: var(--spacing-sm);
  }

  .why-us__slide-title {
    font-size: 1.25rem;
  }

  .why-us__slide-description {
    font-size: 0.9rem;
  }
}

/* ============================================================================ */

/* ACCESSIBILITY                                                                */

/* ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  .why-us__image,
  .why-us__slide-content,
  .why-us__image-label {
    transition: none;
    will-change: auto;
  }

  .why-us__image {
    transform: translateX(-50%);
  }

  @media (width >= 1025px) {
    .why-us__slide:hover .why-us__image,
    .why-us__slide:focus-within .why-us__image {
      transform: translateX(-50%);
      opacity: 1;
    }

    .why-us__slider:hover .why-us__slide:not(:hover) .why-us__image {
      transform: translateX(-50%);
      opacity: 0.55;
    }

    .why-us__slide:hover .why-us__slide-content,
    .why-us__slide:focus-within .why-us__slide-content {
      transform: none;
      opacity: 1;
    }
  }
}
