/* ============================================
   MOBILE NAV - Slide-in panel da destra
   Worst case viewport: 375px (iPhone SE)
   ============================================ */

/* Backdrop */
.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
}

.mobile-nav-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

/* Panel slide-in */
.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    max-width: 100vw;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mobile-nav-panel.is-open {
    transform: translateX(0);
}

/* Header del panel */
.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.mobile-nav-logo img {
    height: 34px;
    width: auto;
    display: block;
}

.mobile-nav-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #1d1d1f;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mobile-nav-close:hover,
.mobile-nav-close:active {
    background: #f5f5f7;
    transform: scale(0.95);
}

/* Badge Apophis row */
.mobile-nav-badge-row {
    padding: 16px 20px 8px;
    flex-shrink: 0;
}

.mobile-nav-apophis {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 12px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    text-decoration: none;
}

.mobile-nav-apophis img {
    height: 22px;
    width: auto;
    display: block;
}

.mobile-nav-apophis span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555;
}

/* Lista link */
.mobile-nav-list {
    padding: 8px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    text-decoration: none;
    color: #1d1d1f;
    font-size: 16px;
    font-weight: 500;
    min-height: 48px;
    transition: background 0.18s ease, transform 0.18s ease;
}

.mobile-nav-link i {
    flex-shrink: 0;
    width: 22px;
    font-size: 17px;
    color: #64748b;
    text-align: center;
}

.mobile-nav-link:hover {
    background: #f5f5f7;
}

.mobile-nav-link:active {
    background: #ebebef;
    transform: scale(0.98);
}

.mobile-nav-link.is-active {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.mobile-nav-link.is-active i {
    color: #2563eb;
}

.mobile-nav-sep {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 10px 16px;
}

/* Footer del panel - sticky in basso */
.mobile-nav-footer {
    padding: 16px 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    margin-top: auto;
}

.mobile-nav-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border: 1.5px solid #1d1d1f;
    border-radius: 14px;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    min-height: 50px;
    transition: all 0.18s ease;
}

.mobile-nav-area:hover {
    background: #1d1d1f;
    color: #fff;
}

.mobile-nav-area:active {
    transform: scale(0.98);
}

.mobile-nav-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-radius: 14px;
    text-decoration: none;
    min-height: 60px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mobile-nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.36);
}

.mobile-nav-cta:active {
    transform: scale(0.98);
}

.mobile-nav-cta i {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.mobile-nav-cta span {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.mobile-nav-cta strong {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
}

.mobile-nav-cta em {
    font-style: normal;
    font-size: 17px;
    font-weight: 700;
}

/* Body lock when nav is open */
body.mobile-nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Hide on desktop */
@media (min-width: 901px) {
    .mobile-nav-panel,
    .mobile-nav-backdrop {
        display: none;
    }
}

/* Tweaks per viewport molto piccoli (iPhone SE 375px) */
@media (max-width: 375px) {
    .mobile-nav-panel {
        width: 90vw;
    }

    .mobile-nav-header {
        padding: 16px 16px;
    }

    .mobile-nav-list {
        padding: 8px 8px 16px;
    }

    .mobile-nav-link {
        font-size: 15px;
        padding: 13px 14px;
        gap: 14px;
    }

    .mobile-nav-footer {
        padding: 14px 16px 20px;
    }
}

/* Squircle support */
@supports (background: paint(squircle)) {
    .mobile-nav-link,
    .mobile-nav-area,
    .mobile-nav-cta,
    .mobile-nav-apophis {
        border-radius: 0 !important;
        --squircle-radius: 14;
        --squircle-smooth: 0.8;
        -webkit-mask-image: paint(squircle);
        mask-image: paint(squircle);
    }
}
