/*
 * Work pages (T062): the old Elementor single-post template 5190 and the four work bodies
 * (posts 394, 10783, 484, 10794), with the same sizes at 1440 / 768 / 390.
 * Breakpoints as Elementor: tablet ≤1024px, mobile ≤767px.
 *
 * Sizes that differ between works come from the block's "vars" in content/works/<id>.json:
 *   point      --mt --mb (+ -t tablet, -m mobile), --cmb-m (text column bottom, mobile), --label-align-m
 *   dark       --mt (+ -t, -m)
 *   banner     --mb, --logo-w, --logo-r
 *   shot       --pad
 *   statement  --st-size-m
 *   gallery    --mt; carousel --gap (between pictures; --show comes from the block's "show")
 *   spacer     --size
 */

/* ---------- Scroll-effect backgrounds (motion.js type "background") ---------- */
.fx-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fx-bg__layer {
	position: absolute; top: 0; left: 0; width: 100%; height: 100%;
	background-position: center center; background-repeat: no-repeat; background-size: cover;
	will-change: transform;
}
/* Lazy backgrounds: motion.js §٧ writes the picture when it gets near the screen; without JavaScript
 * the variable shows it right away */
html:not(.js-motion) [data-bg] { background-image: var(--bg); }
@media (max-width: 1024px) { html:not(.js-motion) [data-bg] { background-image: var(--bg-t, var(--bg)); } }
@media (max-width: 767px) { html:not(.js-motion) [data-bg] { background-image: var(--bg-m, var(--bg)); } }

/* Sideways move: Elementor makes the layer wider by 10% per speed step (speed 7 → 170%) */
.fx-bg__layer--wide { width: 170%; }

/* ---------- Top: title, excerpt, cover (eb6fd55) ---------- */
.work-hero { display: flex; flex-direction: column; gap: 20px; margin-top: 100px; padding: 0 var(--gutter); }
.work-hero__head { display: flex; flex-direction: column; gap: 20px; }
.work-hero__title {
	font-family: var(--f-ar); font-size: clamp(70px, 3vw, 90px); font-weight: 300;
	line-height: 1.3em; letter-spacing: -1.9px; text-align: center;
}
.work-hero__excerpt {
	align-self: center; width: 80%; margin: .2vw 0 1vw; text-align: center;
	font-size: var(--t-h4); font-weight: 500; line-height: var(--lh-h4);
}
.work-hero__cover { position: relative; min-height: 90vh; }

/* ---------- Story: intro + facts (36259e7) ---------- */
.work-story { display: flex; flex-direction: column; gap: 20px; margin: 15vh 0; padding: 0 20vw; }
.work-story__intro { display: flow-root; text-align: center; }
.work-story__title { font-size: var(--t-h3); font-weight: 400; line-height: var(--lh-h3); margin: .6em 0 .3em; }
.work-story__subtitle { font-family: var(--f-ar); font-size: var(--t-h4); font-weight: 500; line-height: var(--lh-h4); margin: .6em 0 .3em; }
.work-story__intro p { margin: 0 0 16px; }

.work-meta { display: flex; align-items: flex-start; gap: 20px; margin: 5vh 0 0; }
.work-meta__item { display: flex; flex-direction: column; gap: 20px; flex: 0 0 auto; min-width: 0; }
.work-meta__item:nth-child(1) { width: 35%; padding-inline-start: 5%; }
.work-meta__item:nth-child(2) { width: 22%; }
.work-meta__item:nth-child(3) { width: 12%; }
.work-meta__item:nth-child(4) { width: 30%; flex-shrink: 1; }
.work-meta dt { font-family: var(--f-ar); font-size: var(--t-h6); font-weight: 500; line-height: 1.2em; }
.work-meta dd { margin: 0; }
.work-meta dd a { color: inherit; }
/* vertical-align 1px: the old icon font put the link 1px higher on its line; this keeps the same row height */
.work-meta__link { display: inline-block; vertical-align: -1px; font-size: 14px; font-weight: 600; line-height: 1.6em; color: var(--c-black); }
/* text first in the markup so the link sits on the text's baseline (as the old icon font did); icon drawn on the right */
.work-meta__link-in { display: flex; flex-direction: row-reverse; justify-content: center; gap: 10px; }
.work-meta__icon { display: flex; align-items: center; }
.work-meta__link .icon-arrow-up { width: 1em; height: 1em; fill: currentColor; }
.work-meta__link--shadow { text-shadow: 0 0 10px rgb(0 0 0 / .3); }

/* ---------- Page capture (05d4f07) ---------- */
.work-shot { overflow: hidden; padding: 0 var(--gutter); }
.work-shot__frame { padding: var(--pad, 230px); }
.work-shot__img { vertical-align: baseline; max-width: 100%; height: auto; border: 2px solid gray; border-radius: 15px; box-shadow: 5px 5px 50px black; }
/* Same frame around the pieces of a sliced capture (an inline box like the old <img>, same gap under it) */
.work-shot__img--sliced { display: inline-block; width: 100%; overflow: hidden; }
.work-shot__img--sliced img { display: block; width: 100%; height: auto; }

/* ---------- Label + text (التحديات / الهدف / النتيجة: 5ef9dbe) ---------- */
.work-point { display: flex; flex-wrap: wrap; margin: var(--mt, 10vh) 0 var(--mb, 45px); padding: 0 var(--gutter); }
.work-point__label {
	width: 25%; text-align: center;
	font-family: var(--f-ar); font-size: var(--t-h6); font-weight: 500; line-height: 1.2em;
}
.work-point__content { display: flex; flex-direction: column; gap: 20px; width: 65%; padding: 0 30px; margin-bottom: 10vh; }
.work-point__heading { font-size: 1.9rem; font-weight: 400; line-height: 1.3em; margin: 0 0 3vh; }
.work-point__text { font-size: clamp(20px, .9vw, 28px); line-height: 1.5em; }
.work-point__text p { margin: 0 0 1em; }
/* Results on black (8b6c515): a thin line above, light text */
.work-point--result { margin: 10vh 0 0; padding: 10vh 0 0; border-top: 1px solid var(--c-glass); color: var(--c-paper); }

/* ---------- Picture moving sideways + black box (69c092e) ---------- */
.work-split { display: flex; align-items: flex-end; gap: 0 30px; padding: 0 var(--gutter); }
/* the padding is there only so both sides shrink by the same share as in Elementor (809 / 541 at 1440) */
.work-split__media { position: relative; flex: 0 1 60%; min-height: 90vh; padding: 0 var(--gutter); background-color: var(--c-muted); }
.work-split__media .fx-bg__layer { background-color: var(--c-muted); background-position: center left; }
.work-split__box {
	display: flex; flex-direction: column; justify-content: flex-end;
	flex: 0 1 40%; min-height: 40vh; padding: 6% 4% 4%; background: var(--c-black); text-align: center;
}
.work-split__box img { width: 100%; max-width: 100%; height: auto; vertical-align: middle; }

/* ---------- The black part (b412e0d) ---------- */
.work-dark {
	display: flex; flex-direction: column; gap: 20px;
	margin-top: var(--mt, 60vh); padding: 0 var(--gutter); background: var(--c-black); color: var(--c-paper);
}

/* Cover with the logo hanging off its bottom (1efc958) */
.work-banner {
	position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
	min-height: 90vh; margin: -60vh 0 var(--mb, 25vh); padding: 0 var(--gutter);
	background-color: var(--c-muted); background-position: top center; background-repeat: no-repeat; background-size: cover;
}
.work-banner__logo { position: relative; text-align: center; }
.work-banner__logo > div { margin: 0 0 -20vh 15vw; }
.work-banner__logo img { width: var(--logo-w, 22vw); height: auto; border-radius: var(--logo-r, 27px); vertical-align: middle; }

/* Wide picture that tilts toward the mouse (b8132f7 / 4c4a1be) */
.work-wide { position: relative; z-index: 23; padding: 0 var(--gutter); }
.work-wide__media { margin-top: -171px; text-align: center; perspective: 1200px; }
.work-wide__media img { width: 75%; height: auto; border-radius: 14px; vertical-align: middle; }

/* Full picture (6a771ad / 6f1eff4f / 2969defe) */
.work-panel {
	position: relative; z-index: 2; min-height: 90vh;
	background-position: center center; background-repeat: no-repeat; background-size: cover;
}
/* 1050px even on tablet, where it is wider than the screen and centred (as before) */
.work-panel--narrow { align-self: center; flex: none; width: 1050px; min-height: 83vh; max-width: 100%; } /* D-047: never wider than the screen (was 1050px on 768–1024: cut both sides) */

.work-spacer { height: var(--size, 50px); }

/* The big sentence, twice (715cbb9 filled, under the pictures; 0839fb0 outlined, over them) */
.work-statement { position: relative; display: flex; flex-direction: column; gap: 20px; }
.work-statement__text { position: absolute; top: 0; left: 0; z-index: 1; width: 70%; text-align: center; }
.work-statement__text > div { margin-top: -5vw; }
.work-statement__text :is(h2, p) { font-size: var(--t-h1); font-weight: 300; line-height: var(--lh-h1); margin: 0; }
.work-statement__text--outline { z-index: 3; }
.work-statement__text--outline p { color: transparent; -webkit-text-stroke: 1px var(--c-paper); }
.work-statement__media { position: relative; z-index: 2; display: flex; justify-content: flex-end; gap: 30px; margin-top: 15vw; }
.work-statement__img--1 { width: 30%; margin-top: 28vh; }
.work-statement__img--2 { width: 55%; }
.work-statement__img img { width: 100%; height: auto; vertical-align: middle; }

/* Gallery + «المشروع التالي» (eb1201f) */
.work-gallery { display: flex; flex-direction: column; gap: 30px; margin-top: var(--mt, 0); padding-top: 10px; }
.work-gallery__next { margin: 3vh 0; font-family: var(--f-ar); font-size: var(--t-h6); font-weight: 500; line-height: 1.2em; }
.work-gallery__next--big { font-size: var(--t-h4); line-height: var(--lh-h4); }

/* ---------- Image slider (carousel.js; Elementor image-carousel look) ---------- */
/* z-index 1 like swiper: it covers the filled sentence above it, the outlined one stays on top */
.carousel { position: relative; z-index: 1; padding-bottom: 35px; }
.carousel__track {
	display: flex; gap: var(--gap, 0px); overflow-x: auto; overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory; scrollbar-width: none;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide { flex: 0 0 calc((100% - (var(--show) - 1) * var(--gap, 0px)) / var(--show)); margin: 0; scroll-snap-align: start; text-align: center; }
.carousel__slide img { width: 100%; height: auto; }
.carousel__dots { position: absolute; bottom: 5px; left: 0; width: 100%; text-align: center; line-height: 1.4em; }
.carousel__dot {
	display: inline-block; width: 6px; height: 6px; margin: 0 6px; padding: 0; border: 0; border-radius: 50%;
	background: var(--c-muted); cursor: pointer; transition: .3s; vertical-align: baseline;
}
.carousel__dot[aria-current="true"] { width: 20px; border-radius: 6px; background: var(--c-paper); }

/* ---------- Next work (loop 5636 / 9aace20) ---------- */
.work-next { position: relative; display: flex; flex-direction: column; min-height: 80vh; padding: 0 var(--gutter); background: var(--c-black); }
.work-next .fx-bg__layer { background-color: var(--c-black); background-position: top center; }
/* The dark fade over the picture zooms with it (as before); its own GPU layer, or every zoom step
 * re-paints picture + fade together: 7–9 late frames → 0 as the card comes in (A/B, T062). */
.work-next .fx-bg__layer::before { content: ""; position: absolute; inset: 0; opacity: .6; background-image: linear-gradient(180deg, #0000 40%, var(--c-black) 90%); will-change: transform; }
.work-next__inner { position: relative; display: flex; flex: 1; flex-direction: column; justify-content: flex-end; }
.work-next__bar { position: relative; z-index: 99; display: flex; flex-direction: column; gap: 10px; padding: 4vh 0 8vh; }
.work-next__link {
	align-self: flex-start; display: flex; gap: 20px;
	font-size: var(--t-h2); font-weight: 400; line-height: var(--lh-h2); color: var(--c-white);
}
.work-next__link:hover, .work-next__link:focus-visible { color: var(--c-paper); }
.work-next__icon { display: flex; align-items: center; font-size: 34px; }
.work-next__icon .icon-arrow-up { width: 1em; height: 1em; fill: currentColor; }
.work-next__excerpt { color: var(--c-white); }

/* ---------- Desktop only ---------- */
@media (min-width: 1025px) {
	/* The bar stays at the bottom of the screen while the card scrolls in (Elementor sticky bottom) */
	.work-next__bar { position: sticky; bottom: 0; }
	/* Word reveal starts dim, like the theme (motion.js lights each word); not with reduced motion */
	@media (prefers-reduced-motion: no-preference) {
		.js-motion [data-reveal] { opacity: .1; will-change: opacity; }
	}
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.work-hero { margin-top: 80px; }
	.work-hero__head { gap: 10px; }
	.work-hero__title { font-size: 46px; line-height: 1em; }
	.work-hero__excerpt { width: 100%; margin: 0; }
	.work-hero__cover { min-height: 500px; margin-top: 10px; }
	.work-hero__cover .fx-bg__layer { background-image: var(--bg-t) !important; }

	.work-story { margin: 80px 0; padding: 0 30px; }
	.work-meta { flex-wrap: wrap; }
	.work-meta__item { gap: 10px; margin-bottom: 10px; }

	.work-point { margin: var(--mt-t, 80px) 0 var(--mb-t, 35px); }
	.work-point__content { padding: 0; margin-bottom: 60px; }
	.work-point__heading { font-size: 36px; line-height: 1.1em; }
	.work-point__text { font-size: 19px; }
	.work-point--result { margin: 10vh 0 0; }

	.work-split__media { min-height: 70vh; }
	.work-dark { margin-top: var(--mt-t, 370px); }
	.work-banner { min-height: 500px; margin: -350px 0 120px; }
	.work-banner__logo > div { margin: 0 0 -140px 60px; }
	.work-banner__logo img { width: 200px; }
	.work-panel { min-height: 500px; }
	.work-gallery { padding: 0; }
	.work-gallery__next { margin: 10px 0 0; }
	.work-next { min-height: 500px; }
}
@media (min-width: 768px) and (max-width: 1024px) {
	.work-meta__item:nth-child(1) { width: 50%; }
	.work-meta__item:nth-child(2) { width: 45%; }
	.work-meta__item:nth-child(3) { width: 50%; }
	.work-meta__item:nth-child(4) { width: 45%; }
	.work-point__content { width: 75%; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.work-hero { margin-top: 70px; }
	.work-hero__title { font-size: 36px; line-height: 1.2em; }
	.work-hero__cover { min-height: 250px; }
	.work-hero__cover .fx-bg__layer { background-image: var(--bg-m) !important; }

	.work-story { margin: 30px 0; padding: 0 20px; }
	.work-meta { margin-top: 10px; }
	.work-meta__item:nth-child(1) { width: 100%; }
	.work-meta__item:nth-child(2) { width: 68%; }
	.work-meta__item:nth-child(3) { width: 25%; }
	.work-meta__item:nth-child(4) { width: 68%; }

	.work-shot__frame { margin: 20vw 0; padding: 5px; }

	.work-point { margin: var(--mt-m, 30px) 0 var(--mb-m, 0px); }
	.work-point__label { width: 100%; margin-bottom: 20px; text-align: var(--label-align-m, center); }
	.work-point__content { width: 100%; margin-bottom: var(--cmb-m, 40px); }
	.work-point__heading { font-size: 28px; line-height: 1.3em; margin: 0; }
	.work-point--result { margin: 60px 0 0; padding-top: 60px; }
	.work-point--result .work-point__content { margin-bottom: calc(35px - 1em); }

	.work-split { flex-wrap: wrap; }
	.work-split__media, .work-split__box { flex-basis: 100%; }
	.work-split__media { min-height: 60vh; }
	.work-split__box { min-height: auto; justify-content: flex-start; padding: 20px; }

	.work-dark { margin-top: var(--mt-m, 200px); }
	.work-banner { min-height: 300px; margin: -200px 0 60px; }
	.work-banner__logo > div { margin: 0 0 -80px 0; }
	.work-banner__logo img { width: 150px; }
	.work-wide__media img { width: 100%; height: 215px; }
	.work-panel, .work-panel--narrow { align-self: stretch; width: auto; min-height: 300px; }

	.work-statement__text { width: 90%; }
	.work-statement__text > div { margin-top: -85px; }
	.work-statement__text :is(h2, p) { font-size: var(--st-size-m, var(--t-h1)); }
	.work-statement__media { flex-direction: column; margin-top: 30%; }
	.work-statement__img--1 { order: 1; width: 45%; margin-top: -40px; }
	.work-statement__img--2 { order: -1; align-self: flex-end; width: 80%; }
	.work-gallery { padding: 0 0 20px; }
	.work-next { min-height: 400px; }
}

/* Mouse tilt target (motion.js §٦): the original widget container eases it 0.4s (measured, D-036) */
.is-tilt { transition: transform .4s ease; }

/* Several pictures per view (apple: 3 on desktop and tablet) → one on mobile */
@media (max-width: 767px) { .carousel { --show: 1 !important; } }

/* T077: link to the store's banners in the gallery (only when there is a set) */
.work-hero__banners { margin: 24px 0 0; }

/* ---------- D-054: the round cursor (carousel.js) over sliders and the next project ---------- */
.work-cursor {
	position: fixed; top: 0; left: 0; z-index: 100; display: grid; place-items: center; pointer-events: none;
	width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; background: var(--c-black); color: var(--c-white);
	opacity: 0; transition: opacity .25s, width .35s cubic-bezier(.2, .6, .3, 1), height .35s cubic-bezier(.2, .6, .3, 1), margin .35s cubic-bezier(.2, .6, .3, 1);
}
.work-cursor.is-on { opacity: 1; }
.work-cursor svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.work-cursor__next { display: none; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.work-cursor__next svg { width: 18px; height: 18px; }
.work-cursor[data-mode="next"] { width: 150px; height: 150px; margin: -75px 0 0 -75px; background: var(--c-white); color: var(--c-black); }
.work-cursor[data-mode="next"] .work-cursor__drag { display: none; }
.work-cursor[data-mode="next"] .work-cursor__next { display: flex; }
[data-cursor].has-cursor, [data-cursor].has-cursor a { cursor: none; }
.carousel.is-dragging { user-select: none; -webkit-user-select: none; }
.work-next { cursor: pointer; }
.mouse-dot.is-off { opacity: 0 !important; }

/* ---------- D-069: the story's details on phones, and less text over «المشروع التالي» ----------
 * Desktop stays as it was (only the labels go a little quieter and the services read «، »). Phones:
 * the story reads from the right, «نبذة» is a small label, and the details are one card: services as
 * chips, platform and date side by side, and the store's link as a full-width button. */
.work-meta dt { color: var(--c-muted); }
.work-meta__tag + .work-meta__tag::before { content: "، "; }
.work-next__short { display: none; }
@media (max-width: 767px) {
	.work-story { gap: 18px; }
	.work-story__intro { text-align: start; }
	.work-story__title { margin: 0 0 14px; font-size: 26px; line-height: 1.35em; }
	.work-story__subtitle { margin: 0 0 8px; font-size: 13px; font-weight: 700; line-height: 1.4em; color: var(--c-muted); }
	.work-story__intro p { font-size: 16px; line-height: 1.85em; }
	.work-meta {
		display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 6px 0 0; padding: 4px 18px 18px;
		border: 1px solid rgb(0 0 0 / .07); border-radius: 24px; background: rgb(255 255 255 / .62);
	}
	.work-meta__item, .work-meta__item:nth-child(n) { width: auto; margin: 0; padding: 14px 0; gap: 6px; border-bottom: 1px solid rgb(0 0 0 / .08); }
	.work-meta__item:has(.work-meta__tag), .work-meta__item:has(.work-meta__link) { grid-column: 1 / -1; }
	.work-meta__item:has(.work-meta__link) { padding-bottom: 0; border-bottom: 0; }
	.work-meta dt { font-size: 12px; font-weight: 500; }
	.work-meta dd { font-size: 15px; line-height: 1.5em; }
	.work-meta__tag + .work-meta__tag::before { content: none; }
	.work-meta dd:has(.work-meta__tag) { display: flex; flex-wrap: wrap; gap: 6px; }
	.work-meta__tag { padding: 5px 12px; border: 1px solid rgb(0 0 0 / .14); border-radius: 100px; font-size: 13px; }
	.work-meta dd .work-meta__link { display: block; padding: 12px 18px; border-radius: 100px; background: var(--c-black); color: var(--c-white); font-size: 15px; text-shadow: none; }
	.work-meta__link-in { justify-content: space-between; }
	/* «المشروع التالي»: the store's name only (the full title stays in the page), no paragraph */
	.work-next__full, .work-next__excerpt { display: none; }
	.work-next__short { display: inline; }
	.work-next__link { font-size: 26px; text-shadow: 0 1px 14px rgb(0 0 0 / .45); }
	.work-next__icon { font-size: 24px; }
}

/* T083: YouTube video of the store (facade until play). */
.work-video { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 auto 15vh; padding: 0 20vw; }
.work-video__play, .work-video__frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; overflow: hidden; background: #111; padding: 0; cursor: pointer; }
.work-video__play img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-video__icon { position: absolute; inset: 50% auto auto 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; background: rgba(0,0,0,.72); transition: transform .2s ease; }
.work-video__icon::after { content: ""; position: absolute; top: 50%; left: 50%; margin: -12px 0 0 -7px; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; }
.work-video__play:hover .work-video__icon, .work-video__play:focus-visible .work-video__icon { transform: scale(1.08); }
.work-video__play:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.work-video__title { margin: 0; font-size: var(--t-small, 14px); opacity: .75; text-align: center; }
@media (max-width: 767px) { .work-video { padding: 0 16px; margin-bottom: 10vh; } }
@media (prefers-reduced-motion: reduce) { .work-video__icon { transition: none; } }

/* plan-ranking-2026-12: «الخدمة: …» under the work's date */
.work-hero__service { margin: 4px 0 0; font-size: 14px; line-height: 1.6em; color: var(--c-muted); }
.work-hero__service a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
