/* =========================================================================
   Mina Onsy Studio — Home page (editorial / award-style layer)
   Loaded only by index.html, after style.css. Uses the editorial tokens
   from style.css (--mono-*, --accent, --editorial-*), so light/dark theme
   and Arabic (RTL) keep working.
   ========================================================================= */

:root {
  --hm-mono: "JetBrains Mono", ui-monospace, monospace;
  --hm-gutter: clamp(20px, 6vw, 96px);
  --hm-ease: cubic-bezier(.16, 1, .3, 1);
  --hm-shadow: 0 30px 70px rgba(28, 22, 14, .14);
}
html[data-theme="dark"] { --hm-shadow: 0 30px 70px rgba(0, 0, 0, .45); }

.hm-main { position: relative; background: var(--mono-dark); color: var(--mono-text); overflow-x: clip; }

/* Film grain — static, one layer, very low opacity (no repaint cost). */
.hm-main::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .06;
  mix-blend-mode: multiply;
  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='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .hm-main::before { mix-blend-mode: screen; opacity: .04; }

/* Scroll progress */
.hm-progress { position: fixed; inset: 0 0 auto; z-index: 70; height: 2px; pointer-events: none; }
.hm-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left center; }
html[dir="rtl"] .hm-progress span { transform-origin: right center; }

/* ---------- Shared editorial atoms ---------- */
.hm-tag { display: flex; align-items: center; gap: 14px; margin: 0 0 26px; color: var(--mono-muted); font: 500 11px/1.4 var(--editorial-sans); letter-spacing: .18em; text-transform: uppercase; }
.hm-tag-index { color: var(--accent); font-family: var(--hm-mono); letter-spacing: .04em; direction: ltr; unicode-bidi: isolate; }
.hm-tag-rule { flex: 0 0 clamp(36px, 6vw, 72px); height: 1px; background: currentColor; opacity: .5; transform-origin: left center; }
html[dir="rtl"] .hm-tag-rule { transform-origin: right center; }
.hm-tag-center { justify-content: center; }

.hm-section-head { display: grid; gap: 0; padding-inline: var(--hm-gutter); margin-bottom: clamp(40px, 6vw, 80px); }
.hm-section-head h2 { margin: 0; color: var(--mono-text); font: 500 clamp(44px, 6.4vw, 96px)/.92 var(--editorial-serif); letter-spacing: -.035em; text-wrap: balance; }
.hm-section-head h2 em, .hm-hero-title em, .hm-approach-title em, .hm-cta-title em { color: var(--accent); font-weight: 500; }

.hm-line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.hm-line > * { display: inline-block; }

/* Button with square arrow chip (from code2) */
.hm-btn { display: inline-flex; align-items: center; gap: 18px; min-height: 52px; padding: 6px 6px 6px 22px; background: var(--mono-text); color: var(--mono-dark); font: 600 12px/1 var(--editorial-sans); letter-spacing: .08em; text-transform: uppercase; transition: background-color .3s ease; }
html[dir="rtl"] .hm-btn { padding: 6px 22px 6px 6px; }
.hm-btn b { display: grid; place-items: center; width: 40px; height: 40px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 400; transition: transform .35s var(--hm-ease); }
html[dir="rtl"] .hm-btn b { transform: scaleX(-1); }
.hm-btn:hover { background: color-mix(in srgb, var(--mono-text) 86%, var(--accent)); }
.hm-btn:hover b { transform: translate(3px, -3px); }
html[dir="rtl"] .hm-btn:hover b { transform: scaleX(-1) translate(3px, -3px); }

/* Underline link — line wipes out and back in on hover */
.hm-link { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--mono-text); font: 600 12px/1.5 var(--editorial-sans); letter-spacing: .06em; text-transform: uppercase; }
.hm-link::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 1px; background: currentColor; transform-origin: right center; transition: transform .6s var(--hm-ease); }
html[dir="rtl"] .hm-link::after { transform-origin: left center; }
@media (hover: hover) {
  .hm-link:hover::after { animation: hm-underline .7s var(--hm-ease); }
}
@keyframes hm-underline { 0% { transform: scaleX(1); } 45% { transform: scaleX(0); } 46% { transform-origin: left center; } 100% { transform: scaleX(1); transform-origin: left center; } }
html[dir="rtl"] .hm-link:hover::after { animation-name: hm-underline-rtl; }
@keyframes hm-underline-rtl { 0% { transform: scaleX(1); } 45% { transform: scaleX(0); } 46% { transform-origin: right center; } 100% { transform: scaleX(1); transform-origin: right center; } }

.hm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 30px; }
.hm-actions-center { justify-content: center; }

/* ---------- 00 · Hero ---------- */
.hm-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  min-height: min(calc(100svh - 82px), 940px);
  padding: clamp(40px, 5vw, 72px) 0 clamp(40px, 5vw, 72px) var(--hm-gutter);
  overflow: clip;
}
html[dir="rtl"] .hm-hero { padding-inline: var(--hm-gutter) 0; }
.hm-hero-copy { position: relative; z-index: 3; max-width: 600px; }
.hm-hero-title { margin: 0; color: var(--mono-text); font: 500 clamp(60px, 7.6vw, 128px)/.9 var(--editorial-serif); letter-spacing: -.045em; }
.hm-hero-lead { max-width: 420px; margin: 28px 0 34px; color: var(--mono-muted); font: 400 clamp(15px, 1.25vw, 18px)/1.8 var(--editorial-sans); text-wrap: pretty; }
.hm-hero-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0; margin: clamp(40px, 5vw, 64px) 0 0; padding: 0; }
.hm-hero-facts div { padding: 14px clamp(14px, 2vw, 26px) 0; border-inline-start: 1px solid var(--mono-line); }
.hm-hero-facts div:first-child { padding-inline-start: 0; border-inline-start: 0; }
.hm-hero-facts dt { margin-bottom: 6px; color: var(--mono-muted); font: 500 10px/1.3 var(--hm-mono); letter-spacing: .12em; text-transform: uppercase; }
.hm-hero-facts dd { margin: 0; color: var(--mono-text); font: 500 clamp(15px, 1.3vw, 19px)/1.3 var(--editorial-serif); font-style: italic; }

.hm-hero-mosaic {
  position: relative;
  height: min(calc(100svh - 82px), 940px);
  margin-block: calc(-1 * clamp(40px, 5vw, 72px));
}
.hm-mosaic-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 14px);
  height: 100%;
  overflow: hidden;
  padding-inline-end: clamp(8px, 1vw, 14px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.hm-col { display: grid; align-content: start; gap: clamp(8px, 1vw, 14px); will-change: transform; }
.hm-col:nth-child(1) { margin-top: -18%; }
.hm-col:nth-child(2) { margin-top: 10%; }
.hm-col:nth-child(3) { margin-top: -38%; }
.hm-col figure { margin: 0; overflow: hidden; aspect-ratio: 2 / 3; background: var(--mono-panel); }
.hm-col img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 1.6s var(--hm-ease), filter .8s ease; }
@media (hover: hover) { .hm-col figure:hover img { transform: scale(1.0); } }

/* Rotating circular seal (Latin text only — Arabic letters must not be spaced on a path) */
.hm-seal { position: absolute; z-index: 4; inset-inline-start: calc(-1 * clamp(56px, 6vw, 80px)); bottom: 14%; display: grid; place-items: center; width: clamp(112px, 10vw, 150px); aspect-ratio: 1; border-radius: 50%; background: var(--mono-dark); color: var(--mono-text); box-shadow: 0 0 0 1px var(--mono-line); }
.hm-seal svg { direction: ltr; position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); animation: hm-spin 22s linear infinite; overflow: visible; }
.hm-seal text { fill: currentColor; font: 500 8.4px var(--hm-mono); letter-spacing: .08em; }
.hm-seal > span { color: var(--accent); font-size: 22px; transition: transform .4s var(--hm-ease); }
.hm-seal:hover > span { transform: translateY(4px); }
@keyframes hm-spin { to { transform: rotate(360deg); } }
html[dir="rtl"] .hm-vertical { display: none; } /* vertical Arabic reads poorly */

/* Physical left/right on purpose: logical insets follow the vertical writing-mode. */
.hm-vertical { position: absolute; z-index: 4; right: clamp(22px, 2vw, 34px); top: 50%; color: #fff; font: 500 10px/1 var(--hm-mono); letter-spacing: .3em; writing-mode: vertical-rl; transform: translateY(-50%); mix-blend-mode: difference; }

/* ---------- Marquee ---------- */
.hm-marquee { position: relative; overflow: hidden; padding-block: clamp(22px, 3vw, 38px); border-block: 1px solid var(--mono-line); direction: ltr; background: var(--mono-dark); }
.hm-marquee-track { display: flex; width: max-content; will-change: transform; }
.hm-marquee-group { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 36px); padding-inline-end: clamp(18px, 2.4vw, 36px); animation: hm-marquee 46s linear infinite; }
.hm-marquee span, .hm-marquee em { color: var(--mono-text); font: 500 clamp(34px, 4.6vw, 72px)/1 var(--editorial-serif); letter-spacing: -.02em; white-space: nowrap; }
.hm-marquee em { color: var(--accent); font-style: italic; }
.hm-marquee i { color: var(--mono-muted); font: 400 clamp(22px, 2.4vw, 36px)/1 var(--editorial-serif); font-style: normal; }
@keyframes hm-marquee { to { transform: translateX(-100%); } }

/* ---------- 01 · Approach ---------- */
.hm-approach { position: relative; display: grid; justify-items: center; padding: clamp(110px, 16vw, 230px) var(--hm-gutter); text-align: center; overflow: clip; }
.hm-approach .hm-tag { justify-content: center; }
.hm-approach-title { position: relative; z-index: 2; margin: 0; color: var(--mono-text); font: 500 clamp(52px, 8vw, 128px)/.9 var(--editorial-serif); letter-spacing: -.04em; text-wrap: balance; }
.hm-approach-title em { display: block; }
.hm-approach-text { position: relative; z-index: 2; max-width: 860px; margin: clamp(30px, 4vw, 48px) 0 clamp(26px, 3vw, 40px); color: var(--mono-text); font: 400 clamp(22px, 2.5vw, 36px)/1.35 var(--editorial-serif); text-wrap: balance; }
.hm-approach-text span { transition: opacity .2s linear; }
.hm-float { position: absolute; z-index: 1; margin: 0; overflow: hidden; width: clamp(130px, 14vw, 230px); aspect-ratio: 2 / 3; box-shadow: var(--hm-shadow); }
.hm-float img { width: 100%; height: 100%; object-fit: cover; }
.hm-float-a { top: 12%; inset-inline-start: 5%; transform: rotate(-4deg); }
.hm-float-b { bottom: 9%; inset-inline-end: 6%; transform: rotate(3deg); }

/* ---------- 02 · Stories — sticky stacked chapters ---------- */
.hm-stories { padding-block: clamp(90px, 11vw, 160px) clamp(60px, 8vw, 120px); background: var(--mono-panel); border-block: 1px solid var(--mono-line); }
.hm-stack { display: grid; gap: clamp(24px, 3vw, 40px); padding-inline: var(--hm-gutter); }
.hm-card {
  position: sticky;
  top: 100px; /* clears the fixed site header (82px) */
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: stretch;
  height: min(calc(100vh - 124px), 700px);
  padding: clamp(22px, 3vw, 44px);
  background: var(--mono-dark);
  border: 1px solid var(--mono-line);
  box-shadow: var(--hm-shadow);
  transform-origin: center top;
  will-change: transform;
}
.hm-card::after { content: ""; position: absolute; inset: 0; background: #0b0a08; opacity: var(--hm-dim, 0); pointer-events: none; }

/* Pre-animation state (set by an inline script in <head>; removed by home.js or a 2.5s safety timer). */
.hm-preload .hm-hero .hm-line > * { transform: translateY(110%); }
.hm-preload .hm-hero .hm-tag,
.hm-preload .hm-hero-lead,
.hm-preload .hm-hero .hm-actions,
.hm-preload .hm-hero-facts,
.hm-preload .hm-seal { opacity: 0; }
.hm-preload .hm-col figure { clip-path: inset(100% 0 0 0); }
.hm-card-copy { display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; min-width: 0; }
.hm-card-index { margin-bottom: auto; color: var(--accent); font: 500 12px/1 var(--hm-mono); letter-spacing: .08em; direction: ltr; unicode-bidi: isolate; text-align: start; }
.hm-card h3 { margin: 0; color: var(--mono-text); font: 500 clamp(40px, 4.6vw, 76px)/.95 var(--editorial-serif); letter-spacing: -.035em; }
.hm-card-meta { margin: 0; color: var(--mono-muted); font: 500 11px/1.4 var(--hm-mono); letter-spacing: .14em; text-transform: uppercase; }
.hm-card-text { max-width: 34ch; margin: 6px 0 10px; color: var(--mono-muted); font: 400 16px/1.7 var(--editorial-sans); }
.hm-card .hm-link { align-self: flex-start; }
.hm-card-photos { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: clamp(8px, 1vw, 14px); align-items: stretch; min-height: 0; }
.hm-card-photos figure { margin: 0; overflow: hidden; background: var(--mono-panel); }
.hm-card-photos figure:nth-child(2) { margin-block: clamp(-12px, -1vw, 0px); }
.hm-card-photos figure:nth-child(odd) { margin-block: 8% 0; }
.hm-card-photos figure:nth-child(3) { margin-block: 0 8%; }
.hm-card-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--hm-ease); }
@media (hover: hover) { .hm-card-photos figure:hover img { transform: scale(1.04); } }

/* ---------- 03 · Services — numbered hover list ---------- */
.hm-services { position: relative; padding-block: clamp(100px, 13vw, 190px) clamp(80px, 10vw, 150px); }
.hm-service-list { margin: 0 var(--hm-gutter); padding: 0; list-style: none; border-top: 1px solid var(--mono-line); }
.hm-service { border-bottom: 1px solid var(--mono-line); transition: opacity .4s ease; }
.hm-service a { position: relative; display: grid; grid-template-columns: 70px minmax(0, 1.2fr) minmax(0, 1fr) 40px; align-items: center; gap: clamp(14px, 3vw, 44px); padding: clamp(24px, 3vw, 40px) 0; color: var(--mono-text); }
.hm-service-num { color: var(--accent); font: 500 12px/1 var(--hm-mono); letter-spacing: .06em; direction: ltr; unicode-bidi: isolate; }
.hm-service-name { font: 500 clamp(34px, 4.4vw, 68px)/1 var(--editorial-serif); letter-spacing: -.03em; transition: transform .6s var(--hm-ease), color .3s ease; }
.hm-service-desc { color: var(--mono-muted); font: 400 15px/1.7 var(--editorial-sans); transition: transform .6s var(--hm-ease); }
.hm-service-arrow { justify-self: end; color: var(--mono-muted); font-size: 22px; transition: transform .5s var(--hm-ease), color .3s ease; }
html[dir="rtl"] .hm-service-arrow { transform: scaleX(-1); }
.hm-service-thumb { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hm-service-list:hover .hm-service { opacity: .35; }
  .hm-service-list:hover .hm-service:hover { opacity: 1; }
  .hm-service:hover .hm-service-name { transform: translateX(14px); color: var(--accent); font-style: italic; }
  .hm-service:hover .hm-service-desc { transform: translateX(6px); }
  html[dir="rtl"] .hm-service:hover .hm-service-name { transform: translateX(-14px); }
  html[dir="rtl"] .hm-service:hover .hm-service-desc { transform: translateX(-6px); }
  .hm-service:hover .hm-service-arrow { color: var(--accent); transform: translate(3px, -3px); }
  html[dir="rtl"] .hm-service:hover .hm-service-arrow { transform: scaleX(-1) translate(3px, -3px); }
}
.hm-cursor-preview { position: fixed; top: 0; left: 0; z-index: 40; width: 240px; aspect-ratio: 2 / 3; overflow: hidden; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(.8); box-shadow: var(--hm-shadow); }
.hm-cursor-preview img { width: 100%; height: 100%; object-fit: cover; }
@media not ((hover: hover) and (pointer: fine)) { .hm-cursor-preview { display: none; } }

/* ---------- 04 · Process ---------- */
.hm-process { padding-block: clamp(90px, 11vw, 160px); background: var(--mono-panel); border-block: 1px solid var(--mono-line); }
.hm-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); margin: 0 var(--hm-gutter); padding: 0; list-style: none; }
.hm-steps li { position: relative; padding: 8px 0 0; padding-inline-start: clamp(18px, 2vw, 28px); border-inline-start: 1px solid var(--mono-line); transition: border-color .4s ease; }
.hm-steps li:hover { border-color: var(--accent); }
.hm-step-num { display: block; margin-bottom: clamp(36px, 5vw, 70px); color: color-mix(in srgb, var(--accent) 70%, var(--mono-muted)); font: 500 italic clamp(44px, 5vw, 76px)/1 var(--editorial-serif); direction: ltr; unicode-bidi: isolate; text-align: start; }
.hm-steps h3 { margin: 0 0 12px; color: var(--mono-text); font: 500 clamp(24px, 2.2vw, 32px)/1.1 var(--editorial-serif); }
.hm-steps p { margin: 0; color: var(--mono-muted); font: 400 15px/1.75 var(--editorial-sans); }

/* ---------- 05 · Selected work (existing grid, new header) ---------- */
.hm-main .portfolio-section { padding-top: clamp(100px, 12vw, 170px); background: var(--mono-dark); }
.hm-work-head { margin-bottom: clamp(26px, 3vw, 40px); }
.hm-main .hm-work-head .portfolio-title { padding: 0; text-align: start; }
.hm-main .portfolio-filters { justify-content: flex-start; padding-inline: var(--hm-gutter); padding-bottom: clamp(26px, 3vw, 40px); }
.hm-main .masonry-grid { width: calc(100% - 2 * var(--hm-gutter)); column-gap: clamp(6px, .8vw, 12px); }
.hm-main .masonry-item { margin-bottom: clamp(6px, .8vw, 12px); }
/* Source photos are ~393px wide: 4 columns on wide screens keeps them sharp. */
@media (min-width: 1200px) { .hm-main .masonry-grid { column-count: 4; } }

/* ---------- 05 · Work teaser (home) ---------- */
.hm-work { padding-block: clamp(100px, 12vw, 170px) clamp(90px, 11vw, 150px); }
.hm-work-intro { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px 40px; }
.hm-work-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1vw, 14px); padding-inline: var(--hm-gutter); }
.hm-work-item { position: relative; display: block; overflow: hidden; aspect-ratio: 2 / 3; background: var(--mono-panel); }
.hm-work-item:nth-child(4n + 2), .hm-work-item:nth-child(4n + 4) { transform: translateY(clamp(24px, 4vw, 64px)); }
.hm-work-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--hm-ease), filter .6s ease; }
@media (hover: hover) {
  .hm-work-grid:hover .hm-work-item img { filter: saturate(.6) brightness(.92); }
  .hm-work-grid .hm-work-item:hover img { transform: scale(1.05); filter: none; }
}

/* ---------- Work page ---------- */
.hm-page-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 28px clamp(30px, 6vw, 100px); padding: clamp(70px, 10vw, 150px) var(--hm-gutter) clamp(44px, 6vw, 80px); }
.hm-page-intro h1 { margin: 0; color: var(--mono-text); font: 500 clamp(64px, 10vw, 168px)/.86 var(--editorial-serif); letter-spacing: -.045em; }
.hm-page-intro h1 em { color: var(--accent); }
.hm-page-intro > p { max-width: 420px; margin: 0; color: var(--mono-muted); font: 400 16px/1.8 var(--editorial-sans); }
.hm-main .hm-page-intro + .portfolio-section { padding-top: 0; }
html[dir="rtl"] .hm-page-intro h1 { font-family: var(--editorial-arabic-display); font-weight: 600; letter-spacing: 0; line-height: 1.2; font-size: clamp(54px, 7vw, 120px); }
html[dir="rtl"] .hm-page-intro h1 em { font-style: normal; }
html[dir="rtl"] .hm-page-intro > p { font-family: var(--editorial-arabic-sans); }

/* ---------- 06 · Final CTA ---------- */
.hm-cta { position: relative; display: grid; justify-items: center; padding: clamp(120px, 16vw, 240px) var(--hm-gutter); text-align: center; overflow: clip; border-top: 1px solid var(--mono-line); }
.hm-cta-glow { position: absolute; inset: 0; z-index: 0; pointer-events: none; background:
  radial-gradient(38% 46% at 30% 40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
  radial-gradient(34% 40% at 72% 62%, rgba(232, 196, 160, .28), transparent 72%);
  filter: blur(30px); }
.hm-cta > *:not(.hm-cta-glow) { position: relative; z-index: 1; }
.hm-cta-title { margin: 0; color: var(--mono-text); font: 500 clamp(64px, 10vw, 168px)/.88 var(--editorial-serif); letter-spacing: -.045em; }
.hm-cta-text { max-width: 480px; margin: 30px 0 38px; color: var(--mono-muted); font: 400 16px/1.8 var(--editorial-sans); }
.hm-cta-sub { display: inline-flex; align-items: center; gap: 8px; margin-top: 34px; color: var(--mono-muted); font: 500 11px/1.4 var(--hm-mono); letter-spacing: .14em; text-transform: uppercase; transition: color .3s ease; }
.hm-cta-sub i { font-style: normal; transition: translate .5s var(--hm-ease); }
.hm-cta-sub:hover { color: var(--accent); }
.hm-cta-sub:hover i { translate: 4px 0; }
html[dir="rtl"] .hm-cta-sub i { scale: -1 1; }
html[dir="rtl"] .hm-cta-sub:hover i { translate: -4px 0; }

/* Bold, heavier headline for the closing call */
.hm-cta-title { font-weight: 600; }
.hm-cta-title em { font-weight: 600; }

/* A matched pair: same height, same shape, an icon chip on each.
   Booking is the solid one; WhatsApp is its outlined twin. */
.hm-cta-actions { gap: 14px; }
.hm-cta-btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 22px;
  min-width: 250px; min-height: 60px; padding: 8px 8px 8px 26px;
  border: 1px solid var(--mono-text);
  font: 600 13px/1 var(--editorial-sans); letter-spacing: .08em; text-transform: uppercase;
  transition: color .45s ease, border-color .45s ease;
}
html[dir="rtl"] .hm-cta-btn { padding: 8px 26px 8px 8px; }
/* Fill that rises from the bottom on hover */
.hm-cta-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: scaleY(0); transform-origin: bottom; transition: transform .6s var(--hm-ease); }
.hm-cta-btn:hover::before, .hm-cta-btn:focus-visible::before { transform: scaleY(1); }
.hm-cta-btn b {
  display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px;
  font-size: 17px; font-weight: 400; transition: transform .6s var(--hm-ease), background-color .45s ease, color .45s ease;
}
.hm-cta-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.hm-cta-btn.is-primary { background: var(--mono-text); color: var(--mono-dark); }
.hm-cta-btn.is-primary::before { background: var(--accent); }
.hm-cta-btn.is-primary b { background: var(--accent); color: #fff; }
.hm-cta-btn.is-primary:hover { border-color: var(--accent); color: #fff; }
.hm-cta-btn.is-primary:hover b { background: var(--mono-dark); color: var(--mono-text); }
/* Square chip stays put; the arrow flies out of the corner and its twin slides in. */
.hm-cta-btn.is-primary b { overflow: hidden; }
.hm-cta-btn.is-primary b i { display: block; font-style: normal; text-shadow: -28px 28px 0 currentColor; transition: transform .55s var(--hm-ease); }
.hm-cta-btn.is-primary:hover b i { transform: translate(28px, -28px); }
html[dir="rtl"] .hm-cta-btn.is-primary b { transform: scaleX(-1); }

.hm-cta-btn.is-whatsapp { --wa: #25d366; background: color-mix(in srgb, var(--mono-dark) 55%, transparent); color: var(--mono-text); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hm-cta-btn.is-whatsapp::before { background: var(--wa); }
.hm-cta-btn.is-whatsapp b { background: var(--wa); color: #fff; }
.hm-cta-btn.is-whatsapp:hover { border-color: var(--wa); color: #fff; }
.hm-cta-btn.is-whatsapp:hover b { background: #fff; color: #128c4b; transform: scale(1.06); }

html[dir="rtl"] .hm-cta-btn { font: 700 16px/1 var(--editorial-arabic-sans); letter-spacing: 0; text-transform: none; }

/* ---------- Arabic (RTL): no tracking, no italics, Arabic display face ---------- */
html[dir="rtl"] .hm-card-index,
html[dir="rtl"] .hm-step-num { text-align: right; }
html[dir="rtl"] .hm-card h3 { font-family: var(--editorial-arabic-display); font-weight: 600; letter-spacing: 0; line-height: 1.3; font-size: clamp(34px, 3.6vw, 58px); }
html[dir="rtl"] .hm-tag,
html[dir="rtl"] .hm-btn,
html[dir="rtl"] .hm-link,
html[dir="rtl"] .hm-card-meta,
html[dir="rtl"] .hm-hero-facts dt,
html[dir="rtl"] .hm-cta-sub { font-family: var(--editorial-arabic-sans); letter-spacing: 0; text-transform: none; }
html[dir="rtl"] .hm-tag { font-size: 14px; }
html[dir="rtl"] .hm-btn, html[dir="rtl"] .hm-link { font-size: 15px; }
html[dir="rtl"] .hm-hero-facts dt, html[dir="rtl"] .hm-card-meta, html[dir="rtl"] .hm-cta-sub { font-size: 13px; }
html[dir="rtl"] .hm-hero-title,
html[dir="rtl"] .hm-section-head h2,
html[dir="rtl"] .hm-approach-title,
html[dir="rtl"] .hm-cta-title,
html[dir="rtl"] .hm-service-name,
html[dir="rtl"] .hm-steps h3 { font-family: var(--editorial-arabic-display); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
html[dir="rtl"] .hm-hero-title { font-size: clamp(46px, 5.2vw, 82px); }
html[dir="rtl"] .hm-section-head h2 { font-size: clamp(36px, 4.6vw, 70px); }
html[dir="rtl"] .hm-approach-title { font-size: clamp(40px, 5.6vw, 88px); }
html[dir="rtl"] .hm-cta-title { font-size: clamp(48px, 7vw, 116px); line-height: 1.25; font-weight: 800; }
html[dir="rtl"] .hm-cta-title em { font-weight: 800; }
html[dir="rtl"] .hm-service-name { font-size: clamp(28px, 3.4vw, 52px); }
html[dir="rtl"] em,
html[dir="rtl"] .hm-hero-facts dd,
html[dir="rtl"] .hm-service:hover .hm-service-name { font-style: normal; }
html[dir="rtl"] .hm-hero-facts dd,
html[dir="rtl"] .hm-approach-text { font-family: var(--editorial-arabic-sans); }
html[dir="rtl"] .hm-approach-text { font-size: clamp(19px, 2vw, 28px); line-height: 1.8; }
html[dir="rtl"] .hm-hero-lead, html[dir="rtl"] .hm-card-text, html[dir="rtl"] .hm-service-desc, html[dir="rtl"] .hm-steps p, html[dir="rtl"] .hm-cta-text { font-family: var(--editorial-arabic-sans); font-size: 16px; line-height: 1.9; }
html[dir="rtl"] .hm-marquee span, html[dir="rtl"] .hm-marquee em { font-family: var(--editorial-arabic-display); font-weight: 600; font-style: normal; letter-spacing: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hm-hero { grid-template-columns: 1fr; padding: clamp(40px, 7vw, 72px) var(--hm-gutter) 0; min-height: 0; }
  html[dir="rtl"] .hm-hero { padding-inline: var(--hm-gutter); }
  .hm-hero-copy { max-width: 680px; }
  .hm-hero-mosaic { height: clamp(460px, 80vw, 760px); margin-block: 0; padding-inline-end: 0; }
  .hm-seal { inset-inline-start: auto; inset-inline-end: 6%; bottom: 6%; }
  .hm-vertical { display: none; }
  /* Still stacked: one column, photos fill whatever height is left. */
  .hm-card { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 20px; height: min(calc(100svh - 124px), 820px); }
  .hm-card-copy { justify-content: flex-start; gap: 10px; }
  .hm-card-index { margin-bottom: 4px; }
  .hm-card-photos { min-height: 0; }
  .hm-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 56px; }
}
@media (max-width: 760px) {
  .hm-hero-facts { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .hm-hero-facts div:nth-child(3) { grid-column: 1 / -1; padding-inline-start: 0; border-inline-start: 0; }
  .hm-hero-mosaic { height: clamp(400px, 118vw, 600px); }
  .hm-col:nth-child(3) { display: none; }
  .hm-mosaic-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline-end: 0; }
  .hm-float { display: none; } /* would cover the headline on narrow screens */
  .hm-card { top: 80px; /* mobile header is 68px */ height: calc(100svh - 100px); max-height: 680px; padding: 18px; gap: 16px; }
  .hm-card h3 { font-size: clamp(32px, 9vw, 42px); }
  .hm-card-text { margin: 0; font-size: 14px; line-height: 1.6; }
  .hm-card-photos { grid-template-columns: 1fr 1fr; }
  .hm-card-photos figure:nth-child(3) { display: none; }
  .hm-card-photos figure:nth-child(n) { margin-block: 0; }
  .hm-service a { grid-template-columns: 34px minmax(0, 1fr) 76px; grid-template-areas: "num name thumb" ". desc thumb"; row-gap: 8px; }
  .hm-service-num { grid-area: num; align-self: start; padding-top: 10px; }
  .hm-service-name { grid-area: name; }
  .hm-service-desc { grid-area: desc; font-size: 14px; }
  .hm-service-thumb { display: block; grid-area: thumb; width: 76px; height: 104px; object-fit: cover; }
  .hm-service-arrow { display: none; }
  .hm-steps { grid-template-columns: 1fr; row-gap: 40px; }
  .hm-work-intro { grid-template-columns: 1fr; }
  .hm-work-intro .hm-btn { justify-self: start; }
  .hm-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-work-item:nth-child(n) { transform: none; }
  .hm-work-item:nth-child(even) { transform: translateY(28px); }
  .hm-work-item:nth-child(n + 7) { display: none; }
  .hm-page-intro { grid-template-columns: 1fr; padding-top: 56px; }
  .hm-step-num { margin-bottom: 18px; }
  .hm-main .masonry-grid { width: calc(100% - 18px); }
  .hm-main .portfolio-filters { padding-inline: 18px; }
}
@media (max-width: 420px) {
  .hm-actions { flex-direction: column; align-items: stretch; }
  .hm-btn { justify-content: space-between; }
  .hm-link { justify-content: center; }
}

/* ---------- Phone & small tablet hero: photos become a soft, drifting backdrop ----------
   One screen tall. The mosaic sits behind the copy, slightly blurred, each column
   drifting slowly on its own rhythm; a paper-tone veil keeps the text crisp. */
.hm-col-extra { display: none; }
@media (max-width: 900px) {
  .hm-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    align-content: end;
    min-height: min(calc(100svh - 68px), 880px);
    padding: 0 22px clamp(34px, 6svh, 56px);
    overflow: hidden;
    isolation: isolate;
  }
  html[dir="rtl"] .hm-hero { padding-inline: 22px; }

  .hm-hero-mosaic { position: absolute; inset: 0; z-index: -1; height: auto; margin: 0; }
  .hm-hero-mosaic::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--mono-dark) 18%, transparent) 0%,
      color-mix(in srgb, var(--mono-dark) 38%, transparent) 26%,
      color-mix(in srgb, var(--mono-dark) 78%, transparent) 50%,
      color-mix(in srgb, var(--mono-dark) 93%, transparent) 70%,
      var(--mono-dark) 100%);
  }
  .hm-mosaic-inner {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 124%;
    height: 100%;
    margin-inline: -12%;
    padding: 0;
    gap: 8px;
    -webkit-mask-image: none;
            mask-image: none;
  }
  .hm-col { gap: 8px; animation: hm-drift 18s ease-in-out infinite alternate; }
  .hm-col:nth-child(1) { margin-top: -30%; animation-duration: 16s; }
  .hm-col:nth-child(2) { margin-top: -24%; animation-duration: 21s; animation-direction: alternate-reverse; }
  .hm-col:nth-child(3) { display: grid; margin-top: -48%; animation-duration: 18s; }
  .hm-col-extra { display: block; }
  .hm-col img { filter: blur(1.6px) saturate(.9); transform: scale(1.06); }

  /* Light theme: a cream veil over photos reads as washed-out, so keep the top of the
     backdrop clear, sit the prints on a dark board (like dark mode) and fade to paper
     only where the text starts. */
  html:not([data-theme="dark"]) .hm-mosaic-inner { background: #1d1a16; }
  html:not([data-theme="dark"]) .hm-col img { filter: blur(1.4px) saturate(1.08) contrast(1.05); }
  html:not([data-theme="dark"]) .hm-hero-mosaic::after {
    background: linear-gradient(180deg,
      transparent 0%,
      color-mix(in srgb, var(--mono-dark) 6%, transparent) 30%,
      color-mix(in srgb, var(--mono-dark) 62%, transparent) 50%,
      color-mix(in srgb, var(--mono-dark) 92%, transparent) 66%,
      var(--mono-dark) 84%);
  }

  .hm-hero-copy { max-width: none; }
  .hm-hero-title { font-size: clamp(54px, 15vw, 84px); }
  .hm-hero-lead { margin: 18px 0 26px; color: var(--mono-text); opacity: .78; }
  .hm-hero-facts { display: none; }
  .hm-hero .hm-tag { color: var(--mono-text); }

  .hm-seal { inset-inline-start: auto; inset-inline-end: 18px; top: 22px; bottom: auto; width: 92px; background: color-mix(in srgb, var(--mono-dark) 82%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .hm-seal text { font-size: 9.2px; }
  .hm-vertical { display: none; }
}
/* `translate` composes with GSAP's scroll parallax (which uses `transform`). */
@keyframes hm-drift { from { translate: 0 -5%; } to { translate: 0 5%; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hm-seal svg, .hm-marquee-group { animation: none !important; }
  .hm-col img, .hm-card-photos img, .hm-service *, .hm-link::after { transition: none !important; animation: none !important; }
  .hm-col img { transform: none; }
}

/* Home work teaser: 'View all work' sits centred under the grid. */
.hm-work-intro { grid-template-columns: 1fr; }
.hm-work-more { display: flex; justify-content: center; margin-top: clamp(72px, 9vw, 120px); }
@media (max-width: 760px) { .hm-work-more { margin-top: 64px; } }
