/* ============================================================
   home.css - EuroMarket Home (Premium Corporate Edition)
   ============================================================ */

/* ============================================================
   SOFT SCROLL-SNAP (solo home, classe applicata da home.js)
   - proximity: snap morbido — piccoli scroll si agganciano alla
     hero, scroll decisi la oltrepassano senza opporre resistenza.
   - JS in home.js disabilita lo snap una volta superata la hero
     e lo riabilita solo quando scrollY torna ~0.
   - Disabilitato in caso di reduced-motion.
   ============================================================ */
html.snap-home {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}
html.snap-home body {
    /* Alcuni browser (Safari) richiedono lo snap-type sul body
       quando html è il container effettivo. Doppia sicurezza. */
    scroll-snap-type: y proximity;
}
html.snap-home .hero-fullscreen {
    scroll-snap-align: start;
    scroll-snap-stop: normal; /* "normal" lascia passare scroll forti */
}
@media (prefers-reduced-motion: reduce) {
    html.snap-home,
    html.snap-home body { scroll-snap-type: none; }
    html.snap-home .hero-fullscreen { scroll-snap-align: none; }
}

/* --- HERO SECTION FULLSCREEN --- */
/*
   PERF NOTE:
   - Rimossa animazione `background-position` (causava repaint full viewport
     ogni frame → frame drop su tutta la pagina, non solo nella hero).
   - Rimosso `backdrop-filter` dall'overlay (su un'area fullscreen costa molto
     ed è ridondante: stiamo già sfocando due orbs sotto di esso).
   - Orbs: blur ridotto 80→50px, promossi a layer GPU con translate3d e
     `will-change: transform` (animano transform, NON layout).
   - `contain: paint` isola la hero dal resto del documento → evita reflow
     a catena durante lo scroll/animazioni.
*/
.hero-fullscreen {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(30, 58, 138, 0.55), transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 105, 20, 0.35), transparent 60%),
        linear-gradient(135deg, #0f1419 0%, #16224a 50%, #0f1419 100%);
    overflow: hidden;
    border-bottom: 1px solid var(--color-border);
    contain: paint;
    isolation: isolate;
}

.hero-fullscreen::before,
.hero-fullscreen::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.32;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.hero-fullscreen::before {
    width: 420px;
    height: 420px;
    background: #1E3A8A;
    top: -100px;
    left: -120px;
    animation: floatOrb 16s ease-in-out infinite;
}

.hero-fullscreen::after {
    width: 320px;
    height: 320px;
    background: #8B6914;
    bottom: -80px;
    right: -100px;
    animation: floatOrb 20s ease-in-out infinite reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(40px, -40px, 0); }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at top, rgba(0, 0, 0, 0.2), transparent 60%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
    z-index: 1;
    pointer-events: none;
    /* backdrop-filter rimosso: costo alto su area fullscreen, effetto trascurabile
       sopra a un gradiente già scuro con blur sugli orbs. */
}

/* Su mobile gli orbs blurrati sono ancora più costosi (GPU meno potente).
   Riduciamo blur, opacità e animazione per garantire 60fps. */
@media (max-width: 768px) {
    .hero-fullscreen::before,
    .hero-fullscreen::after {
        filter: blur(35px);
        opacity: 0.25;
        animation: none;
    }
}

/* Rispetta accessibilità: niente animazioni se l'utente le ha disabilitate. */
@media (prefers-reduced-motion: reduce) {
    .hero-fullscreen::before,
    .hero-fullscreen::after { animation: none; }
}

.hero-container-centered {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.hero-content {
    max-width: 800px;
    padding: var(--space-8);
}

.hero-welcome {
    font-family: 'Playfair Display', serif;
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin-bottom: var(--space-6);
    background: linear-gradient(135deg, #ffffff 0%, #DBEAFE 50%, #ffffff 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    animation: heroFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: var(--space-8);
    max-width: 680px;
    margin-inline: auto;
    line-height: 1.65;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    font-weight: 400;
    animation: heroFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.hero-btns-centered {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    animation: heroFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.btn-lg {
    padding: 18px 36px;
    font-size: 1.1rem;
}

.btn-white-outline {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.btn-white-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

/* --- ABOUT SECTION --- */
.about {
    padding: var(--space-16) 0;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
}

.about-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: var(--space-12);
    align-items: stretch;
}

.about-img {
    position: relative;
    padding: var(--space-3);
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
}

.about-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.about-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.about-content h3 {
    font-size: 2.2rem;
    margin-bottom: var(--space-4);
    color: var(--color-primary);
}

.about-content p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.about-content .btn {
    align-self: flex-start;
    margin-top: var(--space-4);
}

/* --- FEATURES SECTION --- */
.features {
    padding: var(--space-16) 0;
    background: var(--color-bg-base);
    border-bottom: 1px solid var(--color-border);
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-12) auto;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
}

.section-header p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
}

.feature-card {
    background: var(--color-bg-base);
    padding: var(--space-8) var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                border-color 0.3s ease,
                background 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -16px rgba(30, 58, 138, 0.2);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-number {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
    display: block;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-2);
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: var(--space-2);
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    font-weight: 700;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

/* --- CTA SECTION --- */
.cta-section {
    padding: var(--space-16) 0;
    background: var(--color-accent);
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.cta-section h2 {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
}

.cta-section p {
    font-size: 1.1rem;
    color: var(--color-text-main);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-inline: auto;
}



/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero h2 {
        font-size: 3.2rem;
    }
}

@media (max-width: 768px) {
    .hero-container {
        grid-template-columns: 1fr;
        padding-top: var(--space-12);
    }

    .hero-image-wrapper {
        min-height: 300px;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }


}

/* --- SECTION (generic) --- */
.section {
    padding: var(--space-16) 0;
    background: var(--color-bg-base);
    position: relative;
}

.section-alt {
    background: linear-gradient(180deg, var(--color-bg-alt) 0%, #F4F4EE 100%);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--color-text-main);
    text-align: center;
    margin-bottom: var(--space-12);
    letter-spacing: -0.025em;
    position: relative;
}

.section-title::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    margin: var(--space-3) auto 0;
    border-radius: var(--radius-full);
}

/* --- CATEGORY GRID --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
}

.category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-12) var(--space-6);
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--color-text-main);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                border-color 0.3s ease;
    overflow: hidden;
    isolation: isolate;
}

.category-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.04), rgba(139, 105, 20, 0.04));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.category-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 20px 40px -15px rgba(30, 58, 138, 0.25);
    transform: translateY(-6px);
}

.category-card:hover::before {
    opacity: 1;
}

.category-card:hover .category-icon {
    background: var(--color-primary);
    color: #fff;
    transform: scale(1.08) rotate(-4deg);
}

.category-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-bg-alt), #ECECEC);
    border-radius: 50%;
    color: var(--color-primary);
    font-size: 1.7rem;
    margin-bottom: var(--space-6);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.04);
}

.category-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: var(--space-2);
    color: var(--color-text-main);
    letter-spacing: -0.01em;
}

.category-card p {
    color: var(--color-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0;
}

/* --- FEATURE ICON --- */
.feature-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #DBEAFE, var(--color-bg-alt));
    color: var(--color-primary);
    border-radius: 18px;
    font-size: 1.5rem;
    margin-bottom: var(--space-4);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px -4px rgba(30, 58, 138, 0.2);
}

.feature-card:hover .feature-icon {
    transform: translateY(-4px) rotate(-6deg);
    box-shadow: 0 12px 24px -8px rgba(30, 58, 138, 0.35);
}

/* --- ABOUT IMAGE PLACEHOLDER --- */
.about-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.about-img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(30, 58, 138, 0.15), transparent 50%),
        linear-gradient(135deg, var(--color-bg-alt), var(--color-border));
    border-radius: var(--radius-xl);
    color: var(--color-primary);
    font-size: 5.5rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 20px 40px -20px rgba(30, 58, 138, 0.2);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-img-placeholder:hover {
    transform: scale(1.02) rotate(1deg);
}