/* ==========================================================================
   Kraft 3D Studio — página Tienda
   ========================================================================== */

.tienda { padding-bottom: var(--e-9); }

/* --- Filtros ------------------------------------------------------------- */


.tienda__conteo { font-size: var(--t-sm); }

/* --- Grilla -------------------------------------------------------------- */

.tienda__grilla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--e-6) var(--e-3);
}
@media (min-width: 720px)  { .tienda__grilla { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--e-7) var(--e-5); } }
@media (min-width: 1200px) { .tienda__grilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }


/* Fichas más compactas en dos columnas (móvil) */
@media (max-width: 719px) {
  .tienda__grilla .ficha__cuerpo { gap: var(--e-2); padding-top: var(--e-3); }
  .tienda__grilla .ficha__nombre { font-size: 1rem; }
  .tienda__grilla .ficha__meta { font-size: var(--t-xs); gap: 0 .6em; }
  .tienda__grilla .ficha__plazo { font-size: var(--t-xs); }
  .tienda__grilla .ficha__monto { font-size: 1.35rem; }
  .tienda__grilla .ficha__tags { top: var(--e-2); left: var(--e-2); }
  .tienda__grilla .tag { font-size: .625rem; padding: .45em .65em; letter-spacing: .1em; }
  .tienda__grilla .btn {
    min-height: 44px;
    padding: .7em .6em;
    font-size: .6875rem;
    letter-spacing: .04em;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }
  .tienda__grilla .ficha__personalizar { font-size: var(--t-xs); }
}


/* --- Detalle de la pieza (diálogo) -------------------------------------- */

.detalle {
  width: min(100% - 2 * var(--e-3), 1040px);
  max-height: calc(100dvh - 2 * var(--e-3));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radio-lg);
  background: var(--blanco);
  color: var(--navy);
  overflow: auto;
  overscroll-behavior: contain;
}
.detalle::backdrop { background: rgb(7 11 51 / .72); }
.detalle[open] { animation: detalle-entra var(--dur) var(--ease); }
@keyframes detalle-entra {
  from { opacity: 0; transform: translateY(16px); }
}

/* En el teléfono ocupa toda la pantalla, como una página */
@media (max-width: 719px) {
  .detalle {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
}

.detalle__marco { position: relative; display: grid; }
@media (min-width: 720px) {
  .detalle__marco { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}

.detalle__cerrar {
  position: absolute;
  top: var(--e-3);
  right: var(--e-3);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--blanco);
  color: var(--navy);
  box-shadow: 0 2px 10px rgb(7 11 51 / .18);
}
.detalle__cerrar svg { width: 22px; height: 22px; }

.detalle__galeria { background: var(--gris-foto); min-width: 0; }
.detalle__fotos {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.detalle__fotos::-webkit-scrollbar { display: none; }
.detalle__fotos img {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  scroll-snap-align: start;
}
.detalle--vendida .detalle__fotos img { filter: grayscale(1); opacity: .6; }
/* En el teléfono, que el precio y el botón de compra asomen sin bajar tanto */
@media (max-width: 719px) {
  .detalle__fotos img { max-height: 56dvh; }
}

.detalle__miniaturas {
  display: flex;
  gap: var(--e-2);
  padding: var(--e-3);
  overflow-x: auto;
}
.detalle__miniaturas:empty { display: none; }
.detalle__miniaturas button {
  flex: none;
  width: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radio-sm);
  background: none;
  overflow: hidden;
}
.detalle__miniaturas button[aria-current="true"] { border-color: var(--azul); }
.detalle__miniaturas img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

.detalle__info {
  display: flex;
  flex-direction: column;
  gap: var(--e-4);
  padding: var(--e-6) var(--gutter) calc(var(--e-7) + env(safe-area-inset-bottom));
}
@media (min-width: 720px) {
  .detalle__info { padding: var(--e-8) var(--e-7) var(--e-7); justify-content: center; }
}
.detalle__tags { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.detalle .ficha__precio { margin-top: var(--e-2); }
.detalle__copiado:empty { display: none; }
.detalle__copiado { font-size: var(--t-sm); }

/* Esqueletos mientras cargan las piezas: reservan el espacio para que la página no salte */
.ficha--esqueleto .ficha__media { background: var(--gris-foto); animation: esqueleto 1.4s ease-in-out infinite alternate; }
.ficha--esqueleto .ficha__cuerpo span { display: block; height: 1rem; border-radius: 4px; background: var(--gris-foto); }
.ficha--esqueleto .ficha__cuerpo span:nth-child(1) { width: 70%; height: 1.2rem; }
.ficha--esqueleto .ficha__cuerpo span:nth-child(2) { width: 45%; }
.ficha--esqueleto .ficha__cuerpo span:nth-child(3) { width: 100%; height: 44px; margin-top: 3rem; border-radius: var(--radio-pill); }
@keyframes esqueleto { to { opacity: .55; } }

/* Navidad: aviso del catálogo de temporada */
.tienda__navidad {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25em .6em;
  margin-top: var(--e-4);
  padding: .7em 1.1em;
  border-radius: 1.2em;
  background: var(--navy);
  color: var(--celeste);
  font-size: var(--t-sm);
}
.tienda__navidad[hidden] { display: none; }
.tienda__navidad .enlace { color: inherit; }
