/*
 * La Perla — la licorera (/lounge/tienda, pago y gracias).
 *
 * Va encima de hub.css + sitio.css: los tokens son los del portal (--bg,
 * --ink, --gold, --serif…). Las clases .store-* son el contrato con
 * store.js (ver CLAUDE.md, «Las sedes y la licorera»): se pueden restilizar, no
 * renombrar.
 */

/* ── Encabezado de la página (portada corta, la foto del lounge detrás) ─── */
.sp-head {
    position: relative; isolation: isolate; overflow: hidden;
    padding: calc(128px + env(safe-area-inset-top)) 0 34px;
}
.sp-head .hero__art { filter: saturate(0.6) brightness(0.42); }
.sp-head .hero__title { max-width: 14ch; }
.sp-head .hero__sub { margin-top: 2px; }
.sp-head .hero__perks { margin-top: 18px; }

/* ── Filtros: fijos bajo la cabecera ────────────────────────────────────── */
.store-bar {
    position: sticky; top: var(--sp-top-h, 72px); z-index: 20;
    background: rgba(6, 21, 18, 0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-block: 1px solid var(--line);
}
.store-filters { display: flex; gap: 8px; padding: 12px 0; overflow-x: auto; scrollbar-width: none; }
.store-filters::-webkit-scrollbar { display: none; }
.store-chip {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
    font-size: 0.85rem; color: var(--ink-2); transition: all 0.2s;
}
.store-chip:hover { color: var(--ink); border-color: rgba(243, 237, 224, 0.35); }
.store-chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Catálogo ───────────────────────────────────────────────────────────── */
.store-catalog { padding-bottom: 40px; }
.store-cat { padding-top: 34px; scroll-margin-top: calc(var(--sp-top-h, 72px) + 70px); }
.store-cat.is-hidden { display: none; }
.store-cat-title {
    display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px;
    font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1;
    font-variation-settings: 'opsz' 144, 'SOFT' 30;
}
.store-cat-title small { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 14px; }

.store-card {
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--line); border-radius: 18px;
    background: linear-gradient(180deg, rgba(243, 237, 224, 0.045), rgba(243, 237, 224, 0.015));
    transition: transform 0.3s var(--ease), border-color 0.3s;
}
.store-card:hover { transform: translateY(-3px); border-color: rgba(217, 181, 102, 0.45); }
.store-card-media {
    aspect-ratio: 1; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 50% 40%, rgba(217, 181, 102, 0.14), transparent 62%), var(--bg-2);
}
.store-card-media img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.45)); }
.store-card-noimg { width: 100%; height: 100%; display: grid; place-items: center; }
.store-card-noimg span { font-family: var(--serif); font-style: italic; font-size: 3.2rem; color: rgba(217, 181, 102, 0.55); }
.store-card-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.store-card-name { font-family: var(--serif); font-weight: 400; font-size: 1.12rem; line-height: 1.15; font-variation-settings: 'opsz' 72, 'SOFT' 40; }
.store-card-desc { font-size: 0.82rem; line-height: 1.45; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.store-card-stock { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; color: #e39b8a; }
.store-card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.store-card-price { font-family: var(--serif); font-size: 1.3rem; line-height: 1; color: var(--gold-2); }
.store-add {
    min-height: 44px; padding: 0 18px; border-radius: 999px;
    background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink);
    font-size: 0.88rem; font-weight: 600; white-space: nowrap;
    transition: transform 0.2s var(--ease), background 0.2s, color 0.2s;
}
.store-add:hover { transform: translateY(-1px); }
.store-add.added { background: var(--bg-3); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--gold); }
.store-empty-wrap { padding: 40px 0 80px; }

/* ── La barra del pedido (abajo, cuando hay algo en el carrito) ─────────── */
.sp-cartbar {
    position: fixed; z-index: 35; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 10px 10px 18px; border-radius: 18px; text-align: left;
    background: rgba(10, 31, 26, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(217, 181, 102, 0.45); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    transform: translateY(160%); opacity: 0; pointer-events: none; visibility: hidden;
    transition: transform 0.35s var(--ease), opacity 0.35s, visibility 0s linear 0.35s;
}
.has-cart .sp-cartbar { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.cart-open .sp-cartbar { transform: translateY(160%); opacity: 0; pointer-events: none; visibility: hidden; }
.sp-cartbar small { display: block; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.sp-cartbar b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.1rem; line-height: 1.15; }
.sp-cartbar__go {
    flex: none; padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
    background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink);
}
@media (min-width: 900px) { .sp-cartbar { left: auto; right: 24px; width: min(460px, 60vw); } }

/* El contador del botón de la cabecera. */
.store-cart-count {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px;
    background: var(--gold-2); color: var(--gold-ink); font-size: 0.7rem; font-weight: 700;
}

/* ── El pedido: panel a la derecha; en el celular, hoja desde abajo ─────── */
.store-drawer-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(3, 10, 8, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    opacity: 0; transition: opacity 0.3s;
}
.store-drawer-overlay.show { opacity: 1; }
.store-drawer {
    position: fixed; z-index: 95; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
    display: flex; flex-direction: column;
    background: var(--bg-2); border-left: 1px solid var(--line); box-shadow: -30px 0 60px rgba(0, 0, 0, 0.4);
    transform: translateX(104%); visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0s linear 0.3s;
}
.store-drawer.open { transform: none; visibility: visible; transition: transform 0.3s var(--ease); }
.store-drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.store-drawer-head h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1; }
.store-drawer-close {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--line); color: var(--ink-2); font-size: 1.5rem; line-height: 1;
}
.store-drawer-close:hover { color: var(--ink); border-color: rgba(243, 237, 224, 0.35); }
.store-drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 24px; }
.store-done { padding: 26px 22px; color: var(--ink-2); line-height: 1.6; }

.store-cart-items { display: grid; gap: 10px; }
.store-cart-item {
    display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center;
    padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(243, 237, 224, 0.03);
}
.store-cart-item-img {
    width: 60px; height: 60px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
    background: radial-gradient(circle at 50% 40%, rgba(217, 181, 102, 0.14), transparent 65%), var(--bg-3);
}
.store-cart-item-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.store-cart-item-main { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.store-cart-item-name { font-weight: 600; font-size: 0.92rem; line-height: 1.25; }
.store-cart-item-price { font-family: var(--serif); color: var(--gold-2); font-size: 1.05rem; text-align: right; }
.store-cart-item-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.store-qty-btn {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--line); color: var(--ink); font-size: 1.1rem;
}
.store-qty-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-2); }
.store-qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.store-qty-val { min-width: 24px; text-align: center; font-weight: 600; }
.store-cart-item-remove { margin-left: auto; min-height: 44px; padding: 0 10px; font-size: 0.8rem; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }
.store-cart-item-remove:hover { color: #e39b8a; }
.store-cart-empty { display: grid; justify-items: center; gap: 14px; padding: 48px 10px; text-align: center; color: var(--ink-2); }

/* Datos de entrega y forma de pago: campos de 48 px y letra de 16 px (sin zoom en iPhone). */
.store-checkout { position: relative; display: grid; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.store-checkout h3 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.store-field { display: grid; gap: 6px; }
.store-field label { font-size: 0.8rem; color: var(--ink-2); }
.store-field input[type="text"], .store-field input[type="tel"] {
    width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--bg-3); color: var(--ink);
    font: inherit; font-size: 16px; transition: border-color 0.2s, box-shadow 0.2s;
}
.store-field input::placeholder { color: var(--ink-3); }
.store-field input[aria-invalid="true"] { border-color: #e39b8a; }
.store-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 181, 102, 0.18); }
.store-city { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(217, 181, 102, 0.06); border: 1px solid rgba(217, 181, 102, 0.3); color: var(--ink-2); font-size: 0.9rem; }
.store-city svg { width: 18px; height: 18px; color: var(--gold-2); flex: none; }
.store-city b { color: var(--ink); }
.store-pay { display: grid; gap: 8px; }
.store-pay-opt {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 14px;
    border-radius: 14px; border: 1px solid var(--line); cursor: pointer; font-size: 0.92rem; color: var(--ink-2);
    transition: border-color 0.2s, background 0.2s;
}
.store-pay-opt input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.store-pay-opt:has(input:checked) { border-color: var(--gold); background: rgba(217, 181, 102, 0.08); color: var(--ink); }

.store-drawer-foot { padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.store-totals { display: grid; gap: 4px; margin-bottom: 12px; font-size: 0.9rem; color: var(--ink-2); }
.store-totals div { display: flex; justify-content: space-between; gap: 12px; }
.store-totals b { color: var(--ink); font-weight: 600; }
.store-total-row { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 1rem; }
.store-total-row b { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; color: var(--gold-2); }
.store-checkout-err { margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(227, 155, 138, 0.12); border: 1px solid rgba(227, 155, 138, 0.4); color: #f2b9ab; font-size: 0.88rem; }
.store-cta { width: 100%; padding: 16px 20px; font-size: 1rem; border-radius: 16px; }
.store-cta:disabled { opacity: 0.7; cursor: progress; transform: none; }

/* ── Pago y gracias ─────────────────────────────────────────────────────── */
.store-pay-wrap { min-height: 100svh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) var(--gutter) calc(24px + env(safe-area-inset-bottom)); }
.store-pay-card {
    width: min(520px, 100%); padding: clamp(24px, 5vw, 40px); text-align: center;
    border-radius: 22px; border: 1px solid rgba(217, 181, 102, 0.4);
    background: linear-gradient(160deg, rgba(243, 237, 224, 0.06), rgba(243, 237, 224, 0.015)), var(--bg-2);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
}
.store-pay-logo { height: 46px; width: auto; margin: 0 auto 18px; }
.store-pay-card .kicker { justify-content: center; }
.store-pay-card .display { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 10px 0 8px; }
.store-lede { color: var(--ink-2); line-height: 1.6; max-width: 40ch; margin: 0 auto; }
.store-pay-summary { margin: 22px 0; text-align: left; }
.store-pay-summary div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; font-size: 0.92rem; color: var(--ink-2); border-bottom: 1px dotted var(--line); }
.store-pay-summary b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.store-pay-summary .store-pay-sub { color: var(--ink-3); }
.store-pay-summary .store-pay-total { border-bottom: 0; padding-top: 12px; font-size: 1rem; }
.store-pay-total b { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; color: var(--gold-2); }
.store-pay-btn { display: flex; justify-content: center; min-height: 52px; margin: 8px 0 14px; }
.store-pay-note { font-size: 0.82rem; color: var(--ink-3); margin-top: 14px; }
.store-pay-note b { color: var(--ink-2); }
.store-back-link { display: inline-block; margin-top: 14px; padding: 8px; font-size: 0.9rem; font-weight: 600; color: var(--gold-2); }
.store-state { display: grid; justify-items: center; gap: 6px; }
.store-state .btn { margin-top: 14px; }
.store-spinner {
    width: 46px; height: 46px; border-radius: 50%; margin: 4px auto 10px;
    border: 3px solid var(--line); border-top-color: var(--gold); animation: store-spin 1s linear infinite;
}
@keyframes store-spin { to { transform: rotate(360deg); } }
.store-check-ok {
    width: 60px; height: 60px; border-radius: 50%; margin: 4px auto 10px; display: grid; place-items: center;
    background: rgba(69, 198, 173, 0.14); border: 1px solid var(--disco); color: var(--disco); font-size: 1.7rem;
}

/* ══ Móvil: dos productos por fila y el pedido como hoja desde abajo ═══════ */
@media (max-width: 720px) {
    .sp-head { padding: calc(96px + env(safe-area-inset-top)) 0 22px; }
    .sp-head .hero__title { max-width: none; }

    /* En el celular la licorera es una lista, como en las apps de domicilio:
       foto a la izquierda, nombre y precio a la derecha, el botón a un pulgar.
       Setenta productos en tarjetas cuadradas eran 12.000 px de scroll. */
    .store-filters { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
    .store-cat { padding-top: 26px; }
    .store-cat-title { margin-bottom: 12px; }
    .store-grid { grid-template-columns: 1fr; gap: 8px; }
    .store-card { flex-direction: row; border-radius: 16px; }
    .store-card:hover { transform: none; }
    .store-card-media { flex: none; width: 96px; aspect-ratio: auto; padding: 8px; }
    .store-card-noimg span { font-size: 2.2rem; }
    .store-card-body { min-width: 0; padding: 12px 12px 12px 6px; gap: 3px; }
    .store-card-name { font-size: 1.02rem; }
    .store-card-desc { font-size: 0.78rem; -webkit-line-clamp: 1; }
    .store-card-foot { padding-top: 6px; }
    .store-card-price { font-size: 1.18rem; }
    .store-add { padding: 0 16px; font-size: 0.85rem; }

    .store-drawer {
        top: auto; left: 0; right: 0; width: 100%; max-height: 92svh;
        border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
        box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.5);
        transform: translateY(104%);
    }
    .store-drawer::before {
        content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
        border-radius: 4px; background: rgba(243, 237, 224, 0.25);
    }
    .store-drawer-head { padding-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .store-drawer, .store-drawer.open, .store-drawer-overlay, .sp-cartbar, .store-card { transition: none; }
    .store-spinner { animation-duration: 3s; }
}
