/*
 * Service page: «من أعمالنا» (pages/service/work.php) — the dark scene again
 * after the light offers, so the work stands out.
 */

.gb-svc-work {
	--gb-focus: var(--gb-focus-inverse);
	--gb-section-text: var(--gb-scene-text);
	--gb-section-muted: var(--gb-scene-text-muted);

	padding-block: var(--gb-space-2xl);
	background-color: var(--gb-scene-bg);
	background-image: radial-gradient(60% 40% at 50% 0%, var(--gb-color-turquoise-a10), transparent 70%);
	color: var(--gb-scene-text);
}

.gb-svc-work__head {
	margin-block-end: var(--gb-space-l);
}

/* ---------- Cases (image + description, alternating sides) ---------- */

.gb-svc-cases {
	display: grid;
	gap: var(--gb-space-xl);
	margin: 0;
	padding: 0;
	list-style: none;
}

.gb-svc-case {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	align-items: center;
	gap: var(--gb-space-l);
}

@media (min-width: 48rem) {
	.gb-svc-case:nth-child(even) .gb-svc-case__figure {
		order: 2;
	}
}

.gb-svc-case__figure {
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--gb-color-turquoise-a20);
	border-radius: var(--gb-radius-l);
}

.gb-svc-case__image {
	display: block;
	inline-size: 100%;
	block-size: auto;
}

.gb-svc-case__body {
	display: grid;
	gap: var(--gb-space-xs);
}

.gb-svc-case__title {
	font-size: var(--gb-step-3);
	color: var(--gb-primary);
}

.gb-svc-case__text {
	font-size: var(--gb-step-0);
	color: var(--gb-scene-text);
	text-wrap: pretty;
}

/* ---------- Photos: one frame, turned like an album (revision 15) ---------- */

/*
 * pages/service/work.php + assets/js/pages/service/gallery.js. The frame is a
 * light mat with two sheets peeking under it (the album's thickness).
 * Baseline (no JS): the photos scroll sideways inside it, one at a time.
 * [data-gb-frame="on"]: the photos lie on each other; the top one turns over
 * from its free edge (the left in Arabic, the right in English) to show the
 * next, like a page.
 */
.gb-svc-frame {
	--gb-frame-mat: #f7f4ef;
	--gb-frame-pad: clamp(0.5rem, 0.25rem + 1.1vw, 1rem);
	--gb-frame-ink: #0a1a30;

	display: grid;
	justify-items: center;
	gap: var(--gb-space-s);
	max-inline-size: 62rem;
	margin-inline: auto;
}

.gb-svc-frame__stage {
	position: relative;
	inline-size: 100%;
	padding: var(--gb-frame-pad);
	border-radius: calc(var(--gb-radius-l) + 0.25rem);
	background-color: var(--gb-frame-mat);
	/* The album's thickness: two sheets under the frame, a little lower and narrower. */
	box-shadow:
		0 1px 0 rgb(255 255 255 / 0.6) inset,
		0 0.7rem 0 -0.3rem #e4ded4,
		0 1.3rem 0 -0.65rem #cfc7ba,
		0 2.2rem 3.5rem -1.6rem rgb(0 0 0 / 0.7);
}

.gb-svc-frame[data-count="1"] .gb-svc-frame__stage {
	box-shadow:
		0 1px 0 rgb(255 255 255 / 0.6) inset,
		0 2rem 3.5rem -1.8rem rgb(0 0 0 / 0.65);
}

/* Baseline: a row that scrolls one photo at a time. */
.gb-svc-frame__sheets {
	display: flex;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	border-radius: var(--gb-radius-m);
	list-style: none;
}

.gb-svc-frame__sheets::-webkit-scrollbar {
	display: none;
}

.gb-svc-frame__sheet {
	flex: 0 0 100%;
	scroll-snap-align: center;
}

.gb-svc-frame__figure {
	position: relative;
	display: grid;
	aspect-ratio: 3 / 2;
	margin: 0;
	overflow: hidden;
	border-radius: var(--gb-radius-m);
	background-color: var(--gb-frame-ink);
}

/* The photo's own colours, blurred, fill the frame around a photo of another shape. */
.gb-svc-frame__figure::before {
	content: "";
	position: absolute;
	inset: -10%;
	background: var(--gb-frame-bg, none) center / cover no-repeat;
	filter: blur(1.4rem) saturate(1.15);
	opacity: 0.55;
}

.gb-svc-frame__image {
	position: relative;
	grid-area: 1 / 1;
	inline-size: 100%;
	block-size: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.gb-svc-frame__caption {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	padding: 2.4rem clamp(0.9rem, 0.5rem + 1.4vw, 1.5rem) clamp(0.7rem, 0.5rem + 0.8vw, 1.1rem);
	background: linear-gradient(to top, rgb(5 14 28 / 0.82), rgb(5 14 28 / 0));
	color: #fff;
	font-size: var(--gb-step--1);
	line-height: 1.5;
	text-wrap: pretty;
}

/* ---------- The album (JS) ---------- */

[data-gb-frame="on"] .gb-svc-frame__sheets {
	display: grid;
	overflow: visible;
	perspective: 2400px;
	touch-action: pan-y;
	cursor: grab;
}

[data-gb-frame="on"] .gb-svc-frame__sheets.is-dragging {
	cursor: grabbing;
}

[data-gb-frame="on"] .gb-svc-frame__sheet {
	position: relative;
	grid-area: 1 / 1;
	transform-origin: right center;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	will-change: transform;
}

[dir="ltr"] [data-gb-frame="on"] .gb-svc-frame__sheet {
	transform-origin: left center;
}

[data-gb-frame="on"] .gb-svc-frame__sheet[hidden] {
	display: none;
}

/* The light on a turning page: darker as it rises (set by the script, 0–1). */
[data-gb-frame="on"] .gb-svc-frame__sheet::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--gb-radius-m);
	background: linear-gradient(to left, rgb(0 0 0 / 0) 40%, rgb(0 0 0 / 0.45));
	opacity: var(--gb-frame-shade, 0);
	pointer-events: none;
}

[dir="ltr"] [data-gb-frame="on"] .gb-svc-frame__sheet::after {
	background: linear-gradient(to right, rgb(0 0 0 / 0) 40%, rgb(0 0 0 / 0.45));
}

/* The arrows: on the frame's two sides (inside it on phones). */
.gb-svc-frame__turn {
	position: absolute;
	z-index: 5;
	inset-block-start: 50%;
	display: grid;
	place-items: center;
	inline-size: 2.9rem;
	block-size: 2.9rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgb(255 255 255 / 0.94);
	box-shadow: 0 0.5rem 1.2rem -0.4rem rgb(0 0 0 / 0.45);
	color: var(--gb-color-navy);
	cursor: pointer;
	translate: 0 -50%;
	transition: background-color var(--gb-duration-base) linear, scale var(--gb-duration-base) var(--gb-ease-out);
}

.gb-svc-frame__turn[hidden] {
	display: none;
}

.gb-svc-frame__turn:hover {
	background-color: var(--gb-color-turquoise);
	scale: 1.06;
}

.gb-svc-frame__turn svg {
	inline-size: 1.3rem;
	block-size: 1.3rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

[dir="ltr"] .gb-svc-frame__turn svg {
	scale: -1 1;
}

.gb-svc-frame__turn--prev {
	inset-inline-start: 1.4rem;
}

.gb-svc-frame__turn--next {
	inset-inline-end: 1.4rem;
}

@media (min-width: 72rem) {
	.gb-svc-frame__turn--prev {
		inset-inline-start: -4.25rem;
	}

	.gb-svc-frame__turn--next {
		inset-inline-end: -4.25rem;
	}
}

/* The small pictures: one line, scrolling when there are many. */
.gb-svc-frame__thumbs {
	display: flex;
	gap: 0.5rem;
	max-inline-size: 100%;
	margin-block-start: 0.9rem;
	padding: 0.35rem 0.25rem;
	overflow-x: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--gb-color-turquoise-a35) transparent;
}

.gb-svc-frame__thumbs[hidden] {
	display: none;
}

.gb-svc-frame__thumb {
	flex: none;
	inline-size: clamp(3.6rem, 3rem + 2vw, 4.6rem);
	aspect-ratio: 4 / 3;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: var(--gb-radius-s);
	background: rgb(255 255 255 / 0.06);
	cursor: pointer;
	opacity: 0.55;
	transition: opacity var(--gb-duration-base) linear, border-color var(--gb-duration-base) linear;
}

.gb-svc-frame__thumb img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.gb-svc-frame__thumb:hover {
	opacity: 0.9;
}

.gb-svc-frame__thumb[aria-current="true"] {
	border-color: var(--gb-color-turquoise);
	opacity: 1;
}

.gb-svc-frame__hint {
	margin: 0;
	font-size: var(--gb-step--1);
	color: var(--gb-scene-text-muted);
	text-align: center;
}

.gb-svc-frame__hint[hidden] {
	display: none;
}

.gb-svc-stories + .gb-svc-frame,
.gb-svc-cases + .gb-svc-frame,
.gb-svc-cases + .gb-svc-videos,
.gb-svc-frame + .gb-svc-videos {
	margin-block-start: var(--gb-space-xl);
}

/* ---------- Videos (cards play in place, components/video-facade) ---------- */

.gb-svc-videos__title {
	margin-block-end: var(--gb-space-s);
	font-size: var(--gb-step-2);
	color: var(--gb-scene-text);
}

.gb-svc-videos__list {
	display: grid;
	align-items: start;
	gap: var(--gb-space-m) var(--gb-space-s);
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * Two rows by shape (pages/service/work.php): landscape videos three to a
 * row, Shorts as a row of narrow cards. Phones: landscape full width,
 * Shorts two to a row.
 */
.gb-svc-videos__list--wide {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}

.gb-svc-videos__list--tall {
	grid-template-columns: repeat(auto-fill, minmax(min(46%, 11rem), 1fr));
}

@media (min-width: 64rem) {
	.gb-svc-videos__list--tall {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.gb-svc-videos__list + .gb-svc-videos__list {
	margin-block-start: var(--gb-space-l);
}
