/* ==========================================================================
   Artist Singles Showcase — Frontend styles (thumbnails quadrados)
   ========================================================================== */

.as-singles-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 20px;
	width: 100%;
	box-sizing: border-box;
}

.as-singles-grid * {
	box-sizing: border-box;
}

/* Cada item é um <button> para acessibilidade (teclado, leitores de ecrã) */
.as-single-item {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	/* Thumbnail quadrado: a caixa é sempre 1:1, independentemente da largura da coluna */
	aspect-ratio: 1 / 1;
	font: inherit;
	appearance: none;
	-webkit-appearance: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.as-single-item:hover,
.as-single-item:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
	outline: none;
}

.as-single-item:focus-visible {
	outline: 2px solid #1db954;
	outline-offset: 2px;
}

.as-single-thumb {
	position: absolute;
	inset: 0;
	display: block;
}

.as-single-thumb img {
	/* A imagem (normalmente 16:9, vinda do YouTube) preenche
	   sempre a caixa quadrada, tanto na vertical como na
	   horizontal — o excesso é recortado ao centro. */
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

/* Título sobre a imagem, canto inferior esquerdo, branco com ligeira sombra */
.as-single-title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	/* Mais espaço em baixo do que em cima: garante que a segunda linha
	   (incluindo descendentes como "g", "j", "p", "q") nunca é cortada
	   pelo overflow:hidden do item. */
	padding: 30px 14px 14px;
	text-align: left;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0px 8px rgba(0, 0, 0, 0.5);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	/* Margem de segurança acima do necessário para 2 linhas, para não
	   depender de um cálculo em "em" demasiado justo entre browsers. */
	max-height: 3.4em;
	/* Leve gradiente para garantir contraste do texto mesmo em imagens claras */
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 75%);
}

/* ==========================================================================
   Modal (o vídeo mantém-se 16:9, só o thumbnail da grelha é quadrado)
   ========================================================================== */

.as-singles-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.as-singles-modal.is-open {
	display: flex;
}

.as-singles-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
}

.as-singles-modal-content {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 900px;
	background: #111;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
}

.as-singles-modal-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.as-singles-modal-close:hover {
	background: rgba(0, 0, 0, 0.85);
}

.as-video-wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
}

.as-video-wrapper iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.as-modal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 16px;
	background: #181818;
}

.as-btn {
	flex: 1 1 200px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: 6px;
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	transition: opacity 0.2s ease;
}

.as-btn:hover {
	opacity: 0.85;
}

.as-btn-spotify {
	background: #1db954;
}

.as-btn-apple {
	background: #fa2d48;
}

/* ==========================================================================
   Responsividade
   ========================================================================== */

@media (max-width: 782px) {
	.as-singles-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 12px;
	}

	.as-single-title {
		font-size: 13px;
		padding: 24px 10px 10px;
	}

	.as-modal-actions {
		flex-direction: column;
	}

	.as-btn {
		flex: 1 1 auto;
	}
}

@media (max-width: 480px) {
	.as-singles-grid {
		grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
		gap: 10px;
	}

	.as-singles-modal {
		padding: 0;
	}

	.as-singles-modal-content {
		border-radius: 0;
		max-height: 100vh;
		height: 100%;
		justify-content: center;
	}
}
