:root {
  color-scheme: dark;
  --fondo: #07090c;
  --superficie: #10141a;
  --superficie-2: #181d25;
  --linea: rgba(255, 255, 255, .1);
  --linea-fuerte: rgba(255, 255, 255, .22);
  --texto: #f1f4f7;
  --tenue: #98a2af;
  --acento: #ffb648;
  --acento-texto: #1c1204;
  --hielo: #7fd6ff;
  --whatsapp: #25d366;
  --radio: 16px;
  --margen: clamp(16px, 4vw, 48px);
  --fuente: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  line-height: 1.45;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--hielo); outline-offset: 2px; }

.solo-lector {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid var(--linea-fuerte); border-radius: 999px;
  background: transparent;
  font-weight: 650; text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.boton:hover { border-color: var(--texto); }
.boton:active { transform: scale(.97); }
.boton--acento { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.boton--acento:hover { background: #ffc66e; border-color: #ffc66e; }
.boton--whatsapp { width: 100%; background: var(--whatsapp); border-color: var(--whatsapp); color: #04210f; }
.boton--whatsapp:hover { background: #3ee07d; border-color: #3ee07d; }
.boton--whatsapp svg { width: 22px; height: 22px; }

.icono {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--linea); border-radius: 50%;
  background: rgba(7, 9, 12, .7);
}
.icono svg { width: 20px; height: 20px; }
.icono:hover { border-color: var(--linea-fuerte); }

/* Portada */
.portada {
  position: relative; isolation: isolate;
  display: flex; align-items: flex-end;
  min-height: 92svh;
  padding: 96px var(--margen) clamp(40px, 8vh, 80px);
  overflow: hidden;
  background:
    radial-gradient(60vmax 45vmax at 72% 38%, rgba(255, 182, 72, .13), transparent 70%),
    radial-gradient(45vmax 35vmax at 96% 88%, rgba(127, 214, 255, .1), transparent 70%);
}
.portada::after {
  content: ""; position: absolute; inset: auto 0 0; height: 30%; z-index: 1;
  background: linear-gradient(transparent, var(--fondo));
  pointer-events: none;
}
.portada::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(7, 9, 12, .78), rgba(7, 9, 12, .3) 48%, transparent 68%);
  pointer-events: none;
}
.portada__lienzo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity 1.1s ease;
  pointer-events: none;
}
.portada.con-3d .portada__lienzo { opacity: 1; }
.portada__fija {
  position: absolute; top: 50%; left: 72%; width: min(44vw, 520px);
  transform: translate(-50%, -50%) rotateX(52deg) rotateZ(-38deg);
  transition: opacity .8s ease;
}
.portada.con-3d .portada__fija { opacity: 0; }
.chip-fijo { display: block; width: 100%; filter: drop-shadow(0 34px 44px rgba(255, 182, 72, .2)); }

.portada__texto { --ancho-titulo: min(760px, 62vw); position: relative; z-index: 2; max-width: var(--ancho-titulo); }
.sobretitulo {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--acento);
}
.portada h1 {
  margin-top: 12px;
  /* El tamaño baja según la cantidad de letras, para que el nombre entre sin cortarse. */
  font-size: min(clamp(3rem, 9.5vw, 8.5rem), calc(var(--ancho-titulo) / (var(--letras, 8) * .76)));
  font-weight: 800; font-stretch: 112%;
  line-height: .92; letter-spacing: -.035em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.eslogan { margin-top: 20px; max-width: 34em; font-size: clamp(1.05rem, 1.7vw, 1.3rem); color: #c9d0d9; }
.pasos {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 24px 0 28px; padding: 0; list-style: none;
  font-size: .92rem; color: var(--tenue);
}
.pasos b { margin-right: 4px; font-family: var(--mono); font-weight: 500; color: var(--acento); }

/* Barra de búsqueda y categorías */
.barra {
  position: sticky; top: 0; z-index: 10;
  background: rgba(7, 9, 12, .86);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--linea);
}
.barra__interior {
  display: flex; align-items: center; gap: 16px;
  max-width: 1500px; margin: auto; padding: 12px var(--margen);
}
.buscador {
  position: relative; flex: 0 1 360px; min-width: 220px;
  display: block;
}
.buscador svg {
  position: absolute; left: 15px; top: 50%; width: 18px; height: 18px;
  transform: translateY(-50%); color: var(--tenue); pointer-events: none;
}
.buscador input {
  width: 100%; height: 46px; padding: 0 14px 0 42px;
  border: 1px solid var(--linea); border-radius: 999px;
  background: var(--superficie);
  font-size: 1rem;
}
.buscador input::placeholder { color: var(--tenue); }
.buscador input:focus { outline: none; border-color: var(--acento); }

.categorias {
  flex: 1; min-width: 0;
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  padding: 2px;
}
.categorias::-webkit-scrollbar { display: none; }
.categoria {
  flex: none; min-height: 42px; padding: 0 16px;
  border: 1px solid var(--linea); border-radius: 999px;
  background: transparent;
  font-size: .92rem; font-weight: 550; color: #c9d0d9;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.categoria span { margin-left: 5px; font-family: var(--mono); font-size: .76rem; color: var(--tenue); }
.categoria:hover { border-color: var(--linea-fuerte); }
.categoria[aria-pressed="true"] { background: var(--texto); border-color: var(--texto); color: var(--fondo); }
.categoria[aria-pressed="true"] span { color: #4c5661; }

/* Grilla */
.contenido { max-width: 1500px; margin: auto; padding: 20px var(--margen) 120px; }
.contador { margin-bottom: 16px; font-size: .9rem; color: var(--tenue); }
.aviso {
  margin-bottom: 18px; padding: 14px 16px;
  border: 1px solid rgba(255, 182, 72, .4); border-radius: 12px;
  background: rgba(255, 182, 72, .08);
}
.aviso .boton { margin-top: 12px; }

.grilla {
  display: grid; gap: clamp(10px, 1.4vw, 20px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr));
}
@media (max-width: 559px) {
  .grilla { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tarjeta {
  --rx: 0deg; --ry: 0deg; --brillo-x: 50%; --brillo-y: 0%;
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--linea); border-radius: var(--radio);
  background: var(--superficie);
  overflow: hidden;
  /* Con miles de tarjetas, el navegador no dibuja las que están fuera de pantalla. */
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
  transition: transform .25s ease-out, border-color .2s ease, box-shadow .25s ease;
  animation: aparecer .5s cubic-bezier(.2, .7, .2, 1) backwards;
  animation-delay: var(--retraso, 0ms);
}
.tarjeta::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(320px circle at var(--brillo-x) var(--brillo-y), rgba(255, 182, 72, .13), transparent 70%);
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.tarjeta:hover {
  border-color: rgba(255, 182, 72, .45);
  box-shadow: 0 22px 44px -22px rgba(0, 0, 0, .9);
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
}
.tarjeta:hover::after { opacity: 1; }
.tarjeta:active { border-color: rgba(255, 182, 72, .6); }
.tarjeta.en-lista { border-color: rgba(255, 182, 72, .55); }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(16px); }
}

.tarjeta__foto {
  display: block; width: 100%; aspect-ratio: 1; padding: 0;
  border: 0; background: var(--superficie-2);
  overflow: hidden; cursor: zoom-in;
}
.tarjeta__foto img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.tarjeta:hover .tarjeta__foto img { transform: scale(1.05); }

.sin-foto {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 100%; padding: 12px;
  background: radial-gradient(circle at 50% 42%, #222933, var(--superficie-2) 70%);
  color: #8791a0;
  font-size: .76rem;
}
.sin-foto svg { width: 38%; max-width: 110px; stroke-width: 1.2; }

.tarjeta__datos {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  padding: 12px;
}
.codigo { font-family: var(--mono); font-size: .72rem; color: var(--tenue); overflow-wrap: anywhere; }
.tarjeta h3 {
  font-size: .96rem; font-weight: 550; line-height: 1.28;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
  overflow: hidden;
}
.precio { margin-top: auto; padding-top: 6px; font-size: 1.14rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.precio--consultar { font-size: .94rem; font-weight: 600; color: var(--tenue); }
.tarjeta .accion { position: relative; z-index: 1; margin-top: 6px; }

.agregar {
  width: 100%; min-height: 44px;
  border: 1px solid var(--linea-fuerte); border-radius: 11px;
  background: transparent;
  font-weight: 650; font-size: .94rem;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .15s ease;
}
.agregar:hover { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.agregar:active { transform: scale(.97); }

.cantidad {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  min-height: 44px;
  border: 1px solid var(--acento); border-radius: 11px;
  background: rgba(255, 182, 72, .1);
}
.cantidad button {
  height: 42px; border: 0; background: transparent;
  font-size: 1.25rem; line-height: 1; color: var(--acento);
}
.cantidad button:hover { background: rgba(255, 182, 72, .16); }
.cantidad output { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.vacio { display: grid; justify-items: center; gap: 10px; padding: 56px 16px; text-align: center; }
.vacio p { color: var(--tenue); }
.vacio .boton { margin-top: 10px; }

.esqueleto {
  aspect-ratio: .68; border-radius: var(--radio);
  background: linear-gradient(100deg, var(--superficie) 40%, var(--superficie-2) 50%, var(--superficie) 60%) 0 0 / 220% 100%;
  animation: barrido 1.4s linear infinite;
}
@keyframes barrido { to { background-position: -220% 0; } }

/* Pie */
.pie {
  padding: 32px var(--margen) 110px;
  border-top: 1px solid var(--linea);
  color: var(--tenue); font-size: .92rem; text-align: center;
}
.pie strong { color: var(--texto); }

/* Botón flotante de la lista */
.fab {
  position: fixed; z-index: 20;
  right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 0 12px 0 20px;
  border: 0; border-radius: 999px;
  background: var(--acento); color: var(--acento-texto);
  font-weight: 750;
  box-shadow: 0 14px 34px -8px rgba(255, 182, 72, .55), 0 6px 20px rgba(0, 0, 0, .6);
  animation: entrar-fab .35s cubic-bezier(.2, 1.3, .4, 1);
}
.fab[hidden] { display: none; }
.fab svg { width: 20px; height: 20px; }
.fab b {
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 999px; background: var(--acento-texto); color: var(--acento);
  font-variant-numeric: tabular-nums;
}
.fab.latido { animation: latido .38s ease; }
@keyframes entrar-fab { from { transform: translateY(24px) scale(.8); opacity: 0; } }
@keyframes latido { 40% { transform: scale(1.1); } }

.volador {
  position: fixed; z-index: 30; left: 0; top: 0;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--acento);
  box-shadow: 0 0 22px 6px rgba(255, 182, 72, .6);
  pointer-events: none;
}

/* Diálogos */
dialog { color: inherit; border: 0; padding: 0; }
dialog::backdrop { background: rgba(3, 4, 6, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.panel {
  position: fixed; inset: 0 0 0 auto;
  width: min(460px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0;
  background: var(--superficie);
  border-left: 1px solid var(--linea);
}
.panel[open] { display: flex; flex-direction: column; animation: panel-lado .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes panel-lado { from { transform: translateX(100%); } }

.panel__cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--linea);
}
.panel__cabecera h2 { font-size: 1.3rem; font-weight: 750; font-stretch: 108%; }
.panel__items { flex: 1; margin: 0; padding: 0 16px; overflow-y: auto; list-style: none; overscroll-behavior: contain; }
.fila {
  display: grid; grid-template-columns: 1fr 126px; gap: 8px 12px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--linea);
}
.fila__nombre { font-weight: 550; line-height: 1.3; }
.fila__precio { font-size: .92rem; color: #c9d0d9; font-variant-numeric: tabular-nums; }
.fila__datos { display: grid; gap: 3px; min-width: 0; }
.panel__vacio { padding: 40px 0; color: var(--tenue); text-align: center; }
.panel__pie { display: grid; gap: 12px; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }
.panel__nota { font-size: .84rem; color: var(--tenue); }
.panel__largo {
  display: grid; gap: 10px; padding: 12px;
  border: 1px solid rgba(255, 182, 72, .4); border-radius: 12px;
  background: rgba(255, 182, 72, .08);
  font-size: .92rem;
}
.panel__largo[hidden] { display: none; }

.ficha {
  width: min(880px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: auto;
  border: 1px solid var(--linea); border-radius: 20px;
  background: var(--superficie);
  overflow: auto;
}
.ficha[open] { display: grid; grid-template-columns: 1.1fr 1fr; animation: ficha-entra .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes ficha-entra { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.ficha__cerrar { position: absolute; top: 12px; right: 12px; z-index: 1; }
.ficha__foto { aspect-ratio: 1; background: var(--superficie-2); }
.ficha__foto img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ficha__datos { display: flex; flex-direction: column; gap: 10px; padding: 56px 24px 24px; }
.ficha h2 { font-size: clamp(1.3rem, 2.6vw, 1.8rem); font-weight: 700; line-height: 1.18; }
.ficha .precio { margin-top: 4px; font-size: 1.6rem; }
.ficha .precio--consultar { font-size: 1.05rem; }
.ficha .accion { margin-top: 10px; }

/* Celulares */
@media (max-width: 759px) {
  .portada { min-height: 94svh; padding-top: 42svh; }
  .portada::before { display: none; }
  .portada__texto { --ancho-titulo: calc(100vw - 2 * var(--margen)); }
  .portada__fija { top: 25%; left: 50%; width: min(66vw, 300px); }
  .portada h1 { font-size: min(clamp(2.8rem, 15vw, 5rem), calc(var(--ancho-titulo) / (var(--letras, 8) * .76))); }
  .barra__interior { flex-direction: column; align-items: stretch; gap: 8px; padding-block: 10px; }
  .buscador { flex: none; }
  .categorias { flex: none; margin-inline: calc(var(--margen) * -1); padding-inline: var(--margen); }
  .tarjeta__datos { padding: 10px; }
  .tarjeta h3 { font-size: .9rem; }

  .panel { inset: auto 0 0; width: 100%; height: 88dvh; border: 0; border-top: 1px solid var(--linea); border-radius: 20px 20px 0 0; }
  .panel[open] { animation-name: panel-abajo; }
  @keyframes panel-abajo { from { transform: translateY(100%); } }

  .ficha[open] { grid-template-columns: 1fr; }
  .ficha__datos { padding: 16px; }
}

/* En pantallas táctiles, sin desenfoque en vivo: pesa mucho junto al 3D durante el scroll. */
@media (pointer: coarse) {
  .barra {
    background: rgba(7, 9, 12, .97);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
