/* ============================================================
   MENU.CSS — Dimora Sovrana
   Stili specifici per menu.html.
   Richiede base.css caricato prima.
   Nota: .text-gold, variabili CSS, .backtotop-glass, scrollbar
         sono definiti in base.css — non duplicati qui.
   ============================================================ */


/* ------------------------------------------------------------
   1. OVERFLOW FIX SPECIFICO PAGINA
   ------------------------------------------------------------ */
html, body { overflow-x: hidden; position: relative; width: 100%; }
* { box-sizing: border-box; }
img        { max-width: 100%; }
nav        { overflow-x: hidden; }
nav .container { max-width: 100% !important; }
nav img    { max-width: 100%; height: auto; }


/* ------------------------------------------------------------
   2. LOADER PAGINA MENU (diverso da #page-loader di base.css)
   ------------------------------------------------------------ */
#menu-loader {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
#menu-loader.visible {
    opacity: 1;
    pointer-events: auto;
}

.loader-logo {
    display: block;
    width: 140px;
    height: 140px;
    transform-origin: center;
    margin: 0 auto;
}

.loader-text {
    font-size: 18px;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    max-width: 90vw;
    margin: 0 auto;
    border-right: 2px solid var(--color-gold);
    width: 0;
    animation: typing 1.5s steps(20) forwards, blink 0.7s infinite;
}

@keyframes typing { to { width: 20ch; } }
@keyframes blink  { 50% { border-color: transparent; } }


/* ------------------------------------------------------------
   3. VOCI DEL MENU
   ------------------------------------------------------------ */
.menu-item-row {
    border-bottom: 1px dashed rgba(232, 215, 185, 0.2);
    padding-bottom: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}
.menu-item-row:last-child { border-bottom: none; }

.menu-item-row h4             { font-size: clamp(1.4rem, 3vw, 1.5rem); }
.menu-item-row span.text-gold { font-size: clamp(1.5rem, 2vw, 1.7rem); }
.menu-item-row p              { font-size: clamp(0.9rem, 1.4vw, 1rem); }

/* Thumbnail e immagine espansa */
.menu-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}
.menu-image-expanded {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 16px;
    margin-top: 12px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.menu-item-row.expanded .menu-image-expanded { display: block; animation: fadeIn 0.35s ease forwards; }
.menu-item-row.expanded .menu-thumb          { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}


/* ------------------------------------------------------------
   4. BADGE
   ------------------------------------------------------------ */
.menu-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.05em;
    border: 1px solid;
}
.badge-veggy    { border-color: #4ade80; color: #4ade80; }
.badge-piccante { border-color: #f87171; color: #f87171; }
.badge-novita   { border-color: #E8D7B9; color: #E8D7B9; background: rgba(232,215,185,0.1); }


/* ------------------------------------------------------------
   5. TITOLI DI SEZIONE
   ------------------------------------------------------------ */
.menu-section-title { font-size: clamp(2.7rem, 4vw, 3.2rem); }
.menu-group-title   { font-size: clamp(2rem, 3vw, 2.2rem); }


/* ------------------------------------------------------------
   6. NAVIGAZIONE ZONE (sidebar desktop / carosello mobile)
   ------------------------------------------------------------ */
.zone-link {
    cursor: pointer;
    text-align: left;
    padding: 0.35rem 0;
    color: rgba(255,255,255,0.55);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: all 0.25s ease;
}
.zone-link:hover  { color: var(--color-gold); }
.zone-link.active {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
}

@media (max-width: 768px) {
    .zone-link {
        text-align: center;
        border-bottom-color: transparent;
        padding-bottom: 0.75rem;
        position: relative;
    }
    .zone-link.active::after {
        content: "";
        position: absolute;
        left: 50%; bottom: 0;
        transform: translateX(-50%);
        width: 80%; max-width: 260px;
        height: 2px;
        background-color: var(--color-gold);
        border-radius: 2px;
    }
}


/* ------------------------------------------------------------
   7. TAB CONTENT
   ------------------------------------------------------------ */
.tab-content { display: none; animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-content.active { display: block; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ------------------------------------------------------------
   8. TOOLTIP ALLERGENI
   ------------------------------------------------------------ */
.allergen-wrapper {
    position: relative;
    z-index: 30;
    cursor: pointer;
}
.allergen-icon {
    width: 20px; height: 20px;
    position: relative; z-index: 30;
}
.allergen-tooltip {
    position: absolute;
    bottom: 120%; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
@media (hover: hover) {
    .allergen-wrapper:hover .allergen-tooltip { opacity: 1; }
}
.allergen-tooltip.visible { opacity: 1; pointer-events: auto; }


/* ------------------------------------------------------------
   9. FRECCE NAVIGAZIONE MOBILE (carosello zone)
   ------------------------------------------------------------ */
.arrow-tip {
    display: block;
    width: 10px; height: 10px;
    border-top: 2px solid white;
    border-right: 2px solid white;
}
.arrow-left  { transform: rotate(-135deg); }
.arrow-right { transform: rotate(45deg); }


/* ------------------------------------------------------------
   10. HEADER SPECIFICO menu.html (header-glass)
   Non usa #siteHeader condiviso di base.css.
   ------------------------------------------------------------ */
#siteHeader {
    position: fixed;
    inset: 0;
    top: 0;
    height: 80px;
    background: transparent;
    z-index: 1100 !important;
    pointer-events: none;
}

#mobileMenuBtn {
    z-index: 1102 !important;
    pointer-events: auto !important;
}
#mobileMenuBtn i {
    stroke-width: 1.5px;
    color: var(--color-gold);
}

.header-inner {
    position: relative;
    z-index: 20;
    pointer-events: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Layer vetro sfumato */
.header-glass-bg {
    position: absolute;
    inset: 0; height: 100%;
    pointer-events: none; z-index: 1;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    mask-image: linear-gradient(to bottom, black 40%, transparent 90%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 90%);
    transition: opacity 0.4s ease;
}

/* Layer noise */
.header-noise {
    position: absolute;
    inset: 0; height: 100%;
    opacity: 0.08;
    mix-blend-mode: overlay;
    pointer-events: none; z-index: 2;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><filter id='n' x='0' y='0'><feTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.25'/></svg>");
    mask-image: linear-gradient(to bottom, black 30%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 80%);
    transition: opacity 0.4s ease;
}

.header-no-glass .header-glass-bg,
.header-no-glass .header-noise    { opacity: 0 !important; transition: opacity 0.4s ease; }
.header-no-glass .header-inner    { opacity: 1 !important; visibility: visible !important; pointer-events: auto; }
.header-no-glass img               { opacity: 1; transition: opacity 0.3s ease; }

body.header-always-visible #siteHeader,
body.header-always-visible #siteHeader.header-hidden,
body.header-always-visible #siteHeader.is-visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#siteHeader.header-open {
    background: transparent !important;
    backdrop-filter: none !important;
    border-bottom: none !important;
}


/* ------------------------------------------------------------
   11. SFONDO DINAMICO HERO
   ------------------------------------------------------------ */
#dynamic-bg {
    z-index: -1;
    background-size: cover;
    background-position: center;
    transition: background-image 0.8s ease-in-out, opacity 0.8s;
    opacity: 1;
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}
#dynamic-bg::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to right, rgba(10,10,10,0.7) 0%, rgba(10,10,10,0.4) 40%, rgba(10,10,10,0.1) 100%);
    pointer-events: none;
}
#dynamic-bg::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(10,10,10,0.6) 0%, rgba(10,10,10,0.4) 30%, rgba(10,10,10,0.2) 60%, transparent 100%);
    pointer-events: none;
}


/* ------------------------------------------------------------
   12. MOBILE NAV (specifico menu.html)
   ------------------------------------------------------------ */
#mobileNav {
    font-family: var(--font-sans);
    z-index: 1000 !important;
    background: rgba(5, 5, 5, 0.97);
}
#mobileNav.open {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.animate-slideDown { animation: menuFadeDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slideUp   { animation: menuFadeUp   0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes menuFadeDown {
    from { opacity: 0; transform: translateY(-15px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes menuFadeUp {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-15px); }
}

/* Link navigazione mobile */
.mobile-link {
    font-family: var(--font-display);
    color: white;
    font-size: 1.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: block;
}

.mobile-link.text-lg {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--color-gold);
    opacity: 0.7;
    margin-top: -10px;
    text-transform: none;
}

.mobile-link:active {
    color: var(--color-gold);
    transform: scale(0.96);
}

#mobile-menu-items span {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    color: var(--color-gold);
    letter-spacing: 0.4em;
    padding: 6px 16px;
    border: 1px solid rgba(232, 215, 185, 0.2);
    background: rgba(0,0,0,0.4);
    border-radius: 99px;
    margin-bottom: 1.5rem;
    display: inline-block;
}
