/* ============================================================
   CSS CUSTOM PROPERTIES — Light (default) & Dark
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-page: #f0f4ff;
  --bg-surface: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-glass-card: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(255, 255, 255, 0.9);
  --bg-navbar: rgba(240, 244, 255, 0.85);
  --bg-pill: rgba(29, 78, 216, 0.07);
  --bg-tech-pill: rgba(29, 78, 216, 0.05);

  /* Borders */
  --border-color: rgba(29, 78, 216, 0.12);
  --border-input: rgba(29, 78, 216, 0.2);
  --border-section: rgba(29, 78, 216, 0.08);

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.65);
  --text-muted: rgba(15, 23, 42, 0.45);
  --text-nav: rgba(15, 23, 42, 0.7);

  /* Accents (same in both modes) */
  --cyan: #22d3ee;
  --blue: #1d4ed8;
  --ice: #a5f3fc;
  --ink: #04060d;

  /* Aurora */
  --aurora-1: rgba(29, 78, 216, 0.18);
  --aurora-2: rgba(34, 211, 238, 0.12);
  --aurora-3: rgba(165, 243, 252, 0.1);

  /* Grid overlay */
  --grid-line: rgba(29, 78, 216, 0.04);

  /* Shadows */
  --shadow-card: 0 4px 24px -4px rgba(29, 78, 216, 0.1), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 20px 50px -12px rgba(29, 78, 216, 0.2), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-btn: 0 8px 30px -8px rgba(34, 211, 238, 0.5);
  --shadow-btn-hover: 0 16px 40px -8px rgba(34, 211, 238, 0.7);

  /* Navbar scrolled */
  --navbar-scrolled-bg: rgba(240, 244, 255, 0.92);
  --navbar-scrolled-border: rgba(29, 78, 216, 0.1);

  /* Primary colors */
  --primary: #1d4ed8;
  --primary-foreground: #ffffff;
}

html.dark {
  --bg-page: #04060d;
  --bg-surface: #06112a;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-card: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-navbar: transparent;
  --bg-pill: rgba(255, 255, 255, 0.05);
  --bg-tech-pill: rgba(255, 255, 255, 0.03);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.1);
  --border-section: rgba(255, 255, 255, 0.05);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.45);
  --text-nav: rgba(255, 255, 255, 0.7);

  --aurora-1: rgba(29, 78, 216, 0.5);
  --aurora-2: rgba(34, 211, 238, 0.35);
  --aurora-3: rgba(10, 31, 77, 0.6);

  --grid-line: rgba(255, 255, 255, 0.025);

  --shadow-card: none;
  --shadow-card-hover: 0 30px 60px -20px rgba(34, 211, 238, 0.15);
  --shadow-btn: 0 10px 40px -10px rgba(34, 211, 238, 0.6);
  --shadow-btn-hover: 0 20px 50px -10px rgba(34, 211, 238, 0.8);

  --navbar-scrolled-bg: rgba(4, 6, 13, 0.7);
  --navbar-scrolled-border: rgba(255, 255, 255, 0.06);

  /* Primary colors */
  --primary: #22d3ee;
  --primary-foreground: #04060d;
}

/* ============================================================
   BASE
   ============================================================ */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  transition:
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   AURORA BACKGROUND
   ============================================================ */
.aurora {
  position: absolute;
  border-radius: 9999px;
  filter: blur(120px);
  opacity: 1;
  transition: background 0.4s ease;
  will-change: transform;
}
.aurora-1 {
  width: 700px;
  height: 700px;
  background: var(--aurora-1);
  top: -200px;
  left: -150px;
  animation: drift 22s ease-in-out infinite;
}
.aurora-2 {
  width: 600px;
  height: 600px;
  background: var(--aurora-2);
  top: 30%;
  right: -200px;
  opacity: 0.8;
  animation: drift 28s ease-in-out infinite reverse;
}
.aurora-3 {
  width: 500px;
  height: 500px;
  background: var(--aurora-3);
  bottom: -200px;
  left: 30%;
  animation: drift 30s ease-in-out infinite;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(80px, -60px, 0) scale(1.1);
  }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

/* ============================================================
   NAVBAR & FLOATING PILL SYSTEM
   ============================================================ */
#navbar {
  /* Pointer events none on outer wrapper so background clicks bleed through */
  pointer-events: none;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#navbar-inner {
  transition: 
    max-width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: max-width, padding, background-color, border-color, box-shadow;
}

/* Scroll-morph transitions */
#navbar.scrolled .max-w-7xl {
  max-width: 72rem; /* 1152px - shrinks beautifully from 80rem */
}

#navbar.scrolled #navbar-inner {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(24px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(140%) !important;
  border-color: rgba(29, 78, 216, 0.08) !important;
  box-shadow: 
    0 12px 40px -12px rgba(29, 78, 216, 0.12),
    0 1px 2px rgba(29, 78, 216, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

html.dark #navbar.scrolled #navbar-inner {
  background: rgba(4, 6, 13, 0.55) !important;
  backdrop-filter: blur(24px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 
    0 20px 40px -15px rgba(0, 0, 0, 0.6),
    0 0 30px -10px rgba(34, 211, 238, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* Nav links styling */
#navbar nav a {
  color: var(--text-nav);
  transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
}

#navbar nav a:hover {
  color: var(--text-primary) !important;
  transform: translateY(-0.5px);
}

/* Sliding hover indicators */
.nav-hover-indicator {
  transition: 
    left 0.3s cubic-bezier(0.25, 1, 0.5, 1),
    top 0.3s cubic-bezier(0.25, 1, 0.5, 1),
    width 0.3s cubic-bezier(0.25, 1, 0.5, 1),
    height 0.3s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.25s ease,
    transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  background: rgba(29, 78, 216, 0.06);
  border: 1px solid rgba(29, 78, 216, 0.08);
  box-shadow: 0 2px 8px -2px rgba(29, 78, 216, 0.05);
  will-change: left, width, opacity;
}

html.dark .nav-hover-indicator {
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.15);
  box-shadow: 
    0 2px 10px -2px rgba(34, 211, 238, 0.1),
    0 0 6px rgba(34, 211, 238, 0.05);
}

/* Premium CTA start project button in navbar */
.btn-nav-cta {
  background: linear-gradient(135deg, #a5f3fc, #22d3ee 45%, #1d4ed8) !important;
  box-shadow: 0 4px 15px -3px rgba(34, 211, 238, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}

.btn-nav-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 25px -4px rgba(34, 211, 238, 0.5),
    0 0 15px rgba(34, 211, 238, 0.25);
  color: #04060d !important;
}

.btn-nav-cta:active {
  transform: translateY(0) scale(0.98);
}

/* Animated gradient shine on CTA */
.btn-nav-cta::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 30%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  transition: all 0.75s ease;
  pointer-events: none;
}

.btn-nav-cta:hover::after {
  left: 130%;
  transition: all 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Controls micro-interactions */
#theme-toggle,
#lang-toggle,
#menu-toggle {
  transition: 
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#theme-toggle:hover,
#lang-toggle:hover,
#menu-toggle:hover {
  transform: scale(1.08);
  background: rgba(34, 211, 238, 0.08) !important;
  border-color: rgba(34, 211, 238, 0.3) !important;
  color: var(--text-primary) !important;
}

#theme-toggle:active,
#lang-toggle:active,
#menu-toggle:active {
  transform: scale(0.93);
}

/* Mobile dropdown container */
#mobile-menu {
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
  animation: slide-dropdown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: top center;
  pointer-events: auto;
}

@keyframes slide-dropdown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ============================================================
   GLASS & CARDS
   ============================================================ */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
}

.glass-card {
  position: relative;
  background: var(--bg-glass-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  will-change: transform, box-shadow, border-color;
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1.5px;
  background: linear-gradient(180deg, var(--border-color) 0%, transparent 100%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: background 0.5s ease;
}
.glass-card:hover {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-6px);
}
.glass-card:hover::before {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.3) 0%, rgba(29, 78, 216, 0.3) 100%);
}

/* Card text colors */
.glass-card h3 {
  color: var(--text-primary);
}
.glass-card p {
  color: var(--text-secondary);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
/* Inline badge */
#home .glass span.inline-flex {
  color: var(--text-secondary);
}

/* Stats */
#home .text-3xl {
  color: var(--text-primary);
}
#home .text-xs {
  color: var(--text-muted);
}

/* Scroll indicator */
#home a.absolute {
  color: var(--text-muted);
}

/* ============================================================
   SECTION TEXT
   ============================================================ */
.section-tag {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
}
.section-title {
  font-family: "Sora", sans-serif;
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Generic section body text */
section p {
  color: var(--text-secondary);
}

/* Section borders */
section.border-t {
  border-color: var(--border-section) !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #04060d;
  background: linear-gradient(135deg, #a5f3fc, #22d3ee 40%, #1d4ed8);
  box-shadow: var(--shadow-btn);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-btn-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-pill);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  transition:
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-ghost:hover {
  transform: translateY(-2px) scale(1.03);
}
.btn-ghost:hover {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.5);
}

/* ============================================================
   FORM
   ============================================================ */
.form-input {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition:
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-input:focus {
  outline: none !important;
  border-color: var(--cyan) !important;
  background: rgba(34, 211, 238, 0.08) !important;
  box-shadow: 
    0 0 20px rgba(34, 211, 238, 0.2),
    inset 0 0 10px rgba(34, 211, 238, 0.05) !important;
}
.form-input::placeholder {
  color: var(--text-muted);
}

/* Form labels */
#contact-form label {
  color: var(--text-muted);
}

/* ============================================================
   TECH PILLS
   ============================================================ */
.tech-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.75rem 1rem;
  border-radius: 20px;
  background: var(--bg-tech-pill);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  will-change: transform, background-color, border-color, box-shadow;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.tech-pill:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 15px 40px -10px rgba(34, 211, 238, 0.25);
  color: var(--text-primary);
}
.tech-pill .icon {
  font-size: 2.25rem;
}

/* ============================================================
   GRADIENT TEXT
   ============================================================ */
.gradient-text {
  background: linear-gradient(135deg, #a5f3fc 0%, #22d3ee 40%, #1d4ed8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(34, 211, 238, 0.6);
  border-radius: 50%;
  pointer-events: none;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  z-index: 9999;
  mix-blend-mode: difference;
  display: none;
  will-change: transform;
  scale: 1;
  transition:
    scale 0.25s cubic-bezier(0.25, 1, 0.5, 1),
    border-color 0.2s ease,
    background-color 0.2s ease;
}
.custom-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background-color: #22d3ee;
  border-radius: 50%;
  pointer-events: none;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  z-index: 9999;
  mix-blend-mode: difference;
  display: none;
  will-change: transform;
}
@media (min-width: 768px) {
  .custom-cursor,
  .custom-cursor-dot {
    display: block;
  }
}
.custom-cursor.hovered {
  scale: 1.625;
  border-color: rgba(29, 78, 216, 0.8);
  background-color: rgba(34, 211, 238, 0.05);
}
.mouse-glow-blob {
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(34, 211, 238, 0.08) 0%,
    rgba(29, 78, 216, 0.02) 60%,
    transparent 100%
  );
  pointer-events: none;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  z-index: -5;
  mix-blend-mode: multiply;
  filter: blur(60px);
  opacity: 0.7;
  transition: opacity 1.5s ease;
  will-change: transform;
}
html.dark .mouse-glow-blob {
  mix-blend-mode: screen;
  opacity: 0.85;
  background: radial-gradient(
    circle,
    rgba(34, 211, 238, 0.1) 0%,
    rgba(29, 78, 216, 0.03) 60%,
    transparent 100%
  );
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--border-section) !important;
}
footer .font-display {
  color: var(--text-primary);
}
footer .text-white\/30 {
  color: var(--text-muted);
}
footer a {
  color: var(--text-muted);
  transition: color 0.2s;
}
footer a:hover {
  color: var(--text-primary);
}

/* ============================================================
   SCROLL PROGRESS
   ============================================================ */
#scroll-progress {
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--cyan));
}

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ============================================================
   MISC ANIMATIONS
   ============================================================ */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-18px);
  }
}
.animate-float {
  animation: float 6s ease-in-out infinite;
}
@keyframes bounce-slow {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}
.animate-bounce-slow {
  animation: bounce-slow 2.5s ease-in-out infinite;
}

/* ============================================================
   PROJECT CARDS
   ============================================================ */
#projects-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 640px) {
  #projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  #projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.project-card {
  overflow: hidden;
}

/* ============================================================
   RTL SUPPORT
   ============================================================ */
html[dir="rtl"] {
  direction: rtl;
}
html[dir="rtl"] .section-title,
html[dir="rtl"] .section-tag,
html[dir="rtl"] section p,
html[dir="rtl"] .btn-primary,
html[dir="rtl"] .btn-ghost {
  text-align: right;
}

/* Arabic font override with premium IBM Plex Sans Arabic & cursive protection */
html[lang="ar"] body,
html[lang="ar"] * {
  font-family: "IBM Plex Sans Arabic", "Cairo", "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}

/* Prevent cursive letters and tall dot boundaries from clipping inside word-reveal wrappers */
html[lang="ar"] .word-wrapper {
  padding-top: 0.18em !important;
  padding-bottom: 0.22em !important;
  margin-top: -0.18em !important;
  margin-bottom: -0.22em !important;
}

/* Adjust heading metrics and leading height specifically for tall Arabic scripts */
html[lang="ar"] .hero-headline {
  font-family: "IBM Plex Sans Arabic", sans-serif !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  font-size: clamp(2.25rem, 5.5vw, 4.75rem) !important;
}

/* Sizing overrides for Arabic layouts on first page and navigation */
html[lang="ar"] [data-i18n="hero-badge"] {
  font-size: 13px !important;
}

html[lang="ar"] [data-i18n="hero-desc"] {
  font-size: clamp(0.95rem, 2vw, 1.15rem) !important;
  line-height: 1.8 !important;
}

html[lang="ar"] .btn-liquid,
html[lang="ar"] .btn-ghost {
  font-size: 1.05rem !important;
}

html[lang="ar"] .ticker-item span.font-display {
  font-size: 1.35rem !important;
}

html[lang="ar"] .ticker-item span[data-i18n] {
  font-size: 12px !important;
}

html[lang="ar"] #navbar nav a {
  font-size: 13px !important;
}

html[lang="ar"] .btn-nav-cta {
  font-size: 13px !important;
}

html[lang="ar"] #mobile-menu a {
  font-size: 13px !important;
}

/* Arabic-specific typography & layout enhancements */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6 {
  font-family: "IBM Plex Sans Arabic", sans-serif !important;
  font-weight: 800 !important;
}

html[lang="ar"] .section-title {
  line-height: 1.35 !important;
}

html[lang="ar"] p,
html[lang="ar"] span,
html[lang="ar"] a,
html[lang="ar"] label,
html[lang="ar"] input,
html[lang="ar"] textarea {
  font-weight: 500 !important; /* Slightly heavier body weight for readable, premium Arabic rendering */
}

html[lang="ar"] p {
  line-height: 1.75 !important;
}

/* Force correct right alignment for left-aligned utility text elements in RTL mode */
html[dir="rtl"] .text-left {
  text-align: right !important;
}

/* RTL Arrow Transitions & Transforms for Projects */
html[dir="rtl"] .project-card svg {
  transform: scaleX(-1) !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html[dir="rtl"] .project-card a:hover svg,
html[dir="rtl"] .project-card a:focus svg {
  transform: scaleX(-1) translateX(4px) !important;
}

/* Custom premium scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-page);
  border-left: 1px solid var(--border-color);
  transition: background-color 0.4s ease;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  border-radius: 9999px;
  border: 2px solid var(--bg-page);
  transition: border-color 0.4s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--blue), var(--cyan));
}

/* Headings and general text transitions */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
a,
label {
  transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   CINEMATIC HERO REDESIGN SYSTEM
   ============================================================ */

/* Google Fonts Overrides */
.hero-headline {
  font-family: "Syne", "Sora", system-ui, sans-serif !important;
  letter-spacing: -0.04em !important;
}

/* Animated Gradient Mesh Background Blobs */
.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.14;
  mix-blend-mode: multiply;
  pointer-events: none;
  will-change: transform;
}

html.dark .mesh-blob {
  mix-blend-mode: screen;
  opacity: 0.38;
}

.mesh-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.45) 0%, rgba(34, 211, 238, 0) 70%);
  top: -10%;
  left: -10%;
  animation: mesh-move-1 25s ease-in-out infinite alternate;
}

.mesh-2 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.4) 0%, rgba(29, 78, 216, 0) 75%);
  bottom: -15%;
  right: -5%;
  animation: mesh-move-2 30s ease-in-out infinite alternate;
}

.mesh-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(10, 31, 77, 0.6) 0%, rgba(10, 31, 77, 0) 70%);
  top: 30%;
  left: 35%;
  animation: mesh-move-3 20s ease-in-out infinite alternate;
}

@keyframes mesh-move-1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(100px, 80px, 0) scale(1.15); }
  100% { transform: translate3d(-50px, 150px, 0) scale(0.9); }
}

@keyframes mesh-move-2 {
  0% { transform: translate3d(0, 0, 0) scale(1.1); }
  50% { transform: translate3d(-120px, -100px, 0) scale(0.85); }
  100% { transform: translate3d(80px, 40px, 0) scale(1.15); }
}

@keyframes mesh-move-3 {
  0% { transform: translate3d(0, 0, 0) scale(0.9); }
  50% { transform: translate3d(80px, -60px, 0) scale(1.1); }
  100% { transform: translate3d(-100px, 50px, 0) scale(0.95); }
}

/* Inline SVG noise/grain overlay */
.noise-grain-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* Layered Wave Background Lines */
.wave-path {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: draw-wave 4.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wave-path-2 {
  animation: draw-wave 5.5s cubic-bezier(0.16, 1, 0.3, 1) forwards, wave-flow 45s linear infinite;
}

.wave-path-3 {
  animation: draw-wave 6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes draw-wave {
  to { stroke-dashoffset: 0; }
}

@keyframes wave-flow {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1200; }
}

/* Staggered Word Reveal Animations */
.word-wrapper {
  display: inline-block;
  overflow: hidden;
  margin-right: 0.22em;
  vertical-align: bottom;
}

.word {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
  animation: reveal-word 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.word-gradient {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
  animation: reveal-word 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  background: linear-gradient(135deg, #a5f3fc 0%, #22d3ee 40%, #1d4ed8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation-name: reveal-word, text-shine;
  animation-duration: 0.95s, 6s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1), ease;
  animation-fill-mode: forwards, none;
  animation-iteration-count: 1, infinite;
}

@keyframes reveal-word {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes text-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Stagger Delays for Words */
.word-wrapper:nth-child(1) .word { animation-delay: 0.1s; }
.word-wrapper:nth-child(2) .word { animation-delay: 0.18s; }
.word-wrapper:nth-child(3) .word { animation-delay: 0.26s; }
.word-wrapper:nth-child(4) .word { animation-delay: 0.34s; }
.word-wrapper:nth-child(5) .word-gradient { animation-delay: 0.42s; }
.word-wrapper:nth-child(6) .word-gradient { animation-delay: 0.5s; }

/* Spotlight Cursor Follower container */
#home::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    650px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(29, 78, 216, 0.04),
    transparent 80%
  );
  pointer-events: none;
  z-index: 2;
  transition: background 0.15s ease;
}

html.dark #home::before {
  background: radial-gradient(
    650px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(34, 211, 238, 0.06),
    transparent 80%
  );
}

/* Liquid Wave CTA Button */
.btn-liquid {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.9rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1d4ed8 !important;
  background: transparent;
  border: 2px solid #1d4ed8;
  overflow: hidden;
  transition: 
    color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
    border-color 0.4s ease, 
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

html.dark .btn-liquid {
  color: #ffffff !important;
  border-color: #22d3ee;
}

.btn-liquid .btn-text {
  transition: color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-liquid .liquid-bg {
  position: absolute;
  top: 115%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(135deg, #a5f3fc 0%, #22d3ee 45%, #1d4ed8 100%);
  border-radius: 38%;
  transition: 
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
    top 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  transform: rotate(0deg);
  pointer-events: none;
}

.btn-liquid:hover {
  color: #04060d !important;
  border-color: #a5f3fc;
  transform: translateY(-3px) scale(1.03);
}

.btn-liquid:hover .liquid-bg {
  top: -40%;
  transform: rotate(360deg);
}

.btn-liquid:active {
  transform: scale(0.97);
}

/* scattered overlapping floating cards */
.ui-card {
  will-change: transform, box-shadow, border-color;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.ui-card:hover {
  animation-play-state: paused !important; /* freeze CSS floating on mouse interactive tilt */
  box-shadow: 0 35px 70px -15px rgba(34, 211, 238, 0.25);
  border-color: rgba(34, 211, 238, 0.5) !important;
  z-index: 30 !important;
}

.ui-card-analytics {
  animation: float-card-1 8s ease-in-out infinite;
}

.ui-card-billing {
  animation: float-card-2 7s ease-in-out infinite;
}

.ui-card-metrics {
  animation: float-card-3 9s ease-in-out infinite;
}

@keyframes float-card-1 {
  0%, 100% { transform: translateY(0) rotate(1deg); }
  50% { transform: translateY(-15px) rotate(-1deg); }
}

@keyframes float-card-2 {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-18px) rotate(1deg); }
}

@keyframes float-card-3 {
  0%, 100% { transform: translateY(0) rotate(0.5deg); }
  50% { transform: translateY(-12px) rotate(-0.5deg); }
}

/* Endless looping stats ticker strip */
.hero-ticker {
  background: rgba(255, 255, 255, 0.6) !important;
  border-color: rgba(29, 78, 216, 0.06) !important;
}

html.dark .hero-ticker {
  background: rgba(4, 6, 13, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

.ticker-wrapper {
  display: flex;
  width: max-content;
  will-change: transform;
}

.animate-ticker {
  animation: ticker 32s linear infinite;
}

@keyframes ticker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-33.3333%, 0, 0); }
}

.ticker-item {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

/* Mobile Responsive Hide/Scales */
@media (max-width: 1024px) {
  .ui-card-analytics {
    left: 2% !important;
    top: 22% !important;
    transform: scale(0.85);
  }
  .ui-card-billing {
    right: 2% !important;
    top: 38% !important;
    transform: scale(0.85);
  }
  .ui-card-metrics {
    left: 8% !important;
    bottom: 22% !important;
    transform: scale(0.85);
  }
}

@media (max-width: 768px) {
  .ui-card {
    display: none !important; /* Hide floating cards on mobile to avoid overlapping */
  }
  #home {
    min-height: auto;
    padding-top: 8rem;
    padding-bottom: 7rem;
  }
  .hero-ticker {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  .ticker-item span.text-xl {
    font-size: 1.1rem !important; /* Elegant compact sizing on mobile screen marquee */
  }
  .hero-headline {
    font-size: clamp(1.4rem, 6vw, 2.25rem) !important; /* Balanced fluid typography for smaller title */
    line-height: 1.15 !important;
  }
}

/* Morphing hamburger toggle animation styles */
.hamburger-icon .line {
  will-change: transform, opacity;
  transform-origin: left center;
}

#menu-toggle.active .line-1 {
  transform: rotate(45deg) translate(2px, -1px);
}

#menu-toggle.active .line-2 {
  opacity: 0;
  transform: scaleX(0);
}

#menu-toggle.active .line-3 {
  transform: rotate(-45deg) translate(2px, 1px);
}

/* ============================================================
   GLOBAL UX ENHANCEMENTS (PHASE 3)
   ============================================================ */

/* A. Navigation Link Active Tracker Styling */
#navbar nav a.active {
  color: var(--cyan) !important;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

/* B. Portfolio Category Filter Button Styles */
.filter-btn {
  background: var(--bg-pill);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-btn:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2) 0%, rgba(29, 78, 216, 0.2) 100%) !important;
  border-color: var(--cyan) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.15) !important;
}

/* C. Premium Floating Back to Top Navigation Pill */
#back-to-top {
  box-shadow: 0 8px 32px rgba(4, 6, 13, 0.3);
  will-change: transform, opacity;
}

#back-to-top.visible {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

#back-to-top:hover {
  background: rgba(34, 211, 238, 0.15) !important;
  border-color: var(--cyan) !important;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.3) !important;
}

/* Glassmorphism utility for high fidelity indicators */
.glass {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(16px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(120%) !important;
  border-color: var(--border-color) !important;
}

/* ============================================================
   MOBILE & TABLET PERFORMANCE OPTIMIZATIONS
   ============================================================ */
@media (max-width: 1024px) {
  /* Disable expensive blurs and continuous background animations */
  .aurora {
    display: none !important;
    animation: none !important;
  }
  .mouse-glow-blob {
    display: none !important;
  }
  .mesh-blob {
    display: none !important;
  }
  .custom-cursor,
  .custom-cursor-dot {
    display: none !important;
  }
  
  /* Simplify glass effect to avoid heavy repaints on scroll */
  .glass-card,
  #navbar.scrolled #navbar-inner,
  .glass {
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }
  
  /* Disable continuous floating animations */
  .animate-float {
    animation: none !important;
    transform: none !important;
  }
  .animate-bounce-slow {
    animation: none !important;
    transform: none !important;
  }
  
  /* Simplify loading screen animations on mobile */
  #wave-loader .filter {
    display: none !important;
  }
  #wave-loader .animate-pulse {
    animation: none !important;
  }
}
