/*
 * Carta Digital QR — Sistema de diseño "Moderno minimalista cálido"
 * Implementación F8.0 según Especificacion_UX_Carta_Digital_QR.pdf v1.0 sec. 4.2
 *
 * Override por tenant: SOLO --color-primary y --color-accent
 * (inyectados inline en <head> desde tenants.color_primary/accent).
 * El resto del sistema permanece inmutable.
 */

/* ========================================================================
   0. FUENTES — Fraunces (display serif, variable, latin + latin-ext)
   ======================================================================== */
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fraunces-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fraunces-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ========================================================================
   1. TOKENS — Color
   ======================================================================== */
:root {
    /* Neutros cálidos (NO override por tenant) */
    --color-bg:          #FAF7F5;
    --color-surface:     #FFFFFF;
    --color-text:        #1A1A1A;
    --color-text-muted:  #555555;
    --color-text-soft:   #8A8A8A;
    --color-border:      #E6E1DD;

    /* Marca del tenant (override inline; defaults neutros) */
    --color-primary:     #7B2D3F;
    --color-accent:      #F5E2E5;

    /* Semánticos (NO override por tenant) */
    --color-success:     #2F5233;
    --color-warning:     #A66A1F;
    --color-danger:      #9B2B2B;
    --color-info:        #2D5A7B;

    /* ===========================================================
       2. TOKENS — Tipografía (system-ui en MVP, Manrope en post-MVP)
       =========================================================== */
    --font-stack-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                         Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial,
                         "Noto Sans", sans-serif;

    --font-serif:   'Fraunces', 'Charter', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

    --font-display: var(--font-serif);
    --font-h1:      var(--font-serif);
    --font-h2:      var(--font-serif);
    --font-body:    var(--font-stack-system);
    --font-meta:    var(--font-stack-system);
    --font-caption: var(--font-stack-system);

    --font-display-size: 34px;  --font-display-weight: 600;  --font-display-lh: 1.15;
    --font-h1-size:      26px;  --font-h1-weight:      600;  --font-h1-lh:      1.2;
    --font-h2-size:      19px;  --font-h2-weight:      600;  --font-h2-lh:      1.3;
    --font-body-size:    16px;  --font-body-weight:    400;  --font-body-lh:    1.5;
    --font-meta-size:    14px;  --font-meta-weight:    500;  --font-meta-lh:    1.45;
    --font-caption-size: 12px;  --font-caption-weight: 400;  --font-caption-lh: 1.45;

    /* ===========================================================
       3. TOKENS — Espaciado (retícula 8px, micro-step 4px)
       =========================================================== */
    --space-1:  4px;
    --space-2:  8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* ===========================================================
       4. TOKENS — Radios
       =========================================================== */
    --radius-sm:    6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-pill: 9999px;

    /* ===========================================================
       5. TOKENS — Sombras (alpha bajo 4-10% para sensación cálida)
       =========================================================== */
    --shadow-sm: 0 1px 2px  rgba(26, 26, 26, 0.04);
    --shadow-md: 0 4px 12px rgba(26, 26, 26, 0.06);
    --shadow-lg: 0 12px 32px rgba(26, 26, 26, 0.10);

    /* ===========================================================
       6. TOKENS — Motion
       =========================================================== */
    --motion-fast: 120ms ease-out;
    --motion-base: 200ms ease-out;
    --motion-slow: 320ms ease-in-out;
}

/* prefers-reduced-motion: anular todas las transiciones */
@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-fast: 0ms linear;
        --motion-base: 0ms linear;
        --motion-slow: 0ms linear;
    }
    *, *::before, *::after {
        animation-duration: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================================================
   7. RESET MÍNIMO
   ======================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--font-body-size);
    font-weight: var(--font-body-weight);
    line-height: var(--font-body-lh);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
    max-width: 100%;
    display: block;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: inherit;
}

/* ========================================================================
   8. ACCESIBILIDAD — foco visible (WCAG 2.1 AA)
   ======================================================================== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link (oculto visualmente, accesible al primer Tab) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--space-2);
    z-index: 100;
    background: var(--color-primary);
    color: #FFFFFF;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus,
.skip-link:focus-visible {
    left: var(--space-2);
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* Util visualmente oculto pero accesible para screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

/* Alpine.js x-cloak — esconde elementos con x-show hasta que Alpine arranque.
   Sin esta regla, los modales se renderizan visibles antes del primer paint
   (FOUC) hasta que Alpine procese el x-show. */
[x-cloak] {
    display: none !important;
}

/* Filtros aplicados sobre DOM (sin Alpine x-for) — F8 perf refactor */
.dish-card.is-hidden,
.category.is-hidden,
.cat-nav__chip.is-hidden {
    display: none !important;
}

/* Scroll lock cuando hay modal abierto */
body.modal-open {
    overflow: hidden;
}

/* ========================================================================
   9. LAYOUT
   ======================================================================== */
.layout {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .layout {
        padding: 0 var(--space-5);
    }
}

/* ========================================================================
   10. HEADER del establecimiento (PDF sec. 4.3.1)
   ======================================================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--color-bg);
    transition: box-shadow var(--motion-base), padding var(--motion-base);
    padding: var(--space-5) var(--space-4) var(--space-4);
}

.header.is-compact {
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-md);
}

/* Hero con foto del local edge-to-edge — cubre TODO el header */
.header.has-hero-image {
    position: relative;
    isolation: isolate;
    color: #fff;
    background: var(--color-bg);
    padding-top: var(--space-6);
    transition: padding var(--motion-base), box-shadow var(--motion-base), background var(--motion-slow), color var(--motion-slow);
}
.header.has-hero-image.is-compact {
    padding-top: var(--space-3);
    background: var(--color-bg);
    color: var(--color-text);
}
.header__hero {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    transition: opacity var(--motion-slow);
}
.header.has-hero-image.is-compact .header__hero { opacity: 0; }
.header__hero-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.header__hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,.10) 0%, rgba(0,0,0,.30) 50%, rgba(0,0,0,.65) 100%);
}

.header.has-hero-image .header__name        { color: #fff; text-shadow: 0 1px 18px rgba(0,0,0,.35); }
.header.has-hero-image .header__subtitle    { color: rgba(255,255,255,.92); }
.header.has-hero-image.is-compact .header__name     { color: var(--color-primary); text-shadow: none; }
.header.has-hero-image.is-compact .header__subtitle { color: var(--color-text-muted); }

/* Logo sobre foto: ligera ring blanca para destacar */
.header.has-hero-image .header__logo {
    box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 6px 20px rgba(0,0,0,.25);
}
.header.has-hero-image.is-compact .header__logo { box-shadow: none; }

.header__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.header__subtitle {
    font-family: var(--font-stack-system);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--color-text-muted);
    letter-spacing: 0.005em;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity var(--motion-base), max-height var(--motion-base);
}
.header.is-compact .header__subtitle { opacity: 0; max-height: 0; }

.header__bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    max-width: 880px;
    margin: 0 auto;
    min-height: 48px;
}
.header__bar .lang-switcher { order: 3; flex: 0 0 auto; }

.header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 0;
}

.header__logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex: 0 0 auto;
    transition: width var(--motion-base), height var(--motion-base);
}
.header.is-compact .header__logo {
    width: 40px;
    height: 40px;
}

.header__logo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #FFFFFF;
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 22px;
    text-transform: uppercase;
}

.header__name {
    font-family: var(--font-display);
    font-size: var(--font-display-size);
    font-weight: var(--font-display-weight);
    line-height: var(--font-display-lh);
    letter-spacing: -0.015em;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity var(--motion-base), font-size var(--motion-base);
}
.header.is-compact .header__name {
    font-size: 20px;
}

@media (max-width: 480px) {
    .header__name { font-size: 24px; }
    .header.is-compact .header__name { font-size: 18px; }
}

/* Hero meta — chip apertura + acciones rápidas (Maps/teléfono) */
.header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 0 auto;          /* desktop: empujada a la derecha del brand, antes del lang */
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    transition: opacity var(--motion-base), max-height var(--motion-base), margin var(--motion-base);
    overflow: hidden;
}
.header__meta.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0;
    pointer-events: none;
}
@media (max-width: 920px) {
    /* Tablet/móvil: meta a fila completa debajo del brand+lang */
    .header__meta {
        order: 3;
        flex-basis: 100%;
        margin: var(--space-3) 0 0 0;
    }
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 32px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 13px;
    line-height: 1;
    color: var(--color-text);
}
.status-pill__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--color-text-soft);
    flex: 0 0 auto;
}
.status-pill.is-open  { border-color: color-mix(in srgb, var(--color-success) 30%, transparent); background: color-mix(in srgb, var(--color-success) 8%, white); }
.status-pill.is-open  .status-pill__dot { background: var(--color-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 18%, transparent); }
.status-pill.is-closed { border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); background: color-mix(in srgb, var(--color-danger) 6%, white); }
.status-pill.is-closed .status-pill__dot { background: var(--color-danger); }
.status-pill__label { font-weight: 600; }
.status-pill__sub   { color: var(--color-text-muted); font-weight: 400; }
.status-pill__sub::before { content: '· '; color: var(--color-text-soft); }

.quick-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 32px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 13px;
    line-height: 1;
    color: var(--color-text);
    text-decoration: none;
    max-width: 100%;
    transition: border-color var(--motion-fast), background var(--motion-fast);
}
.quick-action svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--color-primary); }
.quick-action span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.quick-action:hover { border-color: var(--color-primary); background: var(--color-accent); }
.quick-action--tel { padding: 0 var(--space-2); }

@media (max-width: 480px) {
    .header__meta { gap: 6px; }
    .quick-action span { max-width: 160px; }
}

/* Pills/acciones translúcidos sobre el hero con foto */
.header.has-hero-image .status-pill,
.header.has-hero-image .quick-action {
    background: rgba(255,255,255,.92);
    border-color: rgba(255,255,255,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--color-text);
}
.header.has-hero-image .status-pill.is-open  { background: rgba(255,255,255,.95); }
.header.has-hero-image .quick-action svg     { color: var(--color-primary); }
.header.has-hero-image .lang-switcher__button {
    background: rgba(255,255,255,.92);
    border-color: rgba(255,255,255,.55);
    color: var(--color-text);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.header.has-hero-image.is-compact .status-pill,
.header.has-hero-image.is-compact .quick-action,
.header.has-hero-image.is-compact .lang-switcher__button {
    background: var(--color-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Toolbar (búsqueda + filtros) translúcida sobre el hero con foto */
.header.has-hero-image .search__input,
.header.has-hero-image .filters-button {
    background: rgba(255,255,255,.92);
    border-color: rgba(255,255,255,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--color-text);
}
.header.has-hero-image .search__icon { color: var(--color-text-muted); }
.header.has-hero-image .filters-button.has-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.header.has-hero-image.is-compact .search__input,
.header.has-hero-image.is-compact .filters-button {
    background: var(--color-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ========================================================================
   11. SELECTOR DE IDIOMA (PDF sec. 4.3.2)
   ======================================================================== */
.lang-switcher {
    position: relative;
    flex: 0 0 auto;
}

.lang-switcher__button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 56px;
    height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-size: var(--font-meta-size);
    font-weight: var(--font-meta-weight);
    line-height: 1;
    transition: border-color var(--motion-fast), background var(--motion-fast);
}
.lang-switcher__button:hover { border-color: var(--color-text-soft); }
.lang-switcher__button[aria-expanded="true"] {
    border-color: var(--color-primary);
    background: var(--color-accent);
}
.lang-switcher__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.lang-switcher__menu {
    position: absolute;
    top: calc(100% + var(--space-1));
    right: 0;
    min-width: 140px;
    padding: var(--space-1);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    list-style: none;
    z-index: 40;
}

.lang-switcher__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--font-body-size);
    line-height: 1.2;
}
.lang-switcher__item:hover { background: var(--color-bg); }
.lang-switcher__item.is-active {
    background: var(--color-accent);
    font-weight: 600;
}
.lang-switcher__check {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: var(--color-primary);
}

/* Fallback sin JS: form GET con select nativo */
.lang-switcher__noscript {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.lang-switcher__noscript select {
    height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
}

/* ========================================================================
   12. TOOLBAR (búsqueda + filtros) — PDF sec. 4.3.4 + 4.3.5
   ======================================================================== */
.toolbar {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-3) var(--space-4) var(--space-4);
    max-width: 880px;
    margin: 0 auto;
}

.search {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search__icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-soft);
    pointer-events: none;
}

.search__input {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-7) 0 calc(var(--space-3) + 24px + var(--space-2));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-size: var(--font-body-size);
    line-height: 1;
    color: var(--color-text);
    transition: border-color var(--motion-fast);
}
.search__input::placeholder { color: var(--color-text-soft); }
.search__input:focus,
.search__input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-color: var(--color-primary);
}

.search__clear {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-text-muted);
}
.search__clear:hover { background: var(--color-bg); color: var(--color-text); }

.filters-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-size: var(--font-meta-size);
    font-weight: var(--font-meta-weight);
    color: var(--color-text);
    flex: 0 0 auto;
}
.filters-button:hover { border-color: var(--color-text-soft); }
.filters-button.has-active {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}
.filters-button__icon {
    width: 18px;
    height: 18px;
}
.filters-button__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--space-1);
    border-radius: 10px;
    background: rgba(255,255,255,0.25);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.filters-button:not(.has-active) .filters-button__count {
    background: var(--color-primary);
    color: #FFFFFF;
}

/* ========================================================================
   13. GRID de categorías — vista filtro persistente
   ======================================================================== */
/* Barra de categorías compacta y fija (sustituye al mosaico de tiles) */
.cat-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar__inner {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    width: max-content;
    max-width: none;
}
.cat-chip {
    appearance: none;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}
.cat-chip.is-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.cat-chip__icon { font-size: 16px; line-height: 1; }

.cat-tiles {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0 var(--space-4);
}
.cat-tiles__inner {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (max-width: 599px) {
    .cat-tiles__inner { gap: var(--space-2); padding: 0 var(--space-3); }
}

.cat-tile {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    display: block;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    color: inherit;
}
.cat-tile:hover { border-color: var(--color-text-soft); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .06); }
.cat-tile:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cat-tile.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary), 0 6px 18px rgba(15, 23, 42, .08);
}

.cat-tile__media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--color-accent-soft);
    overflow: hidden;
    display: block;
}
.cat-tile__media img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Fallback sin foto: emoji XXL del icono de la categoría */
.cat-tile__fallback-emoji {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(48px, 12vw, 84px);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
    transition: transform 0.2s ease;
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg));
}
.cat-tile:hover .cat-tile__fallback-emoji { transform: scale(1.08); }

/* Fallback sin foto ni emoji: texto */
.cat-tile__fallback-name {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    padding: var(--space-3);
    font-family: var(--font-serif);
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--color-primary);
    word-break: break-word;
}

/* Etiqueta del tile (siempre debajo del media) */
.cat-tile__label {
    display: block;
    text-align: center;
    padding: var(--space-2) var(--space-2) var(--space-3);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
}

/* Sólo la categoría activa es visible (vista filtro persistente) */
.category { display: none; }
.category.is-active { display: block; }

/* Conmutador Comida / Bebidas */
.view-switch {
    display: flex;
    gap: var(--space-1);
    max-width: 880px;
    margin: var(--space-3) auto 0;
    padding: var(--space-1);
    background: var(--color-surface, #f4f1ec);
    border-radius: var(--radius-pill);
}
.view-switch__tab {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    border-radius: var(--radius-pill);
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.view-switch__tab.is-active {
    background: var(--color-primary);
    color: #fff;
}

/* Vista de bebidas: dos grupos (Con/Sin alcohol), categorías dentro */
.bebida-grupo { max-width: 880px; margin: 0 auto var(--space-6); }
.bebida-grupo__title {
    font-family: var(--font-h1);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
    padding: var(--space-4) var(--space-4) var(--space-2);
    border-bottom: 2px solid var(--color-border);
    margin: var(--space-4) var(--space-4) var(--space-3);
}
.bebida-categoria { padding: 0 var(--space-4); margin-bottom: var(--space-5); }
.bebida-categoria.is-hidden { display: none; }
.bebida-categoria__title { font-size: 1.1rem; }
.bebida-card { cursor: default; }

/* legacy (chips) — kept for backwards compat if reused elsewhere */
.cat-nav__chip {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-meta-size);
    font-weight: var(--font-meta-weight);
    text-decoration: none;
    transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}
.cat-nav__chip:hover { border-color: var(--color-text-soft); }
.cat-nav__chip.is-active {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}

/* ========================================================================
   14. CHIPS DE FILTROS ACTIVOS (bajo sticky-nav, PDF sec. 6.5)
   ======================================================================== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4) 0;
    max-width: 880px;
    margin: 0 auto;
}

.active-filter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 28px;
    padding: 0 var(--space-1) 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
}
.active-filter__remove {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-text-muted);
}
.active-filter__remove:hover { background: rgba(0,0,0,0.05); color: var(--color-text); }

.active-filters__clear-all {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 13px;
    text-decoration: underline;
}
.active-filters__clear-all:hover { color: var(--color-text); }

/* ========================================================================
   15. CATEGORÍAS y TARJETAS DE PLATO (PDF sec. 4.3.6)
   ======================================================================== */
.dishes {
    padding: var(--space-5) 0 var(--space-7);
    max-width: 880px;
    margin: 0 auto;
    /* Reserva espacio mínimo mientras Alpine renderiza categorías → evita CLS
       del footer cuando el contenido se infla. */
    min-height: 70vh;
}

.category {
    padding: 0 var(--space-4);
    margin-bottom: var(--space-6);
    scroll-margin-top: 64px; /* deja hueco bajo la barra de categorías sticky */
}

.category__title {
    font-family: var(--font-h1);
    font-size: var(--font-h1-size);
    font-weight: var(--font-h1-weight);
    line-height: var(--font-h1-lh);
    color: var(--color-text);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}
.category__icon {
    font-size: 1.1em;
    line-height: 1;
    align-self: center;
}
.category__count {
    font-size: var(--font-meta-size);
    font-weight: 400;
    color: var(--color-text-soft);
}

.category__description {
    font-size: var(--font-body-size);
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
    margin-top: calc(-1 * var(--space-2));
}

.dish-list {
    display: grid;
    gap: var(--space-5);
}

.dish-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast);
    text-align: left;
    width: 100%;
    border: 1px solid transparent;
}
.dish-card:hover { box-shadow: var(--shadow-md); }
.dish-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

@media (min-width: 560px) {
    .dish-card.has-photo {
        grid-template-columns: 1fr 160px;
        gap: var(--space-4);
    }
}

.dish-card.is-featured {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.dish-card.is-unavailable {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.dish-card__photo-wrap {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-accent);
    position: relative;
}
.dish-card__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dish-card__photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    opacity: 0.55;
}
.dish-card__photo-placeholder svg {
    width: 36px;
    height: 36px;
}

.dish-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.dish-card__row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
}

.dish-card__name {
    font-family: var(--font-h2);
    font-size: var(--font-h2-size);
    font-weight: var(--font-h2-weight);
    line-height: var(--font-h2-lh);
    color: var(--color-text);
    margin: 0;
}

.dish-card__price {
    font-family: var(--font-meta);
    font-size: var(--font-h2-size);
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dish-card__variants {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.dish-card__variants-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
}

.dish-card__desc {
    font-size: var(--font-body-size);
    line-height: var(--font-body-lh);
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dish-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* ========================================================================
   16. BADGES SECUNDARIOS (PDF sec. 4.3.8)
   ======================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 22px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }

.badge--vegan {
    background: rgba(47, 82, 51, 0.10);
    color: var(--color-success);
    border-color: rgba(47, 82, 51, 0.25);
}
.badge--vegetarian {
    background: rgba(47, 82, 51, 0.05);
    color: var(--color-success);
    border-color: rgba(47, 82, 51, 0.18);
}
.badge--spicy {
    background: rgba(166, 106, 31, 0.08);
    color: var(--color-warning);
    border-color: rgba(166, 106, 31, 0.25);
}
.badge--recommended {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}
.badge--unavailable {
    background: rgba(26, 26, 26, 0.06);
    color: var(--color-text-muted);
    border-color: rgba(26, 26, 26, 0.10);
}

/* ========================================================================
   17. CHIPS DE ALÉRGENO (PDF sec. 4.3.7) — NUNCA solo color
   ======================================================================== */
.allergens {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.allergen-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    background: rgba(155, 43, 43, 0.08);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}
.allergen-chip__icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}
.allergen-chip__icon svg { width: 14px; height: 14px; display: block; }

.allergen-chip.is-trazas {
    background: rgba(166, 106, 31, 0.06);
    color: var(--color-warning);
    border-color: var(--color-warning);
    border-style: dashed;
}
.allergen-chip__t {
    font-weight: 700;
    margin-left: 2px;
    opacity: 0.85;
}

/* Sabores (chips informativos) — en card y en detalle */
.flavors {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-2);
}
.dish-detail__flavors {
    margin: var(--space-2) 0 var(--space-3);
}
.dish-detail__flavors-title {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-1);
}
.flavor-line {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border);
}
.flavor-line:last-child { border-bottom: none; }
.flavor-line__name { font-weight: 500; }
.flavor-line__allergens { color: var(--color-text-soft, #6b6b6b); font-size: 13px; }
.flavor-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text);
    border: 1px solid var(--color-accent);
}

/* ========================================================================
   18. DETALLE EXPANDIDO — bottom-sheet móvil / modal centrado (PDF sec. 4.3.9 + 6.6)
   ======================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.40);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 768px) {
    .modal-backdrop {
        align-items: center;
        padding: var(--space-5);
    }
}

.modal {
    position: relative;  /* anclaje del modal__close absolute */
    background: var(--color-surface);
    width: 100%;
    max-height: 90vh;
    max-width: 560px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
    .modal {
        border-radius: var(--radius-lg);
        max-height: 85vh;
    }
}

.modal__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-border);
    margin: var(--space-2) auto var(--space-1);
    flex: 0 0 auto;
}
@media (min-width: 768px) { .modal__handle { display: none; } }

.modal__close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(26,26,26,0.06);
    color: var(--color-text);
    z-index: 2;
}
.modal__close:hover { background: rgba(26,26,26,0.12); }
.modal__close svg { width: 20px; height: 20px; }

.modal__scroll {
    overflow-y: auto;
    padding: 0 var(--space-5) var(--space-5);
    -webkit-overflow-scrolling: touch;
}

.dish-detail__photo {
    margin: 0 calc(-1 * var(--space-5)) var(--space-4);
    aspect-ratio: 16 / 10;
    background: var(--color-accent);
    overflow: hidden;
}
.dish-detail__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dish-detail__name {
    font-family: var(--font-h1);
    font-size: var(--font-h1-size);
    font-weight: var(--font-h1-weight);
    line-height: var(--font-h1-lh);
    color: var(--color-text);
    margin-bottom: var(--space-2);
    padding-right: var(--space-7);
}

.dish-detail__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.dish-detail__desc {
    font-size: var(--font-body-size);
    line-height: var(--font-body-lh);
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.dish-detail__allergens-section {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: 14px;
    line-height: 1.5;
}
.dish-detail__allergens-line {
    display: block;
    margin-bottom: var(--space-1);
}
.dish-detail__allergens-line:last-child { margin-bottom: 0; }
.dish-detail__allergens-label {
    font-weight: 700;
    color: var(--color-text);
}

.dish-detail__price-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
    font-variant-numeric: tabular-nums;
}
.dish-detail__price-row {
    display: flex;
    justify-content: space-between;
}
.dish-detail__price-row--main {
    font-size: var(--font-h2-size);
    font-weight: 700;
}
.dish-detail__price-row--variant {
    font-size: var(--font-meta-size);
    color: var(--color-text-muted);
}

/* ========================================================================
   19. FILTROS — bottom-sheet (PDF sec. 4.3.5 + 6.5)
   ======================================================================== */
.filters-panel {
    position: relative;
}

.filters-panel__title {
    font-family: var(--font-h1);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.filters-section {
    margin-bottom: var(--space-5);
}
.filters-section__title {
    font-size: var(--font-meta-size);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.filters-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.filter-option {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-meta-size);
    font-weight: var(--font-meta-weight);
    cursor: pointer;
}
.filter-option:hover { border-color: var(--color-text-soft); }
.filter-option.is-active {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}
.filter-option svg { width: 16px; height: 16px; }
.filter-option__icon { width: 14px; height: 14px; }

.filters-panel__actions {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    flex: 0 0 auto;
}
.filters-panel__actions button {
    flex: 1;
    height: 44px;
    border-radius: var(--radius-md);
    font-size: var(--font-meta-size);
    font-weight: 600;
}
.btn-primary {
    background: var(--color-primary);
    color: #FFFFFF;
    border: 1px solid var(--color-primary);
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-text-soft); }

/* ========================================================================
   20. ESTADOS DEFENSIVOS (PDF sec. 6.4 + 6.9)
   ======================================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-7) var(--space-5);
    max-width: 420px;
    margin: 0 auto;
}
.empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    color: var(--color-text-soft);
}
.empty-state__title {
    font-size: var(--font-h2-size);
    font-weight: var(--font-h2-weight);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}
.empty-state__body {
    font-size: var(--font-body-size);
    line-height: var(--font-body-lh);
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

/* ========================================================================
   21. FOOTER LEGAL (PDF sec. 4.3.10 + 6.11)
   ======================================================================== */
.footer-legal {
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-4) var(--space-7);
    margin-top: var(--space-7);
}
.footer-legal__inner {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font-size: var(--font-caption-size);
    line-height: var(--font-caption-lh);
    color: var(--color-text-muted);
}
.footer-legal__establishment {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    color: var(--color-text-muted);
}
.footer-legal__establishment span { white-space: nowrap; }
.footer-legal__disclaimer {
    color: var(--color-text-muted);
    line-height: 1.55;
}
.footer-legal__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}
.footer-legal__links a {
    color: var(--color-text-muted);
    text-decoration: underline;
    text-decoration-color: var(--color-border);
    text-underline-offset: 2px;
}
.footer-legal__links a:hover { text-decoration-color: var(--color-text-muted); }
.footer-legal__powered {
    color: var(--color-text-soft);
    font-size: 11px;
}

/* --- Chip estado apertura --- */
.footer-local-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}
.local-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}
.local-status-chip.is-open {
    background: #dcfce7;
    color: #15803d;
}
.local-status-chip.is-closed {
    background: var(--color-accent);
    color: var(--color-text-muted);
}
.local-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
}

/* --- Links sociales en footer --- */
.footer-links-social {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}
.footer-link-social {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--motion-fast), color var(--motion-fast);
}
.footer-link-social:hover {
    background: var(--color-accent);
    color: var(--color-primary);
}
.footer-link-social svg {
    flex-shrink: 0;
    stroke: currentColor;
}

/* ========================================================================
   22. NO-JS fallbacks
   ======================================================================== */
.no-js-only { display: none; }
html.no-js .js-only { display: none; }
html.no-js .no-js-only { display: revert; }
