/* EngagementLayer – stili isolati per retention utenti
   Nessun conflitto con Bootstrap, AdSense, sticky ads esistenti. */

/* ─── INLINE BOX ─────────────────────────────────────────── */
.el-inline {
    margin: 20px 0;
    border-top: 3px solid #e85d04;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 14px 16px;
    contain: layout style;
}
.el-inline__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #e85d04;
    margin: 0 0 10px;
}
.el-inline__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.el-inline__item {
    margin: 0;
    padding: 0;
}
.el-inline__item a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    touch-action: manipulation;
}
.el-inline__item a:hover,
.el-inline__item a:focus-visible {
    color: #e85d04;
}
.el-inline__thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background-color: #e4e4e4;
}
/* Tronca i titoli lunghi nell'inline list */
.el-inline__item a span {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* ─── STICKY BAR ─────────────────────────────────────────── */
.el-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1490;
    background: #fff;
    border-top: 3px solid #e85d04;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .13);
    padding: 10px 16px 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(105%);
    transition: transform .3s ease;
}
.el-sticky--visible {
    transform: translateY(0);
    will-change: transform;
}
.el-sticky__thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background-color: #e4e4e4;
}
.el-sticky__body {
    flex: 1;
    min-width: 0;
}
.el-sticky__link {
    text-decoration: none;
    display: block;
    touch-action: manipulation;
}
.el-sticky__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #e85d04;
    display: block;
    margin-bottom: 2px;
}
.el-sticky__title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.el-sticky__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 3px;
    touch-action: manipulation;
    /* Touch target WCAG 2.5.5: minimo 44×44px */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.el-sticky__close:hover {
    color: #333;
    background: #f0f0f0;
}

/* ─── EXIT INTENT OVERLAY ────────────────────────────────── */
.el-exit {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.el-exit--visible {
    opacity: 1;
    visibility: visible;
}
.el-exit__card {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 460px;
    /* Evita overflow su schermi piccoli */
    max-height: 85vh;
    overflow-y: auto;
    /* Previene lo scroll del body sotto l'overlay su iOS */
    overscroll-behavior: contain;
    padding: 22px 20px 18px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}
.el-exit__close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    line-height: 1;
    border-radius: 3px;
    touch-action: manipulation;
    /* Touch target WCAG 2.5.5 */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.el-exit__close:hover {
    color: #333;
    background: #f0f0f0;
}
.el-exit__heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #e85d04;
    margin: 0 0 14px;
    /* Lascia spazio al pulsante chiudi */
    padding-right: 32px;
}
.el-exit__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.el-exit__item {
    margin: 0;
    padding: 0;
}
.el-exit__item a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    touch-action: manipulation;
}
.el-exit__item a:hover,
.el-exit__item a:focus-visible {
    color: #e85d04;
}
.el-exit__item a span {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.el-exit__thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background-color: #e4e4e4;
}

/* ─── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 767px) {
    .el-sticky {
        padding: 8px 4px 8px 10px;
        /* Safe area per iPhone con notch / Dynamic Island */
        padding-bottom: 8px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        max-height: 80px;
    }
    .el-sticky__title {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }
    .el-exit__card {
        max-width: 100%;
        padding: 18px 14px 16px;
        max-height: 80vh;
    }
}

/* ─── FOCUS / ACCESSIBILITÀ ──────────────────────────────── */
/* Fallback per browser senza focus-visible */
.el-sticky__close:focus,
.el-exit__close:focus {
    outline: 2px solid #e85d04;
    outline-offset: 2px;
}
/* Rimuovi outline su click per mouse (solo tastiera) */
.el-sticky__close:focus:not(:focus-visible),
.el-exit__close:focus:not(:focus-visible) {
    outline: none;
}
