/* ==========================================================================
   Tube Theme — main stylesheet (mobile-first, RTL-first, dark)
   ========================================================================== */

@font-face {
	font-family: "Readex Pro";
	font-style: normal;
	font-weight: 300 700;
	font-display: swap;
	src: url("../fonts/readex-arabic.woff2") format("woff2");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
	font-family: "Readex Pro";
	font-style: normal;
	font-weight: 300 700;
	font-display: swap;
	src: url("../fonts/readex-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

/* ---------- Tokens ---------- */

:root {
	--bg: #0b0b10;
	--surface: #14141c;
	--surface-2: #1c1c27;
	--surface-3: #262634;
	--line: rgb(255 255 255 / 8%);
	--text: #f4f4f8;
	--text-2: #b9b9c8;
	--muted: #8a8a9e;
	--accent: #ff2e7e;
	--accent-2: #8b5cf6;
	--accent-grad: linear-gradient(135deg, #ff2e7e 0%, #b23cf0 60%, #8b5cf6 100%);
	--good: #34d399;
	--radius: 14px;
	--radius-sm: 10px;
	--gap: 10px;
	--header-h: 58px;
	--chips-h: 46px;
	--bottom-h: 62px;
	--container: 1680px;
	--font: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
	--ease: cubic-bezier(.2, .8, .2, 1);

	color-scheme: dark;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: calc(var(--header-h) + var(--chips-h));
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
}

img,
video,
svg {
	display: block;
	max-width: 100%;
}

a {
	color: inherit;
	text-decoration: none;
}

button,
input {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

h1,
h2,
h3 {
	margin: 0;
	line-height: 1.35;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 6px;
}

::selection {
	background: var(--accent);
	color: #fff;
}

.sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.skip-link:focus {
	position: fixed !important;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	clip: auto;
	padding: 10px 16px;
	background: var(--accent);
	border-radius: 8px;
}

.icon {
	width: 20px;
	height: 20px;
	flex: none;
}

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

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: 12px;
}

.main {
	padding-block: 16px 32px;
	min-height: 60vh;
}

/* ---------- Header ---------- */

.site-header {
	position: sticky;
	inset-block-start: 0;
	z-index: 50;
	background: rgb(11 11 16 / 82%);
	backdrop-filter: saturate(160%) blur(14px);
	-webkit-backdrop-filter: saturate(160%) blur(14px);
	border-block-end: 1px solid var(--line);
	transition: transform .3s var(--ease);
}

.site-header.is-hidden {
	transform: translateY(calc(-1 * var(--header-h)));
}

.site-header__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	height: var(--header-h);
}

.brand {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
	font-weight: 700;
	font-size: 19px;
	letter-spacing: -.2px;
}

.brand__mark {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 10px;
	background: var(--accent-grad);
	box-shadow: 0 6px 18px -6px rgb(255 46 126 / 60%);
}

.brand__mark .icon {
	width: 15px;
	height: 15px;
	color: #fff;
	margin-inline-end: -2px; /* optical centering of the play triangle */
}

.brand__logo {
	height: 34px;
	width: auto;
}

.icon-btn {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--text);
	transition: background .2s;
}

.icon-btn:hover {
	background: var(--surface-2);
}

/* Search: inline on desktop, full-width overlay on mobile. */

.search {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1;
	max-width: 620px;
	margin-inline: auto;
}

.search__icon {
	position: absolute;
	inset-inline-start: 14px;
	color: var(--muted);
	pointer-events: none;
}

.search__input {
	width: 100%;
	height: 42px;
	padding-inline: 44px 16px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	font-size: 14.5px;
	outline: 0;
	transition: border-color .2s, background .2s, box-shadow .2s;
	-webkit-appearance: none;
	appearance: none;
}

.search__input::placeholder {
	color: var(--muted);
}

.search__input:focus {
	border-color: rgb(255 46 126 / 55%);
	background: var(--surface-2);
	box-shadow: 0 0 0 4px rgb(255 46 126 / 12%);
}

.search__input::-webkit-search-cancel-button {
	display: none;
}

.search__close {
	display: none;
}

.search-toggle {
	display: none;
}

@media (max-width: 760px) {
	.search {
		position: absolute;
		inset: 0;
		z-index: 2;
		max-width: none;
		padding-inline: 12px;
		background: var(--bg);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-6px);
		transition: opacity .2s, transform .2s var(--ease), visibility 0s .2s;
	}

	.search__icon {
		inset-inline-start: 26px;
	}

	.search__close {
		display: grid;
		place-items: center;
		flex: none;
		width: 42px;
		height: 42px;
		margin-inline-start: 6px;
		border: 0;
		border-radius: 12px;
		background: var(--surface-2);
	}

	.is-searching .search {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity .2s, transform .2s var(--ease);
	}

	.search-toggle {
		display: grid;
		margin-inline-start: auto;
	}
}

/* ---------- Category chips ---------- */

.chips {
	position: relative;
	height: var(--chips-h);
}

.chips__track {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: 12px;
	overflow-x: auto;
	scrollbar-width: none;
	scroll-snap-type: x proximity;
	-webkit-mask-image: linear-gradient(to left, #000 92%, transparent);
	mask-image: linear-gradient(to left, #000 92%, transparent);
}

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

.chip {
	flex: none;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--text-2);
	font-size: 13.5px;
	font-weight: 500;
	white-space: nowrap;
	scroll-snap-align: start;
	transition: background .2s, color .2s;
}

.chip:hover {
	background: var(--surface-3);
	color: var(--text);
}

.chip.is-active {
	background: var(--text);
	color: var(--bg);
	font-weight: 600;
}

/* ---------- Listing header & sort ---------- */

.listing-head {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-block-end: 12px;
}

.listing-head__title {
	font-size: 20px;
	font-weight: 700;
}

.listing-head__sub {
	margin: 2px 0 0;
	color: var(--muted);
	font-size: 13px;
}

.listing-head__desc {
	margin-block-start: 6px;
	color: var(--text-2);
	font-size: 14px;
	max-width: 70ch;
}

.listing-head__desc p {
	margin: 0;
}

.actor-avatar {
	flex: none;
	width: 72px;
	height: 72px;
	padding: 3px;
	border-radius: 50%;
	background: var(--accent-grad);
}

.actor-avatar img,
.actor-avatar span {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 3px solid var(--bg);
	object-fit: cover;
}

.actor-avatar span {
	display: grid;
	place-items: center;
	background: var(--surface-2);
	font-size: 28px;
	font-weight: 700;
}

.sort {
	display: flex;
	gap: 6px;
	margin-block-end: 16px;
	overflow-x: auto;
	scrollbar-width: none;
}

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

.sort__tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	padding: 7px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	color: var(--text-2);
	font-size: 13.5px;
	transition: border-color .2s, color .2s, background .2s;
}

.sort__tab .icon {
	width: 16px;
	height: 16px;
}

.sort__tab:hover {
	color: var(--text);
	border-color: rgb(255 255 255 / 18%);
}

.sort__tab.is-active {
	border-color: transparent;
	background: rgb(255 46 126 / 14%);
	color: #ff6aa3;
	font-weight: 600;
}

/* ---------- Grid & card ---------- */

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

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

@media (min-width: 1024px) {
	.grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		row-gap: 26px;
		--gap: 18px;
	}
}

@media (min-width: 1440px) {
	.grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.card {
	min-width: 0;
	animation: card-in .4s var(--ease) both;
}

@keyframes card-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

.card__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	isolation: isolate;
}

.card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s var(--ease), opacity .3s;
}

.card__img--empty {
	display: grid;
	place-items: center;
	color: var(--surface-3);
}

.card__img--empty .icon {
	width: 40px;
	height: 40px;
}

.card__media video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity .3s;
}

.card__media.is-previewing video.is-ready {
	opacity: 1;
}

.card__duration,
.card__hd {
	position: absolute;
	z-index: 2;
	inset-block-end: 6px;
	padding: 1px 7px;
	border-radius: 6px;
	background: rgb(0 0 0 / 72%);
	backdrop-filter: blur(4px);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .3px;
	direction: ltr;
}

.card__duration {
	inset-inline-start: 6px;
}

.card__hd {
	inset-inline-end: 6px;
	background: var(--accent);
}

/* Thin progress line while a hover preview plays. */
.card__progress {
	position: absolute;
	z-index: 2;
	inset-inline: 0;
	inset-block-end: 0;
	height: 3px;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: right;
}

.card__media.is-previewing .card__progress {
	animation: preview-progress var(--preview-dur, 8s) linear forwards;
}

@keyframes preview-progress {
	to {
		transform: scaleX(1);
	}
}

@media (hover: hover) {
	.card:hover .card__img {
		transform: scale(1.04);
	}

	.card:hover .card__title a {
		color: #fff;
	}
}

.card__body {
	padding: 8px 2px 0;
}

.card__title {
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card__title a {
	color: var(--text);
	transition: color .2s;
}

/* Make the whole card clickable via the title link. */
.card {
	position: relative;
}

.card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px 10px;
	margin-block-start: 4px;
	color: var(--muted);
	font-size: 12px;
}

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

.card__meta .icon {
	width: 14px;
	height: 14px;
}

.card__ratio.is-good {
	color: var(--good);
}

@media (max-width: 420px) {
	.card__date {
		display: none !important;
	}

	.card__title {
		font-size: 13.5px;
	}
}

@media (min-width: 1024px) {
	.card__title {
		font-size: 15px;
	}

	.card__meta {
		font-size: 12.5px;
	}
}

/* ---------- Pagination ---------- */

.pager {
	display: grid;
	justify-items: center;
	gap: 18px;
	margin-block-start: 32px;
}

.pager__more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 220px;
	height: 48px;
	padding-inline: 28px;
	border-radius: 999px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	font-weight: 600;
	transition: background .2s, transform .1s;
}

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

.pager__more:active {
	transform: scale(.98);
}

.pager__more.is-loading span {
	opacity: .5;
}

.pager__more.is-loading::after {
	content: "";
	width: 16px;
	height: 16px;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin .7s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.pager__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
}

.pager__links .page-numbers {
	display: grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding-inline: 10px;
	border-radius: 10px;
	background: var(--surface);
	color: var(--text-2);
	font-size: 14px;
	font-weight: 500;
	transition: background .2s;
}

.pager__links a.page-numbers:hover {
	background: var(--surface-2);
	color: var(--text);
}

.pager__links .page-numbers.current {
	background: var(--accent-grad);
	color: #fff;
}

.pager__links .page-numbers.dots {
	background: transparent;
}

/* ---------- Empty states ---------- */

.empty {
	display: grid;
	justify-items: center;
	gap: 8px;
	padding: 64px 16px;
	text-align: center;
}

.empty__icon {
	width: 48px;
	height: 48px;
	color: var(--surface-3);
}

.empty h1,
.empty h2 {
	font-size: 20px;
}

.empty p {
	margin: 0;
	color: var(--muted);
}

.empty__code {
	font-size: 88px;
	font-weight: 700;
	line-height: 1;
	background: var(--accent-grad);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.search--inline {
	width: 100%;
	max-width: 420px;
	margin-block-start: 12px;
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-block-start: 12px;
	padding: 10px 22px;
	border-radius: 999px;
	background: var(--accent-grad);
	color: #fff;
	font-weight: 600;
}

.section-title {
	margin-block: 8px 14px;
	font-size: 18px;
}

/* ---------- Footer ---------- */

.site-footer {
	margin-block-start: 24px;
	padding-block: 28px;
	border-block-start: 1px solid var(--line);
	background: var(--surface);
}

.site-footer__inner {
	display: grid;
	gap: 12px;
}

.footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--text-2);
	font-size: 14px;
}

.footer-links a:hover {
	color: var(--text);
}

.site-footer__note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	color: var(--muted);
	font-size: 13px;
}

.badge-18 {
	flex: none;
	padding: 1px 8px;
	border: 1.5px solid var(--accent);
	border-radius: 6px;
	color: var(--accent);
	font-size: 12px;
	font-weight: 700;
	direction: ltr;
}

.site-footer__copy {
	margin: 0;
	color: var(--muted);
	font-size: 12.5px;
}

/* ---------- Mobile bottom navigation ---------- */

.bottom-nav {
	position: fixed;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 60;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
	padding-block-end: env(safe-area-inset-bottom);
	background: rgb(14 14 20 / 88%);
	backdrop-filter: saturate(160%) blur(16px);
	-webkit-backdrop-filter: saturate(160%) blur(16px);
	border-block-start: 1px solid var(--line);
}

.bottom-nav__item {
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 3px;
	border: 0;
	background: none;
	color: var(--muted);
	font-size: 11px;
	font-weight: 500;
	transition: color .2s;
}

.bottom-nav__item .icon {
	width: 22px;
	height: 22px;
	transition: transform .2s var(--ease);
}

.bottom-nav__item.is-active {
	color: var(--text);
}

.bottom-nav__item.is-active .icon {
	color: var(--accent);
	transform: translateY(-1px);
}

@media (min-width: 761px) {
	body {
		padding-bottom: 0;
	}

	.bottom-nav {
		display: none;
	}

	.container {
		padding-inline: 24px;
	}

	.chips__track {
		padding-inline: 24px;
	}

	.main {
		padding-block-start: 22px;
	}

	.listing-head__title {
		font-size: 24px;
	}

	.site-footer__inner {
		grid-template-columns: auto 1fr;
		align-items: center;
		column-gap: 32px;
	}

	.site-footer__note,
	.site-footer__copy {
		grid-column: 1 / -1;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
