/* =========================================================
   HMM Coffee · Carta pública
   Los colores --primario, --acento y --fondo se cargan desde
   el panel de administración (Ajustes).
   ========================================================= */
:root {
    --primario: #4A2C1A;
    --acento: #A8713F;
    --fondo: #F6EADB;
    --superficie: #FFFFFF;
    --texto: color-mix(in srgb, var(--primario) 92%, #000);
    --texto-suave: color-mix(in srgb, var(--primario) 62%, var(--fondo));
    --linea: color-mix(in srgb, var(--primario) 12%, transparent);
    --acento-suave: color-mix(in srgb, var(--acento) 16%, transparent);
    --sombra: 0 1px 2px rgba(30, 20, 10, .06), 0 8px 24px -12px rgba(30, 20, 10, .18);
    --radio: 18px;
    --serif: 'Fraunces', Georgia, serif;
    --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }
body {
    margin: 0;
    font-family: var(--sans);
    color: var(--texto);
    background: var(--fondo);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
img { max-width: 100%; display: block; }
.ico { flex-shrink: 0; }
[hidden] { display: none !important; }

.contenedor { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--primario);
    color: var(--fondo);
    text-align: center;
    padding: 56px 16px 64px;
}
.hero::before {
    content: '';
    position: absolute;
    inset: -40% -20% auto;
    height: 140%;
    background:
        radial-gradient(closest-side, color-mix(in srgb, var(--acento) 45%, transparent), transparent 70%) 50% 0 / 80% 80% no-repeat;
    opacity: .55;
    pointer-events: none;
}
.hero::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 28px;
    background: var(--fondo);
    border-radius: 28px 28px 0 0;
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.hero-logo {
    width: 116px; height: 116px;
    object-fit: contain;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--fondo) 8%, transparent);
    padding: 8px;
    animation: aparecer .7s ease both;
}
.hero-marca {
    width: 84px; height: 84px;
    display: grid; place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    color: var(--acento);
    border: 1.5px solid color-mix(in srgb, var(--acento) 55%, transparent);
    animation: aparecer .7s ease both;
}
.hero h1 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(2.2rem, 7vw, 3.4rem);
    letter-spacing: -.02em;
    line-height: 1.05;
    margin: 0;
    animation: aparecer .7s .08s ease both;
}
.hero-eslogan {
    margin: 10px auto 0;
    font-family: 'Parisienne', cursive;
    font-size: clamp(1.6rem, 5.5vw, 2.1rem);
    line-height: 1.2;
    color: color-mix(in srgb, var(--acento) 55%, var(--fondo));
    animation: aparecer .7s .16s ease both;
}
.hero-info {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
    margin-top: 20px;
    font-size: .9rem;
    color: color-mix(in srgb, var(--fondo) 80%, transparent);
    animation: aparecer .7s .24s ease both;
}
.hero-info span { display: inline-flex; align-items: center; gap: 6px; }
.hero-info .ico { color: var(--acento); }

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

/* ---------- Barra de búsqueda + categorías ---------- */
.barra {
    position: sticky; top: 0; z-index: 20;
    padding: 12px 0 10px;
    background: color-mix(in srgb, var(--fondo) 86%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: box-shadow .2s;
}
.barra.fija { box-shadow: 0 6px 20px -14px rgba(30, 20, 10, .45); }
.buscador {
    display: flex; align-items: center; gap: 10px;
    height: 52px;
    padding: 0 8px 0 18px;
    background: var(--superficie);
    border: 1.5px solid var(--linea);
    border-radius: 999px;
    color: var(--texto-suave);
    box-shadow: var(--sombra);
    transition: border-color .2s, box-shadow .2s;
}
.buscador:focus-within {
    border-color: var(--acento);
    box-shadow: 0 0 0 4px var(--acento-suave);
}
.buscador input {
    flex: 1; min-width: 0;
    border: 0; outline: 0; background: none;
    font: inherit; font-size: 1rem; color: var(--texto);
}
.buscador input::-webkit-search-cancel-button { display: none; }
.buscador-limpiar {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: var(--acento-suave); color: var(--texto);
    cursor: pointer;
}

.chips {
    display: flex; gap: 8px;
    margin: 12px -16px 0;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: .9rem; font-weight: 500;
    text-decoration: none;
    color: var(--texto);
    background: var(--superficie);
    border: 1px solid var(--linea);
    transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--acento); }
.chip.activo { background: var(--primario); color: var(--fondo); border-color: var(--primario); }
.buscando .chips { opacity: .4; pointer-events: none; }

/* ---------- Carta ---------- */
.carta { padding-top: 18px; padding-bottom: 48px; min-height: 40vh; }
.categoria { padding-top: 22px; }
.categoria-cabecera { margin-bottom: 16px; }
.categoria-cabecera h2 {
    font-family: var(--serif);
    font-size: clamp(1.6rem, 4.5vw, 2rem);
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0;
    display: flex; align-items: center; gap: 14px;
}
.categoria-cabecera h2::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(to right, var(--acento), transparent);
    opacity: .6;
}
.categoria-cabecera p { margin: 4px 0 0; color: var(--texto-suave); font-size: .95rem; }

.producto {
    position: relative;
    cursor: pointer;
    outline: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s;
}
.producto h3 { margin: 0; font-size: 1.04rem; font-weight: 600; line-height: 1.3; }
.producto-precio { font-weight: 700; color: var(--acento); white-space: nowrap; font-variant-numeric: tabular-nums; }
.producto-desc {
    margin: 4px 0 0;
    font-size: .9rem; color: var(--texto-suave);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.producto-linea { display: flex; align-items: baseline; gap: 10px; }

/* Modo sin fotos: estilo carta clásica con líneas de puntos */
.sin-fotos .productos {
    background: var(--superficie);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 6px 4px;
}
.sin-fotos .producto { padding: 14px 16px; border-radius: 12px; }
.sin-fotos .producto + .producto::before {
    content: ''; position: absolute; top: 0; left: 16px; right: 16px;
    border-top: 1px solid var(--linea);
}
.sin-fotos .producto:hover,
.sin-fotos .producto:focus-visible { background: var(--acento-suave); }
.sin-fotos .producto-puntos {
    flex: 1; min-width: 20px;
    border-bottom: 2px dotted color-mix(in srgb, var(--primario) 22%, transparent);
    transform: translateY(-4px);
}

/* Modo con fotos: tarjetas */
.con-fotos .productos { display: grid; gap: 12px; }
.con-fotos .producto {
    display: flex; gap: 14px; align-items: center;
    padding: 10px;
    background: var(--superficie);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
}
.con-fotos .producto:hover,
.con-fotos .producto:focus-visible { transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgba(30, 20, 10, .35); }
.con-fotos .producto-puntos { flex: 1; }
.con-fotos .producto-cuerpo { flex: 1; min-width: 0; padding-right: 6px; }
.con-fotos .producto-linea { flex-direction: column; gap: 2px; }
.con-fotos .producto-precio { order: 3; margin-top: 6px; font-size: 1.02rem; }
.con-fotos .producto-puntos { display: none; }
.producto-foto {
    width: 96px; height: 96px; flex-shrink: 0;
    border-radius: 14px; overflow: hidden;
    background: var(--acento-suave);
}
.producto-foto img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.producto:hover .producto-foto img { transform: scale(1.06); }
.producto-foto-vacia {
    width: 100%; height: 100%;
    display: grid; place-items: center;
    color: color-mix(in srgb, var(--acento) 70%, transparent);
}

@media (min-width: 720px) {
    .sin-fotos .productos { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; padding: 10px; }
    .sin-fotos .producto + .producto::before { display: none; }
    .sin-fotos .producto { border-bottom: 1px solid var(--linea); border-radius: 0; }
    .sin-fotos .producto:hover { border-radius: 12px; }

    .con-fotos .productos { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
    .con-fotos .producto { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; }
    .con-fotos .producto-foto { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; }
    .con-fotos .producto-cuerpo { padding: 14px 16px 16px; }
}

/* Estados de búsqueda */
.producto.oculto, .categoria.oculta { display: none; }
mark { background: var(--acento-suave); color: inherit; border-radius: 4px; padding: 0 2px; }

.vacio { text-align: center; padding: 60px 16px; color: var(--texto-suave); }
.vacio .ico { color: var(--acento); margin: 0 auto 10px; }
.vacio p { margin: 0 0 14px; font-size: 1.05rem; }
.boton-texto {
    font: inherit; font-weight: 600;
    border: 0; background: var(--primario); color: var(--fondo);
    padding: 10px 20px; border-radius: 999px; cursor: pointer;
}

/* ---------- Pie ---------- */
.pie {
    background: var(--primario);
    color: color-mix(in srgb, var(--fondo) 78%, transparent);
    text-align: center;
    padding: 36px 0 40px;
}
.pie strong { font-family: var(--serif); font-size: 1.3rem; color: var(--fondo); display: block; }
.pie-redes { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 22px; margin: 14px 0; }
.pie-redes a { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; }
.pie-redes a:hover { color: var(--acento); }
.pie small { display: block; margin-top: 10px; opacity: .7; }

/* ---------- Botón subir ---------- */
.subir {
    position: fixed; right: 16px; bottom: 20px; z-index: 30;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: var(--acento); color: #fff;
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .4);
    cursor: pointer;
    opacity: 0; transform: translateY(16px); pointer-events: none;
    transition: opacity .25s, transform .25s;
}
.subir.visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Modal de producto ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-fondo { position: absolute; inset: 0; background: rgba(20, 12, 8, .55); animation: fundido .2s ease; }
.modal-caja {
    position: relative;
    width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
    background: var(--superficie);
    border-radius: 24px 24px 0 0;
    animation: subirCaja .28s cubic-bezier(.2, .8, .2, 1);
}
.modal-cerrar {
    position: absolute; top: 12px; right: 12px; z-index: 1;
    width: 40px; height: 40px; display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .92); color: var(--texto);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
    cursor: pointer;
}
.modal-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.modal-cuerpo { padding: 24px 22px 30px; }
.modal-cat { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--acento); }
.modal-cuerpo h3 { font-family: var(--serif); font-size: 1.7rem; margin: 4px 0 8px; padding-right: 40px; line-height: 1.15; }
.modal-cuerpo p { margin: 0 0 18px; color: var(--texto-suave); white-space: pre-line; }
.modal-cuerpo p:empty { display: none; }
.modal-precio { font-size: 1.35rem; color: var(--primario); }

@media (min-width: 600px) {
    .modal { align-items: center; padding: 24px; }
    .modal-caja { border-radius: 24px; }
}
@keyframes fundido { from { opacity: 0; } }
@keyframes subirCaja { from { transform: translateY(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}
