/* ==============================================
   SOMMARIO FLOTTANTE - FLOATING INDEX
   Design ultra-minimal ed elegante
   ============================================== */

/* ==============================================
   TOGGLE FRECCIA TRA LOGO E HERO
   ============================================== */

.sommario-toggle-wrapper {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 8px;
    z-index: 100;
    transition: opacity 0.4s ease;
}

/* Nascondi la label quando il dropdown è aperto */
.hero-sommario-dropdown.active ~ .sommario-toggle-wrapper .sommario-toggle-label {
    opacity: 0;
    pointer-events: none;
}

.sommario-toggle-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: opacity 0.4s ease;
}

.sommario-toggle-hero {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.sommario-toggle-hero:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.sommario-toggle-hero svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sommario-toggle-hero.active svg {
    transform: rotate(180deg);
}

/* ==============================================
   SOMMARIO DROPDOWN NELLA HERO
   ============================================== */

.hero-sommario-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.98) 0%, rgba(10, 10, 15, 0.95) 100%);
    backdrop-filter: blur(40px);
    padding: 140px 0 60px 0;
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.hero-sommario-dropdown.active {
    transform: translateY(0);
}

.hero-sommario-dropdown.show-initial {
    animation: showAndHide 6.5s ease-in-out forwards;
}

@keyframes showAndHide {
    0% {
        transform: translateY(-100%);
    }
    8%, 92% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-100%);
    }
}

.sommario-dropdown-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
}

.sommario-dropdown-content h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 24px 0;
    text-align: center;
}

.sommario-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.sommario-item {
    margin: 0;
}

.sommario-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sommario-expand {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.4rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    margin-left: 8px;
    line-height: 1;
}

.sommario-item.expanded .sommario-expand {
    color: rgba(211, 228, 252, 0.8);
}

.sommario-item.expanded .sommario-expand::before {
    content: '-';
}

.sommario-item:not(.expanded) .sommario-expand::before {
    content: '+';
}

.sommario-submenu {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sommario-item.expanded .sommario-submenu {
    max-height: 400px;
}

.sommario-submenu li {
    margin: 0;
}

.sommario-submenu a {
    display: block;
    padding: 12px 20px 12px 32px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.01);
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    margin-top: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.sommario-submenu a::before {
    content: '•';
    position: absolute;
    left: 16px;
    color: rgba(211, 228, 252, 0.5);
    font-size: 1.2rem;
    line-height: 1;
}

.sommario-submenu a:hover {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: rgba(211, 228, 252, 0.5);
    color: rgba(255, 255, 255, 0.9);
    padding-left: 38px;
}

.sommario-submenu a:hover::before {
    color: rgba(211, 228, 252, 0.9);
}

.sommario-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sommario-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-2px);
}

.sommario-link:hover::before {
    transform: scaleY(1);
}

.sommario-text {
    display: block;
}

/* ==============================================
   PULSANTE FLOTTANTE
   ============================================== */

.floating-sommario-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: auto;
    height: 56px;
    padding: 0 24px 0 28px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: pointer;
    z-index: 1000;
    display: none; /* Nascosto di default, mostrato dopo scroll */
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-sommario-text {
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-sommario-btn svg {
    width: 20px;
    height: 20px;
    stroke: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-sommario-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(-8px) translateY(-4px);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.floating-sommario-btn:hover svg {
    transform: translateX(-4px);
}

.floating-sommario-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-8px);
}

.floating-sommario-btn.active svg {
    transform: rotate(180deg);
}

/* ==============================================
   MENU FLOTTANTE ESPANSO
   ============================================== */

.floating-sommario-menu {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: linear-gradient(135deg, rgba(15, 15, 25, 0.98) 0%, rgba(10, 10, 15, 0.98) 100%);
    backdrop-filter: blur(40px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 28px;
    width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.7),
        0 10px 30px rgba(211, 228, 252, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-sommario-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.floating-sommario-menu h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3.5px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(90deg, var(--accent), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.floating-sommario-menu .sommario-list {
    grid-template-columns: 1fr;
    gap: 10px;
}

.floating-sommario-menu .sommario-link {
    padding: 16px 20px;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.floating-sommario-menu .sommario-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(211, 228, 252, 0.1), transparent);
    transition: left 0.6s ease;
}

.floating-sommario-menu .sommario-link:hover::before {
    left: 100%;
}

.floating-sommario-menu .sommario-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(211, 228, 252, 0.3);
    transform: translateX(8px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(211, 228, 252, 0.15);
}

/* Animazione stagger per i link */
.floating-sommario-menu.active .sommario-item {
    animation: slideInStagger 0.5s ease-out backwards;
}

.floating-sommario-menu.active .sommario-item:nth-child(1) { animation-delay: 0.05s; }
.floating-sommario-menu.active .sommario-item:nth-child(2) { animation-delay: 0.1s; }
.floating-sommario-menu.active .sommario-item:nth-child(3) { animation-delay: 0.15s; }
.floating-sommario-menu.active .sommario-item:nth-child(4) { animation-delay: 0.2s; }
.floating-sommario-menu.active .sommario-item:nth-child(5) { animation-delay: 0.25s; }
.floating-sommario-menu.active .sommario-item:nth-child(6) { animation-delay: 0.3s; }

@keyframes slideInStagger {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrollbar personalizzata - molto più bella */
.floating-sommario-menu::-webkit-scrollbar {
    width: 8px;
}

.floating-sommario-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin: 8px 0;
}

.floating-sommario-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(211, 228, 252, 0.4), rgba(211, 228, 252, 0.6));
    border-radius: 10px;
    border: 2px solid rgba(10, 10, 15, 0.5);
    transition: all 0.3s ease;
}

.floating-sommario-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(211, 228, 252, 0.6), rgba(211, 228, 252, 0.8));
    border-color: rgba(10, 10, 15, 0.3);
}

/* ==============================================
   MOBILE RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .sommario-toggle-hero {
        width: 44px;
        height: 44px;
    }

    .hero-sommario-dropdown {
        padding: 120px 0 40px 0;
    }

    .sommario-dropdown-content {
        padding: 0 20px;
    }

    .sommario-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sommario-link {
        padding: 16px 20px;
        font-size: 0.9rem;
    }

    /* Pulsante flottante su mobile */
    .floating-sommario-btn {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    .floating-sommario-btn svg {
        width: 22px;
        height: 22px;
    }

    .floating-sommario-menu {
        bottom: 85px;
        right: 20px;
        left: 20px;
        width: auto;
        padding: 20px;
        max-height: 60vh;
    }

    .floating-sommario-menu h3 {
        font-size: 0.65rem;
        margin-bottom: 16px;
    }
}

@media (max-width: 480px) {
    .sommario-toggle-hero {
        width: 40px;
        height: 40px;
    }

    .sommario-toggle-hero svg {
        width: 16px;
        height: 16px;
    }

    .sommario-link {
        padding: 14px 16px;
        font-size: 0.85rem;
    }

    .floating-sommario-menu .sommario-link {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
}
