/* ============================================================
   Basam Al Manea — Portfolio styles
   Heritage minimalism: cream / charcoal / terracotta / bronze.
   ============================================================ */
:root {
  --cream: #f0ece3;
  --cream-2: #f7f4ec;
  --ink: #1a1713;
  --charcoal: #141312;
  --charcoal-2: #1d1b19;
  --terracotta: #a44a24;
  --bronze: #a98142;
  --teal: #23574e;
  --line: #d9d2c3;
  --line-dark: #37332e;
  --muted: #6f6a60;
  --muted-dark: #a39d92;
  --font-display: 'Archivo', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-body: 'Manrope', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --scrim: 240 236 227;
  --wa: 37 211 102;   /* WhatsApp brand green */
  --glass: 255 253 248;
  --glass-edge: 26 23 19;
  --glass-hi: 26 23 19;
}
html[lang="ar"] {
  --font-display: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s var(--ease-out), color 0.6s var(--ease-out);
  touch-action: manipulation;
}
body[data-tone="dark"] {
  background: var(--charcoal); color: var(--cream-2);
  --scrim: 20 19 18;
  --glass: 38 35 32; --glass-edge: 247 244 236; --glass-hi: 247 244 236;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; }
.loader-logo {
  width: clamp(6rem, 16vw, 8.5rem); height: auto;
  margin: 0 auto 1.6rem;
}
.loader-bar {
  width: 9rem; height: 2px; margin: 0 auto;
  background: var(--line); overflow: hidden;
}
.loader-bar span {
  display: block; height: 100%; width: 40%;
  background: var(--terracotta);
  animation: loadslide 1.1s ease-in-out infinite;
}
@keyframes loadslide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(350%); }
}

/* ---------- fixed chrome ---------- */
.chrome {
  position: fixed; inset-inline: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: clamp(1.2rem, 4vw, 3rem);
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
.chrome-top { top: 0; padding-block: 1.1rem; }
/* same treatment at the top, so the brand never sits flat on a photograph */
.chrome-top::before {
  content: ''; position: absolute; inset-inline: 0; top: 0;
  height: 5rem; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom,
    rgb(var(--scrim) / 0.92) 18%, rgb(var(--scrim) / 0.6) 55%, rgb(var(--scrim) / 0));
}
.chrome-bottom { bottom: 0; padding-block: 1rem; }
/* scrolling content dissolves under the bottom navigation rather than colliding with it */
.chrome-bottom::before {
  content: ''; position: absolute; inset-inline: 0; bottom: 0;
  height: 5.5rem; z-index: -1; pointer-events: none;
  background: linear-gradient(to top,
    rgb(var(--scrim)) 22%, rgb(var(--scrim) / 0.82) 52%, rgb(var(--scrim) / 0));
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-img {
  height: clamp(1.35rem, 2.6vw, 1.75rem); width: auto;
  transition: filter 0.6s var(--ease-out);
}
/* dark slides: knock the ink logo out to light so it stays legible */
body[data-tone="dark"] .brand-img { filter: brightness(0) invert(1); }
.brand-text {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.02rem; letter-spacing: 0.14em;
}
.brand-text em { font-style: normal; font-weight: 400; margin-inline-start: 0.45em; }

/* ---------- floating dock ---------- */
/* Apple-style glass: a real backdrop blur with saturation lift, a hairline
   edge, and light caught along the top. One highlight slides between items —
   per-item fills collided into a single blob once an item was magnified. */
.dock {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.05rem;
  padding: 0.34rem;
  border-radius: 999px;
  background: rgb(var(--glass) / 0.5);
  border: 1px solid rgb(var(--glass-edge) / 0.13);
  box-shadow:
    0 1px 0 0 rgb(var(--glass-hi) / 0.5) inset,
    0 0 0 0.5px rgb(var(--glass-edge) / 0.06),
    0 12px 32px -14px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  transition: background 0.6s var(--ease-out), border-color 0.6s var(--ease-out);
}
.dock[hidden] { display: none; }

.dock-ind {
  position: absolute; left: 0; top: 0.34rem; bottom: 0.34rem;
  width: 0; opacity: 0;
  border-radius: 999px;
  background: rgb(var(--glass-hi) / 0.11);
  box-shadow: 0 1px 0 0 rgb(var(--glass-hi) / 0.22) inset;
  pointer-events: none;
  /* a touch of overshoot so it settles rather than stops dead */
  transition:
    transform 0.52s cubic-bezier(0.32, 1.14, 0.52, 1),
    width 0.52s cubic-bezier(0.32, 1.14, 0.52, 1),
    opacity 0.3s var(--ease-out);
}

.dock-item {
  --mag: 1; --lift: 0px;
  position: relative; z-index: 1;
  background: none; border: 0;
  padding: 0.58rem 1.05rem;
  border-radius: 999px;
  color: inherit;
  min-height: 40px;
  transition: color 0.35s var(--ease-out);
}
.dock-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
  /* the label carries the magnification; the highlight never scales */
  transform: scale(var(--mag)) translateY(var(--lift));
  transition: transform 0.34s var(--ease-out);
  will-change: transform;
}
html[lang="ar"] .dock-label { letter-spacing: 0; font-size: 0.8rem; }
.dock-item.active { color: var(--terracotta); }
body[data-tone="dark"] .dock-item.active { color: var(--bronze); }
.dock-item:active .dock-label { transform: scale(calc(var(--mag) * 0.95)) translateY(var(--lift)); }

.chrome-actions { display: flex; align-items: center; gap: 0.9rem; }
.lang-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; min-width: 60px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--glass-edge) / 0.13);
  background: rgb(var(--glass) / 0.5);
  box-shadow:
    0 1px 0 rgb(var(--glass-hi) / 0.5) inset,
    0 0 0 0.5px rgb(var(--glass-edge) / 0.06),
    0 10px 26px -14px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  color: inherit;
  font-family: var(--font-display);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out),
    border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.lang-btn:hover, .lang-btn:focus-visible {
  color: var(--terracotta);
  background: rgb(var(--glass-hi) / 0.11);
  border-color: rgb(var(--glass-edge) / 0.22);
  transform: translateY(-1px);
}
body[data-tone="dark"] .lang-btn:hover,
body[data-tone="dark"] .lang-btn:focus-visible { color: var(--bronze); }
.lang-btn:active { transform: scale(0.97); }
html[lang="ar"] .lang-btn { letter-spacing: 0; font-size: 0.84rem; }
.menu-btn {
  background: none; border: 0; width: 44px; height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
}
.menu-btn span {
  display: block; width: 26px; height: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out);
}
.menu-btn.open span:first-child { transform: translateY(4.5px) rotate(45deg); }
.menu-btn.open span:last-child { transform: translateY(-4.5px) rotate(-45deg); }

.scroll-hint {
  display: flex; align-items: center; gap: 0.7rem;
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s;
}
body[data-tone="dark"] .scroll-hint { color: var(--muted-dark); }
.hint-line { width: 3.4rem; height: 1px; background: currentColor; position: relative; overflow: hidden; }
.hint-line::after {
  content: ''; position: absolute; inset: 0;
  background: var(--terracotta);
  animation: hintslide 2s ease-in-out infinite;
}
@keyframes hintslide {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}
html[dir="rtl"] .hint-line::after { animation-name: hintslide-rtl; }
@keyframes hintslide-rtl {
  0% { transform: translateX(100%); }
  60%, 100% { transform: translateX(-100%); }
}

.progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 70;
  background: transparent;
}
.progress span {
  display: block; height: 100%;
  background: var(--terracotta);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 0.5s var(--ease-out);
}
html[dir="rtl"] .progress span { transform-origin: 100% 50%; }

/* ---------- dots nav ---------- */
.dots {
  position: fixed; inset-inline-end: clamp(0.7rem, 2vw, 1.6rem); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.65rem; z-index: 60;
}
.dots button {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid currentColor; background: transparent;
  color: var(--muted);
  padding: 0; position: relative;
  transition: background 0.25s, transform 0.25s, color 0.25s;
}
body[data-tone="dark"] .dots button { color: var(--muted-dark); }
.dots button.active {
  background: var(--terracotta); border-color: var(--terracotta);
  color: var(--terracotta);
  transform: scale(1.25);
}
.dots button::after {
  content: attr(data-label);
  position: absolute; inset-inline-end: 1.5rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap; color: inherit;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.dots button:hover::after { opacity: 1; }

/* ---------- menu overlay ---------- */
.menu-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--charcoal) 96%, transparent);
  color: var(--cream-2);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s var(--ease-out), visibility 0.4s;
}
.menu-overlay.open { opacity: 1; visibility: visible; }
.menu-list {
  display: flex; flex-direction: column; gap: 0.15rem;
  max-height: 82dvh; overflow-y: auto;
  padding: 1rem 2rem;
}
.menu-list a {
  display: flex; align-items: baseline; gap: 1.2rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.6vh, 2rem);
  font-weight: 700; letter-spacing: 0.02em;
  padding: 0.32rem 0.4rem;
  color: var(--muted-dark);
  transition: color 0.2s, transform 0.25s var(--ease-out);
}
.menu-list a:hover, .menu-list a.active { color: var(--cream-2); transform: translateX(0.4rem); }
html[dir="rtl"] .menu-list a:hover, html[dir="rtl"] .menu-list a.active { transform: translateX(-0.4rem); }
.menu-list a.active .m-num { color: var(--terracotta); }
.m-num { font-size: 0.75em; font-weight: 500; color: var(--bronze); min-width: 2.2em; }

/* ---------- backdrop stage ---------- */
/* One full-bleed render per slide (backdrop.js swaps them with a directional
   wipe). The hero shows the image at full presence; content slides pull it
   back so the type leads; dark slides let it glow through the charcoal. */
.stage {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden;
  perspective: 1200px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s var(--ease-out);
}
/* the scrim is directional (heavy under the type, open on the far side), so
   the image can sit higher than it looks — the extra light lands where the
   column of text is not */
body:not([data-slide="0"]) .stage { opacity: 0.46; }
body[data-tone="dark"] .stage { opacity: 0.58; }
.stage-tilt {
  /* oversized so the pointer tilt and drift never expose an edge */
  position: absolute; inset: -4%;
  transform-style: preserve-3d;
  will-change: transform;
}
.stage-layer { position: absolute; inset: 0; opacity: 0; }
.stage-layer.show, .stage-layer.out {
  transition: clip-path 1.05s var(--ease-out), transform 1.05s var(--ease-out),
              opacity 0.9s var(--ease-out);
}
.stage-layer.enter-down { clip-path: inset(100% 0 0 0); transform: translateY(2.5%) scale(1.06); opacity: 1; }
.stage-layer.enter-up   { clip-path: inset(0 0 100% 0); transform: translateY(-2.5%) scale(1.06); opacity: 1; }
.stage-layer.show { clip-path: inset(0 0 0 0); transform: translateY(0) scale(1); opacity: 1; }
.stage-layer.out  { opacity: 0; transform: scale(1.045); }
.stage-photo { position: absolute; inset: 0; will-change: transform; }
.stage-pan {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  animation: kenburns 16s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.07); } }
.bg-scrim {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to bottom,
      rgb(var(--scrim) / 0.92) 0%,
      rgb(var(--scrim) / 0.30) 24%,
      rgb(var(--scrim) / 0.30) 60%,
      rgb(var(--scrim) / 0.92) 100%),
    linear-gradient(to right,
      rgb(var(--scrim) / 0.88) 0%,
      rgb(var(--scrim) / 0.62) 38%,
      rgb(var(--scrim) / 0.10) 78%);
  transition: background 0.6s var(--ease-out);
}
html[dir="rtl"] .bg-scrim {
  background:
    linear-gradient(to bottom,
      rgb(var(--scrim) / 0.92) 0%,
      rgb(var(--scrim) / 0.30) 24%,
      rgb(var(--scrim) / 0.30) 60%,
      rgb(var(--scrim) / 0.92) 100%),
    linear-gradient(to left,
      rgb(var(--scrim) / 0.88) 0%,
      rgb(var(--scrim) / 0.62) 38%,
      rgb(var(--scrim) / 0.10) 78%);
}


/* ---------- deck & slides ---------- */
#deck { position: relative; z-index: 10; height: 100dvh; }
.slide {
  position: absolute; inset: 0;
  visibility: hidden; pointer-events: none;
}
.slide.active { visibility: visible; pointer-events: auto; }
.slide-inner {
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(5.2rem, 11vh, 7.5rem) clamp(1.4rem, 6vw, 5rem) clamp(4rem, 9vh, 5.5rem);
  display: flex; flex-direction: column;
}
/* Auto margins centre a slide that fits and collapse to 0 on one that
   doesn't, so overflow only runs downward where scrolling can reach it.
   justify-content: center would push half of it above the top edge. */
.slide-inner > :first-child { margin-block-start: auto; }
.slide-inner > :last-child { margin-block-end: auto; }
.slide[data-tone="dark"] { color: var(--cream-2); }

/* ---------- shared type ---------- */
.label {
  font-family: var(--font-display);
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: clamp(0.9rem, 2.4vh, 1.6rem);
}
.slide[data-tone="dark"] .label { color: var(--bronze); }
.mini-label {
  font-family: var(--font-display);
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.55rem;
}
.slide[data-tone="dark"] .mini-label { color: var(--muted-dark); }
.gap-top { margin-top: clamp(1.4rem, 3.5vh, 2.4rem); }
.h-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5.4vw, 4rem);
  line-height: 1.06; letter-spacing: -0.015em;
  margin-bottom: clamp(1.1rem, 3vh, 2rem);
  max-width: 18ch;
}
html[lang="ar"] .h-display { letter-spacing: 0; line-height: 1.25; }
.body-text {
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.15vw, 1.06rem);
  margin-bottom: 1rem;
}
.slide[data-tone="dark"] .body-text { color: var(--muted-dark); }
.rule {
  height: 1px; background: var(--line);
  margin-block: clamp(1.2rem, 3vh, 2rem);
  transform-origin: 0 50%;
}
html[dir="rtl"] .rule { transform-origin: 100% 50%; }
.slide[data-tone="dark"] .rule { background: var(--line-dark); }

/* ---------- hero ---------- */
.hero-wrap { display: flex; flex-direction: column; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.2rem, 12.5vw, 9.5rem);
  line-height: 0.95; letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-block: 0.4rem 1.6rem;
}
html[lang="ar"] .hero-title { line-height: 1.15; letter-spacing: 0; font-weight: 700; }
.hero-title span { display: block; }
.hero-title span:last-child { color: transparent; -webkit-text-stroke: 2px var(--ink); }
html[lang="ar"] .hero-title span:last-child { color: var(--terracotta); -webkit-text-stroke: 0; }
.hero-meta { max-width: 46rem; }
.hero-role {
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: 0.28em; font-size: 0.85rem;
  color: var(--bronze);
  margin-bottom: 0.5rem;
}
.hero-subtitle { color: var(--muted); font-size: clamp(0.95rem, 1.2vw, 1.1rem); }
.hero-loc { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; margin-top: 0.35rem; }
.hero-stats {
  display: grid; grid-template-columns: repeat(4, auto);
  gap: clamp(1.4rem, 4.5vw, 4rem);
  justify-content: start;
  margin-top: clamp(1.8rem, 5.5vh, 3.6rem);
  padding-top: clamp(1rem, 2.6vh, 1.7rem);
  border-top: 1px solid var(--line);
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 800; font-size: clamp(1.35rem, 2.6vw, 2.1rem);
  letter-spacing: -0.01em;
}
.stat-label { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- profile ---------- */
.two-col {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.col-photo {
  justify-self: end;
  max-width: min(24rem, 100%);
  border: 1px solid var(--line);
  padding: 0.7rem;
  background: var(--cream-2);
}
html[dir="rtl"] .col-photo { justify-self: start; }
.col-photo img { width: 100%; height: auto; filter: saturate(0.92); }
.info-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 3vw, 2.6rem); }
.info-line { font-size: 0.95rem; margin-bottom: 0.3rem; }
.info-line a { text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color 0.2s; }
.info-line a:hover { border-color: var(--terracotta); }
.profile-contact-list { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.45rem; }
.profile-contact-row {
  display: grid; grid-template-columns: minmax(5rem, 0.7fr) minmax(0, 1.3fr);
  align-items: baseline; gap: 0.65rem;
}
.profile-contact-label {
  color: var(--terracotta);
  font-family: var(--font-display);
  font-size: 0.58rem; font-weight: 600; line-height: 1.35;
  letter-spacing: 0.09em; text-transform: uppercase;
}
html[lang="ar"] .profile-contact-label { letter-spacing: 0; text-transform: none; }

/* ---------- experience ---------- */
.cv-grid {
  display: grid; grid-template-columns: 1.35fr 1fr 0.8fr;
  gap: clamp(1.6rem, 4vw, 3.6rem);
  margin-top: clamp(0.6rem, 2vh, 1.4rem);
}
.job { margin-bottom: clamp(1.2rem, 3vh, 2rem); }
.job-company {
  font-family: var(--font-display);
  font-size: 1.02rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em; margin-bottom: 0.25rem;
}
.job-role { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }
.job-period { white-space: nowrap; }
.job-point { font-size: 0.92rem; color: var(--muted); margin-bottom: 0.4rem; max-width: 48ch; }
.cv-strong { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.3rem; }
.cv-muted { font-size: 0.9rem; color: var(--muted); }

/* ---------- works index: direction-aware cards ---------- */
.works-wrap {
  /* 74rem keeps both rows of six on screen at a normal laptop height; wider
     than this and the cards grow until the second row needs scrolling */
  width: min(100%, 74rem);
  margin-inline: auto;
}
/* the index heading is a signpost, not a hero - keeping it smaller buys the
   second row of cards enough room to land on screen */
.works-wrap .h-display {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  margin-bottom: clamp(0.8rem, 2vh, 1.3rem);
}
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.7vw, 1.25rem);
  margin-top: clamp(0.6rem, 2vh, 1.4rem);
}
.work-card {
  position: relative; display: block; width: 100%;
  background: none; border: 0; padding: 0;
  color: inherit; text-align: start;
}
.wc-frame {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 3 / 2;
  background: var(--charcoal-2);
  border: 1px solid var(--line-dark);
  transition: transform 0.2s var(--ease-out);
}
.work-card:active .wc-frame { transform: scale(0.986); }
.wc-img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(0.88) brightness(0.9);
  transition: transform 0.7s var(--ease-out), filter 0.45s var(--ease-out);
}
.work-card:hover .wc-img,
.work-card:focus-visible .wc-img { transform: scale(1.06); filter: saturate(1) brightness(1); }

/* the veil parks off the edge the pointer crossed, then slides over the image */
.wc-veil {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--charcoal) 72%, transparent);
  opacity: 0;
  transition: transform 0.55s var(--ease-out), opacity 0.35s var(--ease-out);
  will-change: transform;
}
.work-card[data-from="top"]    .wc-veil { transform: translateY(-100%); }
.work-card[data-from="right"]  .wc-veil { transform: translateX(100%); }
.work-card[data-from="bottom"] .wc-veil { transform: translateY(100%); }
.work-card[data-from="left"]   .wc-veil { transform: translateX(-100%); }
.work-card.hovered .wc-veil { transform: translate(0, 0); opacity: 1; }

.wc-cta {
  font-family: var(--font-display);
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--cream-2);
  border-bottom: 1px solid var(--bronze);
  padding-bottom: 0.35rem;
  opacity: 0; transform: translateY(9px);
  transition: opacity 0.4s 0.1s var(--ease-out), transform 0.4s 0.1s var(--ease-out);
}
.work-card.hovered .wc-cta { opacity: 1; transform: translateY(0); }

@media (hover: none) {
  .wc-veil {
    opacity: 1; transform: none; background: none;
    align-items: flex-end; justify-content: flex-start;
    padding: 0.7rem;
  }
  .wc-cta {
    opacity: 1; transform: none;
    font-size: 0.6rem; letter-spacing: 0.18em;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--bronze); border-bottom-width: 1px;
    background: color-mix(in srgb, var(--charcoal) 74%, transparent);
  }
}

.wc-cap {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.8rem 0.15rem 0;
}
.wc-head { display: flex; align-items: baseline; gap: 0.6rem; }
.wc-sum {
  font-size: 0.83rem; line-height: 1.55;
  color: var(--muted-dark);
  /* two lines keeps every card the same height; the full text is on the slide */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.wc-num {
  font-family: var(--font-display);
  font-size: 0.7rem; font-weight: 600; color: var(--bronze);
}
.wc-title {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.5vw, 1.18rem);
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em;
  transition: color 0.25s;
}
html[lang="ar"] .wc-title { font-weight: 700; }
.work-card:hover .wc-title, .work-card:focus-visible .wc-title { color: var(--bronze); }
.wc-meta {
  margin-inline-start: auto;
  font-size: 0.67rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-dark);
  white-space: nowrap;
}

/* ---------- certifications ---------- */
.cert-wrap {
  position: relative;
  width: min(100%, 88rem);
  margin-inline: auto;
}
.cert-intro {
  position: absolute; z-index: 2;
  inset-inline-start: 0; top: 0;
  width: min(31%, 25rem);
  padding-top: 0.25rem;
}
.cert-intro .label { color: var(--bronze); }
.cert-intro .h-display {
  max-width: none;
  font-size: clamp(2.45rem, 4.2vw, 4.4rem);
  color: var(--cream-2);
}
.cert-grid {
  display: flex; flex-direction: column;
  gap: clamp(3rem, 7vh, 5.5rem);
}
.cert-card {
  display: grid; width: 100%; min-width: 0;
  grid-template-columns: minmax(16rem, 0.56fr) minmax(0, 1.44fr);
  gap: clamp(2.5rem, 5vw, 5.2rem);
  align-items: stretch;
  padding: 0; border: 0; background: none;
  color: inherit; text-align: start;
}
.cert-card:disabled { cursor: default; }
.cert-frame {
  grid-column: 2; grid-row: 1;
  justify-self: end;
  position: relative; display: flex; overflow: hidden;
  align-items: center; justify-content: center;
  aspect-ratio: 5 / 4;
  width: min(100%, calc((100dvh - 10rem) * 1.25));
  padding: clamp(0.65rem, 1.2vw, 1rem);
  border: 1px solid color-mix(in srgb, var(--bronze) 68%, var(--line-dark));
  background: #e8e2d7;
  box-shadow: 0 1.7rem 4.5rem rgba(0, 0, 0, 0.34);
  transform: rotate(0.22deg);
  transition: transform 0.55s var(--ease-out), border-color 0.3s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.cert-frame::before,
.cert-frame::after {
  content: ''; position: absolute; z-index: 2;
  width: 2.4rem; height: 2.4rem;
  pointer-events: none;
}
.cert-frame::before {
  inset-inline-start: 0.45rem; top: 0.45rem;
  border-inline-start: 1px solid var(--bronze); border-top: 1px solid var(--bronze);
}
.cert-frame::after {
  inset-inline-end: 0.45rem; bottom: 0.45rem;
  border-inline-end: 1px solid var(--bronze); border-bottom: 1px solid var(--bronze);
}
.cert-frame img {
  width: 100%; height: 100%; object-fit: contain;
  filter: saturate(0.9) contrast(1.02);
  transition: transform 0.65s var(--ease-out), filter 0.4s var(--ease-out);
}
.cert-card:not(:disabled):hover .cert-frame,
.cert-card:not(:disabled):focus-visible .cert-frame {
  transform: translateY(-6px) rotate(0deg);
  border-color: var(--bronze);
  box-shadow: 0 2.1rem 5.5rem rgba(0, 0, 0, 0.43);
}
.cert-card:not(:disabled):hover .cert-frame img,
.cert-card:not(:disabled):focus-visible .cert-frame img {
  transform: scale(1.012); filter: saturate(1) contrast(1.02);
}
.cert-view {
  position: absolute; inset-inline-end: 1rem; bottom: 1rem;
  padding: 0.55rem 0.8rem;
  background: color-mix(in srgb, var(--charcoal) 88%, transparent);
  color: var(--cream-2);
  font-family: var(--font-display); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.cert-card:hover .cert-view, .cert-card:focus-visible .cert-view { opacity: 1; transform: none; }
.cert-placeholder { color: var(--muted); font-size: 0.85rem; }
.cert-caption {
  grid-column: 1; grid-row: 1;
  align-self: end;
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0;
  padding: 0 0 clamp(1.2rem, 4vh, 2.6rem);
}
.cert-caption::before {
  content: ''; width: min(100%, 16rem); height: 1px;
  margin-bottom: clamp(1rem, 3vh, 1.8rem);
  background: linear-gradient(to right, var(--bronze), var(--line-dark));
}
html[dir="rtl"] .cert-caption::before {
  background: linear-gradient(to left, var(--bronze), var(--line-dark));
}
.cert-number {
  font-family: var(--font-display);
  font-size: clamp(3.7rem, 7vw, 7rem); font-weight: 800; line-height: 0.78;
  color: transparent; -webkit-text-stroke: 1px var(--bronze);
  opacity: 0.6; margin-bottom: clamp(1.1rem, 3vh, 1.8rem);
}
.cert-title {
  max-width: 16ch;
  font-family: var(--font-display); font-size: clamp(1.3rem, 2.2vw, 2.1rem);
  font-weight: 800; line-height: 1.08; text-transform: uppercase;
  color: var(--cream-2);
  margin-bottom: 0.7rem;
}
html[lang="ar"] .cert-title { font-weight: 700; text-transform: none; }
.cert-source {
  max-width: 28ch;
  font-size: clamp(0.82rem, 1vw, 0.95rem); line-height: 1.55;
  color: var(--muted-dark);
}
.numeric { display: inline-block; direction: ltr; unicode-bidi: isolate; }

@media (hover: none) {
  .cert-view { opacity: 1; transform: none; }
}

/* ---------- project slides ---------- */
.project-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  gap: clamp(1.6rem, 4.5vw, 4rem);
  align-items: start;
  min-height: 0;
}
.project-title { font-size: clamp(1.7rem, 3.6vw, 2.9rem); }
.project-meta {
  font-family: var(--font-display);
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.project-tagline {
  font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.9rem;
}
.media-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.media-tab {
  background: none; border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.5rem 0.95rem; min-height: 40px;
  transition: all 0.2s;
}
.media-tab:hover { border-color: var(--ink); color: var(--ink); }
.media-tab.active { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.project-media { min-width: 0; }
.media-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.4vw, 1rem);
}
.media-card {
  position: relative; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--cream-2);
  aspect-ratio: 4 / 3;
}
.media-card.span-2 { grid-column: span 2; aspect-ratio: 16 / 8.2; }
.media-card img, .media-card video {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.7s var(--ease-out), filter 0.4s;
}
.media-card:hover img, .media-card:hover video { transform: scale(1.045); }
.media-card figcaption {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 1.6rem 0.85rem 0.6rem;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: #fff;
  background: linear-gradient(to top, rgba(15, 13, 11, 0.72), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.media-card:hover figcaption, .media-card:focus-visible figcaption { opacity: 1; }
.play-badge {
  position: absolute; inset: 0; margin: auto;
  width: 3.2rem; height: 3.2rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 13, 11, 0.62); color: #fff;
  border-radius: 50%; font-size: 1rem;
  pointer-events: none;
}

/* ---------- contact ---------- */
.contact-wrap { max-width: 60rem; }
.contact-heading { font-size: clamp(2.4rem, 7vw, 5.4rem); max-width: none; }
.contact-cols {
  display: grid;
  grid-template-columns: minmax(12rem, 1.25fr) minmax(11rem, 1fr) minmax(11rem, 1fr);
  align-items: start; gap: clamp(1.2rem, 4vw, 3.4rem);
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
}
.contact-cols > * { min-width: 0; }
.contact-cols a {
  text-decoration: none; border-bottom: 1px solid var(--line-dark);
  transition: border-color 0.2s, color 0.2s;
}
.contact-cols a:hover { color: var(--bronze); border-color: var(--bronze); }
.contact-email { padding-block: 0.55rem; overflow-wrap: anywhere; }
.contact-phone-list { display: flex; flex-direction: column; gap: 0.55rem; }
.contact-phone {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.8rem; padding-block: 0.5rem;
}
.contact-phone-label {
  color: var(--bronze);
  font-family: var(--font-display);
  font-size: 0.62rem; font-weight: 600; line-height: 1.35;
  letter-spacing: 0.12em; text-transform: uppercase;
}
html[lang="ar"] .contact-phone-label { letter-spacing: 0; text-transform: none; }
.contact-location-list { display: flex; flex-direction: column; gap: 0.55rem; }
.contact-location-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.8rem; min-height: 44px; padding-block: 0.5rem;
  border-bottom: 1px solid var(--line-dark);
}
.contact-location-label {
  color: var(--bronze);
  font-family: var(--font-display);
  font-size: 0.62rem; font-weight: 600; line-height: 1.35;
  letter-spacing: 0.12em; text-transform: uppercase;
}
html[lang="ar"] .contact-location-label { letter-spacing: 0; text-transform: none; }
.phone-number {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- WhatsApp buttons ---------- */
/* One per contact number. Outlined at rest so it sits inside the cream /
   charcoal palette; it fills with the WhatsApp green on hover, where the
   brand colour earns its place as a call to action. */
.wa-row {
  display: flex; flex-wrap: wrap;
  gap: clamp(0.6rem, 1.4vw, 0.9rem);
  margin-top: clamp(1.4rem, 4vh, 2.4rem);
}
.wa-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1.15rem; min-height: 48px;
  border: 1px solid rgb(var(--wa) / 0.5);
  border-radius: 999px;
  color: var(--cream-2);
  text-decoration: none;
  transition: background 0.28s var(--ease-out), border-color 0.28s var(--ease-out),
              color 0.28s var(--ease-out), transform 0.2s var(--ease-out);
}
.wa-btn:hover, .wa-btn:focus-visible {
  background: rgb(var(--wa));
  border-color: rgb(var(--wa));
  color: var(--charcoal);
}
.wa-btn:active { transform: scale(0.975); }
.wa-icon {
  width: 1.15rem; height: 1.15rem; flex: none;
  fill: rgb(var(--wa));
  transition: fill 0.28s var(--ease-out);
}
.wa-btn:hover .wa-icon, .wa-btn:focus-visible .wa-icon { fill: var(--charcoal); }
.wa-name {
  font-family: var(--font-display);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
}
html[lang="ar"] .wa-name { letter-spacing: 0; text-transform: none; font-size: 0.85rem; }

@media (max-width: 560px) {
  .wa-row { flex-direction: column; align-items: stretch; }
  .wa-btn { justify-content: center; }
}

/* ---------- project detail view ---------- */
/* Opens over the deck from a card on the index. It brings its own bar, and
   the site chrome steps aside so the two never compete. */
.pv {
  position: fixed; inset: 0; z-index: 150;
  background: var(--cream);
  /* it opens over the dark index slide, so it must state its own ink -
     otherwise the heading inherits body[data-tone="dark"] and goes
     cream-on-cream */
  color: var(--ink);
  opacity: 0; visibility: hidden;
  transition: opacity 0.42s var(--ease-out), visibility 0.42s;
}
.pv.open { opacity: 1; visibility: visible; }
.pv-inner {
  height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(1.1rem, 3vh, 1.8rem) clamp(1.4rem, 6vw, 5rem) clamp(3rem, 8vh, 5rem);
  transform: translateY(26px);
  transition: transform 0.55s var(--ease-out);
}
.pv.open .pv-inner { transform: none; }

body.pv-open .chrome,
body.pv-open .dots,
body.pv-open .progress {
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.pv-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: clamp(1rem, 3vh, 1.8rem);
  margin-bottom: clamp(0.8rem, 2.5vh, 1.6rem);
  border-bottom: 1px solid var(--line);
}
.pv-back {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: none; border: 0; color: inherit;
  font-family: var(--font-display);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0.6rem 0.2rem; min-height: 44px;
  transition: color 0.25s;
}
.pv-back:hover { color: var(--terracotta); }
.pv-arrow { font-size: 1.1em; transition: transform 0.3s var(--ease-out); }
.pv-back:hover .pv-arrow { transform: translateX(-4px); }
html[dir="rtl"] .pv-back:hover .pv-arrow { transform: translateX(4px); }

.pv-steps { display: flex; align-items: center; gap: 0.5rem; }
.pv-count {
  font-family: var(--font-display);
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.2em;
  color: var(--muted);
  margin-inline-end: 0.4rem;
  /* "01 / 06" is a counter, not prose - bidi would flip it to "06 / 01"
     inside an RTL page, which reads as project six of one */
  direction: ltr; unicode-bidi: isolate;
}
.pv-step {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  color: inherit; font-size: 1.15rem; line-height: 1;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.pv-step:hover:not(:disabled) { border-color: var(--ink); background: var(--cream-2); }
.pv-step:disabled { opacity: 0.34; cursor: default; }

/* the detail view is its own page, so its columns start at the top */
.pv .project-wrap { align-items: start; }
.pv .media-card.span-2 { grid-column: span 2; }

@media (max-width: 1024px) {
  .pv .project-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pv .media-card.span-2 { grid-column: span 1; }
  .pv-bar { gap: 0.6rem; }
  .pv-count { margin-inline-end: 0.2rem; }
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12, 11, 10, 0.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img, .lightbox video {
  max-width: min(92vw, 1400px); max-height: 84dvh;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 2;
  background: none; border: 0; color: #fff;
  font-size: 1.7rem; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.75; transition: opacity 0.2s, transform 0.2s;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; transform: scale(1.08); }
.lb-close { top: 1rem; inset-inline-end: 1.2rem; font-size: 2.3rem; }
.lb-prev { inset-inline-start: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { inset-inline-end: 1rem; top: 50%; transform: translateY(-50%); }
.lb-caption {
  position: absolute; bottom: 1.4rem; inset-inline: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase;
}

/* ---------- error state ---------- */
.load-error { text-align: center; color: var(--muted); font-size: 1.05rem; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv-grid { grid-template-columns: 1fr 1fr; }
  .project-wrap { grid-template-columns: 1fr; gap: 1.6rem; }
  .project-info .body-text { max-width: none; }
  .slide-inner > :first-child { margin-block-start: 0; }
  .slide-inner > :last-child { margin-block-end: 0; }
}
@media (max-width: 768px) {
  .dots { display: none; }
  .dock { display: none; } /* too cramped for six labels; the menu covers it */
  .two-col { grid-template-columns: 1fr; gap: 1.8rem; }
  .col-photo { justify-self: start; max-width: 15rem; }
  .cv-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .hero-stats { grid-template-columns: repeat(2, auto); row-gap: 1.1rem; }
  .media-grid { grid-template-columns: 1fr; }
  .media-card.span-2 { grid-column: span 1; aspect-ratio: 16 / 9; }
  .media-card { aspect-ratio: 16 / 10; }
  .media-card figcaption { opacity: 1; }
  .scroll-hint span { display: none; }
  .info-cols { grid-template-columns: 1fr; }
  .cert-intro { position: static; width: auto; padding: 0; }
  .cert-intro .h-display { margin-bottom: 1rem; }
  .cert-grid { gap: 2.5rem; }
  .cert-card { grid-template-columns: 1fr; gap: 0; }
  .cert-frame {
    grid-column: 1; grid-row: 1;
    width: 100%; transform: none;
    padding: 0.5rem;
  }
  .cert-caption {
    grid-column: 1; grid-row: 2;
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.75rem; row-gap: 0.2rem;
    padding: 1rem 0.1rem 0;
  }
  .cert-caption::before { display: none; }
  .cert-number {
    grid-row: span 2;
    font-size: 0.72rem; line-height: 1.4;
    color: var(--bronze); -webkit-text-stroke: 0;
    opacity: 1; margin: 0;
  }
  .cert-title { max-width: none; font-size: 1.05rem; margin: 0; }
  .cert-source { grid-column: 2; max-width: none; font-size: 0.78rem; }
  .contact-cols { grid-template-columns: 1fr; gap: 0.8rem; }
  .contact-phone-list, .contact-location-list { gap: 0.35rem; }
  .contact-phone { min-height: 44px; }
  .profile-contact-row { grid-template-columns: minmax(5rem, 0.65fr) minmax(0, 1.35fr); }
}

/* ---------- reduced motion ---------- */
@media (max-width: 560px) {
  .work-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .wc-frame { aspect-ratio: 3 / 2; } /* shorter, so more of the list fits a phone */
  .wc-head { flex-wrap: wrap; }
  .wc-meta { margin-inline-start: 0; flex-basis: 100%; }
  .wc-sum { -webkit-line-clamp: 3; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
