/**
 * categories.css — Sección Categorías con carrusel scroll-snap
 * (categories-section + categories-carousel del frontend Astro).
 *
 * Depende de: tokens.css y assets/js/carousel.js (botones prev/next).
 * El snap y el arrastre táctil son CSS nativo — sin embla ni dependencias.
 */

/* ==========================================================================
   Sección y encabezado
   ========================================================================== */
.lm-cats {
  position: relative;
  overflow: hidden;
  max-width: 100svw;
  padding: 5rem 0; /* py-20 */
}
.lm-cats__container {
  max-width: 96rem; /* ≈ max-w-9xl */
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem; /* gap-8 */
}

.lm-cats__header {
  width: 100%;
  display: flex;
  flex-wrap: wrap; /* adaptación mobile */
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.lm-cats__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary);
  font-size: 6vw; /* base mobile; valor del TSX en md+ */
  line-height: 1.1;
}
.lm-cats__all {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-text);
  font-size: 1.125rem; /* text-lg */
  font-weight: 500;
  color: var(--on-background);
  text-decoration: none;
}
.lm-cats__all:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Carrusel genérico (scroll-snap)
   ========================================================================== */
.lm-carousel {
  position: relative;
  width: 100%;
}
.lm-carousel__viewport {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 0.5rem 1rem 0 0; /* pt-2 pr-4 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* el scrollbar lo reemplazan los botones */
}
.lm-carousel__viewport::-webkit-scrollbar {
  display: none;
}

/* Botones prev/next (abajo a la derecha, como el TSX) */
.lm-carousel__btn {
  position: absolute;
  bottom: -3rem; /* -bottom-12 */
  width: 2.25rem; /* size-9 */
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: var(--outline-variant);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.lm-carousel__btn--prev {
  right: 5rem; /* right-20 */
}
.lm-carousel__btn--next {
  right: 1rem; /* right-4 */
}
.lm-carousel__btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.lm-carousel__btn svg {
  display: block;
}

/* ==========================================================================
   Slides y tarjetas de categoría
   ========================================================================== */
.lm-cats__slide {
  flex: 0 0 85%; /* adaptación mobile (el TSX era basis-1/3 fijo) */
  min-width: 0;
  scroll-snap-align: start;
}

.lm-cats__card {
  width: 100%;
  text-align: center;
  padding: 0 0.5rem; /* px-2 */
}

/* Cover con degradado y producto apoyado en la base */
.lm-cats__cover-link {
  display: block;
  text-decoration: none;
}
.lm-cats__cover {
  height: 30rem; /* h-120 */
  max-height: 30rem;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  border-radius: 2rem; /* rounded-4xl */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* shadow-xs */
  transition: transform 0.3s ease-in-out;
}
.lm-cats__cover:hover {
  transform: scale(1.02); /* hover:scale-[1.02] */
}
/* Degradados hardcodeados del TSX, alternados */
.lm-cats__cover--a {
  background: linear-gradient(180deg, #c7b3cc, #268ab2);
}
.lm-cats__cover--b {
  background: linear-gradient(180deg, #95ecb0, #f3f98a);
}
.lm-cats__picture {
  display: block;
  position: relative;
  margin: 0;
  padding: 0.75rem; /* p-3 */
  max-width: 100%;
  max-height: 100%;
}
.lm-cats__picture img {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

/* Badge (slot vacío en el original, reserva su altura) + título */
.lm-cats__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1rem; /* h-4 */
}
.lm-cats__badge span {
  font-family: var(--font-text);
  font-size: 0.75rem; /* text-xs */
  font-weight: 600;
  letter-spacing: -0.05em; /* tracking-tighter */
}
.lm-cats__heading h3 {
  margin: 0;
  font-family: var(--font-text);
  font-size: 2.25rem; /* text-4xl */
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: 0.007em;
  color: var(--on-background);
}

/* Descripción con altura fija (alinea las tarjetas entre sí) */
.lm-cats__desc {
  height: 4.5rem; /* h-18 */
  margin-bottom: 2rem; /* mb-8 */
  padding: 0 1.75rem; /* px-7 */
}
.lm-cats__desc p {
  margin: 1rem 0; /* my-4 */
  font-family: var(--font-text);
  font-size: 1.125rem; /* text-lg */
  font-weight: 400;
  line-height: 1.24;
  letter-spacing: -0.025em; /* tracking-tight */
  color: var(--on-background);
}

/* Acciones */
.lm-cats__actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2.25rem; /* gap-9 */
}
.lm-cats__btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem 3rem; /* py-7 px-12 */
  border-radius: 1rem; /* rounded-2xl */
  background: var(--primary);
  color: var(--on-primary-container);
  font-family: var(--font-text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 0;
  text-decoration: none;
  transition: filter 0.2s ease;
}
.lm-cats__btn-primary:hover {
  filter: brightness(0.97);
}
.lm-cats__btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-text);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-background);
  text-decoration: none;
}
.lm-cats__btn-ghost:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Breakpoint md: valores del TSX
   ========================================================================== */
@media (min-width: 768px) {
  .lm-cats__title {
    font-size: 2.8vw; /* text-[2.8cqw] */
  }
  .lm-cats__slide {
    flex-basis: 33.3333%; /* basis-1/3 */
  }
}

/* ==========================================================================
   Accesibilidad: movimiento reducido
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .lm-carousel__viewport {
    scroll-behavior: auto;
  }
  .lm-cats__cover {
    transition: none;
  }
}
