/* UrduPaper — Videos module frontend styles.
 *
 * Two layouts:
 *   .upaper-video-page--full   horizontal — main column + related sidebar
 *   .upaper-video-page--short  vertical reel — left sidebar | reel | right sidebar
 *
 * Reactions + sharing reuse the theme's existing post components. On full
 * videos they render inline; on reels they live inside `.upaper-video-modal`
 * popups triggered from the reel rail.
 */

/* ---------------------------------------------------------------------------
 * Full layout
 * ------------------------------------------------------------------------ */
.upaper-video-page {
	max-width: 100%;
	margin: 0 auto;
	padding: 28px 16px 48px;
}

.upaper-video-page--full {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	gap: 32px;
	align-items: start;
}

@media (max-width: 980px) {
	.upaper-video-page--full {
		grid-template-columns: 1fr;
	}
}

.upaper-video-page__main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.upaper-video-player {
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 10px;
	overflow: hidden;
	position: relative;
}

.upaper-video-player iframe,
.upaper-video-player video,
.upaper-video-player embed,
.upaper-video-player .wp-block-embed__wrapper {
	width: 100% !important;
	height: 100% !important;
}

.upaper-video-embed {
	position: absolute;
	inset: 0;
}

.upaper-video-embed iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.upaper-video-embed--tiktok {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
}

.upaper-video-embed--tiktok .tiktok-embed {
	max-width: 100%;
	width: 100%;
	margin: 0;
}

.upaper-video-embed--instagram {
	background: #fff;
}

.upaper-video-page__header {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.upaper-video-page__title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
}

.upaper-video-page__meta {
	color: #50575e;
	font-size: 13px;
}

.upaper-video-page__excerpt {
	background: #f6f7f7;
	border-radius: 8px;
	padding: 14px 16px;
	font-size: 14px;
	line-height: 1.7;
}

.upaper-video-page__comments {
	margin-top: 12px;
}

/* ---------------------------------------------------------------------------
 * Related videos (full layout sidebar)
 * ------------------------------------------------------------------------ */
/* Spacing under the shared `.block-head` heading inside related sections. */
.upaper-video-related .block-head,
.upaper-video-related-reels .block-head {
	margin-bottom: 16px;
	direction: ltr; /* Prevent RTL from flipping the header layout. */
}

/* The theme's `.block-head` is calibrated for full-width section headers
 * (60px tall icon block, 28px glyph). In the related-videos sidebar (~360px
 * column) that's too bulky — compact the icon block + title padding so the
 * header sits cleanly above the list. */
.upaper-video-related .block-head .block-head-icon {
	height: 40px;
	padding: 0 10px;
}

.upaper-video-related .block-head .block-head-icon i {
	font-size: 18px;
	width: 18px;
	height: 18px;
	top: 0;
}

.upaper-video-related .block-head .title-text {
	padding: 10px 10px 10px 8px;
	font-size: 15px;
}

.upaper-video-related__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.upaper-video-related__link {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	text-decoration: none;
	color: inherit;
}

.upaper-video-related__thumb {
	position: relative;
	flex: 0 0 140px;
	aspect-ratio: 16 / 9;
	background: #1d2327;
	border-radius: 6px;
	overflow: hidden;
}

.upaper-video-related__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.upaper-video-related__playicon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, .92);
}

.upaper-video-related__playicon .upaper-menu-icon {
	width: 28px;
	height: 28px;
}

.upaper-video-related__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.upaper-video-related__title {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.upaper-video-related__meta {
	font-size: 12px;
	color: #767676;
}

/* ---------------------------------------------------------------------------
 * Reel layout
 * ------------------------------------------------------------------------ */
.upaper-video-page--short {
	max-width: 100%;
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.upaper-video-page__row {
	display: grid;
	/* Middle column = reel (420px) + gap (14px) + rail (~52px) = ~486px. */
	grid-template-columns: 280px minmax(0, 500px) 280px;
	gap: 20px;
	justify-content: center;
	align-items: start;
}

@media (max-width: 1100px) {
	.upaper-video-page__row {
		grid-template-columns: 1fr minmax(0, 500px) 1fr;
	}
}

@media (max-width: 768px) {
	.upaper-video-page__row {
		grid-template-columns: 1fr;
	}
	.upaper-video-page__sidebar {
		display: none;
	}
}

.upaper-video-page__sidebar {
	position: sticky;
	top: 80px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.upaper-video-page__reel {
	position: relative;
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
	aspect-ratio: 9 / 16;
	background: #000;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 14px 40px rgba(0, 0, 0, .25);
}

.upaper-video-reel-player {
	position: absolute;
	inset: 0;
}

.upaper-video-reel-player iframe,
.upaper-video-reel-player video,
.upaper-video-reel-player .wp-block-embed__wrapper {
	width: 100% !important;
	height: 100% !important;
	border: 0;
	display: block;
}

.upaper-video-reel__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 16px 18px 18px;
	color: #fff;
	background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 50%, rgba(0, 0, 0, .82) 100%);
	pointer-events: none;
	z-index: 3;
}

.upaper-video-reel__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
	text-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

.upaper-video-reel__excerpt {
	margin: 6px 0 0;
	font-size: 13px;
	line-height: 1.45;
	opacity: .88;
}

/* ---------------------------------------------------------------------------
 * Reel + rail wrapper (rail sits OUTSIDE the reel, to its right)
 * ------------------------------------------------------------------------ */
.upaper-video-page__reel-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	width: 100%;
}

/* ---------------------------------------------------------------------------
 * Reel action rail (3 circular buttons, vertically stacked beside the reel)
 * ------------------------------------------------------------------------ */
.upaper-video-reel__rail {
	display: flex;
	flex-direction: column;
	gap: 22px;
	padding-bottom: 24px;
	flex: 0 0 auto;
}

.upaper-video-rail-btn {
	position: relative;
	width: 48px;
	height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #1d2327;
	color: #fff !important;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	transition: transform .15s ease, background .15s ease, color .15s ease;
}

.upaper-video-rail-btn:hover,
.upaper-video-rail-btn:focus {
	background: #f4ac04;
	color: #121212 !important;
	transform: scale(1.08);
	outline: none;
}

/* Force the SVG stroke explicitly — `currentColor` is what menu-icons emits
 * but theme stylesheets can override `color` on `button:hover` with higher
 * specificity than ours. Stroking explicitly survives any such override. */
.upaper-video-rail-btn .upaper-menu-icon {
	width: 22px;
	height: 22px;
	stroke: currentColor;
}

.upaper-video-rail-btn:hover .upaper-menu-icon,
.upaper-video-rail-btn:focus .upaper-menu-icon {
	stroke: #121212;
}

.upaper-video-rail-btn__count {
	position: absolute;
	left: 50%;
	bottom: -18px;
	transform: translateX(-50%);
	font-size: 11px;
	font-weight: 600;
	color: #50575e;
	white-space: nowrap;
}

/* RTL — rail moves to the left of the reel. */
html[dir="rtl"] .upaper-video-page__reel-wrap {
	flex-direction: row-reverse;
}

/* Narrow / mobile — drop the side rail under the reel so nothing gets cut
 * off, and switch to a horizontal row. */
@media (max-width: 540px) {
	.upaper-video-page__reel-wrap {
		flex-direction: column;
		align-items: center;
	}
	.upaper-video-reel__rail {
		flex-direction: row;
		padding-bottom: 0;
		padding-top: 12px;
		gap: 28px;
	}
	.upaper-video-rail-btn__count {
		bottom: -16px;
	}
}

/* ---------------------------------------------------------------------------
 * Related reels grid
 * ------------------------------------------------------------------------ */
.upaper-video-page__related-row {
	margin: 0 auto;
	width: 100%;
}

/* Single-row horizontal carousel with scroll-snap + arrow nav. */
.upaper-video-related-reels__carousel {
	position: relative;
	padding: 0 4px;
}

.upaper-video-related-reels__track {
	display: flex;
	gap: 14px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 4px 4px 8px;
	/* Hide scrollbar — arrows are the primary navigation, swipe still works. */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.upaper-video-related-reels__track::-webkit-scrollbar {
	display: none;
}

.upaper-video-related-reels__item {
	flex: 0 0 180px;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-decoration: none;
	color: inherit;
}

@media (max-width: 640px) {
	.upaper-video-related-reels__item {
		flex-basis: 150px;
	}
}

/* Arrow nav buttons — circular, overlaid on the carousel edges. */
.upaper-video-related-reels__nav {
	position: absolute;
	top: calc(50% - 16px);
	transform: translateY(-50%);
	z-index: 4;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 0;
	background: #1d2327;
	color: #fff !important;
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease, transform .15s ease;
}

.upaper-video-related-reels__nav:hover,
.upaper-video-related-reels__nav:focus {
	background: #f4ac04;
	color: #121212 !important;
	transform: translateY(-50%) scale(1.08);
	outline: none;
}

.upaper-video-related-reels__nav.is-prev { left: -8px; }
.upaper-video-related-reels__nav.is-next { right: -8px; }

html[dir="rtl"] .upaper-video-related-reels__nav.is-prev { left: auto; right: -8px; }
html[dir="rtl"] .upaper-video-related-reels__nav.is-next { right: auto; left: -8px; }

/* Faded edges so cards bleeding past the viewport feel intentional. */
.upaper-video-related-reels__carousel::before,
.upaper-video-related-reels__carousel::after {
	content: '';
	position: absolute;
	top: 4px;
	bottom: 8px;
	width: 28px;
	pointer-events: none;
	z-index: 2;
}

.upaper-video-related-reels__carousel::before {
	left: 0;
	background: linear-gradient(90deg, var(--up-page-bg, #fff) 0%, transparent 100%);
}

.upaper-video-related-reels__carousel::after {
	right: 0;
	background: linear-gradient(-90deg, var(--up-page-bg, #fff) 0%, transparent 100%);
}

.upaper-video-related-reels__thumb {
	position: relative;
	aspect-ratio: 9 / 16;
	background: #1d2327;
	border-radius: 10px;
	overflow: hidden;
}

.upaper-video-related-reels__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.upaper-video-related-reels__playicon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, .92);
}

.upaper-video-related-reels__playicon .upaper-menu-icon {
	width: 36px;
	height: 36px;
}

.upaper-video-related-reels__title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * Shared modal shell (React / Share / Comments on reels)
 * ------------------------------------------------------------------------ */
.upaper-video-modal {
	position: fixed;
	inset: 0;
	z-index: 100200;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: rgba(0, 0, 0, .5);
	animation: upaperVideoModalFade .2s ease both;
}

/* The browser's default `[hidden] { display: none }` loses to any class
 * selector with `display: flex`. Restore the hidden state explicitly so
 * the modals are actually hidden on page load until JS opens them. */
.upaper-video-modal[hidden] {
	display: none;
}

.upaper-video-modal__panel {
	background: #fff;
	width: 100%;
	max-width: 560px;
	max-height: 80vh;
	border-radius: 14px 14px 0 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: upaperVideoModalIn .25s ease both;
}

@keyframes upaperVideoModalFade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes upaperVideoModalIn {
	from { transform: translateY(20px); opacity: 0; }
	to   { transform: translateY(0);     opacity: 1; }
}

@media (min-width: 768px) {
	.upaper-video-modal {
		align-items: center;
	}
	.upaper-video-modal__panel {
		border-radius: 14px;
	}
}

.upaper-video-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	background: linear-gradient(135deg, #121212, #282828);
	color: #fff;
}

.upaper-video-modal__header h3 {
	margin: 0;
	color: #fff;
	font-size: 15px;
}

.upaper-video-modal__close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	padding: 0 6px;
	line-height: 1;
}

.upaper-video-modal__close:hover {
	color: #f4ac04;
}

.upaper-video-modal__body {
	padding: 18px 20px;
	overflow-y: auto;
}

/* Theme's sharing partial uses a sticky `.fixed` class on social-bar — make
 * sure it doesn't break out of the modal body. */
.upaper-video-modal__body .social-bar.fixed {
	position: static !important;
}

/* Comments list inside the modal — readable defaults, override the theme's
 * floated comment styles which assume a wider container. */
.upaper-video-comments-list {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.upaper-video-comments-list .children {
	list-style: none;
	margin: 12px 0 0 36px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.upaper-video-comments-list .comment-body {
	padding: 12px 14px;
	background: #f6f7f7;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.55;
}

.upaper-video-comments-list .comment-author {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
	font-weight: 600;
}

.upaper-video-comments-list .comment-author img {
	border-radius: 50%;
}

.upaper-video-comments-list .comment-metadata {
	font-size: 11px;
	color: #767676;
	margin-bottom: 6px;
}

.upaper-video-comments-list .reply {
	margin-top: 6px;
}

.upaper-video-comments-empty {
	text-align: center;
	color: #767676;
	font-size: 13px;
	padding: 12px;
	margin: 0 0 16px;
}

.upaper-video-comment-form {
	border-top: 1px solid #ececec;
	padding-top: 14px;
}

.upaper-video-comment-form .comment-form-comment textarea {
	width: 100%;
	min-height: 80px;
}

.upaper-video-comment-form .form-submit {
	margin-top: 8px;
}

/* ---------------------------------------------------------------------------
 * Archive — two-mode template (overview sections + filtered grid)
 * ------------------------------------------------------------------------ */
.upaper-videos-archive {
	max-width: 100%;
	margin: 0 auto;
	padding: 28px 0;
}

/* Block-head headers (theme styles do the heavy lifting). Spacing only. */
.upaper-videos-archive .home-blocks {
	margin-bottom: 28px;
}

.upaper-videos-archive__section .block-head {
	margin-bottom: 12px;
}

/* The grid lives beside the block-head, so the .home-blocks wrapper inherits
 * the section margin. */
.upaper-videos-archive__section {
	margin-bottom: 36px;
}

/* 4-column grid, responsive collapse. */
.upaper-videos-archive__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 18px;
}

@media (max-width: 980px) {
	.upaper-videos-archive__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.upaper-videos-archive__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 420px) {
	.upaper-videos-archive__grid--horizontal {
		grid-template-columns: 1fr;
	}
}

.upaper-videos-archive__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-decoration: none;
	color: inherit;
}

.upaper-videos-archive__thumb {
	position: relative;
	background: #1d2327;
	border-radius: 10px;
	overflow: hidden;
}

.upaper-videos-archive__card--horizontal .upaper-videos-archive__thumb {
	aspect-ratio: 16 / 9;
}

.upaper-videos-archive__card--vertical .upaper-videos-archive__thumb {
	aspect-ratio: 9 / 16;
}

.upaper-videos-archive__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.upaper-videos-archive__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, .92);
}

.upaper-videos-archive__play .upaper-menu-icon {
	width: 38px;
	height: 38px;
}

.upaper-videos-archive__title {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.upaper-videos-archive__meta {
	font-size: 12px;
	color: #767676;
}

.upaper-videos-archive__pagination {
	margin-top: 32px;
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
}

.upaper-videos-archive__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 12px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: #1d2327;
	text-decoration: none;
	background: #fff;
}

.upaper-videos-archive__pagination .page-numbers.current {
	background: #1d2327;
	color: #fff;
	border-color: #1d2327;
}

.upaper-videos-archive__pagination a.page-numbers:hover {
	background: #f4ac04;
	border-color: #f4ac04;
	color: #121212;
}

.upaper-videos-archive__empty {
	text-align: center;
	color: #767676;
	padding: 40px 16px;
	font-size: 14px;
}
