/* Shorts: feed vertical em tela cheia. Usado só por include_shorts_page.tpl. */
:root {
	--sh-accent: #bd1414;
	--sh-col: min(100vw, calc(100vh * 9 / 16));
}
@supports (height: 100dvh) {
	:root { --sh-col: min(100vw, calc(100dvh * 9 / 16)); }
}

* { box-sizing: border-box; }

html, body.shorts-page {
	margin: 0;
	height: 100%;
	background: #000;
	color: #fff;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

body.shorts-page a { color: inherit; text-decoration: none; }
body.shorts-page button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- barra do topo ---------- */
.shorts-top {
	position: fixed;
	z-index: 20;
	top: 0;
	left: 50%;
	width: var(--sh-col);
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: calc(8px + env(safe-area-inset-top)) 8px 28px;
	background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
	pointer-events: none;
}
.shorts-top > * { pointer-events: auto; }
.shorts-back,
.shorts-login,
.shorts-clean,
.shorts-top-spacer {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
}
.shorts-back,
.shorts-login,
.shorts-clean { border-radius: 50%; }
.shorts-back:hover,
.shorts-login:hover,
.shorts-clean:hover { background: rgba(255, 255, 255, .14); }
.shorts-clean svg { width: 24px; height: 24px; display: block; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7)); }
.shorts-top-right { display: flex; align-items: center; }
.shorts-logo {
	/* centralizado na coluna, independente de quantos botões há de cada lado */
	position: absolute;
	left: 50%;
	top: calc(8px + env(safe-area-inset-top));
	height: 44px;
	display: flex;
	align-items: center;
	transform: translateX(-50%);
	font-size: 18px;
	font-weight: 800;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}

/* ---------- feed ---------- */
#shorts {
	position: relative;
	width: var(--sh-col);
	height: 100vh;
	height: 100dvh;
	margin: 0 auto;
	overflow-y: scroll;
	overscroll-behavior: contain;
	overflow-anchor: none; /* o shorts.js corrige a rolagem ao tirar slides antigos do DOM */
	scroll-snap-type: y mandatory;
	scrollbar-width: none;
	background: #0b0b0b;
}
#shorts::-webkit-scrollbar { display: none; }
.shorts-chunk { display: contents; }

.short {
	position: relative;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	background: #0b0b0b;
}
.short-poster,
.short-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	border: 0;
}
.short-video { cursor: pointer; }
/* sem zoom nem atraso por duplo toque (o shorts.js trata o duplo toque como curtir) */
.short,
.short-video,
.short-btn { touch-action: manipulation; }

/* coração do duplo toque: nasce no ponto do toque, o shorts.js remove no animationend */
.short-heart {
	position: absolute;
	z-index: 5;
	width: 96px;
	height: 96px;
	margin: -48px 0 0 -48px;
	color: var(--sh-accent);
	pointer-events: none;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5));
	animation: sh-heart .75s ease-out forwards;
}
.short-heart svg { width: 100%; height: 100%; display: block; }
.short-heart svg .fillable { fill: currentColor; stroke: none; }
@keyframes sh-heart {
	0% { opacity: 0; transform: scale(.4); }
	20% { opacity: 1; transform: scale(1.15); }
	40% { transform: scale(1); }
	75% { opacity: 1; transform: translateY(-14px) scale(1); }
	100% { opacity: 0; transform: translateY(-34px) scale(1); }
}
/* enquanto o vídeo não tem quadro, fica transparente e a capa aparece por baixo */

.short::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 45%;
	background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .72));
	pointer-events: none;
}

/* ---------- título ---------- */
.short-info {
	position: absolute;
	z-index: 3;
	left: 14px;
	right: 78px;
	bottom: calc(32px + env(safe-area-inset-bottom));
}
.short-title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	font-size: 15px;
	line-height: 1.35;
	font-weight: 600;
	text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.short-meta {
	margin-top: 6px;
	font-size: 12.5px;
	color: rgba(255, 255, 255, .72);
	text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}

/* ---------- botões laterais ---------- */
.short-actions {
	position: absolute;
	z-index: 3;
	right: 8px;
	bottom: calc(32px + env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}
.short-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	min-width: 52px;
	font-size: 12px;
	font-weight: 600;
	text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.short-btn .ico {
	width: 46px;
	height: 46px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgba(30, 30, 30, .55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: transform .15s ease, background .15s ease;
}
.short-btn:hover .ico { background: rgba(60, 60, 60, .7); }
.short-btn:active .ico { transform: scale(.9); }
.short-btn svg { width: 24px; height: 24px; display: block; }
.short-btn.is-on .ico { color: var(--sh-accent); background: rgba(255, 255, 255, .92); }
.short-btn.is-on svg .fillable { fill: currentColor; }
.short-btn:focus-visible .ico,
.shorts-back:focus-visible,
.shorts-login:focus-visible,
.shorts-clean:focus-visible,
.shorts-sheet-close:focus-visible,
.shorts-nav button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- play/pause, carregando, progresso ---------- */
.short-state {
	position: absolute;
	z-index: 2;
	top: 50%;
	left: 50%;
	width: 76px;
	height: 76px;
	margin: -38px 0 0 -38px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, .5);
	opacity: 0;
	transform: scale(.8);
	transition: opacity .18s ease, transform .18s ease;
	pointer-events: none;
}
.short-state svg { width: 34px; height: 34px; }
.short.is-paused .short-state { opacity: 1; transform: scale(1); }

.short-spinner {
	position: absolute;
	z-index: 2;
	top: 50%;
	left: 50%;
	width: 42px;
	height: 42px;
	margin: -21px 0 0 -21px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
}
.short.is-loading:not(.is-paused) .short-spinner {
	opacity: 1;
	animation: sh-spin .8s linear infinite;
}
@keyframes sh-spin { to { transform: rotate(360deg); } }

/* A área de toque (24px) é bem mais alta que o traço visível, para dar para arrastar com o dedo.
   --p (0 a 1) é atualizado pelo shorts.js. */
.short-progress {
	--p: 0;
	position: absolute;
	z-index: 4;
	left: 0;
	right: 0;
	bottom: 0;
	height: calc(24px + env(safe-area-inset-bottom));
	cursor: pointer;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}
.short-progress-track {
	position: absolute;
	left: 0;
	right: 0;
	bottom: env(safe-area-inset-bottom);
	height: 3px;
	background: rgba(255, 255, 255, .28);
	transition: height .12s ease;
}
.short-progress-track i {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--sh-accent);
	transform: scaleX(var(--p));
	transform-origin: 0 50%;
}
.short-progress-time {
	position: absolute;
	left: 50%;
	bottom: calc(40px + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	padding: 6px 12px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .7);
	font-size: 15px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
}
.short.is-scrubbing .short-progress-track { height: 8px; }
.short.is-scrubbing .short-progress-time { opacity: 1; }
/* enquanto arrasta, some o que fica por cima do vídeo para ver o quadro */
.short.is-scrubbing .short-info,
.short.is-scrubbing .short-actions { opacity: 0; }
.short-info,
.short-actions { transition: opacity .15s ease; }
@media (hover: hover) {
	.short-progress:hover .short-progress-track { height: 8px; }
}

/* ---------- tela limpa (botão do olho): fica só o vídeo, a barra de progresso e o topo mínimo ---------- */
.short::after,
.shorts-top,
.shorts-logo,
.shorts-login { transition: opacity .15s ease; }
body.is-clean .short-info,
body.is-clean .short-actions,
body.is-clean .shorts-logo,
body.is-clean .shorts-login { opacity: 0; pointer-events: none; }
body.is-clean .short::after { opacity: 0; }
body.is-clean .shorts-top { background: none; }

/* ---------- aviso (link copiado) ---------- */
.shorts-toast {
	position: fixed;
	z-index: 30;
	left: 50%;
	bottom: 90px;
	transform: translate(-50%, 10px);
	padding: 9px 16px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .95);
	color: #111;
	font-size: 13.5px;
	font-weight: 600;
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
	pointer-events: none;
}
.shorts-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- painel deslizante (login, cadastro, comentários) ---------- */
.shorts-sheet-wrap {
	position: fixed;
	z-index: 40;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	visibility: hidden;
	transition: visibility 0s .25s;
}
.shorts-sheet-wrap.is-open { visibility: visible; transition-delay: 0s; }
.shorts-sheet-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	opacity: 0;
	transition: opacity .25s ease;
}
.shorts-sheet-wrap.is-open .shorts-sheet-backdrop { opacity: 1; }
.shorts-sheet {
	position: absolute;
	left: 50%;
	bottom: 0;
	width: var(--sh-col);
	max-height: 86%;
	display: flex;
	flex-direction: column;
	border-radius: 16px 16px 0 0;
	background: #161616;
	color: #fff;
	outline: 0;
	transform: translate(-50%, 100%);
	transition: transform .25s ease;
}
.shorts-sheet-wrap.is-open .shorts-sheet { transform: translate(-50%, 0); }
.shorts-sheet-wrap.is-comments .shorts-sheet { height: 70%; }
.shorts-sheet-head {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 8px 8px 16px;
	border-bottom: 1px solid #2a2a2a;
	font-size: 16px;
}
.shorts-sheet-close {
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 50%;
}
.shorts-sheet-close:hover { background: rgba(255, 255, 255, .12); }
.shorts-sheet-close svg { width: 22px; height: 22px; }
.shorts-sheet-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
}
.shorts-sheet-foot {
	flex: none;
	padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid #2a2a2a;
}
.shorts-sheet-foot:empty { display: none; }
.shorts-sheet-loading {
	width: 34px;
	height: 34px;
	margin: 28px auto;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sh-spin .8s linear infinite;
}
.shorts-sheet-note { margin: 24px 0; text-align: center; color: #aaa; font-size: 14.5px; }

/* formulários do KVS dentro do painel (mesmas classes do tema: .row, .textfield, .submit...) */
.shorts-sheet .hidden { display: none; }
.shorts-sheet .row { margin: 0 0 12px; }
.shorts-sheet label { font-size: 13.5px; color: #bbb; }
.shorts-sheet .field-label { display: block; margin-bottom: 5px; }
.shorts-sheet .textfield,
.shorts-sheet .textarea,
.shorts-sheet select {
	display: block;
	width: 100%;
	padding: 11px 12px;
	border: 1px solid #333;
	border-radius: 10px;
	background: #222;
	color: #fff;
	font: inherit;
	font-size: 16px; /* menor que 16px o iOS dá zoom ao focar */
	outline: 0;
	resize: none;
}
.shorts-sheet .textfield:focus,
.shorts-sheet .textarea:focus { border-color: #888; }
.shorts-sheet .textfield.error,
.shorts-sheet .textarea.error { border-color: #e04848; }
.shorts-sheet ::placeholder { color: #777; }
.shorts-sheet .checkbox { width: 18px; height: 18px; margin: 0 6px 0 0; vertical-align: middle; accent-color: #fff; }
.shorts-sheet .field-error { display: none; margin-top: 5px; color: #ff7b7b; font-size: 13px; }
.shorts-sheet .field-error.is-visible { display: block; }
.shorts-sheet .generic-error,
.shorts-sheet .success {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #262626;
	border-left: 3px solid var(--sh-accent);
	font-size: 14px;
	line-height: 1.4;
}
.shorts-sheet .success { border-left-color: #fff; }
.shorts-sheet .captcha-control > [data-name="code"] { margin-bottom: 12px; min-height: 65px; }
.shorts-sheet .captcha-control .image img { display: block; margin-bottom: 8px; border-radius: 6px; }
.shorts-sheet .submit,
.shorts-sheet .toggle-button {
	display: block;
	width: 100%;
	height: 46px;
	line-height: 46px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	cursor: pointer;
}
.shorts-sheet form.is-busy .submit { opacity: .5; pointer-events: none; }
.shorts-sheet .links { margin-top: 14px; font-size: 14px; line-height: 1.5; color: #888; text-align: center; }
.shorts-sheet .links p { margin: 0 0 8px; }
.shorts-sheet .links a,
.shorts-sheet-body a[data-fancybox] { color: #ddd; text-decoration: underline; cursor: pointer; }

/* comentários */
.sh-comment { display: flex; gap: 10px; margin-bottom: 16px; font-size: 14.5px; line-height: 1.4; }
.sh-avatar {
	flex: none;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: 50%;
	background: #333;
	color: #ddd;
	font-size: 14px;
	font-weight: 700;
}
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sh-comment b { display: block; font-size: 13px; color: #aaa; font-weight: 600; }
.sh-comment-text { display: block; overflow-wrap: anywhere; }
.sh-comments-more { display: block; padding: 4px 0 8px; text-align: center; font-size: 14px; color: #ddd !important; text-decoration: underline !important; }
.sh-comment-form .row { margin-bottom: 8px; }
.sh-comment-form:not(.is-expanded) .sh-extra { display: none; }
.sh-comment-form .captcha-control > [data-name="code"] { margin-bottom: 8px; }

/* ---------- setas (só desktop) ---------- */
.shorts-nav { display: none; }

@media (min-width: 760px) and (hover: hover) {
	body.shorts-page { background: #0b0b0b; }
	#shorts { background: #000; }
	.shorts-nav {
		position: fixed;
		z-index: 20;
		top: 50%;
		left: calc(50% + var(--sh-col) / 2 + 18px);
		transform: translateY(-50%);
		display: flex;
		flex-direction: column;
		gap: 12px;
	}
	.shorts-nav button {
		width: 48px;
		height: 48px;
		display: grid;
		place-items: center;
		border-radius: 50%;
		background: #1e1e1e;
		color: #fff;
		transition: background .15s ease;
	}
	.shorts-nav button:hover { background: #333; }
	.shorts-nav button:disabled { opacity: .35; cursor: default; }
	.shorts-nav svg { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	/* a animação continua existindo (o JS espera o animationend), só sem movimento */
	.short-heart { animation: sh-heart-fade .5s linear forwards; }
	@keyframes sh-heart-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
	.short-btn .ico, .short-state, .shorts-toast, .shorts-sheet, .shorts-sheet-backdrop, .short-progress-track, .short::after, .shorts-top, .shorts-logo, .shorts-login { transition: none; }
}
