/* ==========================================================================
   menu.css — Full redesign of index.html (El Rey del Gusto customer menu)
   Loaded LAST on index.html only. Overrides styles.css / categories.css /
   cart.css by source order. cart.html and checkout.html never load this file.

   Principle: logical properties everywhere (inset-inline-*, margin-inline,
   text-align: start) so Arabic mirrors automatically via body[dir=rtl].
   ========================================================================== */

/* ---------------- Base / reset additions ---------------- */
html, body {
    overflow-x: clip;          /* decorative blobs must never break sticky nav */
}

button {
    font: inherit;
}

#menu-container {
    scroll-margin-top: 90px;   /* clears the sticky category nav when scrolled to */
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: inherit;
}

/* ---------------- Hero ---------------- */
.menu-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, var(--hero-bg), var(--hero-bg-2));
    padding: clamp(4rem, 10vw, 7rem) 20px;
    text-align: center;
}

.menu-hero-blob {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

.menu-hero-blob-a {
    top: -140px;
    inset-inline-start: -120px;
    background: radial-gradient(circle, var(--hero-accent) 0%, transparent 70%);
}

.menu-hero-blob-b {
    bottom: -160px;
    inset-inline-end: -120px;
    background: radial-gradient(circle, var(--price-copper) 0%, transparent 70%);
}

.dark .menu-hero-blob {
    opacity: 0.22;
}

.menu-hero .header {
    padding: 0;                /* hero provides the spacing */
}

.menu-hero .restaurant-name {
    color: var(--hero-text);
}

.menu-hero .tagline {
    color: var(--hero-muted);
}

.menu-hero .decorative-element {
    width: 72px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--hero-accent), transparent);
}

/* Table banner (injected into header.header for dine-in QR orders) reads on the dark hero */
.menu-hero .table-banner {
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Quick-contact chips */
.hero-chips {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-pill);
    color: var(--hero-text);
    font-size: 0.9rem;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

a.hero-chip:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--hero-accent);
    color: var(--hero-accent);
}

.hero-chip-icon {
    font-size: 1rem;
}

/* Hero CTAs */
.hero-ctas {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease,
                background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.hero-cta-primary {
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    color: #fff;
    box-shadow: 0 12px 30px -8px rgba(205, 127, 50, 0.5);
}

.hero-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px -8px rgba(205, 127, 50, 0.65);
}

.hero-cta-secondary {
    background: transparent;
    color: var(--hero-text);
    border: 1.5px solid rgba(247, 241, 232, 0.85);
}

.hero-cta-secondary:hover {
    background: var(--hero-text);
    color: var(--hero-bg);
    border-color: var(--hero-text);
}

/* ---------------- Contact section ---------------- */
.contact-section {
    margin-top: 56px;
}

.contact-grid {
    gap: 20px;
}

.contact-item {
    border: 1px solid var(--decorative-gray);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.contact-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.contact-item .icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border-radius: 50%;
    background: rgba(205, 127, 50, 0.12);
    background: color-mix(in srgb, var(--price-copper) 12%, transparent);
}

.social-btn {
    border: 1.5px solid var(--decorative-gray);
    box-shadow: none;
}

/* ---------------- Category navigation ---------------- */
.category-nav-wrapper {
    background: var(--card-bg);
    background: color-mix(in srgb, var(--card-bg) 85%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 var(--decorative-gray);
}

.category-btn {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: auto;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1.5px solid var(--decorative-gray);
    border-radius: var(--radius-pill);
}

.category-btn::before {
    display: none;             /* legacy copper overlay replaced by direct styling */
}

.category-btn:hover {
    transform: translateY(-2px);
    border-color: var(--price-copper);
    box-shadow: 0 6px 16px -6px rgba(205, 127, 50, 0.4);
}

.category-btn.active {
    background: var(--price-copper);
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    border-color: transparent;
    box-shadow: 0 6px 16px -6px rgba(205, 127, 50, 0.5);
}

.category-btn.active::before {
    display: none;
}

.category-icon {
    font-size: 1.25rem;
}

.category-name {
    font-size: 0.85rem;
}

.category-count {
    background: var(--surface-2);
    color: var(--text-dark-gray);
    font-weight: 600;
}

.category-btn.active .category-count {
    background: rgba(255, 255, 255, 0.9);
    color: var(--price-copper);
}

/* ---------------- Section headers ---------------- */
.menu-section {
    max-width: 1200px;
    margin: 0 auto 80px;
}

.section-header {
    margin-bottom: 40px;
}

.pizza-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border-radius: 50%;
    background: rgba(205, 127, 50, 0.12);
    background: color-mix(in srgb, var(--price-copper) 12%, transparent);
}

.section-header h2 {
    color: var(--text-black);
}

.section-header h2::after {
    left: 50%;
    transform: translateX(-50%);
}

/* ---------------- Menu cards (21st.dev "Menu Item Card" adaptation) ---------------- */
.menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--decorative-gray);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    /* Entrance: `backwards` fills only the delay, so hover transform still applies after */
    animation: card-in 0.45s ease backwards;
    animation-delay: calc(min(var(--i, 0), 12) * 45ms);
}

.menu-item::before {
    display: none;             /* legacy left accent bar removed */
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
}

@media (hover: hover) and (pointer: fine) {
    .menu-item:hover {
        transform: scale(1.03);
        box-shadow: var(--shadow-md);
        border-color: rgba(205, 127, 50, 0.4);
        border-color: color-mix(in srgb, var(--price-copper) 40%, var(--decorative-gray));
    }
}

.menu-item.featured {
    border-color: var(--price-copper);
    box-shadow: 0 0 0 1px var(--ring), var(--shadow-sm);
}

.menu-item.signature {
    background: linear-gradient(160deg, rgba(205, 127, 50, 0.08), var(--card-bg));
    background: linear-gradient(160deg, color-mix(in srgb, var(--price-copper) 8%, var(--card-bg)), var(--card-bg));
}

.dark .menu-item.signature {
    background: linear-gradient(160deg, rgba(217, 142, 74, 0.14), rgba(217, 142, 74, 0.05));
}

/* Media (image / placeholder) */
.item-media {
    position: relative;
    height: 192px;
    overflow: hidden;
}

.item-placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(140deg, #3a2a18, #6b4a26 55%, #8a5f33);
}

.item-placeholder-emoji {
    font-size: 3rem;
    opacity: 0.85;
}

.item-placeholder-initial {
    padding: 2px 10px;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: var(--radius-pill);
}

.item-img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

@media (hover: hover) and (pointer: fine) {
    .menu-item:hover .item-img {
        transform: scale(1.05);
    }
}

/* gradient scrim toward the bottom of the media */
.item-media::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to top, var(--overlay), transparent 55%);
}

/* badges & ribbons */
.item-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 3;
    padding: 4px 10px;
    background: var(--price-copper);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-pill);
}

.item-ribbon {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 3;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-pill);
}

.ribbon-signature {
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    color: #fff;
}

.ribbon-featured {
    background: linear-gradient(135deg, #d4a017, #b8860b);
    color: #fff;
}

/* ADD pill (overlaid on media; hidden until hover/focus on fine pointers) */
.card-add-btn {
    position: absolute;
    inset-inline: 0;
    bottom: 12px;
    margin-inline: auto;
    width: max-content;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 32px;
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1c;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border: none;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease,
                background-color 0.25s ease, color 0.25s ease;
}

.menu-item:hover .card-add-btn,
.menu-item:focus-within .card-add-btn {
    opacity: 1;
    transform: translateY(0);
}

.card-add-btn:hover {
    background: var(--price-copper);
    color: #fff;
}

/* body */
.item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    flex: 1;
}

.item-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.item-price {
    font-size: 1.15rem;
    white-space: nowrap;
}

.item-price-note {
    font-size: 0.75rem;
    color: var(--text-dark-gray);
    font-weight: 500;
}

.item-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-black);
    flex: none;
}

.item-ingredients {
    margin-top: auto;          /* pins short cards to equal height in a row */
    padding-top: 8px;
    font-size: 0.85rem;
    color: var(--text-dark-gray);
    line-height: 1.5;
}

/* ---------------- Item modal ---------------- */
.item-modal {
    background: rgba(12, 10, 8, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    max-width: 440px;
    padding: 0;
    border-radius: var(--radius-xl);
    border: 1px solid var(--decorative-gray);
    box-shadow: var(--shadow-lg);
    overflow: hidden auto;
}

.modal-media {
    height: 160px;
    background-color: #3a2a18;
    background-size: cover;
    background-position: center;
}

.modal-media.no-image {
    display: none;
}

.modal-pad {
    padding: 20px 24px 24px;
}

.modal-close {
    top: 12px;
    inset-inline-end: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    z-index: 5;
}

.modal-close:hover {
    background: var(--price-copper);
    color: #fff;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-black);
}

.modal-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--price-copper);
}

.modal-ingredients {
    color: var(--text-dark-gray);
    line-height: 1.6;
}

.modal-section h4 {
    color: var(--text-black);
}

.size-btn {
    flex: 1;
    padding: 12px;
    border: 1.5px solid var(--decorative-gray);
    background: var(--card-bg);
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.size-btn.active {
    border-color: var(--price-copper);
    background: var(--price-copper);
    color: #fff;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.quantity-selector button:hover {
    border-color: var(--price-copper);
    color: var(--price-copper);
}

.notes-input {
    border-radius: var(--radius-md);
}

.notes-input:focus {
    outline: none;
    border-color: var(--price-copper);
    box-shadow: 0 0 0 3px var(--ring);
}

/* modal confirm button (index.html only — cart.html loads no menu.css) */
.modal-content .add-to-cart-btn {
    padding: 14px;
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 12px 30px -8px rgba(205, 127, 50, 0.5);
}

.modal-content .add-to-cart-btn:hover {
    background: linear-gradient(135deg, var(--price-copper-hover), var(--price-copper));
    transform: translateY(-2px);
}

/* ---------------- QR + print button ---------------- */
.qr-section {
    border: 1px solid var(--decorative-gray);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

/* qrcodejs emits a <canvas>; the legacy styles.css only styled img */
#qrcode :is(img, canvas) {
    max-width: 250px;
    height: auto;
    background: #fff;
    border: 4px solid var(--bg-cream);
    border-radius: var(--radius-lg);
    padding: 8px;
}

.print-btn {
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    border-radius: var(--radius-pill);
}

.print-btn:hover {
    background: linear-gradient(135deg, var(--price-copper-hover), var(--price-copper));
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(205, 127, 50, 0.4);
}

/* ---------------- Floating controls ---------------- */
.language-selector {
    background: var(--card-bg);
    background: color-mix(in srgb, var(--card-bg) 82%, transparent);
    border: 1px solid var(--decorative-gray);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.theme-toggle {
    background: var(--card-bg);
    background: color-mix(in srgb, var(--card-bg) 82%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cart-notification {
    background: linear-gradient(135deg, var(--price-copper), var(--price-copper-hover));
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ---------------- Footer ---------------- */
.footer {
    background: var(--surface-2);
    color: var(--text-dark-gray);
    border-top: 1px solid var(--decorative-gray);
}

.dark .footer {
    background: #18191d;
    color: #a3a8af;
    border-top-color: #2a2d33;
}

.footer p {
    color: inherit;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
    .menu-hero {
        padding: 4rem 16px;
    }

    .hero-chip {
        flex: 1;
        justify-content: center;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-ctas {
        gap: 10px;
    }

    .hero-cta {
        width: 100%;
    }

    .item-media {
        height: 160px;
    }

    .modal-content {
        margin-inline: 8px;
    }

    .size-options {
        flex-wrap: wrap;
    }
}

/* Touch: ADD pill becomes an always-visible full-width bar between image and text */
@media (hover: none), (pointer: coarse) {
    .item-media {
        height: auto;
    }

    .item-media::after {
        top: 0;
        bottom: auto;
        height: 160px;
    }

    .item-placeholder {
        position: relative;
        height: 160px;
    }

    .item-img {
        position: absolute;
        top: 0;
        inset-inline: 0;
        height: 160px;
    }

    .card-add-btn {
        position: relative;
        inset-inline: auto;
        bottom: auto;
        margin: 0;
        width: 100%;
        border-radius: 0;
        padding: 14px;
        opacity: 1;
        transform: none;
    }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
    .menu-item {
        animation: none;
    }

    .menu-item:hover,
    .menu-item:hover .item-img,
    .hero-cta-primary:hover,
    .hero-cta-secondary:hover,
    .card-add-btn,
    .modal-content .add-to-cart-btn:hover {
        transform: none;
    }

    .card-add-btn {
        transition: none;
    }
}

/* ---------------- Print ---------------- */
@media print {
    .menu-hero-blob, .hero-chips, .hero-ctas, .category-nav-wrapper,
    .contact-section, .qr-section, .print-btn, .language-selector,
    .theme-toggle, .cart-icon-container, .cart-notification, .footer,
    .modal-media {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000;
    }

    .menu-hero {
        background: none;
        padding: 0;
    }

    .menu-hero .header {
        padding: 24px 0;
    }

    .menu-hero .restaurant-name {
        color: #000;
    }

    .menu-hero .tagline {
        color: #555;
    }

    .menu-item {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
        animation: none;
    }

    .item-media {
        display: none;
    }

    .card-add-btn {
        display: none !important;
    }

    .item-price {
        color: #000;
        font-weight: 700;
    }

    .menu-section {
        margin-bottom: 24px;
    }

    .section-header {
        page-break-after: avoid;
    }
}
