/* =========================
   RESPONSIVE NAVIGATION & BREAKPOINT REFINEMENTS
========================= */

.mobile-menu-toggle {
    display: none;
}

.mobile-menu-panel {
    --bs-offcanvas-width: min(390px, 88vw);
    background: var(--paper);
    color: var(--ink);
    border-left: 1px solid var(--line);
}

.mobile-menu-panel .offcanvas-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.mobile-menu-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: "Manrope", sans-serif;
    font-size: 18px;
    font-weight: 500;
}

.mobile-menu-brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.mobile-menu-panel .offcanvas-body {
    padding: 18px 24px 28px;
}

.mobile-menu-nav {
    display: grid;
}

.mobile-menu-nav a {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
    font-family: "Manrope", sans-serif;
    font-size: 20px;
    line-height: 1.2;
    transition: color .2s ease, padding-left .2s ease;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a:focus-visible,
.mobile-menu-nav a.active {
    color: var(--coral);
    padding-left: 6px;
}

.mobile-menu-socials {
    margin-top: 28px;
}

/* WhatsApp nel pannello mobile: stessa presenza visiva degli altri social. */
.mobile-menu-socials .whatsapp-link {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--slate);
}

.mobile-menu-socials .whatsapp-link svg {
    width: 20px;
    height: 20px;
}

/* =========================
   LAPTOP / DESKTOP INTERMEDIO
   1101–1550px
========================= */

@media (min-width:1101px) and (max-width:1550px) {
    .hero {
        grid-template-columns: 40% 60%;
    }

    .hero-copy {
        padding-left: clamp(38px,4vw,64px);
        padding-right: 24px;
    }

    .hero h1 {
        font-size: clamp(50px,4.45vw,70px);
        white-space: normal;
    }

    .gallery-track {
        margin-left: clamp(48px,5vw,78px);
        gap: 18px;
    }

    .portrait {
        flex-basis: clamp(195px,15.5vw,245px);
        height: clamp(400px,30vw,450px);
    }
}

/* =========================
   TABLET / SMALL LAPTOP
   fino a 1100px
========================= */

@media (max-width:1100px) {
    :root {
        --rail: 0px;
    }

    body {
        overflow-x: hidden;
    }

    .side-nav {
        position: sticky;
        top: 0;
        bottom: auto;
        width: 100%;
        height: 76px;
        padding: 0 clamp(18px,3vw,30px);
        flex-direction: row;
        justify-content: space-between;
        background: rgba(255,250,246,.98);
        border-right: 0;
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(12px);
        z-index: 40;
    }

    /* Su tablet/mobile il logo vive direttamente sulla navbar chiara:
       niente riquadro rosa separato, più spazio e maggiore leggibilità. */
    .side-logo {
        width: 132px;
        height: 72px;
        padding: 5px 0;
        border: 0;
        background: transparent;
        display: grid;
        place-items: center start;
        overflow: visible;
    }

    .side-logo img,
    .side-nav .side-logo img {
        width: 116px;
        height: 62px;
        max-width: 100%;
        object-fit: contain;
        object-position: center;
        transform: none;
        margin: 0;
    }

    .side-nav > nav,
    .side-contact,
    .side-socials {
        display: none;
    }

    .mobile-menu-toggle {
        width: 46px;
        height: 46px;
        padding: 0;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 1px solid var(--line);
        border-radius: 50%;
        background: var(--paper);
        color: var(--ink);
        cursor: pointer;
    }

    .mobile-menu-toggle span {
        width: 18px;
        height: 1.5px;
        background: currentColor;
        display: block;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        border-color: var(--coral);
        color: var(--coral);
    }

    main {
        margin-left: 0;
    }

    /* Sul tablet/mobile le tre immagini della hero restano allineate. */
    .gallery-track {
        align-items: center;
    }

    .portrait:nth-child(2) {
        transform: none;
    }

    /* Gerarchia insegnanti più vicina alla versione desktop. */
    .teachers .schedule-intro h2 {
        font-size: clamp(48px,6vw,66px);
        line-height: 1.02;
    }

    .teachers .schedule-intro > p:last-child {
        font-size: 16px;
        line-height: 1.6;
    }

    .teachers .schedule-intro .kicker {
        font-size: 10px;
    }

    /* Azioni flottanti ai due lati opposti. */
    .mobile-whatsapp-contact {
        position: fixed !important;
        left: 24px !important;
        right: auto !important;
        bottom: 24px;
        z-index: 60 !important;
    }
}

/* In portrait le sezioni principali usano la composizione verticale. */
@media (max-width:1100px) and (orientation:portrait) {
    .trial {
        grid-template-columns: 1fr;
        gap: 14px;
        padding-block: 34px;
    }

    .trial .pill {
        justify-self: start;
    }

    .hero {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .hero-copy {
        padding: 72px 30px 60px;
    }

    .hero h1 {
        white-space: normal;
    }

    .hero-gallery {
        min-height: 570px;
    }

    .gallery-track {
        margin-left: 30px;
    }

    .about {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .about-image {
        height: 540px;
    }

    .course-browser {
        grid-template-columns: 1fr;
    }

    .course-detail {
        min-height: 400px;
    }

    .schedule-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .schedule-summary {
        min-height: 280px;
    }

    .teachers {
        height: auto;
        min-height: 0;
        max-height: none;
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .balla-snella {
        height: auto;
        min-height: 0;
        max-height: none;
        grid-template-columns: 1fr;
    }

    .balla-image {
        min-height: 470px;
    }
}

/* iPad / tablet orizzontale: conserva la composizione a due colonne. */
@media (min-width:901px) and (max-width:1100px) and (orientation:landscape) {
    .hero,
    .about {
        grid-template-columns: 42% 58%;
    }

    .hero {
        min-height: 720px;
    }

    .hero-copy {
        padding: 64px 30px 60px clamp(30px,4vw,46px);
    }

    .hero h1 {
        font-size: clamp(46px,5vw,58px);
        white-space: normal;
    }

    .hero-copy > p:not(.kicker) {
        max-width: 320px;
    }

    .hero-gallery {
        min-height: 720px;
    }

    .gallery-track {
        margin-left: 34px;
        gap: 15px;
    }

    .portrait {
        flex: 0 0 clamp(170px,19vw,205px);
        height: 390px;
    }

    .hero-socials {
        top: 22px;
        right: 24px;
    }

    .teachers .schedule-intro {
        margin-bottom: 38px;
    }
}

/* Indicatore swipe corsi: creato via JS, visibile solo su smartphone. */
.mobile-course-indicator {
    display: none;
}

/* =========================
   SMARTPHONE
========================= */

@media (max-width:600px) {
    .side-nav {
        height: 72px;
        padding: 0 14px 0 16px;
    }

    .side-logo {
        width: 126px;
        height: 68px;
        padding: 4px 0;
        background: transparent;
        display: grid;
        place-items: center start;
    }

    .side-logo img,
    .side-nav .side-logo img {
        width: 108px !important;
        height: 60px !important;
        max-width: 108px;
        margin: 0;
        object-fit: contain;
        object-position: center;
    }

    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
    }

    .mobile-menu-panel {
        --bs-offcanvas-width: min(340px, 90vw);
    }

    .mobile-menu-panel .offcanvas-header {
        padding: 18px 20px;
    }

    .mobile-menu-panel .offcanvas-body {
        padding: 14px 20px 24px;
    }

    .mobile-menu-nav a {
        font-size: 18px;
        padding: 14px 0;
    }

    /* Hero gallery: carosello touch nativo, senza dipendenze JS. */
    .hero-gallery {
        min-height: 560px;
        overflow-x: auto !important;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 22px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        align-items: center;
        padding-top: 54px;
        padding-bottom: 20px;
    }

    .hero-gallery::-webkit-scrollbar {
        display: none;
    }

    .gallery-track {
        width: max-content;
        margin-left: 22px !important;
        margin-right: 22px;
        gap: 16px;
        transform: none;
        align-items: center;
    }

    .portrait {
        flex: 0 0 72vw;
        width: 72vw;
        height: min(470px,120vw);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* Corsi: una scheda alla volta e navigazione tramite swipe orizzontale. */
    .course-cards {
        padding-bottom: 0;
        touch-action: pan-y;
        overscroll-behavior-x: contain;
    }

    .course-controls {
        display: none;
    }

    .mobile-course-indicator {
        margin: 14px 0 26px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        color: var(--muted);
    }

    .mobile-course-indicator[hidden] {
        display: none;
    }

    .mobile-course-indicator-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
    }

    .mobile-course-indicator-arrow {
        width: 34px;
        height: 34px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: transparent;
        color: var(--slate);
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-course-indicator-arrow:active {
        background: var(--slate);
        border-color: var(--slate);
        color: var(--paper);
    }

    .mobile-course-indicator-count {
        min-width: 56px;
        text-align: center;
        color: var(--ink);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .16em;
    }

    .mobile-course-indicator small {
        font-size: 9px;
        letter-spacing: .08em;
    }

    .teachers .schedule-intro h2 {
        font-size: clamp(42px,12vw,52px);
    }

    .teachers .schedule-intro > p:last-child {
        font-size: 15px;
    }

    /* Orari: circa quattro attività visibili, le altre scorrono nel box. */
    .schedule-buttons {
        max-height: 278px;
        overflow-y: auto;
        overscroll-behavior: contain;
        scroll-snap-type: y proximity;
        padding-right: 5px;
        scrollbar-width: thin;
        scrollbar-color: var(--rose) transparent;
    }

    .schedule-buttons button {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .schedule-buttons::-webkit-scrollbar {
        width: 5px;
    }

    .schedule-buttons::-webkit-scrollbar-thumb {
        background: var(--rose);
        border-radius: 999px;
    }

    .schedule-buttons::-webkit-scrollbar-track {
        background: transparent;
    }

    .mobile-whatsapp-contact {
        position: fixed !important;
        left: 15px !important;
        right: auto !important;
        bottom: 15px !important;
        width: 44px;
        height: 44px;
        z-index: 60 !important;
    }
}
