:root {
  --max: 980px;
  --text: #111;
  --muted: #555;
  --border: #eee;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: #fff;
}

.wrap {
  max-width: var(--max);
  margin: auto;
  padding: 16px;
}

.nav a {
  margin-right: 12px;
  text-decoration: none;
  color: var(--text);
}
.nav a:hover { text-decoration: underline; }

h1 { margin-top: 10px; line-height: 1.2; }
h2, h3 { line-height: 1.25; }

.muted { color: var(--muted); }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0;
  background: #fff;
}

/* BOTÓN */
.btn {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  font-weight: 600;
}
.btn:hover { border-color: #aaa; }

/* TABLAS */
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px; border-bottom: 1px solid #eee; }
table th { text-align: left; }

/* ===============================
   HERO (AHORA BIEN PEQUEÑO)
   =============================== */
.hero-img {
  width: 100%;
  height: 220px;          /* 🔑 CLAVE */
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

/* ===============================
   PRODUCTOS (YA NO GIGANTES)
   =============================== */
.product {
  display: grid;
  grid-template-columns: 120px 1fr; /* 🔑 imagen pequeña */
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #eee;
  align-items: center;
}
.product:first-of-type { border-top: none; }

.product-media {
  width: 120px;
  height: 120px;          /* 🔑 CAJA FIJA */
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* 🔑 RECORTE CONTROLADO */
}

/* ESCRITORIO */
@media (min-width: 860px) {
  .product {
    grid-template-columns: 140px 1fr;
  }
  .product-media {
    width: 140px;
    height: 140px;
  }
}
.product{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap:16px;
  align-items:center;
  padding:16px 0;
  border-top:1px solid #eee;
}
.product:first-of-type{ border-top:none; }

.product-media{
  width:120px;
  height:120px;
  border-radius:12px;
  background:#fafafa;
  overflow:hidden;
}

.product-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

@media (min-width:860px){
  .product{ grid-template-columns:140px 1fr; }
  .product-media{ width:140px; height:140px; }
}
/* FIX GLOBAL: evita que reglas externas hagan las imágenes gigantes */
img {
  max-width: 100%;
  height: auto;
}
/* FIX DEFINITIVO: si algún CSS externo mete width:100% !important */
.product-media {
  width: 120px !important;
  height: 120px !important;
  overflow: hidden !important;
}

.product-img {
  width: 120px !important;
  height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  object-fit: cover !important;
  display: block !important;
}

@media (min-width: 860px) {
  .product-media {
    width: 140px !important;
    height: 140px !important;
  }
  .product-img {
    width: 140px !important;
    height: 140px !important;
    max-width: 140px !important;
    max-height: 140px !important;
  }
}
/* ===== FIX FINAL TOP-5 ===== */
#top-5 .product {
  display: grid !important;
  grid-template-columns: 120px 1fr !important;
  gap: 16px !important;
  align-items: center !important;
  padding: 16px 0 !important;
  border-top: 1px solid #eee !important;
}
#top-5 .product:first-of-type { border-top: none !important; }

#top-5 .product-media {
  width: 120px !important;
  height: 120px !important;
  border-radius: 12px !important;
  background: #fafafa !important;
  overflow: hidden !important;
}

#top-5 .product-img {
  width: 120px !important;
  height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  object-fit: cover !important;
  display: block !important;
}

@media (min-width: 860px) {
  #top-5 .product { grid-template-columns: 140px 1fr !important; }
  #top-5 .product-media { width: 140px !important; height: 140px !important; }
  #top-5 .product-img { width: 140px !important; height: 140px !important; max-width: 140px !important; max-height: 140px !important; }
}

/* HERO */
.hero-img {
  width: 100% !important;
  height: 220px !important;
  object-fit: cover !important;
  border-radius: 14px !important;
  display: block !important;
}
/* ===== FORZAR MINIATURAS TOP 5 (ANTI-CACHÉ / ANTI-TEMA) ===== */
#top-5 .product {
  display: grid !important;
  grid-template-columns: 120px 1fr !important;
  gap: 16px !important;
  align-items: center !important;
  padding: 16px 0 !important;
  border-top: 1px solid #eee !important;
}

#top-5 .product:first-of-type { border-top: none !important; }

#top-5 .product-media {
  width: 120px !important;
  height: 120px !important;
  overflow: hidden !important;
  border-radius: 12px !important;
  background: #fafafa !important;
}

#top-5 .product-img {
  width: 120px !important;
  height: 120px !important;
  max-width: 120px !important;
  max-height: 120px !important;
  object-fit: cover !important;
  display: block !important;
}

@media (min-width: 860px) {
  #top-5 .product { grid-template-columns: 140px 1fr !important; }
  #top-5 .product-media { width: 140px !important; height: 140px !important; }
  #top-5 .product-img { width: 140px !important; height: 140px !important; max-width: 140px !important; max-height: 140px !important; }
}
.grid-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:16px;
}

.cat-card{
  position:relative;
  border-radius:14px;
  overflow:hidden;
  text-decoration:none;
  color:#fff;
}

.cat-card img{
  width:100%;
  height:180px;
  object-fit:cover;
  display:block;
}

.cat-card span{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  background:rgba(0,0,0,.45);
  font-weight:700;
  font-size:1.1rem;
  opacity:0;
  transition:.25s ease;
  padding:12px;
}

.cat-card:hover span{
  opacity:1;
}
/* =========================
   GRID DE CATEGORÍAS (HOME)
   ========================= */

.grid-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:16px;
}

.cat-card{
  position:relative;
  border-radius:14px;
  overflow:hidden;
  text-decoration:none;
  color:#fff;
  background:#000;
}

.cat-card img{
  width:100%;
  height:180px;
  object-fit:cover;
  display:block;
}

/* TEXTO EN HOVER */
.cat-card span{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  background:rgba(0,0,0,.45);
  font-weight:700;
  font-size:1.05rem;
  opacity:0;
  transition:opacity .25s ease;
  padding:12px;
}

.cat-card span small{
  font-weight:400;
  opacity:.85;
  font-size:.9rem;
}

/* EFECTO HOVER */
.cat-card:hover span{
  opacity:1;
}
/* ===============================
   GRID CATEGORÍAS (INDEX)
   =============================== */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 768px) {
  .grid-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cat-card {
  position: relative;
  display: block;
  height: 160px;              /* 🔑 controla el tamaño */
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  background: #000;
}

.cat-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* 🔑 recorta sin deformar */
  display: block;
}

/* TEXTO OVERLAY */
.cat-card span {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.65),
    rgba(0,0,0,.1)
  );
}

/* HOVER PRO */
.cat-card:hover img {
  transform: scale(1.05);
}

.cat-card img {
  transition: transform .3s ease;
}

.cat-card small {
  font-weight: 400;
  opacity: .85;
}
