/* ---------------------------------------------------------------------
 * Shortcode [wcytsg_short] — usado fora da galeria do produto (em
 * posts/páginas). Sem a restrição de container quadrado do tema, então
 * a miniatura já pode ser exibida no formato vertical real do Short.
 * ------------------------------------------------------------------- */

.wcytsg-shortcode-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.wcytsg-shortcode-item {
	width: 140px;
	aspect-ratio: 9 / 16;
	border-radius: 10px;
	overflow: hidden;
	flex: 0 0 auto;
}

.wcytsg-shortcode-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcytsg-shortcode-item .wcytsg-play-trigger {
	width: 100%;
	height: 100%;
}

.wcytsg-short-slide {
	position: relative;
	overflow: hidden;
}

.wcytsg-short-slide img {
	width: 100%;
	height: auto;
	display: block;
}

.wcytsg-play-trigger {
	position: relative;
	display: block;
	text-decoration: none;
}

.wcytsg-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 46px;
	background-color: rgba(0, 0, 0, 0.72);
	border-radius: 12px;
	transition: background-color 0.15s ease;
}

.wcytsg-play-trigger:hover .wcytsg-play-icon {
	background-color: rgba(0, 0, 0, 0.9);
}

.wcytsg-play-icon::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 56%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 9px 0 9px 16px;
	border-color: transparent transparent transparent #ffffff;
}

.wcytsg-short-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background-color: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 3px 8px;
	border-radius: 4px;
	text-transform: uppercase;
}

@media (max-width: 480px) {
	.wcytsg-play-icon {
		width: 56px;
		height: 40px;
	}
	.wcytsg-short-badge {
		font-size: 10px;
		padding: 2px 6px;
	}
	.wcytsg-modal-close {
		top: -40px;
	}
}

/* Quando o vídeo está sendo reproduzido, o slide continua mostrando a
   miniatura normalmente — o vídeo abre em um modal separado (ver abaixo),
   então o container 1:1 da galeria do tema nunca é forçado a mudar de
   proporção e o Short não fica cortado. */

/* Miniatura de navegação (flex-control-nav) gerada automaticamente pelo WooCommerce
   também recebe a imagem do Short — aqui garantimos que fique com a mesma altura das demais */
.flex-control-thumbs img {
	width: 100%;
	height: auto;
}

/* ---------------------------------------------------------------------
 * Modal (lightbox) do YouTube Short
 * Aberto por cima de toda a página, respeitando a proporção vertical
 * 9:16 real do Short, sem depender do tamanho/formato da galeria.
 * ------------------------------------------------------------------- */

.wcytsg-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.wcytsg-modal-overlay.wcytsg-modal-open {
	display: flex;
}

body.wcytsg-modal-no-scroll {
	overflow: hidden;
}

.wcytsg-modal-inner {
	position: relative;
	width: min(92vw, calc(92vh * 9 / 16));
	max-width: 420px;
	aspect-ratio: 9 / 16;
}

.wcytsg-modal-video,
.wcytsg-modal-video iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
}

.wcytsg-modal-close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.wcytsg-modal-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Fallback para navegadores sem suporte a aspect-ratio no modal
   (mantém a proporção vertical via padding-top) */
@supports not (aspect-ratio: 9 / 16) {
	.wcytsg-modal-inner {
		height: 0;
		padding-top: calc(min(92vw, calc(92vh * 9 / 16)) * 16 / 9);
	}
	.wcytsg-modal-video {
		position: absolute;
		top: 0;
		left: 0;
	}
}
