/* ==========================================================================
   Watch page (loaded only on single videos)
   ========================================================================== */

.watch {
	display: grid;
	gap: 18px;
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-block-end: 32px;
}

.watch__main {
	min-width: 0;
}

.watch__info,
.watch__side {
	padding-inline: 12px;
}

@media (min-width: 1100px) {
	.watch {
		grid-template-columns: minmax(0, 1fr) 400px;
		gap: 28px;
		padding: 20px 24px 40px;
	}

	.watch__info,
	.watch__side {
		padding-inline: 0;
	}
}

@media (min-width: 1500px) {
	.watch {
		grid-template-columns: minmax(0, 1fr) 460px;
	}
}

/* ---------- Player ---------- */

.player {
	--ui-h: 64px;
	position: relative;
	width: 100%;
	aspect-ratio: var(--ar, 16 / 9);
	max-height: 76svh;
	overflow: hidden;
	isolation: isolate;
	background: #000;
	-webkit-user-select: none;
	user-select: none;
	outline: 0;
}

/* Blurred poster fills the sides when the video is narrower than the box (portrait videos). */
.player::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: -40px;
	background: var(--poster, none) center / cover no-repeat;
	filter: blur(32px) brightness(.45) saturate(1.2);
	transform: translateZ(0);
}

@media (min-width: 1100px) {
	.player {
		border-radius: var(--radius);
		max-height: calc(100svh - var(--header-h) - var(--chips-h) - 60px);
		min-height: 360px;
	}
}

.player__poster,
.player__video,
.player__embed,
.player__embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border: 0;
}

.player__video {
	background: transparent;
}

.player.is-started .player__poster {
	display: none;
}

/* Big centre play button. */
.player__big {
	position: absolute;
	z-index: 3;
	inset: 0;
	margin: auto;
	display: grid;
	place-items: center;
	width: 76px;
	height: 76px;
	border: 0;
	border-radius: 50%;
	background: var(--accent-grad);
	color: #fff;
	box-shadow: 0 10px 40px -8px rgb(255 46 126 / 70%);
	transition: transform .2s var(--ease), opacity .2s;
}

.player__big .icon {
	width: 30px;
	height: 30px;
	margin-inline-start: 4px;
}

.player__big:hover {
	transform: scale(1.06);
}

.player.is-started .player__big {
	opacity: 0;
	pointer-events: none;
	transform: scale(.8);
}

.player.is-started.is-paused .player__big {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

/* Buffering spinner. */
.player__spinner {
	position: absolute;
	z-index: 2;
	inset: 0;
	margin: auto;
	width: 46px;
	height: 46px;
	border: 3px solid rgb(255 255 255 / 25%);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	animation: spin .8s linear infinite;
	pointer-events: none;
	transition: opacity .2s;
}

.player.is-waiting .player__spinner {
	opacity: 1;
}

.player.is-waiting .player__big {
	opacity: 0 !important;
}

/* Double-tap seek indicators. */
.player__seek {
	position: absolute;
	z-index: 2;
	top: 50%;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 16px;
	border-radius: 999px;
	background: rgb(0 0 0 / 55%);
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	direction: ltr;
	opacity: 0;
	transform: translateY(-50%) scale(.9);
	pointer-events: none;
	transition: opacity .2s, transform .2s;
}

.player__seek .icon {
	width: 18px;
	height: 18px;
}

.player__seek--back {
	left: 8%;
}

.player__seek--fwd {
	right: 8%;
}

.player__seek.is-on {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}

/* Control bar. */
.player__ui {
	position: absolute;
	z-index: 4;
	inset-inline: 0;
	bottom: 0;
	padding: 28px 10px 6px;
	background: linear-gradient(to top, rgb(0 0 0 / 80%), rgb(0 0 0 / 0%));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .25s, transform .25s;
	pointer-events: none;
}

.player.is-started.is-paused .player__ui,
.player.is-started.show-ui .player__ui,
.player.is-started:focus-within .player__ui {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.player.is-started.is-playing:not(.show-ui) {
	cursor: none;
}

.player__progress {
	position: relative;
	height: 16px;
	margin-inline: 4px;
	cursor: pointer;
	touch-action: none;
	outline: 0;
}

.player__progress::before,
.player__buffered,
.player__played {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	height: 4px;
	border-radius: 4px;
	transform: translateY(-50%);
	transition: height .15s;
}

.player__progress::before {
	right: 0;
	background: rgb(255 255 255 / 22%);
}

.player__buffered {
	width: 0;
	background: rgb(255 255 255 / 40%);
}

.player__played {
	width: 0;
	background: var(--accent);
}

.player__progress:hover::before,
.player__progress:hover .player__buffered,
.player__progress:hover .player__played,
.player.is-scrubbing .player__played {
	height: 6px;
}

.player__handle {
	position: absolute;
	top: 50%;
	left: 0;
	width: 14px;
	height: 14px;
	margin-left: -7px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 3px rgb(255 46 126 / 50%);
	transform: translateY(-50%) scale(0);
	transition: transform .15s;
}

.player__progress:hover .player__handle,
.player__progress:focus-visible .player__handle,
.player.is-scrubbing .player__handle {
	transform: translateY(-50%) scale(1);
}

.player__tip {
	position: absolute;
	bottom: 18px;
	left: 0;
	padding: 2px 7px;
	border-radius: 6px;
	background: rgb(0 0 0 / 80%);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	transform: translateX(-50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s;
}

.player__progress:hover .player__tip,
.player.is-scrubbing .player__tip {
	opacity: 1;
}

.player__row {
	display: flex;
	align-items: center;
	gap: 2px;
}

.player__btn {
	display: grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding: 0 6px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: #fff;
	transition: background .15s;
}

.player__btn:hover {
	background: rgb(255 255 255 / 12%);
}

.player__btn .icon {
	width: 22px;
	height: 22px;
}

.player__speed {
	font-size: 13px;
	font-weight: 700;
	font-family: var(--font);
}

.player__time {
	padding-inline: 6px;
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.player__grow {
	flex: 1;
}

/* Icon state swaps. */
.player .i-pause,
.player .i-mute,
.player .i-exit {
	display: none;
}

.player.is-playing .i-play {
	display: none;
}

.player.is-playing .i-pause {
	display: block;
}

.player.is-muted .i-vol {
	display: none;
}

.player.is-muted .i-mute {
	display: block;
}

.player.is-fs .i-fs {
	display: none;
}

.player.is-fs .i-exit {
	display: block;
}

/* Fullscreen. */
.player:fullscreen,
.player.is-fs {
	max-height: none;
	aspect-ratio: auto;
	width: 100%;
	height: 100%;
	border-radius: 0;
}

/* ---------- Info ---------- */

.watch__info {
	padding-block-start: 14px;
}

.watch__title {
	font-size: 18px;
	font-weight: 600;
	line-height: 1.5;
}

@media (min-width: 761px) {
	.watch__title {
		font-size: 22px;
	}
}

.watch__stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 16px;
	margin-block-start: 6px;
	color: var(--muted);
	font-size: 13px;
}

.watch__stats > span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.watch__stats .icon {
	width: 15px;
	height: 15px;
}

.watch__stats b {
	color: var(--text-2);
	font-weight: 600;
}

.badge-hd {
	padding: 0 7px;
	border-radius: 5px;
	background: var(--accent);
	color: #fff;
	font-size: 11.5px;
	font-weight: 700;
}

.watch__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-block-start: 14px;
	overflow-x: auto;
	scrollbar-width: none;
	padding-block-end: 2px;
}

.watch__actions::-webkit-scrollbar {
	display: none;
}

.pill[aria-pressed="true"] {
	background: rgb(255 46 126 / 16%);
	color: #ff6aa3;
}

.pill[aria-pressed="true"] .icon {
	fill: currentColor;
}

.pill--accent {
	background: var(--accent-grad);
	color: #fff;
}

.pill--accent:hover {
	background: var(--accent-grad);
	filter: brightness(1.08);
}

.icon.flip-y {
	transform: scaleY(-1);
}

/* Like / dislike group. */
.vote {
	position: relative;
	display: flex;
	flex: none;
}

.vote__btn {
	border-radius: 0;
}

.vote__btn:first-child {
	border-start-start-radius: 999px;
	border-end-start-radius: 999px;
	padding-inline-end: 14px;
}

.vote__btn--down {
	border-start-end-radius: 999px;
	border-end-end-radius: 999px;
	border-inline-start: 1px solid var(--line);
}

.vote__bar {
	position: absolute;
	inset-inline: 14px;
	bottom: 3px;
	height: 2px;
	border-radius: 2px;
	background: rgb(255 255 255 / 10%);
	overflow: hidden;
	pointer-events: none;
}

.vote__bar i {
	display: block;
	height: 100%;
	background: var(--good);
	transition: width .3s;
}

.vote.is-bump .vote__btn[aria-pressed="true"] .icon {
	animation: bump .35s var(--ease);
}

@keyframes bump {
	50% {
		transform: scale(1.35) rotate(-8deg);
	}
}

/* Share panel. */
.share {
	margin-block-start: 12px;
	padding: 14px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--line);
	animation: card-in .25s var(--ease);
}

.share__links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.share__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--surface-2);
	font-size: 13.5px;
	font-weight: 500;
	transition: background .2s;
}

.share__link:hover {
	background: var(--surface-3);
}

.share__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--c);
}

.share__copy {
	display: flex;
	gap: 8px;
	margin-block-start: 12px;
}

.share__copy input {
	flex: 1;
	min-width: 0;
	height: 40px;
	padding-inline: 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--bg);
	color: var(--text-2);
	font-size: 13px;
}

/* Actors. */
.actors {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-block-start: 18px;
}

.actor {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 16px 6px 6px;
	padding-inline: 6px 16px;
	border-radius: 999px;
	background: var(--surface);
	border: 1px solid var(--line);
	transition: border-color .2s, background .2s;
}

.actor:hover {
	background: var(--surface-2);
	border-color: rgb(255 46 126 / 40%);
}

.actor__img {
	flex: none;
	width: 42px;
	height: 42px;
	padding: 2px;
	border-radius: 50%;
	background: var(--accent-grad);
}

.actor__img img,
.actor__img span {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2px solid var(--surface);
	object-fit: cover;
}

.actor__img span {
	display: grid;
	place-items: center;
	background: var(--surface-2);
	font-weight: 700;
}

.actor__text {
	display: grid;
	line-height: 1.3;
}

.actor__text b {
	font-size: 14px;
	font-weight: 600;
}

.actor__text small {
	color: var(--muted);
	font-size: 12px;
}

/* Description. */
.desc {
	position: relative;
	margin-block-start: 16px;
	padding: 14px 16px;
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text-2);
	font-size: 14.5px;
	line-height: 1.9;
}

.desc__body > :first-child {
	margin-top: 0;
}

.desc__body > :last-child {
	margin-bottom: 0;
}

.desc.is-clamped .desc__body {
	max-height: 5.7em;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(#000 55%, transparent);
	mask-image: linear-gradient(#000 55%, transparent);
}

.desc__more {
	margin-block-start: 6px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--text);
	font-weight: 600;
	font-size: 13.5px;
}

/* ---------- Related ---------- */

.watch__side .section-title {
	margin-block: 4px 12px;
}

.grid--side {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	--gap: 10px;
	--row-gap: 18px;
}

@media (min-width: 640px) and (max-width: 1099px) {
	.grid--side {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		--gap: 14px;
	}
}

@media (min-width: 1100px) {
	.grid--side .card__title {
		font-size: 13.5px;
	}

	.grid--side .card__date {
		display: none;
	}
}

/* Toast. */
.toast {
	position: fixed;
	z-index: 90;
	inset-inline: 0;
	bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom));
	width: max-content;
	max-width: calc(100% - 32px);
	margin-inline: auto;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--text);
	color: var(--bg);
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 10px 30px rgb(0 0 0 / 40%);
	animation: card-in .25s var(--ease);
}

@media (min-width: 761px) {
	.toast {
		bottom: 24px;
	}
}
