/* ===========================================================
   Omar Saber — Portfolio (Profile build)
   Pure HTML / CSS / JS conversion of the React design
   =========================================================== */

/* ---------- Variables (DARK = default) ---------- */
:root {
  --bg: #0a0a1a;
  --bg-2: #050510;
  --panel: rgba(10, 10, 26, 0.8);
  --panel-2: rgba(15, 23, 42, 0.6);
  --card-bg: rgba(10, 10, 26, 0.8);
  --card-bg-strong: rgba(10, 10, 26, 0.95);
  --input-bg: rgba(255, 255, 255, 0.05);

  --cyan: #22d3ee;
  --cyan-bright: #00d4ff;
  --cyan-soft: #67e8f9;
  --violet: #7c3aed;
  --violet-bright: #8b5cf6;
  --pink: #ec4899;
  --emerald: #10b981;
  --teal: #14b8a6;
  --orange: #f97316;
  --red: #ef4444;
  --indigo: #6366f1;
  --yellow: #eab308;
  --rose: #f43f5e;
  --fuchsia: #d946ef;
  --green: #22c55e;

  --text: #ffffff;
  --text-soft: #d1d5db;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-cyan: rgba(34, 211, 238, 0.3);

  --grad-cv: linear-gradient(90deg, var(--cyan) 0%, var(--violet) 100%);
  --grad-cv-text: linear-gradient(90deg, #22d3ee 0%, #a78bfa 100%);
  --grad-headline: linear-gradient(90deg, #67e8f9, #ffffff, #c4b5fd);

  --shadow-cyan: 0 0 30px rgba(34, 211, 238, 0.5);
  --shadow-violet: 0 0 30px rgba(139, 92, 246, 0.5);

  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 999px;
}

/* ---------- LIGHT theme ---------- */
html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #e9eef7;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-2: rgba(255, 255, 255, 0.7);
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-bg-strong: rgba(255, 255, 255, 0.98);
  --input-bg: rgba(15, 23, 42, 0.04);

  --cyan: #0891b2;
  --cyan-bright: #06b6d4;
  --cyan-soft: #22d3ee;
  --violet: #6d28d9;
  --violet-bright: #7c3aed;

  --text: #0f172a;
  --text-soft: #1f2937;
  --text-muted: #475569;
  --text-dim: #64748b;

  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.22);
  --border-cyan: rgba(8, 145, 178, 0.35);

  --grad-headline: linear-gradient(90deg, #0891b2, #1e293b, #6d28d9);
}
html[data-theme="light"] body {
  background: linear-gradient(135deg, #f4f6fb 0%, #e9eef7 100%);
}
html[data-theme="light"] .nav.scrolled {
  background: rgba(255, 255, 255, 0.85);
  border-bottom-color: var(--border);
}
html[data-theme="light"] .nav-mobile {
  background: rgba(255, 255, 255, 0.95);
}
/* Soften the heavy aurora blobs and dark vignette in light mode */
html[data-theme="light"] .aurora-blob-1 { opacity: 0.5; background: radial-gradient(circle, rgba(8, 145, 178, 0.22), transparent 60%); }
html[data-theme="light"] .aurora-blob-2 { opacity: 0.5; background: radial-gradient(circle, rgba(124, 58, 237, 0.18), transparent 60%); }
html[data-theme="light"] .aurora-blob-3 { opacity: 0.5; background: radial-gradient(circle, rgba(236, 72, 153, 0.14), transparent 60%); }
html[data-theme="light"] .aurora-vignette {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(244, 246, 251, 0.85) 100%);
}
html[data-theme="light"] .aurora-scanlines { display: none; }
html[data-theme="light"] .marquee-fade {
  background: linear-gradient(90deg, var(--bg) 0%, transparent 10%, transparent 90%, var(--bg) 100%);
}
html[data-theme="light"] .hero-grid {
  background-image:
    linear-gradient(rgba(8, 145, 178, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 145, 178, 0.10) 1px, transparent 1px);
}
html[data-theme="light"] .hero-orb-1 { background: rgba(6, 182, 212, 0.18); }
html[data-theme="light"] .hero-orb-2 { background: rgba(124, 58, 237, 0.15); }

/* In light mode, panels use the new card vars */
html[data-theme="light"] .hero-stat,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .timeline-card,
html[data-theme="light"] .skill-card,
html[data-theme="light"] .cert-card,
html[data-theme="light"] .project-card,
html[data-theme="light"] .contact-card,
html[data-theme="light"] .contact-form-wrap,
html[data-theme="light"] .marquee-item,
html[data-theme="light"] .chat-bar {
  background: var(--card-bg);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .chat-bar { background: var(--panel); }
html[data-theme="light"] .marquee-item {
  border-color: rgba(8, 145, 178, 0.35);
  color: #0e7490;
}
html[data-theme="light"] .form-field input,
html[data-theme="light"] .form-field textarea,
html[data-theme="light"] .form-field select,
html[data-theme="light"] .chat-bar-input {
  background: var(--input-bg);
  color: var(--text);
}
html[data-theme="light"] .form-field select option { background: #ffffff; color: var(--text); }
html[data-theme="light"] .chip,
html[data-theme="light"] .skill-filter,
html[data-theme="light"] .timeline-tech,
html[data-theme="light"] .project-tech,
html[data-theme="light"] .tag {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-soft);
}
html[data-theme="light"] .timeline-line {
  background: linear-gradient(180deg, var(--cyan), var(--violet) 50%, #ec4899);
}
html[data-theme="light"] ::-webkit-scrollbar-track { background: #e9eef7; }
html[data-theme="light"] .chat-bar-msg.bot .chat-bar-msg-bubble {
  background: rgba(8, 145, 178, 0.06);
  border-color: rgba(8, 145, 178, 0.25);
  color: var(--text);
}
html[data-theme="light"] .modal-content { background: var(--card-bg-strong); }
html[data-theme="light"] .modal-backdrop { background: rgba(15, 23, 42, 0.55); }

/* Smooth theme transition */
body, .nav, .timeline-card, .skill-card, .cert-card, .project-card,
.stat-card, .hero-stat, .contact-card, .contact-form-wrap, .marquee-item,
.chat-bar, .form-field input, .form-field textarea, .form-field select {
  transition: background 300ms ease, color 300ms ease, border-color 300ms ease;
}

/* Theme toggle button */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 200ms ease, background 200ms ease, border-color 200ms ease;
}
.theme-toggle:hover {
  transform: scale(1.08) rotate(15deg);
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: inline-block; }
html[data-theme="light"] .theme-icon-sun  { display: inline-block; }
html[data-theme="light"] .theme-icon-moon { display: none; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; padding: 0; margin: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a1a; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--cyan), var(--violet)); border-radius: 10px; }

/* Selection */
::selection { background: var(--cyan); color: #0a0a1a; }

/* ---------- Aurora Background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  filter: blur(20px);
}
.aurora-blob-1 {
  top: -160px;
  left: -160px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.3), transparent 60%);
  animation: aurora1 22s ease-in-out infinite;
}
.aurora-blob-2 {
  top: 33%;
  right: -160px;
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.32), transparent 60%);
  animation: aurora2 26s ease-in-out infinite;
}
.aurora-blob-3 {
  bottom: -160px;
  left: 33%;
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.22), transparent 60%);
  animation: aurora3 24s ease-in-out infinite;
}
.aurora-scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, #00d4ff 2px, #00d4ff 3px);
}
.aurora-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(5, 5, 16, 0.85) 100%);
}
@keyframes aurora1 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(120px, 80px, 0); } }
@keyframes aurora2 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(-100px, 60px, 0); } }
@keyframes aurora3 { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(80px, -60px, 0); } }

/* Particles canvas */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Mouse glow */
.mouse-glow {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.07), transparent 60%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 2;
  transition: opacity 200ms ease;
  mix-blend-mode: screen;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  transition: background 300ms ease, border-color 300ms ease, backdrop-filter 300ms ease;
  border-bottom: 1px solid transparent;
  transform: translateY(-100%);
  animation: navIn 0.6s ease forwards;
}
@keyframes navIn { to { transform: translateY(0); } }
.nav.scrolled {
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-brand {
  font-weight: 800;
  font-size: 1.25rem;
  background: var(--grad-cv-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 200ms ease;
}
.nav-brand:hover { transform: scale(1.05); }

.nav-links {
  display: none;
  gap: 2rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.nav-links a {
  font-size: 0.9rem;
  color: var(--text-soft);
  transition: color 200ms ease;
}
.nav-links a:hover { color: var(--cyan); }

.nav-cv { display: none; }
.nav-burger {
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0.5rem;
  display: inline-flex;
}

.nav-mobile {
  display: none;
  flex-direction: column;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 1rem;
  gap: 0.5rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: 0.6rem 0.25rem;
  color: var(--text-soft);
  transition: color 200ms ease;
}
.nav-mobile a:hover { color: var(--cyan); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cv { display: inline-flex; }
  .nav-burger { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease, border-color 200ms ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px) scale(1.03); }
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.5rem; font-size: 1rem; border-radius: var(--radius-xl); }

.btn-gradient {
  background: linear-gradient(90deg, var(--cyan) 0%, #2563eb 100%);
}
.btn-gradient:hover { box-shadow: var(--shadow-cyan); }

.btn-violet {
  background: linear-gradient(90deg, var(--violet) 0%, #9333ea 100%);
}
.btn-violet:hover { box-shadow: var(--shadow-violet); }

.btn-emerald {
  background: linear-gradient(90deg, var(--emerald) 0%, var(--teal) 100%);
}
.btn-emerald:hover { box-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }

.btn-outline-cyan {
  background: transparent;
  border: 2px solid rgba(34, 211, 238, 0.5);
  backdrop-filter: blur(8px);
}
.btn-outline-cyan:hover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}

.btn-outline-violet {
  background: transparent;
  border: 2px solid rgba(139, 92, 246, 0.5);
  backdrop-filter: blur(8px);
}
.btn-outline-violet:hover {
  border-color: var(--violet-bright);
  background: rgba(139, 92, 246, 0.1);
}

/* ---------- Layout helpers ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}
.container-narrow { max-width: 1100px; }

.section {
  position: relative;
  z-index: 10;
  padding: 8rem 1rem;
}

.section-head {
  text-align: center;
  margin-bottom: 4rem;
}
.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.section-divider {
  width: 96px;
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  border-radius: 999px;
  margin: 0 auto;
}
.section-desc {
  margin: 1.5rem auto 0;
  max-width: 560px;
  color: var(--text-muted);
}

main { position: relative; z-index: 10; }

/* gradient text helpers */
.gradient-text {
  background: var(--grad-cv-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gradient-text-anim {
  background: var(--grad-headline);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.t-cyan { color: var(--cyan); font-weight: 600; }
.t-violet { color: #a78bfa; font-weight: 600; }

/* ---------- Reveal Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px) scale(0.97);
  transition:
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Subtle entry variants for cards */
.skill-card.reveal       { transform: translateY(20px) scale(0.95); }
.cert-card.reveal        { transform: translateY(30px) scale(0.95) rotateY(-10deg); }
.project-card.reveal     { transform: translateY(40px) scale(0.97); }
.timeline-item.reveal.left  { transform: translateX(-50px); }
.timeline-item.reveal.right { transform: translateX(50px); }
.timeline-item.reveal.is-visible { transform: translateX(0); }
.cert-card.reveal.is-visible    { transform: translateY(0) scale(1) rotateY(0); }
.skill-card.reveal.is-visible,
.project-card.reveal.is-visible { transform: translateY(0) scale(1); }

.animate-up {
  opacity: 0;
  transform: translateY(30px);
  animation: animateUp 0.8s ease forwards;
}
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
@keyframes animateUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem 4rem;
  overflow: hidden;
  z-index: 10;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(100, 200, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 200, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  pointer-events: none;
}
@keyframes gridMove {
  0% { transform: translateY(0); }
  100% { transform: translateY(50px); }
}
.hero-orb {
  position: absolute;
  width: 384px; height: 384px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: pulseOrb 4s ease-in-out infinite;
}
.hero-orb-1 {
  top: 25%; left: 25%;
  background: rgba(6, 182, 212, 0.2);
}
.hero-orb-2 {
  bottom: 25%; right: 25%;
  background: rgba(139, 92, 246, 0.2);
  animation-delay: 1s;
}
@keyframes pulseOrb {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.hero-inner {
  position: relative;
  z-index: 5;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}
.hero-pill {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  margin-bottom: 1.5rem;
}
.hero-title {
  position: relative;
  font-size: clamp(2.75rem, 7vw, 6rem);
  font-weight: 800;
  margin: 0 0 1.5rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.hero-name { position: relative; display: inline-block; }
.glitch {
  position: absolute;
  inset: 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  mix-blend-mode: screen;
  pointer-events: none;
}
.glitch-cyan {
  background: linear-gradient(90deg, #22d3ee, #22d3ee);
  animation: glitchCyan 4s infinite;
}
.glitch-magenta {
  background: linear-gradient(90deg, #d946ef, #d946ef);
  animation: glitchMagenta 4s infinite;
  animation-delay: 0.05s;
}
@keyframes glitchCyan {
  0%, 90%, 100% { opacity: 0; transform: translateX(0); }
  5% { opacity: 0.6; transform: translateX(-3px); }
  10% { opacity: 0; transform: translateX(2px); }
  15% { opacity: 0.4; transform: translateX(0); }
}
@keyframes glitchMagenta {
  0%, 90%, 100% { opacity: 0; transform: translateX(0); }
  5% { opacity: 0.5; transform: translateX(3px); }
  10% { opacity: 0; transform: translateX(-2px); }
  15% { opacity: 0.3; transform: translateX(0); }
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.4rem);
  color: var(--text-soft);
  max-width: 60rem;
  margin: 0 auto 3rem;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* Hero AI Chat Bar — glassmorphic */
.chat-bar {
  max-width: 60rem;
  width: 100%;
  margin: 3rem auto 2rem;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: left;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="light"] .chat-bar {
  background: rgba(255, 255, 255, 0.45);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow:
    0 20px 60px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.chat-bar-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}
.chat-bar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.chat-bar-name {
  font-weight: 700;
  background: var(--grad-cv-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.chat-bar-status {
  font-size: 0.75rem;
  color: var(--cyan);
  display: flex; align-items: center; gap: 0.4rem;
}
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Inline messages thread inside hero chat bar */
.chat-bar-messages {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.25rem 0.25rem 1rem;
  margin-bottom: 1rem;
  scroll-behavior: smooth;
}
.chat-bar-messages.has-messages { display: flex; }
.chat-bar-msg {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  animation: msgIn 300ms ease;
  max-width: 100%;
}
.chat-bar-msg.user { flex-direction: row-reverse; }
.chat-bar-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.chat-bar-msg.bot .chat-bar-msg-avatar {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.chat-bar-msg.user .chat-bar-msg-avatar {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.chat-bar-msg-bubble {
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-line;
  max-width: 80%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-bar-msg-bubble strong { font-weight: 700; color: var(--cyan); }
.chat-bar-msg.user .chat-bar-msg-bubble strong { color: #fff; }
.chat-bar-msg-bubble em { font-style: italic; opacity: 0.9; }
.chat-bar-msg-bubble a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-bar-msg.user .chat-bar-msg-bubble a { color: #fff; }
.chat-bar-msg-bubble .md-inline-code {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82em;
  color: #67e8f9;
}
.chat-bar-msg.user .chat-bar-msg-bubble .md-inline-code {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.chat-bar-msg-bubble .md-code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  white-space: pre;
}
.chat-bar-msg-bubble .md-code code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: #a5f3fc;
  background: transparent;
}
.chat-bar-msg-bubble .md-list {
  margin: 0.4rem 0;
  padding-inline-start: 1.2rem;
  list-style: none;
}
.chat-bar-msg-bubble .md-list li {
  position: relative;
  margin: 0.2rem 0;
  padding-inline-start: 0.4rem;
}
.chat-bar-msg-bubble .md-list li::before {
  content: "•";
  position: absolute;
  inset-inline-start: -0.6rem;
  color: var(--cyan);
  font-weight: 700;
}
.chat-bar-msg.user .chat-bar-msg-bubble .md-list li::before { color: #fff; }
/* Disable pre-line inside lists/code so explicit newlines in source don't double-space */
.chat-bar-msg-bubble .md-list,
.chat-bar-msg-bubble .md-code { white-space: normal; }
.chat-bar-msg-bubble .md-code { white-space: pre; }
.chat-bar-msg.bot .chat-bar-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: #fff;
}
.chat-bar-msg.user .chat-bar-msg-bubble {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #fff;
}
.chat-bar-msg.typing .chat-bar-msg-bubble {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0.85rem 1rem;
}
.chat-bar-msg.typing .chat-bar-msg-bubble span {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  display: inline-block;
  animation: typingDot 1.2s ease-in-out infinite;
}
.chat-bar-msg.typing .chat-bar-msg-bubble span:nth-child(2) { animation-delay: 0.15s; }
.chat-bar-msg.typing .chat-bar-msg-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Custom scrollbar for the inline thread */
.chat-bar-messages::-webkit-scrollbar { width: 6px; }
.chat-bar-messages::-webkit-scrollbar-track { background: transparent; }
.chat-bar-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  border-radius: 6px;
}

.chat-bar-input-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}
.chat-bar-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1.1rem 3rem 1.1rem 1rem;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 200ms ease;
  font-family: inherit;
}
.chat-bar-input::placeholder { color: var(--text-muted); }
.chat-bar-input:focus { border-color: rgba(34, 211, 238, 0.5); }
.chat-bar-send {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--cyan);
  padding: 0.5rem;
  border-radius: 8px;
  display: inline-flex;
  transition: color 200ms, transform 200ms;
}
.chat-bar-send:hover { color: var(--cyan-soft); transform: translateY(-50%) scale(1.1); }

.chat-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.chip {
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-soft);
  transition: all 200ms ease;
}
.chip:hover {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.1);
  transform: scale(1.05);
}

/* Hero Stats */
.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 5rem;
}
@media (min-width: 768px) {
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
}
.hero-stat {
  position: relative;
  padding: 1.5rem;
  background: rgba(10, 10, 26, 0.5);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  transition: transform 300ms ease, box-shadow 300ms ease;
}
.hero-stat::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  border-radius: var(--radius-xl);
  filter: blur(16px);
  z-index: -1;
  transition: filter 300ms ease;
}
.hero-stat:hover {
  transform: translateY(-10px) scale(1.05);
}
.hero-stat:hover::before { filter: blur(24px); }
.hero-stat-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero-stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.hero-stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Neon Tunnel (Hero) ---------- */
.neon-tunnel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}
.neon-ring {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 2px solid var(--cyan-bright);
  box-shadow: 0 0 20px var(--cyan-bright);
  opacity: 0;
  animation: neonRing 7s ease-out infinite;
  animation-delay: calc(var(--i) * 1.1s);
  will-change: transform, opacity;
}
.neon-ring:nth-child(2n) {
  border-color: var(--violet);
  box-shadow: 0 0 20px var(--violet);
}
@keyframes neonRing {
  0% { transform: scale(0.2); opacity: 0; }
  50% { opacity: 0.35; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---------- Wireframe Globe (Hero) ---------- */
.globe-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}
.globe-halo {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, #00d4ff, transparent 30%, #7c3aed, transparent 70%, #ec4899, transparent);
  filter: blur(50px);
  opacity: 0.4;
  animation: spin 18s linear infinite;
  will-change: transform;
}
.globe {
  position: relative;
  width: 440px;
  height: 440px;
  transform-style: preserve-3d;
  animation: globeSpin 28s linear infinite;
  will-change: transform;
}
@keyframes globeSpin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}
.globe-lat,
.globe-lon {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border-style: solid;
  border-width: 1px;
}
.globe-lat { border-color: var(--cyan); opacity: 0.55; }
.globe-lon { border-color: #a78bfa; opacity: 0.4; }
.globe-equator {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cyan-bright);
  box-shadow: 0 0 25px var(--cyan-bright);
}
.globe-orbit {
  position: absolute;
  border-radius: 50%;
  animation: spin linear infinite;
  pointer-events: none;
  will-change: transform;
}
.globe-orbit-1 { width: 480px; height: 480px; animation-duration: 8s; }
.globe-orbit-2 { width: 560px; height: 560px; animation-duration: 12s; }
.globe-orbit-dot {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan-soft);
  box-shadow: 0 0 14px var(--cyan-bright);
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@media (max-width: 768px) {
  .globe-halo { width: 320px; height: 320px; }
  .globe { width: 280px; height: 280px; }
  .globe-orbit-1 { width: 320px; height: 320px; }
  .globe-orbit-2 { width: 380px; height: 380px; }
  .neon-ring { width: 320px; height: 320px; }
}

/* ---------- Skills Cube (3D) ---------- */
.skills-cube-stage {
  position: relative;
  height: 34rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  margin-top: 5rem;
}
.skills-cube-halo {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, #00d4ff, transparent 30%, #7c3aed, transparent 70%, #ec4899, transparent);
  filter: blur(50px);
  opacity: 0.45;
  animation: spin 14s linear infinite;
  pointer-events: none;
}
.skills-cube {
  position: relative;
  width: 280px;
  height: 280px;
  transform-style: preserve-3d;
  transform: rotateX(-15deg) rotateY(15deg);
  will-change: transform;
}
.cube-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--c);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 20%, transparent), color-mix(in srgb, var(--c) 7%, transparent));
  border: 2px solid var(--c);
  box-shadow: 0 0 40px color-mix(in srgb, var(--c) 40%, transparent), inset 0 0 30px color-mix(in srgb, var(--c) 20%, transparent);
  text-shadow: 0 0 12px var(--c);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cube-front  { transform: translateZ(140px); }
.cube-back   { transform: rotateY(180deg) translateZ(140px); }
.cube-right  { transform: rotateY(90deg)  translateZ(140px); }
.cube-left   { transform: rotateY(-90deg) translateZ(140px); }
.cube-top    { transform: rotateX(90deg)  translateZ(140px); }
.cube-bottom { transform: rotateX(-90deg) translateZ(140px); }

.orbit-chip {
  position: absolute;
  width: 1px;
  height: 1px;
  animation: orbit 22s linear infinite;
  animation-delay: calc(var(--i) * -3.667s);
  pointer-events: none;
}
@keyframes orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.orbit-chip-inner {
  position: absolute;
  left: 280px;
  top: 0;
  transform: translate(-50%, -50%);
  padding: 0.5rem 1rem;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(34, 211, 238, 0.6);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #67e8f9;
  white-space: nowrap;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.6);
  animation: orbitCounter 22s linear infinite;
  animation-delay: inherit;
}
@keyframes orbitCounter {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(-360deg); }
}
.skills-cube-hint {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .skills-cube-stage { height: 26rem; perspective: 900px; }
  .skills-cube-halo { width: 320px; height: 320px; }
  .orbit-chip-inner { left: 170px; }
}

/* ---------- Company / Issuer Logo Badge ---------- */
.company-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}
.company-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 50%);
  pointer-events: none;
}

/* Image-based variant: real company logo on a clean white tile */
.company-logo-img {
  background: #ffffff;
  padding: 6px;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  text-shadow: none;
}
.company-logo-img::after { display: none; }
.company-logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Cert card top: logo on the left, emoji as small accent on the right */
.cert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cert-emoji-mini {
  font-size: 1.5rem;
  opacity: 0.7;
}
.cert-emoji {
  font-size: 3rem;
  text-align: center;
}

/* Modal: center the logo */
.modal-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.modal-logo-wrap .company-logo {
  border-radius: 18px;
  font-size: 1.5rem;
}

/* Holo Robot avatar */
.holo-robot {
  position: relative;
  width: 44px; height: 44px;
  flex-shrink: 0;
  animation: holoFloat 2s ease-in-out infinite;
}
@keyframes holoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.holo-head {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #67e8f9, #00d4ff 40%, #7c3aed 80%);
  box-shadow: 0 0 25px #00d4ff, inset -3px -6px 10px rgba(0,0,0,0.4);
}
.holo-eye {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ecfeff;
  top: 32%;
  box-shadow: 0 0 6px #fff;
}
.holo-eye-l { left: 28%; }
.holo-eye-r { right: 28%; }
.holo-mouth {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 2px;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--cyan);
  animation: holoMouth 1.2s ease-in-out infinite;
}
@keyframes holoMouth {
  0%, 100% { transform: translateX(-50%) scaleY(1); }
  50% { transform: translateX(-50%) scaleY(2); }
}
.holo-antenna {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 11px;
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan-bright);
}
.holo-antenna-tip {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan-soft);
  box-shadow: 0 0 8px var(--cyan);
  animation: holoBlink 1s ease-in-out infinite;
}
@keyframes holoBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- Tech Marquee ---------- */
.marquee-section {
  position: relative;
  z-index: 10;
  padding: 2rem 0;
  overflow: hidden;
}
.marquee-fade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, transparent 10%, transparent 90%, var(--bg) 100%);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 40s linear infinite;
  will-change: transform;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-row {
  display: flex;
  gap: 1.25rem;
  padding: 0 0.625rem;
  flex-shrink: 0;
}
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.1rem;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius);
  font-weight: 600;
  color: #a5f3fc;
  white-space: nowrap;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.marquee-item:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.4);
}
.marquee-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.marquee-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 4px;
  padding: 1px;
}
.marquee-icon.failed img { display: none; }
.marquee-icon.failed::before {
  content: attr(data-emoji);
  font-size: 1.1rem;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- Language Toggle ---------- */
.lang-toggle {
  height: 38px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 200ms ease, background 200ms ease, border-color 200ms ease;
}
.lang-toggle:hover {
  transform: scale(1.05);
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}
.lang-toggle .lang-current {
  color: var(--cyan);
}
.lang-toggle .lang-sep {
  margin: 0 0.3rem;
  opacity: 0.4;
}

/* ---------- RTL adjustments ---------- */
html[dir="rtl"] body { font-family: 'Tajawal', 'Inter', system-ui, sans-serif; }
html[dir="rtl"] .nav-brand,
html[dir="rtl"] .hero-title,
html[dir="rtl"] .section-title,
html[dir="rtl"] .stat-value,
html[dir="rtl"] .skill-level,
html[dir="rtl"] .timeline-period,
html[dir="rtl"] .marquee-item,
html[dir="rtl"] .skill-cat { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .timeline-line { left: auto; right: 50%; transform: translateX(50%); }
html[dir="rtl"] .timeline-item.left .timeline-card-wrap,
html[dir="rtl"] .timeline-item.right .timeline-card-wrap { text-align: right; }
html[dir="rtl"] .marquee-fade {
  background: linear-gradient(270deg, var(--bg) 0%, transparent 10%, transparent 90%, var(--bg) 100%);
}
html[dir="rtl"] .chat-bar-input,
html[dir="rtl"] .form-field input,
html[dir="rtl"] .form-field textarea,
html[dir="rtl"] .form-field select { text-align: right; }
html[dir="rtl"] .chat-bar-send { right: auto; left: 0.5rem; }

/* ---------- ABOUT ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
@media (min-width: 1024px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
}
.about-text p {
  color: var(--text-soft);
  font-size: 1.125rem;
  line-height: 1.7;
  margin: 0 0 1.25rem;
}
.about-tags {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.tag {
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-soft);
  backdrop-filter: blur(8px);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.stat-card {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: transform 300ms ease, border-color 300ms ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  border-radius: var(--radius-xl);
  filter: blur(16px);
  z-index: -1;
}
.stat-card:hover { transform: translateY(-5px) scale(1.05); }
.stat-icon { color: var(--cyan); margin-bottom: 1rem; }
.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  /* Lock digit width so the count-up animation doesn't shift layout (CLS fix) */
  font-variant-numeric: tabular-nums;
}
.stat-value .counter { display: inline-block; min-width: 1.6ch; text-align: end; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Experience Timeline ---------- */
.timeline {
  position: relative;
}
.timeline-line {
  display: none;
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet) 50%, var(--pink));
  transform: translateX(-50%);
}
@media (min-width: 768px) {
  .timeline-line { display: block; }
}

.timeline-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
}

.timeline-card-wrap {
  width: 100%;
}
@media (min-width: 768px) {
  .timeline-item.left { flex-direction: row; }
  .timeline-item.right { flex-direction: row-reverse; }
  .timeline-item.left .timeline-card-wrap,
  .timeline-item.right .timeline-card-wrap { width: calc(50% - 2rem); text-align: left; }
}

.timeline-card {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: transform 300ms ease, border-color 300ms ease;
}
.timeline-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  filter: blur(16px);
  opacity: 0.2;
  z-index: -1;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
}
.timeline-card:hover { transform: translateY(-5px) scale(1.02); border-color: var(--border-strong); }
.timeline-card-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.timeline-card-meta { min-width: 0; flex: 1; }
.timeline-icon {
  padding: 0.5rem;
  border-radius: 10px;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
  color: #fff;
  display: inline-flex;
}
.timeline-title { font-size: 1.25rem; font-weight: 700; color: #fff; margin: 0; }
.timeline-company { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.timeline-period { font-size: 0.85rem; color: var(--cyan); font-weight: 500; margin: 0 0 0.75rem; }
.timeline-desc { color: var(--text-soft); margin: 0 0 1rem; line-height: 1.6; }
.timeline-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}
.timeline-tech {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.7rem;
  color: var(--text-soft);
}

.timeline-dot-wrap {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
@media (min-width: 768px) {
  .timeline-dot-wrap { display: block; }
}
.timeline-dot {
  position: relative;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
}
.timeline-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pingDot 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes pingDot {
  75%, 100% { transform: scale(2.5); opacity: 0; }
}

/* ---------- Skills ---------- */
.skill-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.skill-filter {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 0.85rem;
  transition: all 200ms ease;
}
.skill-filter:hover { border-color: var(--border-strong); }
.skill-filter.active {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  color: #fff;
  border-color: transparent;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .skills-grid { grid-template-columns: repeat(4, 1fr); } }

.skill-card {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: transform 300ms ease, border-color 300ms ease;
}
.skill-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
  opacity: 0.2;
  filter: blur(12px);
  border-radius: var(--radius);
  z-index: -1;
}
.skill-card:hover { transform: translateY(-5px) scale(1.05); }
.skill-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.skill-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--skill-color, #22d3ee) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--skill-color, #22d3ee) 45%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--skill-color, #22d3ee) 25%, transparent);
}
.skill-logo-img {
  background: #ffffff;
  padding: 5px;
  border-color: color-mix(in srgb, var(--skill-color, #22d3ee) 35%, transparent);
}
.skill-logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
/* If image failed to load, show the emoji fallback via ::before */
.skill-logo-img.failed {
  background: color-mix(in srgb, var(--skill-color, #22d3ee) 18%, transparent);
  padding: 0;
}
.skill-logo-img.failed::before {
  content: attr(data-emoji);
  font-size: 1.25rem;
}
.skill-meta { flex: 1; min-width: 0; }
.skill-card-top .skill-level { align-self: flex-start; }
.skill-name { font-weight: 600; color: #fff; margin: 0 0 0.2rem; }
.skill-cat { font-size: 0.7rem; color: var(--text-muted); }
.skill-level {
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--grad-cv-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.skill-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
  border-radius: 999px;
  transition: width 1s ease;
}

/* ---------- Certificates ---------- */
.certs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) { .certs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .certs-grid { grid-template-columns: repeat(4, 1fr); } }

.cert-card {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 300ms ease, border-color 300ms ease;
  height: 100%;
}
.cert-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
  opacity: 0.2;
  filter: blur(16px);
  border-radius: var(--radius-xl);
  z-index: -1;
  transition: filter 300ms ease;
}
.cert-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
}
.cert-card:hover::before { filter: blur(24px); }
.cert-emoji { font-size: 3rem; text-align: center; margin-bottom: 1rem; }
.cert-cat-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}
.cert-title { font-weight: 700; color: #fff; margin: 0 0 0.5rem; }
.cert-issuer { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.cert-date { font-size: 0.75rem; color: var(--cyan); font-weight: 500; margin: 0; }
.cert-view {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 200ms ease;
}
.cert-card:hover .cert-view { color: var(--cyan); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}
.modal-content {
  position: relative;
  max-width: 42rem;
  width: 100%;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  animation: modalIn 300ms ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 200ms ease;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.1); }
.modal-emoji { font-size: 4rem; text-align: center; margin-bottom: 1.5rem; }
.modal-cat {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.modal-title { font-size: 1.875rem; font-weight: 800; margin: 0 0 1rem; }
.modal-issuer { font-size: 1.25rem; color: var(--text-soft); margin: 0 0 0.5rem; }
.modal-date { color: var(--cyan); font-weight: 500; margin: 0 0 1.5rem; }
.modal-desc { color: var(--text-muted); font-size: 1.125rem; line-height: 1.7; margin: 0 0 2rem; }
.modal-actions { display: flex; gap: 1rem; }
.modal-actions .btn { flex: 1; }

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 1024px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }

.project-card {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  height: 100%;
  transition: transform 300ms ease, border-color 300ms ease;
  overflow: hidden;
}
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
  opacity: 0.2;
  filter: blur(16px);
  border-radius: var(--radius-2xl);
  z-index: -1;
  transition: filter 300ms ease;
}
.project-card:hover { transform: translateY(-5px); border-color: var(--border-strong); }
.project-card:hover::before { filter: blur(24px); }
.project-card::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  opacity: 0;
  transition: opacity 200ms ease;
}
.project-card:hover::after { opacity: 1; }

.project-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.project-icon {
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--card-grad, linear-gradient(135deg, var(--cyan), var(--violet)));
  color: #fff;
  display: inline-flex;
  flex-shrink: 0;
}
.project-title { font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0 0 0.25rem; }
.project-cat { font-size: 0.85rem; color: var(--text-muted); }

.project-section { margin-bottom: 1rem; }
.project-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.project-section.problem h4 { color: #f87171; }
.project-section.solution h4 { color: #4ade80; }
.project-section p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.6;
}

.project-techs-label, .project-impact-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.25rem 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.project-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.project-tech {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.7rem;
  color: var(--text-soft);
}
.project-impact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.project-impact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--cyan);
  font-weight: 500;
}
.project-impact-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
  flex-shrink: 0;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 1024px) { .contact-grid { grid-template-columns: 1fr 1fr; } }

.contact-h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
}
.contact-p {
  color: var(--text-soft);
  font-size: 1.125rem;
  line-height: 1.7;
  margin: 0 0 2rem;
}
.contact-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}
.contact-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: transform 300ms ease, border-color 300ms ease;
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  filter: blur(12px);
  z-index: -1;
  opacity: 0.2;
  background: var(--card-grad, linear-gradient(90deg, var(--cyan), var(--violet)));
}
a.contact-card:hover { transform: translateX(10px); border-color: var(--border-strong); }
.contact-card-icon {
  padding: 0.75rem;
  border-radius: 10px;
  display: inline-flex;
  color: #fff;
}
.contact-icon-cyan { background: linear-gradient(135deg, var(--cyan), #2563eb); --card-grad: linear-gradient(90deg, var(--cyan), #2563eb); }
.contact-icon-emerald { background: linear-gradient(135deg, var(--emerald), var(--teal)); --card-grad: linear-gradient(90deg, var(--emerald), var(--teal)); }
.contact-icon-violet { background: linear-gradient(135deg, var(--violet), #9333ea); --card-grad: linear-gradient(90deg, var(--violet), #9333ea); }
.contact-card-label { font-size: 0.75rem; color: var(--text-muted); }
.contact-card-value { color: #fff; font-weight: 500; }

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.quick-actions-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 1rem;
}
.quick-actions-row {
  display: flex;
  gap: 0.75rem;
}

.contact-form-wrap {
  position: relative;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 2rem;
}
.contact-form-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  filter: blur(16px);
  z-index: -1;
}
.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-field { display: flex; flex-direction: column; }
.form-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 0.5rem;
}
.form-field input,
.form-field textarea,
.form-field select {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 200ms ease;
  resize: vertical;
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-muted); }
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus { border-color: rgba(34, 211, 238, 0.5); }
.form-field select option { background: #0a0a1a; color: #fff; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.footer {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer p { margin: 0; color: var(--text-muted); }
.footer-sub { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.5rem !important; }

/* ---------- AI Chatbot Floating (disabled — replaced by inline hero chat) ---------- */
.chatbot-fab { display: none !important; }
.chatbot-window { display: none !important; }
.chatbot-fab-deprecated {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 60;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border: 0;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(34, 211, 238, 0.4);
  transition: transform 200ms ease, box-shadow 200ms ease;
  animation: fabIn 400ms ease;
}
@keyframes fabIn { from { transform: scale(0); } to { transform: scale(1); } }
.chatbot-fab:hover { transform: scale(1.1); box-shadow: 0 15px 40px rgba(0,0,0,0.4), 0 0 50px rgba(34,211,238,0.6); }
.fab-pulse {
  position: absolute;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--red);
  animation: pulseDot 2s ease-in-out infinite;
}
.chatbot-fab.open .fab-pulse { display: none; }

.chatbot-window {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  z-index: 60;
  width: 24rem;
  max-width: calc(100vw - 3rem);
  display: none;
  animation: chatIn 300ms ease;
}
.chatbot-window.open { display: block; }
@keyframes chatIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chatbot-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.2));
  border-radius: var(--radius-2xl);
  filter: blur(16px);
  z-index: -1;
}
.chatbot-inner {
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}
.chatbot-header {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chatbot-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.chatbot-meta { flex: 1; min-width: 0; }
.chatbot-name { font-weight: 700; color: #fff; }
.chatbot-status { font-size: 0.75rem; color: rgba(255, 255, 255, 0.8); }
.chatbot-lang {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  border-radius: 8px;
  font-size: 0.75rem;
  color: #fff;
  transition: background 200ms ease;
}
.chatbot-lang:hover { background: rgba(255, 255, 255, 0.3); }
.chatbot-close {
  background: transparent;
  border: 0;
  color: #fff;
  padding: 0.25rem;
  border-radius: 8px;
  display: inline-flex;
  transition: background 200ms ease;
}
.chatbot-close:hover { background: rgba(255, 255, 255, 0.2); }

.chatbot-messages {
  height: 24rem;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chatbot-msg {
  display: flex;
  gap: 0.5rem;
  animation: msgIn 300ms ease;
}
.chatbot-msg.user { flex-direction: row-reverse; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.chatbot-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.chatbot-msg.bot .chatbot-msg-avatar {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.chatbot-msg.user .chatbot-msg-avatar {
  background: rgba(255, 255, 255, 0.1);
}
.chatbot-msg-bubble {
  max-width: 75%;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-line;
}
.chatbot-msg.bot .chatbot-msg-bubble {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.chatbot-msg.user .chatbot-msg-bubble {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  color: #fff;
}

.chatbot-input-wrap {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.chatbot-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 200ms ease;
}
.chatbot-input::placeholder { color: var(--text-muted); }
.chatbot-input:focus { border-color: rgba(34, 211, 238, 0.5); }
.chatbot-send {
  padding: 0.5rem 0.75rem;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 200ms ease;
}
.chatbot-send:hover { box-shadow: 0 0 20px rgba(34, 211, 238, 0.5); }

/* RTL for Arabic */
.chatbot-window.rtl .chatbot-msg-bubble { direction: rtl; text-align: right; }
.chatbot-window.rtl .chatbot-input { direction: rtl; text-align: right; }

/* ---------- Image Viewer (lightbox) ---------- */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.image-viewer.open {
  display: flex;
  animation: fadeIn 200ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}
.image-viewer-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease;
}
.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}
.image-viewer-stage {
  position: relative;
  z-index: 1;
  max-width: min(95vw, 1400px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: imgIn 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes imgIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.image-viewer-img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  background: #fff;
  display: block;
}
.image-viewer-caption {
  color: #fff;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  max-width: 80vw;
}
.image-viewer-download {
  text-decoration: none;
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 360px;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: toastIn 300ms ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.out { animation: toastOut 300ms ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   RESPONSIVE — covers 320px (small phones) → 1440px+ (large desktop)
   Breakpoints:
     ≤ 480px  small phones
     ≤ 640px  phones
     ≤ 768px  large phones / small tablets
     ≤ 1024px tablets
   ============================================================ */

/* Disable horizontal scroll globally + smooth tap highlights */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }
* { -webkit-tap-highlight-color: rgba(34, 211, 238, 0.15); }
/* Pin full-viewport fixed layers to actual viewport (avoid 1px scroll) */
.aurora, #particles, .mouse-glow { max-width: 100vw; }
#particles { width: 100% !important; height: 100% !important; }

/* ---------- CLS optimization ----------
   Async-built grids reserve a min-height so the page doesn't jump
   when cards are inserted by JS during boot. Containment prevents
   internal animations from triggering layout in the parent. */
.timeline { min-height: 600px; }
.skills-grid { min-height: 400px; }
.certs-grid { min-height: 400px; }
.projects-grid { min-height: 600px; }
.skill-card, .cert-card, .project-card, .timeline-card,
.stat-card, .hero-stat { contain: layout paint; }
/* Marquee/skills logo images: hint browser to allocate the box. */
.marquee-icon img, .skill-logo-img img, .company-logo-img img { aspect-ratio: 1 / 1; }

/* Touch devices: hide the mouse glow effect */
@media (hover: none), (pointer: coarse) {
  .mouse-glow { display: none !important; }
}

/* ---------- ≤ 1024px (tablets) ---------- */
@media (max-width: 1024px) {
  .section { padding: 6rem 1rem; }
  .nav-inner { padding: 0 1rem; gap: 0.75rem; }
}

/* ---------- ≤ 768px (large phones / small tablets) ---------- */
@media (max-width: 768px) {
  .section { padding: 4.5rem 1rem; }
  .section-head { margin-bottom: 2.5rem; }

  /* Nav: tighten spacing */
  .nav-inner { height: 60px; }
  .nav-brand { font-size: 1.05rem; }
  .nav-cv { padding: 0.55rem 0.85rem; font-size: 0.8rem; }
  .nav-cv svg { display: none; }
  .theme-toggle, .lang-toggle { height: 34px; }
  .lang-toggle { padding: 0 0.65rem; font-size: 0.72rem; }

  /* Hero */
  .hero { padding: 5.5rem 1rem 3rem; }
  .hero-pill { font-size: 0.78rem; padding: 0.4rem 0.85rem; }
  .hero-title { line-height: 1.05; margin-bottom: 1rem; }
  .hero-sub { font-size: 1rem; margin-bottom: 2rem; line-height: 1.55; }
  .hero-actions { gap: 0.6rem; }
  .hero-actions .btn { padding: 0.65rem 1rem; font-size: 0.85rem; }
  .hero-actions .btn svg { width: 15px; height: 15px; }
  .hero-orb { width: 240px; height: 240px; filter: blur(60px); }

  /* Hero chat bar */
  .chat-bar { padding: 1.25rem; margin: 2rem auto 1.5rem; }
  .chat-bar-header { gap: 0.6rem; margin-bottom: 1rem; }
  .chat-bar-icon { width: 38px; height: 38px; border-radius: 12px; }
  .chat-bar-name { font-size: 0.95rem; }
  .chat-bar-input { padding: 0.85rem 2.75rem 0.85rem 0.85rem; font-size: 0.95rem; }
  .chat-bar-chips { gap: 0.45rem; }
  .chip { padding: 0.5rem 0.8rem; font-size: 0.78rem; }
  .chat-bar-msg-bubble { font-size: 0.85rem; padding: 0.6rem 0.8rem; max-width: 85%; }
  .chat-bar-messages { max-height: 240px; }

  /* Hero stats */
  .hero-stats { margin-top: 3rem; gap: 1rem; }
  .hero-stat { padding: 1.1rem; }
  .hero-stat-icon { font-size: 2rem; }
  .hero-stat-value { font-size: 1.6rem; }
  .hero-stat-label { font-size: 0.78rem; }

  /* Marquee */
  .marquee-row { gap: 0.85rem; padding: 0 0.5rem; }
  .marquee-item { padding: 0.5rem 0.9rem; font-size: 0.82rem; gap: 0.5rem; }
  .marquee-icon { width: 18px; height: 18px; }

  /* Section titles & dividers */
  .section-title { font-size: clamp(1.6rem, 6vw, 2.25rem); }
  .section-desc { font-size: 0.95rem; padding: 0 0.5rem; }

  /* About */
  .about-grid { gap: 2rem; }
  .about-text p { font-size: 1rem; line-height: 1.65; }
  .about-tags { gap: 0.4rem; }
  .tag { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
  .stat-card { padding: 1.1rem; }
  .stat-value { font-size: 1.7rem; }
  .stat-label { font-size: 0.78rem; }
  .about-stats { gap: 1rem; }

  /* Timeline */
  .timeline-card { padding: 1.1rem; }
  .timeline-title { font-size: 1.1rem; }
  .timeline-company { font-size: 0.78rem; }
  .timeline-period { font-size: 0.78rem; }
  .timeline-desc { font-size: 0.92rem; }
  .timeline-tech { font-size: 0.65rem; padding: 0.2rem 0.55rem; }
  .timeline-card-head { gap: 0.6rem; }

  /* Skills */
  .skill-filters { gap: 0.5rem; margin-bottom: 2rem; }
  .skill-filter { padding: 0.45rem 0.85rem; font-size: 0.78rem; }
  .skill-card { padding: 1rem; }
  .skill-name { font-size: 0.95rem; }
  .skill-cat { font-size: 0.65rem; }
  .skill-level { font-size: 0.78rem; }
  .skill-logo { width: 34px; height: 34px; font-size: 1.1rem; }
  .skills-cube-stage { height: 22rem; perspective: 800px; margin-top: 3rem; }
  .skills-cube { width: 200px; height: 200px; }
  .cube-face { font-size: 1.1rem; }
  .cube-front { transform: translateZ(100px); }
  .cube-back { transform: rotateY(180deg) translateZ(100px); }
  .cube-right { transform: rotateY(90deg) translateZ(100px); }
  .cube-left { transform: rotateY(-90deg) translateZ(100px); }
  .cube-top { transform: rotateX(90deg) translateZ(100px); }
  .cube-bottom { transform: rotateX(-90deg) translateZ(100px); }
  .orbit-chip-inner { left: 130px; padding: 0.35rem 0.65rem; font-size: 0.7rem; }
  .skills-cube-halo { width: 240px; height: 240px; }

  /* Certs */
  .cert-card { padding: 1.2rem; }
  .cert-title { font-size: 0.95rem; }
  .cert-issuer { font-size: 0.78rem; }
  .cert-date { font-size: 0.7rem; }
  .cert-emoji { font-size: 2.2rem; }

  /* Projects */
  .project-card { padding: 1.4rem; }
  .project-title { font-size: 1.15rem; }
  .project-cat { font-size: 0.78rem; }
  .project-section p { font-size: 0.85rem; }
  .project-tech { font-size: 0.65rem; padding: 0.2rem 0.55rem; }
  .project-impact-item { font-size: 0.78rem; }

  /* Contact */
  .contact-grid { gap: 2rem; }
  .contact-h3 { font-size: 1.25rem; }
  .contact-p { font-size: 1rem; }
  .contact-cards { gap: 0.75rem; }
  .contact-card { padding: 0.85rem; gap: 0.75rem; }
  .contact-card-icon { padding: 0.55rem; }
  .contact-card-icon svg { width: 18px; height: 18px; }
  .contact-card-value { font-size: 0.92rem; }
  .contact-form-wrap { padding: 1.4rem; }
  .form-field input, .form-field textarea, .form-field select {
    padding: 0.7rem 0.9rem; font-size: 16px; /* 16px prevents iOS zoom on focus */
  }
  .quick-actions-row { gap: 0.5rem; }

  /* Tap-target sizes (≥ 44px tap area) */
  .btn, .chip, .skill-filter, .nav-burger, .theme-toggle, .lang-toggle {
    min-height: 38px;
  }
  .btn-lg { min-height: 46px; }

  /* Modal & image viewer */
  .modal { padding: 0.5rem; }
  .modal-content { padding: 1.4rem; border-radius: 18px; max-height: 92vh; overflow-y: auto; }
  .modal-title { font-size: 1.4rem; }
  .modal-issuer { font-size: 1rem; }
  .modal-desc { font-size: 0.95rem; }
  .modal-actions { flex-direction: column; gap: 0.6rem; }
  .image-viewer { padding: 0.5rem; }
  .image-viewer-close { top: 0.75rem; right: 0.75rem; width: 40px; height: 40px; }
  .image-viewer-img { max-height: 70vh; }
  .image-viewer-caption { font-size: 0.9rem; }

  /* Toast */
  .toast-container { top: 0.75rem; right: 0.75rem; left: 0.75rem; }
  .toast { max-width: none; padding: 0.85rem 1rem; font-size: 0.85rem; }

  /* Globe / tunnel: lighter on mobile (perf + space) */
  .globe-stage, .neon-tunnel { opacity: 0.6; }
  .neon-ring { width: 240px; height: 240px; }
}

/* ---------- ≤ 480px (small phones) ---------- */
@media (max-width: 480px) {
  .section { padding: 3.5rem 0.85rem; }
  .container { padding: 0 0.5rem; }

  /* Nav: hide CV button text, keep icon-only */
  .nav-cv { padding: 0.5rem; }
  .nav-cv svg { display: inline; }
  .nav-cv span { display: none; }

  /* Hero title: smaller floor */
  .hero-title { font-size: clamp(2rem, 9vw, 3rem); }
  .hero-sub { font-size: 0.95rem; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 calc(50% - 0.3rem); justify-content: center; padding: 0.6rem 0.5rem; font-size: 0.8rem; }
  .hero-pill { font-size: 0.72rem; }

  /* Stats */
  .hero-stats { grid-template-columns: 1fr; }
  .about-stats { grid-template-columns: 1fr 1fr; }

  /* Chat bar: tighter */
  .chat-bar { padding: 1rem; border-radius: 18px; }
  .chip { font-size: 0.72rem; padding: 0.4rem 0.7rem; }

  /* Section divider tighter */
  .section-divider { width: 70px; height: 3px; }

  /* Skills cube even smaller */
  .skills-cube-stage { height: 18rem; }
  .skills-cube { width: 160px; height: 160px; }
  .cube-front { transform: translateZ(80px); }
  .cube-back { transform: rotateY(180deg) translateZ(80px); }
  .cube-right { transform: rotateY(90deg) translateZ(80px); }
  .cube-left { transform: rotateY(-90deg) translateZ(80px); }
  .cube-top { transform: rotateX(90deg) translateZ(80px); }
  .cube-bottom { transform: rotateX(-90deg) translateZ(80px); }
  .orbit-chip-inner { left: 105px; }

  /* Quick actions row → stack */
  .quick-actions-row { flex-direction: column; }

  /* Footer */
  .footer { margin-top: 2.5rem; padding-top: 1.5rem; }
  .footer p { font-size: 0.85rem; }
}

/* ---------- ≥ 1440px (large desktop): cap content width gracefully ---------- */
@media (min-width: 1440px) {
  .container { max-width: 1320px; }
  .section { padding: 9rem 1rem; }
}

/* ---------- Print ---------- */
@media print {
  .nav, .aurora, #particles, .mouse-glow, .chatbot-fab, .chatbot-window,
  .marquee-section, .neon-tunnel, .globe-stage, .skills-cube-stage,
  .hero-orb, .hero-grid, .lang-toggle, .theme-toggle, .toast-container,
  .image-viewer { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .section { padding: 1rem 0 !important; }
  .timeline-card, .skill-card, .cert-card, .project-card, .stat-card {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
}
