/* =========================================================
   Amgad Emadeldin — Portfolio (Bootstrap + Vanilla JS)
   Bilingual EN/AR, theme variables, custom animations
   ========================================================= */

:root {
  --bg: #F5F1EA;
  --surface: #ECE6DA;
  --surface-2: #E2DBCB;
  --ink: #14110F;
  --ink-soft: #2A2521;
  --muted: #6B6258;
  --muted-2: #8C8275;
  --hairline: rgba(20, 17, 15, 0.12);
  --hairline-strong: rgba(20, 17, 15, 0.22);
  --accent: #C25A33;
  --accent-ink: #FFFFFF;
  --whatsapp: #25D366;
  --shadow-lg: 0 30px 60px -30px rgba(20, 17, 15, 0.25);
  --grain: 0.04;
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --font-ar: "IBM Plex Sans Arabic", "Tajawal", "Cairo", sans-serif;
  --font-ar-display: "IBM Plex Sans Arabic", "Tajawal", sans-serif;
}

html[data-theme="slate"] {
  --bg: #E8E6E1; --surface: #DCDAD3; --surface-2: #CFCDC4;
  --ink: #1A1B1D; --ink-soft: #2E3034;
  --muted: #5E6068; --muted-2: #82858E;
  --hairline: rgba(26, 27, 29, 0.12);
  --hairline-strong: rgba(26, 27, 29, 0.22);
}
html[data-theme="midnight"] {
  --bg: #0E0D0C; --surface: #181614; --surface-2: #221F1B;
  --ink: #ECE6DA; --ink-soft: #C9C2B5;
  --muted: #8A8278; --muted-2: #62594F;
  --hairline: rgba(236, 230, 218, 0.10);
  --hairline-strong: rgba(236, 230, 218, 0.22);
  --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  --grain: 0.06;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}
html[dir="rtl"] body { font-family: var(--font-ar); letter-spacing: 0; }
html[dir="rtl"] .display-font,
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { font-family: var(--font-ar-display); }
html[dir="rtl"] .mono { font-family: var(--font-mono); }

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: 1.5rem;
}
/* Keep comfortable breathing room from screen edges on mobile */
@media (max-width: 575px) { .container { padding-inline: 1.25rem; } }
@media (max-width: 400px) { .container { padding-inline: 1.125rem; } }
/* Small devices (landscape phones, portrait tablets) */
@media (min-width: 576px) { .container { max-width: 540px; } }
/* Tablets (portrait and landscape) */
@media (min-width: 768px) { .container { max-width: 720px; } }
/* Large tablets, small desktops */
@media (min-width: 992px) { .container { max-width: 960px; } }
/* Desktops */
@media (min-width: 1200px) { .container { max-width: 1140px; } }
/* Large desktops */
@media (min-width: 1400px) { .container { max-width: 1320px; } }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  opacity: var(--grain); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}
html[data-theme="midnight"] body::before { mix-blend-mode: screen; }

::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

/* ---- Loader ---- */
.loader {
  position: fixed; inset: 0; background: var(--bg); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s 0.3s ease, visibility 0s 1s;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-inner {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(60px, 10vw, 140px);
  letter-spacing: -0.04em; color: var(--ink);
  position: relative; overflow: hidden;
}
.loader-inner span { display: inline-block; animation: rise 0.9s cubic-bezier(.2,.9,.2,1) both; }
.loader-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--hairline); overflow: hidden;
}
.loader-bar::after {
  content: ""; position: absolute; inset: 0;
  background: var(--accent); transform-origin: left;
  animation: loadbar 1.2s ease-out forwards;
}
html[dir="rtl"] .loader-bar::after { transform-origin: right; }
@keyframes loadbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise { from { transform: translateY(110%); } to { transform: translateY(0); } }

/* ---- Custom cursor ---- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  transform: translate3d(-50%, -50%, 0); will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; background: var(--ink); border-radius: 50%; }
.cursor-ring {
  width: 36px; height: 36px; border: 1px solid var(--ink); border-radius: 50%;
  transition: width .25s cubic-bezier(.2,.8,.2,1), height .25s cubic-bezier(.2,.8,.2,1), background .2s, opacity .2s;
  mix-blend-mode: difference; opacity: .85;
}
.cursor-ring.hover { width: 64px; height: 64px; background: var(--ink); opacity: .12; }
.cursor-label {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  transform: translate3d(-50%, -50%, 0);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--accent-ink); background: var(--accent);
  padding: 8px 12px; border-radius: 999px; text-transform: uppercase;
  opacity: 0; transition: opacity .2s; white-space: nowrap;
}
.cursor-label.show { opacity: 1; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring, .cursor-label { display: none; }
}

/* ---- Type helpers ---- */
.display-font { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.03em; }
.mono { font-family: var(--font-mono); }
.italic { font-style: italic; color: var(--accent); }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 6px; height: 6px; background: var(--accent);
  border-radius: 50%; display: inline-block;
}

/* ---- Nav ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 22px 32px;
  display: flex; align-items: center; justify-content: space-between;
  transition: background .3s, backdrop-filter .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.nav-logo {
  font-family: var(--font-display); font-size: 22px;
  font-style: italic; display: flex; align-items: baseline; gap: 8px;
}
.nav-logo .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav-links {
  display: flex; gap: 6px; align-items: center;
  font-family: var(--font-mono); font-size: 12px;
}
.nav-link {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  transition: color .2s, background .2s; min-height: 40px; display: inline-flex; align-items: center;
}
.nav-link:hover { color: var(--ink); background: var(--surface); }
.nav-link .num { color: var(--muted-2); margin-inline-end: 4px; }
.nav-cta {
  margin-inline-start: 8px; padding: 10px 16px;
  background: var(--ink); color: var(--bg); border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .2s; min-height: 40px;
}
.nav-cta:hover { transform: translateY(-1px); }
@media (max-width: 480px) {
  .nav-link { padding: 6px 10px; font-size: 11px; }
  .nav-cta { padding: 8px 12px; font-size: 11px; }
}
.nav-cta .pulse {
  display: inline-block;
  flex: 0 0 auto;
  align-self: center;
  width: 9px !important;
  height: 9px !important;
  min-width: 9px;
  min-height: 9px;
  max-width: 9px;
  max-height: 9px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #4ADE80;
  position: relative;
  box-sizing: content-box;
  animation: dotPing 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes dotPing {
  0% {
    box-shadow:
      0 0 0 0 rgba(74, 222, 128, .85),
      0 0 0 0 rgba(74, 222, 128, .55);
  }
  70% {
    box-shadow:
      0 0 0 7px rgba(74, 222, 128, 0),
      0 0 0 14px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(74, 222, 128, 0),
      0 0 0 0 rgba(74, 222, 128, 0);
  }
}
.lang-toggle {
  margin-inline-end: 4px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--hairline-strong); color: var(--ink);
  font-family: var(--font-mono); font-size: 11px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s, transform .2s;
}
.lang-toggle:hover { background: var(--surface); transform: translateY(-1px); }
.lang-toggle .sep { color: var(--muted-2); }
.lang-toggle .on { color: var(--accent); }
@media (max-width: 860px) {
  .nav-links .nav-link { display: none; }
  .nav { padding: 18px 20px; }
}


/* ---- Hero ---- */
.hero {
  min-height: 100vh; padding-block: 140px 80px;
  position: relative; display: flex; flex-direction: column; justify-content: center;
}
@media (max-width: 768px) { .hero { padding-block: 100px 60px; } }
@media (max-width: 576px) { .hero { padding-block: 80px 40px; } }
.hero-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px;
  margin-bottom: 60px;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.hero-meta-block { display: flex; flex-direction: column; gap: 4px; }
.hero-meta-block strong { color: var(--ink); font-weight: 500; }

.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(60px, 12vw, 200px); line-height: 1.2;
  letter-spacing: -.04em; margin: 0; color: var(--ink);
  /* `anywhere` is more aggressive than `break-word`: it also breaks Arabic/CJK
     glyphs that lack natural break points, so long words can't push past the
     container edge on mobile. */
  overflow-wrap: anywhere;
  word-wrap: break-word;
  hyphens: auto;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line .inner {
  display: inline-block; transform: translateY(110%);
  animation: rise 1.1s cubic-bezier(.2,.9,.2,1) forwards;
  max-width: 100%;
}
.hero-title .line:nth-child(2) .inner { animation-delay: .15s; }
.hero-title .line:nth-child(3) .inner { animation-delay: .3s; }

html[dir="rtl"] .hero-title { font-family: var(--font-ar-display); letter-spacing: 0; }
/* Arabic glyphs are noticeably wider than the Instrument Serif Latin set, so
   the title overflows at viewports where the Latin version still fits. Drop
   the size for RTL on tablets and phones. */
@media (max-width: 900px) {
  html[dir="rtl"] .hero-title { font-size: clamp(40px, 9vw, 78px); }
}
@media (max-width: 480px) {
  html[dir="rtl"] .hero-title { font-size: clamp(30px, 8vw, 52px); }
}

.hero-bottom { margin-top: 80px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; align-items: end; }
.hero-bottom .col { display: flex; flex-direction: column; gap: 12px; }
.hero-bottom h4 {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  margin: 0; font-weight: 500;
}
.hero-bottom p { font-size: 16px; color: var(--ink-soft); margin: 0; max-width: 36ch; line-height: 1.55; text-wrap: pretty; }

.hero-scroll {
  position: absolute; bottom: 32px; right: 32px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px; writing-mode: vertical-rl;
}
html[dir="rtl"] .hero-scroll { right: auto; left: 32px; }
.hero-scroll .arrow {
  width: 1px; height: 40px; background: var(--ink);
  animation: scrollHint 2s ease-in-out infinite;
}
@keyframes scrollHint {
  0%, 100% { transform: scaleY(1); transform-origin: top; }
  50% { transform: scaleY(0.3); transform-origin: top; }
}

/* Allow long hero-title phrases (e.g. "engineered with care." or the wider
   Arabic glyphs) to wrap instead of being clipped by .line's overflow:hidden.
   Switching .inner to block lets it fill the available width and wrap;
   .line auto-expands to fit, so the rise animation still hides the
   pre-animation translateY(110%) state. Applied up to 900px to cover tablets
   where the RTL title still overflows. */
@media (max-width: 900px) {
  .hero-title .line .inner { display: block; max-width: 100%; white-space: normal; }
}

/* Mobile optimization: Galaxy S20 Ultra & similar devices */
@media (max-width: 360px) {
  .hero { padding-block: 60px 30px; min-height: auto; }
  .hero-meta { margin-bottom: 30px; gap: 12px; font-size: 9px; }
  .hero-meta-block { gap: 2px; }
  .hero-title { font-size: clamp(30px, 9vw, 52px); letter-spacing: -0.02em; }
  .hero-bottom { margin-top: 40px; gap: 20px; }
  .hero-bottom p { font-size: 14px; max-width: 30ch; }
  .hero-scroll { display: none; }
  .section { padding-block: 32px; }
  .section-head h2 { font-size: clamp(24px, 6vw, 32px); }
  button, a, .btn { min-height: 44px; padding: 12px 16px; }
  .container { padding-inline: 1rem; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  .nav { padding: 14px 18px; }
  .nav-logo { font-size: clamp(12px, 3vw, 16px); }
  .hero { padding-block: 70px 50px; }
  .hero-meta { font-size: 9px; }
  .hero-title { font-size: clamp(34px, 10vw, 60px); }
  .hero-bottom { gap: 24px; }
  .hero-bottom h4 { font-size: 10px; }
  .hero-bottom p { font-size: 15px; line-height: 1.4; }

  .section { padding-block: 48px; }
  .section-head h2 { font-size: clamp(28px, 8vw, 42px); }
  .section-head .lede { font-size: 15px; margin-top: 12px; }

  .work-card h3 { font-size: 24px; }
  .featured h3 { font-size: clamp(28px, 6vw, 48px); }
  .featured p { font-size: 15px; margin-bottom: 20px; }

  .contact-mark { font-size: clamp(48px, 18vw, 72px); }
  .contact { padding: 32px 20px 16px; }

  /* Touch targets for interactive elements */
  a, button, [role="button"] { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
  .lang-toggle { min-height: 40px; padding: 8px 12px; }

  /* Better spacing for thumbs */
  .hero-bottom .col { gap: 10px; }
  .work-grid { gap: 32px; }
  .stack { gap: 12px; }

  /* Hide non-essential elements on ultra-narrow */
  @media (max-width: 360px) {
    .hero-meta-block:nth-child(3),
    .hero-meta-block:nth-child(4) { display: none; }
  }
}

@media (max-width: 900px) { .hero-bottom { grid-template-columns: 1fr; gap: 24px; } }

/* ---- Marquee ---- */
.marquee {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 22px 0; overflow: hidden; white-space: nowrap;
}
.marquee-track {
  display: inline-flex; gap: 60px; animation: scroll 40s linear infinite;
  font-family: var(--font-display); font-size: 28px; font-style: italic;
  color: var(--ink); align-items: center;
}
.marquee-track .star { width: 12px; height: 12px; background: var(--accent); border-radius: 50%; display: inline-block; }
@keyframes scroll { to { transform: translateX(-50%); } }
html[dir="rtl"] .marquee-track { animation: scrollRtl 40s linear infinite; }
@keyframes scrollRtl { to { transform: translateX(50%); } }

/* ---- Section frame ---- */
/* Use padding-block so the container's padding-inline survives the cascade
   (a `padding: Y 0` shorthand here would zero out horizontal padding and
   make content sit flush against the screen edges on mobile). */
.section { padding-block: 120px; position: relative; }
@media (max-width: 900px) { .section { padding-block: 80px; } }
@media (max-width: 768px) { .section { padding-block: 60px; } }
@media (max-width: 576px) { .section { padding-block: 40px; } }
.section-head {
  display: grid; grid-template-columns: 140px 1fr; gap: 40px;
  margin-bottom: 80px; align-items: baseline;
}
.section-head .num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.section-head h2 {
  font-family: var(--font-display); font-size: clamp(40px, 6vw, 80px);
  font-weight: 400; line-height: 1; letter-spacing: -.03em; margin: 0; color: var(--ink);
}
html[dir="rtl"] .section-head h2 { font-family: var(--font-ar-display); letter-spacing: 0; }
.section-head .lede { margin-top: 18px; font-size: 17px; color: var(--muted); max-width: 52ch; text-wrap: pretty; }
@media (max-width: 720px) {
  .section { padding: 55px 16px; }
  .section-head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 50px; }
}
@media (max-width: 576px) {
  .section-head h2 { font-size: clamp(28px, 5vw, 40px); }
  .section-head { gap: 12px; margin-bottom: 30px; }
}

/* ---- Buttons ---- */
.btn-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: .04em; text-transform: uppercase;
  transition: transform .2s, background .2s; cursor: pointer; border: 0;
  min-height: 44px;
}
.btn-pill:hover { transform: translateY(-1px); color: var(--bg); }
.btn-pill .arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--bg); color: var(--ink);
  border-radius: 50%; transition: transform .3s;
}
.btn-pill:hover .arrow { transform: translateX(2px) rotate(-45deg); }
html[dir="rtl"] .btn-pill:hover .arrow { transform: translateX(-2px) rotate(45deg); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline-strong); min-height: 44px; }
.btn-ghost .arrow { background: var(--ink); color: var(--bg); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-whatsapp { background: var(--whatsapp); color: #052e16; min-height: 44px; }
.btn-whatsapp:hover { color: #052e16; }
.btn-whatsapp .arrow { background: #052e16; color: var(--whatsapp); }
.btn-whatsapp svg { width: 16px; height: 16px; }

/* Mobile: enhance touch targets */
@media (max-width: 480px) {
  .btn-pill { padding: 12px 18px; min-height: 48px; font-size: 11px; }
  .btn-ghost { padding: 12px 18px; min-height: 48px; }
  .btn-whatsapp { padding: 12px 18px; min-height: 48px; }
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-whatsapp {
  background: var(--whatsapp); color: #052e16;
}
.btn-whatsapp:hover { color: #052e16; }
.btn-whatsapp .arrow { background: #052e16; color: var(--whatsapp); }
.btn-whatsapp svg { width: 16px; height: 16px; }

/* ---- About ---- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px; align-items: start; }
.about-text p {
  font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.35; letter-spacing: -.015em; color: var(--ink);
  margin: 0 0 24px; text-wrap: pretty;
}
html[dir="rtl"] .about-text p { font-family: var(--font-ar); font-weight: 400; letter-spacing: 0; line-height: 1.85; }
.about-side { display: flex; flex-direction: column; gap: 32px; }
.about-photo {
  aspect-ratio: 2 / 3; background: var(--surface); border-radius: 6px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.about-photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.about-photo .label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  background: var(--bg); padding: 6px 12px;
  border: 1px solid var(--hairline); border-radius: 999px;
}
.about-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--hairline);
}
.about-stat { padding: 24px 0; border-bottom: 1px solid var(--hairline); }
.about-stat:nth-child(odd) { padding-inline-end: 16px; border-inline-end: 1px solid var(--hairline); }
.about-stat:nth-child(even) { padding-inline-start: 16px; }
.about-stat .k {
  font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--ink);
}
.about-stat .v {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 8px;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 50px; } }

/* ---- Work grid ---- */
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.work-card { position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 16px; color: inherit; text-decoration: none; }
.work-card:hover, .work-card:focus { color: inherit; text-decoration: none; }
.work-card:nth-child(odd) { margin-top: 80px; }
.work-card .thumb {
  aspect-ratio: 4/3; background: var(--surface); border-radius: 8px;
  overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.work-card:hover .thumb { transform: scale(.98); }
.work-card .thumb-bg {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent, transparent 18px, color-mix(in oklab, var(--ink) 5%, transparent) 18px, color-mix(in oklab, var(--ink) 5%, transparent) 19px);
  opacity: .6;
}
.work-card .thumb-mark {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(60px, 8vw, 110px); line-height: 1;
  color: var(--ink); font-style: italic; opacity: .18;
}
.work-card .thumb-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}
.work-card:hover .thumb-img { transform: scale(1.04); }
.work-card .thumb:has(.thumb-img) .thumb-bg { display: none; }
.work-card .thumb-tag, .work-card .thumb-year {
  position: absolute; z-index: 2;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  background: var(--bg); padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--hairline);
}
.work-card .thumb-tag { top: 16px; inset-inline-start: 16px; }
.work-card .thumb-year { bottom: 16px; inset-inline-end: 16px; color: var(--muted); }
.work-card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.work-card h3 { font-family: var(--font-display); font-size: 28px; font-weight: 400; margin: 0; letter-spacing: -.02em; }
html[dir="rtl"] .work-card h3 { font-family: var(--font-ar-display); letter-spacing: 0; }
.work-card .role { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.work-card p { margin: 0; color: var(--muted); font-size: 15px; max-width: 50ch; }
@media (max-width: 760px) {
  .work-grid { grid-template-columns: 1fr; gap: 50px; }
  .work-card:nth-child(odd) { margin-top: 0; }
}

/* ---- Featured ---- */
.featured {
  background: var(--surface); border-radius: 16px; padding: 60px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 60px;
  align-items: center; position: relative; overflow: hidden;
}
.featured::before {
  content: ""; position: absolute; top: 24px; inset-inline-end: 24px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ED68A; box-shadow: 0 0 0 4px color-mix(in oklab, #4ED68A 30%, transparent);
}
.featured-tag {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 24px;
}
.featured h3 {
  font-family: var(--font-display); font-size: clamp(36px, 5vw, 60px);
  font-weight: 400; line-height: 1.05; letter-spacing: -.025em;
  margin: 0 0 24px; color: var(--ink);
}
html[dir="rtl"] .featured h3 { font-family: var(--font-ar-display); letter-spacing: 0; }
.featured p { color: var(--muted); font-size: 16px; margin: 0 0 32px; line-height: 1.6; }
.featured-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; padding-top: 32px; border-top: 1px solid var(--hairline); }
.featured-stats .s .k { font-family: var(--font-display); font-size: 32px; line-height: 1; color: var(--ink); }
.featured-stats .s .v { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 6px; }
.featured-visual {
  aspect-ratio: 4/5; background: var(--bg); border-radius: 12px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.featured-visual .browser {
  width: 90%; background: var(--surface-2); border-radius: 8px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: rotate(-2deg); transition: transform .5s cubic-bezier(.2,.8,.2,1);
  text-decoration: none; color: inherit; display: block;
}
.featured:hover .featured-visual .browser { transform: rotate(0deg) scale(1.02); }
.featured-visual .browser-bar { background: var(--bg); border-bottom: 1px solid var(--hairline); padding: 10px 14px; display: flex; align-items: center; gap: 6px; }
.featured-visual .browser-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline-strong); }
.featured-visual .browser-bar .url { margin-inline-start: 10px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.featured-visual .browser-img { width: 100%; display: block; object-fit: cover; aspect-ratio: 16/10; }
@media (max-width: 900px) { .featured { grid-template-columns: 1fr; padding: 32px; gap: 32px; } }
@media (max-width: 576px) { .featured { padding: 24px; gap: 20px; border-radius: 12px; } }


/* ---- Stack ---- */
.stack {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--hairline); border-inline-start: 1px solid var(--hairline);
}
.stack-cell {
  border-inline-end: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 32px 24px; position: relative; transition: background .2s;
  min-height: 160px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.stack-cell:hover { background: var(--surface); }
.stack-cell .glyph {
  font-family: var(--font-display); font-style: italic;
  font-size: 40px; line-height: 1; color: var(--accent);
}
.stack-cell .name { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-weight: 500; letter-spacing: .02em; }
.stack-cell .cat { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 4px; }
.stack-cell .yrs {
  position: absolute; top: 16px; inset-inline-end: 16px;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
@media (max-width: 900px) { .stack { grid-template-columns: 1fr 1fr; } }
@media (max-width: 576px) {
  .stack { grid-template-columns: 1fr; }
  .stack-cell {
    padding: 20px 16px;
    min-height: 140px;
  }
  .stack-cell .glyph { font-size: 32px; }
  .stack-cell .name { font-size: 12px; }
  .stack-cell .cat { font-size: 9px; }
}

/* ---- Timeline ---- */
.timeline { display: flex; flex-direction: column; }
.tl-row {
  display: grid; grid-template-columns: 160px 1fr 1.5fr 60px;
  gap: 40px; padding: 32px 0;
  border-top: 1px solid var(--hairline);
  align-items: start; cursor: pointer;
  transition: padding .3s; position: relative;
}
.tl-row:hover { padding-inline-start: 16px; }
.tl-row:last-child { border-bottom: 1px solid var(--hairline); }
.tl-row .yr { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.tl-row .yr .now {
  display: inline-block; margin-inline-start: 8px;
  padding: 2px 8px; background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; vertical-align: middle;
}
.tl-row .ttl { font-family: var(--font-display); font-size: 28px; font-weight: 400; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
html[dir="rtl"] .tl-row .ttl { font-family: var(--font-ar-display); letter-spacing: 0; }
.tl-row .ttl .co { display: block; font-family: var(--font-sans); font-size: 13px; letter-spacing: 0; color: var(--muted); margin-top: 8px; }
html[dir="rtl"] .tl-row .ttl .co { font-family: var(--font-ar); }
.tl-row .desc { color: var(--muted); font-size: 15px; line-height: 1.55; text-wrap: pretty; }
.tl-row .arrow { font-family: var(--font-mono); font-size: 18px; color: var(--muted); transition: transform .3s, color .3s; justify-self: end; }
.tl-row:hover .arrow { transform: translateX(6px) rotate(-45deg); color: var(--accent); }
html[dir="rtl"] .tl-row:hover .arrow { transform: translateX(-6px) rotate(45deg); }
@media (max-width: 760px) {
  .tl-row { grid-template-columns: 1fr; gap: 12px; padding: 24px 0; }
  .tl-row .arrow { display: none; }
  .tl-row .ttl { font-size: 22px; }
  .tl-row .desc { font-size: 14px; }
}
@media (max-width: 480px) {
  .tl-row { padding: 16px 0; gap: 8px; }
  .tl-row:hover { padding-inline-start: 0; }
  .tl-row .yr { font-size: 12px; }
  .tl-row .ttl { font-size: clamp(18px, 5vw, 24px); }
}

/* ---- Testimonials ---- */
.tests { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.test {
  background: var(--surface); border-radius: 12px; padding: 32px;
  display: flex; flex-direction: column; gap: 24px;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), background .3s;
}
.test:hover { transform: translateY(-4px); background: var(--surface-2); }
.test .quote-mark { font-family: var(--font-display); font-style: italic; font-size: 60px; line-height: .4; color: var(--accent); margin-bottom: -10px; }
.test .body { font-family: var(--font-display); font-size: 20px; line-height: 1.4; letter-spacing: -.01em; color: var(--ink); margin: 0; flex: 1; text-wrap: pretty; }
html[dir="rtl"] .test .body { font-family: var(--font-ar); font-weight: 400; letter-spacing: 0; line-height: 1.85; font-size: 17px; }
.test .who { display: flex; align-items: center; gap: 12px; padding-top: 24px; border-top: 1px solid var(--hairline); }
.test .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-weight: 500; }
.test .who .info { display: flex; flex-direction: column; }
.test .who .nm { font-size: 14px; font-weight: 500; color: var(--ink); }
.test .who .ro { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 900px) { .tests { grid-template-columns: 1fr; } }

/* ---- Contact ---- */
.contact {
  background: var(--ink); color: var(--bg); border-radius: 16px;
  padding: 80px 60px 40px; position: relative; overflow: hidden;
  margin-bottom: 24px;
}
.contact::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 0%, color-mix(in oklab, var(--accent) 25%, transparent), transparent 50%);
  pointer-events: none;
}
.contact-inner { position: relative; }
.contact .eyebrow { color: color-mix(in oklab, var(--bg) 60%, transparent); }
.contact .eyebrow::before { background: var(--accent); }
.contact h2 {
  font-family: var(--font-display); font-size: clamp(50px, 9vw, 130px);
  line-height: .95; letter-spacing: -.04em; font-weight: 400; margin: 24px 0 40px;
}
html[dir="rtl"] .contact h2 { font-family: var(--font-ar-display); letter-spacing: 0; }
.contact-cta {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 18px 28px; background: var(--bg); color: var(--ink);
  border-radius: 999px; font-family: var(--font-mono); font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase; transition: transform .2s;
}
.contact-cta:hover { transform: translateY(-2px); color: var(--ink); }
.contact-cta .arrow {
  width: 28px; height: 28px; background: var(--ink); color: var(--bg);
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .3s;
}
.contact-cta:hover .arrow { transform: rotate(-45deg); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.contact-actions .btn-whatsapp { background: var(--whatsapp); color: #052e16; }
.contact-actions .btn-whatsapp .arrow { background: #052e16; color: var(--whatsapp); }

.contact-grid {
  margin-top: 80px;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px;
  padding-top: 40px;
  border-top: 1px solid color-mix(in oklab, var(--bg) 15%, transparent);
}
.contact-grid h4 {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
  color: color-mix(in oklab, var(--bg) 50%, transparent);
  margin: 0 0 16px; font-weight: 500;
}
.contact-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.contact-grid li { font-size: 14px; }
.contact-grid li a { display: inline-flex; align-items: center; gap: 6px; color: var(--bg); transition: color .2s; }
.contact-grid li a:hover { color: var(--accent); }
.contact-mark { font-family: var(--font-display); font-style: italic; font-size: 80px; line-height: .9; letter-spacing: -.03em; }
html[dir="rtl"] .contact-mark { font-family: var(--font-ar-display); letter-spacing: 0; }

.foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 32px; font-family: var(--font-mono); font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .08em; gap: 16px; flex-wrap: wrap;
}
.foot .now { display: inline-flex; align-items: center; gap: 8px; }
.foot .now::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #4ED68A; box-shadow: 0 0 0 3px color-mix(in oklab, #4ED68A 25%, transparent);
}
@media (max-width: 900px) {
  .contact { padding: 50px 28px 24px; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .foot { flex-direction: column; gap: 8px; padding: 16px 20px; text-align: center; }
}
@media (max-width: 576px) {
  .contact { padding: 40px 20px 16px; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-mark { font-size: clamp(60px, 15vw, 80px); }
}

/* ---- WhatsApp float ---- */
.wa-float {
  position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 90;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--whatsapp); color: #052e16;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px -6px rgba(37, 211, 102, .55);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  animation: floatPulse 3s ease-in-out infinite;
}
.wa-float:hover { transform: scale(1.1) rotate(-8deg); color: #052e16; }
.wa-float svg { width: 30px; height: 30px; }
.wa-float::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--whatsapp); opacity: 0;
  animation: waRing 2s ease-out infinite;
}
@keyframes waRing { 0% { opacity: .8; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes floatPulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (max-width: 600px) { .wa-float { width: 54px; height: 54px; } .wa-float svg { width: 26px; height: 26px; } }

/* ---- Reveal ---- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-x { opacity: 0; transform: translateX(-28px); transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1); }
.reveal-x.in { opacity: 1; transform: translateX(0); }
.stagger > * { opacity: 0; transform: translateY(20px); transition: opacity .7s, transform .7s; }
.stagger.in > * { opacity: 1; transform: translateY(0); }
.stagger.in > *:nth-child(1) { transition-delay: 0s; }
.stagger.in > *:nth-child(2) { transition-delay: .08s; }
.stagger.in > *:nth-child(3) { transition-delay: .16s; }
.stagger.in > *:nth-child(4) { transition-delay: .24s; }
.stagger.in > *:nth-child(5) { transition-delay: .32s; }
.stagger.in > *:nth-child(6) { transition-delay: .4s; }
.stagger.in > *:nth-child(7) { transition-delay: .48s; }
.stagger.in > *:nth-child(8) { transition-delay: .56s; }
.stagger.in > *:nth-child(9) { transition-delay: .64s; }
.stagger.in > *:nth-child(10) { transition-delay: .72s; }
.stagger.in > *:nth-child(11) { transition-delay: .8s; }
.stagger.in > *:nth-child(12) { transition-delay: .88s; }

/* ---- Tilt ---- */
.tilt { transform-style: preserve-3d; transition: transform .15s ease-out; }
.tilt-inner { transform: translateZ(20px); }

/* ---- Magnetic ---- */
.magnetic { display: inline-block; transition: transform .25s cubic-bezier(.2,.8,.2,1); }

/* ---- Tweaks panel (vanilla) ---- */
.tweaks {
  position: fixed; right: 16px; bottom: 16px; z-index: 9990;
  width: 280px; max-height: calc(100vh - 32px);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--hairline); border-radius: 14px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink);
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.25);
  overflow: hidden;
}
html[dir="rtl"] .tweaks { right: auto; left: 16px; }
.tweaks.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tweaks-hd { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.tweaks-hd b { font-size: 12px; font-weight: 600; }
.tweaks-x { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.tweaks-x:hover { background: var(--surface); color: var(--ink); }
.tweaks-body { padding: 14px 16px; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.tweak-sect { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.tweak-row { display: flex; flex-direction: column; gap: 8px; }
.tweak-row .tweak-lbl { color: var(--muted); }
.tweak-seg { display: flex; padding: 2px; background: var(--surface); border-radius: 8px; position: relative; }
.tweak-seg button { flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 11px; color: var(--muted); position: relative; z-index: 1; transition: color .2s; }
.tweak-seg button.on { color: var(--ink); }
.tweak-seg .thumb { position: absolute; top: 2px; bottom: 2px; inset-inline-start: 2px; background: var(--bg); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.08); transition: transform .3s cubic-bezier(.2,.8,.2,1), width .3s; z-index: 0; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 2px solid transparent; transition: transform .15s, border-color .2s; cursor: pointer; }
.swatch.on { border-color: var(--ink); transform: scale(1.08); }
.tweak-trigger {
  position: fixed; right: 16px; bottom: 96px; z-index: 9989;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 16px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.3);
  transition: transform .2s;
}
html[dir="rtl"] .tweak-trigger { right: auto; left: 16px; }
.tweak-trigger:hover { transform: rotate(45deg); }

/* ---- RTL adjustments ---- */
html[dir="rtl"] .hero-meta { direction: rtl; }
html[dir="rtl"] .marquee { direction: ltr; }
