return filtered; }
/* custom scroll */ ::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: #ddd2c4; } ::-webkit-scrollbar-thumb { background: #aa7e5a; border-radius: 8px; }
// renderizar grid con animación sencilla function render() { const filteredData = filterDiscos(); const total = filteredData.length; statsSpan.innerHTML = `📀 ${total} ${total === 1 ? 'disco' : 'discos'}`;
// evento búsqueda searchInput.addEventListener('input', onSearchInput);
html += ` <div class="card"> <div class="card-img" style="background: ${bgGradient}; display: flex; flex-direction: column; justify-content: center; align-items: center;"> <i class="${album.icon}" style="font-size: 4rem; color: rgba(255,245,225,0.9); text-shadow: 2px 2px 0px rgba(0,0,0,0.2);"></i> <span style="margin-top: 10px; font-size: 0.7rem; font-weight: 600; background: rgba(0,0,0,0.4); padding: 0.2rem 1rem; border-radius: 20px; backdrop-filter: blur(2px); color: white;">${album.year}</span> </div> <div class="card-content"> <div class="album-year"> <span>${album.year}</span> <span><i class="far fa-calendar-alt"></i></span> </div> <div class="album-title">${escapeHtml(album.title)}</div> <div class="album-type"><i class="${typeIcon === '🎙️' ? 'fas fa-microphone' : (typeIcon === '💿' ? 'fas fa-cd' : 'fas fa-head-side-vr')}" style="margin-right: 5px;"></i> ${typeLabel}</div> <div class="tracklist"> <h4><i class="fas fa-list-ul"></i> Canciones destacadas</h4> <ul> ${trackListItems} ${moreTracks} </ul> </div> </div> </div> `; } gridContainer.innerHTML = html; }
body { background: linear-gradient(145deg, #f6f2eb 0%, #e8e2d8 100%); font-family: 'Inter', sans-serif; color: #1e1b17; scroll-behavior: smooth; }
// evento de búsqueda con debounce suave let debounceTimer; function onSearchInput() { clearTimeout(debounceTimer); debounceTimer = setTimeout(() => { currentSearch = searchInput.value; render(); }, 280); }
// construcción de cards let html = ''; for (let album of filteredData) { // tipo legible let typeLabel = ''; let typeIcon = ''; if (album.type === 'estudio') { typeLabel = 'Álbum de estudio'; typeIcon = '🎙️'; } else if (album.type === 'ep') { typeLabel = 'EP / Extended Play'; typeIcon = '💿'; } else if (album.type === 'live') { typeLabel = 'En vivo / Concierto'; typeIcon = '🎤'; }
// Helper: normalizar texto function normalizeText(txt) { return txt.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); }
// elementos DOM const gridContainer = document.getElementById('discogGrid'); const searchInput = document.getElementById('searchInput'); const filterBtns = document.querySelectorAll('.filter-btn'); const statsSpan = document.getElementById('statsCounter');
/* discography grid */ .container { max-width: 1400px; margin: 2rem auto; padding: 0 1.5rem; } .discog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; } .card { background: #ffffffea; backdrop-filter: blur(0px); border-radius: 28px; overflow: hidden; box-shadow: 0 12px 24px -12px rgba(0,0,0,0.2); transition: transform 0.25s ease, box-shadow 0.3s; border: 1px solid #f0e2d4; } .card:hover { transform: translateY(-6px); box-shadow: 0 20px 30px -12px rgba(0,0,0,0.25); } .card-img { height: 220px; background: #d9cdbf; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: #7c5f45; position: relative; background-size: cover; background-position: center; background-repeat: no-repeat; transition: all 0.2s; } /* fallback icon if no image bg */ .card-img i { text-shadow: 2px 2px 0 rgba(0,0,0,0.1); } .card-content { padding: 1.5rem 1.3rem 1.8rem; } .album-year { font-size: 0.8rem; letter-spacing: 1px; font-weight: 600; color: #b47c48; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; } .album-title { font-size: 1.7rem; font-weight: 700; margin: 0.4rem 0 0.5rem; line-height: 1.2; color: #231f1b; } .album-type { display: inline-block; background: #f0e4d8; padding: 0.2rem 0.9rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; margin-bottom: 0.8rem; text-transform: uppercase; } .tracklist { margin-top: 1rem; border-top: 1px dashed #e5d5c6; padding-top: 0.9rem; } .tracklist h4 { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #aa7e5a; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 6px; } .tracklist ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; } .tracklist li { font-size: 0.8rem; background: #f8f2ec; padding: 0.2rem 0.6rem; border-radius: 20px; color: #4e3a2c; font-weight: 400; } .no-results { text-align: center; grid-column: 1 / -1; padding: 4rem; background: #f4ede6; border-radius: 60px; font-size: 1.2rem; color: #876e55; } footer { text-align: center; padding: 2rem; font-size: 0.8rem; color: #7c6857; border-top: 1px solid #e2cfbf; margin-top: 2rem; } @media (max-width: 650px) { .hero h1 { font-size: 2.5rem; } .controls { flex-direction: column; align-items: stretch; } .filter-buttons { justify-content: center; } .discog-grid { gap: 1.2rem; } .album-title { font-size: 1.4rem; } } </style> </head> <body>