/* =====================================================================
   Tienda online — lo que Tailwind no expresa cómodo.

   La tipografía va autoalojada: la CSP es `font-src 'self' data:` y
   además una tienda no debería depender de que Google responda para
   verse bien. Es un archivo variable de 38 KB que cubre de 400 a 800.
   ===================================================================== */

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/tienda/fuentes/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                   U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/tienda/fuentes/montserrat-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                   U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --marca: #13A538;
    --marca-oscuro: #0E7C2A;
    --acento: #3ED933;
}

* { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Montserrat', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.oculto { display: none !important; }

/* El señuelo para bots: fuera de la pantalla, nunca en el orden de
   tabulación y sin quitarlo del árbol con display:none, que algunos
   bots detectan. */
.señuelo {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* --- Barra de categorías --------------------------------------------
   Iconos con nombre debajo, en fila, con desplazamiento lateral en el
   celular. Es la navegación principal de un supermercado. */

.categorias {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.categorias::-webkit-scrollbar { display: none; }

.categoria {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
    width: 82px;
    padding: .55rem .25rem;
    border-radius: .75rem;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    color: #fff;
    transition: background .15s ease;
}

.categoria:hover { background: rgba(255, 255, 255, .14); }

.categoria.activa { background: rgba(255, 255, 255, .22); }

.categoria-icono {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    font-size: 19px;
    line-height: 1;
}

/* --- Tarjeta de producto -------------------------------------------- */

.producto {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #eceff1;
    border-radius: .75rem;
    overflow: hidden;
    transition: box-shadow .16s ease, border-color .16s ease;
}

.producto:hover {
    border-color: #dfe5e8;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}

.producto-imagen {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: contain;
    padding: .5rem;
    background: #fff;
}

.producto-sin-foto {
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    background: #fafafa;
    font-size: 34px;
}

.producto-nombre {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    color: #263238;
}

.producto-precio {
    font-size: 15px;
    font-weight: 800;
    color: var(--marca-oscuro);
}

.producto-etiqueta {
    display: inline-block;
    padding: .1rem .4rem;
    border-radius: .25rem;
    background: #f1f3f4;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #607d8b;
    text-transform: uppercase;
}

.agotado { opacity: .5; }

/* --- Contador de cantidad (− 1 +) ------------------------------------
   Es el gesto del supermercado en línea: no «agregar» y abrir el
   carrito, sino sumar y restar sin salir de la góndola. */

.contador {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 1.5px solid var(--acento);
    border-radius: .5rem;
    overflow: hidden;
    background: #fff;
}

.contador button {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: var(--acento);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    transition: background .12s ease;
}

.contador button:hover { background: var(--acento-oscuro, #2FC226); }

.contador span {
    flex: 1;
    text-align: center;
    font-size: 13.5px;
    font-weight: 700;
    color: #263238;
}

.btn-agregar {
    width: 100%;
    height: 32px;
    border-radius: .5rem;
    background: var(--acento);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    transition: background .12s ease;
}

.btn-agregar:hover { background: #2FC226; }

/* --- Carrusel horizontal de una sección ------------------------------ */

.vitrina {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 46%;
    gap: .6rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: .25rem;
}

.vitrina::-webkit-scrollbar { display: none; }

.vitrina > * { scroll-snap-align: start; }

@media (min-width: 640px) { .vitrina { grid-auto-columns: 30%; } }
@media (min-width: 900px) { .vitrina { grid-auto-columns: 22%; } }
@media (min-width: 1100px) { .vitrina { grid-auto-columns: 18.4%; } }

/* --- Campos del formulario ------------------------------------------ */

.campo { display: block; }

.campo > span {
    display: block;
    margin-bottom: .3rem;
    font-size: 12.5px;
    font-weight: 700;
    color: #37474f;
}

.campo input,
.campo textarea,
.campo select {
    width: 100%;
    border: 1px solid #dfe3e6;
    border-radius: .6rem;
    padding: .7rem .9rem;
    font-size: 15px;   /* 16px o menos hace que iOS acerque al enfocar */
    font-family: inherit;
    outline: none;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.campo input:focus,
.campo textarea:focus {
    border-color: var(--marca);
    box-shadow: 0 0 0 3px rgba(19, 165, 56, .14);
}

/* --- Opción seleccionable (reparto, pago) --------------------------- */

.opcion {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    border: 1.5px solid #e6eaec;
    border-radius: .75rem;
    padding: .8rem .9rem;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s ease, background .15s ease;
}

.opcion:hover { border-color: #cfd8dc; }

.opcion input { margin-top: .15rem; accent-color: var(--marca); width: 18px; height: 18px; }

.opcion:has(input:checked) {
    border-color: var(--marca);
    background: #F3FBF5;
}

/* --- Mapa ------------------------------------------------------------ */

#mapa { z-index: 0; }

/* El pin va clavado en el centro: se mueve el mapa, no el pin. Es el
   gesto que la gente ya conoce de las apps de delivery. */
.mapa-caja { position: relative; }

.mapa-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 400;
    margin-top: -34px;
    margin-left: -14px;
    pointer-events: none;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3));
}

/* --- Animaciones ----------------------------------------------------- */

@keyframes subir {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (min-width: 640px) {
    @keyframes subir {
        from { transform: translateX(100%); }
        to   { transform: translateX(0); }
    }
}

#panel-carrito aside { animation: subir .22s ease-out; }

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

.aparece { animation: aparecer .2s ease-out; }

@media (prefers-reduced-motion: reduce) {
    #panel-carrito aside, .aparece { animation: none; }
    * { transition: none !important; }
}

/* --- Carrusel de promociones ----------------------------------------
   Una pista que se desliza con scroll nativo: así el gesto de arrastrar
   del celular funciona sin escribir una línea de JavaScript, y las
   flechas y los puntos solo empujan esa misma pista. */

.carrusel {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background: #eceff1;
}

.carrusel-pista {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.carrusel-pista::-webkit-scrollbar { display: none; }

.carrusel-lamina {
    position: relative;
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-height: 150px;
    display: flex;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

@media (min-width: 640px) { .carrusel-lamina { min-height: 210px; } }
@media (min-width: 900px) { .carrusel-lamina { min-height: 250px; } }

.carrusel-imagen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carrusel-texto {
    position: relative;
    z-index: 2;
    padding: 1.25rem 1.5rem;
    max-width: 100%;
}

@media (min-width: 640px) { .carrusel-texto { padding: 2rem 2.5rem; } }

/* Sobre una foto, el texto solo se lee con un velo detrás */
.carrusel-texto.con-velo {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(90deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .34) 55%, rgba(0, 0, 0, 0) 100%);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

.carrusel-flecha {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: none;
    width: 34px;
    height: 34px;
    transform: translateY(-50%);
    place-items: center;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .88);
    color: #263238;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    transition: background .15s ease;
}

.carrusel-flecha:hover { background: #fff; }
.carrusel-flecha.izquierda { left: 10px; }
.carrusel-flecha.derecha  { right: 10px; }

@media (min-width: 640px) { .carrusel-flecha { display: grid; } }

.carrusel-puntos {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.carrusel-punto {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .55);
    transition: width .2s ease, background .2s ease;
}

.carrusel-punto.activo {
    width: 22px;
    background: #fff;
}
