/* ---------- CSS Variables for Light / Dark Mode ---------- */
:root {
  --color-ink: #05050a;
  --color-carbon: #0a0a14;
  --color-steel: #10101c;
  --color-ghost: #9aa3b2;
  --color-border: rgba(255,255,255,.09);
  --color-glass-bg: rgba(255,255,255,.04);
  --color-grid-opacity: 0.045;
  --color-field-bg: rgba(255,255,255,.03);
  --color-field-border: rgba(255,255,255,.1);
  --color-text-white: #ffffff;
}

html.light {
  --color-ink: #f8fafc;
  --color-carbon: #ffffff;
  --color-steel: #f1f5f9;
  --color-ghost: #475569;
  --color-border: rgba(0,0,0,.08);
  --color-glass-bg: rgba(255,255,255,.75);
  --color-grid-opacity: 0.07;
  --color-field-bg: rgba(0,0,0,.02);
  --color-field-border: rgba(0,0,0,.1);
  --color-text-white: #0f172a;
}

/* Arabic typography overrides */
html[lang="ar"] {
  font-family: 'Cairo', sans-serif !important;
}
html[lang="ar"] .font-display {
  font-family: 'Cairo', sans-serif !important;
}
html[lang="ar"] .font-body {
  font-family: 'Cairo', sans-serif !important;
}

/* Light Mode Overrides for hardcoded elements */
html.light body {
  color: #334155;
}
html.light .text-white {
  color: #0f172a !important;
}
html.light .text-gray-200 {
  color: #334155 !important;
}
html.light .text-gray-300 {
  color: #1e293b !important;
}
html.light .text-ghost {
  color: #475569 !important;
}
html.light .glass {
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.04);
}
html.light .btn-ghost {
  color: #334155;
  border-color: rgba(0,0,0,0.12);
}
html.light .btn-ghost:hover {
  color: #00f0ff;
}
html.light ::placeholder {
  color: #64748b !important;
}

/* Keep primary button text dark always */
.btn-primary {
  color: #05050a !important;
}

/* Keep terminal elements styled as dark-theme */
.terminal-always-dark {
  background: #0a0a14 !important;
  border: 1px solid rgba(255,255,255,.1) !important;
}
.terminal-always-dark .text-ghost {
  color: #9aa3b2 !important;
}
.terminal-always-dark .text-gray-300 {
  color: #d1d5db !important;
}

/* Logo visibility toggling based on theme */
.light-logo-img { display: none; }
.dark-logo-img { display: inline-block; }

html.light .light-logo-img { display: inline-block; }
html.light .dark-logo-img { display: none; }

/* ---------- Base ---------- */
body { background: var(--color-ink); overflow-x: hidden; }
::selection { background: rgba(0,240,255,.25); color: #fff; }

/* Custom scrollbar — slim, neon-tinted */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--color-ink); }
::-webkit-scrollbar-thumb { background: linear-gradient(#00f0ff, #6366f1); border-radius: 99px; }

/* ---------- Background layers ---------- */
/* Faint engineering grid that spans the whole page */
.bg-grid {
  background-image:
    linear-gradient(rgba(0,240,255,var(--color-grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,var(--color-grid-opacity)) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}
/* Floating neon orbs (blurred radial glows) */
.orb { position: absolute; border-radius: 9999px; filter: blur(110px); opacity: var(--color-orb-opacity, 0.35); pointer-events: none; }
@keyframes drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(40px,-40px) scale(1.12); }
}
.orb-drift { animation: drift 14s ease-in-out infinite; }

/* ---------- Typography helpers ---------- */
.text-gradient {
  background: linear-gradient(92deg, #00f0ff 10%, #8b5cf6 60%, #6366f1 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--color-glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--color-border);
}

/* ---------- Card hover: glowing border sweep ---------- */
.glow-card {
  position: relative;
  transition: transform .45s cubic-bezier(.22,1,.36,1), border-color .45s, box-shadow .45s, transform .25s ease-out; /* Smooth transition for mouse leave tilt */
}
.glow-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(0,240,255,.7), transparent 35%, transparent 65%, rgba(139,92,246,.7));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .45s; pointer-events: none;
}
.glow-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 60px -18px rgba(0,240,255,.18), 0 12px 40px -12px rgba(139,92,246,.15);
}
.glow-card:hover::before { opacity: 1; }

/* Icon chip inside cards — flares up on hover */
.icon-chip { transition: all .45s cubic-bezier(.22,1,.36,1); }
.glow-card:hover .icon-chip {
  background: linear-gradient(135deg, rgba(0,240,255,.18), rgba(139,92,246,.18));
  box-shadow: 0 0 28px rgba(0,240,255,.35);
  transform: scale(1.08) rotate(-4deg);
}

/* ---------- Buttons ---------- */
.btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(92deg, #00f0ff, #6366f1);
  transition: box-shadow .35s, transform .35s;
}
.btn-primary:hover { box-shadow: 0 0 34px rgba(0,240,255,.45), 0 0 60px rgba(99,102,241,.25); transform: translateY(-2px); }
/* Shine sweep on primary button hover */
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); transition: left .6s ease;
}
.btn-primary:hover::after { left: 130%; }

.btn-ghost { transition: all .35s; }
.btn-ghost:hover { border-color: rgba(0,240,255,.6); box-shadow: inset 0 0 24px rgba(0,240,255,.08), 0 0 24px rgba(0,240,255,.15); transform: translateY(-2px); }

/* ---------- Navbar ---------- */
#navbar { transition: background .4s, border-color .4s, backdrop-filter .4s, box-shadow .4s; }
#navbar.scrolled {
  background: var(--color-glass-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 10px 40px -18px rgba(0,240,255,.15);
}
.nav-link { position: relative; transition: color .3s; }
.nav-link::after {
  content: ''; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: linear-gradient(90deg, #00f0ff, #8b5cf6); border-radius: 99px; transition: width .35s;
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: #00f0ff; }

/* Mobile drawer animation */
#mobileMenu { max-height: 0; overflow: hidden; transition: max-height .5s cubic-bezier(.22,1,.36,1); }
#mobileMenu.open { max-height: 480px; }

/* ---------- Hero terminal card ---------- */
.terminal-dot { width: 11px; height: 11px; border-radius: 9999px; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.caret { animation: blink 1s step-end infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.float-slow { animation: floatY 7s ease-in-out infinite; }

/* Scanline sweeping across the terminal card */
@keyframes scan { 0% { top: -10%; } 100% { top: 110%; } }
.scanline {
  position: absolute; left: 0; right: 0; height: 90px; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0,240,255,.07), transparent);
  animation: scan 5.5s linear infinite;
}

/* ---------- Scroll-reveal (IntersectionObserver toggles .revealed) ---------- */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity .8s cubic-bezier(.22,1,.36,1), transform .8s cubic-bezier(.22,1,.36,1); }
.reveal.revealed { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: .12s; } .reveal-delay-2 { transition-delay: .24s; }
.reveal-delay-3 { transition-delay: .36s; } .reveal-delay-4 { transition-delay: .48s; }

/* ---------- Tech badges ---------- */
.badge {
  font-family: 'JetBrains Mono', monospace; font-size: .68rem; letter-spacing: .04em;
  border: 1px solid rgba(0,240,255,.25); color: #8ff7ff;
  background: rgba(0,240,255,.06); transition: all .3s;
}
.badge:hover { background: rgba(0,240,255,.14); border-color: rgba(0,240,255,.55); box-shadow: 0 0 16px rgba(0,240,255,.2); }
.badge-purple { border-color: rgba(139,92,246,.35); color: #c9b8ff; background: rgba(139,92,246,.08); }
.badge-purple:hover { background: rgba(139,92,246,.18); border-color: rgba(139,92,246,.6); box-shadow: 0 0 16px rgba(139,92,246,.25); }

/* ---------- Section eyebrow label ---------- */
.eyebrow { font-family: 'JetBrains Mono', monospace; letter-spacing: .28em; }

/* ---------- Contact inputs ---------- */
.field {
  background: var(--color-field-bg); border: 1px solid var(--color-field-border);
  transition: border-color .3s, box-shadow .3s, background .3s;
}
.field:focus {
  outline: none; border-color: rgba(0,240,255,.6);
  box-shadow: 0 0 0 3px rgba(0,240,255,.12), 0 0 24px rgba(0,240,255,.1);
  background: rgba(0,240,255,.03);
}

/* ---------- Marquee (capability ticker) ---------- */
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.marquee-track { animation: marquee 30s linear infinite; }
.marquee-track:hover { animation-play-state: paused; }

/* Divider glow line */
.glow-line { height: 1px; background: linear-gradient(90deg, transparent, rgba(0,240,255,.5), rgba(139,92,246,.5), transparent); }

/* ================================================================
   NEW STYLES (Particles, Modals, 3D Tilt Transitions)
   ================================================================ */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
}

/* Modal animation and states */
#projectModal {
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#projectModal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#projectModal.open .modal-content {
  transform: scale(1) translateY(0);
}

.modal-content {
  transform: scale(0.92) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--color-steel);
  border: 1px solid var(--color-border);
}

/* Light mode specific classes for Modal */
html.light .modal-content {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 50px -15px rgba(0,0,0,0.15);
}

/* Global Transitions for theme switching */
html, body {
  transition: background-color 0.35s ease, color 0.35s ease;
}
p, span, h1, h2, h3, h4, h5, h6, a, div, header, footer, section, button, select, input, textarea {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.15s ease;
}
.glow-card, .btn-primary, .btn-ghost {
  transition: transform 0.25s ease-out, box-shadow 0.35s ease, border-color 0.35s ease;
}
