/* ---------- Tokens ---------- */
:root {
  /* Colores del logo: azul marino #303088 y azul lavanda #6078b8 */
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --ink: #141833;
  --ink-2: #4b5170;
  --ink-3: #61678a;
  --line: #dde1ee;
  --accent: #303088;
  --accent-hover: #24246e;
  --accent-ink: #ffffff;
  --accent-soft: #e8ebf8;
  --marca-2: #6078b8;
  --topbar-bg: #ffffff;
  --logo-ink: #303088;
  --head: #14183f;
  --head-ink: #eef0fb;
  --head-ink-2: #a9b1d8;
  --head-accent: #a3b4ee;
  --wa: #1a9e4c;
  --wa-hover: #158440;
  --oferta: #d6420b;
  --nuevo: #23844a;
  --agotado: #66727b;
  --tint-s: 60%;
  --tint-l: 94%;
  --tint-ink-s: 55%;
  --tint-ink-l: 36%;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(14 26 34 / .06), 0 6px 20px rgb(14 26 34 / .07);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d1a;
    --surface: #12152a;
    --surface-2: #1a1e38;
    --ink: #e7e9f5;
    --ink-2: #a7adc9;
    --ink-3: #8a90b0;
    --line: #262b4a;
    --accent: #8c9ee8;
    --accent-hover: #a6b5f0;
    --accent-ink: #0b0e2a;
    --accent-soft: #1d2250;
    --topbar-bg: #0f1330;
    --logo-ink: #e7e9f5;
    --head: #0a0d24;
    --wa: #25b35b;
    --wa-hover: #2fc867;
    --tint-s: 32%;
    --tint-l: 17%;
    --tint-ink-s: 65%;
    --tint-ink-l: 70%;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d1a;
  --surface: #12152a;
  --surface-2: #1a1e38;
  --ink: #e7e9f5;
  --ink-2: #a7adc9;
  --ink-3: #8a90b0;
  --line: #262b4a;
  --accent: #8c9ee8;
  --accent-hover: #a6b5f0;
  --accent-ink: #0b0e2a;
  --accent-soft: #1d2250;
  --topbar-bg: #0f1330;
  --logo-ink: #e7e9f5;
  --head: #0a0d24;
  --wa: #25b35b;
  --wa-hover: #2fc867;
  --tint-s: 32%;
  --tint-l: 17%;
  --tint-ink-s: 65%;
  --tint-ink-l: 70%;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { max-width: 1240px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 24px; } }

.ico, .ico-media, .wa-float svg {
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico { width: 20px; height: 20px; flex: none; }

.tinted {
  background: hsl(var(--h, 195) var(--tint-s) var(--tint-l));
  color: hsl(var(--h, 195) var(--tint-ink-s) var(--tint-ink-l));
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn .ico { width: 18px; height: 18px; }
.btn:disabled { cursor: not-allowed; opacity: .6; }
.btn-sm { height: 36px; padding: 0 12px; font-size: .86rem; }
.btn-lg { width: 100%; height: 50px; font-size: 1rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.stepper {
  display: inline-flex; align-items: center;
  height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.stepper button {
  display: grid; place-items: center; width: 34px; height: 100%;
  border: 0; background: transparent; color: var(--ink-2); border-radius: 9px;
}
.stepper button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper .ico { width: 16px; height: 16px; }
.stepper output { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Aviso de horario temporal ---------- */
.aviso-horario {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; background: #f2b705; color: #1d1600;
  font-size: .88rem; text-align: center; line-height: 1.35;
}
.aviso-horario .ico { width: 18px; height: 18px; flex: none; }
.aviso-corto { display: none; }
/* En el celular, una sola línea con la versión corta del aviso. */
@media (max-width: 720px) {
  .aviso-horario { padding: 6px 12px; font-size: .82rem; font-weight: 600; }
  .aviso-horario .ico { width: 16px; height: 16px; }
  .aviso-largo { display: none; }
  .aviso-corto { display: inline; }
}

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg); color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  min-height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo-img { width: 40px; height: 40px; border-radius: 10px; }
.logo-text { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--logo-ink); }

/* En modo oscuro el logo va sobre un fondo blanco para conservar sus colores. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-img { background: #fff; padding: 3px; }
}
:root[data-theme="dark"] .logo-img { background: #fff; padding: 3px; }

.search {
  position: relative; display: flex; align-items: center;
  max-width: 560px; width: 100%; justify-self: center;
}
.search .ico { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }

.cart-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px;
  border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.cart-btn:hover { background: var(--accent-hover); }
.cart-label { font-variant-numeric: tabular-nums; }
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--oferta); color: #fff; font-size: .75rem; font-weight: 700;
  box-shadow: 0 0 0 2px var(--topbar-bg);
}

@media (max-width: 720px) {
  .topbar-in {
    grid-template-columns: 1fr auto; gap: 10px;
    padding-block: 10px;
  }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .cart-label { display: none; }
  .cart-btn { width: 46px; justify-content: center; padding: 0; }
}

/* ---------- Portada ---------- */
.hero {
  position: relative; overflow: hidden;
  background-color: var(--head);
  /* Brillo detrás del logo. Las pistas de circuito van aparte (.pistas). */
  background-image: radial-gradient(ellipse 60% 90% at 85% 10%, rgb(96 120 184 / .38), transparent 70%);
  color: var(--head-ink);
  padding: 40px 0 64px;
}
.kicker {
  font: 600 .78rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--head-accent); margin-bottom: 12px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; }
.hero-lead { margin-top: 10px; max-width: 620px; color: var(--head-ink-2); font-size: 1.05rem; }
.hero-info {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none;
}
.hero-info li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: rgb(255 255 255 / .06); border: 1px solid rgb(255 255 255 / .09);
  font-size: .86rem; color: var(--head-ink);
}
.hero-info .ico { width: 16px; height: 16px; color: var(--head-accent); }
.hero-in { position: relative; z-index: 1; }
.hero-logo {
  position: absolute; right: 40px; top: 50%; transform: translateY(-50%);
  width: 180px; height: auto; filter: brightness(0) invert(1); opacity: .92;
}
@media (min-width: 961px) { .hero-in > :not(.hero-logo) { max-width: calc(100% - 250px); } }
@media (max-width: 960px) { .hero-logo { display: none; } }
.hero-info a { color: inherit; text-decoration: none; }
.hero-info a:hover { text-decoration: underline; }

/* En el celular la portada se reduce al nombre y la fila de datos (horario, dirección, domicilios)
   para que los productos se vean desde la primera pantalla. */
@media (max-width: 720px) {
  .hero { padding: 16px 0 48px; }
  .hero h1 { font-size: 1.55rem; }
  .hero .kicker, .hero-lead { display: none; }
  .hero-info {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 10px -16px 0; padding-inline: 16px;
  }
  .hero-info li { padding: 5px 11px; font-size: .82rem; }
  .hero-info li { flex: none; }
}

/* ---------- Categorías ---------- */
.cats-wrap {
  position: sticky; top: var(--topbar-h, 64px); z-index: 10;
  margin-top: -32px;
  transition: transform .25s ease, opacity .25s ease, visibility .25s;
}
/* Se esconde detrás del encabezado al bajar por los productos (app.js, barrasAlDesplazar). */
.cats-wrap.oculta { transform: translateY(calc(-100% - 12px)); opacity: 0; visibility: hidden; pointer-events: none; }
.cats {
  position: relative;
  display: flex; gap: 8px; padding: 10px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 6px 12px 6px 6px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--ink-2); font-weight: 500; font-size: .9rem; white-space: nowrap;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
@media (min-width: 1024px) {
  .cats { flex-wrap: wrap; overflow: visible; gap: 4px 6px; padding: 8px; }
  .cats .chip { gap: 6px; padding: 4px 10px 4px 4px; font-size: .85rem; }
  .cats .chip-ico { width: 26px; height: 26px; }
  .cats .chip-ico .ico { width: 15px; height: 15px; }
}
.chip-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.chip-ico .ico { width: 17px; height: 17px; }
.chip small { font: 500 .75rem var(--mono); color: var(--ink-3); }

/* ---------- Barra de herramientas ---------- */
#catalogo { scroll-margin-top: calc(var(--topbar-h, 64px) + 64px); padding-bottom: 64px; }
.noscript { margin-block: 24px; padding: 16px; border-radius: var(--radius); background: var(--surface); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 28px 0 16px;
}
.toolbar h2 { font-size: 1.4rem; font-weight: 700; }
.conteo { color: var(--ink-3); font-size: .9rem; margin-top: 2px; }
.toolbar-ctrls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.select select, .campo select {
  height: 40px; padding: 0 36px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background-color: var(--surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8994' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

/* ---------- Productos ---------- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: transparent; }

.card-media {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 4 / 3; width: 100%; border: 0; padding: 0; overflow: hidden;
}
/* Las fotos se muestran completas (sin recortar), con margen y sobre fondo blanco.
   Van en posición absoluta para que ocupen exactamente el cuadro: si estuvieran dentro de la
   cuadrícula, una foto cuadrada lo agrandaría y se cortaría arriba y abajo. */
.card-media img, .modal-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card-media img { padding: 12px; }
.modal-media img { padding: 28px; }
.card-media:has(> img.cargada), .modal-media:has(img), .item-thumb:has(img) { background: #fff; }
.card-media { transition: background-color .3s; }
/* Mientras la foto carga: el icono de la categoría sobre su color suave, con un brillo que pasa.
   Al cargar, la foto aparece con un fundido y el icono se oculta. */
.card-media:has(> img:not(.cargada))::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .5) 50%, transparent 70%) -150% 0 / 200% 100% no-repeat;
  animation: brillo-foto 1.3s ease-in-out infinite;
}
@keyframes brillo-foto { to { background-position: 250% 0; } }
.card-media img, .modal-media img, .item-thumb img { transition: opacity .3s ease-out; }
.card-media img:not(.cargada), .modal-media img:not(.cargada), .item-thumb img:not(.cargada),
.is-agotado .card-media > img:not(.cargada) { opacity: 0; }
.card-media:has(> img.cargada) > .ico-espera, .modal-media:has(> img.cargada) > .ico-espera,
.galeria-foto:has(> img.cargada) > .ico-espera, .item-thumb:has(> img.cargada) > .ico-espera { opacity: 0; }
/* El icono se desvanece mientras la foto aparece, para que el recuadro nunca quede vacío. */
svg.ico-espera { transition: opacity .3s ease-out, transform .3s; }
.item-thumb .ico-espera { opacity: .6; }
.ico-media { width: 40%; height: auto; stroke-width: 1.3; transition: transform .3s; }
.card:hover .ico-media { transform: scale(1.06); }
.is-agotado .card-media > :not(.tag) { opacity: .45; filter: grayscale(1); }

.tag {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 8px; border-radius: 6px;
  color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.tag-oferta { background: var(--oferta); }
.tag-nuevo { background: var(--nuevo); }
.tag-agotado { background: var(--agotado); }

.card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 12px 14px 14px; }
.card-cat {
  font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Tarjetas de relleno mientras carga el catálogo */
.esqueleto { pointer-events: none; }
.chip.esqueleto { width: 130px; height: 42px; }
.esqueleto .card-media, .esqueleto .card-body span, .chip.esqueleto {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: brillo 1.2s linear infinite;
}
.esqueleto .card-body span { display: block; height: 12px; border-radius: 6px; }
.esqueleto .card-body span:nth-child(1) { width: 40%; }
.esqueleto .card-body span:nth-child(2) { width: 85%; height: 16px; }
.esqueleto .card-body span:nth-child(3) { width: 30%; height: 20px; margin-top: 18px; }
@keyframes brillo { to { background-position: -200% 0; } }

/* Catálogo agrupado por categoría */
/* minmax(0, 1fr): sin esto, el carrusel de cada sección estira la página hacia los lados. */
.secciones { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.seccion-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.seccion-head h3 { flex: 1; font-size: 1.15rem; font-weight: 700; }
.seccion-head .chip-ico { width: 34px; height: 34px; }
.ver-todo {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 6px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--accent); font-weight: 600; font-size: .9rem;
}
.ver-todo:hover { background: var(--accent-soft); }
.ver-todo .ico { width: 16px; height: 16px; }
@media (max-width: 540px) {
  .secciones { gap: 28px; }
  .seccion-head h3 { font-size: 1.05rem; }
}
.card-title { font-size: .97rem; font-weight: 600; }
.link {
  padding: 0; border: 0; background: none; text-align: left; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link:hover { color: var(--accent); }
/* Referencias como las marcas impresas en un chip. */
.ref {
  align-self: flex-start; display: inline-block; width: fit-content;
  padding: 2px 7px; border-radius: 4px;
  background: var(--chip-bg); color: var(--chip-ink);
  font: 500 .7rem/1.45 var(--mono); letter-spacing: .03em;
}

.card-foot {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px;
  margin-top: auto; padding-top: 10px;
}
.precio { display: flex; flex-direction: column; line-height: 1.2; }
.precio s { font-size: .78rem; color: var(--ink-3); }
.precio strong { font-size: 1.12rem; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 540px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 10px 10px 12px; }
  .card-title { font-size: .9rem; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .card-foot .accion, .card-foot .btn, .card-foot .stepper { width: 100%; }
  .card-foot .stepper { justify-content: space-between; }
  .toolbar { margin: 20px 0 12px; gap: 8px; }
  .toolbar h2 { font-size: 1.2rem; }
  .toolbar-ctrls { width: 100%; justify-content: space-between; }
  .toolbar .select select { height: 36px; }
}

/* ---------- Vitrina de destacados ---------- */
.vitrina {
  margin-top: 28px; padding: 16px;
  background: var(--accent-soft); border-radius: var(--radius);
}
.vitrina-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.vitrina-head h2 { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 1.3rem; font-weight: 700; }
.vitrina-head h2 .ico { width: 22px; height: 22px; color: var(--accent); fill: var(--accent); }
.vitrina-ver {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; background: none;
  color: var(--accent); font-weight: 600; font-size: .88rem;
}
.vitrina-ver .ico { width: 15px; height: 15px; }
.card-vitrina .card-foot { flex-direction: row; align-items: center; padding-top: 8px; }
@media (max-width: 540px) {
  .vitrina { margin: 20px -16px 0; padding: 14px 16px; border-radius: 0; }
  .vitrina-head h2 { font-size: 1.2rem; }
}

/* ---------- Carruseles (vitrina y categorías del inicio) ---------- */
.carrusel-flechas { display: flex; gap: 6px; flex: none; }
.carrusel-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink);
}
.carrusel-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.carrusel-btn:disabled { opacity: .4; cursor: default; }
.carrusel-btn .ico { width: 17px; height: 17px; }
.carrusel-btn.anterior .ico { transform: rotate(180deg); }
/* En pantallas táctiles se desliza con el dedo. */
@media (hover: none) { .carrusel-flechas { display: none; } }
.carrusel {
  display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
  padding: 4px 2px 6px; margin: -4px -2px -6px;
}
.carrusel::-webkit-scrollbar { display: none; }
.carrusel > * { scroll-snap-align: start; }
.carrusel > .card:hover { transform: none; }
/* Mientras la vitrina se desliza sola no se ajusta a cada tarjeta, para que el movimiento sea continuo. */
.carrusel.cinta { scroll-snap-type: none; }
.carrusel-mas {
  display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px;
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--accent); font-weight: 600; text-align: center;
}
.carrusel-mas:hover { border-color: var(--accent); background: var(--accent-soft); }
.carrusel-mas .ico { width: 28px; height: 28px; }
@media (max-width: 540px) {
  /* Se ven dos tarjetas y el borde de la tercera, para que se note que se puede deslizar. */
  .carrusel {
    grid-auto-columns: calc((100% - 20px) / 2.2); gap: 10px;
    margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px;
  }
}

.vacio {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 56px 16px; color: var(--ink-2);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.vacio > .ico { width: 36px; height: 36px; color: var(--ink-3); margin-bottom: 6px; }
.vacio strong { color: var(--ink); }
.vacio-acciones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }

/* ---------- Pie ---------- */
.footer { position: relative; overflow: hidden; background: var(--head); color: var(--head-ink-2); font-size: .92rem; }
.footer-in {
  display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding-block: 40px 28px;
}
.footer h3 { color: var(--head-ink); font-size: .95rem; margin-bottom: 8px; }
.footer-logo { width: 150px; height: auto; margin: -8px 0 12px -8px; }
.footer p + p { margin-top: 4px; }
.footer ol { margin: 0; padding-left: 18px; }
.footer li + li { margin-top: 4px; }
.footer a { color: var(--head-ink-2); text-decoration: none; }
.footer a:hover { color: var(--head-ink); text-decoration: underline; }
.lista-pagos, .lista-legal { margin: 0; padding: 0; list-style: none; }
.lista-pagos small { display: block; font-size: .8rem; opacity: .8; }
.footer-legal { padding-block: 16px 24px; border-top: 1px solid rgb(255 255 255 / .07); font-size: .82rem; }

.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 15;
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--wa); color: #fff; box-shadow: 0 6px 20px rgb(0 0 0 / .25);
  transition: transform .2s, background-color .2s;
}
.wa-float:hover { transform: scale(1.06); background: var(--wa-hover); }
.wa-float svg { width: 28px; height: 28px; stroke-width: 1.7; }

.redes { display: flex; gap: 8px; margin-top: 14px; }
.redes a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: rgb(255 255 255 / .07); color: var(--head-ink);
}
.redes a:hover { background: rgb(255 255 255 / .14); text-decoration: none; }
.redes .ico { width: 19px; height: 19px; }

@keyframes subir { from { transform: translateY(120%); } }

/* ---------- Diálogos ---------- */
dialog { color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(4 10 14 / .55); backdrop-filter: blur(2px); }

.drawer {
  margin: 0 0 0 auto; padding: 0; border: 0;
  width: min(440px, 100vw); max-width: 100vw;
  height: 100vh; height: 100dvh; max-height: none;
}
@media (max-width: 520px) { .drawer { width: 100vw; } }
.drawer[open] { animation: deslizar .25s ease-out; }
@keyframes deslizar { from { transform: translateX(100%); } }

.drawer-in { display: flex; flex-direction: column; height: 100%; }
.drawer-head {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { flex: 1; font-size: 1.15rem; }
.drawer-head .icon-btn:first-child { margin-left: -12px; }

.vista { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; }
.vista-body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; }
.vista-foot {
  display: grid; gap: 10px; flex: none;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.total-row { display: flex; align-items: baseline; justify-content: space-between; }
.total-row strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.nota { font-size: .82rem; color: var(--ink-3); }

.items { margin: 0; padding: 0; list-style: none; }
.item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 4px 12px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.item-thumb {
  position: relative; grid-row: span 2; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
}
.item-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.item-thumb .ico { width: 26px; height: 26px; stroke-width: 1.5; }
.item-info { display: flex; flex-direction: column; min-width: 0; }
.item-nombre { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.item-meta { font: 500 .74rem var(--mono); color: var(--ink-3); margin-top: 2px; }
.item-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-ctrl { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.quitar {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: .84rem;
}
.quitar:hover { color: var(--oferta); background: var(--surface-2); }
.quitar .ico { width: 16px; height: 16px; }

.carrito-vacio, .enviado {
  display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--ink-2);
  padding-top: 56px;
}
.carrito-vacio > .ico { width: 40px; height: 40px; color: var(--ink-3); margin-bottom: 6px; }
.carrito-vacio strong, .enviado strong { color: var(--ink); font-size: 1.05rem; }
.carrito-vacio .btn { margin-top: 12px; }
.enviado-ico {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px;
  border-radius: 50%; background: var(--wa); color: #fff;
}
.enviado-ico .ico { width: 32px; height: 32px; stroke-width: 2.4; }

/* Formulario */
.campos { display: grid; gap: 16px; align-content: start; padding-top: 20px; }
.campo { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.campo > span, .campo legend { font-weight: 600; font-size: .88rem; padding: 0; }
.campo small { font-weight: 400; color: var(--ink-3); }
.campo input, .campo textarea, .campo select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background-color: var(--surface);
}
.campo input { height: 44px; padding: 0 12px; }
.campo select { height: 44px; }
.campo textarea { padding: 10px 12px; resize: vertical; }
.campo input:focus, .campo textarea:focus, .campo select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.campo [aria-invalid="true"] { border-color: var(--oferta); }
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opcion {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.opcion:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opcion:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.nota-pago { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.consentimientos { display: grid; gap: 10px; padding-top: 4px; }
.check-legal { align-items: flex-start; font-size: .84rem; line-height: 1.45; }
.check-legal input { flex: none; margin: 1px 0 0; }
.check-legal input[aria-invalid="true"] { outline: 2px solid var(--oferta); outline-offset: 2px; }
.desglose { display: grid; gap: 2px; font-size: .9rem; color: var(--ink-2); }
.opcion input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.opcion > span { display: grid; gap: 2px; font-size: .88rem; }
.opcion small { font-size: .78rem; }

/* Detalle */
.modal {
  padding: 0; border: 0; border-radius: 18px; overflow: hidden;
  width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
}
.modal[open] { animation: aparecer .2s ease-out; }
@keyframes aparecer { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-in { position: relative; display: grid; grid-template-columns: 1fr 1fr; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 1; background: var(--surface); }
.modal-media { position: relative; display: grid; place-items: center; min-height: 320px; }
.modal-media .ico-media { width: 46%; }

/* Galería de varias fotos en el detalle */
.galeria { position: absolute; inset: 0; }
.galeria-pista {
  display: flex; height: 100%; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.galeria-pista::-webkit-scrollbar { display: none; }
.galeria-pista:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.galeria-foto { position: relative; flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: start; overflow: hidden; }
.galeria-foto img { padding: 28px 28px 36px; }
.galeria-btn {
  position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink);
  box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.galeria-btn svg { width: 20px; height: 20px; }
.galeria-btn.anterior { left: 12px; }
.galeria-btn.anterior svg { rotate: 180deg; }
.galeria-btn.siguiente { right: 12px; }
.galeria-btn:disabled { opacity: 0; pointer-events: none; }
.galeria-puntos { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; }
.galeria-puntos button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; cursor: pointer;
  background: rgb(20 24 51 / .22); transition: width .2s;
}
.galeria-puntos button[aria-current] { width: 22px; background: #303088; }
.modal-media .tag { z-index: 2; }
@media (hover: none) { .galeria-btn { display: none; } }
.fotos-n {
  position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 99px;
  font-size: .7rem; font-weight: 600; background: rgb(0 0 0 / .55); color: #fff;
}
.modal-body { display: flex; flex-direction: column; gap: 8px; padding: 32px 28px 28px; }
.modal-body h2 { font-size: 1.45rem; padding-right: 32px; }
.desc { color: var(--ink-2); margin-top: 6px; }
.specs { margin: 8px 0 0; padding: 0; list-style: none; font-size: .88rem; border-top: 1px solid var(--line); }
.specs li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.specs span { color: var(--ink-3); }
.specs strong { font-weight: 600; text-align: right; }
/* El precio y el botón Agregar quedan fijos abajo mientras se leen la descripción y las especificaciones. */
.modal-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: auto -28px 0; padding: 14px 28px;
  background: var(--surface); border-top: 1px solid var(--line);
}
/* La línea de arriba del precio cierra la tabla de especificaciones. */
.specs li:last-child { border-bottom: 0; }
.modal-foot .precio strong { font-size: 1.5rem; }
.modal-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 8px; }
.consulta, .compartir {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  font-weight: 600; font-size: .9rem; text-decoration: none;
}
.consulta { color: var(--wa); }
.compartir { color: var(--ink-2); }
.consulta:hover, .compartir:hover { text-decoration: underline; }
.consulta .ico, .compartir .ico { width: 18px; height: 18px; }
.vaciar-todo { margin: 12px auto 0; display: flex; }

@media (max-width: 700px) {
  .modal-in { grid-template-columns: 1fr; }
  /* Alto fijo (4:3 del ancho del modal): la galería va en posición absoluta y no empuja la fila. */
  .modal-media { min-height: 0; height: min(calc((100vw - 32px) * .75), 360px); }
  .modal-media img { padding: 14px; }
  .galeria-foto img { padding: 14px 14px 28px; }
  .modal-media .ico-media { width: 26%; }
  .modal-body { padding: 20px; }
  .modal-foot { margin-inline: -20px; padding: 12px 20px; }
}

/* ---------- Páginas legales ---------- */
.topbar-legal { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.topbar-legal .logo-text { white-space: nowrap; }
.topbar-legal .btn { gap: .3em; }
@media (max-width: 480px) { .solo-pc { display: none; } }

.legal-layout {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start;
  padding-block: 40px 72px;
}
.legal-nav {
  position: sticky; top: 88px;
  display: grid; gap: 2px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.legal-nav a {
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: .9rem; font-weight: 500; text-decoration: none;
}
.legal-nav a:hover { background: var(--surface-2); color: var(--ink); }
.legal-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

.legal {
  max-width: 760px; padding: 36px 40px 44px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink-2); line-height: 1.65;
}
.legal .kicker { color: var(--accent); }
.legal h1 { color: var(--ink); font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; }
.legal h2 { color: var(--ink); font-size: 1.2rem; margin: 36px 0 10px; scroll-margin-top: 90px; }
.legal h3 { color: var(--ink); font-size: 1rem; margin: 20px 0 6px; }
.legal p, .legal ul, .legal ol { margin: 0 0 12px; }
.legal ul, .legal ol { padding-left: 22px; }
.legal li + li { margin-top: 6px; }
.legal strong { color: var(--ink); font-weight: 600; }
.actualizado { margin-top: 6px !important; margin-bottom: 24px !important; font-size: .88rem; color: var(--ink-3); }

.legal .datos { padding: 0; list-style: none; border-top: 1px solid var(--line); }
.legal .datos li { display: flex; justify-content: space-between; gap: 16px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.legal .datos span { color: var(--ink-3); flex: none; }
.legal .datos strong { text-align: right; }

.tabla-wrap { margin: 0 0 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.tabla-garantia { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.tabla-garantia th {
  padding: 10px 12px; text-align: left; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.tabla-garantia td { padding: 12px; vertical-align: top; border-top: 1px solid var(--line); }
.tabla-garantia tbody tr:nth-child(even) td { background: var(--surface-2); }
.tabla-garantia td:nth-child(1) { width: 42%; }
.tabla-garantia td:nth-child(2) { width: 20%; color: var(--ink); }
@media (max-width: 1100px) {
  .tabla-garantia, .tabla-garantia tbody, .tabla-garantia tr, .tabla-garantia td { display: block; }
  .tabla-garantia thead { display: none; }
  .tabla-garantia tr { padding: 12px; border-top: 1px solid var(--line); }
  .tabla-garantia tbody tr:first-child { border-top: 0; }
  .tabla-garantia td { width: auto !important; padding: 2px 0; border: 0; background: none !important; }
  .tabla-garantia td:first-child { color: var(--ink); font-weight: 600; }
}

.pendiente { padding: 1px 6px; border-radius: 4px; background: #ffe08a; color: #4a3500; font-weight: 600; }

@media (max-width: 860px) {
  .legal-layout { grid-template-columns: 1fr; gap: 16px; padding-block: 16px 48px; }
  .legal-nav { position: static; display: flex; overflow-x: auto; scrollbar-width: none; }
  .legal-nav a { flex: none; white-space: nowrap; }
  .legal { padding: 24px 18px 32px; }
  .legal .datos li { flex-direction: column; gap: 0; }
  .legal .datos strong { text-align: left; }
}

/* ---------- Aviso ---------- */
.toast {
  position: fixed; inset: auto auto 24px 50%; margin: 0; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px); padding: 10px 16px;
  border: 0; border-radius: 10px; background: var(--ink); color: var(--bg);
  font-size: .9rem; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
}
.toast.visible { opacity: 1; animation: toast .2s ease-out; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }
/* En el celular el aviso sale arriba, debajo del encabezado: abajo chocaría con la barra de botones. */
@media (max-width: 720px) {
  .toast { inset: calc(var(--topbar-h, 64px) + 10px) auto auto 50%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Menú lateral en el computador, vista de lista de precios, barra de botones
   en el celular y toques técnicos como los del logo.
   ===================================================================== */
:root {
  --pista: #c3cae4;     /* líneas de circuito sobre fondo claro */
  --chip-bg: #1d2148;   /* referencias como las marcas impresas en un chip */
  --chip-ink: #cdd3ee;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pista: #2e3563; --chip-bg: #252a52; --chip-ink: #cdd3ee; }
}
:root[data-theme="dark"] { --pista: #2e3563; --chip-bg: #252a52; --chip-ink: #cdd3ee; }

/* ---------- Toques técnicos ---------- */
/* Pistas de circuito, como las del logo, en el borde de la portada y del pie de página. */
.pistas {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 90px; pointer-events: none;
  fill: none; stroke: #6078b8; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .5;
}
.footer-in, .footer-legal { position: relative; z-index: 1; }
.pistas-pie { top: 0; bottom: auto; height: 90px; opacity: .35; }

/* Títulos de sección con una pista que termina en un punto de soldadura, como en el logo. */
.seccion-head h3, .vitrina-head h2, .lateral-titulo { display: flex; align-items: center; gap: 12px; }
.seccion-head h3::after, .vitrina-head h2::after, .lateral-titulo::after {
  content: ""; flex: 1; min-width: 32px; height: 12px;
  background:
    radial-gradient(circle at calc(100% - 6px) 50%, transparent 3px, var(--pista) 3.5px 5.5px, transparent 6px),
    linear-gradient(var(--pista), var(--pista)) 0 50% / calc(100% - 11px) 2px no-repeat;
}

/* ---------- Ver como tarjetas o lista ---------- */
.toolbar-titulo { flex: 1 1 auto; min-width: 0; }
.toolbar-ctrls { order: 1; }
.ver-como {
  order: 2; display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.ver-como-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-weight: 600; font-size: .88rem;
}
.ver-como-btn .ico { width: 17px; height: 17px; }
.ver-como-btn:hover { color: var(--ink); }
.ver-como-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(14 26 34 / .14); }

/* Lista de precios: un producto por renglón */
.lista {
  display: grid; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.lista:empty { display: none; }
.fila {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 132px; align-items: center; gap: 16px;
  padding: 10px 16px 10px 10px;
}
.fila + .fila { border-top: 1px solid var(--line); }
.fila .card-media { width: 64px; aspect-ratio: 1; border-radius: 10px; }
.fila .card-media img { padding: 4px; }
.fila .ico-media { width: 50%; }
.fila-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fila .card-title { font-size: .96rem; }
.fila-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fila .tag { position: static; padding: 2px 6px; font-size: .66rem; }
.fila .precio { align-items: flex-end; text-align: right; }
.fila .accion { display: flex; justify-content: flex-end; }
.seccion-conteo { flex: none; color: var(--ink-3); font-size: .88rem; }

/* ---------- Menú lateral (computador) ---------- */
.lateral-titulo { font-size: .95rem; font-weight: 700; color: var(--ink); }
@media (min-width: 1024px) {
  .hero { padding-bottom: 78px; }
  .tienda {
    display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start;
    padding-top: 28px;
  }
  .lateral {
    position: sticky; top: calc(var(--topbar-h, 64px) + 20px);
    display: grid; gap: 10px; max-height: calc(100vh - var(--topbar-h, 64px) - 40px);
    overflow-y: auto; scrollbar-width: thin; padding: 0 2px 8px;
  }
  .lateral-titulo { margin-top: 4px; }
  /* La barra de categorías se vuelve una lista: los mismos botones, uno debajo del otro. */
  .lateral .cats-wrap, .lateral .cats-wrap.oculta {
    position: static; margin: 0; transform: none; opacity: 1; visibility: visible; pointer-events: auto;
  }
  .lateral .cats { flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 6px; overflow: visible; box-shadow: none; }
  .lateral .cats .chip {
    width: 100%; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 10px;
    font-size: .9rem; white-space: normal; text-align: left;
  }
  .lateral .cats .chip-ico { width: 28px; height: 28px; }
  .lateral .chip small { margin-left: auto; }
  .lateral-filtros .toolbar-ctrls {
    flex-direction: column; align-items: stretch; gap: 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .lateral-filtros .select select { width: 100%; }
  #catalogo { scroll-margin-top: calc(var(--topbar-h, 64px) + 20px); }
  .vitrina { margin-top: 0; }
  .toolbar { margin-top: 32px; }
}
@media (max-width: 1023px) {
  .lateral { display: contents; }
  .lateral-titulo, .lateral-filtros { display: none; }
}
/* Si el catálogo no cargó (app.js, mostrarErrorCatalogo): sin menú lateral ni botón Tarjetas/Lista. */
.sin-catalogo .lateral, .sin-catalogo .ver-como { display: none; }
@media (min-width: 1024px) { .sin-catalogo .tienda { display: block; } }

/* ---------- Barra de botones (celular) ---------- */
.barra-inferior { display: none; }
@media (max-width: 720px) {
  .barra-inferior {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    background: var(--topbar-bg); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgb(14 26 34 / .06);
  }
  .barra-inferior > * {
    display: grid; justify-items: center; gap: 3px; padding: 7px 0 5px; border: 0; border-radius: 10px;
    background: none; color: var(--ink-2); font-size: .72rem; font-weight: 600; text-decoration: none;
  }
  .barra-inferior > :active { background: var(--surface-2); }
  .barra-inferior .ico { width: 23px; height: 23px; }
  .barra-inferior a { color: var(--wa); }
  .nav-icono { position: relative; display: grid; }
  .nav-cantidad {
    position: absolute; top: -6px; right: -11px; display: grid; place-items: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--oferta); color: #fff; font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--topbar-bg);
  }
  /* En el celular WhatsApp está en la barra: no se muestra el botón flotante. */
  .wa-float { display: none; }
  /* Espacio al final para que la barra no tape la última línea del pie de página. */
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
}

/* Lista de categorías que abre el botón "Categorías" de la barra */
.hoja {
  margin: auto 0 0; padding: 0; border: 0; width: 100%; max-width: 100%;
  max-height: min(80dvh, 640px); border-radius: 18px 18px 0 0;
}
.hoja[open] { display: flex; flex-direction: column; animation: subir .25s ease-out; }
.hoja-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.hoja-head h2 { font-size: 1.1rem; }
.hoja-lista { display: grid; gap: 2px; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); overflow-y: auto; }
.hoja-lista .chip { width: 100%; padding: 8px 12px 8px 8px; font-size: .98rem; white-space: normal; text-align: left; }
.hoja-lista .chip small { margin-left: auto; }

/* ---------- Celular ---------- */
@media (max-width: 720px) {
  .pistas { height: 60px; opacity: .4; }
  .pistas-pie { height: 60px; }
}
@media (max-width: 540px) {
  /* El botón Tarjetas/Lista va junto al título y los filtros en la línea de abajo. */
  .ver-como { order: 1; }
  .toolbar-ctrls { order: 2; }
  .ver-como-btn { padding: 0 9px; }
  /* En el celular el título de cada categoría necesita todo el ancho: sin la pista. */
  .seccion-head h3::after { display: none; }
  .ver-como-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fila {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas: "foto info precio" "foto info accion";
    gap: 6px 12px; padding: 10px 12px 10px 8px;
  }
  .fila .card-media { grid-area: foto; width: 56px; align-self: start; }
  .fila-info { grid-area: info; align-self: center; }
  .fila .precio { grid-area: precio; align-self: end; }
  .fila .accion { grid-area: accion; align-self: start; }
  .fila .btn-sm { height: 34px; padding: 0 10px; }
}
