/* ==========================================================
   Osama Mashady — portfolio
   Direction: Minimalism & Swiss + Accessible (UI UX Pro Max)
   Pattern: Trust & Authority. RTL-safe (logical properties).
   ========================================================== */

:root {
  --ink: #15133a;
  --ink-2: #2a2858;
  --paper: #faf8f5;
  --surface: #ffffff;
  --line: #e1dde8;
  --muted: #55536b;
  --accent: #3b3fa8;
  --accent-strong: #2b2e85;
  --accent-soft: #e9e9fb;
  --on-accent: #ffffff;
  --band: #15133a;
  --on-band: #f4f2fa;
  --on-band-muted: #b3b1d1;
  --band-accent: #ffc46b;
  --focus: #3b3fa8;

  --font-head: "Figtree", "Noto Sans Arabic", system-ui, sans-serif;
  --font-body: "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;

  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: 1rem;
  --step-1: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
  --step-2: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem);
  --step-4: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  --step-5: clamp(2.75rem, 1.7rem + 5vw, 5.5rem);

  --space-section: clamp(72px, 9vw, 128px);
  --container: 1180px;
  --gutter: clamp(20px, 4vw, 40px);
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f1f0fa;
    --ink-2: #d6d4ec;
    --paper: #0e0d22;
    --surface: #171634;
    --line: #2d2b55;
    --muted: #aeacce;
    --accent: #a5a8ff;
    --accent-strong: #c7c9ff;
    --accent-soft: #242360;
    --on-accent: #0e0d2e;
    --band: #080717;
    --focus: #c7c9ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 0.8rem; letter-spacing: 0.04em;
}
.brand-name { font-size: 0.98rem; white-space: nowrap; }
.btn-sm { white-space: nowrap; }
.nav { margin-inline-start: auto; }
.nav ul { display: flex; gap: 4px; }
.nav a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  text-decoration: none; font-size: 0.9rem; font-weight: 500; color: var(--muted); transition: color .2s var(--ease), background .2s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; inset-inline: 12px; bottom: 7px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
[dir="rtl"] .nav a::after { transform-origin: right; }
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }
.nav a[aria-current="true"] { color: var(--accent-strong); background: var(--accent-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
  min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 0.9rem; transition: border-color .2s var(--ease);
}
.lang-toggle:hover { border-color: var(--accent); }
.menu-btn { display: none; min-height: 44px; min-width: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); place-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1.5px solid transparent; font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 0.9rem; }
.btn-light { background: var(--on-band); color: #15133a; }
.btn-light:hover { background: #fff; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 96px) clamp(48px, 7vw, 88px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 600;
  font-size: var(--step--1); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-strong);
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
.hero h1 {
  font-family: var(--font-head); font-weight: 700; font-size: var(--step-5); line-height: 1.02; letter-spacing: -0.035em; margin-block: 20px 8px;
}
.hero h1 .surname { color: var(--accent); }
.hero-role { font-family: var(--font-head); font-size: var(--step-2); font-weight: 500; color: var(--ink-2); }
.hero-lead { margin-block: 24px 32px; max-width: 56ch; font-size: var(--step-1); color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts { margin-block-start: 44px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-block-start: 24px; border-top: 1px solid var(--line); }
.hero-facts dt { font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-block-end: 4px; }
.hero-facts dd { font-weight: 600; line-height: 1.4; }

.portrait { position: relative; width: min(100%, 420px); justify-self: end; margin-inline-end: 20px; }
[dir="rtl"] .portrait { justify-self: start; margin-inline-end: 0; margin-inline-start: 20px; }
.portrait::before {
  content: ""; position: absolute; inset: 20px -20px -20px 20px; border: 1.5px solid var(--accent); border-radius: var(--radius); z-index: 0;
}
[dir="rtl"] .portrait::before { inset: 20px 20px -20px -20px; }
.portrait img {
  position: relative; z-index: 1; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 18%;
  border-radius: var(--radius); background: var(--surface);
}
.portrait-card {
  position: absolute; z-index: 2; inset-inline-start: -16px; bottom: 28px; max-width: 260px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px -16px rgba(21, 19, 58, 0.35);
}
.portrait-card small { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.portrait-card strong { font-family: var(--font-head); font-size: 0.98rem; line-height: 1.35; }

/* ---------- Proof band ---------- */
.band { background: var(--band); color: var(--on-band); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 40px 24px; border-inline-start: 1px solid rgba(255, 255, 255, 0.12); }
.stat:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stat-num { font-family: var(--font-head); font-weight: 700; font-size: var(--step-4); line-height: 1; letter-spacing: -0.03em; color: var(--band-accent); font-variant-numeric: tabular-nums; }
.stat-label { margin-block-start: 12px; font-size: 0.9rem; color: var(--on-band-muted); max-width: 22ch; }

/* ---------- Sections ---------- */
section { padding-block: var(--space-section); }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 80px); align-items: end; margin-block-end: clamp(40px, 5vw, 64px); }
.section-head.single { grid-template-columns: 1fr; }
.section-no { font-family: var(--font-head); font-weight: 600; font-size: var(--step--1); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-strong); display: flex; gap: 12px; align-items: center; margin-block-end: 16px; }
.section-no span { color: var(--muted); }
h2 { font-family: var(--font-head); font-weight: 700; font-size: var(--step-3); line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; }
.section-intro { color: var(--muted); font-size: var(--step-1); max-width: 60ch; }
h3 { font-family: var(--font-head); font-weight: 650; font-size: var(--step-1); line-height: 1.3; letter-spacing: -0.01em; }

[dir="rtl"] .hero h1, [dir="rtl"] h2, [dir="rtl"] .stat-num { letter-spacing: 0; }
[dir="rtl"] .eyebrow, [dir="rtl"] .section-no, [dir="rtl"] .hero-facts dt { letter-spacing: 0; text-transform: none; }
[dir="rtl"] .hero h1 { line-height: 1.25; }
[dir="rtl"] body { line-height: 1.85; }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 96px); }
.lede { font-family: var(--font-head); font-size: var(--step-2); line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; text-wrap: pretty; }
.about-grid > div > .about-text:first-child { margin-block-start: 0; }
.about-text { margin-block-start: 24px; color: var(--muted); max-width: 52ch; }
.strengths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.strength { padding: 24px 24px 24px 0; border-bottom: 1px solid var(--line); }
[dir="rtl"] .strength { padding: 24px 0 24px 24px; }
.strength .n { font-family: var(--font-head); font-weight: 700; color: var(--accent); font-size: 0.85rem; letter-spacing: 0.06em; }
.strength h3 { margin-block: 6px 6px; }
.strength p { color: var(--muted); font-size: 0.94rem; }

/* Timeline */
.timeline { border-top: 1px solid var(--line); }
.t-item { display: grid; grid-template-columns: minmax(0, 0.34fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 64px); padding-block: 36px; border-bottom: 1px solid var(--line); }
.t-meta { color: var(--muted); font-size: 0.94rem; }
.t-date { font-family: var(--font-head); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.t-org { font-family: var(--font-head); font-weight: 700; font-size: var(--step-2); letter-spacing: -0.02em; line-height: 1.2; }
.t-role { margin-block-start: 6px; color: var(--accent-strong); font-weight: 600; }
.t-place { display: inline-flex; align-items: center; gap: 6px; margin-block-start: 6px; color: var(--muted); font-size: 0.9rem; }
.t-place .icon { width: 16px; height: 16px; }
.t-points { margin-block-start: 18px; display: grid; gap: 10px; }
.t-points li { position: relative; padding-inline-start: 22px; }
.t-points li::before { content: ""; position: absolute; inset-inline-start: 0; top: 0.78em; width: 10px; height: 2px; background: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 8px; margin-block-start: 14px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.85rem; font-weight: 600; }
.badge .icon { width: 16px; height: 16px; }

/* Skills */
.skill-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.skill-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.skill-card h3 { margin-block-end: 16px; padding-block-end: 14px; border-bottom: 1px solid var(--line); }
.skill-card li { padding-block: 7px; font-size: 0.94rem; display: flex; gap: 10px; }
.skill-card li::before { content: ""; flex: none; width: 6px; height: 6px; margin-block-start: 0.7em; border-radius: 50%; background: var(--accent); }
.personal { margin-block-start: 56px; }
.personal h3 { margin-block-end: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.92rem; font-weight: 500; }

/* Education / cards */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 3vw, 36px); }
.section-alt .card { background: var(--paper); }
.card .t-org { font-size: var(--step-1); }
.card + .card { margin-block-start: 0; }
.quote { margin-block-start: 20px; padding-inline-start: 18px; border-inline-start: 3px solid var(--accent); color: var(--muted); }

/* Case study (UEPF) */
.case { background: var(--band); color: var(--on-band); }
.case .section-no { color: var(--band-accent); }
.case .section-no span, .case .section-intro { color: var(--on-band-muted); }
.case h2 { color: var(--on-band); }
.case-quote { font-family: var(--font-head); font-size: var(--step-2); color: var(--band-accent); font-weight: 500; margin-block-start: 20px; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 24px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--band-accent); color: #2a1c00; font-weight: 700; font-size: 0.88rem; }
.pill .icon { width: 16px; height: 16px; }
.case-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 48px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius); }
.case-stat { padding: 28px; border-inline-start: 1px solid rgba(255, 255, 255, 0.14); }
.case-stat:first-child { border-inline-start: 0; }
.case-stat .stat-num { font-size: var(--step-3); }
.case-stat p { margin-block-start: 8px; color: var(--on-band-muted); font-size: 0.92rem; }
.case-feature { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: clamp(24px, 4vw, 56px); align-items: center; margin-block-end: 24px; }
.case-feature img { width: 100%; height: auto; border-radius: var(--radius); }
.case-feature p { font-family: var(--font-head); font-size: var(--step-2); line-height: 1.35; font-weight: 500; }

/* Galleries */
.gallery { columns: 3 240px; column-gap: 16px; margin-block-start: 32px; }
.gallery.cols-2 { columns: 2 240px; }
.gallery.cols-4 { columns: 4 200px; }
.gallery figure { break-inside: avoid; margin-block-end: 16px; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: var(--radius); overflow: hidden; position: relative; }
.gallery img { width: 100%; height: auto; transition: transform .5s var(--ease); background: var(--line); }
.gallery button:hover img { transform: scale(1.025); }
.gallery figcaption { margin-block-start: 8px; font-size: 0.84rem; color: var(--muted); }
.case .gallery figcaption { color: var(--on-band-muted); }
.partners-img { margin-block-start: 24px; border-radius: var(--radius); width: 100%; height: auto; }

/* Videos */
.videos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-block-start: 8px; }
.video-card video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); object-fit: cover; }
.video-card figcaption { margin-block-start: 12px; font-size: 0.9rem; color: var(--muted); }
.video-card figcaption strong { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1rem; }

/* Development list */
.dev-list { margin-block-start: 48px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; border-top: 1px solid var(--line); }
.dev-item { display: grid; grid-template-columns: 84px 1fr; gap: 16px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.dev-item time { font-family: var(--font-head); font-weight: 600; color: var(--accent-strong); font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.dev-item strong { display: block; font-family: var(--font-head); line-height: 1.3; }
.dev-item span { color: var(--muted); font-size: 0.92rem; }

.feature { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(24px, 5vw, 72px); padding-block: 40px; border-top: 1px solid var(--line); }
.feature:first-of-type { margin-block-start: 0; }
.feature .t-org { font-size: var(--step-2); }
.feature-body p { color: var(--muted); margin-block-start: 14px; max-width: 54ch; }
.date-tag { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: 0.82rem; margin-block-end: 14px; }
.feature .gallery { margin-block-start: 0; }

/* Contact */
.contact { background: var(--band); color: var(--on-band); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.contact h2 { font-size: var(--step-4); color: var(--on-band); }
.contact .section-no { color: var(--band-accent); }
.contact p.lead { margin-block: 24px 32px; color: var(--on-band-muted); font-size: var(--step-1); max-width: 44ch; }
.contact-list { border-top: 1px solid rgba(255, 255, 255, 0.14); }
.contact-list a { display: flex; align-items: center; gap: 18px; padding: 22px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); text-decoration: none; transition: background .2s var(--ease), padding .2s var(--ease); }
.contact-list a:hover { background: rgba(255, 255, 255, 0.05); padding-inline: 14px; }
.contact-list .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 196, 107, 0.14); color: var(--band-accent); flex: none; }
.contact-list small { display: block; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-band-muted); font-weight: 600; }
[dir="rtl"] .contact-list small { letter-spacing: 0; text-transform: none; }
.contact-list strong { font-family: var(--font-head); font-size: var(--step-1); font-weight: 600; word-break: break-word; }
.contact-list .arrow { margin-inline-start: auto; color: var(--on-band-muted); }
.also { margin-block-start: 28px; display: flex; flex-wrap: wrap; gap: 12px 32px; color: var(--on-band-muted); font-size: 0.92rem; }
.also strong { color: var(--on-band); font-weight: 600; }

.site-footer { background: var(--band); color: var(--on-band-muted); border-top: 1px solid rgba(255, 255, 255, 0.12); padding-block: 28px; font-size: 0.88rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* Lightbox */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; color: #fff; }
dialog.lightbox::backdrop { background: rgba(8, 7, 23, 0.92); }
.lb-inner { height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 56px 72px 24px; }
.lb-inner img { max-width: 100%; max-height: calc(100vh - 140px); width: auto; height: auto; border-radius: var(--radius-sm); object-fit: contain; }
.lb-cap { margin-block-start: 14px; text-align: center; font-size: 0.95rem; color: #d8d6ee; }
.lb-btn { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: #fff; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lb-close { top: 16px; inset-inline-end: 16px; }
.lb-prev { top: 50%; inset-inline-start: 16px; transform: translateY(-50%); }
.lb-next { top: 50%; inset-inline-end: 16px; transform: translateY(-50%); }
[dir="rtl"] .lb-prev .icon, [dir="rtl"] .lb-next .icon { transform: scaleX(-1); }

/* Reveal (stagger via --d, set in JS) */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease) var(--d, 0s), transform .8s var(--ease) var(--d, 0s); }
.js .gallery figure.reveal { transform: translateY(28px) scale(0.96); }
.js .reveal.in { opacity: 1; transform: none; }
/* after the entrance finishes, hover transitions take over (no slow delay) */
.js .reveal.settled { transition: translate .35s var(--ease), transform .35s var(--ease), border-color .3s var(--ease), box-shadow .35s var(--ease), background .3s var(--ease); }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-inline-start: 0; padding-inline-start: 0; }
  .stat { padding-block: 32px; }
}
@media (max-width: 1160px) {
  .menu-btn { display: grid; }
  .nav { position: absolute; inset-inline: 0; top: var(--header-h); background: var(--paper); border-bottom: 1px solid var(--line); display: none; padding: 8px var(--gutter) 20px; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; }
  .nav a { width: 100%; min-height: 48px; font-size: 1rem; }
  .header-actions { margin-inline-start: auto; }
}
@media (max-width: 960px) {
  .hero-grid, .about-grid, .section-head, .contact-grid, .feature, .case-feature { grid-template-columns: 1fr; }
  .portrait { width: min(100%, 340px); justify-self: start; margin-inline: 0 20px; }
  [dir="rtl"] .portrait { margin-inline: 20px 0; }
  .portrait img { aspect-ratio: 1 / 1; object-position: center 22%; }
  .portrait-card { inset-inline-start: 12px; bottom: 12px; max-width: 220px; padding: 10px 14px; }
  .t-item { grid-template-columns: 1fr; gap: 12px; }
  .two-col, .videos, .dev-list { grid-template-columns: 1fr; }
  .hero-facts { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 480px) {
  .header-actions .btn-sm { display: none; }
  .header-inner { gap: 12px; }
}
@media (max-width: 640px) {
  .header-actions .btn-sm span { display: none; }
  .header-actions .btn-sm { padding: 0; width: 44px; }
  .btn.btn-sm { width: 44px; }
  .strengths { grid-template-columns: 1fr; }
  .skill-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .stat, .stat:nth-child(4) { border-inline-start: 0; padding-inline: 0; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-block: 24px; }
  .stat:nth-child(-n + 2) { border-top: 0; }
  .case-stats { grid-template-columns: 1fr; }
  .case-stat { border-inline-start: 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .case-stat:first-child { border-top: 0; }
  .gallery, .gallery.cols-2, .gallery.cols-4 { columns: 2 140px; column-gap: 12px; }
  .lb-inner { padding: 64px 12px 16px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .btn { width: 100%; }
  .hero-cta { width: 100%; }
  .dev-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .js .reveal, .js .gallery figure.reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .lightbox, .menu-btn, .gallery, .videos { display: none !important; }
  .band, .case, .contact, .site-footer { background: #fff !important; color: #000 !important; }
  section { padding-block: 24px; }
}

/* ==========================================================
   Motion layer: load, scroll, hover + custom cursor
   ========================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes wipe { from { clip-path: inset(0 0 100% 0); transform: scale(1.06); } to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes outline-in { from { opacity: 0; transform: translate(-16px, -16px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }

/* hero entrance, staggered */
.js .hero-copy > * { animation: rise 0.95s var(--ease) both; }
.js .hero-copy > :nth-child(1) { animation-delay: 0.05s; }
.js .hero-copy > :nth-child(2) { animation-delay: 0.15s; }
.js .hero-copy > :nth-child(3) { animation-delay: 0.27s; }
.js .hero-copy > :nth-child(4) { animation-delay: 0.37s; }
.js .hero-copy > :nth-child(5) { animation-delay: 0.47s; }
.js .hero-copy > :nth-child(6) { animation-delay: 0.58s; }
.js .portrait img { animation: wipe 1.25s var(--ease) 0.2s both; }
.js .portrait::before { animation: outline-in 1s var(--ease) 0.7s both; }
.js .portrait-card { animation: pop 0.8s var(--ease) 1.05s both; }
.js .site-header { animation: rise 0.7s var(--ease) both; }

/* scroll progress + header state */
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 60; background: var(--accent); transform: scaleX(0); transform-origin: left; pointer-events: none; }
[dir="rtl"] .progress { transform-origin: right; }
.site-header { transition: box-shadow .3s var(--ease), background .3s var(--ease); }
.site-header.scrolled { box-shadow: 0 8px 24px -18px rgba(21, 19, 58, 0.45); }

/* brand */
.brand-name { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.015em; transition: color .25s var(--ease); }
.brand:hover .brand-name { color: var(--accent); }

/* buttons: magnetic pull + icon nudge + sheen */
.btn { position: relative; overflow: hidden; transform: translate(var(--mx, 0px), var(--my, 0px)); transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease), box-shadow .3s var(--ease); }
.btn:active { transform: translate(var(--mx, 0px), calc(var(--my, 0px) + 1px)); }
.btn::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--ease); pointer-events: none; }
.btn:hover::before { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 12px 28px -14px var(--accent); }
.btn .icon { transition: transform .3s var(--ease); }
.btn:hover .icon { transform: translateY(2px); }
.lang-toggle { transform: translate(var(--mx, 0px), var(--my, 0px)); transition: border-color .2s var(--ease), transform .25s var(--ease), background .2s var(--ease); }
.lang-toggle:hover { background: var(--accent-soft); }

/* cards lift */
.skill-card, .card, .strength, .case-stat, .video-card video { transition: translate .35s var(--ease), transform .35s var(--ease), border-color .3s var(--ease), box-shadow .35s var(--ease), background .3s var(--ease); }
.skill-card:hover, .card:hover { translate: 0 -6px; border-color: var(--accent); box-shadow: 0 22px 40px -28px rgba(21, 19, 58, 0.5); }
.strength:hover { translate: 6px 0; }
[dir="rtl"] .strength:hover { translate: -6px 0; }
.strength .n { display: inline-block; transition: transform .35s var(--ease); }
.strength:hover .n { transform: scale(1.25); transform-origin: left; }
.case-stat:hover { background: rgba(255, 255, 255, 0.04); }
.video-card:hover video { transform: scale(1.01); box-shadow: 0 24px 44px -26px rgba(0, 0, 0, 0.6); }

/* timeline rows */
.t-item { position: relative; transition: background .3s var(--ease); }
.t-item::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; width: 3px; height: 100%; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .45s var(--ease); }
.t-item:hover::before { transform: scaleY(1); }
.t-org { transition: color .3s var(--ease), transform .35s var(--ease); }
.t-item:hover .t-org { color: var(--accent-strong); transform: translateX(6px); }
[dir="rtl"] .t-item:hover .t-org { transform: translateX(-6px); }
.dev-item { transition: padding .35s var(--ease), background .3s var(--ease); }
.dev-item:hover { padding-inline-start: 12px; background: var(--accent-soft); }

/* chips, pills, badges */
.chip { transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease), color .25s var(--ease); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); transform: translateY(-3px); }
.pill { transition: transform .3s var(--ease); }
.pill:hover { transform: translateY(-3px) rotate(-1deg); }
.pill .icon { transition: transform .5s var(--ease); }
.pill:hover .icon { transform: rotate(144deg) scale(1.15); }

/* galleries */
.gallery button { box-shadow: 0 0 0 0 transparent; transition: box-shadow .35s var(--ease), transform .35s var(--ease); }
.gallery button::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8, 7, 23, 0.5)); opacity: 0; transition: opacity .35s var(--ease); pointer-events: none; }
.gallery button:hover { box-shadow: 0 22px 40px -22px rgba(0, 0, 0, 0.55); transform: translateY(-3px); }
.gallery button:hover::after { opacity: 1; }
.gallery img { transition: transform .8s var(--ease); }
.gallery button:hover img { transform: scale(1.06); }
.portrait img, .case-feature img { transition: transform .8s var(--ease); }

/* contact rows */
.contact-list .arrow { transition: transform .3s var(--ease), color .3s var(--ease); }
.contact-list a:hover .arrow { transform: translate(4px, -4px); color: var(--band-accent); }
[dir="rtl"] .contact-list a:hover .arrow { transform: translate(-4px, -4px); }
.contact-list .ic { transition: background .3s var(--ease), transform .4s var(--ease); }
.contact-list a:hover .ic { background: rgba(255, 196, 107, 0.3); transform: rotate(-8deg) scale(1.08); }

/* clickable things show the standard pointer (hand) */
a[href], button, [role="button"], summary, label, select, .btn, .lang-toggle, .menu-btn, .gallery button, .lb-btn { cursor: pointer; }
button:disabled { cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .js .hero-copy > *, .js .portrait img, .js .portrait::before, .js .portrait-card, .js .site-header { animation: none; }
  .btn::before { display: none; }
  .skill-card:hover, .card:hover, .strength:hover { translate: none; }
  .gallery button:hover, .chip:hover, .pill:hover { transform: none; }
}

/* ---------- Hero v3: light, arched portrait with offset gold outline ---------- */
.hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.hero h1 .surname { color: var(--accent); }
.portrait { width: min(100%, 380px); margin-inline-end: 24px; justify-self: center; }
[dir="rtl"] .portrait { margin-inline: 24px 0; }
.portrait::before {
  content: ""; position: absolute; inset: 24px -24px -24px 24px; z-index: 0;
  border: 2px solid var(--band-accent); border-radius: 999px 999px 18px 18px; background: transparent;
}
[dir="rtl"] .portrait::before { inset: 24px 24px -24px -24px; }
.portrait img {
  height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%;
  border-radius: 999px 999px 18px 18px; background: #f3ead6; mix-blend-mode: multiply;
}
.portrait { background: #f3ead6; border-radius: 999px 999px 18px 18px; }
.portrait-card {
  display: inline-flex; align-items: center; gap: 10px; max-width: none; padding: 12px 20px;
  inset-inline-start: -14px; bottom: 28px; border: 0; border-radius: 999px;
  background: var(--band); color: var(--on-band); font-family: var(--font-head); font-weight: 600; font-size: 0.98rem;
  box-shadow: 0 14px 30px -14px rgba(21, 19, 58, 0.6);
}
.portrait-card .icon { width: 18px; height: 18px; color: var(--band-accent); }
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { width: min(100%, 320px); justify-self: start; margin-inline: 0 24px; }
  [dir="rtl"] .portrait { margin-inline: 24px 0; }
  .portrait-card { inset-inline-start: 8px; bottom: 18px; }
}

/* ---------- Why Osama: circles ---------- */
.why { padding-block-start: 0; }
.why-head h2 { font-family: var(--font-head); font-size: var(--step-4); letter-spacing: -0.02em; line-height: 1.1; }
.why-hint { margin-block-start: 10px; color: var(--muted); }
.why-layout { margin-block-start: 40px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.why-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); }
.why-dot {
  width: 100%; aspect-ratio: 1; border-radius: 50%; padding: 12%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
  font-family: var(--font-head); font-weight: 600; line-height: 1.3; font-size: clamp(0.85rem, 0.75rem + 0.5vw, 1.05rem);
  transition: background .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease), scale .35s var(--ease);
  animation: why-float calc(5s + var(--i) * 0.6s) ease-in-out calc(var(--i) * -0.8s) infinite;
}
.why-dot .n { font-size: clamp(1.1rem, 0.9rem + 1vw, 1.6rem); font-weight: 700; color: var(--accent); transition: color .35s var(--ease); }
.why-dot:hover { scale: 1.06; border-color: var(--accent); }
.why-dot.is-active { background: var(--band); border-color: var(--band-accent); color: var(--on-band); scale: 1.05; box-shadow: 0 24px 44px -22px rgba(21, 19, 58, 0.7), 0 0 0 6px rgba(255, 196, 107, 0.18); }
.why-dot.is-active .n { color: var(--band-accent); }
.why-dot:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
@keyframes why-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.why-panel { min-height: 220px; padding: clamp(24px, 3vw, 40px); border-radius: 24px; background: var(--accent-soft); border: 1px solid var(--line); }
.why-panel .n { font-family: var(--font-head); font-weight: 700; color: var(--accent); letter-spacing: 0.06em; }
.why-panel h3 { margin-block: 8px 12px; font-size: var(--step-2); line-height: 1.2; }
.why-panel p { color: var(--muted); font-size: var(--step-0); }
.js .why-panel-in { animation: rise .5s var(--ease) both; }
.js .why-cell.reveal { transform: scale(0.8) translateY(16px); }
.js .why-cell.reveal.in { transform: none; }
@media (max-width: 960px) {
  .why-layout { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .why-dot { font-size: 0.95rem; padding: 10%; }
}
@media (prefers-reduced-motion: reduce) {
  .why-dot { animation: none; }
  .js .why-panel-in { animation: none; }
  .js .why-cell.reveal { transform: none; }
}

/* orbit layout (desktop): six circles around a portrait */
.why-orbit { position: relative; width: min(100%, 560px); aspect-ratio: 1; justify-self: center; }
.why-orbit::before, .why-orbit::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.why-orbit::before { inset: 12%; border: 1.5px solid var(--line); }
.why-orbit::after { inset: 4%; border: 1.5px dashed var(--line); animation: why-spin 80s linear infinite; }
@keyframes why-spin { to { rotate: 360deg; } }
.why-center {
  position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: var(--band); padding: 6px; box-shadow: 0 0 0 8px rgba(255, 196, 107, 0.2);
  animation: why-pulse 4s ease-in-out infinite;
}
.why-center img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: center 18%; background: #f3ead6; }
@keyframes why-pulse { 0%, 100% { box-shadow: 0 0 0 8px rgba(255, 196, 107, 0.2); } 50% { box-shadow: 0 0 0 20px rgba(255, 196, 107, 0.05); } }
.why-orbit .why-grid { display: block; position: absolute; inset: 0; }
.why-orbit .why-cell { position: absolute; left: var(--x); top: var(--y); width: 24%; translate: -50% -50%; }
.why-orbit .why-dot { padding: 10%; font-size: clamp(0.72rem, 0.55rem + 0.4vw, 0.9rem); }
.why-orbit .why-dot .n { font-size: clamp(0.95rem, 0.8rem + 0.5vw, 1.25rem); }
@media (max-width: 960px) {
  .why-orbit { width: 100%; aspect-ratio: auto; }
  .why-orbit::before, .why-orbit::after, .why-center { display: none; }
  .why-orbit .why-grid { display: grid; position: static; }
  .why-orbit .why-cell { position: static; width: auto; translate: none; }
  .why-orbit .why-dot { padding: 10%; font-size: 0.95rem; }
  .why-orbit .why-dot .n { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .why-orbit::after, .why-center { animation: none; }
}
.why-orbit::before, .why-orbit::after { z-index: 0; }
.why-orbit .why-grid, .why-center { z-index: 1; }

/* ---------- Why panel v2: dark card matching the active circle ---------- */
.why-layout { align-items: stretch; }
.why-panel {
  position: relative; overflow: hidden; display: flex; align-items: center; min-height: 0;
  padding: clamp(28px, 4vw, 56px); border-radius: 28px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, #15133a 0%, #2a2858 100%); color: var(--on-band);
  box-shadow: 0 30px 60px -36px rgba(21, 19, 58, 0.7);
}
.why-panel::before {
  content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 107, 0.28), transparent 70%); pointer-events: none;
}
.why-panel-in { position: relative; z-index: 1; width: 100%; }
.why-panel .n {
  display: block; font-family: var(--font-head); font-weight: 800; font-size: clamp(3.5rem, 2.5rem + 4vw, 6rem); line-height: 1;
  color: var(--band-accent); letter-spacing: -0.04em; margin-block-end: 18px;
}
.why-panel .n::after { content: ""; display: block; width: 48px; height: 3px; margin-block-start: 18px; border-radius: 2px; background: var(--band-accent); opacity: 0.7; }
.why-panel h3 { color: var(--on-band); font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); line-height: 1.15; margin-block: 0 14px; }
.why-panel p { color: var(--on-band-muted); font-size: var(--step-1); line-height: 1.6; max-width: 36ch; }
@media (max-width: 960px) { .why-layout { align-items: start; } .why-panel .n { font-size: 3.2rem; } }

/* Why orbit v2: circles revolve slowly around the portrait; labels stay upright */
@keyframes why-orbit { to { rotate: 360deg; } }
@keyframes why-orbit-rev { to { rotate: -360deg; } }
.why-orbit .why-grid { animation: why-orbit 120s linear infinite; }
.why-orbit .why-cell { animation: why-orbit-rev 120s linear infinite; }
.why-orbit:hover .why-grid, .why-orbit:hover .why-cell,
.why-orbit:focus-within .why-grid, .why-orbit:focus-within .why-cell { animation-play-state: paused; }
@media (max-width: 960px) {
  .why-orbit .why-grid, .why-orbit .why-cell { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .why-orbit .why-grid, .why-orbit .why-cell { animation: none; }
}

/* ===== Gallery v2: curated mosaic (replaces the masonry columns) ===== */
.gallery, .gallery.cols-2, .gallery.cols-4 {
  --row: clamp(96px, 13vw, 168px);
  columns: auto; counter-reset: g;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: var(--row);
  gap: 10px; margin-block-start: 32px;
}
.feature .gallery { --row: clamp(84px, 9.5vw, 124px); }
.gallery figure { position: relative; margin: 0; break-inside: auto; min-height: 0; overflow: hidden; border-radius: 14px; background: var(--line); counter-increment: g; grid-column: span 4; grid-row: span 1; }
.gallery button { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; box-shadow: none; transform: none; }
.gallery button:hover { transform: none; box-shadow: none; }
.gallery img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; transition: transform .9s var(--ease), filter .5s var(--ease); }
.gallery button:hover img { transform: scale(1.07); }
.gallery button::after { background: linear-gradient(180deg, rgba(8, 7, 23, 0) 40%, rgba(8, 7, 23, 0.78)); opacity: 0.0; }
.gallery figure:hover button::after, .gallery button:focus-visible::after { opacity: 1; }
/* numbered label */
.gallery figure::before { content: counter(g, decimal-leading-zero); position: absolute; z-index: 2; inset-block-start: 10px; inset-inline-start: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: #15133a; font: 700 0.72rem/1.4 var(--font-head); letter-spacing: 0.06em; pointer-events: none; }
/* caption slides up over the photo */
.gallery figcaption, .case .gallery figcaption { position: absolute; z-index: 2; inset-inline: 0; inset-block-end: 0; margin: 0; padding: 28px 14px 12px; color: #fff; font-size: 0.82rem; line-height: 1.35; pointer-events: none; translate: 0 8px; opacity: 0; transition: opacity .4s var(--ease), translate .4s var(--ease); }
.gallery figure:hover figcaption, .gallery figure:focus-within figcaption { opacity: 1; translate: 0 0; }
/* expand cue */
.gallery figure::after { content: ""; position: absolute; z-index: 2; inset-block-start: 10px; inset-inline-end: 10px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315133a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 14px no-repeat; opacity: 0; scale: .8; transition: opacity .35s var(--ease), scale .35s var(--ease); pointer-events: none; }
.gallery figure:hover::after { opacity: 1; scale: 1; }
/* spotlight: dim the others while one is hovered */
@media (hover: hover) and (pointer: fine) {
  .gallery:hover figure:not(:hover) img { filter: brightness(0.72) saturate(0.85); }
}
/* layouts by number of photos (12-column mosaic) */
.gallery:has(> figure:nth-child(2):last-child) figure { grid-column: span 6; grid-row: span 2; }
.gallery:has(> figure:nth-child(3):last-child) figure:nth-child(1) { grid-column: span 7; grid-row: span 2; }
.gallery:has(> figure:nth-child(3):last-child) figure:nth-child(n+2) { grid-column: span 5; }
.gallery:has(> figure:nth-child(4):last-child) figure:nth-child(1) { grid-column: span 6; grid-row: span 2; }
.gallery:has(> figure:nth-child(4):last-child) figure:nth-child(2) { grid-column: span 6; }
.gallery:has(> figure:nth-child(4):last-child) figure:nth-child(n+3) { grid-column: span 3; }
.gallery:has(> figure:nth-child(5):last-child) figure:nth-child(1) { grid-column: span 6; grid-row: span 2; }
.gallery:has(> figure:nth-child(5):last-child) figure:nth-child(n+2) { grid-column: span 3; }
.gallery:has(> figure:nth-child(6):last-child) figure:nth-child(1) { grid-column: span 8; grid-row: span 2; }
.gallery:has(> figure:nth-child(6):last-child) figure:nth-child(2),
.gallery:has(> figure:nth-child(6):last-child) figure:nth-child(3) { grid-column: span 4; }
.js .gallery figure.reveal { transform: translateY(28px) scale(0.97); }
.js .gallery figure.reveal.in { transform: none; }
@media (max-width: 640px) {
  .gallery, .gallery.cols-2, .gallery.cols-4 { --row: clamp(120px, 38vw, 200px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery figure, .gallery figure:nth-child(n) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery:has(> figure:nth-child(odd):last-child) figure:nth-child(1) { grid-column: span 2 !important; }
  .gallery figcaption, .case .gallery figcaption { opacity: 1; translate: 0 0; font-size: 0.74rem; padding: 22px 10px 8px; background: linear-gradient(180deg, transparent, rgba(8, 7, 23, 0.7)); }
}
@media (hover: none) {
  .gallery figcaption, .case .gallery figcaption { opacity: 1; translate: 0 0; background: linear-gradient(180deg, transparent, rgba(8, 7, 23, 0.7)); }
}
@media (prefers-reduced-motion: reduce) {
  .gallery img, .gallery figcaption, .gallery figure::after { transition: none; }
  .gallery button:hover img { transform: none; }
}

/* ===== Gallery v3: curtain reveal, expanding panels, lightbox morph ===== */
.js .gallery figure.reveal button { clip-path: inset(0 0 100% 0 round 14px); transition: clip-path 1.1s cubic-bezier(.77, 0, .175, 1) var(--d, 0s); }
.js .gallery figure.reveal.in button { clip-path: inset(0 0 0 0 round 14px); }
.js .gallery figure.reveal:not(.in) img { scale: 1.3; }
.gallery img { transition: transform .9s var(--ease), filter .5s var(--ease), scale 1.5s cubic-bezier(.22, 1, .36, 1) var(--d, 0s); }
.js .gallery figure.reveal.settled button { clip-path: none; }

/* Expanding panels: idle = justified row (width follows each photo's ratio); hover/focus = that photo takes the stage */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .gallery, .gallery.cols-2, .gallery.cols-4 { display: flex; gap: 0; margin-inline: -5px; height: clamp(300px, 31vw, 420px); }
  .feature .gallery, .timeline .gallery { height: clamp(220px, 25vw, 300px); }
  .gallery figure, .gallery figure:nth-child(n) {
    flex: var(--ar, 1.3) 1 0; min-width: 0; grid-column: auto; grid-row: auto;
    padding: 0; border-radius: 0; background: none; overflow: visible;
    transition: flex-grow .9s cubic-bezier(.22, 1, .36, 1);
  }
  .js .gallery figure.reveal.settled { transition: flex-grow .9s cubic-bezier(.22, 1, .36, 1), opacity .5s var(--ease); }
  .gallery button { inset: 0 5px; width: auto; height: auto; border-radius: 14px; background: var(--line); }
  .gallery figure::before { inset-inline-start: 15px; }
  .gallery figure::after { inset-inline-end: 15px; }
  .gallery figcaption, .case .gallery figcaption { inset-inline: 5px; border-radius: 0 0 14px 14px; font-size: 0.9rem; }
  .gallery figure:hover, .gallery figure:focus-within { flex-grow: calc(var(--ar, 1.3) * 6); }
  .gallery:has(figure:hover) figure:not(:hover), .gallery:has(figure:focus-within) figure:not(:focus-within) { opacity: 0.45; }
  .gallery:hover figure:not(:hover) img { filter: brightness(0.8) saturate(0.7); }
  /* narrow panels: keep only the number */
  .gallery:has(figure:hover) figure:not(:hover)::before { opacity: 0; }
  .gallery figure::before { transition: opacity .3s var(--ease); }
}

/* Lightbox: smooth open + shared-element morph from the thumbnail */
dialog.lightbox[open]::backdrop { animation: lb-fade .45s var(--ease) both; }
@keyframes lb-fade { from { opacity: 0; } }
dialog.lightbox[open] #lbImg { view-transition-name: lbimg; }
::view-transition-group(lbimg) { animation-duration: .65s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(lbimg), ::view-transition-new(lbimg) { height: 100%; object-fit: cover; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }
@media (prefers-reduced-motion: reduce) {
  .js .gallery figure.reveal button { clip-path: none; transition: none; }
  .js .gallery figure.reveal:not(.in) img { scale: none; }
  .gallery figure { transition: none !important; }
}


/* ===== Manual theme: the toggle in the header sets data-theme on <html>; no attribute = follow the system ===== */
:root[data-theme="dark"] {
  --ink: #f1f0fa;
  --ink-2: #d6d4ec;
  --paper: #0e0d22;
  --surface: #171634;
  --line: #2d2b55;
  --muted: #aeacce;
  --accent: #a5a8ff;
  --accent-strong: #c7c9ff;
  --accent-soft: #242360;
  --on-accent: #0e0d2e;
  --band: #080717;
  --focus: #c7c9ff;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
body, .site-header, .card, .why-orbit .why-dot, .gallery figure { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease); }
.theme-toggle {
  min-height: 44px; min-width: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .25s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s var(--ease), opacity .3s var(--ease); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.theme-toggle:active svg { transform: rotate(40deg) scale(.9); }

/* ===== Fixes: timeline bar gets its own gutter; larger Why circles ===== */
.t-item::before { inset-inline-start: -22px; border-radius: 2px; }
@media (max-width: 960px) { .t-item::before { inset-inline-start: -14px; } }
.why-orbit { width: min(100%, 620px); }
.why-orbit .why-cell { width: 28%; }
.why-orbit .why-dot { font-size: clamp(0.78rem, 0.6rem + 0.45vw, 1rem); }
.why-orbit .why-dot .n { font-size: clamp(1.05rem, 0.85rem + 0.55vw, 1.45rem); }
@media (max-width: 960px) { .why-orbit { width: 100%; } .why-orbit .why-cell { width: auto; } }

/* ===== Floating WhatsApp button ===== */
.wa-float {
  position: fixed; z-index: 60; inset-block-end: clamp(16px, 3vw, 28px); inset-inline-end: clamp(16px, 3vw, 28px);
  display: flex; align-items: center; gap: 12px; text-decoration: none; cursor: pointer;
  opacity: 0; translate: 0 16px; scale: .9; pointer-events: none;
  transition: opacity .4s var(--ease), translate .5s cubic-bezier(.22, 1, .36, 1), scale .5s cubic-bezier(.22, 1, .36, 1);
}
.wa-float.is-shown { opacity: 1; translate: 0 0; scale: 1; pointer-events: auto; }
.wa-btn {
  position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: #25d366; color: #fff; box-shadow: 0 14px 30px -10px rgba(21, 19, 58, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.wa-btn svg { width: 30px; height: 30px; }
.wa-btn::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #25d366; z-index: -1; animation: wa-ring 2.8s ease-out infinite; }
@keyframes wa-ring { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
.wa-label {
  padding: 10px 16px; border-radius: 999px; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  font-weight: 600; font-size: 0.9rem; white-space: nowrap; box-shadow: 0 10px 24px -14px rgba(21, 19, 58, 0.5);
  opacity: 0; translate: 10px 0; pointer-events: none; transition: opacity .3s var(--ease), translate .35s var(--ease);
}
[dir="rtl"] .wa-label { translate: -10px 0; }
.wa-float:hover .wa-label, .wa-float:focus-visible .wa-label { opacity: 1; translate: 0 0; }
.wa-float:hover .wa-btn { transform: scale(1.08); box-shadow: 0 18px 34px -10px rgba(37, 211, 102, 0.55); }
.wa-float:focus-visible { outline: none; }
.wa-float:focus-visible .wa-btn { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 640px) { .wa-btn { width: 54px; height: 54px; } .wa-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .wa-btn::before { animation: none; display: none; } .wa-float { transition: opacity .2s; translate: 0 0; scale: 1; } }
@media print { .wa-float { display: none !important; } }
