/* ==========================================================
   UIP Home Slider
   ========================================================== */

.uip-hero {
    position: relative;
    overflow: hidden;
    background: #0d1f3c;
    min-height: 560px;
}

/* ── Слайди ── */
.uip-hero__slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.uip-hero__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    min-height: 700px;
    display: flex;
    align-items: center;
    /* Safari iOS: форсуємо compositing layer щоб не зникали дочірні елементи */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.uip-hero__slide.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

/* ── Grid pattern ── */
.uip-hero__slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridShift 20s linear infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes gridShift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 60px 60px;
    }
}

/* ── Overlay ── */
.uip-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(12, 87, 168, 0.85) 0%, rgba(13, 31, 60, 0.95) 100%);
    z-index: 0;
}

/* ── Внутрішня сітка ── */
.uip-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding-top: 60px;
    padding-bottom: 60px;
    width: 100%;
}

/* ── Контент (ліва сторона) ── */
.uip-hero__content {
    flex: 0 0 50%;
    max-width: 560px;
}

/* ── Мітка ── */
.uip-hero__label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

.uip-hero__label::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 2px;
    background: var(--color-accent, #40B026);
    flex-shrink: 0;
}

/* ── Word-by-word entrance animation ── */
@keyframes uip-word-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.uip-hero__title .uip-word {
    display: inline-block;
    will-change: transform, opacity;
}

/* ── Заголовок ── */
.uip-hero__title {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
    margin: 0 0 20px;
}

.uip-hero__accent {
    color: var(--color-accent, #40B026);
}

/* ── Опис ── */
.uip-hero__desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    margin: 0 0 32px;
    max-width: 440px;
}

/* ── Кнопка ── */
.uip-hero__btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--color-secondary, #40B026);
    color: #fff !important;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none !important;
    border: 2px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-radius: var(--radius-btn, 6px);
}

.uip-hero__btn:hover {
    background: var(--color-secondary-dark, #339900);
    border-color: var(--color-secondary-dark, #339900);
}

/* ── Зображення (права сторона) ── */
.uip-hero__media {
    flex: 0 0 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uip-hero__image {
    max-width: 100%;
    max-height: 680px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
    animation: uip-hero-float 4s ease-in-out infinite;
    /* Примусовий GPU-шар — Safari iOS інколи не рендерить анімований елемент */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@keyframes uip-hero-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ── Стрілки prev/next ── */
.uip-hero__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    padding: 0 !important;
    line-height: normal !important;
    backdrop-filter: blur(4px);
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s ease, transform 0.3s ease;
    border-radius: var(--radius-btn, 6px);
}

.uip-hero__arrow--prev {
    left: 24px;
}

.uip-hero__arrow--next {
    right: 24px;
}

.uip-hero__arrow svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Показуємо при наведенні на слайдер */
.uip-hero:hover .uip-hero__arrow {
    opacity: 1;
}

.uip-hero__arrow:hover {
    background: var(--color-primary, #0C57A8);
    border-color: var(--color-primary, #0C57A8);
}

.uip-hero__arrow--prev:hover {
    transform: translateY(-50%) translateX(-2px);
}

.uip-hero__arrow--next:hover {
    transform: translateY(-50%) translateX(2px);
}

@media (max-width: 600px) {
    .uip-hero__arrow {
        display: none;
    }
}

/* ── Контролі / dots ── */
.uip-hero__controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.uip-hero__dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.uip-hero__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease, width 0.3s ease, border-radius 0.3s ease;
}

.uip-hero__dot.active {
    width: 28px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
}

/* ── Progress bar ── */
.uip-hero__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 10;
}

.uip-hero__progress-bar {
    height: 100%;
    background: var(--color-accent, #40B026);
    width: 0%;
    transition: width linear;
}

/* ── Адаптив ── */
@media (max-width: 849px) {
    .uip-hero__inner {
        flex-direction: column;
        text-align: center;
        padding-top: 40px;
        padding-bottom: 20px;
    }

    .uip-hero__content {
        flex: none;
        max-width: 100%;
    }

    .uip-hero__label {
        justify-content: center;
    }

    .uip-hero__desc {
        max-width: 100%;
    }

    .uip-hero__media {
        flex: none;
        width: 100%;
        /* overflow: hidden прибрано — float-анімація translateY(-10px) обрізалась Safari */
        overflow: visible;
        padding-bottom: 16px;
        /* запас для нижньої тіні */
    }

    .uip-hero__image {
        max-height: 265px;
    }
}

@media (max-width: 549px) {
    .uip-hero {
        min-height: auto;
    }

    .uip-hero__title {
        font-size: 1.75rem;
    }
}