/* Galaxy Tab / tablet touch layout overrides.
   Loaded after style.css to keep the tablet fixes isolated. */

@media (hover: none) and (pointer: coarse) and (min-width: 700px) and (max-width: 1368px) {
    html {
        scroll-padding-top: 92px;
    }

    body {
        overflow-x: hidden;
    }

    .container {
        width: min(100% - 28px, 1120px);
        padding-left: 14px;
        padding-right: 14px;
    }

    .section {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .navbar {
        min-height: 82px;
        overflow: visible;
    }

    .nav-container {
        min-height: 82px;
        gap: 14px;
        overflow: visible;
    }

    .logo img {
        max-height: 58px;
        max-width: min(42vw, 320px);
    }

    /* Pages with the real mobile menu. */
    #navbar .nav-container {
        padding-right: 88px;
    }

    #navbar .nav-actions > .btn {
        display: none !important;
    }

    #navbar .hamburger {
        position: fixed !important;
        top: 14px !important;
        right: 16px !important;
        bottom: auto !important;
        left: auto !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 58px;
        min-width: 58px;
        height: 58px;
        min-height: 58px;
        opacity: 1;
        visibility: visible;
        transform: none !important;
        pointer-events: auto;
        z-index: 7200;
    }

    #navbar .hamburger.active {
        transform: none !important;
    }

    #navbar .hamburger span {
        width: 26px;
        flex: 0 0 2.5px;
    }

    #navbar .nav-links {
        position: fixed !important;
        top: 86px !important;
        right: 14px !important;
        bottom: auto !important;
        left: auto !important;
        width: min(430px, calc(100vw - 28px));
        max-height: calc(100svh - 108px);
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 14px 18px 16px;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
        overflow-y: auto;
        overflow-x: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(0.98);
        z-index: 7190;
    }

    #navbar .nav-links.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    #navbar .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    #navbar .nav-links li:last-child {
        border-bottom: 0;
    }

    #navbar .nav-links a,
    #navbar .nav-dropdown-toggle {
        width: 100%;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 2px;
        color: var(--text-dark);
        font-size: 1rem;
        line-height: 1.2;
        white-space: normal;
    }

    #navbar .nav-dropdown-menu {
        position: static;
        width: 100%;
        padding: 0 0 8px 14px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }

    #navbar .mobile-only {
        display: block !important;
    }

    #navbar .mobile-lang-row {
        display: flex !important;
        gap: 8px;
        flex-wrap: wrap;
        padding: 8px 0 10px;
    }

    #navbar .mobile-lang-row button {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
    }

    /* SEO pages without hamburger: keep nav visible, compact and wrapping. */
    .navbar:not(#navbar) .nav-container {
        align-items: center;
        flex-wrap: wrap;
        row-gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .navbar:not(#navbar) .nav-links {
        flex: 1 1 100%;
        order: 3;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .navbar:not(#navbar) .nav-links a {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        padding: 7px 0;
        font-size: 0.92rem;
        white-space: normal;
    }

    .navbar:not(#navbar) .nav-actions {
        margin-left: auto;
    }

    .floating-lang-strip {
        top: auto !important;
        right: auto !important;
        left: 14px !important;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
        display: flex;
        width: clamp(210px, 32vw, 260px);
        min-height: 54px;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
        padding: 7px;
        z-index: 7100;
    }

    .floating-lang-strip button {
        flex: 1 1 20%;
        width: auto;
        min-width: 0;
        height: 38px;
        margin: 0;
    }

    .floating-booking-button,
    .mobile-booking-fab {
        position: fixed;
        right: 14px !important;
        left: auto !important;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
        display: inline-flex !important;
        width: auto;
        min-width: 138px;
        max-width: min(210px, 34vw);
        min-height: 54px;
        padding: 0 16px;
        white-space: normal;
        line-height: 1.12;
        z-index: 7090;
    }

    .luciotti-official-chat {
        right: 14px;
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
        min-height: 50px;
        max-width: min(240px, 36vw);
    }

    .hero {
        min-height: 720px;
        padding-top: 96px;
    }

    .hero-content {
        max-width: 760px;
        padding-top: 40px;
    }

    .hero h1,
    .booking-hero h1 {
        max-width: 10.5em;
        font-size: clamp(2.2rem, 6vw, 4.4rem);
        line-height: 1.02;
    }

    .hero-content > p,
    .booking-hero p,
    .seo-page-copy p {
        max-width: 720px;
        font-size: 1.02rem;
        line-height: 1.58;
    }

    .hero-map-link {
        right: 18px;
        bottom: 150px;
        width: min(26vw, 230px);
        max-width: 230px;
    }

    .seo-local-layout,
    .booking-grid,
    .contatti-grid,
    .seo-area-grid {
        grid-template-columns: 1fr;
    }

    .fleet-grid,
    .seo-fleet-section .fleet-grid,
    .sale-listings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 18px;
    }

    .vehicle-card,
    .sale-listing-card,
    .partner-card,
    .service-card {
        max-width: 100%;
    }

    .vehicle-info,
    .seo-fleet-card .vehicle-info {
        min-height: auto;
    }

    .search-box,
    .booking-form-panel,
    .booking-copy-card {
        max-width: min(100%, 900px);
        margin-left: auto;
        margin-right: auto;
    }

    .search-row,
    .form-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    input,
    select,
    textarea,
    button,
    .btn {
        touch-action: manipulation;
    }

    .btn {
        min-height: 44px;
        white-space: normal;
        line-height: 1.18;
    }
}

@media (hover: none) and (pointer: coarse) and (min-width: 700px) and (max-width: 980px) {
    .fleet-grid,
    .seo-fleet-section .fleet-grid,
    .sale-listings-grid {
        grid-template-columns: 1fr !important;
    }

    .search-row,
    .form-row {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: 660px;
    }

    .hero-map-link {
        position: static;
        width: min(220px, 42vw);
        margin: 24px auto 0;
    }
}
