/* ==========================================================================
   Ahmed Safdar — Portfolio
   Palette derived from the personal brand mark: near-black, gold, teal.
   ========================================================================== */

:root {
  --bg: #08080a;
  --bg-2: #0c0c10;
  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --text: #f2efe9;
  --dim: #98959a;
  --dim-2: #6d6a70;

  --gold: #d4a24e;
  --gold-2: #efc784;
  --teal: #17a398;
  --teal-2: #4fd6c8;

  --sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.8);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

.skip-link {
  position: absolute; inset-inline-start: -9999px; inset-block-start: 0; z-index: 999;
  background: var(--gold); color: #14100a; padding: 12px 20px; border-radius: 0 0 10px 0; font-weight: 600;
}
.skip-link:focus { inset-inline-start: 0; }

.wrap { width: min(1180px, 100% - 44px); margin-inline: auto; }

.ico { width: 20px; height: 20px; flex: none; }
.ico.xs { width: 15px; height: 15px; }

/* Editorial accent — serif italic against the sans body */
.grad {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, var(--gold-2) 0%, var(--gold) 38%, var(--teal-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ==========================================================================
   FLOATING DOCK
   ========================================================================== */

.dock-wrap {
  position: fixed; inset-block-start: 18px; inset-inline: 0; z-index: 200;
  display: flex; justify-content: center; pointer-events: none;
  padding-inline: 16px;
}

.dock {
  pointer-events: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(18, 18, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    0 10px 40px -8px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  transition: box-shadow .5s var(--ease), background .5s var(--ease), transform .5s var(--ease);
}
.dock-wrap.up .dock { transform: translateY(-130%); }
.dock-wrap.solid .dock { background: rgba(14, 14, 18, 0.78); }

.dock-brand { display: grid; place-items: center; padding-inline: 10px; height: 38px; }
.dock-brand img { height: 30px; width: auto; border-radius: 7px; }
.dock-mark { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.03em; color: var(--gold); }
.dock-mark i { font-style: normal; color: var(--teal-2); }

.dock-divider { width: 1px; height: 22px; background: var(--line-2); }

.dock-list { display: flex; align-items: center; gap: 2px; }

.dock-item {
  display: block; position: relative;
  padding: 9px 15px; border-radius: 999px;
  font-size: 0.875rem; font-weight: 400; color: var(--dim);
  white-space: nowrap;
  transform-origin: center bottom;
  transition: color .3s var(--ease), background .3s var(--ease);
  /* --mag is written by JS: 0 = far from cursor, 1 = directly under it */
  transform: scale(calc(1 + (var(--mag, 0) * 0.13))) translateY(calc(var(--mag, 0) * -2px));
}
.dock-item:hover, .dock-item:focus-visible { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.dock-item.active { color: var(--text); }
.dock-item.active::after {
  content: ''; position: absolute; inset-block-end: 3px; inset-inline-start: 50%;
  width: 14px; height: 2px; margin-inline-start: -7px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--teal-2));
}

.dock-burger { display: none; width: 40px; height: 38px; place-items: center; border-radius: 999px; color: var(--text); }
.dock-burger:hover { background: rgba(255, 255, 255, 0.07); }
.burger-close { display: none; }
.dock-burger[aria-expanded="true"] .burger-open { display: none; }
.dock-burger[aria-expanded="true"] .burger-close { display: block; }

/* Mobile sheet */
.sheet {
  position: fixed; inset-block-start: 76px; inset-inline: 14px; z-index: 199;
  padding: 10px;
  border-radius: var(--r-lg);
  background: rgba(14, 14, 18, 0.9);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-10px) scale(.98);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.sheet.open { opacity: 1; transform: none; }
.sheet a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-radius: 14px; color: var(--dim); font-size: 1rem;
}
.sheet a:hover, .sheet a:active { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.sheet-arrow { opacity: .35; }

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  position: relative; min-height: 100svh;
  display: grid; place-items: center; text-align: center;
  padding: 150px 22px 90px;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(23, 163, 152, .13), transparent 62%),
    radial-gradient(760px 480px at 88% 104%, rgba(212, 162, 78, .11), transparent 60%),
    var(--bg);
}
#hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-veil {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(closest-side at 50% 45%, transparent 30%, rgba(8, 8, 10, .55) 100%);
}
.hero-inner { position: relative; z-index: 2; width: min(920px, 100%); }

.hero-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: .74rem; font-weight: 400;
  letter-spacing: .22em; text-transform: uppercase; color: var(--teal-2);
  padding: 7px 16px; border-radius: 999px;
  background: rgba(23, 163, 152, .07); border: 1px solid rgba(23, 163, 152, .2);
}
.pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal-2);
  box-shadow: 0 0 0 0 rgba(79, 214, 200, .6); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(79, 214, 200, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 214, 200, 0); }
}

.hero-title.no-kicker { margin-block-start: 0; }
.hero-title {
  margin-block-start: 26px;
  font-size: clamp(2.4rem, 7.2vw, 5.1rem);
  font-weight: 200;
  line-height: 1.03;
  letter-spacing: -0.035em;
}
.ht-line { display: block; }
.hero-title .grad { font-size: 1.06em; line-height: 1.12; }

/* Container text flip */
.flip {
  margin-block-start: 24px;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  font-size: clamp(1rem, 2.4vw, 1.32rem); font-weight: 300; color: var(--dim);
}
.flip-lead { white-space: nowrap; }
.flip-box {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 10px 30px -12px rgba(0,0,0,.8);
  overflow: hidden;
  width: var(--flip-w, auto);
  transition: width .5s var(--ease);
}
.flip-word {
  display: inline-block; white-space: nowrap;
  font-weight: 400; color: var(--text);
  background: linear-gradient(100deg, var(--gold-2), var(--teal-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.flip-word.out { animation: flipOut .34s var(--ease) forwards; }
.flip-word.in  { animation: flipIn .44s var(--ease) forwards; }
@keyframes flipOut {
  to { opacity: 0; transform: translateY(-70%) rotateX(45deg); filter: blur(5px); }
}
@keyframes flipIn {
  from { opacity: 0; transform: translateY(70%) rotateX(-45deg); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: none; }
}

.hero-sub {
  margin: 26px auto 0; max-width: 620px;
  font-size: clamp(.98rem, 1.7vw, 1.09rem); color: var(--dim);
}

.hero-cta { margin-block-start: 38px; display: flex; gap: 13px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 28px; border-radius: 999px;
  font-size: .95rem; font-weight: 500; letter-spacing: -0.01em;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .35s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn .ico { width: 17px; height: 17px; transition: transform .35s var(--ease); }
.btn:hover .ico { transform: translateX(4px); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #17120a; font-weight: 600;
  box-shadow: 0 14px 38px -12px rgba(212, 162, 78, .65);
}
.btn-primary:hover { box-shadow: 0 20px 46px -12px rgba(212, 162, 78, .8); }
.btn-glass {
  background: rgba(255, 255, 255, .05); color: var(--text);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.btn-glass:hover { background: rgba(255, 255, 255, .09); border-color: rgba(79, 214, 200, .4); }

.stats {
  margin-block-start: 62px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.stat { background: rgba(10, 10, 13, .7); padding: 22px 12px; backdrop-filter: blur(8px); }
.stat-val {
  display: block; font-family: var(--mono); font-size: clamp(1.15rem, 2.8vw, 1.65rem);
  font-weight: 500; color: var(--gold-2); letter-spacing: -0.02em;
}
.stat-lbl { display: block; margin-block-start: 4px; font-size: .74rem; color: var(--dim-2); letter-spacing: .04em; }

.scroll-hint { position: absolute; inset-block-end: 30px; inset-inline-start: 50%; translate: -50% 0; z-index: 2; }
.scroll-hint span {
  display: block; width: 24px; height: 38px; border: 1px solid var(--line-2); border-radius: 13px; position: relative;
}
.scroll-hint span::after {
  content: ''; position: absolute; inset-block-start: 7px; inset-inline-start: 50%; margin-inline-start: -2px;
  width: 4px; height: 7px; border-radius: 3px; background: var(--teal-2);
  animation: dot 2s var(--ease) infinite;
}
@keyframes dot {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  75% { opacity: 0; transform: translateY(13px); }
  100% { opacity: 0; }
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.section { padding-block: clamp(80px, 11vw, 140px); position: relative; }
.section.alt { background: var(--bg-2); }
.section.alt::before, .section.alt::after {
  content: ''; position: absolute; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}
.section.alt::before { inset-block-start: 0; }
.section.alt::after { inset-block-end: 0; }

.sec-head { margin-block-end: clamp(40px, 5vw, 64px); max-width: 660px; }
.sec-head.center { margin-inline: auto; text-align: center; }
.kicker {
  font-family: var(--mono); font-size: .72rem; font-weight: 400;
  letter-spacing: .24em; text-transform: uppercase; color: var(--teal-2);
  margin-block-end: 14px;
}
.sec-title {
  font-size: clamp(1.85rem, 4.6vw, 3rem); font-weight: 200;
  letter-spacing: -0.032em; line-height: 1.12;
}
.sec-sub { margin-block-start: 18px; color: var(--dim); font-size: 1.02rem; }
.sec-head.center .sec-sub { margin-inline: auto; max-width: 520px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 18px; }

/* Shared card surface */
.card, .proj, .work, .contact, .skill {
  position: relative; overflow: hidden;
  background: linear-gradient(168deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .45s var(--ease), transform .45s var(--ease), box-shadow .45s var(--ease);
}
.card:hover, .proj:hover, .work:hover, .contact:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}

/* Cursor sheen — position fed by JS custom properties */
.card-sheen {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transition: opacity .45s var(--ease);
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(212, 162, 78, .1), transparent 62%);
}
.card:hover .card-sheen, .proj:hover .card-sheen, .contact:hover .card-sheen { opacity: 1; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 330px 1fr; gap: clamp(34px, 5vw, 64px); align-items: start; }
.frame {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
}
.frame img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.frame-fallback {
  aspect-ratio: 4/5; display: grid; place-items: center;
  background: radial-gradient(circle at 32% 22%, rgba(23,163,152,.22), rgba(255,255,255,.03));
}
.frame-fallback span { font-family: var(--serif); font-style: italic; font-size: 4.6rem; color: var(--gold); }
.frame-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(205deg, rgba(23,163,152,.14), transparent 42%, rgba(212,162,78,.14));
}

.about-body p { color: var(--dim); font-size: 1.04rem; margin-block-end: 18px; }
.facts { margin-block-start: 30px; display: grid; gap: 9px; }
.fact {
  display: grid; grid-template-columns: 142px 1fr; gap: 14px;
  padding: 15px 19px; border-radius: 14px;
  background: rgba(255, 255, 255, .028); border: 1px solid var(--line);
  transition: border-color .35s var(--ease), background .35s var(--ease);
}
.fact:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .05); }
.fact dt {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold); padding-block-start: 3px;
}
.fact dd { font-size: .94rem; color: var(--text); font-weight: 300; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-inline-start: 38px; }
.timeline::before {
  content: ''; position: absolute; inset-block: 8px 8px; inset-inline-start: 7px; width: 1px;
  background: linear-gradient(180deg, var(--gold), var(--teal) 55%, transparent);
}
.tl { position: relative; padding-block-end: 54px; }
.tl:last-child { padding-block-end: 0; }
.tl-node {
  position: absolute; inset-inline-start: -38px; inset-block-start: 9px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 162, 78, .1);
}
.tl-node::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%;
  background: var(--gold); opacity: .85;
}
.tl-date { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; color: var(--teal-2); }
.tl-role { margin-block-start: 8px; font-size: 1.28rem; font-weight: 400; letter-spacing: -0.02em; }
.tl-org { margin-block: 3px 16px; color: var(--gold); font-size: .93rem; }
.tl-points { display: grid; gap: 10px; }
.tl-points li { position: relative; padding-inline-start: 22px; color: var(--dim); font-size: .96rem; }
.tl-points li::before {
  content: ''; position: absolute; inset-inline-start: 2px; inset-block-start: .68em;
  width: 6px; height: 1px; background: var(--teal); opacity: .75;
}

/* ---------- Service cards ---------- */
.card { padding: 32px 28px 34px; }
.card-ico {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(212,162,78,.16), rgba(23,163,152,.1));
  border: 1px solid rgba(212, 162, 78, .22); color: var(--gold-2);
  margin-block-end: 20px;
  transition: transform .45s var(--ease), color .45s var(--ease);
}
.card:hover .card-ico { transform: translateY(-3px) scale(1.06); color: var(--teal-2); }
.card h3 { font-size: 1.08rem; font-weight: 500; letter-spacing: -0.015em; margin-block-end: 9px; }
.card p { color: var(--dim); font-size: .93rem; }

/* ---------- Skills ---------- */
.skill { padding: 26px 24px 28px; }
.skill h4 {
  font-size: .95rem; font-weight: 500; color: var(--gold-2); margin-block-end: 15px;
  letter-spacing: -0.01em;
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tags li {
  font-size: .775rem; font-weight: 400; padding: 5px 12px; border-radius: 999px;
  background: rgba(23, 163, 152, .07); border: 1px solid rgba(23, 163, 152, .18); color: var(--teal-2);
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.skill:hover .tags li { background: rgba(23, 163, 152, .11); border-color: rgba(23, 163, 152, .3); }
.tags.sm li { font-size: .72rem; padding: 4px 10px; }

/* ---------- Projects ---------- */
.proj { display: flex; flex-direction: column; }
.proj-img { aspect-ratio: 16/10; overflow: hidden; border-block-end: 1px solid var(--line); }
.proj-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.proj:hover .proj-img img { transform: scale(1.05); }
.proj-body { padding: 26px 25px 28px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.proj-cat {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold);
}
.proj h3 { font-size: 1.14rem; font-weight: 500; letter-spacing: -0.02em; }
.proj-desc { color: var(--dim); font-size: .92rem; flex: 1; }

/* ---------- Work showcase ---------- */
.work { display: flex; flex-direction: column; }
.work-cover {
  position: relative; aspect-ratio: 16/10; overflow: hidden;
  background: rgba(255, 255, 255, .02); border-block-end: 1px solid var(--line);
}
.work-cover img, .work-cover video { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.work:hover .work-cover img, .work:hover .work-cover video { transform: scale(1.055); }
.work-nocover { display: grid; place-items: center; height: 100%; color: var(--dim-2); }
.work-nocover svg { width: 40px; height: 40px; }
.work-play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  pointer-events: none; text-shadow: 0 2px 14px rgba(0,0,0,.7);
}
.work-play svg { width: 46px; height: 46px; }
.work-count {
  position: absolute; inset-block-start: 12px; inset-inline-end: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  font-family: var(--mono); font-size: .72rem; color: var(--text);
  background: rgba(10, 10, 13, .72); border: 1px solid var(--line-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.work-open {
  position: absolute; inset: 0; width: 100%;
  display: grid; place-items: center;
  background: rgba(8, 8, 10, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .4s var(--ease);
}
.work:hover .work-open, .work-open:focus-visible { opacity: 1; }
.work-open-label {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 999px; font-size: .89rem; font-weight: 500;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--line-2);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transform: translateY(8px); transition: transform .4s var(--ease);
}
.work:hover .work-open-label { transform: none; }

.work-body { padding: 24px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.work-body h3 { font-size: 1.1rem; font-weight: 500; letter-spacing: -0.02em; }
.work-body > p { color: var(--dim); font-size: .92rem; }
.work-files { margin-block-start: 4px; display: grid; gap: 7px; }
.work-files a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 11px; font-size: .84rem; color: var(--dim);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
}
.work-files a:hover { color: var(--text); border-color: rgba(212,162,78,.35); background: rgba(212,162,78,.07); }
.work-files a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-files a .ico:first-child { color: var(--gold); }

/* ---------- Lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 500;
  display: grid; place-items: center; padding: clamp(16px, 4vw, 54px);
  background: rgba(5, 5, 7, .93);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; transition: opacity .35s var(--ease);
}
.lb.open { opacity: 1; }
.lb[hidden] { display: none; }
.lb-stage { display: flex; flex-direction: column; gap: 16px; max-width: 100%; max-height: 100%; }
.lb-media {
  display: grid; place-items: center;
  max-height: min(76vh, 900px); border-radius: var(--r); overflow: hidden;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9);
}
.lb-media img, .lb-media video { max-height: min(76vh, 900px); max-width: 100%; width: auto; object-fit: contain; }
.lb-cap {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  color: var(--dim); font-size: .9rem; text-align: center;
}
.lb-count { font-family: var(--mono); font-size: .78rem; color: var(--dim-2); }
.lb-close, .lb-nav {
  position: absolute; z-index: 2; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%; color: var(--text);
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .3s var(--ease), transform .3s var(--ease);
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .14); transform: scale(1.06); }
.lb-close { inset-block-start: clamp(14px, 3vw, 30px); inset-inline-end: clamp(14px, 3vw, 30px); }
.lb-nav { inset-block-start: 50%; translate: 0 -50%; }
.lb-prev { inset-inline-start: clamp(10px, 2.4vw, 30px); }
.lb-next { inset-inline-end: clamp(10px, 2.4vw, 30px); }
.lb-nav[hidden] { display: none; }

/* ---------- Contact ---------- */
.contact { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 32px 20px; text-align: center; }
.contact-ico {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(150deg, rgba(212,162,78,.15), rgba(23,163,152,.1));
  border: 1px solid rgba(212,162,78,.2); color: var(--gold-2);
  margin-block-end: 9px; transition: transform .45s var(--ease), color .45s var(--ease);
}
.contact:hover .contact-ico { transform: translateY(-3px); color: var(--teal-2); }
.contact-lbl {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--teal-2);
}
.contact-val { font-size: .89rem; color: var(--dim); word-break: break-word; }

/* ---------- Footer ---------- */
.footer { border-block-start: 1px solid var(--line); padding-block: 30px; }
.footer-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { color: var(--dim-2); font-size: .85rem; }
.footer-admin { color: rgba(120, 118, 122, .5); font-size: .78rem; transition: color .3s var(--ease); }
.footer-admin:hover { color: var(--gold); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .85s var(--ease), transform .85s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1000px) {
  .about { grid-template-columns: 1fr; }
  .about-media { max-width: 290px; }
}

@media (max-width: 860px) {
  .dock-list, .dock-divider { display: none; }
  .dock-burger { display: grid; }
  .dock { padding: 6px 8px; gap: 4px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .fact { grid-template-columns: 1fr; gap: 3px; }
  .fact dt { padding-block-start: 0; }
  .timeline { padding-inline-start: 28px; }
  .tl-node { inset-inline-start: -28px; width: 13px; height: 13px; }
  .grid-3 { grid-template-columns: 1fr; }
  .hero { padding-block-start: 128px; }
  /* Touch devices have no hover — always show the gallery affordance */
  .work-open { opacity: 1; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
               align-content: end; padding-block-end: 14px; }
  .work-open-label { transform: none; font-size: .8rem; padding: 9px 16px; }
}

@media (max-width: 560px) {
  .wrap { width: min(1180px, 100% - 32px); }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .contact { padding: 24px 12px; }
  .lb-close, .lb-nav { width: 42px; height: 42px; }
  .flip { gap: 9px; }
  .stat { padding: 17px 8px; }
}

@media (hover: none) {
  .card-sheen { display: none; }
}

/* ==========================================================================
   MOTION LAYER
   Preloader, section rail, scroll progress, richer reveals and hover sweeps.
   ========================================================================== */

/* ---------- Preloader ----------
   Visible by default so there is no flash of unstyled content. JS removes it on
   load; the CSS failsafe animation also clears it so a JS error can never leave
   a visitor staring at a blank overlay. */
.loader {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center; gap: 22px;
  background: var(--bg);
  animation: loaderFailsafe 0.6s var(--ease) 4s forwards;
}
.loader-in { display: grid; justify-items: center; gap: 20px; }
.loader-mark {
  font-size: 2rem; font-weight: 600; letter-spacing: -0.04em; color: var(--gold);
  animation: markPulse 1.6s ease-in-out infinite alternate;
}
.loader-mark i { font-style: normal; color: var(--teal-2); }
.loader-bar {
  width: 132px; height: 1px; background: var(--line-2); overflow: hidden; position: relative;
}
.loader-bar::after {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: barSweep 1.1s var(--ease) infinite;
}
.loader.done { opacity: 0; visibility: hidden; transition: opacity .7s var(--ease), visibility .7s; }
@keyframes markPulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes barSweep { from { transform: translateX(-100%); } to { transform: translateX(330%); } }
@keyframes loaderFailsafe { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .loader { display: none; } }

/* Hold the hero still until the loader clears, then let it play */
body.loading { overflow: hidden; }

/* ---------- Scroll progress ---------- */
.progress {
  position: fixed; inset-block-start: 0; inset-inline: 0; height: 2px; z-index: 300;
  background: linear-gradient(90deg, var(--gold), var(--teal-2));
  transform: scaleX(var(--p, 0)); transform-origin: left center;
  transition: transform .12s linear;
}

/* ---------- Section rail (adapted from the architectural sheet counter) ---------- */
.rail {
  position: fixed; inset-inline-end: 26px; inset-block-start: 50%; translate: 0 -50%;
  z-index: 150; display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
  opacity: 0; transition: opacity .6s var(--ease);
}
.rail.ready { opacity: 1; }
.rail-count {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; color: var(--dim-2);
  writing-mode: vertical-rl; margin-block-end: 4px;
}
.rail-count b { color: var(--gold); font-weight: 500; }
.rail-dots { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.rail-dot {
  position: relative; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28); background: transparent;
  transition: all .4s var(--ease);
}
.rail-dot:hover { border-color: var(--gold); transform: scale(1.25); }
.rail-dot.on { background: var(--gold); border-color: var(--gold); }
.rail-dot.on::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid rgba(212, 162, 78, .35);
}
/* Label appears on hover, sliding out from the dot */
.rail-dot span {
  position: absolute; inset-inline-end: 20px; inset-block-start: 50%; translate: 0 -50%;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  font-size: .72rem; color: var(--text);
  background: rgba(18, 18, 22, .82); border: 1px solid var(--line-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; translate: 8px -50%; pointer-events: none;
  transition: opacity .3s var(--ease), translate .3s var(--ease);
}
.rail-dot:hover span { opacity: 1; translate: 0 -50%; }

/* ---------- Button sweep fill ---------- */
.btn { position: relative; overflow: hidden; z-index: 0; }
.btn-glass::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, rgba(212, 162, 78, .22), rgba(23, 163, 152, .22));
  transform: scaleX(0); transform-origin: left center;
  transition: transform .45s var(--ease);
}
.btn-glass:hover::before { transform: scaleX(1); }

/* ---------- Richer reveals ----------
   Directional variants; the base .reveal still works on its own. */
.reveal { opacity: 0; transform: translateY(26px); filter: blur(6px);
          transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; filter: none; }
.reveal-l { transform: translateX(-34px); }
.reveal-r { transform: translateX(34px); }
.reveal-s { transform: scale(.94); }

/* Section headings lift slightly as their section enters */
.sec-head .kicker { position: relative; padding-inline-start: 0; }
.sec-head .kicker::before {
  content: ''; display: inline-block; width: 0; height: 1px; vertical-align: middle;
  background: var(--gold); margin-inline-end: 0;
  transition: width .8s var(--ease) .15s, margin-inline-end .8s var(--ease) .15s;
}
.sec-head.in .kicker::before { width: 26px; margin-inline-end: 12px; }

/* ---------- Section transition wash ----------
   A faint sweep that plays once as each section scrolls into view, so moving
   between sections reads as a transition rather than a hard cut. */
.section { position: relative; overflow: hidden; }
.section::before {
  content: ''; position: absolute; inset-inline: 0; inset-block-start: 0; height: 100%;
  pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(212, 162, 78, .05), transparent 38%);
}
.section.entered::before { animation: sectionWash 1.4s var(--ease) forwards; }
@keyframes sectionWash { 0% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 1100px) { .rail { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { filter: none; }
  .section.entered::before { animation: none; }
}

/* ==========================================================================
   LOGO PRESENCE
   The uploaded mark is a JPEG on a near-black field (sampled rgb(32,32,30)),
   so it would otherwise render as a dark rectangle on the glass dock.
   mix-blend-mode: screen drops that background against our dark surfaces,
   making it read as a transparent mark.
   ========================================================================== */

.dock { padding: 8px 12px; }
.dock-brand { padding-inline: 6px; height: auto; }

/* In the dock the full lockup would shrink the monogram to nothing, so crop to
   the mark itself — the wordmark gets its moment on the preloader instead. */
.brand-logo,
.dock-brand img {
  height: 52px; width: 62px;
  object-fit: cover;
  object-position: center 34%;
  border-radius: 0;
  mix-blend-mode: screen;
  filter: saturate(1.14) contrast(1.08)
          drop-shadow(0 0 16px rgba(212, 162, 78, .24));
  transition: filter .45s var(--ease), transform .45s var(--ease);
}
.dock-brand:hover img {
  filter: saturate(1.22) contrast(1.12) drop-shadow(0 0 26px rgba(212, 162, 78, .45));
  transform: scale(1.05);
}

/* Preloader mark — the logo's big moment */
.loader-in img {
  height: 132px !important; width: auto;
  border-radius: 0 !important;
  mix-blend-mode: screen;
  filter: saturate(1.12) drop-shadow(0 0 34px rgba(212, 162, 78, .3));
  animation: markPulse 1.6s ease-in-out infinite alternate;
}
.loader-mark { font-size: 3.2rem; }

/* Keep the taller dock clear of the hero content */
.hero { padding-block-start: 168px; }

@media (max-width: 860px) {
  .brand-logo, .dock-brand img { height: 42px; width: 50px; }
  .loader-in img { height: 104px !important; }
  .hero { padding-block-start: 138px; }
}

/* ==========================================================================
   BILINGUAL — Arabic typography and RTL
   The layout already uses logical properties throughout (inset-inline,
   margin-inline, padding-inline), so it mirrors automatically under dir="rtl".
   What follows is type, and the handful of places that were direction-aware.
   ========================================================================== */

/* Language toggle */
.lang-btn {
  display: grid; place-items: center;
  min-width: 44px; height: 38px; padding-inline: 13px;
  border-radius: 999px; flex: none;
  font-size: .82rem; font-weight: 500; letter-spacing: .02em;
  color: var(--gold-2);
  background: rgba(212, 162, 78, .09);
  border: 1px solid rgba(212, 162, 78, .26);
  transition: background .3s var(--ease), color .3s var(--ease), transform .3s var(--ease);
}
.lang-btn:hover { background: rgba(212, 162, 78, .18); color: var(--text); transform: translateY(-1px); }

.sheet-lang { margin-block-start: 6px; padding-block-start: 10px; border-block-start: 1px solid var(--line); }
.sheet-lang-tag {
  font-size: .74rem; padding: 4px 10px; border-radius: 999px;
  color: var(--gold-2); background: rgba(212, 162, 78, .1);
  border: 1px solid rgba(212, 162, 78, .24);
}

/* ---------- Arabic type ---------- */
[lang="ar"] {
  --sans: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --serif: 'Amiri', 'Times New Roman', serif;
}
[lang="ar"] body,
html[lang="ar"] body { font-family: var(--sans); }

/* Arabic script has taller ascenders and no lowercase, so it needs more line
   height and none of the tight tracking that suits the Latin display face. */
html[lang="ar"] .hero-title,
html[lang="ar"] .sec-title {
  letter-spacing: 0;
  line-height: 1.28;
  font-weight: 300;
}
html[lang="ar"] .grad { font-style: normal; font-weight: 700; line-height: 1.4; }
html[lang="ar"] .hero-title .grad { font-size: 1em; }
html[lang="ar"] body { line-height: 1.85; }
html[lang="ar"] .tl-points li,
html[lang="ar"] .about-body p,
html[lang="ar"] .card p { line-height: 1.9; }

/* Kickers: Arabic in all-caps monospace is unreadable, so use the sans face
   at normal case with light tracking instead. */
html[lang="ar"] .kicker,
html[lang="ar"] .hero-kicker,
html[lang="ar"] .proj-cat,
html[lang="ar"] .contact-lbl,
html[lang="ar"] .tl-date {
  font-family: var(--sans);
  text-transform: none;
  letter-spacing: .04em;
  font-size: .82rem;
}
html[lang="ar"] .fact dt { font-family: var(--sans); text-transform: none; letter-spacing: .02em; font-size: .78rem; }

/* Numbers stay in the Latin monospace so figures line up cleanly */
html[lang="ar"] .stat-val,
html[lang="ar"] .rail-count,
html[lang="ar"] .lb-count { font-family: var(--mono); direction: ltr; }

/* ---------- RTL corrections ----------
   Anything that was genuinely direction-aware rather than logical. */
[dir="rtl"] .btn:hover .ico { transform: translateX(-4px); }
[dir="rtl"] .sheet-arrow { transform: scaleX(-1); }
[dir="rtl"] .btn-primary .ico { transform: scaleX(-1); }
[dir="rtl"] .btn-primary:hover .ico { transform: scaleX(-1) translateX(4px); }

/* The scroll progress bar must fill from the right in RTL */
[dir="rtl"] .progress { transform-origin: right center; }

/* Rail labels flip to the opposite side of their dot */
[dir="rtl"] .rail-dot span { inset-inline-end: auto; inset-inline-start: 20px; translate: -8px -50%; }
[dir="rtl"] .rail-dot:hover span { translate: 0 -50%; }

/* Timeline bullets point the correct way */
[dir="rtl"] .tl-points li::before { transform: scaleX(-1); }

/* Section kicker rule sits on the correct side */
[dir="rtl"] .sec-head .kicker::before { margin-inline-end: 0; }
[dir="rtl"] .sec-head.in .kicker::before { margin-inline-end: 12px; }

/* Latin fragments inside Arabic text (Azure, ERP, Microsoft 365) keep LTR order */
[dir="rtl"] .tags li, [dir="rtl"] .work-files a span { unicode-bidi: plaintext; }
[dir="rtl"] .contact-val { direction: ltr; text-align: center; }

@media (max-width: 860px) {
  .lang-btn { min-width: 40px; height: 36px; padding-inline: 11px; font-size: .78rem; }
}

/* ==========================================================================
   EXPERTISE — two audience tracks
   Track A (individuals) leans teal, track B (companies) leans gold, so the
   two audiences are distinguishable at a glance without extra chrome.
   ========================================================================== */

.track { position: relative; padding-block-start: clamp(34px, 5vw, 54px); }
.track + .track { margin-block-start: clamp(40px, 6vw, 72px); }

/* Hairline rule above each track, fading out across the width */
.track::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, var(--track-accent), transparent 62%);
  opacity: .55;
}
[dir="rtl"] .track::before {
  background: linear-gradient(270deg, var(--track-accent), transparent 62%);
}

.track-a { --track-accent: var(--teal-2); --track-soft: rgba(23, 163, 152, .1); --track-line: rgba(23, 163, 152, .26); }
.track-b { --track-accent: var(--gold);   --track-soft: rgba(212, 162, 78, .1); --track-line: rgba(212, 162, 78, .28); }

.track-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 6px 18px;
  margin-block-end: clamp(24px, 3vw, 36px);
}
.track-num {
  grid-row: span 2;
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px;
  font-family: var(--mono); font-size: .84rem; letter-spacing: .02em;
  color: var(--track-accent);
  background: var(--track-soft);
  border: 1px solid var(--track-line);
}
.track-meta { min-width: 0; }
.track-label {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--track-accent);
  margin-block-end: 5px;
}
.track-title {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 300;
  letter-spacing: -0.02em; line-height: 1.25; color: var(--text);
}
.track-note {
  grid-column: 2; max-width: 62ch;
  color: var(--dim); font-size: .95rem; margin-block-start: 8px;
}

.track-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 18px; }
.track-cards .card h4 {
  font-size: 1.06rem; font-weight: 500; letter-spacing: -0.015em; margin-block-end: 9px;
}
/* Card accents inherit the track colour */
.track .card-ico {
  background: linear-gradient(150deg, var(--track-soft), rgba(255, 255, 255, .02));
  border-color: var(--track-line);
  color: var(--track-accent);
}
.track .card:hover { border-color: var(--track-line); }
.track .card:hover .card-ico { color: var(--text); }
.track .card-sheen {
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), var(--track-soft), transparent 62%);
}

/* Arabic headings need the sans face at normal case */
html[lang="ar"] .track-label { font-family: var(--sans); text-transform: none; letter-spacing: .04em; font-size: .82rem; }
html[lang="ar"] .track-title { line-height: 1.5; }

@media (max-width: 640px) {
  .track-head { grid-template-columns: 1fr; gap: 4px; }
  .track-num { grid-row: auto; width: 40px; height: 40px; margin-block-end: 10px; }
  .track-note { grid-column: 1; }
  .track-cards { grid-template-columns: 1fr; }
}
