/**
 * homepage.css — Frigotel front page styles
 *
 * Solid, well-illustrated layout with large photography sections.
 * All backgrounds are light (#FFFFFF or #F4F8FC) except Hero and CTA
 * which use the hero gradient (as per spec).
 *
 * Depends on: variables.css, components.css
 *
 * @package Frigotel
 */

.hp-hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 100%;
    height: 80vh;
    /* Reverted to stable Turn 18 version */

    /* Spacing System */
    gap: var(--space-m);
    margin-top: calc(var(--header-height) + var(--space-m));
    padding: 0 var(--space-m);
    padding-top: 0 !important;
    padding-bottom: 0;

    background: var(--color-bianco);
    position: relative;
    z-index: var(--z-base);
    overflow: visible;
}

/* Main Column (Left) */
.hp-hero-grid__main {
    grid-row: 1 / -1;
    /* Spans from first to last row */
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-card);
}

.hp-hero-grid__side {
    grid-row: 1 / -1;
    /* Also spans the full height to contain flex items */
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
    height: 100%;
}

.hp-hero-slider {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    /* Promote slider to its own GPU compositor layer */
    will-change: transform;
    transform: translateZ(0);
}

/* =========================================================
   SLIDE STATE CLASSES
   visibility: hidden removes inactive slides from the
   GPU compositor tree, freeing GPU memory and eliminating
   the multi-texture compositing bottleneck.
   ========================================================= */

/* Default: all slides are stacked and hidden from compositor */
.hp-hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    /* Slow crossfade — no JS animation frames needed */
    transition: opacity 1.5s ease;
    will-change: opacity;
    transform: translateZ(0);
    z-index: 0;
}

/* Active slide: fully visible, on top */
.hp-hero-slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Entering: visible but still transparent — compositor pre-renders it
   so the texture is ready before the fade animation begins */
.hp-hero-slide.is-entering {
    opacity: 0;
    visibility: visible;
    z-index: 1;
}

/* Leaving: fading out, must stay visible until transition ends */
.hp-hero-slide.is-leaving {
    opacity: 0;
    visibility: visible;
    z-index: 1;
    transition: opacity 1.5s ease, visibility 0s linear 1.5s;
}

.hp-hero-slide__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    will-change: opacity;
    /* Pre-optimize for transitions */
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Force GPU acceleration */
}

.hp-hero-slide__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* Keep image texture permanently resident in GPU VRAM.
       backface-visibility:hidden + perspective forces Chrome to treat
       each image as an independent compositor layer, preventing re-rasterization
       during fade transitions. */
    backface-visibility: hidden;
    perspective: 1000px;
    transform: translateZ(0);
}

.hp-hero-slide__overlay {
    position: absolute;
    inset: 0;
    /* Deep blue -> cyan gradient with reduced opacity */
    background: linear-gradient(135deg, rgba(13, 46, 107, 0.6) 0%, rgba(0, 87, 168, 0.5) 50%, rgba(0, 168, 232, 0.45) 100%);
    /* Multiply ensures the gradient blends with the image without washing out shadows */
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

.hp-hero-grid__main .hero-content {
    position: absolute;
    z-index: 5;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: var(--space-l);
    padding-inline: var(--space-xl);
    max-width: 1200px;
    /* Pointer events pass through to slides underneath */
    pointer-events: none;
}

.hp-hero-grid__main .hero-title {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    line-height: 1.1;
    margin-bottom: 0;
    color: var(--color-bianco);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hp-hero-grid__main .hero-subtitle {
    font-size: clamp(0.95rem, 1.2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.9);
    max-width: 950px;
}


/* Side Column (Right) */
.hp-hero-grid__side {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hp-hero-card {
    position: relative;
    flex: 1;
    overflow: hidden;
    padding: 12px var(--space-xl);
    /* Very slim top cards */
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-blu-profondo);
    text-decoration: none;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7), 0 1px 2px rgba(0, 0, 0, 0.5);
    /* Enhance readability over image backgrounds */
}

.hp-hero-card--services {
    flex: 2;
    /* Still double the size of others */
    background-color: var(--color-blu-profondo);
    border: none;
    align-items: center;
    justify-content: flex-start;
    padding: var(--space-xl);
    /* Services gets more padding to feel "larger" */
    text-shadow: none;
    /* No background image, no shadow needed */
}

/* Card 1 & 2: Classic site card styling (Cold light background, light blue border) */
.hp-hero-card--spare-parts,
.hp-hero-card--secondary {
    background-color: var(--color-sfondo-freddo);
    border: 1px solid var(--color-azzurro-tenue);
    text-shadow: none;
}

/* Decorative background image placed absolutely with more freedom, transparency, and no hover zoom */
.hp-hero-card__decor-img {
    position: absolute;
    bottom: -25%;
    right: -10%;
    width: 60%;
    height: auto;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    /* No transitions/transforms on hover */
}

/* Custom override for Services hero card: less transparent, higher up and shifted left */
.hp-hero-card--services .hp-hero-card__decor-img {
    bottom: -5%;
    right: -5%;
    opacity: 0.25;
    scale: 1.25;
}

/* Title and description text colors for readability on light background */
.hp-hero-card--spare-parts .hp-hero-card__title,
.hp-hero-card--secondary .hp-hero-card__title {
    color: var(--color-blu-profondo);
}

.hp-hero-card--spare-parts .hp-hero-card__desc,
.hp-hero-card--secondary .hp-hero-card__desc {
    color: var(--color-grigio-blu);
}

/* Chevron color matches the primary action color */
.hp-hero-card--spare-parts .hp-hero-card__chevron,
.hp-hero-card--secondary .hp-hero-card__chevron {
    color: var(--color-blu-primario);
}

/* Hover transitions matching the site's classic cards, no vertical raise */
.hp-hero-card--spare-parts:hover,
.hp-hero-card--secondary:hover {
    border-color: var(--color-ciano-chiaro);
    box-shadow: var(--shadow-hover);
}

.hp-hero-card--spare-parts:hover .hp-hero-card__chevron,
.hp-hero-card--secondary:hover .hp-hero-card__chevron {
    color: var(--color-ciano-accento);
}

.hp-hero-card__content {
    position: relative;
    z-index: 2;
    flex: 1;
    padding-right: var(--space-m);
}

.hp-hero-card__title {
    font-size: 1.25rem;
    /* Smaller title for side cards */
    font-weight: var(--font-weight-bold);
    margin-bottom: 2px;
    line-height: 1.2;
    color: var(--color-bianco);
}

.hp-hero-card--services .hp-hero-card__title {
    font-size: 1.75rem;
    /* Services title remains prominent */
    margin-bottom: var(--space-s);
}

.hp-hero-card__desc {
    font-size: 1.05rem;
    /* Larger description for readability on desktop */
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
}

.hp-hero-card--services .hp-hero-card__desc {
    font-size: 1.1rem;
    margin-bottom: var(--space-m);
}

/* Actions wrapper inside services card (replaces inline margin-top) */
.hp-hero-card__actions {
    margin-top: 15px;
}

.hp-hero-card__chevron {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-bianco);
    /* White chevron */
    transition: transform 0.3s ease;
}

.hp-hero-card__chevron svg {
    width: 32px;
    height: 32px;
}

.hp-hero-card:hover .hp-hero-card__chevron {
    transform: translateX(8px) scale(1.25);
    color: var(--color-ciano-chiaro);
    /* Subtle color change on hover */
}

/* Responsive Grid Update */
@media (max-width: 1199px) {
    .hp-hero-grid {
        display: block;
        /* Switch to block to allow natural flow and scrolling */
        height: auto;
        margin-top: calc(var(--header-height) + 12px);
        /* 12px offset from header */
        padding-inline: 12px;
        /* 12px side spacing */
        overflow: visible;
    }

    .hp-hero-grid__main {
        height: 46dvh;
        margin-bottom: 12px;
        /* 12px gap between carousel and cards */
        border-radius: var(--radius-m);
    }

    .hp-hero-grid__main .hero-content {
        padding-inline: var(--space-m);
        padding-bottom: 5px;
    }

    .hp-hero-grid__main .hero-title {
        font-size: clamp(1.6rem, 5vw, 2.2rem);
        margin-bottom: var(--space-m);
    }

    .hp-hero-grid__main .hero-subtitle {
        font-size: clamp(0.85rem, 2.8vw, 1rem);
    }

    .hp-hero-grid__side {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
        /* 12px gap between individual cards */
    }

    .hp-hero-card {
        height: auto;
        min-height: 140px;
        padding-block: var(--space-l);
        border-radius: var(--radius-m);
        margin-bottom: 0;
        /* Margin removed in favor of parent gap */
    }

    .hp-hero-card__desc {
        display: block;
        -webkit-line-clamp: initial;
        font-size: 0.9rem;
    }

    /* Adjust decorative background SVG icons on tablet/mobile to prevent stretching */
    .hp-hero-card__decor-img {
        width: 25%;
        max-width: 220px;
        min-width: 140px;
        height: auto;
        bottom: -20%;
        right: -5%;
    }

    .hp-hero-card--services .hp-hero-card__decor-img {
        bottom: -5%;
        right: 2%;
    }
}

/* =========================================================
   SHARED: Tag Label
========================================================= */

.hp-tag {
    display: inline-block;
    font-size: 14px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-blu-primario);
    margin-bottom: var(--space-m);
}

/* =========================================================
   SERVICE NETWORK SECTION
   Dynamic data visualization and statistics.
   ========================================================= */

.hp-network {
    background-color: #ffffff;
    padding-block: var(--space-xl);
    /* Isolate globe section layout from hero above */
    contain: layout style;
}

@media (min-width: 1000px) {
    .hp-network {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
        overflow: hidden;
    }

    .hp-network__header {
        margin-bottom: 0;
        position: relative;
        z-index: 2;
    }

    .hp-network__content {
        gap: 0;
        position: relative;
    }

    .hp-globe-no-box.hp-network__photo {
        max-width: 1100px;
        margin-top: -40px;
        margin-bottom: -160px;
        position: relative;
        z-index: 1;
    }

    #globeViz {
        height: 700px !important;
    }

    .hp-network__details {
        position: relative;
        z-index: 2;
    }
}



.hp-network__header {
    text-align: center;
    max-width: 760px;
    margin: 0 auto var(--space-m);
}

.hp-network__title {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: var(--font-weight-bold);
    color: var(--color-blu-profondo);
    line-height: 1.15;
    margin-bottom: var(--space-m);
}

.hp-network__lead {
    font-size: var(--text-body-large);
    color: var(--color-grigio-blu);
    line-height: 1.75;
}

.hp-network__content {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
    align-items: center;
}

.hp-network__photo {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(13, 46, 107, 0.12);
}

.hp-globe-no-box.hp-network__photo {
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    /* Consente all'alone di estendersi fuori dal riquadro */
    max-width: 800px;
}

#globeViz {
    width: 100%;
    height: 500px;
    /* Was inline style: moved to CSS */
    overflow: visible;
    /* Was inline style: allows atmosphere glow to overflow */
    display: block;
    /* Promote globe canvas to its own compositor layer and isolate its layout */
    will-change: transform;
    transform: translateZ(0);
    contain: strict;
}

/* 
   Override Globe.gl default tooltip styles. 
   !important is needed to win against library-injected inline styles.
*/
.scene-tooltip {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.hp-network__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 4 / 3;
}

/* Stats row — 3 cards side by side below the globe */
.hp-network__details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-l);
    width: 100%;
}

@media (max-width: 767px) {
    .hp-network__details {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 999px) {
    .hp-network__details {
        grid-template-columns: repeat(2, 1fr);
    }
}

.hp-stat {
    background: var(--color-sfondo-freddo);
    border: 1px solid var(--color-azzurro-tenue);
    border-radius: var(--radius-l);
    padding: var(--space-l);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-medium);
}

.hp-stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.hp-stat__number {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--color-blu-profondo);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.hp-stat__number span {
    color: var(--color-ciano-accento);
}

.hp-stat__heading {
    font-size: var(--text-heading-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-blu-profondo);
    margin-bottom: var(--space-xs);
}

.hp-stat p {
    font-size: var(--text-body-small);
    color: var(--color-grigio-blu);
    line-height: 1.5;
}

@media (max-width: 999px) {
    .hp-network__content {
        grid-template-columns: 1fr;
    }

    .hp-network__photo {
        max-height: 360px;
    }

    /* Full width but taller to give the globe more presence */
    .hp-network__photo.hp-globe-no-box {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        max-width: none;
        max-height: none;
        aspect-ratio: 0.8 / 1;
        /* Taller format for mobile */
        overflow: visible;
    }

    #globeViz {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 0.8 / 1;
        /* Taller for more vertical presence */
        overflow: visible !important;
        touch-action: pan-y !important;
        transform: scale(1.3);
        /* Significantly enlarged */
        margin-block: var(--space-xl);
        /* Add vertical breathing room for the scaled globe */
    }

    #globeViz canvas {
        touch-action: pan-y !important;
    }
}

.hp-app-promo {
    position: relative;
    padding-block: var(--space-3xl);
    min-height: 70vh;
    display: flex;
    align-items: center;
    background-color: var(--color-blu-profondo);
    overflow: hidden;
}

.hp-app-promo__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hp-app-promo__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    /* Sposta il fuoco verso destra per mostrare meglio il telefono */
    transition: transform 1s ease;
}

.hp-app-promo:hover .hp-app-promo__bg img {
    transform: scale(1.03);
}

.hp-app-promo__overlay {
    position: absolute;
    inset: 0;
    /* Sfumatura più scura a sinistra per il testo, molto trasparente a destra per il telefono */
    background: linear-gradient(to right, rgba(13, 46, 107, 0.95) 0%, rgba(13, 46, 107, 0.6) 45%, rgba(13, 46, 107, 0.05) 100%);
    z-index: 1;
}

.hp-app-promo__content {
    position: relative;
    z-index: 2;
    max-width: 520px;
    /* Ridotto da 650px per non sovrapporsi al telefono */
    color: var(--color-bianco);
    text-align: left;
}

.hp-tag--white {
    color: var(--color-bianco);
    opacity: 0.95;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hp-app-promo__title {
    font-size: clamp(2.25rem, 4.5vw, 3.25rem);
    font-weight: var(--font-weight-bold);
    line-height: 1.1;
    margin-bottom: var(--space-m);
    color: var(--color-bianco);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.hp-app-promo__desc {
    font-size: var(--text-body-large);
    line-height: 1.75;
    margin-bottom: var(--space-xl);
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

.hp-app-promo__actions {
    display: flex;
    gap: var(--space-m);
}

@media (max-width: 999px) {
    .hp-app-promo {
        min-height: auto;
        padding-block: var(--space-2xl);
    }

    .hp-app-promo__overlay {
        background: linear-gradient(180deg, rgba(13, 46, 107, 0.9) 0%, rgba(13, 46, 107, 0.5) 100%);
    }

    .hp-app-promo__bg img {
        object-position: 70% center;
    }

    .hp-app-promo__content {
        text-align: center;
        margin-inline: auto;
        max-width: 100%;
    }

    .hp-app-promo__actions {
        justify-content: center;
    }
}



/* =========================================================
   7. CALL TO ACTION (CTA)
   High-impact section with hero gradient.
   ========================================================= */

.hp-cta {
    background: var(--gradient-hero);
    padding-block: var(--space-3xl);
}

.hp-cta__block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 700px;
    margin-inline: auto;
    gap: var(--space-m);
}

.hp-cta__title {
    font-size: var(--text-heading-l);
    color: var(--color-bianco);
    line-height: var(--line-height-heading);
    letter-spacing: var(--letter-spacing-tight);
}

.hp-cta__text {
    font-size: var(--text-body-large);
    color: var(--color-ciano-chiaro);
    line-height: var(--line-height-body);
    max-width: 540px;
}

.hp-cta__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-m);
    margin-top: var(--space-s);
}

/* White CTA button on gradient backgrounds */
.btn--cta-white {
    background: var(--color-bianco);
    color: var(--color-blu-profondo);
    border-color: var(--color-bianco);
}

.btn--cta-white:hover,
.btn--cta-white:focus-visible {
    background: transparent;
    color: var(--color-bianco);
    border-color: var(--color-bianco);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
}

@media (max-width: 767px) {
    .hp-cta__actions {
        flex-direction: column;
        width: 100%;
    }

    .hp-cta__actions .btn {
        width: 100%;
    }

}