.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: 12px;
  gap: 10px;
  padding: 2rem;
  max-width: 1300px;
  margin: 0 auto;
  justify-content: center;
  grid-auto-flow: dense;
}

.item {
  grid-row: span calc(var(--s) + 1);
  height: calc(var(--s) * 12px);
  background-color: #eee;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  opacity: 0;
  transform: translateY(30px) scale(0.97);
}

.item.visible {
  animation: fadeUp 0.5s ease-out forwards;
}

.item.empty {
  background-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

.item.tall {
  grid-row: span calc((var(--s) + 2));
  height: calc((var(--s) + 2) * 12px);
}

.item.wide {
  grid-column: span 2;
}

.item.extra-tall {
  grid-row: span calc((var(--s) + 4));
  height: calc((var(--s) + 4) * 12px);
}

.item.compact {
  grid-row: span calc(var(--s) - 2);
  height: calc((var(--s) - 2) * 12px);
}

.item.square-large {
  grid-column: span 2;
  grid-row: span calc((var(--s) + 3));
  height: calc((var(--s) + 3) * 12px);
}

.item a {
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
  backdrop-filter: brightness(0.5);
  padding: 1rem;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Estilos para imágenes dentro de items */
.item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Media Queries para Responsive */
@media (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 992px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 10px;
    gap: 12px;
    padding: 1.5rem;
  }
  
  .item {
    height: calc(var(--s) * 10px);
  }
  
  .item.tall {
    height: calc((var(--s) + 2) * 10px);
  }
  
  .item.extra-tall {
    height: calc((var(--s) + 4) * 10px);
  }
  
  .item.compact {
    height: calc((var(--s) - 2) * 10px);
  }
  
  .item.square-large {
    height: calc((var(--s) + 3) * 10px);
  }
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 10px;
    gap: 10px;
    padding: 1rem;
  }
  
  .item {
    border-radius: 15px;
  }
  
  /* Simplificar items wide en tablet */
  .item.wide {
    grid-column: span 2;
  }
  
  .item.square-large {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 12px;
    gap: 12px;
  }
  
  .item {
    height: calc(var(--s) * 12px);
  }
  
  .item.tall {
    height: calc((var(--s) + 2) * 12px);
  }
  
  .item.extra-tall {
    height: calc((var(--s) + 4) * 12px);
  }
  
  .item.compact {
    height: calc((var(--s) - 2) * 12px);
  }
  
  .item.square-large {
    height: calc((var(--s) + 3) * 12px);
  }
  
  /* En móvil, todas las columnas son span 1 */
  .item.wide,
  .item.square-large {
    grid-column: span 1;
  }
}