/* ══════════════════════════════════════════════
   CROCI DI SICILIA – HERO CSS  v1.2.0
   Fix v1.2: bottoni visibili su mobile con
   Elementor (reset display/visibility forzati)
══════════════════════════════════════════════ */

/* ── FULL-WIDTH WRAPPER ── */
.csh-hero,
.csh-hero-wrap {
    display: block !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* ── ELEMENTOR RESET ── */
.elementor-widget-shortcode,
.elementor-widget-shortcode .elementor-widget-container,
.elementor-widget-shortcode .elementor-shortcode,
.elementor-section:has(.csh-hero-wrap),
.elementor-section:has(.csh-hero-wrap) .elementor-container,
.elementor-section:has(.csh-hero-wrap) .elementor-column,
.elementor-section:has(.csh-hero-wrap) .elementor-column-wrap,
.elementor-section:has(.csh-hero-wrap) .elementor-widget-wrap,
.e-con:has(.csh-hero-wrap),
.e-con-inner:has(.csh-hero-wrap) {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* ── ELEMENTOR MOBILE: forza visibilità bottoni ──
   Elementor su mobile può impostare display:none
   o visibility:hidden sugli elementi via CSS inline
   o tramite classi .elementor-hidden-mobile.
   Questo blocco sovrascrive tutto con !important. */
.csh-hero__actions,
.csh-hero__actions .csh-btn,
#csh-open-trailer,
#csh-open-trailer *,
.csh-btn--outline,
.csh-btn--primary {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;        /* sovrascritta poi dall'animazione stagger */
    pointer-events: auto !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
}
/* L'animazione stagger porta opacity a 0 inizialmente,
   poi la riporta a 1 con .is-visible – va bene così.
   Ma il display/visibility non devono mai essere none/hidden. */
.csh-hero.is-visible .csh-hero__actions,
.csh-hero.is-visible .csh-hero__actions .csh-btn,
.csh-hero.is-visible #csh-open-trailer {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ── RESET TEMI VARI ── */
.csh-hero-wrap,
.csh-hero-wrap *,
.entry-content .csh-hero,
.wp-block-shortcode .csh-hero,
.elementor-widget-shortcode .csh-hero,
.fl-module-content .csh-hero,
.vc_column-inner .csh-hero,
body .csh-hero {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.wp-block-shortcode,
.wp-block-group,
.entry-content > .wp-block-shortcode,
.entry-content > p:has(.csh-hero) {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    border: none !important;
}

.elementor-widget-shortcode .elementor-widget-container {
    padding: 0 !important;
    margin: 0 !important;
}

.entry-content:has(.csh-hero),
.post-content:has(.csh-hero),
.page-content:has(.csh-hero),
.site-content:has(.csh-hero) {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

/* ── BOX MODEL ── */
.csh-hero,
.csh-hero * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── SEZIONE HERO ── */
.csh-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
    background: #000;
    font-family: 'Poppins', sans-serif;
}

/* ── VIDEO BG ── */
.csh-hero__video-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.csh-hero__video-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}
.csh-hero__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}
.csh-hero__video.is-loaded {
    opacity: 1;
}

/* ── OVERLAY ── */
.csh-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.72) 0%,
        rgba(0,0,0,0.60) 40%,
        rgba(0,0,0,0.82) 75%,
        rgba(0,0,0,0.97) 100%
    );
    z-index: 2;
}

/* ── GRAIN ── */
.csh-hero__grain {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: .04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px;
    pointer-events: none;
}

/* ── CONTENUTO ── */
.csh-hero__content {
    position: relative;
    z-index: 4;
    text-align: center !important;
    padding: 0 20px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ── STAGGER ANIMAZIONI ── */
.csh-hero__title,
.csh-hero__divider,
.csh-hero__sub,
.csh-hero__actions {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .8s ease, transform .8s ease;
}
.csh-hero.is-visible .csh-hero__title   { opacity: 1; transform: translateY(0); transition-delay: .1s; }
.csh-hero.is-visible .csh-hero__divider { opacity: 1; transform: translateY(0); transition-delay: .35s; }
.csh-hero.is-visible .csh-hero__sub     { opacity: 1; transform: translateY(0); transition-delay: .55s; }
.csh-hero.is-visible .csh-hero__actions { opacity: 1; transform: translateY(0); transition-delay: .75s; }

/* ── TITOLO ── */
.csh-hero__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 900;
    font-size: clamp(72px, 13vw, 152px);
    line-height: .9;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -.025em;
    text-shadow: 0 4px 40px rgba(0,0,0,0.5);
    text-align: center !important;
    width: 100% !important;
}
.csh-hero__title span { display: block; }
.csh-tmid {
    font-size: clamp(32px, 5vw, 64px) !important;
    font-weight: 700 !important;
    letter-spacing: .2em !important;
    color: #C9A84C !important;
    opacity: .9;
    line-height: 1.5 !important;
}

/* ── DIVIDER ── */
.csh-hero__divider {
    width: 56px;
    height: 2px;
    background: #C8102E;
    margin: 26px auto 24px;
}

/* ── SOTTOTITOLO ── */
.csh-hero__sub {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(13px, 1.5vw, 16px);
    font-weight: 300;
    line-height: 1.8;
    color: rgba(255,255,255,.7);
    max-width: 560px;
    margin: 0 auto 44px;
    letter-spacing: .02em;
}

/* ── BOTTONI ── */
.csh-hero__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.csh-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 15px 32px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s, color .2s, border-color .2s;
    white-space: nowrap;
    line-height: 1;
    /* Touch: target minimo 44px */
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.csh-btn--primary {
    background: #C8102E;
    color: #fff;
}
.csh-btn--primary:hover {
    background: #a50d25;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(200,16,46,.45);
    color: #fff;
    text-decoration: none;
}
.csh-btn--outline {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,.45);
}
.csh-btn--outline:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.8);
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
}
.csh-btn__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ══════════════════════════════
   DIALOG TRAILER
══════════════════════════════ */
.csh-dialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    /* padding orizzontale/verticale: lascia spazio ai bordi su mobile */
    padding: 16px;
    /* Impedisce scroll del contenuto dietro */
    overscroll-behavior: contain;
}
.csh-dialog[aria-hidden="false"] {
    display: flex;
}
.csh-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.93);
    animation: cshBackdrop .3s ease both;
    cursor: pointer;
}
@keyframes cshBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Box del dialog:
   - max-width per desktop
   - max-height per evitare di sforare su schermi piccoli
   - display flex-column per header + video proporzionati */
.csh-dialog__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    /* Altezza massima: 90% della viewport - lascia margine in alto/basso */
    max-height: 90dvh;
    max-height: 90vh; /* fallback */
    display: flex;
    flex-direction: column;
    background: #080808;
    border: 1px solid rgba(201,168,76,.2);
    border-radius: 6px;
    overflow: hidden;
    animation: cshDialogIn .35s cubic-bezier(.4,0,.2,1) both;
    box-shadow: 0 32px 80px rgba(0,0,0,.85);
}
@keyframes cshDialogIn {
    from { opacity: 0; transform: scale(.94) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header: altezza fissa, non si restringe */
.csh-dialog__head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.csh-dialog__label {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #C9A84C;
    opacity: .85;
}
.csh-dialog__close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.5);
    width: 40px;
    height: 40px;
    min-width: 40px;   /* touch target adeguato */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color .2s, background .2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.csh-dialog__close:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}
.csh-dialog__close svg { width: 20px; height: 20px; }

/* Wrap video: occupa tutto lo spazio flex rimasto,
   mantiene proporzioni 16:9 senza sforare */
.csh-dialog__video-wrap {
    flex: 1 1 auto;
    position: relative;
    width: 100%;
    /* aspect-ratio come suggerimento; su mobile
       viene limitato dall'altezza flex */
    aspect-ratio: 16 / 9;
    background: #000;
    min-height: 0; /* fondamentale per flex shrink */
    overflow: hidden;
}
/* Scudo anti-download / tasto destro */
.csh-dialog__video-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.csh-dialog__video-inner {
    width: 100%;
    height: 100%;
}
.csh-dialog__video-inner video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain; /* contain su mobile: il video non viene tagliato */
    background: #000;
}

/* ══════════════════════════════
   RESPONSIVE – TABLET  (≤ 900px)
══════════════════════════════ */
@media (max-width: 900px) {
    .csh-dialog {
        padding: 12px !important;
    }
    .csh-dialog__box {
        max-height: 92dvh;
        max-height: 92vh;
    }
}

/* ══════════════════════════════
   RESPONSIVE – MOBILE  (≤ 768px)
══════════════════════════════ */
@media (max-width: 768px) {

    /* HERO */
    .csh-hero {
        height: 100svh !important;
        min-height: 500px !important;
    }
    .csh-hero__content {
        padding: 0 24px !important;
        justify-content: center !important;
    }
    .csh-hero__title {
        font-size: clamp(58px, 18vw, 100px) !important;
        letter-spacing: -.03em !important;
        line-height: .88 !important;
    }
    .csh-tmid {
        font-size: clamp(26px, 7vw, 48px) !important;
        letter-spacing: .15em !important;
    }
    .csh-hero__divider {
        margin: 20px auto 18px !important;
        width: 44px !important;
    }
    .csh-hero__sub {
        font-size: 13px !important;
        line-height: 1.7 !important;
        margin-bottom: 32px !important;
        padding: 0 4px !important;
    }
    /* Bottoni: colonna centrata, larghezza piena */
    .csh-hero__actions {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 320px !important;
    }
    .csh-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 15px 20px !important;
        font-size: 12px !important;
    }

    /* DIALOG su mobile:
       quasi fullscreen, solo un piccolo margine
       per far capire che si può toccare fuori */
    .csh-dialog {
        padding: 8px !important;
        align-items: flex-end !important;   /* sheet dal basso su mobile */
    }
    .csh-dialog__box {
        max-width: 100% !important;
        border-radius: 10px 10px 6px 6px !important;
        /* Usa dvh se disponibile, poi vh come fallback */
        max-height: 88dvh !important;
        max-height: 88vh !important;
    }
    .csh-dialog__head {
        padding: 12px 16px !important;
    }
    .csh-dialog__label {
        font-size: 10px !important;
        letter-spacing: .15em !important;
    }
}

/* ══════════════════════════════
   RESPONSIVE – PICCOLI (≤ 400px)
══════════════════════════════ */
@media (max-width: 400px) {
    .csh-hero__title {
        font-size: clamp(48px, 19vw, 72px) !important;
    }
    .csh-hero__sub {
        font-size: 12px !important;
    }
    .csh-dialog {
        padding: 0px !important;
        align-items: flex-end !important;
    }
    .csh-dialog__box {
        border-radius: 10px 10px 0 0 !important;
        max-height: 92dvh !important;
        max-height: 92vh !important;
    }
}
