/* ESSAM portfolio v2 — work index, case studies, 3D lab.  Generated pages link this file. */

:root {
  --paper: #f3ece2;
  --paper-2: #ebe2d5;
  --ink: #17110d;
  --ink-2: #4a3d33;
  --muted: #8a7a6b;
  --line: rgba(23, 17, 13, .12);
  --red: #b82810;
  --dark: #120d0a;
  --cream: #fae4bb;
  --radius: 4px;
  --gutter: clamp(20px, 4vw, 64px);
  --max: 1520px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --f-display: 'Alexandria', 'Space Grotesk', system-ui, sans-serif;
  --f-latin: 'Space Grotesk', 'Alexandria', system-ui, sans-serif;
  --f-body: 'Noto Sans Arabic', 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.75 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { font-family: var(--f-latin); line-height: 1.6; }
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.latin { font-family: var(--f-latin); letter-spacing: .02em; }
.eyebrow { font: 500 12px/1 var(--f-latin); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- header ---------- */
.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  color: var(--ink);
  transition: background .4s, color .4s, padding .4s;
}
.site-head.on-dark { color: #f6efe5; }
.site-head.scrolled { background: rgba(243, 236, 226, .86); backdrop-filter: blur(14px); color: var(--ink); padding-block: 12px; border-bottom: 1px solid var(--line); }
.site-head .brand { display: flex; align-items: center; gap: 12px; font: 700 15px/1 var(--f-latin); letter-spacing: .28em; }
.site-head .brand img { width: 26px; height: 44px; object-fit: contain; filter: brightness(0) saturate(100%); transition: filter .4s; }
.site-head.on-dark:not(.scrolled) .brand img { filter: none; }
.site-head nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px); font: 500 14px/1 var(--f-display); }
.site-head nav a { position: relative; padding: 6px 0; opacity: .78; transition: opacity .3s; }
.site-head nav a:hover, .site-head nav a[aria-current] { opacity: 1; }
.site-head nav a[aria-current]::after { content: ""; position: absolute; inset: auto 0 -2px 0; height: 2px; background: var(--red); }
.lang-btn { font: 600 12px/1 var(--f-latin); letter-spacing: .12em; border: 1px solid currentColor; border-radius: 99px; padding: 8px 14px; opacity: .85; }
.lang-btn:hover { opacity: 1; }
@media (max-width: 720px) {
  .site-head nav a.hide-sm { display: none; }
  .site-head .brand span { display: none; }
}

/* ---------- reveal ---------- */
.rv { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ---------- work index ---------- */
.work-hero { padding-block: clamp(140px, 18vw, 220px) clamp(56px, 8vw, 110px); }
.work-hero h1 {
  margin: 18px 0 0; font: 800 clamp(48px, 9.4vw, 148px)/.98 var(--f-display); letter-spacing: -.02em;
}
html[lang="en"] .work-hero h1 { letter-spacing: -.045em; }
.work-hero h1 em { font-style: normal; color: var(--red); }
.work-hero .intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; margin-top: clamp(28px, 4vw, 56px); }
.work-hero .intro p { max-width: 560px; margin: 0; font-size: clamp(16px, 1.3vw, 19px); color: var(--ink-2); }
.stats { display: flex; gap: clamp(22px, 4vw, 56px); }
.stats div { border-inline-start: 1px solid var(--line); padding-inline-start: 18px; }
.stats b { display: block; font: 600 clamp(30px, 3.4vw, 46px)/1 var(--f-latin); }
.stats span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .work-hero .intro { grid-template-columns: 1fr; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; border-top: 1px solid var(--ink); padding: 18px 0 0; margin-bottom: clamp(32px, 5vw, 64px); }
.section-head h2 { margin: 0; font: 700 clamp(22px, 2.2vw, 30px)/1.2 var(--f-display); }

/* featured cases */
.cases { display: grid; gap: clamp(72px, 10vw, 150px); padding-bottom: clamp(90px, 12vw, 170px); }
.case-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 clamp(16px, 2.4vw, 40px); align-items: end; }
.case-row .media { grid-column: 1 / span 8; position: relative; overflow: hidden; border-radius: var(--radius); background: var(--tint, #222); aspect-ratio: 16 / 10; }
.case-row:nth-child(even) .media { grid-column: 5 / span 8; grid-row: 1; }
.case-row .media img, .case-row .media video { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease), opacity .6s; }
.case-row .media .alt { position: absolute; inset: 0; opacity: 0; }
.case-row:hover .media img { transform: scale(1.035); }
.case-row:hover .media .alt { opacity: 1; }
.case-row .media .tag {
  position: absolute; inset-block-start: 18px; inset-inline-start: 18px; z-index: 2;
  font: 600 11px/1 var(--f-latin); letter-spacing: .16em; text-transform: uppercase;
  color: #fff; background: rgba(0, 0, 0, .38); backdrop-filter: blur(8px); padding: 9px 12px; border-radius: 99px;
}
.case-row .info { grid-column: 9 / span 4; padding-bottom: 6px; }
.case-row:nth-child(even) .info { grid-column: 1 / span 4; grid-row: 1; }
.case-row .num { font: 500 13px/1 var(--f-latin); color: var(--red); letter-spacing: .1em; }
.case-row h3 { margin: 14px 0 12px; font: 700 clamp(26px, 2.8vw, 44px)/1.12 var(--f-display); }
html[lang="en"] .case-row h3 { letter-spacing: -.02em; }
.case-row p { margin: 0 0 22px; color: var(--ink-2); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; line-height: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-2); }
.case-row .go { display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; font: 600 14px/1 var(--f-display); border-bottom: 1px solid currentColor; padding-bottom: 6px; }
.case-row .go i { font-style: normal; transition: transform .4s var(--ease); }
.case-row:hover .go i { transform: translate(-4px, -4px); }
html[lang="en"] .case-row:hover .go i { transform: translate(4px, -4px); }
@media (max-width: 900px) {
  .case-row .media, .case-row:nth-child(even) .media, .case-row .info, .case-row:nth-child(even) .info { grid-column: 1 / -1; grid-row: auto; }
  .case-row .info { padding-top: 22px; }
}

/* index grid */
.index { padding-bottom: clamp(90px, 12vw, 160px); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: clamp(30px, 4vw, 48px); }
.filters button { font-size: 13px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 99px; transition: background .3s, color .3s, border-color .3s; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters button sup { font: 500 10px var(--f-latin); opacity: .6; margin-inline-start: 4px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(34px, 4vw, 56px) clamp(16px, 2vw, 28px); }
.tile .ph { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); aspect-ratio: 4 / 3; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.tile:hover .ph img { transform: scale(1.05); }
.tile .ph .count { position: absolute; inset-block-end: 12px; inset-inline-end: 12px; font: 600 11px/1 var(--f-latin); background: var(--paper); padding: 7px 10px; border-radius: 99px; }
.tile h4 { margin: 14px 0 4px; font: 600 15px/1.45 var(--f-display); }
.tile small { color: var(--muted); font-size: 12px; }
.tile.big { grid-column: span 2; }
.tile.big .ph { aspect-ratio: 8 / 3; }
.tile[hidden] { display: none; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile.big { grid-column: 1 / -1; } }

/* lab band */
.lab-band { background: var(--dark); color: #f6efe5; overflow: hidden; }
.lab-band .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding-block: clamp(80px, 10vw, 140px); }
.lab-band h2 { margin: 16px 0; font: 800 clamp(40px, 6vw, 92px)/1 var(--f-display); }
.lab-band p { color: #c9bba8; max-width: 460px; }
.lab-band .eyebrow { color: #e2c592; }
.lab-band canvas { width: 100%; aspect-ratio: 1; }
.btn { display: inline-flex; align-items: center; gap: 12px; margin-top: 18px; padding: 15px 24px; border-radius: 99px; background: var(--red); color: #fff; font: 600 14px/1 var(--f-display); transition: transform .3s var(--ease), background .3s; }
.btn:hover { transform: translateY(-2px); background: #86202e; }
@media (max-width: 800px) { .lab-band .wrap { grid-template-columns: 1fr; } }

/* ---------- case study ---------- */
.cs-hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; color: #f7f1e8; background: var(--tint, #111); overflow: hidden; }
.cs-hero .bg { position: absolute; inset: 0; }
.cs-hero .bg img, .cs-hero .bg video { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); animation: heroIn 2.4s var(--ease) forwards; }
@keyframes heroIn { from { transform: scale(1.12); opacity: .2; } to { transform: scale(1.02); opacity: 1; } }
.cs-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.1) 55%, rgba(0,0,0,.82) 100%); }
.cs-hero .wrap { position: relative; z-index: 2; padding-bottom: clamp(36px, 6vw, 80px); }
.cs-hero .eyebrow { color: rgba(247, 241, 232, .78); }
.cs-hero h1 { margin: 16px 0 0; max-width: 15ch; font: 800 clamp(44px, 8vw, 132px)/1 var(--f-display); }
html[lang="en"] .cs-hero h1 { letter-spacing: -.04em; }
.scroll-cue { position: absolute; inset-block-end: 28px; inset-inline-end: var(--gutter); z-index: 3; font: 500 11px/1 var(--f-latin); letter-spacing: .2em; color: rgba(255,255,255,.7); writing-mode: vertical-rl; }

.cs-intro { padding-block: clamp(70px, 9vw, 130px) clamp(40px, 6vw, 80px); }
.cs-intro .grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px clamp(16px, 2.4vw, 40px); }
.cs-intro .lead { grid-column: 1 / span 7; margin: 0; font: 500 clamp(22px, 2.4vw, 36px)/1.45 var(--f-display); }
html[lang="en"] .cs-intro .lead { letter-spacing: -.01em; line-height: 1.32; }
.facts { grid-column: 9 / span 4; display: grid; gap: 22px; margin: 0; }
.facts div { border-top: 1px solid var(--line); padding-top: 12px; }
.facts dt { font: 500 11px/1 var(--f-latin); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.facts dd { margin: 0; font-size: 15px; }
@media (max-width: 900px) { .cs-intro .lead, .facts { grid-column: 1 / -1; } .facts { grid-template-columns: 1fr 1fr; } }

.chapter { padding-block: clamp(40px, 6vw, 90px); }
.chapter-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px clamp(16px, 2.4vw, 40px); margin-bottom: clamp(28px, 4vw, 52px); align-items: baseline; }
.chapter-head .n { grid-column: 1 / span 1; font: 500 13px/1 var(--f-latin); color: var(--accent-ink, var(--red)); }
.chapter-head h2 { grid-column: 2 / span 5; margin: 0; font: 700 clamp(26px, 3vw, 46px)/1.1 var(--f-display); }
html[lang="en"] .chapter-head h2 { letter-spacing: -.025em; }
.chapter-head p { grid-column: 8 / span 5; margin: 0; color: var(--ink-2); font-size: 16px; }
@media (max-width: 900px) { .chapter-head .n, .chapter-head h2, .chapter-head p { grid-column: 1 / -1; } }

.blk { margin-bottom: clamp(14px, 1.8vw, 26px); }
.blk figure { margin: 0; }
.shot { position: relative; display: block; width: 100%; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); cursor: zoom-in; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.shot:hover img { transform: scale(1.02); }
.shot.contain { background: #fff; }
.shot.contain img { object-fit: contain; }
.blk.full { width: 100vw; margin-inline-start: calc(50% - 50vw); }
.blk.full .shot { border-radius: 0; max-height: 92vh; }
.row { display: grid; gap: clamp(14px, 1.8vw, 26px); align-items: stretch; }
.row.pair { grid-template-columns: 1fr 1fr; }
.row.trio { grid-template-columns: repeat(3, 1fr); }
.row.quad { grid-template-columns: repeat(4, 1fr); }
.row.pair .shot, .row.trio .shot, .row.quad .shot { height: 100%; }
.row.quad { align-items: start; }
.row.quad .shot { height: auto; }
.row.quad .shot img { height: auto; }
.row.mosaic { grid-template-columns: 1.6fr 1fr; grid-template-rows: 1fr 1fr; }
.row.mosaic > :first-child { grid-row: 1 / span 2; }
.row.mosaic .shot { height: 100%; }
.masonry { columns: 3; column-gap: clamp(14px, 1.8vw, 26px); }
.masonry .shot { break-inside: avoid; margin-bottom: clamp(14px, 1.8vw, 26px); height: auto; }
.masonry .shot img { height: auto; }
@media (max-width: 900px) { .row.quad { grid-template-columns: 1fr 1fr; } .masonry { columns: 2; } }
@media (max-width: 620px) { .row.pair, .row.trio, .row.mosaic { grid-template-columns: 1fr; grid-template-rows: none; } .row.mosaic > :first-child { grid-row: auto; } }

.palette { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-radius: var(--radius); overflow: hidden; height: clamp(90px, 10vw, 150px); }
.palette span { display: flex; align-items: flex-end; padding: 12px; font: 500 12px/1 var(--f-latin); letter-spacing: .06em; }

.statement { padding: clamp(50px, 8vw, 120px) 0; text-align: center; }
.statement p { margin: 0 auto; max-width: 22ch; font: 700 clamp(30px, 4.6vw, 72px)/1.2 var(--f-display); }
html[lang="en"] .statement p { letter-spacing: -.03em; line-height: 1.08; }

/* before/after */
.ba { position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 3 / 4; max-height: 88vh; margin-inline: auto; touch-action: pan-y; user-select: none; background: #111; }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba .after { clip-path: inset(0 0 0 var(--pos, 50%)); }
[dir="rtl"] .ba .after { clip-path: inset(0 var(--pos, 50%) 0 0); }
.ba .handle { position: absolute; top: 0; bottom: 0; inset-inline-start: var(--pos, 50%); width: 2px; background: #fff; transform: translateX(-50%); }
[dir="rtl"] .ba .handle { transform: translateX(50%); }
.ba .handle::after { content: "↔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #111; font: 600 18px/1 var(--f-latin); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.ba .lbl { position: absolute; inset-block-start: 16px; font: 600 11px/1 var(--f-latin); letter-spacing: .14em; text-transform: uppercase; color: #fff; background: rgba(0,0,0,.45); padding: 8px 12px; border-radius: 99px; }
.ba .lbl.b { inset-inline-start: 16px; } .ba .lbl.a { inset-inline-end: 16px; }
.ba input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba-wrap { max-width: 760px; margin: 0 auto; }

/* video */
.vid { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.vid video { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.vid.portrait video { aspect-ratio: auto; max-height: 86vh; margin: 0 auto; }

/* next */
.next { display: block; position: relative; overflow: hidden; color: #f6efe5; background: var(--dark); margin-top: clamp(60px, 8vw, 120px); }
.next img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .38; transition: opacity .8s, transform 1.6s var(--ease); }
.next:hover img { opacity: .55; transform: scale(1.04); }
.next .wrap { position: relative; padding-block: clamp(80px, 12vw, 180px); }
.next .eyebrow { color: rgba(246,239,229,.7); }
.next h2 { margin: 14px 0 0; font: 800 clamp(38px, 6.6vw, 104px)/1 var(--f-display); }

.site-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 30px var(--gutter); font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.site-foot a:hover { color: var(--ink); }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(10, 7, 5, .94); padding: 4vh 4vw; cursor: zoom-out; }
.lb.open { display: grid; }
.lb img { max-width: 100%; max-height: 92vh; object-fit: contain; border-radius: 2px; }
.lb .x { position: absolute; top: 18px; inset-inline-end: 22px; color: #fff; font: 500 13px/1 var(--f-latin); letter-spacing: .14em; }
.lb .nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 30px; padding: 20px; opacity: .7; }
.lb .nav:hover { opacity: 1; }
.lb .prev { inset-inline-start: 6px; } .lb .nxt { inset-inline-end: 6px; }

/* simple project (non-featured) */
.sp-hero { padding-block: clamp(130px, 15vw, 190px) clamp(36px, 5vw, 60px); }
.sp-hero h1 { margin: 14px 0 0; font: 800 clamp(38px, 6vw, 92px)/1.04 var(--f-display); }
html[lang="en"] .sp-hero h1 { letter-spacing: -.035em; }
.crumb { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.crumb a:hover { color: var(--ink); }

/* business cards collection */
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(30px, 4vw, 54px) clamp(16px, 2vw, 28px); padding-bottom: 120px; }
.card-item .pair-flip { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); cursor: zoom-in; }
.card-item .pair-flip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .6s var(--ease), transform 1.2s var(--ease); }
.card-item .pair-flip img + img { opacity: 0; }
.card-item:hover .pair-flip img + img { opacity: 1; }
.card-item h4 { margin: 14px 0 2px; font: 600 15px/1.4 var(--f-display); }
.card-item small { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .cards-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .cards-grid { grid-template-columns: 1fr; } }

/* ---------- 3D lab ---------- */
.lab-page { background: var(--dark); color: #f3ebe0; }
.lab-page .site-foot { border-color: rgba(255,255,255,.1); color: #8f8274; }
.lab-intro { padding-block: clamp(140px, 16vw, 210px) clamp(40px, 6vw, 80px); }
.lab-intro h1 { margin: 16px 0 18px; font: 800 clamp(52px, 10vw, 160px)/.95 var(--f-display); }
.lab-intro p { max-width: 560px; color: #bfb09d; font-size: 17px; }
.lab-intro .eyebrow { color: #e2c592; }
.piece { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 30px clamp(16px, 2.4vw, 40px); align-items: center; padding: clamp(40px, 6vw, 80px) 0; border-top: 1px solid rgba(255,255,255,.08); }
.piece .stage { grid-column: 1 / span 8; position: relative; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #2a2019 0%, #0c0907 70%); }
.piece:nth-child(even) .stage { grid-column: 5 / span 8; grid-row: 1; }
.piece .stage canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.piece .stage canvas:active { cursor: grabbing; }
.piece .stage .hint { position: absolute; inset-block-end: 14px; inset-inline-start: 16px; font: 500 11px/1 var(--f-latin); letter-spacing: .14em; color: rgba(255,255,255,.55); pointer-events: none; }
.piece .stage .loading { position: absolute; inset: 0; display: grid; place-items: center; font: 500 12px/1 var(--f-latin); letter-spacing: .2em; color: rgba(255,255,255,.5); }
.piece .txt { grid-column: 9 / span 4; }
.piece:nth-child(even) .txt { grid-column: 1 / span 4; grid-row: 1; }
.piece .num { font: 500 13px/1 var(--f-latin); color: #e2c592; letter-spacing: .1em; }
.piece h2 { margin: 14px 0 12px; font: 700 clamp(26px, 2.8vw, 42px)/1.12 var(--f-display); }
.piece p { color: #bfb09d; font-size: 15px; margin: 0 0 18px; }
.piece .chip { border-color: rgba(255,255,255,.16); color: #d8cbb9; }
@media (max-width: 900px) { .piece .stage, .piece:nth-child(even) .stage, .piece .txt, .piece:nth-child(even) .txt { grid-column: 1 / -1; grid-row: auto; } }

/* ---------- refinements ---------- */
.lab-page .site-head.scrolled { background: rgba(18, 13, 10, .86); color: #f3ebe0; border-color: rgba(255,255,255,.08); }
.lab-page .site-head .brand img, .site-head.on-dark:not(.scrolled) .brand img { filter: none; }
.lab-page .site-head.scrolled .brand img { filter: none; }
.chapter .shot { background: var(--tint, var(--paper-2)); }
.case-row .media img { object-position: var(--pos, 50% 50%); }

/* character sheet rows, small marks, silent clip grid */
.row.sheet { grid-template-columns: 1fr 2.8fr; }
.row.sheet .shot { background: #fff; }
.blk.small { display: grid; place-items: center; padding: clamp(30px, 5vw, 70px) 0; background: var(--tint, #111); border-radius: var(--radius); }
.blk.small .shot { width: min(var(--w), 70%); background: none; cursor: zoom-in; }
.clips { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(14px, 1.8vw, 26px); }
.clips figure { margin: 0; grid-column: span 2; }
.clips figure:nth-child(4) { grid-column: 2 / span 2; }
.clips video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: #000; }
.clips figcaption { margin-top: 8px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
@media (max-width: 760px) { .row.sheet { grid-template-columns: 1fr 2fr; } .clips { grid-template-columns: 1fr 1fr; } .clips figure, .clips figure:nth-child(4) { grid-column: auto; } }

/* full-bleed blocks use 100vw, which includes the scrollbar: never let that scroll sideways */
html, body { overflow-x: clip; }

/* colour codes are Latin: keep "#" in front even on Arabic pages */
.palette span { direction: ltr; justify-content: flex-start; }

/* ---------- reel process: steps, prompt, frames, reels grid ---------- */
.step { display: flex; align-items: baseline; gap: 12px; margin: clamp(26px, 3vw, 40px) 0 14px; padding-top: 14px; border-top: 1px solid var(--line); font: 600 14px/1.2 var(--f-display); }
.step .latin { font: 500 12px/1 var(--f-latin); color: var(--red); letter-spacing: .12em; }
.prompt-box { margin: 0 0 clamp(14px, 1.8vw, 26px); background: #15110e; color: #e9dfcf; border-radius: var(--radius); padding: 18px 20px 16px; direction: ltr; text-align: left; }
.prompt-box figcaption { font: 600 11px/1 var(--f-latin); letter-spacing: .2em; color: #e2c592; margin-bottom: 10px; }
.prompt-box pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.65 ui-monospace, "Cascadia Code", Consolas, monospace; }
.prompt-box details { margin-top: 12px; border-top: 1px solid #ffffff1a; padding-top: 10px; }
.prompt-box summary { cursor: pointer; font: 600 13px/1.4 var(--f-display); color: #e2c592; direction: rtl; text-align: right; }
html[lang="en"] .prompt-box summary { direction: ltr; text-align: left; }
.prompt-box details pre { margin-top: 10px; max-height: 360px; overflow: auto; }
.frames { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.frames figure { margin: 0; flex: 0 0 auto; scroll-snap-align: start; }
.frames .shot { height: clamp(260px, 34vw, 420px); width: auto; background: #000; }
.frames .shot img { height: 100%; width: auto; object-fit: contain; }
.frames figcaption { margin-top: 6px; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.reels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: clamp(14px, 1.8vw, 26px); }
.reels figure { margin: 0; }
.reels video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; border-radius: var(--radius); }
.reels figcaption { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.clips.vertical video { aspect-ratio: 9 / 16; }
.clips.vertical figure, .clips.vertical figure:nth-child(4) { grid-column: span 1; }
@media (max-width: 760px) { .clips.vertical { grid-template-columns: repeat(3, 1fr); } }

/* vertical reels: frame hugs the video instead of a wide black box */
.vid.portrait { max-width: min(460px, 100%); margin-inline: auto; background: none; }
.vid.portrait video { width: 100%; max-height: 86vh; aspect-ratio: 9 / 16; object-fit: contain; background: #000; border-radius: var(--radius); }

/* ---------- unified reel layout ---------- */
.reel { display: grid; grid-template-columns: minmax(0, 1fr) clamp(260px, 26vw, 360px); gap: clamp(24px, 3vw, 48px); align-items: start; }
.reel-steps > .step:first-child { margin-top: 0; }
.reel-final { position: sticky; top: 92px; }
.reel-final .step { margin-top: 0; }
.reel-final video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; border-radius: var(--radius); box-shadow: 0 24px 60px -30px rgba(0,0,0,.6); }
.reel-sheets { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.reel-sheets .shot { flex: 0 0 auto; height: clamp(180px, 20vw, 250px); width: auto; background: #fff; }
.reel-sheets .shot img { height: 100%; width: auto; object-fit: contain; }
.reel-frames .shot { height: clamp(220px, 24vw, 300px); }
.reel-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.reel-shots figure { margin: 0; }
.reel-shots video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; border-radius: var(--radius); }
.reel-shots figcaption { margin-top: 6px; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.reel .prompt-box { margin-bottom: 0; }
.reel-group { padding-block: clamp(50px, 7vw, 100px) 0; }
.reel-group h2 { margin: 0; font: 800 clamp(30px, 4vw, 60px)/1.05 var(--f-display); }
.reel-group p { max-width: 640px; color: var(--ink-2); }
@media (max-width: 900px) {
  .reel { grid-template-columns: 1fr; }
  .reel-final { position: static; max-width: 420px; margin-inline: auto; width: 100%; }
}

/* =====================================================================
   Creative layer — capsule header, curtain transitions, cursor, grain,
   headline reveal, marquee, clip reveals, closing CTA.
   ===================================================================== */
::selection { background: var(--red); color: var(--cream); }
html { scrollbar-width: thin; scrollbar-color: var(--red) transparent; }

/* paper grain */
body::before {
  content: ""; position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 20%{transform:translate(-3%,2%)} 40%{transform:translate(2%,-3%)} 60%{transform:translate(-2%,-1%)} 80%{transform:translate(3%,3%)} 100%{transform:translate(0,0)} }

/* capsule header */
.site-head { padding: 16px var(--gutter); transition: transform .5s var(--ease), padding .4s, color .4s; }
.site-head nav {
  padding: 7px 7px 7px 20px; border-radius: 99px; gap: 6px;
  background: rgba(243, 236, 226, .55); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(23, 17, 13, .08); box-shadow: 0 10px 30px -18px rgba(23, 17, 13, .35);
}
[dir="rtl"] .site-head nav { padding: 7px 20px 7px 7px; }
.site-head nav a { padding: 9px 14px; border-radius: 99px; opacity: .72; transition: opacity .3s, background .3s, color .3s; }
.site-head nav a:hover { opacity: 1; background: rgba(23, 17, 13, .06); }
.site-head nav a[aria-current] { opacity: 1; background: var(--ink); color: var(--paper); }
.site-head nav a[aria-current]::after { display: none; }
.site-head .lang-btn { margin-inline-start: 6px; background: var(--red); color: #fff; border-color: var(--red); padding: 9px 14px; opacity: 1; }
.site-head.scrolled { background: none; border-bottom: 0; backdrop-filter: none; padding-block: 12px; }
.site-head.hide { transform: translateY(-120%); }
.site-head .brand img { width: 26px; height: auto; transition: transform .6s var(--ease), filter .4s; }
.site-head .brand:hover img { transform: rotate(-8deg) scale(1.08); }
.site-head.on-dark:not(.scrolled) nav { background: rgba(18, 13, 10, .35); border-color: rgba(255,255,255,.12); color: #f6efe5; }
.site-head.on-dark:not(.scrolled) nav a[aria-current] { background: #f6efe5; color: var(--ink); }
.lab-page .site-head nav { background: rgba(18, 13, 10, .55); border-color: rgba(255,255,255,.1); color: #f3ebe0; }
.lab-page .site-head nav a[aria-current] { background: #f3ebe0; color: var(--dark); }
.lab-page .site-head.scrolled { background: none; border: 0; }
.site-head .progress { position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--red); transform-origin: left; transform: scaleX(var(--p, 0)); }
[dir="rtl"] .site-head .progress { transform-origin: right; }
@media (max-width: 720px) { .site-head nav { padding: 5px; } [dir="rtl"] .site-head nav { padding: 5px; } .site-head nav a { padding: 8px 11px; font-size: 13px; } }

/* curtain page transition */
.curtain { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--red); pointer-events: none;
  transform: translateY(-100%); transition: transform .7s cubic-bezier(.76, 0, .24, 1); }
.curtain img { width: 54px; opacity: 0; transform: translateY(14px) scale(.9); transition: opacity .4s .2s, transform .6s .2s var(--ease); }
.curtain.cover { transform: none; pointer-events: all; }
.curtain.cover img { opacity: 1; transform: none; }
.curtain.lift { transform: none; animation: lift .9s cubic-bezier(.76, 0, .24, 1) .15s forwards; }
.curtain.lift img { opacity: 1; transform: none; animation: markOut .5s ease forwards; }
@keyframes lift { to { transform: translateY(-100%); } }
@keyframes markOut { to { opacity: 0; transform: translateY(-20px) scale(.9); } }

/* cursor follower (fine pointers only) */
.cur { position: fixed; top: 0; left: 0; z-index: 150; pointer-events: none; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 1px solid rgba(107, 22, 33, .6); display: grid; place-items: center;
  transition: width .35s var(--ease), height .35s var(--ease), margin .35s var(--ease), background .35s, border-color .35s, opacity .3s; }
.cur span { font: 600 11px/1 var(--f-display); letter-spacing: .06em; color: #fff; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.cur.link { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(107, 22, 33, .1); }
.cur.view { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--red); border-color: var(--red); }
.cur.view span { opacity: 1; }
.cur.gone { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cur { display: none; } }

/* headline line reveal */
.split > span, .split > em { display: inline-block; clip-path: inset(0 0 100% 0); transform: translateY(40%); animation: lineUp 1.1s var(--ease) forwards; }
.split > em { animation-delay: .18s; }
@keyframes lineUp { to { clip-path: inset(-10% 0 -20% 0); transform: none; } }
.work-hero h1 em { position: relative; }
html[lang="ar"] .work-hero h1 em::after { display: none; }
.work-hero h1 em::after { content: ""; position: absolute; inset-inline: 0; bottom: -.02em; height: .06em; background: currentColor; transform: scaleX(0); transform-origin: right; animation: underline 1s var(--ease) 1.1s forwards; }
html[lang="en"] .work-hero h1 em::after { transform-origin: left; }
@keyframes underline { to { transform: scaleX(1); } }
.work-hero .eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-inline-end: 10px; animation: pulse 2s infinite; vertical-align: middle; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(107,22,33,.45); } 50% { box-shadow: 0 0 0 8px rgba(107,22,33,0); } }

/* marquee */
.marquee { overflow: hidden; background: var(--ink); color: var(--paper); padding: clamp(16px, 2vw, 26px) 0; margin-bottom: clamp(60px, 8vw, 110px); transform: rotate(-1.2deg) scale(1.02); direction: ltr; }
.marquee .track { display: flex; width: max-content; gap: 34px; align-items: center; animation: marq 38s linear infinite; }
.marquee span { font: 700 clamp(26px, 3.6vw, 54px)/1 var(--f-latin); letter-spacing: -.02em; white-space: nowrap; }
.marquee span:nth-child(4n+1) { color: transparent; -webkit-text-stroke: 1px var(--paper); }
.marquee i { font-style: normal; color: var(--red); font-size: clamp(18px, 2vw, 28px); }
.marquee:hover .track { animation-play-state: paused; }
@keyframes marq { to { transform: translateX(-50%); } }

/* media reveal: images wipe in */
.case-row.rv .media { clip-path: inset(12% 6% 12% 6% round 14px); transition: clip-path 1.4s var(--ease); }
.case-row.rv.in .media { clip-path: inset(0 0 0 0 round var(--radius)); }
.case-row .media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.35), transparent 40%); opacity: 0; transition: opacity .6s; }
.case-row:hover .media::after { opacity: 1; }
.case-row .num { display: inline-flex; align-items: center; gap: 10px; }
.case-row .num::after { content: ""; width: 34px; height: 1px; background: currentColor; transition: width .6s var(--ease); }
.case-row:hover .num::after { width: 70px; }
.tile .ph { transition: border-radius .6s var(--ease); }
.tile:hover .ph { border-radius: 22px; }
.tile h4 { transition: color .3s; }
.tile:hover h4 { color: var(--red); }
.filters button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: translateY(101%); transition: transform .5s var(--ease); }
.btn:hover::before { transform: none; }
.chapter-head .n { font-size: clamp(34px, 4vw, 64px); font-weight: 700; line-height: .9; }
.reel-final video { box-shadow: 0 40px 80px -40px rgba(107, 22, 33, .55); }

/* closing CTA */
.cta { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); padding-block: clamp(90px, 13vw, 190px); }
.lab-page .cta { background: #050403; }
.cta .wrap { position: relative; z-index: 1; }
.cta .eyebrow { color: #e2c592; }
.cta-big { display: inline-flex; align-items: center; gap: .25em; margin: 18px 0 34px; font: 800 clamp(48px, 9.5vw, 170px)/1.05 var(--f-display); letter-spacing: -.02em; transition: color .4s; }
html[lang="en"] .cta-big { letter-spacing: -.05em; }
.cta-big i { font-style: normal; display: inline-block; color: var(--red); transition: transform .6s var(--ease); }
[dir="rtl"] .cta-big i { transform: scaleX(-1); }
.cta-big:hover { color: var(--cream); }
.cta-big:hover i { transform: translate(8px, -8px) rotate(8deg); }
[dir="rtl"] .cta-big:hover i { transform: scaleX(-1) translate(8px, -8px) rotate(8deg); }
.cta-links { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-links a { padding: 13px 22px; border: 1px solid rgba(255,255,255,.2); border-radius: 99px; font-size: 14px; transition: background .3s, color .3s, border-color .3s; }
.cta-links a:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cta-mark { position: absolute; inset-inline-end: 4%; bottom: -10%; height: 120%; width: auto; opacity: .08; pointer-events: none; transform: rotate(-8deg); }
.site-foot { background: var(--ink); color: #8f8274; border-top: 1px solid rgba(255,255,255,.08); }
.lab-page .site-foot { background: #050403; }
.site-foot a:hover { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  body::before, .marquee .track, .split > span, .split > em { animation: none; }
  .split > span, .split > em { clip-path: none; transform: none; }
  .case-row.rv .media { clip-path: none; }
  .curtain { display: none; }
}

/* a single portrait video should not stretch across the page */
.reels:has(> figure:only-child) { max-width: 420px; margin-inline: auto; }
.reels:has(> figure:nth-child(2):last-child) { max-width: 860px; margin-inline: auto; }

.vid.square { max-width: min(620px, 100%); margin-inline: auto; background: none; }
.vid.square video { aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
