:root {
  --bg: #fdf6e3;          /* Beige cálido */
  --text: #3c2f2f;        /* Marrón oscuro para texto */
  --muted: #1d1915;       /* Marrón grisáceo para secundarios */
  --card: #fffaf3;        /* Fondo cálido para tarjetas */
  --accent: #d46d29;      /* Terracota/naranja suave */
  --accent-light: #f2b880;/* Naranja claro */
  --highlight: #e85d75;   /* Rosado cálido para detalles */
  --shadow: 0 6px 20px rgba(0,0,0,.08);
}

/* ===== Hero de bienvenida ===== */
.hero-bienvenida {
  background: linear-gradient(135deg, #FFD700, #FF6F61, #40E0D0);
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-box {
  background-color: #fff;
  border: 2px solid #FFD700;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 600px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(255, 111, 97, 0.25);
}
.hero-box h2 {
  color: #FF6F61;
  margin-bottom: 0.8rem;
  font-size: 1.6rem;
}
.hero-box p {
  color: var(--text);
  margin-bottom: 1.2rem;
  font-size: 1rem;
}
.hero-box .btn {
  background-color: #40E0D0;
  color: #fff;
  font-weight: bold;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
}
.hero-box .btn:hover {
  background-color: #FF6F61;
}

/* ===== Estilos base ===== */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  text-align: center;
  /* Patrón de fondo */
  background-image: 
    linear-gradient(45deg, rgba(212,109,41,0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(232,93,117,0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(212,109,41,0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(232,93,117,0.08) 75%);
  background-size: 40px 40px;
}

header {
  background: linear-gradient(90deg, #FFD700, #FF6F61);
  padding: 1.5rem;
}
@keyframes glow {
  0% { text-shadow: 0 0 5px #35b8ab; }
  50% { text-shadow: 0 0 15px #FF6F61; }
  100% { text-shadow: 0 0 5px #000000; }
}
header h1 {
  font-family: 'Baloo 2', cursive; /* fuente más amigable */
  font-size: 3.4rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  text-shadow: 4px 3px 4px rgba(0,0,0,0.25);
  animation: glow 3s infinite alternate;
}
main h2 {
  font-size: 1.7rem;
  position: relative;
  display: inline-block;
  display: inline-block;
  background-color: rgba(255, 215, 0, 0.15); /* dorado translúcido */
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(255, 111, 97, 0.25);
  animation: fadeInUp 0.8s ease-out;
}
main h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 4px;
  background: #d46d29; /* terracota */
  border-radius: 2px;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Brand y Logo ===== */
.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}
.logo-wrapper {
  width: 70px;              /* tamaño del óvalo */
  height: 100px;              /* más pequeño y ovalado */
  border-radius: 50%;        /* recorta la imagen en óvalo */
  border: 3px solid #FFD700; /* línea dorada alrededor */
  box-shadow: var(--shadow);
  overflow: hidden;          /* recorta todo lo que sobresalga */
}
.logo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;         /* la imagen llena todo el óvalo */
}

/* ===== Menú principal ===== */
.nav {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.nav a {
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background-color: #35b8ab;
}
.nav a:hover {
  background-color: #FF6F61;
  color: #fff;
}

/* ===== Contenedor principal ===== */
.container {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Secciones (centrar tarjetas) ===== */
.hero {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Tarjetas de productos ===== */
.card {
  background: var(--card);
  border: 2px solid #FFD700;
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 4px 8px rgba(255, 111, 97, 0.2);
  text-align: center;
  width: 180px;        /* ancho fijo */
  min-height: 300px;   /* altura base uniforme */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* distribuye imagen y texto */
}
.card .body h3 {
  margin-top: 0;
  color: #FF6F61;
  font-size: 1rem;
  white-space: normal;
  word-wrap: break-word;
  min-height: 2.4em;   /* espacio reservado para ~2 líneas */
  line-height: 1.2em;  /* controla la altura de cada línea */
  overflow: hidden;    /* evita que se desborde */
}
.card .body p {
  font-size: 0.85rem;
  margin: 0.05rem 0;
  min-height: 2.3em;   /* espacio reservado para ~2 líneas */
  line-height: 1.1em;  /* controla la altura de cada línea */
  overflow: hidden;    /* evita que se desborde */
}
/* Ajuste específico para el párrafo del código */
.card .body p:first-of-type {
  font-size: 0.85rem;
  margin-top: 0.1rem;    /* casi pegado al título */
  margin-bottom: 0.1rem; /* menos espacio debajo */
}
/* Pegado al título (h3) */
.card .body h3 + p {
  margin-top: 0.05rem;
}
/* Compacta solo el párrafo del código */
.card .body p:first-of-type {
  margin-top: 0.05rem;
  margin-bottom: 0.75rem;
  min-height: 0;        /* elimina la reserva de 2 líneas en el código */
  line-height: 1.2em;
}
/* Reduce el espacio entre código y descripción */
.card .body p:first-of-type + p {
  margin-top: 0.20rem;
}
/* Carrusel dentro de la tarjeta */
.card .img-carousel {
  width: 100%;
  height: 160px;              /* misma altura que .card .img */
  background-color: #f0f0f0;  /* igual que tus imágenes */
  border-radius: 6px;
  overflow-x: auto;           /* scroll horizontal */
  scroll-snap-type: x mandatory;
  display: flex;
}
.card .img-carousel .slides {
  display: flex;
  width: 100%;
}
.card .img-carousel img {
  width: 100%;
  height: 160px;              /* igual que .card .img */
  object-fit: contain;        /* mantiene proporción */
  flex-shrink: 0;             /* evita que se compriman */
  scroll-snap-align: center;  /* cada imagen se centra al deslizar */
}

/* ===== Lightbox para imágenes de productos ===== */
.lightbox {
  display: none;              /* Oculto por defecto */
  position: fixed;
  z-index: 1000;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8); /* Fondo oscuro */
  text-align: center;
}
.lightbox img {
  max-width: 80%;
  max-height: 80%;
  margin: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
/* Cuando el lightbox está activo */
.lightbox:target {
  display: block;
}
/* Botón de cerrar */
.lightbox .close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  text-decoration: none;
  font-weight: bold;
}
.view-link {
  display: block;
  font-size: 0.8rem;
  color: #FF6F61;
  text-decoration: underline;
  margin-top: 4px;
  cursor: pointer;
}
.card .img-carousel a {
  flex-shrink: 0;             /* evita que se compriman */
  scroll-snap-align: center;  /* cada imagen se centra al deslizar */
  width: 100%;
  height: 160px;
  display: flex;              /* asegura que la imagen ocupe el espacio */
  justify-content: center;
  align-items: center;
}
.card .img-carousel a img {
  width: 100%;
  height: 160px;
  object-fit: contain;        /* mantiene proporción */
  border-radius: 6px;
}

/* ===== Tarjetas informativas del index ===== */
.card-info {
  background: var(--card);
  border: 2px solid #FFD700;
  border-radius: 8px;
  padding: 1.2rem;
  box-shadow: 0 4px 8px rgba(255, 111, 97, 0.2);
  text-align: center;
  max-width: 700px;
  margin: 1rem auto;
}
.card-info .body h3 {
  margin-top: 0;
  color: #FF6F61;
  font-size: 1.2rem;
}
.card-info p,
.card-info li {
  font-size: 1rem;
}

/* ===== Botones ===== */
.btn {
  display: inline-block;
  background-color: #FF6F61;
  color: #fff;
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
}
.btn:hover {
  background-color: #40E0D0;
  color: #fff;
}
.price-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  align-items: center;
}
.price {
  font-weight: bold;
  color: #ffd900;
  font-size: 0.9rem;
}

/* ===== Productos (grid adaptativo) ===== */
.grid-productos,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 220px); /* columnas fijas de 220px */
  gap: 1rem;
  justify-content: center;
}

/* Ajuste para imágenes de productos */
.card .img {
  width: 100%;
  height: 170px;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card .img img {
  width: 90%;
  height: 110%;
  object-fit: contain;   /* ajusta la imagen sin recortar */
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .brand {
    flex-direction: column; /* logo arriba, título abajo */
    gap: 0.5rem;            /* menos espacio entre ellos */
  }

  header h1 {
    text-align: center;     /* asegura que quede centrado */
    font-size: 2.4rem;      /* un poco más pequeño en móvil */
  }
}

@media (max-width: 1024px) {
  .grid-productos,
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-productos,
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav {
    flex-direction: column;
    align-items: center;
  }
  .card {
    padding: 0.6rem;
    width: 160px; /* más compacto en tablets */
  }
  .card .img {
    height: 140px;
  }
  .card .body h3 {
    font-size: 0.95rem;
  }
  .card .body p {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .grid-productos,
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .card {
    padding: 0.5rem;
    width: 140px;       /* más compacto en móviles */
    min-height: 180px;  /* altura base más baja en móvil */
  }
  .card .img {
    height: 120px;
    margin-bottom: 0.4rem; /* reduce espacio entre imagen y texto */
  }
  .card .body h3 {
    font-size: 0.9rem;
    margin-top: 0.2rem; /* ajusta separación superior */
  }
  .card .body p {
    font-size: 0.9rem;
    margin: 0.02rem 0;   /* reduce separación vertical */
  }
  .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }
}