/* ---------------------------------------------------------------
   Catálogo LW1ESM — estilos base + galería con carrusel + modal
   --------------------------------------------------------------- */

:root {
  --navy-900: #131b24;
  --navy-800: #182531;
  --navy-700: #22323f;
  --amber: #dba25f;
  --terracotta: #c65b34;
  --terracotta-dark: #a8492a;
  --green: #2f9e57;
  --green-dark: #257e45;
  --ink: #1c2530;
  --gray-700: #4b5563;
  --gray-500: #7c8894;
  --gray-300: #d7dce1;
  --paper: #f2f3f5;
  --card: #ffffff;
  --border: #e4e6ea;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 10px 24px -14px rgba(19, 27, 36, 0.28);
  --shadow-card-hover: 0 18px 34px -16px rgba(19, 27, 36, 0.35);
  --shadow-modal: 0 30px 70px -20px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header / hero ---------- */

.hero {
  background: linear-gradient(160deg, var(--navy-800) 0%, var(--navy-900) 100%);
  padding: 56px 0 48px;
}

.hero .eyebrow {
  margin: 0 0 12px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 16px;
  color: #ffffff;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero .intro {
  margin: 0;
  max-width: 560px;
  color: #b7c2cc;
  font-size: clamp(15px, 1.6vw, 18px);
}

/* ---------- Notices ---------- */

main.wrap {
  padding-top: 32px;
  padding-bottom: 64px;
}

.notice {
  display: block;
  margin-bottom: 28px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: #fff3e0;
  border: 1px solid #f0d3a8;
  color: #7a5417;
  font-size: 14.5px;
}

.notice.error {
  background: #fdecea;
  border-color: #f3c1bb;
  color: #9c2c1f;
}

.notice code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.search input {
  width: 280px;
  max-width: 100%;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 14.5px;
  color: var(--ink);
}

.search input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(198, 91, 52, 0.15);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.filter:hover {
  border-color: var(--navy-800);
}

.filter.active {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #ffffff;
}

.filter:focus-visible,
.search input:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

/* ---------- Grid & cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.card:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

.card[hidden] {
  display: none;
}

/* Placeholder cuando no hay fotos */
.photo {
  aspect-ratio: 4 / 3;
  background: #eceff1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 13.5px;
  position: relative;
}

.card-body {
  padding: 18px 20px 20px;
}

.card-body .category {
  margin: 0 0 6px;
  color: var(--terracotta);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-body h2 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.card-body .meta {
  margin: 0 0 10px;
  color: var(--gray-500);
  font-size: 13.5px;
}

.card-body .price {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}

.whatsapp {
  display: block;
  text-align: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--green);
  color: #ffffff;
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  transition: background 0.15s var(--ease);
}

.whatsapp:hover {
  background: var(--green-dark);
}

.whatsapp:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

.stock-badge {
  margin: 0;
  display: block;
  text-align: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: #fdecea;
  border: 1px solid #f3c1bb;
  color: #9c2c1f;
  font-weight: 700;
  font-size: 14.5px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--gray-500);
  padding: 48px 0;
  font-size: 15px;
}

footer {
  background: var(--navy-900);
  color: #94a1ac;
  text-align: center;
  padding: 22px 0;
  font-size: 13.5px;
}

/* ---------------------------------------------------------------
   Carrusel de fotos (tarjetas y modal)
   --------------------------------------------------------------- */

.carousel {
  overflow: hidden;
  position: relative;
  background: #eceff1;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.32s var(--ease);
}

.carousel-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.car-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(19, 27, 36, 0.5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

.car-arrow:hover {
  background: rgba(19, 27, 36, 0.75);
}

.car-arrow:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.car-arrow svg {
  width: 16px;
  height: 16px;
}

.car-arrow.prev {
  left: 10px;
}

.car-arrow.next {
  right: 10px;
}

.car-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.car-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

.car-dot.is-active {
  background: #ffffff;
  transform: scale(1.35);
}

/* ---------------------------------------------------------------
   Modal de detalle
   --------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 21, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay.is-visible {
  opacity: 1;
}

.modal {
  background: var(--card);
  width: min(1040px, 100%);
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow-y: auto;
  position: relative;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s var(--ease);
}

.modal-overlay.is-visible .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(19, 27, 36, 0.55);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s var(--ease);
}

.modal-close:hover {
  background: rgba(19, 27, 36, 0.8);
}

.modal-close:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
}

.detail-photo {
  position: sticky;
  top: 0;
  aspect-ratio: auto;
  height: min(82vh, 760px);
}

.detail-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
}

.carousel--detail .carousel-track img {
  object-fit: contain;
  background: #eceff1;
}

.carousel--detail .car-arrow {
  width: 40px;
  height: 40px;
}

.carousel--detail .car-arrow svg {
  width: 20px;
  height: 20px;
}

.detail-body {
  padding: 32px 32px 32px 28px;
}

.detail-body .category {
  margin: 0 0 8px;
  color: var(--terracotta);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-body h2 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

.detail-body .meta {
  margin: 0 0 12px;
  color: var(--gray-500);
  font-size: 14.5px;
}

.detail-body .price {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
}

.detail-body .location {
  margin: 0 0 16px;
  color: var(--gray-700);
  font-size: 14px;
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--gray-700);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.share-button:hover {
  border-color: var(--navy-800);
  color: var(--navy-800);
}

.share-button:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

.share-button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.share-button.is-copied {
  border-color: var(--green);
  background: #eefaf1;
  color: var(--green-dark);
}

.detail-body .description {
  margin: 0 0 24px;
  color: var(--gray-700);
  font-size: 14.5px;
  line-height: 1.6;
}

.detail-body .description p:first-child {
  margin-top: 0;
}

.detail-body .whatsapp {
  display: inline-block;
  padding: 13px 28px;
}

.detail-body .stock-badge {
  display: inline-block;
  padding: 13px 28px;
}

/* Modal ampliado para categorías que se benefician de fotos más grandes
   (por ahora: "computadora de escritorio" u otra categoría que incluya "escritorio"). */
.modal.is-wide {
  width: min(1200px, 96vw);
}

.modal.is-wide .detail {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}

.modal.is-wide .detail-photo {
  height: min(86vh, 820px);
}

@media (max-width: 720px) {
  .modal.is-wide .detail {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */

@media (max-width: 720px) {
  .hero {
    padding: 40px 0 32px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search input {
    width: 100%;
  }

  .detail {
    grid-template-columns: 1fr;
  }

  .detail-photo,
  .modal.is-wide .detail-photo {
    height: min(55vh, 420px);
  }

  .detail-body {
    padding: 24px;
  }

  .modal {
    max-height: 92vh;
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------
   Accesibilidad: respeta la preferencia de menos movimiento
   --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .card,
  .carousel-track,
  .car-dot,
  .modal-overlay,
  .modal {
    transition: none !important;
  }
}
