/* ==========================================================================
   FOGLIO DI STILE UNIFICATO: style.css
   Progetto: Bar Terzo Millennio (Vetrina Digitale + Menù QR)
   ========================================================================== */


/* ==========================================================================
   PARTE 1: STILI GLOBALI E VETRINA DIGITALE (index.html)
   ========================================================================== */

/* --- 1.1 Scroll Fluido e Comportamento Base --- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* --- 1.2 Personalizzazione della Scrollbar per Desktop --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #FDFBF7; /* Colore Crema */
}

::-webkit-scrollbar-thumb {
    background: #B8860B; /* Colore Oro */
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9B7009; /* Oro scuro al passaggio del mouse */
}

/* --- 1.3 Effetto Ombra Header allo Scroll (attivato via JS) --- */
.header-scrolled {
    box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- 1.4 Animazione e Stile Card Sedi (index.html & contatti.html) --- */
.sede-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

@media (hover: hover) {
    .sede-card:hover {
        transform: translateY(-6px);
        border-color: rgba(184, 134, 11, 0.35);
    }
}

/* --- 1.5 Bottone Fisso WhatsApp con Messaggio Temporizzato (Tutte le pagine) --- */
.wa-floating,
.menu-page .wa-floating {
    position: fixed;
    right: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Montserrat", "Instrument Sans", system-ui, sans-serif;
    pointer-events: none;
}

/* Nel menù digitale teniamo il widget WhatsApp leggermente più in alto su mobile
   così non si sovrappone mai ai pulsanti "Torna alla home" e "Tutte le categorie" */
.menu-page .wa-floating {
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 68px));
}

.wa-bubble,
.menu-page .wa-bubble {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 999px;
    background: #ffffff;
    color: #16181A;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(37, 211, 102, 0.35);
    transform-origin: right center;
    animation: wa-bubble-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    transition: opacity 0.45s ease, transform 0.45s ease, visibility 0.45s ease;
    pointer-events: auto;
}

.wa-bubble--hidden,
.menu-page .wa-bubble--hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(14px) scale(0.9);
    pointer-events: none !important;
}

.wa-online-dot,
.menu-page .wa-online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25);
    flex-shrink: 0;
}

.wa-btn,
.menu-page .wa-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    pointer-events: auto;
}

.wa-btn:hover,
.menu-page .wa-btn:hover {
    background: #1ebe57;
    transform: scale(1.07);
    box-shadow: 0 8px 26px rgba(37, 211, 102, 0.6), 0 4px 10px rgba(0, 0, 0, 0.24);
}

.wa-btn:active,
.menu-page .wa-btn:active {
    transform: scale(0.95);
}

.wa-icon,
.menu-page .wa-icon {
    width: 30px;
    height: 30px;
    display: block;
}

@keyframes wa-bubble-in {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.88);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 480px) {
    .wa-floating,
    .menu-page .wa-floating {
        right: 12px;
        bottom: max(14px, env(safe-area-inset-bottom));
        gap: 8px;
    }
    .wa-bubble,
    .menu-page .wa-bubble {
        font-size: 0.78rem;
        padding: 9px 12px;
    }
    .wa-btn,
    .menu-page .wa-btn {
        width: 52px;
        height: 52px;
    }
    .wa-icon,
    .menu-page .wa-icon {
        width: 27px;
        height: 27px;
    }
}


/* ==========================================================================
   PARTE 2: MENÙ DIGITALE QR (menù.html)
   Ogni categoria porta i propri colori tramite le variabili --bg / --ink /
   --accent (definite nei dati del menù) su tutta la pagina.
   ========================================================================== */

/* --- 2.1 Variabili CSS e Reset Base del Menù --- */
:root {
    --page: #ECEEEF;
    --text: #16181A;
    --muted: #4A4F55;
    --font-display: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
    --font-text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.menu-page,
.menu-page *,
.menu-page *::before,
.menu-page *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.menu-page {
    background: var(--page);
    color: var(--text);
    font-family: var(--font-text);
    font-size: 1rem;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Quando si entra in una categoria, l'intera pagina prende il colore della categoria */
body.menu-page.in-category {
    background: var(--bg);
    color: var(--ink);
}

body.menu-page.in-category .top {
    display: none;
}

[hidden] {
    display: none !important;
}

/* Classi di accessibilità (Screen Reader e Focus) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.menu-page a:focus-visible,
.menu-page button:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

/* --- 2.2 Intestazione Menù (Logo e Costo Servizio) --- */
.top {
    text-align: center;
    padding: max(22px, env(safe-area-inset-top)) 16px 6px;
}

.logo {
    display: block;
    width: min(64vw, 260px);
    height: auto;
    margin: 0 auto;
}

.fee {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    border-radius: 999px;
    background: #2C3E50;
    color: #FFFFFF;
    border: 2px solid #B8860B;
    font-size: clamp(1.1rem, 4vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(44, 62, 80, 0.2);
}

/* --- 2.3 Griglia delle Categorie (Home del Menù) --- */
.grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 14px 18px;
}

.tile {
    --tilt: -7deg;
    position: relative;
    display: block;
    overflow: hidden;
    isolation: isolate;
    aspect-ratio: 1 / 1.12;
    border-radius: 22px;
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
    container-type: inline-size;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease;
}

.tile:active {
    transform: scale(0.97);
}

/* Disco colorato decorativo dietro l'illustrazione */
.tile::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: -16%;
    bottom: -16%;
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent);
}

.tile-title {
    display: block;
    padding: 16px 16px 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    font-size: clamp(1.1rem, 12cqi, 1.75rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    text-transform: lowercase; /* I titoli nei dati restano in maiuscolo originale */
}

.tile-title::first-letter {
    text-transform: uppercase;
}

.tile .ill {
    position: absolute;
    z-index: 1;
    right: -6%;
    bottom: -5%;
    width: 84%;
    height: auto;
    transform: rotate(var(--tilt));
    transform-origin: 60% 70%;
    transition: transform 0.25s ease;
}

/* Alternanza visiva: nella seconda colonna disco e illustrazione sono specchiati */
.grid li:nth-child(even) .tile {
    --tilt: 6deg;
}

.grid li:nth-child(even) .tile::before {
    right: auto;
    left: -16%;
}

.grid li:nth-child(even) .tile .ill {
    right: auto;
    left: -6%;
}

@media (hover: hover) {
    .tile:hover .ill {
        transform: rotate(0deg) translateY(-4px) scale(1.04);
    }
}

/* Stile comune alle illustrazioni SVG */
.ill {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- 2.4 Schermata Interna della Singola Categoria (Tutta la pagina nel colore della categoria) --- */
.cat {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
}

.cat-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--bg);
    color: var(--ink);
}

.cat-hero-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 28px;
    min-height: 240px;
    max-width: 760px;
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 18px 20px;
}

.cat-hero-inner::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: -16%;
    top: -8%;
    width: clamp(195px, 58vw, 340px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent);
}

.cat-hero .ill {
    position: absolute;
    z-index: -1;
    right: -3%;
    top: 4%;
    width: clamp(165px, 48vw, 290px);
    height: auto;
    transform: rotate(-6deg);
}

.cat-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 68%;
}

.cat-emoji-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--ink) 14%, var(--accent));
    color: var(--ink);
}

.cat-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 10vw, 3.6rem);
    line-height: 1;
    letter-spacing: -0.015em;
    text-transform: lowercase;
}

.cat-title::first-letter {
    text-transform: uppercase;
}

.cat-title:focus {
    outline: none;
}

.cat-subtitle {
    color: var(--ink);
    opacity: 0.92;
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.35;
}

/* --- Divisore Decorativo con Disegnino della Categoria --- */
.cat-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 760px;
    margin: 2px auto 6px;
    padding: 0 18px;
}

.cat-divider-line {
    flex: 1;
    height: 1.5px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--ink) 22%, transparent);
}

.cat-divider-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 2px 8px color-mix(in srgb, #000 12%, transparent);
}

.ill-mini {
    width: 26px;
    height: 26px;
}

/* --- 2.5 Pulsanti di Navigazione ("Indietro", "Torna alla home" e "Tutte le categorie") --- */
.btn-back,
.menu-page .btn-back {
    position: relative;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px 12px 16px;
    border: 0;
    border-radius: 999px;
    font: 600 1rem/1.1 var(--font-text);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn-back:active,
.menu-page .btn-back:active {
    transform: scale(0.97);
}

/* Garantisce che il click su qualsiasi punto del pulsante (testo, icona o bordo)
   venga sempre intercettato direttamente dal pulsante/link stesso */
.btn-back > *,
.menu-page .btn-back > *,
.btn-back svg,
.btn-back path,
.btn-back-label {
    pointer-events: none;
}

.btn-back--home,
.menu-page .btn-back--home {
    display: flex;
    width: fit-content;
    margin: 8px auto max(36px, env(safe-area-inset-bottom));
    padding: 14px 26px 14px 18px;
    background: #2C3E50;
    color: #fff;
    box-shadow: 0 6px 18px rgba(44, 62, 80, 0.28);
}

.btn-back svg,
.menu-page .btn-back svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-back--top,
.menu-page .btn-back--top {
    background: color-mix(in srgb, var(--ink) 18%, transparent);
    color: var(--ink);
}

/* Pulsante flottante in basso: ben visibile sullo sfondo colorato della categoria */
.btn-back--fab,
.menu-page .btn-back--fab {
    position: fixed;
    z-index: 9995;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    min-height: 52px;
    padding: 14px 26px 14px 18px;
    white-space: nowrap;
    background: var(--ink);
    color: var(--bg);
    box-shadow: 0 0 0 3px var(--accent),
                0 10px 26px rgba(0, 0, 0, 0.35);
}

.btn-back--fab:active,
.menu-page .btn-back--fab:active {
    transform: translateX(-50%) scale(0.97);
}

/* --- 2.6 Elenco Prodotti e Prezzi in Stile Categoria --- */
.cat-list-wrap {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

/* Disegnini SVG soffusi sullo sfondo della lista prodotti */
.cat-bg-ill {
    position: absolute;
    z-index: -1;
    width: clamp(180px, 52vw, 280px);
    height: auto;
    color: var(--accent);
    opacity: 0.22;
    pointer-events: none;
}

.cat-bg-ill--1 {
    left: -12%;
    top: 12%;
    transform: rotate(14deg);
}

.cat-bg-ill--2 {
    right: -12%;
    top: 46%;
    transform: rotate(-15deg);
}

.cat-bg-ill--3 {
    left: -10%;
    bottom: 14%;
    transform: rotate(10deg);
}

.cat-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 16px 18px;
}

/* Intestazione di sottosezione all'interno di una categoria (es. Antipasti, Bibite, Le Pizze) */
.cat-section-header,
.menu-page .cat-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 4px;
    padding: 0 4px;
}

.cat-list > .cat-section-header:first-child {
    margin-top: 4px;
}

.cat-section-title,
.menu-page .cat-section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.35rem, 5vw, 1.75rem);
    letter-spacing: 0.01em;
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 14%, var(--bg));
    border: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent);
    padding: 6px 16px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 8px color-mix(in srgb, #000 10%, transparent);
}

.cat-section-line,
.menu-page .cat-section-line {
    flex: 1;
    height: 1.5px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--ink) 28%, transparent);
}

.cat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--accent) 42%, var(--bg));
    border: 1.5px solid color-mix(in srgb, var(--ink) 16%, transparent);
    box-shadow: 0 4px 12px color-mix(in srgb, #000 8%, transparent);
    transition: transform 0.18s ease, background-color 0.18s ease;
}

@media (hover: hover) {
    .cat-item:hover {
        transform: translateY(-2px);
        background: color-mix(in srgb, var(--accent) 55%, var(--bg));
    }
}

/* Bollino con Emoji caratteristica del singolo prodotto */
.item-emoji {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 1.3rem;
    line-height: 1;
    background: color-mix(in srgb, var(--bg) 45%, var(--accent));
    border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 25%, transparent);
}

.item-body {
    flex: 1;
    min-width: 0;
}

.row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.name {
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.3;
    color: var(--ink);
    overflow-wrap: anywhere;
}

/* Puntini morbidi che collegano il nome al prezzo */
.dots {
    flex: 1;
    min-width: 12px;
    border-bottom: 2px dotted color-mix(in srgb, var(--ink) 28%, transparent);
    transform: translateY(-4px);
}

.price {
    flex: none;
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 15%, var(--bg));
    border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
    color: var(--ink);
    text-align: right;
    font-size: 0.98rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.desc {
    max-width: 58ch;
    margin-top: 4px;
    font-size: 0.9rem;
    line-height: 1.38;
    color: color-mix(in srgb, var(--ink) 82%, transparent);
}

/* Card conclusiva della categoria con disegnino SVG */
.cat-footer-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 728px;
    margin: 8px 16px 0;
    padding: 14px 18px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--ink) 10%, var(--bg));
    border: 1.5px dashed color-mix(in srgb, var(--ink) 26%, transparent);
    color: var(--ink);
    text-align: left;
}

@media (min-width: 760px) {
    .cat-footer-card {
        margin-left: auto;
        margin-right: auto;
    }
}

.cat-footer-ill {
    flex: none;
    width: 44px;
    height: 44px;
    transform: rotate(-6deg);
}

.cat-footer-text {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

/* --- 2.7 Animazioni, Transizioni e Media Queries --- */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pop-in {
    from { opacity: 0; transform: translateY(16px) rotate(-12deg) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) rotate(-6deg) scale(1); }
}

#home.enter,
.cat.enter {
    animation: fade-in 0.22s ease-out;
}

.cat.enter .cat-hero .ill {
    animation: pop-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nojs {
    padding: 24px 16px;
    text-align: center;
}

/* Adattamento per schermi grandi (Desktop / Tablet Orizzontale) */
@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        max-width: 1100px;
        gap: 16px;
    }
    .cat-hero-inner {
        min-height: 280px;
        padding-top: 22px;
    }
    .cat-list {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* Rispetto delle preferenze utente per riduzione movimento */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
