/* ============================================================
       DESIGN TOKENS
       ============================================================ */
:root {
  --bg: #f4efe6; /* warm cream */
  --bg-2: #ece5d6; /* deeper cream for cards */
  --paper: #fbf8f1;
  --ink: #141414; /* near-black */
  --ink-2: #3a3a3a;
  --muted: #6b6358;
  --line: #d9cfbc;
  --accent: #b84b2a; /* warm rust */
  --accent-2: #8a3a21;
  --ok: #2d6a4f;

  /* surface helpers — themed */
  --nav-bg: rgba(244, 239, 230, 0.78);
  --nav-bg-scroll: rgba(244, 239, 230, 0.92);
  --grain-color: rgba(20, 20, 20, 0.07);
  --grain-color-2: rgba(20, 20, 20, 0.04);
  --grain-opacity: 0.35;
  --grain-blend: multiply;
  --chip-bg: var(--bg-2);

  --f-serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --f-sans: "Geist", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-arabic: "Tajawal", "Geist", system-ui, -apple-system, sans-serif;
}

/* ============================================================
       DARK THEME — premium charcoal (tuned for readable contrast)
       Body uses soft ivory (--ink) on deep charcoal (--bg); never pure
       white on pure black. Muted/labels stay above WCAG-AA.
       ============================================================ */
[data-theme="dark"] {
  --bg: #121214;
  --bg-2: #1a1a1e;
  --paper: #1e1e22;
  --ink: #ebeae6; /* soft ivory — not pure white */
  --ink-2: #c9c7c1; /* body text */
  --muted: #9b9892; /* labels (passes AA on bg) */
  --line: #2e2e34;
  --accent: #e76b47; /* brighter rust for dark bg */
  --accent-2: #c04827;
  --ok: #4fcb95;

  --nav-bg: rgba(18, 18, 20, 0.72);
  --nav-bg-scroll: rgba(18, 18, 20, 0.92);
  --grain-color: rgba(255, 255, 255, 0.05);
  --grain-color-2: rgba(255, 255, 255, 0.025);
  --grain-opacity: 0.55;
  --grain-blend: screen;
  --chip-bg: #25252b;

  color-scheme: dark;
}
/* Contact section is *always* cream-on-dark — even in dark mode, text must stay light
       (var(--bg) becomes #121214 in dark mode, which would disappear on the dark contact bg). */
[data-theme="dark"] .contact-wrap {
  background: #0c0c0e;
  color: #f4efe6;
}
[data-theme="dark"] .contact-wrap .section-title,
[data-theme="dark"] .contact-wrap .contact-lead,
[data-theme="dark"] .contact-wrap .c-row .c-val,
[data-theme="dark"] .contact-wrap .c-row .c-icon,
[data-theme="dark"] .contact-wrap .contact-btn {
  color: #f4efe6;
}
[data-theme="dark"] .contact-wrap .contact-btn.primary {
  color: #141414;
}
[data-theme="dark"] .contact-wrap .c-row a.c-val:hover,
[data-theme="dark"] .contact-wrap .c-copy:hover {
  color: #e8a88e;
}
[data-theme="dark"] .nav-bar.scrolled {
  border-bottom-color: var(--line);
}
[data-theme="dark"] .brand-mark {
  background: var(--ink);
  color: var(--bg);
}
[data-theme="dark"] .btn-ink {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
[data-theme="dark"] .btn-ink:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[data-theme="dark"] .btn-ghost {
  border-color: var(--ink);
  color: var(--ink);
}
[data-theme="dark"] .btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
[data-theme="dark"] .nav-cta {
  border-color: var(--ink);
  color: var(--ink);
}
[data-theme="dark"] .nav-cta:hover {
  background: var(--ink);
  color: var(--bg);
}
[data-theme="dark"] ::selection {
  background: var(--accent);
  color: #fff;
}

/* ============================================================
       WORDMARK LOGO  —  3 typography options
       ------------------------------------------------------------
       Default: brand-serif (Option 1). Swap the class on the
       <a id="brand"> element to brand-sans or brand-mono.
       Each variant is theme- and language-aware automatically.
       ============================================================ */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  line-height: 1;
  transition:
    color 0.3s ease,
    transform 0.3s ease;
}
/* Language toggle — show only the active script */
.wm-en {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
}
.wm-ar {
  display: none;
  align-items: baseline;
  gap: 0.15em;
}
html[lang="ar"] .wm-en {
  display: none;
}
html[lang="ar"] .wm-ar {
  display: inline-flex;
}

/* ---------------------------------------------------------------
       OPTION 1 — ELEGANT SERIF (editorial, luxurious)        [DEFAULT]
       --------------------------------------------------------------- */
.brand-serif .wordmark {
  font-family: var(--f-serif);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
.brand-serif .wm-first {
  font-style: italic;
  color: var(--accent);
  padding-right: 0.18em;
}
.brand-serif .wm-last {
  font-style: italic;
  color: var(--ink);
}
.brand-serif .wm-sep,
.brand-serif .wm-bracket {
  display: none;
}
html[lang="ar"] .brand-serif .wordmark {
  font-family: var(--f-arabic);
  font-weight: 700;
  font-size: 1.2rem;
}
html[lang="ar"] .brand-serif .wm-first,
html[lang="ar"] .brand-serif .wm-last {
  font-style: normal;
}
html[lang="ar"] .brand-serif .wm-first {
  padding: 0;
  padding-left: 0.28em;
}

/* ---------------------------------------------------------------
       OPTION 2 — MODERN TECH / SANS (geometric, futuristic)
       --------------------------------------------------------------- */
.brand-sans .wordmark {
  font-family: var(--f-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--ink);
}
.brand-sans .wm-first,
.brand-sans .wm-last {
  color: var(--ink);
}
.brand-sans .wm-sep {
  display: inline-block;
  width: 0.32em;
  height: 0.32em;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 0.4em;
  transform: translateY(-0.05em);
  font-size: 0;
  color: transparent;
}
.brand-sans .wm-bracket {
  display: none;
}
html[lang="ar"] .brand-sans .wordmark {
  font-family: var(--f-arabic);
  font-weight: 800;
  text-transform: none;
  font-size: 1rem;
}

/* ---------------------------------------------------------------
       OPTION 3 — MINIMALIST MONOSPACE (developer-centric)
       --------------------------------------------------------------- */
.brand-mono .wordmark {
  font-family: var(--f-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  color: var(--ink);
  gap: 0;
}
.brand-mono .wm-bracket {
  color: var(--muted);
  display: inline;
}
.brand-mono .wm-first {
  color: var(--ink);
}
.brand-mono .wm-sep {
  display: inline;
  font-size: 0;
}
.brand-mono .wm-sep::before {
  content: "-";
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 0.04em;
}
.brand-mono .wm-last {
  color: var(--accent);
}
html[lang="ar"] .brand-mono .wordmark {
  font-family: var(--f-arabic);
  font-weight: 600;
  text-transform: none;
  font-size: 0.95rem;
}
html[lang="ar"] .brand-mono .wm-sep::before {
  content: "·";
  padding: 0 0.25em;
}

/* ============================================================
       ANIMATIONS & TRANSITIONS
       ============================================================ */
@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Hero staggered entrance on load */
.stagger > * {
  opacity: 0;
  animation: heroIn 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.stagger > *:nth-child(1) {
  animation-delay: 0.05s;
}
.stagger > *:nth-child(2) {
  animation-delay: 0.15s;
}
.stagger > *:nth-child(3) {
  animation-delay: 0.28s;
}
.stagger > *:nth-child(4) {
  animation-delay: 0.42s;
}
.stagger > *:nth-child(5) {
  animation-delay: 0.55s;
}
.stagger > *:nth-child(6) {
  animation-delay: 0.68s;
}

/* Hero card slides in from the side after the text settles */
.hero-card-wrap {
  opacity: 0;
  animation: heroIn 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: 0.5s;
}

/* Reveal slide variants for sections */
.reveal.slide-l {
  transform: translateX(-22px);
}
.reveal.slide-r {
  transform: translateX(22px);
}
[dir="rtl"] .reveal.slide-l {
  transform: translateX(22px);
}
[dir="rtl"] .reveal.slide-r {
  transform: translateX(-22px);
}
.reveal.in.slide-l,
.reveal.in.slide-r {
  transform: none;
}

/* Stagger children inside .reveal-children once it enters view */
.reveal-children > * {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.7s ease,
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal-children.in > * {
  opacity: 1;
  transform: none;
}
.reveal-children.in > *:nth-child(1) {
  transition-delay: 0.05s;
}
.reveal-children.in > *:nth-child(2) {
  transition-delay: 0.15s;
}
.reveal-children.in > *:nth-child(3) {
  transition-delay: 0.25s;
}
.reveal-children.in > *:nth-child(4) {
  transition-delay: 0.35s;
}
.reveal-children.in > *:nth-child(5) {
  transition-delay: 0.45s;
}
.reveal-children.in > *:nth-child(6) {
  transition-delay: 0.55s;
}

/* Standardize interactive transitions */
.nav-links a {
  transition: color 0.3s ease;
}
.brand {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.brand:hover {
  opacity: 0.82;
}
.proj-card {
  transition:
    border-color 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.tl-card,
.edu-card,
.skill-group {
  transition:
    border-color 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.chip,
.contact-btn,
.c-row a {
  transition: all 0.3s ease;
}
.btn-ink,
.btn-ghost,
.nav-cta,
.icon-btn {
  transition: all 0.3s ease;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0 !important;
    transition-duration: 0.001ms !important;
  }
  .stagger > * {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ============================================================
       ARABIC + RTL
       ============================================================ */
html[lang="ar"] {
  --f-serif: var(--f-arabic);
  --f-sans: var(--f-arabic);
}
html[lang="ar"] body {
  letter-spacing: 0;
  line-height: 1.7;
}
html[lang="ar"] .serif,
html[lang="ar"] .hero-title,
html[lang="ar"] .section-title,
html[lang="ar"] .tl-role,
html[lang="ar"] .proj-title,
html[lang="ar"] .edu-card .deg,
html[lang="ar"] .skill-group .sg-title,
html[lang="ar"] .contact-lead,
html[lang="ar"] .about-text .lead,
html[lang="ar"] .stat .n {
  font-family: var(--f-arabic);
  font-weight: 800;
  font-style: normal;
  letter-spacing: -0.01em;
}
html[lang="ar"] em {
  font-style: normal;
  font-weight: 800;
}
html[lang="ar"] .mono,
html[lang="ar"] .hero-card,
html[lang="ar"] .nav-links,
html[lang="ar"] .nav-cta,
html[lang="ar"] .btn-ink,
html[lang="ar"] .btn-ghost,
html[lang="ar"] .contact-btn,
html[lang="ar"] .section-num,
html[lang="ar"] .proj-tag,
html[lang="ar"] .tl-meta,
html[lang="ar"] .hero-strip,
html[lang="ar"] footer,
html[lang="ar"] .chip,
html[lang="ar"] .hero-eyebrow {
  font-family: var(--f-arabic);
  letter-spacing: 0;
  text-transform: none;
}
/* keep latin tech tokens in JetBrains Mono inside Arabic mode */
html[lang="ar"] .chip[data-latin],
html[lang="ar"] .stack-name {
  font-family: var(--f-mono);
  letter-spacing: 0.04em;
}

/* RTL layout flips */
[dir="rtl"] .timeline {
  padding-left: 0;
  padding-right: 28px;
}
[dir="rtl"] .timeline::before {
  left: auto;
  right: 8px;
}
[dir="rtl"] .tl-item::before {
  left: auto;
  right: -28px;
}
[dir="rtl"] .tl-body li {
  padding-left: 0;
  padding-right: 22px;
}
[dir="rtl"] .tl-body li::before {
  left: auto;
  right: 0;
  content: "←";
}
[dir="rtl"] .nav-links a.active::after {
  left: 0;
  right: 0;
}
[dir="rtl"] .hero-card .term-line::before {
  content: "";
}
[dir="rtl"] .hero-card .term-line::after {
  content: " $";
  color: var(--accent);
}
[dir="rtl"] .hero-strip .marquee {
  animation-direction: reverse;
}
[dir="rtl"] .hero-strip .marquee span::after {
  margin-left: 0;
  margin-right: 3rem;
}
[dir="rtl"] .nav-cta i.bi-arrow-up-right {
  transform: scaleX(-1);
}
[dir="rtl"] .row.offset-lg-1 {
  /* keep offset same — Bootstrap handles */
}

/* ============================================================
       BASE
       ============================================================ */
* {
  -webkit-font-smoothing: antialiased;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
body {
  font-family: var(--f-sans);
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}
/* Subtle paper grain across the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image:
    radial-gradient(var(--grain-color) 1px, transparent 1px),
    radial-gradient(var(--grain-color-2) 1px, transparent 1px);
  background-size:
    3px 3px,
    7px 7px;
  background-position:
    0 0,
    1.5px 1.5px;
  z-index: 0;
  transition: opacity 0.35s ease;
}
main,
nav,
footer {
  position: relative;
  z-index: 1;
}

.serif {
  font-family: var(--f-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.mono {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ink {
  color: var(--ink);
}
.muted {
  color: var(--muted);
}
.accent {
  color: var(--accent);
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

/* ============================================================
       NAV
       ============================================================ */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.3s,
    background 0.3s;
}
.nav-bar.scrolled {
  border-bottom-color: var(--line);
  background: var(--nav-bg-scroll);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--f-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.nav-links a {
  position: relative;
  color: var(--muted);
  padding: 4px 0;
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-links a.active {
  color: var(--ink);
}
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
}
.nav-cta {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition:
    background 0.2s,
    color 0.2s;
}
.nav-cta:hover {
  background: var(--ink);
  color: var(--bg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s,
    transform 0.2s;
}
.icon-btn:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.icon-btn:active {
  transform: scale(0.95);
}
.icon-btn i {
  font-size: 0.95rem;
  transition: transform 0.35s cubic-bezier(0.6, -0.4, 0.4, 1.4);
}
.icon-btn-text {
  width: auto;
  padding: 0 14px;
}
[data-theme="dark"] .icon-btn:hover {
  background: var(--ink);
  color: var(--bg);
}
/* Subtle rotate when theme toggles */
.icon-btn.spin i {
  transform: rotate(360deg) scale(1.1);
}

@media (max-width: 575px) {
  .nav-cta {
    display: none;
  }
  .icon-btn-text {
    padding: 0 10px;
    font-size: 0.68rem;
  }
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
}

/* ============================================================
       HERO
       ============================================================ */
.hero {
  padding: 40px 0 110px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}
.hero-eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.18);
}
.hero-title {
  font-family: var(--f-serif);
  font-size: clamp(3.4rem, 8.2vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 0.35em;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
}
.hero-role {
  font-family: var(--f-sans);
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 28px;
  max-width: 36ch;
}
.hero-role .stack {
  color: var(--accent);
  font-weight: 600;
}
.hero-lead {
  max-width: 52ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 36px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-ink,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 14px 22px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: 999px;
  border: 1px solid var(--ink);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-ink {
  background: var(--ink);
  color: var(--bg);
}
.btn-ink:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
.btn-ink i,
.btn-ghost i {
  font-size: 0.95rem;
}

/* Hero side card */
.hero-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  line-height: 1.7;
  position: relative;
}
.hero-card .h-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
}
.hero-card .h-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.hero-card .h-row:last-child {
  border-bottom: 0;
}
.hero-card .h-row .v {
  color: var(--ink);
  font-weight: 500;
}
.hero-card .term-line {
  color: var(--muted);
}
.hero-card .term-line::before {
  content: "$ ";
  color: var(--accent);
}

/* Marquee underline of hero */
.hero-strip {
  display: flex;
  gap: 3rem;
  flex-wrap: nowrap;
  overflow: hidden;
  padding: 14px 0;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.hero-strip .marquee {
  display: inline-flex;
  gap: 3rem;
  animation: marquee 38s linear infinite;
  white-space: nowrap;
}
.hero-strip .marquee span {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}
.hero-strip .marquee span::after {
  content: "✦";
  color: var(--accent);
  margin-left: 3rem;
}
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ============================================================
       SECTIONS
       ============================================================ */
section {
  padding: 110px 0;
  position: relative;
}
section + section {
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 56px;
}
.section-num {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.section-title {
  font-family: var(--f-serif);
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
}
.section-title em {
  font-style: italic;
  color: var(--accent);
}
.section-rule {
  flex: 1;
  height: 1px;
  margin-bottom: 0.6em;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.1s var(--ease-premium, cubic-bezier(0.25, 1, 0.5, 1))
    0.32s;
  background: linear-gradient(
    to right,
    var(--line) 0%,
    color-mix(in srgb, var(--accent) 30%, var(--line)) 35%,
    color-mix(in srgb, var(--accent) 65%, var(--line)) 70%,
    var(--accent) 100%
  );
  position: relative;
}
.section-rule::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(50%, -50%);
  box-shadow: 0 0 8px rgba(184, 75, 42, 0.45);
  opacity: 0.85;
  transition:
    opacity 0.35s var(--ease-premium),
    transform 0.45s var(--ease-spring);
}
[data-theme="dark"] .section-rule::after {
  box-shadow: 0 0 10px rgba(231, 107, 71, 0.55);
}
.section-head:hover .section-rule::after {
  opacity: 1;
  transform: translate(50%, -50%) scale(1.25);
}
.section-head.in .section-rule {
  transform: scaleX(1);
}

[dir="rtl"] .section-rule {
  transform-origin: right center;
  background: linear-gradient(
    to left,
    var(--line) 0%,
    color-mix(in srgb, var(--accent) 30%, var(--line)) 35%,
    color-mix(in srgb, var(--accent) 65%, var(--line)) 70%,
    var(--accent) 100%
  );
}
[dir="rtl"] .section-rule::after {
  right: auto;
  left: 0;
  transform: translate(-50%, -50%);
}
[dir="rtl"] .section-head:hover .section-rule::after {
  transform: translate(-50%, -50%) scale(1.25);
}

/* ============================================================
       ABOUT
       ============================================================ */
.about-text p {
  font-size: 1.06rem;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 56ch;
}
.about-text p + p {
  margin-top: 1.1em;
}
.about-text .lead {
  font-family: var(--f-serif);
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: -0.01em;
  max-width: 22ch;
  margin-bottom: 1.2em;
}
.about-text .lead em {
  color: var(--accent);
}

.edu-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 14px;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.edu-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.edu-card .year {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.edu-card .deg {
  font-family: var(--f-serif);
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 4px 0 2px;
  color: var(--ink);
}
.edu-card .inst {
  color: var(--ink-2);
  font-size: 0.95rem;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.stat .n {
  font-family: var(--f-serif);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stat .n em {
  color: var(--accent);
  font-style: italic;
}
.stat .l {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

/* ============================================================
       SKILLS
       ============================================================ */
.skill-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 28px;
  height: 100%;
  transition:
    border-color 0.2s,
    transform 0.2s;
  position: relative;
}
.skill-group:hover {
  border-color: var(--ink);
}
.skill-group .sg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.skill-group .sg-title {
  font-family: var(--f-serif);
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.skill-group .sg-title em {
  color: var(--accent);
  font-style: italic;
}
.skill-group .sg-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.skill-group.primary .sg-icon {
  background: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink);
  border: 1px solid transparent;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.chip:hover {
  background: var(--bg);
  border-color: var(--line);
}
.chip.solid {
  background: var(--ink);
  color: var(--bg);
}
.chip.accent {
  background: var(--accent);
  color: var(--bg);
}
.chip .bi {
  font-size: 0.8rem;
  opacity: 0.85;
}

.skill-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bar-row .br-top {
  display: flex;
  justify-content: space-between;
}
.bar-row .br-top .n {
  font-family: var(--f-sans);
  font-size: 0.95rem;
  font-weight: 500;
}
.bar-row .br-top .v {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.bar {
  height: 4px;
  background: var(--chip-bg);
  border-radius: 2px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--ink);
  width: 0;
  transition: width 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.skill-group.primary .bar > span {
  background: var(--accent);
}

/* ============================================================
       EXPERIENCE — TIMELINE
       ============================================================ */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}
.tl-item {
  position: relative;
  padding-bottom: 44px;
}
.tl-item:last-child {
  padding-bottom: 0;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 8px;
  width: 17px;
  height: 17px;
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.tl-item.current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(184, 75, 42, 0.18);
}
.tl-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 28px;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.tl-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.tl-meta .tag-now {
  color: var(--accent);
}
.tl-role {
  font-family: var(--f-serif);
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.tl-company {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 14px;
}
.tl-company .at {
  color: var(--muted);
  font-weight: 400;
}
.tl-body {
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.65;
  max-width: 65ch;
}
.tl-body ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.tl-body li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
}
.tl-body li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-family: var(--f-mono);
}
.tl-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
.tl-stack .chip {
  font-size: 0.68rem;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--line);
}

/* ============================================================
       PROJECTS
       ============================================================ */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}
.proj-card {
  grid-column: span 6;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition:
    border-color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.proj-card:hover {
  border-color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -22px rgba(20, 20, 20, 0.18);
}
.proj-card.feat {
  grid-column: span 12;
}
.proj-card.feat .proj-visual {
  aspect-ratio: 21 / 9;
}

.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 6px;
}
.proj-tag {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.proj-tag.muted {
  color: var(--muted);
}
.proj-title {
  font-family: var(--f-serif);
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 4px 0 10px;
  color: var(--ink);
}
.proj-title em {
  font-style: italic;
  color: var(--accent);
}
.proj-desc {
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.65;
  margin-bottom: 18px;
}
.proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.proj-stack .chip {
  font-size: 0.68rem;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--line);
}

.proj-visual {
  aspect-ratio: 16 / 10;
  background: var(--bg-2);
  border-radius: 10px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.proj-visual svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 767px) {
  .proj-card,
  .proj-card.feat {
    grid-column: span 12;
  }
}

/* ============================================================
       CONTACT
       ============================================================ */
.contact-wrap {
  background: var(--ink);
  color: var(--bg);
  border-radius: 22px;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.contact-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(184, 75, 42, 0.35),
      transparent 50%
    ),
    radial-gradient(circle at 5% 90%, rgba(184, 75, 42, 0.18), transparent 55%);
  pointer-events: none;
}
.contact-wrap > * {
  position: relative;
}
.contact-wrap .section-num {
  color: #e8a88e;
}
.contact-wrap .section-title {
  color: var(--bg);
}
.contact-wrap .section-title em {
  color: #e8a88e;
}
.contact-wrap .section-rule {
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(232, 168, 142, 0.35) 35%,
    rgba(232, 168, 142, 0.65) 70%,
    #e8a88e 100%
  );
}
[dir="rtl"] .contact-wrap .section-rule {
  background: linear-gradient(
    to left,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(232, 168, 142, 0.35) 35%,
    rgba(232, 168, 142, 0.65) 70%,
    #e8a88e 100%
  );
}
.contact-wrap .section-rule::after {
  background: #e8a88e;
  box-shadow: 0 0 10px rgba(232, 168, 142, 0.55);
}

/* Contact section-rule fires from the wrap's .in (no .reveal on section-head) */
.contact-wrap.in .section-rule {
  transform: scaleX(1);
}
[dir="rtl"] .contact-wrap .section-rule {
  transform-origin: right center;
}

/* Stagger left/right columns as the wrap enters view */
.contact-wrap .row > [class*="col-"] {
  transform: translateY(24px);
  transition: transform 0.85s var(--ease-premium, cubic-bezier(0.25, 1, 0.5, 1));
}
.contact-wrap.in .row > [class*="col-"]:nth-child(1) {
  transform: none;
  transition-delay: 0.48s;
}
.contact-wrap.in .row > [class*="col-"]:nth-child(2) {
  transform: none;
  transition-delay: 0.72s;
}

.contact-lead {
  font-family: var(--f-serif);
  font-size: 1.5rem;
  line-height: 1.45;
  color: var(--bg);
  max-width: 38ch;
  margin-bottom: 30px;
}
.contact-lead em {
  color: #e8a88e;
}

.c-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--f-mono);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.82);
}
.c-row:last-child {
  border-bottom: 0;
}
.c-row .c-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-size: 1rem;
}
.c-row .c-label {
  color: rgba(255, 255, 255, 0.5);
  margin-right: auto;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.c-row .c-val {
  color: var(--bg);
}
.c-row a:hover {
  color: #e8a88e;
}
[dir="rtl"] .c-row .c-label {
  margin-right: 0;
  margin-left: auto;
}

/* Click-to-copy email */
.c-copy {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}
.c-copy .c-copy-icon {
  font-size: 0.92rem;
  opacity: 0.5;
  transition:
    opacity 0.2s,
    color 0.2s;
}
.c-copy:hover {
  color: #e8a88e;
}
.c-copy:hover .c-copy-icon {
  opacity: 1;
  color: #e8a88e;
}
.c-copy.copied {
  color: #9ddfbf;
}
.c-copy.copied .c-copy-icon {
  color: #9ddfbf;
  opacity: 1;
}

/* Contact action buttons (replaces the old contact form) */
.contact-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 18px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition:
    transform 0.35s var(--ease-premium),
    background 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}
.contact-btn i {
  font-size: 1.15rem;
  color: #e8a88e;
  transition: color 0.3s ease;
}
.contact-btn:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(232, 168, 142, 0.5);
  color: var(--bg);
}
.contact-btn.primary {
  background: #e8a88e;
  border-color: #e8a88e;
  color: var(--ink);
}
.contact-btn.primary i {
  color: var(--ink);
}
.contact-btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.contact-btn.primary:hover i {
  color: #fff;
}
@media (max-width: 575px) {
  .contact-actions {
    grid-template-columns: 1fr;
  }
  .contact-btn {
    padding: 16px 20px;
  }
}

/* ============================================================
       FOOTER
       ============================================================ */
footer {
  padding: 36px 0;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
footer .f-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
footer .back-top {
  color: var(--ink);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
footer .back-top:hover {
  color: var(--accent);
}

/* ============================================================
       UTIL — reveal on scroll
       ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* Small screens */
@media (max-width: 767px) {
  section {
    padding: 80px 0;
  }
  .hero {
    padding: 60px 0 80px;
  }
  .contact-wrap {
    padding: 36px 24px;
    border-radius: 14px;
  }
  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
       PREMIUM SIGNATURE — easing tokens, scroll progress, magnetic
       hovers, fluid button fills, fade transitions, parallax grain.
       This block intentionally appears last so it refines the
       established design system without rewriting it.
       ============================================================ */
:root {
  --ease-premium: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------
       1. Ultra-thin scroll progress bar (top of viewport)
       ------------------------------------------------------------ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}
.scroll-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow:
    0 0 12px rgba(184, 75, 42, 0.35),
    0 0 2px rgba(184, 75, 42, 0.55);
  transition:
    width 0.12s linear,
    opacity 0.35s var(--ease-premium);
  transform-origin: left center;
}
[dir="rtl"] .scroll-progress__fill {
  margin-left: auto;
  transform-origin: right center;
}
[data-theme="dark"] .scroll-progress__fill {
  box-shadow:
    0 0 14px rgba(231, 107, 71, 0.45),
    0 0 2px rgba(231, 107, 71, 0.65);
}

/* ------------------------------------------------------------
       2. Subtle parallax for the paper grain layer
       ------------------------------------------------------------ */
body::before {
  will-change: transform, opacity;
  transform: translate3d(0, var(--grain-y, 0px), 0);
  transition:
    transform 1.1s var(--ease-premium),
    opacity 0.45s var(--ease-premium);
}

/* ------------------------------------------------------------
       3. Page-level fade for theme & language transitions
       ------------------------------------------------------------ */
main,
.nav-bar,
footer,
.hero-strip {
  transition:
    opacity 0.45s var(--ease-premium),
    filter 0.45s var(--ease-premium),
    background-color 0.55s var(--ease-premium),
    color 0.55s var(--ease-premium),
    border-color 0.55s var(--ease-premium);
}
html.is-switching main,
html.is-switching .hero-strip {
  opacity: 0;
  filter: blur(3px);
}
html.is-switching .nav-bar,
html.is-switching footer {
  opacity: 0.5;
}

body {
  transition:
    background-color 0.55s var(--ease-premium),
    color 0.55s var(--ease-premium);
}

/* ------------------------------------------------------------
       4. Reveal-on-scroll — promote to premium easing
       ------------------------------------------------------------ */
.reveal {
  transform: translateY(22px);
  transition:
    opacity 1s var(--ease-premium),
    transform 1s var(--ease-premium);
}
.reveal-children > * {
  transform: translateY(18px);
  transition:
    opacity 0.9s var(--ease-premium),
    transform 0.9s var(--ease-premium);
}
.reveal-children.in > *:nth-child(7) {
  transition-delay: 0.6s;
}
.reveal-children.in > *:nth-child(8) {
  transition-delay: 0.7s;
}
.reveal-children.in > *:nth-child(9) {
  transition-delay: 0.8s;
}

/* ------------------------------------------------------------
       5. Magnetic / center-out underline for nav links
       ------------------------------------------------------------ */
.nav-links a {
  position: relative;
  transition: color 0.35s var(--ease-premium);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -6px;
  height: 1.5px;
  background: var(--accent);
  transition:
    left 0.55s var(--ease-premium),
    right 0.55s var(--ease-premium),
    opacity 0.35s var(--ease-premium);
  opacity: 0.85;
}
.nav-links a:hover::after,
.nav-links a.active::after {
  left: 0;
  right: 0;
}
.nav-links a.active::after {
  opacity: 1;
  height: 2px;
}

/* ------------------------------------------------------------
       6. Premium fluid button fills (slide-up reveal)
       Each button declares its own --btn-fill / --btn-fg colors;
       a pseudo-element slides up to deliver the new color smoothly.
       ------------------------------------------------------------ */
.btn-ink,
.btn-ghost,
.nav-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    color 0.45s var(--ease-premium),
    border-color 0.45s var(--ease-premium),
    transform 0.45s var(--ease-premium),
    box-shadow 0.45s var(--ease-premium);
}
.btn-ink {
  --btn-fill: var(--accent);
  --btn-fg: #fff;
}
.btn-ghost {
  --btn-fill: var(--ink);
  --btn-fg: var(--bg);
}
.nav-cta {
  --btn-fill: var(--ink);
  --btn-fg: var(--bg);
}
[data-theme="dark"] .btn-ink {
  --btn-fill: var(--accent);
  --btn-fg: #fff;
}
[data-theme="dark"] .btn-ghost {
  --btn-fill: var(--ink);
  --btn-fg: var(--bg);
}
[data-theme="dark"] .nav-cta {
  --btn-fill: var(--ink);
  --btn-fg: var(--bg);
}

.btn-ink::before,
.btn-ghost::before,
.nav-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--btn-fill);
  transform: translateY(101%);
  transition: transform 0.6s var(--ease-premium);
  z-index: -1;
}
.btn-ink > *,
.btn-ghost > *,
.nav-cta > * {
  position: relative;
  z-index: 1;
}

.btn-ink:hover,
.btn-ghost:hover,
.nav-cta:hover {
  color: var(--btn-fg);
  border-color: var(--btn-fill);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -16px rgba(20, 20, 20, 0.28);
}
.btn-ink:hover::before,
.btn-ghost:hover::before,
.nav-cta:hover::before {
  transform: translateY(0);
}
[data-theme="dark"] .btn-ink:hover,
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .nav-cta:hover {
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------
       7. Project card — depth lift + rust accent glow that follows
          the cursor (driven by JS-set --mx / --my CSS variables).
       ------------------------------------------------------------ */
.proj-card {
  transition:
    transform 0.65s var(--ease-premium),
    border-color 0.45s var(--ease-premium),
    box-shadow 0.65s var(--ease-premium);
}
.proj-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    320px circle at var(--mx, 50%) var(--my, 0%),
    rgba(184, 75, 42, 0.22),
    transparent 60%
  );
  transition: opacity 0.6s var(--ease-premium);
  z-index: 0;
}
[data-theme="dark"] .proj-card::before {
  background: radial-gradient(
    320px circle at var(--mx, 50%) var(--my, 0%),
    rgba(231, 107, 71, 0.28),
    transparent 60%
  );
}
.proj-card > * {
  position: relative;
  z-index: 1;
}
.proj-card:hover {
  transform: translateY(-6px);
  border-color: var(--ink);
  box-shadow: 0 30px 60px -28px rgba(20, 20, 20, 0.28);
}
[data-theme="dark"] .proj-card:hover {
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.6);
}
.proj-card:hover::before {
  opacity: 1;
}
.proj-card .proj-visual {
  transition:
    transform 1.1s var(--ease-premium),
    box-shadow 0.55s var(--ease-premium);
}
.proj-card:hover .proj-visual {
  transform: scale(1.015);
}
.proj-card .proj-title {
  transition:
    color 0.45s var(--ease-premium),
    transform 0.55s var(--ease-premium);
}
.proj-card:hover .proj-title {
  color: var(--accent);
}

/* ------------------------------------------------------------
       8. Skill / timeline / edu cards — same premium lift language
       ------------------------------------------------------------ */
.skill-group,
.edu-card,
.tl-card {
  transition:
    transform 0.55s var(--ease-premium),
    border-color 0.45s var(--ease-premium),
    box-shadow 0.55s var(--ease-premium);
}
.skill-group:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px -26px rgba(20, 20, 20, 0.22);
}
.edu-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -22px rgba(20, 20, 20, 0.2);
}
.tl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px -24px rgba(20, 20, 20, 0.22);
}
[data-theme="dark"] .skill-group:hover,
[data-theme="dark"] .edu-card:hover,
[data-theme="dark"] .tl-card:hover {
  box-shadow: 0 22px 44px -24px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------
       9. Chips — subtle micro-lift on hover
       ------------------------------------------------------------ */
.chip {
  transition:
    background-color 0.35s var(--ease-premium),
    border-color 0.35s var(--ease-premium),
    color 0.35s var(--ease-premium),
    transform 0.35s var(--ease-premium);
}
.chip:hover {
  transform: translateY(-1px);
}

/* ------------------------------------------------------------
       10. Icon buttons — magnetic feel
       ------------------------------------------------------------ */
.icon-btn {
  transition:
    background-color 0.35s var(--ease-premium),
    color 0.35s var(--ease-premium),
    border-color 0.35s var(--ease-premium),
    transform 0.45s var(--ease-spring),
    box-shadow 0.45s var(--ease-premium);
}
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px rgba(20, 20, 20, 0.25);
}

/* ------------------------------------------------------------
       11. Hero strip — feather the edges so the marquee feels infinite
       ------------------------------------------------------------ */
.hero-strip {
  position: relative;
}
.hero-strip::before,
.hero-strip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  pointer-events: none;
  z-index: 2;
}
.hero-strip::before {
  left: 0;
  background: linear-gradient(to right, var(--paper), transparent);
}
.hero-strip::after {
  right: 0;
  background: linear-gradient(to left, var(--paper), transparent);
}

/* ------------------------------------------------------------
       12. Anti-CLS for the EN ↔ AR font swap
       Reserve consistent line-box heights so the layout doesn't
       jump when Tajawal vs Instrument Serif metrics differ.
       ------------------------------------------------------------ */
.hero-title,
.section-title,
.proj-title,
.tl-role,
.edu-card .deg,
.skill-group .sg-title,
.stat .n,
.about-text .lead,
.contact-lead {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body {
  font-feature-settings:
    "kern" 1,
    "liga" 1;
}

/* ------------------------------------------------------------
       13. Airier rhythm on large screens
       ------------------------------------------------------------ */
@media (min-width: 992px) {
  section {
    padding: 130px 0;
  }
  .section-head {
    margin-bottom: 64px;
  }
  .contact-wrap {
    padding: 72px;
  }
}

/* ------------------------------------------------------------
       14. Floating tools layer in the Hero
       Subtle, drifting icon+label tags representing the stack —
       inspired by editorial dev portfolios with background motifs.
       Each .bg-tool is positioned via inline style and animated
       with its own duration + delay for an organic feel.
       ------------------------------------------------------------ */
.hero {
  overflow: hidden;
}
.hero > .container {
  position: relative;
  z-index: 2;
}

.hero-bg-tools {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-tool {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0.11;
  white-space: nowrap;
  user-select: none;
  will-change: transform, opacity;
  animation: heroToolDrift var(--dur, 14s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.bg-tool i {
  font-size: 1.45rem;
  color: var(--accent);
  opacity: 0.9;
}
[data-theme="dark"] .bg-tool {
  color: var(--ink);
  opacity: 0.14;
}
[data-theme="dark"] .bg-tool i {
  opacity: 0.85;
}

/* Organic drift — translate + slight rotation, smooth ease. */
@keyframes heroToolDrift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  25% {
    transform: translate3d(0, -6px, 0) rotate(-1deg);
  }
  50% {
    transform: translate3d(0, -14px, 0) rotate(1.5deg);
  }
  75% {
    transform: translate3d(0, -8px, 0) rotate(0.8deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}

/* Hide on narrow screens — too cramped, plus mobile perf */
@media (max-width: 767px) {
  .hero-bg-tools {
    display: none;
  }
}

/* ------------------------------------------------------------
       15. Wordmark — robot-typewriter animation
       JS replaces the wordmark inner with typed characters,
       cycling: type → pause(dots) → erase → pause(dots) → type.
       ------------------------------------------------------------ */
/* Stack static fallback (invisible) and typed overlay in the same
       grid cell so the wordmark always reserves the FULL name's width.
       The nav links and right-side controls no longer shift as the
       characters are typed/erased. */
.wordmark.is-typing {
  display: inline-grid;
  grid-template-areas: "wm";
  align-items: baseline;
}
.wordmark.is-typing > * {
  grid-area: wm;
  justify-self: start;
}
.wordmark.is-typing .wm-en,
.wordmark.is-typing .wm-ar {
  visibility: hidden;
}

.wm-typed {
  display: inline;
  white-space: nowrap;
}
.wm-typed .tw-bracket {
  color: var(--muted);
}
.wm-typed .tw-first {
  color: var(--ink);
}
.wm-typed .tw-sep {
  color: var(--muted);
  padding: 0 0.04em;
}
.wm-typed .tw-last {
  color: var(--accent);
}

.tw-cursor {
  display: inline-block;
  width: 0.09em;
  height: 0.95em;
  background: var(--accent);
  margin-inline-start: 0.12em;
  vertical-align: -0.12em;
  border-radius: 1px;
  animation: twBlink 0.85s steps(2) infinite;
}
@keyframes twBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ------------------------------------------------------------
       16. Reduced-motion guardrails (override premium animations)
       ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress__fill {
    transition: none;
  }
  body::before {
    transform: none !important;
    transition: none !important;
  }
  .btn-ink::before,
  .btn-ghost::before,
  .nav-cta::before,
  .proj-card::before {
    transition: none;
  }
  html.is-switching main,
  html.is-switching .hero-strip {
    opacity: 1 !important;
    filter: none !important;
  }
  .bg-tool {
    animation: none !important;
  }
  .tw-cursor {
    animation: none !important;
  }
}

/* ------------------------------------------------------------
       17. Keyboard focus — visible outline for all interactive elements
       ------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.icon-btn:focus-visible,
.nav-cta:focus-visible,
.btn-ink:focus-visible,
.btn-ghost:focus-visible,
.contact-btn:focus-visible,
.c-copy:focus-visible,
.back-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
