:root {
    /* Identidad Fuente Cabrina: blanco, negro, grises, beige, café */
    --pm-bg: #faf8f4;
    --pm-surface: #ffffff;
    --pm-text: #111111;
    --pm-muted: #6b6b6b;
    --pm-accent: #111111;
    --pm-border: #e4ddd2;
    --pm-beige: #f3eee6;
    --pm-beige-deep: #e8e0d4;
    --pm-divider: #8A6742;
    --pm-photo: clamp(96px, 28vw, 110px);
    --pm-photo-radius: 8px;
    --pm-card-gap: 20px;
    --pm-sticky-offset: 7.5rem;
    --pm-font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --pm-max: 1160px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--pm-bg);
    color: var(--pm-text);
    font-family: var(--pm-font);
}

.public-menu-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pm-bg);
    isolation: isolate;
}

/* ----- Portada de bienvenida (capa inicial) ----- */
body.is-welcome {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
    touch-action: none;
}

.pm-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
}

.pm-welcome {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 320ms ease;
}

.pm-welcome.is-leaving {
    opacity: 0;
    pointer-events: none;
}

.pm-welcome-bg {
    position: absolute;
    inset: -8%;
    z-index: 0;
    background-color: #d6c7b2;
    background-image: var(--pm-welcome-image, none);
    background-size: cover;
    background-position: center;
    filter: blur(10px);
    transform: scale(1.06);
    pointer-events: none;
}

.pm-welcome-veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    /* Más foto visible; contraste suficiente para logo/texto */
    background:
        linear-gradient(
            180deg,
            rgba(250, 248, 244, 0.38) 0%,
            rgba(243, 238, 230, 0.42) 48%,
            rgba(250, 248, 244, 0.5) 100%
        ),
        rgba(255, 255, 255, 0.08);
}

.pm-welcome-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 1.25rem;
    text-align: center;
    max-width: min(94vw, 560px);
}

.pm-welcome-logo {
    display: block;
    width: clamp(192px, 56vw, 264px);
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    filter: drop-shadow(0 6px 22px rgba(17, 17, 17, 0.14));
}

.pm-welcome-name {
    margin: 0;
    font-size: clamp(2.9rem, 10vw, 3.7rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #111111;
    line-height: 1.1;
    text-transform: uppercase;
}

.pm-welcome-tagline {
    margin: 0 0 0.25rem;
    max-width: 22ch;
    font-size: clamp(1rem, 3.6vw, 1.2rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.35;
    color: #2a2a2a;
}

.pm-welcome-enter {
    appearance: none;
    margin-top: 0.35rem;
    min-width: 10.5rem;
    min-height: 48px;
    padding: 0.8rem 2.1rem;
    border: 1px solid #111111;
    border-radius: 10px;
    background: #1a1a1a;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pm-welcome-enter:hover {
    background: #e8e4dc;
    color: #1a1a1a;
    border-color: #8a6742;
}

.pm-welcome-enter:focus-visible {
    outline: 2px solid #8a6742;
    outline-offset: 3px;
    background: #e8e4dc;
    color: #1a1a1a;
    border-color: #8a6742;
}

.pm-welcome-enter:active {
    background: #ddd6c8;
    color: #1a1a1a;
}

.public-menu-page::before {
    content: "";
    position: fixed;
    inset: -8%;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 18% 12%, rgba(160, 120, 80, 0.22), transparent 42%),
        radial-gradient(ellipse at 82% 78%, rgba(120, 90, 60, 0.16), transparent 48%),
        radial-gradient(ellipse at 50% 40%, rgba(200, 170, 130, 0.14), transparent 55%),
        linear-gradient(160deg, #e8dfd0 0%, #d9cbb8 45%, #cfc0a8 100%);
    background-size: cover;
    background-position: center;
    filter: blur(36px);
    opacity: 0.38;
    transform: scale(1.06);
}

.public-menu-page::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(250, 248, 244, 0.88) 0%, rgba(250, 248, 244, 0.82) 45%, rgba(243, 238, 230, 0.9) 100%),
        radial-gradient(circle at 12% 30%, rgba(80, 60, 40, 0.03) 0 2px, transparent 3px),
        radial-gradient(circle at 70% 60%, rgba(40, 30, 20, 0.025) 0 1.5px, transparent 2.5px);
    background-size: auto, 120px 120px, 90px 90px;
}

/* ----- Header compacto ----- */
.pm-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem 0.65rem;
    background: var(--pm-surface);
    border-bottom: 1px solid var(--pm-border);
}

.pm-logo {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex: 0 0 64px;
}

.pm-header-text {
    text-align: left;
    min-width: 0;
}

.pm-title {
    margin: 0;
    font-size: clamp(1.15rem, 3.5vw, 1.45rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--pm-text);
    line-height: 1.2;
}

.pm-subtitle {
    margin: 0.2rem 0 0;
    color: var(--pm-muted);
    font-size: 0.8rem;
    line-height: 1.3;
}

/* ----- Nav sticky ----- */
.pm-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.65rem 1rem;
    background: rgba(250, 248, 244, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pm-border);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pm-nav::-webkit-scrollbar {
    display: none;
}

.pm-nav-btn {
    flex: 0 0 auto;
    border: 1px solid var(--pm-border);
    background: var(--pm-surface);
    color: var(--pm-text);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pm-nav-btn:hover {
    border-color: #bdb5a8;
    background: var(--pm-beige);
}

.pm-nav-btn.is-active {
    border-color: #111111;
    color: #ffffff;
    background: #111111;
}

/* ----- Main ----- */
.pm-main {
    flex: 1;
    padding: 1rem 1rem 3.5rem;
    max-width: var(--pm-max);
    width: 100%;
    margin: 0 auto;
}

.pm-status {
    text-align: center;
    color: var(--pm-muted);
    padding: 2.5rem 1rem;
}

.pm-status.is-error {
    color: #333333;
}

.pm-empty {
    margin: 0;
    color: var(--pm-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0 1rem;
}

.pm-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ----- Secciones ----- */
.pm-category-section {
    scroll-margin-top: var(--pm-sticky-offset);
}

.pm-category-title {
    margin: 0 0 1rem;
    font-size: clamp(1.05rem, 2.8vw, 1.25rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #111111;
    background: var(--pm-beige);
    border: 1px solid var(--pm-border);
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    box-shadow: 0 1px 4px rgba(17, 17, 17, 0.06);
}

.pm-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ----- Productos: grid [foto | texto], una columna ----- */
.pm-card {
    position: relative;
    display: grid;
    grid-template-columns: var(--pm-photo) minmax(0, 1fr);
    column-gap: var(--pm-card-gap);
    row-gap: 0;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 24px 0.1rem;
    box-shadow: none;
}

.pm-card:hover {
    border-color: transparent;
}

/* Separador sutil solo bajo el bloque de texto (no atraviesa la foto) */
.pm-card + .pm-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: calc(var(--pm-photo) + var(--pm-card-gap));
    right: 0;
    height: 1px;
    background: rgba(17, 17, 17, 0.1);
    pointer-events: none;
}

.pm-card-media {
    position: relative;
    width: var(--pm-photo);
    height: var(--pm-photo);
    aspect-ratio: 1 / 1;
    border-radius: var(--pm-photo-radius);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.06);
    display: block;
    box-shadow: 0 1px 6px rgba(17, 17, 17, 0.06);
}

.pm-card-media::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, #f3eee6 20%, #ffffff 48%, #f3eee6 75%);
    background-size: 200% 100%;
    animation: pm-skel 1.35s ease-in-out infinite;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 0;
}

.pm-card-media.is-ready::before {
    opacity: 0;
    animation: none;
}

@keyframes pm-skel {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Fotos reales: cover homogéneo; fallback logo: contain */
.pm-card-img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #ffffff;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pm-card-img.is-loaded {
    opacity: 1;
}

.pm-card-img.is-fallback {
    object-fit: contain;
    object-position: center;
    padding: 12px;
    background: #ffffff;
    opacity: 1;
}

.pm-card-body {
    min-width: 0;
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.55rem;
    text-align: left;
}

.pm-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.3rem;
    width: 100%;
}

.pm-card-title {
    width: 100%;
    min-width: 0;
    margin: 0;
    font-size: clamp(0.98rem, 2.8vw, 1.08rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-transform: uppercase; /* Solo presentación Carta QR; no altera DB/POS */
    overflow-wrap: anywhere;
    word-break: break-word;
    color: var(--pm-text);
}

/* Línea café bajo el nombre — ancho del bloque de texto */
.pm-card-title::after {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    margin-top: 6px;
    margin-bottom: 2px;
    background: var(--pm-divider);
}

.pm-badges {
    flex: 0 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    max-width: 100%;
}

.pm-badge {
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 999px;
    background: #222222;
    color: #ffffff;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-badge.badge-oferta {
    background: #444444;
}

.pm-badge.badge-recomendado,
.pm-badge.badge-mas-vendido,
.pm-badge.badge-premium,
.pm-badge.badge-temporada,
.pm-badge.badge-agotado,
.pm-badge.badge-proximamente {
    background: #555555;
}

.pm-desc {
    margin: 0;
    color: var(--pm-muted);
    font-size: 0.82rem;
    line-height: 1.35;
    width: 100%;
}

.pm-price {
    margin: 0.1rem 0 0;
    font-weight: 700;
    color: var(--pm-accent);
    font-size: 0.98rem;
}

/* Sin descripción: precio sigue al bloque título/línea sin hueco grande */
.pm-card-header + .pm-price {
    margin-top: 0;
}

.pm-footer {
    text-align: center;
    padding: 1.1rem 1rem 1.4rem;
    color: var(--pm-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--pm-border);
    background: var(--pm-surface);
}

/* ----- Volver arriba ----- */
.pm-top {
    position: fixed;
    right: 1rem;
    bottom: 1.15rem;
    z-index: 50;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--pm-border);
    background: var(--pm-surface);
    color: var(--pm-text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.pm-top:hover {
    background: var(--pm-beige);
    border-color: #111111;
}

@media (min-width: 860px) {
    .pm-header {
        padding: 1rem 1.5rem 0.75rem;
    }

    .pm-nav {
        padding: 0.75rem 1.5rem;
        justify-content: flex-start;
    }

    .pm-main {
        padding: 1.35rem 1.5rem 4rem;
        max-width: 720px;
        margin: 0 auto;
        width: 100%;
    }

    .pm-cards {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .pm-card {
        padding: 26px 0.15rem;
    }
}

@media (max-width: 380px) {
    .pm-card {
        --pm-card-gap: 16px;
        padding: 20px 0.05rem;
    }

    .pm-card-title {
        font-size: 0.95rem;
    }

    .pm-logo {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
    }
}
