/* Home hero: full-bleed photo (EN / AR / mobile versions) with a fast left / right motion.
   The hero keeps its original size; the photo fills it completely (object-fit: cover).
   Replaces the old slider + parallax. Loaded after hero-parallax.css. */

html body #home.w3l-banner {
    --hero-photo-opacity: 1;
}

html[data-theme="light"] body #home.w3l-banner {
    --hero-photo-opacity: .8;
}

html[lang="ar"] body #home.w3l-banner::before,
html[dir="rtl"] body #home.w3l-banner::before,
html[lang="ar"] body #home.w3l-banner::after,
html[dir="rtl"] body #home.w3l-banner::after {
    display: none !important;
    content: none !important;
    background: none !important;
    box-shadow: none !important;
}

#home .hero-photo {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#home .hero-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    opacity: var(--hero-photo-opacity);
    will-change: transform;
    animation: hero-photo-pan 12s ease-in-out infinite;
}

/* Only one photo shows: English, Arabic, or (small screens) mobile */
#home .hero-photo-ar,
#home .hero-photo-mob { display: none; }

html[lang="ar"] #home .hero-photo-en,
html[dir="rtl"] #home .hero-photo-en,
html[lang="ar"] #home .hero-photo-mob,
html[dir="rtl"] #home .hero-photo-mob { display: none !important; }

html[lang="ar"] #home .hero-photo-ar,
html[dir="rtl"] #home .hero-photo-ar { display: block; }

html[lang="ar"] #home .hero-photo-img,
html[dir="rtl"] #home .hero-photo-img {
    animation-name: hero-photo-pan-ar;
}

@media (max-width: 767px) {
    html #home .hero-photo-en,
    html #home .hero-photo-ar { display: none; }
    html #home .hero-photo-mob { display: block; }

    /* Mobile: the photo fills the hero completely (full width and height, no crop gaps). */
    html body #home.w3l-banner {
        display: grid !important;
        min-height: 100svh !important;
        height: 100svh !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    html body #home .hero-photo {
        position: absolute;
        inset: 0;
        grid-area: 1 / 1;
        z-index: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    html body #home .hero-photo-mob {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 100%;
        object-fit: cover;
        object-position: center;
        animation: hero-photo-pan 12s ease-in-out infinite;
    }

    html[lang="ar"] body #home .hero-photo-mob,
    html[dir="rtl"] body #home .hero-photo-mob {
        animation-name: hero-photo-pan-ar;
    }

    html body #home .hero-stage {
        grid-area: 1 / 1;
        padding-top: 6.5rem;
        padding-bottom: 2.2rem;
    }
}

/* Mobile / tablet: space between the hero paragraph and the two buttons */
@media (max-width: 991px) {
    html body #home .hero-stage .hero-actions {
        margin-top: 1.8rem !important;
    }
}

/* Slide left and right only (slightly oversized so the edges never show) */
@keyframes hero-photo-pan {
    0%   { transform: scale(1.1) translateX(-4%); }
    50%  { transform: scale(1.1) translateX(4%); }
    100% { transform: scale(1.1) translateX(-4%); }
}

@keyframes hero-photo-pan-ar {
    0%   { transform: scaleX(-1) scale(1.1) translateX(-4%); }
    50%  { transform: scaleX(-1) scale(1.1) translateX(4%); }
    100% { transform: scaleX(-1) scale(1.1) translateX(-4%); }
}

/* Keep the text and buttons above the photo */
html body #home .hero-stage { position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
    #home .hero-photo-img { animation: none; }
    html[lang="ar"] #home .hero-photo-img,
    html[dir="rtl"] #home .hero-photo-img { transform: scaleX(-1); }
}

/* Small shadow behind the hero headline ("Your partner at every stage of Farming") */
html body #home .hero-title,
html body #home .hero-title span {
    text-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .25) !important;
}

/* ---- Hero text entrance, played when the website starts (after the intro) ----
   English: text slides in from the right to its place on the left.
   Arabic : text slides in from the left to its place on the right. */
html body #home { overflow: hidden; }

html:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-copy > *,
html:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-actions {
    animation: hero-text-in-en 1.2s cubic-bezier(.22, 1, .36, 1) both;
}

html[lang="ar"]:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-copy > *,
html[lang="ar"]:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-actions {
    animation-name: hero-text-in-ar;
}

html:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-copy > *:nth-child(2) { animation-delay: .12s; }
html:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-copy > *:nth-child(3) { animation-delay: .24s; }
html:not(.intro-pending):not(.intro-playing):not(.intro-docking) #home .hero-stage .hero-actions { animation-delay: .36s; }

/* hold the text back while the intro splash is still showing */
html.intro-pending #home .hero-stage .hero-copy > *,
html.intro-playing #home .hero-stage .hero-copy > *,
html.intro-docking #home .hero-stage .hero-copy > *,
html.intro-pending #home .hero-stage .hero-actions,
html.intro-playing #home .hero-stage .hero-actions,
html.intro-docking #home .hero-stage .hero-actions {
    opacity: 0;
}

@keyframes hero-text-in-en {
    from { opacity: 0; transform: translateX(min(60vw, 520px)); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes hero-text-in-ar {
    from { opacity: 0; transform: translateX(max(-60vw, -520px)); }
    to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    html #home .hero-stage .hero-copy > *,
    html #home .hero-stage .hero-actions { animation: none !important; opacity: 1 !important; }
}
