/* ============ THEME: "Neural Pixel" ============ */
:root {
  --bg: #06060a;
  --surface: #0e0e17;
  --surface-2: #151522;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eceaf6;
  --muted: #8b8aa3;
  /* accents are driven by the scroll-journey (js/main.js → theme) */
  --a-rgb: 124 92 255;
  --b-rgb: 34 225 198;
  --accent: rgb(var(--a-rgb));
  --accent-2: rgb(var(--b-rgb));
  --gold: #ffcf5c;
  --grad: linear-gradient(100deg, var(--accent), var(--accent-2));
  --f-display: "Unbounded", system-ui, sans-serif;
  --f-body: "Space Grotesk", system-ui, sans-serif;
  --f-pixel: "Silkscreen", monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
html[lang="ar"] { --f-body: "Cairo", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* ============ INTRO ============ */
.intro { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; pointer-events: all; }
.intro.done { pointer-events: none; }
.intro-tiles { position: absolute; inset: 0; display: grid; }
.intro-tiles i { background: var(--bg); display: block; outline: 1px solid var(--bg); }
.intro-center { position: relative; text-align: center; font-family: var(--f-pixel); }
.intro-logo { font-family: var(--f-display); font-weight: 900; font-size: clamp(56px, 12vw, 120px); line-height: 1; letter-spacing: -.04em; }
.intro-logo span, .nav-logo span { color: var(--accent-2); }
.intro-count { margin-top: 18px; font-size: 14px; color: var(--muted); letter-spacing: .2em; }
.intro-bar { width: 200px; height: 6px; margin: 14px auto 0; background: var(--surface-2); image-rendering: pixelated; }
.intro-bar span { display: block; height: 100%; width: 0; background: var(--grad); }
.intro-hint { margin-top: 14px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .25em; }

/* ============ CHROME ============ */
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; background: var(--grad); transform-origin: left; transform: scaleX(0); z-index: 200; }
html[dir="rtl"] .progress { transform-origin: right; }
.neural { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .55; }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 150; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.cursor, .cursor-ring { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 300; border-radius: 50%; display: none; }
.cursor { width: 6px; height: 6px; background: var(--accent-2); margin: -3px 0 0 -3px; }
.cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1px solid rgba(255,255,255,.35); transition: width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease), background .3s; }
.cursor-ring.hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgb(var(--a-rgb) / .15); border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .cursor, .cursor-ring { display: block; } }

.nav { position: fixed; top: 0; inset-inline: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 18px var(--gutter); mix-blend-mode: difference; }
.nav-logo { font-family: var(--f-display); font-weight: 900; font-size: 22px; letter-spacing: -.04em; }
.nav-links { display: flex; gap: 28px; font-size: 14px; }
.nav-links a { position: relative; opacity: .8; transition: opacity .3s; }
.nav-links a:hover { opacity: 1; }
.nav-links a::after { content: ""; position: absolute; inset-inline: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transition: transform .4s var(--ease); }
.nav-links a:hover::after { transform: scaleX(1); }
.lang { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; font-family: "Cairo", var(--f-body); font-weight: 800; font-size: 15px; transition: background .3s, color .3s; }
.lang:hover { background: #fff; color: #000; }
@media (max-width: 720px) { .nav-links { display: none; } }

.label { font-family: var(--f-pixel); font-size: 12px; letter-spacing: .15em; color: var(--accent-2); margin-bottom: 28px; direction: ltr; }
html[dir="rtl"] .label { text-align: right; }
.section-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(32px, 6vw, 72px); line-height: 1.05; letter-spacing: -.03em; margin-bottom: 48px; }
html[lang="ar"] .section-title, html[lang="ar"] .journey-head h2, html[lang="ar"] .contact-title { font-family: "Cairo", sans-serif; font-weight: 800; letter-spacing: 0; }

.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 15px; transition: background .3s, color .3s; will-change: transform; }
.btn:hover { background: var(--accent-2); }
.btn.small { padding: 10px 20px; font-size: 14px; margin-top: 18px; }

/* ============ HERO ============ */
.hero { overflow-x: clip; min-height: 100svh; padding: 96px var(--gutter) 40px; display: flex; flex-direction: column; position: relative; }
.hero-name { font-family: var(--f-display); font-weight: 900; line-height: .9; text-transform: uppercase; letter-spacing: -.02em; text-align: center; direction: ltr; user-select: none; }
.hero-name .line { display: flex; justify-content: center; align-items: center; white-space: nowrap; }
.hero-name .ch { display: inline-block; flex-shrink: 0; overflow: hidden; line-height: 1.15; padding: 0 .01em; margin-block: -.07em; }
.hero-name .ch-i { display: inline-block; background: linear-gradient(180deg, #fff 30%, #9c98c4); -webkit-background-clip: text; background-clip: text; color: transparent; transition: filter .3s; will-change: transform; }
.hero-name .ch:hover .ch-i { background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.hero-name-ar { text-align: center; font-family: "Cairo", sans-serif; font-weight: 600; color: var(--muted); font-size: clamp(15px, 2vw, 20px); margin-top: 10px; }

.hero-grid { flex: 1; display: grid; grid-template-columns: 1fr minmax(220px, 340px) 1fr; gap: clamp(20px, 4vw, 60px); align-items: center; margin-top: clamp(24px, 4vh, 48px); }
.hero-left { align-self: end; }
.hero-right { align-self: end; text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: rgba(255,255,255,.03); backdrop-filter: blur(8px); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 var(--accent-2); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero-lead { margin-top: 18px; font-size: clamp(18px, 2vw, 24px); line-height: 1.35; max-width: 340px; }
.hero-role { font-size: clamp(18px, 2vw, 24px); }
.rotator { display: inline-block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.hero-sub { color: var(--muted); font-size: 14px; max-width: 300px; }

.hero-photo { position: relative; aspect-ratio: 42 / 52; width: 100%; }
.hero-photo canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; border-radius: 18px; }
.photo-frame { position: absolute; inset: -10px; border: 1px solid var(--line); border-radius: 24px; pointer-events: none; }
.photo-frame::before, .photo-frame::after { content: ""; position: absolute; width: 14px; height: 14px; background: var(--accent-2); }
.photo-frame::before { top: -4px; left: -4px; }
.photo-frame::after { bottom: -4px; right: -4px; background: var(--accent); }
.photo-tag { position: absolute; bottom: 14px; inset-inline-start: 14px; font-family: var(--f-pixel); font-size: 11px; padding: 6px 10px; background: rgba(6,6,10,.7); backdrop-filter: blur(6px); border-radius: 6px; }

.scroll-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 28px; font-family: var(--f-pixel); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3em; }
.scroll-hint i { width: 1px; height: 44px; background: linear-gradient(var(--text), transparent); animation: drip 1.8s var(--ease) infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero-photo { max-width: 260px; order: -1; }
  .hero-left, .hero-right { align-self: auto; text-align: center; align-items: center; }
  .hero-lead { margin-inline: auto; }
}

/* ============ ABOUT ============ */
.about { padding: clamp(100px, 16vh, 180px) var(--gutter); max-width: 1300px; margin: 0 auto; }
.about-text { font-family: var(--f-display); font-weight: 500; font-size: clamp(22px, 3.4vw, 46px); line-height: 1.3; letter-spacing: -.02em; }
html[lang="ar"] .about-text { font-family: "Cairo", sans-serif; font-weight: 600; letter-spacing: 0; line-height: 1.6; }
.about-text .w { opacity: .15; transition: opacity .2s; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 72px; }
.stat { padding: 28px 22px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.03), transparent); }
.stat b, .stat > span { font-family: var(--f-display); font-weight: 900; font-size: clamp(36px, 5vw, 64px); line-height: 1; }
.stat > span { color: var(--accent-2); }
.stat p { margin-top: 10px; color: var(--muted); font-size: 14px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ============ JOURNEY ============ */
.journey { position: relative; }
.journey-pin { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 90px 0 40px; overflow: hidden; }
.journey-head { padding: 0 var(--gutter); margin-bottom: 40px; max-width: 900px; }
.journey-head h2 { font-family: var(--f-display); font-weight: 700; font-size: clamp(24px, 3.4vw, 44px); line-height: 1.15; letter-spacing: -.02em; }
.journey-track { display: flex; gap: 28px; padding: 0 var(--gutter); width: max-content; will-change: transform; }
.chapter { position: relative; width: min(78vw, 420px); flex-shrink: 0; padding: 32px; border-radius: 26px; border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface-2), var(--surface)); overflow: hidden; }
.chapter::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 0%), rgb(var(--a-rgb) / .18), transparent 40%); opacity: 0; transition: opacity .4s; }
.chapter:hover::before { opacity: 1; }
.ch-num { font-family: var(--f-pixel); font-size: 64px; line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.25); position: absolute; top: 20px; inset-inline-end: 24px; }
.chapter .pix { width: 120px; height: 120px; image-rendering: pixelated; display: block; margin-bottom: 26px; }
.chapter h3 { font-family: var(--f-display); font-size: 26px; font-weight: 700; margin-bottom: 10px; letter-spacing: -.02em; }
html[lang="ar"] .chapter h3, html[lang="ar"] .card h3 { font-family: "Cairo", sans-serif; font-weight: 800; letter-spacing: 0; }
.chapter p { color: var(--muted); font-size: 16px; }
.chapter-next { background: var(--grad); border: 0; }
.chapter-next p, .chapter-next .ch-num { color: rgba(6,6,10,.75); -webkit-text-stroke-color: rgba(6,6,10,.3); }
.chapter-next h3 { color: var(--bg); }
.chapter-next .btn { background: var(--bg); color: var(--text); }
.journey-progress { margin: 40px var(--gutter) 0; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.journey-progress span { display: block; height: 100%; width: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left; }
html[dir="rtl"] .journey-progress span { transform-origin: right; }

/* vertical journey on small screens */
@media (max-width: 899px) {
  .journey-track { flex-direction: column; width: auto; padding: 0 var(--gutter); gap: 20px; position: relative; }
  .chapter { width: 100%; }
  .journey-progress { display: none; }
}

/* ============ PROJECTS ============ */
.projects { padding: clamp(100px, 16vh, 180px) var(--gutter); max-width: 1300px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.card { position: relative; padding: 32px; border-radius: 26px; border: 1px solid var(--line); background: var(--surface); transition: border-color .4s; overflow: hidden; }
.card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgb(var(--b-rgb) / .12), transparent 45%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.card:hover { border-color: rgb(var(--a-rgb) / .5); }
.card:hover::after { opacity: 1; }
.card .pix { width: 84px; height: 84px; image-rendering: pixelated; display: block; margin-bottom: 22px; }
.badge { position: absolute; top: 28px; inset-inline-end: 28px; font-family: var(--f-pixel); font-size: 11px; padding: 6px 10px; border-radius: 6px; background: rgb(var(--a-rgb) / .15); color: #b9a8ff; border: 1px solid rgb(var(--a-rgb) / .35); }
.badge.gold { background: rgba(255,207,92,.12); color: var(--gold); border-color: rgba(255,207,92,.4); }
.card h3 { font-family: var(--f-display); font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.02em; margin-bottom: 10px; }
.card p { color: var(--muted); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tags li { font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr !important; } }

/* ============ SKILLS ============ */
.skills { padding: 40px 0; border-block: 1px solid var(--line); overflow: hidden; direction: ltr; }
.marquee { display: flex; overflow: hidden; }
.marquee-inner { display: flex; flex-shrink: 0; gap: 40px; padding-inline-end: 40px; animation: marq 28s linear infinite; font-family: var(--f-display); font-weight: 900; font-size: clamp(36px, 7vw, 96px); text-transform: uppercase; white-space: nowrap; letter-spacing: -.03em; }
.marquee.reverse .marquee-inner { animation-direction: reverse; font-size: clamp(20px, 3vw, 40px); color: transparent; -webkit-text-stroke: 1px var(--muted); margin-top: 8px; animation-duration: 22s; }
.marquee-inner span:nth-child(even) { color: var(--accent); -webkit-text-stroke: 0; }
@keyframes marq { to { transform: translateX(-100%); } }

/* ============ CONTACT ============ */
.contact { padding: clamp(100px, 16vh, 180px) var(--gutter) 80px; max-width: 1300px; margin: 0 auto; }
.contact-title { font-family: var(--f-display); font-weight: 900; font-size: clamp(40px, 9vw, 130px); line-height: .95; letter-spacing: -.04em; margin-bottom: 64px; }
.contact-title em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.contact-links { border-top: 1px solid var(--line); }
.clink { position: relative; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 24px; padding: 30px 8px; border-bottom: 1px solid var(--line); overflow: hidden; }
.clink::before { content: ""; position: absolute; inset: 0; background: var(--grad); transform: scaleY(0); transform-origin: bottom; transition: transform .5s var(--ease); z-index: -1; }
.clink:hover::before { transform: scaleY(1); }
.clink:hover { color: var(--bg); }
.clink-k { font-family: var(--f-display); font-weight: 700; font-size: clamp(22px, 4vw, 48px); letter-spacing: -.02em; transition: transform .5s var(--ease); }
.clink:hover .clink-k { transform: translateX(16px); }
html[dir="rtl"] .clink:hover .clink-k { transform: translateX(-16px); }
.clink-v { color: var(--muted); font-size: 15px; transition: color .3s; }
.clink:hover .clink-v { color: var(--bg); }
.clink b { font-size: 28px; transition: transform .5s var(--ease); }
.clink:hover b { transform: rotate(45deg); }
@media (max-width: 560px) { .clink { grid-template-columns: 1fr auto; } .clink-v { grid-row: 2; font-size: 13px; } .clink b { grid-row: 1 / 3; grid-column: 2; } }

.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 30px var(--gutter); color: var(--muted); font-size: 13px; }

/* ============ REVEAL ============ */
[data-reveal] { opacity: 0; transform: translateY(40px); }
.no-js [data-reveal], .reduced [data-reveal] { opacity: 1; transform: none; }

/* ============ CHAT ============ */
.chat-fab { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 400; width: 60px; height: 60px; border-radius: 50%; background: var(--grad); color: var(--bg); display: grid; place-items: center; box-shadow: 0 10px 40px rgb(var(--a-rgb) / .45); transition: transform .4s var(--ease); }
.chat-fab:hover { transform: scale(1.08) rotate(-6deg); }
.chat-fab-dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg); }
.chat-fab.open .chat-fab-dot { display: none; }
.chat { position: fixed; bottom: 96px; inset-inline-end: 22px; z-index: 400; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100svh - 130px)); display: flex; flex-direction: column; border-radius: 22px; border: 1px solid var(--line); background: rgba(14, 14, 23, .92); backdrop-filter: blur(18px); box-shadow: 0 30px 80px rgba(0,0,0,.6); opacity: 0; transform: translateY(20px) scale(.96); transform-origin: bottom right; pointer-events: none; transition: opacity .35s var(--ease), transform .35s var(--ease); }
html[dir="rtl"] .chat { transform-origin: bottom left; }
.chat.open { opacity: 1; transform: none; pointer-events: all; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 15px; }
.chat-head small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.chat-head small i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); }
.chat-avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: var(--bg); display: grid; place-items: center; font-family: var(--f-display); font-weight: 900; font-size: 14px; }
.chat-close { margin-inline-start: auto; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.chat-close:hover { background: var(--surface-2); color: var(--text); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; animation: msgIn .35s var(--ease); }
.msg.bot { background: var(--surface-2); align-self: flex-start; border-end-start-radius: 4px; }
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-end-end-radius: 4px; }
.msg a { color: var(--accent-2); text-decoration: underline; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-5px); opacity: .5; } }
.chat-chips { display: flex; gap: 8px; padding: 0 18px 10px; flex-wrap: wrap; }
.chat-chips button { font-size: 12.5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); transition: border-color .3s, background .3s; }
.chat-chips button:hover { border-color: var(--accent); background: rgb(var(--a-rgb) / .12); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 12px 14px; color: var(--text); font: inherit; font-size: 16px; outline: none; transition: border-color .3s; }
.chat-form input:focus { border-color: var(--accent); }
.chat-form button { width: 46px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 16px; }
html[dir="rtl"] .chat-form button { transform: scaleX(-1); }
.chat-form button:disabled { opacity: .4; }

/* ============ MANIFESTO ============ */
.manifesto { padding: clamp(60px, 10vh, 120px) 0; overflow: hidden; direction: ltr; border-block: 1px solid var(--line); }
.m-line { font-family: var(--f-display); font-weight: 900; font-size: clamp(48px, 10vw, 150px); line-height: 1.02; letter-spacing: -.04em; white-space: nowrap; will-change: transform; }
.m-line i { font-style: normal; color: var(--accent-2); font-size: .5em; vertical-align: middle; }
.m-line.outline { color: transparent; -webkit-text-stroke: 1.5px rgba(255,255,255,.35); }
.m-line.outline i { -webkit-text-stroke: 0; color: var(--accent); }

/* ============ SERVICES (sticky stack) ============ */
.services { padding: clamp(100px, 16vh, 180px) var(--gutter) 40px; max-width: 1300px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 40px; padding-bottom: 10vh; }
.scard { position: sticky; top: calc(96px + var(--i) * 28px); min-height: min(62vh, 520px); padding: clamp(28px, 4vw, 56px); border-radius: 30px; border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface-2), var(--surface)); display: flex; flex-direction: column; justify-content: flex-end; transform-origin: top center; box-shadow: 0 -20px 60px rgba(0,0,0,.45); overflow: hidden; }
.scard::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; mask-image: radial-gradient(circle at 85% 15%, #000, transparent 60%); -webkit-mask-image: radial-gradient(circle at 85% 15%, #000, transparent 60%); pointer-events: none; }
.scard.alt { background: linear-gradient(160deg, #1b1340, #0e0b22); }
.scard.grad { background: var(--grad); color: var(--bg); border: 0; }
.scard.grad p, .scard.grad .scard-k { color: rgba(6,6,10,.75); }
.scard.grad .tags li { border-color: rgba(6,6,10,.25); color: var(--bg); }
.scard-top { position: absolute; top: clamp(28px, 4vw, 48px); inset-inline: clamp(28px, 4vw, 56px); display: flex; justify-content: space-between; font-family: var(--f-pixel); }
.scard-n { font-size: clamp(48px, 7vw, 96px); line-height: 1; }
.scard-k { font-size: 12px; letter-spacing: .2em; color: var(--accent-2); }
.scard h3 { position: relative; font-family: var(--f-display); font-weight: 900; font-size: clamp(30px, 5vw, 68px); line-height: 1; letter-spacing: -.03em; margin-bottom: 16px; }
html[lang="ar"] .scard h3, html[lang="ar"] .step h4 { font-family: "Cairo", sans-serif; letter-spacing: 0; }
.scard p { position: relative; color: var(--muted); font-size: clamp(16px, 1.6vw, 20px); max-width: 640px; }

/* ============ PROCESS ============ */
.process { padding: clamp(100px, 16vh, 180px) var(--gutter); max-width: 1300px; margin: 0 auto; }
.steps { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; padding-top: 48px; }
.steps-line { position: absolute; top: 0; inset-inline: 0; height: 2px; background: var(--surface-2); }
.steps-line span { display: block; height: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left; }
html[dir="rtl"] .steps-line span { transform-origin: right; }
.step { position: relative; }
.step::before { content: ""; position: absolute; top: -54px; inset-inline-start: 0; width: 14px; height: 14px; background: var(--bg); border: 2px solid var(--accent-2); }
.step b { font-family: var(--f-pixel); font-size: 13px; color: var(--accent-2); }
.step h4 { font-family: var(--f-display); font-size: clamp(20px, 2vw, 26px); margin: 8px 0; letter-spacing: -.02em; }
.step p { color: var(--muted); font-size: 15px; }
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; padding-top: 0; padding-inline-start: 36px; gap: 36px; }
  .steps-line { top: 0; bottom: 0; inset-inline-start: 6px; inset-inline-end: auto; width: 2px; height: auto; }
  .steps-line span { transform: scaleY(0); transform-origin: top; width: 100%; }
  .step::before { top: 4px; inset-inline-start: -36px; }
}

/* ============ AI LAB ============ */
.lab { padding: clamp(100px, 16vh, 180px) var(--gutter); max-width: 1300px; margin: 0 auto; }
.lab .section-title { margin-bottom: 20px; }
.lab-intro { color: var(--muted); font-size: clamp(16px, 1.6vw, 19px); max-width: 760px; margin-bottom: 48px; }
.lab-grid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: clamp(24px, 4vw, 56px); padding: clamp(20px, 3vw, 36px); border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.lab-stage { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 1; }
.lab-stage canvas { width: 100%; height: 100%; display: block; }
.lab-scan { position: absolute; inset-inline: 0; top: 0; height: 8%; background: linear-gradient(180deg, transparent, rgb(var(--b-rgb) / .55), transparent); border-block: 1px solid var(--accent-2); opacity: 0; pointer-events: none; transform: translateY(-50%); }
.lab-scan.on { opacity: 1; }
.lab-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chipbtn { font-size: 13px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; transition: border-color .3s, background .3s; }
.chipbtn:hover { border-color: var(--accent); }
.chipbtn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.lab-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.kernel { margin-top: 22px; }
.kernel-head { font-family: var(--f-pixel); font-size: 11px; color: var(--muted); letter-spacing: .1em; margin-bottom: 10px; }
.kernel-head b { color: var(--text); font-weight: 400; }
.kernel-grid { display: grid; grid-template-columns: repeat(3, 48px); gap: 6px; direction: ltr; }
.kernel-grid span { height: 48px; display: grid; place-items: center; border-radius: 10px; background: var(--bg); font-family: var(--f-pixel); font-size: 14px; color: var(--muted); border: 1px solid var(--line); }
.kernel-grid .pos { color: var(--accent-2); border-color: rgb(var(--b-rgb) / .35); }
.kernel-grid .neg { color: #b9a8ff; border-color: rgb(var(--a-rgb) / .35); }
.lab-step { display: flex; align-items: center; gap: 12px; font-family: var(--f-pixel); font-size: 11px; color: var(--accent-2); margin-bottom: 16px; direction: ltr; }
.lab-step i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.map { position: relative; display: grid; grid-template-columns: 2fr 1fr; gap: 6px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); text-align: start; transition: border-color .3s, transform .3s var(--ease); }
.map:hover { transform: translateY(-3px); }
.map.active { border-color: var(--accent-2); }
.map canvas { width: 100%; aspect-ratio: 1; image-rendering: pixelated; border-radius: 8px; display: block; }
.map canvas.pool { align-self: end; }
.map span { grid-column: 1 / -1; font-family: var(--f-pixel); font-size: 10px; color: var(--muted); padding: 2px 2px 0; direction: ltr; text-align: left; }
.energy { margin-top: 24px; display: grid; gap: 8px; }
.energy-title { font-family: var(--f-pixel); font-size: 11px; color: var(--muted); letter-spacing: .1em; margin-bottom: 4px; }
.bar { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: center; direction: ltr; }
.bar span { font-family: var(--f-pixel); font-size: 10px; color: var(--muted); }
.bar i { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.bar b { display: block; height: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .9s var(--ease); }
@media (max-width: 860px) {
  .lab-grid { grid-template-columns: 1fr; }
  .lab-input { max-width: 340px; width: 100%; margin: 0 auto; }
  .maps { grid-template-columns: repeat(2, 1fr); }
}

/* ============ MOBILE MENU ============ */
.nav-actions { display: flex; align-items: center; gap: 10px; }
.burger { display: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); position: relative; }
.burger i { position: absolute; left: 11px; right: 11px; height: 1.5px; background: #fff; transition: transform .4s var(--ease), top .4s var(--ease); }
.burger i:first-child { top: 15px; } .burger i:last-child { top: 23px; }
.burger.open i:first-child { top: 19px; transform: rotate(45deg); }
.burger.open i:last-child { top: 19px; transform: rotate(-45deg); }
@media (max-width: 720px) { .burger { display: block; } }
.mmenu { position: fixed; inset: 0; z-index: 90; background: rgba(6,6,10,.96); backdrop-filter: blur(16px); display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 var(--gutter); clip-path: circle(0 at calc(100% - 40px) 38px); transition: clip-path .7s var(--ease); }
html[dir="rtl"] .mmenu { clip-path: circle(0 at 40px 38px); }
.mmenu.open { clip-path: circle(150% at calc(100% - 40px) 38px) !important; }
.mmenu a { font-family: var(--f-display); font-weight: 900; font-size: clamp(36px, 11vw, 56px); letter-spacing: -.03em; line-height: 1.15; opacity: 0; transform: translateY(30px); transition: opacity .5s, transform .6s var(--ease); }
html[lang="ar"] .mmenu a { font-family: "Cairo", sans-serif; }
.mmenu.open a { opacity: 1; transform: none; }
.mmenu.open a:nth-child(2) { transition-delay: .05s; } .mmenu.open a:nth-child(3) { transition-delay: .1s; }
.mmenu.open a:nth-child(4) { transition-delay: .15s; } .mmenu.open a:nth-child(5) { transition-delay: .2s; } .mmenu.open a:nth-child(6) { transition-delay: .25s; }
.mmenu a:hover { color: var(--accent-2); }

/* ============ CHAT HINT ============ */
.chat-hint { position: fixed; bottom: 36px; inset-inline-end: 94px; z-index: 399; padding: 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; transform: translateX(10px); pointer-events: none; transition: opacity .4s, transform .5s var(--ease); white-space: nowrap; }
.chat-hint.show { opacity: 1; transform: none; }

/* ============ ASSISTANT-DRIVEN HIGHLIGHTS ============ */
.spot { animation: spot 2.4s var(--ease); }
@keyframes spot {
  0% { box-shadow: 0 0 0 0 rgb(var(--b-rgb) / 0); }
  15% { box-shadow: 0 0 0 3px var(--accent-2), 0 0 60px rgb(var(--b-rgb) / .45); }
  70% { box-shadow: 0 0 0 3px var(--accent-2), 0 0 60px rgb(var(--b-rgb) / .3); }
  100% { box-shadow: 0 0 0 0 rgb(var(--b-rgb) / 0); }
}
.spot-text { animation: spotText 2.2s var(--ease); }
@keyframes spotText { 20%, 60% { text-shadow: 0 0 30px rgb(var(--a-rgb) / .9); } }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.msg-actions a { text-decoration: none; color: var(--bg); background: var(--grad); padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.chat-fab.ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent-2); animation: fabPing 1.6s ease-out 3; }
@keyframes fabPing { to { transform: scale(1.6); opacity: 0; } }

/* ============ MOBILE OPTIMISATION ============ */
html { -webkit-tap-highlight-color: transparent; }
.chat-fab { bottom: calc(22px + env(safe-area-inset-bottom)); }
.chat-hint { bottom: calc(36px + env(safe-area-inset-bottom)); }
body.chat-locked { overflow: hidden; }

@media (max-width: 899px) {
  /* journey → vertical timeline */
  .journey-pin { min-height: auto; padding: 72px 0 24px; }
  .journey-head { margin-bottom: 28px; }
  .journey-track { --jp: 0; padding-inline-start: calc(var(--gutter) + 28px); gap: 14px; }
  .journey-track::before, .journey-track::after { content: ""; position: absolute; top: 10px; bottom: 10px; inset-inline-start: calc(var(--gutter) + 7px); width: 2px; border-radius: 2px; }
  .journey-track::before { background: var(--surface-2); }
  .journey-track::after { background: linear-gradient(var(--accent), var(--accent-2)); transform: scaleY(var(--jp)); transform-origin: top; }
  .chapter { overflow: visible; padding: 18px 18px 18px 16px; border-radius: 18px; display: grid; grid-template-columns: 52px 1fr; column-gap: 14px; align-items: center; }
  .chapter::before { display: none; }
  .chapter::after { content: ""; position: absolute; top: 28px; inset-inline-start: -27px; width: 12px; height: 12px; background: var(--bg); border: 2px solid var(--accent-2); }
  .chapter .pix { width: 52px; height: 52px; margin: 0; grid-row: 1 / span 2; }
  .chapter h3 { font-size: 19px; margin: 0 0 2px; padding-inline-end: 40px; }
  .chapter p { font-size: 14.5px; line-height: 1.5; grid-column: 2; }
  .ch-num { font-size: 26px; top: 14px; inset-inline-end: 14px; }
  .chapter-next .btn { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 720px) {
  .about, .projects, .services, .lab, .process, .contact { padding-top: 76px; padding-bottom: 76px; }
  .section-title { margin-bottom: 30px; }
  .label { margin-bottom: 16px; }
  .hero { padding-top: 84px; padding-bottom: 24px; }
  .hero-grid { gap: 18px; margin-top: 22px; }
  .hero-photo { max-width: 230px; }
  .hero-lead { font-size: 18px; }
  .hero-right { gap: 10px; }
  .scroll-hint { display: none; }
  .about-text { font-size: 21px; }
  .stats { margin-top: 40px; gap: 10px; }
  .stat { padding: 20px 16px; border-radius: 14px; }
  .manifesto { padding: 40px 0; }
  /* services: compact sticky cards */
  .stack { gap: 18px; padding-bottom: 4vh; }
  .scard { top: calc(72px + var(--i) * 14px); min-height: 0; padding: 24px; border-radius: 22px; }
  .scard-top { position: static; margin-bottom: 36px; }
  .scard-n { font-size: 44px; }
  .scard h3 { font-size: 28px; margin-bottom: 10px; }
  .scard p { font-size: 15px; }
  .scard .tags { margin-top: 16px; }
  .card { padding: 24px; border-radius: 20px; }
  .card .pix { width: 64px; height: 64px; margin-bottom: 16px; }
  .badge { top: 22px; inset-inline-end: 22px; }
  .lab-grid { padding: 16px; border-radius: 22px; }
  .lab-intro { margin-bottom: 28px; font-size: 15.5px; }
  .contact-title { margin-bottom: 36px; }
  .clink { padding: 22px 4px; }
  .chat-hint { font-size: 13px; padding: 8px 12px; inset-inline-end: 88px; }
}

@media (max-width: 560px) {
  /* chat becomes a bottom sheet */
  .chat { inset-inline: 0; bottom: 0; width: 100%; height: min(86dvh, 680px); border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transform-origin: bottom center; }
  html[dir="rtl"] .chat { transform-origin: bottom center; }
  .chat.open { transform: none; }
  .chat-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
  .chat-head { position: relative; padding-top: 20px; }
  .chat-fab.open { opacity: 0; pointer-events: none; transform: scale(.6); }
  .msg { max-width: 90%; }
}


/* ============ PARTICLE PHOTO ============ */
.hero-photo canvas { position: absolute; inset: -70px; width: calc(100% + 140px); height: calc(100% + 140px); border-radius: 0; image-rendering: auto; pointer-events: none; z-index: 1; }
.hero-photo { touch-action: pan-y; }
.photo-tag { z-index: 2; }

/* ============ FEATURED PROJECT + PHONE ============ */
.cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card-feature { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 4vw, 60px); align-items: center; padding: clamp(28px, 4vw, 56px); background: radial-gradient(600px circle at 80% 50%, rgba(255, 70, 140, .14), transparent 60%), var(--surface); }
.badge.static { position: static; display: inline-block; margin-bottom: 18px; }
.card-feature h3 { font-size: clamp(30px, 4vw, 52px); }
.cf-points { list-style: none; margin-top: 22px; display: grid; gap: 12px; }
.cf-points li { position: relative; padding-inline-start: 26px; color: var(--text); font-size: 15.5px; }
.cf-points li::before { content: ""; position: absolute; inset-inline-start: 0; top: .55em; width: 10px; height: 10px; background: var(--grad); }
.phone-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px; perspective: 1400px; }
.phone-wrap::before { content: ""; position: absolute; inset: 10% -10%; background: radial-gradient(closest-side, rgba(255, 70, 140, .35), transparent); filter: blur(30px); z-index: 0; }
.phone-tilt { position: relative; z-index: 1; transform-style: preserve-3d; will-change: transform; }
.phone { position: relative; width: clamp(210px, 22vw, 280px); aspect-ratio: 1206 / 2622; padding: 9px; border-radius: 48px; background: linear-gradient(145deg, #3a3a46, #101016 40%, #26262f); box-shadow: inset 0 0 0 1.5px #4a4a58, inset 0 0 0 4px #0b0b10, 0 50px 90px -20px rgba(0,0,0,.8), 0 30px 60px -30px rgba(255, 70, 140, .5); transform: rotateY(-16deg) rotateX(6deg); transform-style: preserve-3d; }
.phone::before { content: ""; position: absolute; top: 22%; inset-inline-end: -3px; width: 3px; height: 13%; border-radius: 2px; background: #2c2c36; }
.phone::after { content: ""; position: absolute; inset: 9px; border-radius: 40px; background: linear-gradient(115deg, rgba(255,255,255,.18) 0%, transparent 28%, transparent 70%, rgba(255,255,255,.06)); pointer-events: none; }
.phone-screen { position: relative; width: 100%; height: 100%; border-radius: 40px; overflow: hidden; background: #000; cursor: pointer; }
.phone-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06) translateY(10px); transition: opacity .8s var(--ease), transform 1.2s var(--ease); }
.phone-screen img.active { opacity: 1; transform: none; }
.phone-dots { position: relative; z-index: 1; display: flex; gap: 8px; }
.phone-dots button { width: 8px; height: 8px; border-radius: 8px; background: var(--line); transition: width .4s var(--ease), background .4s; }
.phone-dots button.on { width: 26px; background: var(--grad); }
@media (max-width: 860px) {
  .card-feature { grid-template-columns: 1fr; }
  .phone-wrap { order: -1; margin-bottom: 8px; gap: 40px; }
  .phone { width: min(230px, 62vw); }
}

/* ============ AMBIENT JOURNEY LIGHT ============ */
.ambient { position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vmax 60vmax at 12% 18%, rgb(var(--a-rgb) / .16), transparent 60%),
    radial-gradient(55vmax 55vmax at 88% 85%, rgb(var(--b-rgb) / .12), transparent 60%); }
.theme-chip { position: fixed; z-index: 120; bottom: calc(30px + env(safe-area-inset-bottom)); inset-inline-start: var(--gutter); display: flex; align-items: center; gap: 10px; font-family: var(--f-pixel); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); pointer-events: none; opacity: 0; transition: opacity .6s; direction: ltr; }
.theme-chip.on { opacity: 1; }
.theme-chip i { width: 22px; height: 8px; background: var(--grad); }
@media (max-width: 720px) { .theme-chip { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
