/* =============================================================================
   Casa Graziella — Mobile Quick-Access Bar
   Persistent bottom bar on mobile (<=768px): Appartamenti / Prenota /
   WhatsApp / Dove Siamo. Desktop: not rendered at all.

   Rendered as a sibling of <header>/<footer> in footer.php — never inside an
   element carrying backdrop-filter/transform/filter, which would become the
   containing block for its position:fixed (see the v2.1.0 regression).
   ============================================================================= */

.cg-qbar {
    display: none;
}

@media (max-width: 768px) {

    .cg-qbar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1150;   /* above .site-header (1000), below the nav overlay
                            (1200). The CookieYes banner (z-index 9999999) and
                            <dialog> top-layer modals both stay above this —
                            verified, see HISTORY v2.2.0. */
        background: var(--cg-black);
        border-top: 1px solid var(--cg-border);
        /* Clears the iPhone home indicator */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    .cg-qbar__list {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .cg-qbar__item {
        flex: 1 1 0;
        min-width: 0;
    }

    .cg-qbar__link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        min-height: 56px;      /* >= 44px touch target incl. the label */
        height: 100%;
        padding: 0.4rem 0.25rem;
        color: var(--cg-cream);
        text-decoration: none;
        text-align: center;
        transition: color var(--cg-transition), background var(--cg-transition);
    }

    .cg-qbar__icon {
        flex-shrink: 0;
        display: block;
    }

    .cg-qbar__label {
        font-family: var(--cg-font-body);
        font-size: 0.62rem;
        font-weight: 500;
        line-height: 1.2;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        /* Long EN labels ("Where We Are") must not wrap the bar open */
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cg-qbar__link:hover,
    .cg-qbar__link:focus-visible {
        color: var(--cg-gold);
    }

    .cg-qbar__link[aria-current="page"] {
        color: var(--cg-gold);
        box-shadow: inset 0 2px 0 0 var(--cg-gold);
    }

    /* Prenota — visually primary */
    .cg-qbar__link--primary {
        margin: 0.3rem;
        border-radius: 4px;
        background: var(--cg-gold);
        color: var(--cg-black);
        min-height: 50px;
    }

    .cg-qbar__link--primary:hover,
    .cg-qbar__link--primary:focus-visible {
        background: var(--cg-gold-lt);
        color: var(--cg-black);
    }

    .cg-qbar__link:focus-visible {
        outline: 2px solid var(--cg-gold);
        outline-offset: -2px;
    }

    /* Hidden while the fullscreen nav overlay is open — never two navigations
       at once. body.cg-nav-locked is set by js/mobile-nav.js on open. */
    body.cg-nav-locked .cg-qbar {
        display: none;
    }

    /* -----------------------------------------------------------------------
       Make room so the bar never covers page content or the footer.

       Since v2.3.0 the bar is the ONLY bottom-anchored fixed element — the
       floating WhatsApp button and the sticky CTA were removed as redundant,
       along with their collision offsets and the extra .site-footer
       padding-bottom that css/sticky-cta.css used to add. 56px is the bar's
       min-height (.cg-qbar__link); the safe-area inset matches the bar's own
       padding-bottom, so the two together clear the iPhone home indicator.
       ----------------------------------------------------------------------- */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

/* =============================================================================
   CookieYes floating revisit badge — kept down.

   The badge is turned off in the plugin (Cookie Banner > Content > Revisit
   Consent Button > Floating button) because at 'bottom-left' it lands on the
   quick bar's first item. Turning it off is not enough on its own: the badge
   markup ships in the banner template either way, carrying .cky-revisit-hide
   ({ display: none }), and CookieYes's _ckyToggleRevisit() *toggles* that class
   whenever a .cky-banner-element is clicked — which is exactly what the footer
   "Preferenze cookie" button does. Without the rule below, the first click on
   that button would put the badge back on screen, over the bar.

   If the floating badge is ever wanted again, delete this block AND move the
   quick bar / badge apart — do not just re-enable it in the plugin.
   ============================================================================= */
.cky-btn-revisit-wrapper {
    display: none !important;
}

/* Reduced motion: no colour/background transitions */
@media (prefers-reduced-motion: reduce) {
    .cg-qbar__link {
        transition: none !important;
    }
}
