/* Portada: la palabra enorme y un solo tenis delante */
.portada {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: 26px 16px 18px;
  min-height: 300px;
}
.palabra {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: min(calc(150vw / var(--letras, 9)), 300px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--tinta);
}
/* Los tenis pasan como en una rueda de exhibición, con el eje debajo de la portada */
.giro {
  position: relative;
  z-index: 1;
  width: 94vw;
  max-width: 660px;
  aspect-ratio: 1.08;
  margin: -8vw auto 0;
  translate: -1vw 0;
}
.giro-tenis {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 230%;
  rotate: 24deg;
  opacity: 0;
  filter: drop-shadow(0 24px 18px var(--sombra));
  transition: rotate 1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.giro-tenis.activo { rotate: 0deg; opacity: 1; }
.giro-tenis.sale { rotate: -24deg; opacity: 0; transition: rotate 0.8s cubic-bezier(0.5, 0, 0.75, 0.4), opacity 0.55s ease 0.15s; }
.giro-tenis.primera { animation: llega 0.9s var(--suela) both; }
.giro-pausa {
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--suave);
}
.giro-pausa[hidden] { display: none; }
.giro-pausa:hover { background: #e7dcc9; color: var(--tinta); }
.portada-frase {
  position: relative;
  z-index: 2;
  margin: 6px 0 0;
  text-align: center;
  color: var(--suave);
  font-size: 16px;
}
@keyframes llega {
  from { rotate: 24deg; opacity: 0; }
}

/* Buscador y para quién */
.herramientas {
  display: grid;
  gap: 10px;
  padding: 10px 16px 6px;
  max-width: 1320px;
  margin: 0 auto;
}
.buscar input {
  width: 100%;
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--hueso-claro);
  box-shadow: inset 0 0 0 1.5px rgb(141 106 66 / 0.35);
  font-size: 17px;
}
.buscar input::placeholder { color: var(--suave); }
.para { display: flex; gap: 6px; }
.para button {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  transition: background 0.18s, color 0.18s;
}
.para button[aria-pressed="true"] { background: var(--tinta); color: var(--hueso); }

/* Marcas: una fila de cajas de zapatos */
.cajas {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  padding: 16px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(var(--hueso) 86%, transparent);
}
.cajas::-webkit-scrollbar { display: none; }
.caja {
  position: relative;
  flex: 0 0 auto;
  width: 124px;
  height: 78px;
  padding: 20px 10px 8px;
  border: 0;
  border-radius: 7px 7px 11px 11px;
  background: var(--carton) url("/img/carton.webp");
  background-size: 180px;
  box-shadow: 0 9px 11px -5px var(--sombra), inset 0 -6px 9px -6px rgb(70 44 16 / 0.45);
  display: grid;
  place-items: center;
  text-align: center;
  transition: translate 0.25s var(--suela), box-shadow 0.25s;
}
.caja::before {
  content: "";
  position: absolute;
  inset: -3px -3px auto;
  height: 17px;
  border-radius: 6px 6px 3px 3px;
  background: var(--carton-oscuro) url("/img/carton.webp");
  background-size: 180px;
  background-blend-mode: multiply;
  box-shadow: 0 3px 3px rgb(50 30 10 / 0.3);
  transition: background-color 0.25s;
}
.caja:nth-child(3n + 1) { rotate: -1.4deg; }
.caja:nth-child(3n + 2) { rotate: 0.9deg; }
.caja-nombre {
  font-family: var(--display);
  font-size: 19px;
  line-height: 1;
  text-wrap: balance;
}
.caja-cuenta {
  position: absolute;
  right: -5px;
  top: -9px;
  z-index: 1;
  min-width: 27px;
  height: 27px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--tinta);
  color: var(--hueso);
  font-size: 13px;
  font-weight: 700;
  line-height: 27px;
  font-variant-numeric: tabular-nums;
}
.caja:hover { translate: 0 -3px; }
.caja[aria-pressed="true"] { translate: 0 -5px; box-shadow: 0 16px 14px -6px var(--sombra); }
.caja[aria-pressed="true"]::before { background-color: var(--senal); background-image: none; }
.caja[aria-pressed="true"] .caja-cuenta { background: var(--senal); }

.resultado {
  max-width: 1320px;
  margin: 4px auto 0;
  padding: 0 16px;
  color: var(--suave);
  font-size: 15px;
}

/* Vitrina por marca */
.vitrina {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px 40px;
  scroll-margin-top: 112px;
}
.marca {
  content-visibility: auto;
  contain-intrinsic-size: auto 1000px;
  padding-top: 30px;
}
.marca-cabeza {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 42px;
}
.marca-titulo {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px, 9vw, 74px);
  line-height: 1;
}
.marca-cuenta { position: relative; z-index: 1; color: var(--suave); font-size: 15px; white-space: nowrap; }
.cordon {
  position: absolute;
  inset: auto 0 -30px 0;
  width: 100%;
  height: 30px;
  fill: none;
  stroke: var(--senal);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.85;
}

.rejilla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 14px;
  padding-bottom: 30px;
}
.rejilla > :nth-child(even) { translate: 0 26px; }

.tarjeta {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.tarjeta-foto {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  /* Silueta de plantilla de zapato: punta redonda, talón más angosto */
  border-radius: 46% 46% 34% 34% / 24% 24% 15% 15%;
  overflow: hidden;
  background: #e7dcc9;
  box-shadow: 0 16px 18px -11px var(--sombra);
}
.tarjeta-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
  transition: scale 0.5s var(--suela);
}
.tarjeta:hover .tarjeta-foto img { scale: 1.06; }
.tarjeta-texto { display: grid; gap: 1px; padding: 12px 6px 0; }
.tarjeta-nombre { font-weight: 700; line-height: 1.2; }
.tarjeta-precio { font-variant-numeric: tabular-nums; }
.tarjeta-precio.sin { color: var(--senal); font-weight: 600; }
.tarjeta-extra { color: var(--suave); font-size: 14.5px; }

.vacio { padding: 48px 8px; text-align: center; }
.vacio p { margin: 0 0 16px; font-size: 19px; }

.cargando { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; padding-top: 30px; }
.cargando span {
  aspect-ratio: 3 / 4;
  border-radius: 46% 46% 34% 34% / 24% 24% 15% 15%;
  background: #e7dcc9;
  animation: late 1.3s ease-in-out infinite alternate;
}
@keyframes late { to { opacity: 0.45; } }

/* Pie */
.pie {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 30px;
  padding: 70px 16px 34px;
  background: var(--tinta);
  color: var(--hueso);
  text-align: center;
  border-radius: 50% 50% 0 0 / 46px 46px 0 0;
}
.pie-titulo { margin: 0; font-family: var(--display); font-size: clamp(34px, 8vw, 62px); line-height: 1; }
.pie-nota { margin: 14px 0 0; font-size: 14px; color: #bcae9c; }

/* Ficha del tenis */
.ficha {
  width: 100%;
  max-width: 100%;
  max-height: 94dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--hueso-claro);
  color: var(--tinta);
  overflow-y: auto;
}
.ficha[open] { animation: sube 0.32s var(--suela); }
@keyframes sube { from { translate: 0 60px; opacity: 0; } }
.cerrar {
  position: sticky;
  top: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 12px 12px -58px auto;
  border: 0;
  border-radius: 50%;
  background: var(--tinta);
  color: var(--hueso);
}
.ficha-foto {
  position: relative;
  background: #e7dcc9;
  overflow: hidden;
  touch-action: pan-y;
  cursor: zoom-in;
  user-select: none;
  -webkit-touch-callout: none;
}
.ficha-foto img { width: 100%; max-height: 58dvh; object-fit: contain; transition: opacity 0.2s; }
.ficha-foto img.cambia { opacity: 0.35; }
.lupa {
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 4px solid var(--hueso-claro);
  box-shadow: 0 14px 28px rgb(28 21 16 / 0.4);
  background-repeat: no-repeat;
  pointer-events: none;
  translate: -50% -50%;
}
.ficha-datos { display: grid; gap: 8px; padding: 16px 18px calc(22px + env(safe-area-inset-bottom)); }
.ficha-miniaturas { display: flex; gap: 8px; overflow-x: auto; padding: 3px 3px 8px; scrollbar-width: none; }
.ficha-miniaturas:empty { display: none; }
.miniatura {
  flex: 0 0 auto;
  width: 58px;
  height: 74px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 46% 46% 34% 34% / 24% 24% 15% 15%;
  overflow: hidden;
  opacity: 0.72;
}
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.miniatura[aria-pressed="true"] { opacity: 1; outline: 3px solid var(--senal); outline-offset: 1px; }
.ficha-marca { margin: 0; color: var(--suave); }
.ficha-titulo { margin: 0; font-family: var(--display); font-weight: 400; font-size: 36px; line-height: 1.05; }
.ficha-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 10px; }
.ficha-info dt { color: var(--suave); font-size: 15px; }
.ficha-info dd { margin: 0; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ficha .boton { width: 100%; }

@media (min-width: 768px) {
  .portada { padding-top: 34px; min-height: 0; }
  .palabra { font-size: min(calc(136vw / var(--letras, 9)), 280px); }
  .giro { width: min(50vw, 760px); max-width: none; aspect-ratio: 1.35; margin-top: -7vw; translate: none; }
  .herramientas { grid-template-columns: minmax(0, 1fr) 360px; align-items: center; padding-inline: 28px; }
  .cajas {
    padding-inline: max(28px, calc((100vw - 1264px) / 2));
    scrollbar-width: thin;
    scrollbar-color: var(--carton-oscuro) transparent;
  }
  .caja { width: 146px; height: 86px; }
  .caja-nombre { font-size: 22px; }
  .resultado, .vitrina { padding-inline: 28px; }
  .rejilla, .cargando { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 22px; }
  .ficha {
    display: none;
    width: min(980px, 94vw);
    max-height: 88dvh;
    margin: auto;
    border-radius: 30px;
  }
  .ficha[open] { display: grid; grid-template-columns: 1.25fr 1fr; }
  .cerrar { position: absolute; top: 14px; right: 14px; margin: 0; }
  .ficha-foto { display: grid; place-items: center; min-height: 100%; }
  .ficha-foto img { max-height: 88dvh; height: 100%; }
  .ficha-datos { align-content: center; padding: 30px; }
  .ficha-titulo { font-size: 46px; }
}

@media (min-width: 1200px) {
  .rejilla, .cargando { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
