/**
 * Components for the Scripts section, the homepage Latest Releases carousel and
 * the script article. Loaded site-wide (small, self-contained), reuses the
 * theme's colour tokens and never touches the app-page stylesheet.
 *
 * @package APKMobile
 */

/* ------------------------------------------------ homepage carousel */

.home-carousel {
	padding: var(--space-lg, 3rem) 0 0;
}

.home-carousel__carousel {
	position: relative;
	outline: none;
}

.home-carousel__viewport {
	/* Native horizontal scrolling: trackpad/mouse and touch drive the carousel
	   directly and each slide snaps cleanly into place. The scrollbar is hidden
	   visually but the region stays scrollable and reachable. */
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	border: 1px solid var(--c-border-strong, rgba(255, 255, 255, 0.14));
	border-radius: 18px;
	background: var(--c-card, #111c2a);
}

.home-carousel__viewport::-webkit-scrollbar {
	display: none;
}

.home-carousel__track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.home-carousel__slide {
	flex: 0 0 100%;
	min-width: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.home-carousel__slide-link {
	display: block;
	position: relative;
	/* Roughly 30% shorter than the old 16 / 9 banner: a wide, filmstrip-like
	   ratio plus a responsive cap so the height tracks the viewport instead of
	   being hardcoded. Aspect ratio is preserved (object-fit: cover, no stretch). */
	aspect-ratio: 2.5 / 1;
	max-height: clamp(300px, 32vw, 460px);
	overflow: hidden;
	text-decoration: none;
	color: #fff;
}

.home-carousel__media {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #16273a, #0d1620);
}

.home-carousel__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.home-carousel__initials {
	font-size: clamp(2.5rem, 10vw, 4.5rem);
	font-weight: 800;
	letter-spacing: 0.06em;
	color: rgba(255, 255, 255, 0.85);
}

.home-carousel__body {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 2rem 1.5rem 1.1rem;
	background: linear-gradient(180deg, rgba(6, 12, 20, 0) 0%, rgba(6, 12, 20, 0.85) 100%);
}

.home-carousel__name {
	font-size: clamp(1.1rem, 3vw, 1.6rem);
	font-weight: 700;
	line-height: 1.2;
}

.home-carousel__meta {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.85rem;
	color: rgba(255, 255, 255, 0.78);
}

.home-carousel__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	background: rgba(6, 12, 20, 0.55);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

.home-carousel__arrow:hover {
	background: rgba(6, 12, 20, 0.8);
}

.home-carousel__arrow:focus-visible {
	outline: 3px solid rgba(34, 197, 94, 0.6);
	outline-offset: 2px;
}

.home-carousel__arrow--prev {
	inset-inline-start: 0.75rem;
}

.home-carousel__arrow--next {
	inset-inline-end: 0.75rem;
}

.home-carousel__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1rem;
}

.home-carousel__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--c-border-strong, rgba(255, 255, 255, 0.3));
	cursor: pointer;
}

.home-carousel__dot.is-active {
	background: #22c55e;
	transform: scale(1.25);
}

.home-carousel__dot:focus-visible {
	outline: 3px solid rgba(34, 197, 94, 0.6);
	outline-offset: 2px;
}

@media (max-width: 640px) {
	.home-carousel__slide-link {
		/* ~20% shorter than the previous 3 / 2 mobile frame. The image ratio is
		   preserved (object-fit: cover, no stretch). */
		aspect-ratio: 15 / 8;
		max-height: none;
	}

	.home-carousel__body {
		padding: 1.5rem 1rem 0.85rem;
	}

	.home-carousel__arrow {
		width: 40px;
		height: 40px;
	}
}

/* ------------------------------------------------------- script cards */

.section--scripts .section__title::before {
	content: "";
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 0.55rem;
	border-radius: 3px;
	background: #22c55e;
	transform: translateY(-1px);
}

.script-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 1rem;
}

.script-card {
	background: var(--c-card, #111c2a);
	border: 1px solid var(--c-border, rgba(255, 255, 255, 0.1));
	border-radius: 14px;
	overflow: hidden;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.script-card:hover {
	border-color: var(--c-border-strong, rgba(255, 255, 255, 0.22));
	transform: translateY(-2px);
}

.script-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

.script-card__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	/* ~25% shorter visual area than the old 16 / 9 frame, so the section reads
	   lighter while covers stay undistorted (object-fit: cover, no stretch). */
	aspect-ratio: 2.4 / 1;
	background: linear-gradient(135deg, #16273a, #0d1620);
	overflow: hidden;
}

.script-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.script-card__initials {
	font-size: 1.5rem;
	font-weight: 800;
	color: rgba(255, 255, 255, 0.85);
}

.script-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.85rem 1rem 1rem;
}

.script-card__title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.3;
}

.script-card__category {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #22c55e;
}

/* ----------------------------------------- script carousel (homepage) */

.script-carousel {
	position: relative;
}

.script-carousel__viewport {
	overflow: hidden;
	outline: none;
}

.script-carousel__viewport:focus-visible {
	outline: 3px solid rgba(34, 197, 94, 0.6);
	outline-offset: 3px;
	border-radius: 14px;
}

.script-carousel__track {
	display: flex;
	align-items: stretch;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
	transition: transform 0.5s ease;
	will-change: transform;
}

.script-carousel__slide {
	flex: 0 0 auto;
	width: clamp(210px, 22vw, 250px);
	display: flex;
}

.script-carousel__slide .script-card {
	flex: 1 1 auto;
	width: 100%;
}

.script-carousel__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 50%;
	background: rgba(6, 12, 20, 0.72);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	backdrop-filter: blur(4px);
}

.script-carousel__arrow:hover {
	background: rgba(6, 12, 20, 0.92);
}

.script-carousel__arrow:focus-visible {
	outline: 3px solid rgba(34, 197, 94, 0.6);
	outline-offset: 2px;
}

.script-carousel__arrow--prev {
	inset-inline-start: 0.35rem;
}

.script-carousel__arrow--next {
	inset-inline-end: 0.35rem;
}

@media (max-width: 640px) {
	.script-carousel__slide {
		width: 74vw;
	}

	.script-carousel__arrow {
		width: 38px;
		height: 38px;
	}
}

/* ----------------------------------------------------- script article */

.script-page {
	padding-bottom: clamp(2rem, 6vw, 4rem);
}

.script-article__header {
	padding-block: clamp(1.5rem, 5vw, 3rem);
}

.script-article__title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.6rem, 5vw, 2.4rem);
	line-height: 1.15;
}

.script-article__meta {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	color: var(--c-text-muted, #94a3b8);
}

.script-article__type {
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #22c55e;
	font-size: 0.8rem;
}

.script-article__media {
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 7;
	background: linear-gradient(135deg, #16273a, #0d1620);
	overflow: hidden;
}

.script-article__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.script-article__initials {
	font-size: clamp(3rem, 12vw, 6rem);
	font-weight: 800;
	color: rgba(255, 255, 255, 0.85);
}

.script-article__body {
	padding-top: 2rem;
}

.script-article__cta {
	margin: 2rem 0;
}

.script-article__tags {
	margin-top: 2rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

@media (min-width: 860px) {
	.script-article__media {
		aspect-ratio: 16 / 6;
	}
}
