:root {
  --navy: #132247;
  --navy-oscuro: #0d1834;
  --navy-claro: #1b2f5f;
  --amarillo: #ffc928;
  --rojo: #b71924;
  --suave: #c9d3ea;
  color-scheme: dark;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  background: var(--navy);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.wrap { width: min(100%, 812px); padding-inline: 16px; margin-inline: auto; }

header { background: var(--navy-oscuro); }
.cabecera { display: flex; align-items: center; gap: 20px; padding-block: 12px; }
.cabecera img { object-fit: contain; }
h1 { margin: 0; font-size: clamp(1.35rem, 5vw, 1.75rem); }

.galeria {
  position: relative;
  width: min(100%, 900px);
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  background: var(--navy-oscuro);
}
.galeria img { width: 100%; height: 100%; display: block; object-fit: cover; }
.galeria button {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  padding: 0 0 4px;
  border: 0;
  border-radius: 50%;
  background: rgb(13 24 52 / 80%);
  color: white;
  font-size: 2rem;
  line-height: 1;
}
.anterior { left: 8px; }
.siguiente { right: 8px; }
.puntos { position: absolute; inset: auto 0 8px; display: flex; justify-content: center; gap: 6px; }
.puntos span { width: 8px; height: 8px; border-radius: 50%; background: var(--suave); }
.puntos .activo { background: var(--amarillo); }

.indice {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--navy-oscuro);
  border-bottom: 3px solid var(--amarillo);
}
.enlaces { display: flex; gap: 8px; overflow-x: auto; padding-block: 8px; }
.enlaces a {
  flex: none;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding-inline: 14px;
  border-radius: 999px;
  background: var(--amarillo);
  color: var(--navy-oscuro);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
}
.enlaces a.destacado { background: white; color: var(--rojo); }

.busqueda { display: grid; gap: 8px; margin-block: 20px 8px; }
.busqueda label { font-weight: 700; }
.busqueda input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--suave);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--navy-oscuro);
  color: white;
}
.busqueda input::placeholder { color: var(--suave); }

#estado:empty { margin: 0; }
section { padding-block: 14px; scroll-margin-top: 83px; }
h2 { margin: 0 0 12px; font-size: clamp(1.35rem, 5vw, 1.8rem); }
.cuadricula { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.tarjeta {
  position: relative;
  min-width: 0;
  height: clamp(205px, 58vw, 275px);
  perspective: 900px;
  border-radius: 10px;
}
.tarjeta:focus-within { outline: 2px solid var(--amarillo); outline-offset: 2px; }
.giro {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.tarjeta.abierta .giro { transform: rotateY(180deg); }
.cara {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  border-radius: inherit;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.giro { border-radius: inherit; }
.frente { background: var(--navy-claro); }
.frente .nombre { margin-top: auto; background: var(--navy-oscuro); }
.frente img {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: cover;
  background: var(--navy-claro);
}
.nombre {
  margin: 0;
  padding: 10px;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.insignia {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--rojo);
  color: white;
  font-size: .75rem;
  font-weight: 700;
}
.reverso {
  transform: rotateY(180deg);
  background: white;
  color: var(--navy-oscuro);
}
.detalle { overflow: auto; flex: 1; padding: 0 10px 6px; }
.detalle:focus-visible { outline-color: var(--navy); outline-offset: -2px; }
.descripcion { margin: 0 0 8px; font-size: .875rem; line-height: 1.4; white-space: pre-line; }
.precio {
  margin: 0;
  padding: 4px 10px 0;
  color: var(--rojo);
  font-size: 1.3rem;
  font-weight: 800;
}
.presentaciones { margin: 0; padding: 0; list-style: none; font-size: .875rem; }
.presentaciones li { padding-bottom: 4px; }
.presentaciones strong { color: var(--rojo); }
.lista { margin: 0; padding: 0; list-style: none; font-size: .8125rem; line-height: 1.3; }
.lista li { padding: 5px 0; border-bottom: 1px solid rgb(13 24 52 / 12%); }
.lista .producto { display: block; font-weight: 700; }
.lista .precios { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lista strong { color: var(--rojo); }
.voltear {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
}
.abierta .voltear {
  inset: auto 0 0;
  min-height: 44px;
  border-radius: 0 0 10px 10px;
  color: var(--navy-oscuro);
  font-size: .875rem;
  font-weight: 700;
}
.reverso { padding-bottom: 44px; }
footer { padding-block: 20px 30px; color: var(--suave); text-align: center; }

@media (min-width: 620px) {
  .cuadricula { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 820px) {
  .cuadricula { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .giro { transition: none; }
}

.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nota { margin: 8px 0 0; font-size: .75rem; line-height: 1.35; color: var(--navy); }
