/* --- CSS Variables & Design Tokens --- */
:root {
  --bg-primary: #050812;
  --bg-secondary: rgba(14, 20, 31, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a8b2d1;
  --accent-cyan: #00f4ff;
  --accent-purple: #8a2be2;
  --accent-gradient: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);

  --font-arabic: 'Cairo', sans-serif;
  --font-english: 'Outfit', sans-serif;

  --transition-smooth: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- Reset & Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-arabic);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  width: 100%;
}

/* Typography Helpers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800;
  line-height: 1.3;
}

.glitch {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

/* --- Animated Background Blobs --- */
.blob {
  position: absolute;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.8;
  will-change: transform;
  animation: float 20s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
  pointer-events: none;
}

.blob-1 {
  width: 60vw;
  height: 60vw;
  max-width: 600px;
  max-height: 600px;
  min-width: 300px;
  min-height: 300px;
  background: radial-gradient(circle at center, rgba(138, 43, 226, 0.35) 0%, rgba(138, 43, 226, 0) 70%);
  top: -100px;
  right: -100px;
}

.blob-2 {
  width: 50vw;
  height: 50vw;
  max-width: 500px;
  max-height: 500px;
  min-width: 250px;
  min-height: 250px;
  background: radial-gradient(circle at center, rgba(0, 244, 255, 0.25) 0%, rgba(0, 244, 255, 0) 70%);
  bottom: 5%;
  left: -50px;
  animation-duration: 25s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-50px, 50px) scale(1.1);
  }

  100% {
    transform: translate(50px, -20px) scale(0.9);
  }
}

/* --- Glassmorphism Utils --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(0, 244, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 40px 0 rgba(0, 244, 255, 0.1);
}

/* --- Navigation --- */
.glass-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(5, 8, 18, 0.6);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: padding 0.3s ease;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
}

.logo {
  font-family: var(--font-english);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links li a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.3s;
  position: relative;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: var(--text-primary);
}

.nav-links li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gradient);
  transition: width 0.3s;
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 1001;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 5px;
  transition: 0.3s;
}

/* --- Main Structure --- */
main {
  padding-top: 100px;
}

section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section-header {
  margin-bottom: 4rem;
  text-align: right;
}

.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.divider {
  width: 80px;
  height: 4px;
  background: var(--accent-gradient);
  border-radius: 4px;
}

/* --- Hero Section --- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(100vh - 100px);
  gap: 4rem;
}

.hero-text {
  flex: 1.2;
}

.badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(138, 43, 226, 0.15);
  border: 1px solid rgba(138, 43, 226, 0.4);
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
}

.tagline {
  font-size: 1.4rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.dynamic-text-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  margin-bottom: 2.5rem;
  min-height: 40px;
}

.static-text {
  color: var(--text-secondary);
}

.dynamic-text {
  color: var(--accent-cyan);
  font-weight: 700;
  border-left: 2px solid var(--accent-cyan);
  padding-left: 5px;
  white-space: nowrap;
  overflow: hidden;
}

.hero-cta {
  display: flex;
  gap: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.8rem 2rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(0, 244, 255, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 244, 255, 0.05);
  transform: translateY(-2px);
}

.hero-image {
  flex: 0.8;
  position: relative;
  border-radius: 30px;
  padding: 10px;
  aspect-ratio: 4/5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-image::before {
  content: '';
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: -5px;
  right: -5px;
  background: var(--accent-gradient);
  z-index: -1;
  border-radius: 35px;
  opacity: 0.5;
  filter: blur(20px);
  animation: pulse-glow 4s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  0% {
    opacity: 0.3;
    filter: blur(15px);
  }

  100% {
    opacity: 0.8;
    filter: blur(25px);
  }
}

.image-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hero-image:hover img {
  transform: scale(1.05);
}

/* --- Facts / Bento Grid --- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.bento-item {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bento-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(0, 244, 255, 0.3));
}

.bento-item h3 {
  font-size: 1.4rem;
  color: var(--text-primary);
}

.bento-item p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* --- Skills Section --- */
.skills-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.skill-category {
  padding: 2.5rem;
  transition: transform 0.3s ease;
}

.skill-category:hover {
  transform: translateY(-10px);
}

.skill-icon {
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(0, 244, 255, 0.3));
}

.skill-category h3 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.skill-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s;
  font-family: var(--font-english);
  cursor: default;
}

.skill-tag:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.skill-tag.arabic-tag {
  font-family: var(--font-arabic);
}

.star {
  color: #ffd700;
  margin-right: 5px;
}

/* --- Projects Section --- */
.highlight-project {
  display: flex;
  align-items: center;
  gap: 3rem;
  padding: 3rem;
  margin-bottom: 3rem;
  border-color: rgba(138, 43, 226, 0.4);
}

.project-info {
  flex: 1.2;
}

.project-badge {
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.3);
}

.project-info h3 {
  font-size: 2.2rem;
  margin: 1rem 0;
  font-family: var(--font-english);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.project-info p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.project-img-wrapper {
  flex: 0.8;
  height: 250px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
}

.project-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-img-fallback {
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.2);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.sm-project-img {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  object-fit: contain;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 8px;
}

.project-card {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 200px;
}

.project-card h4 {
  font-size: 1.5rem;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
  font-family: var(--font-arabic);
}

.project-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  flex-grow: 1;
}

.construction {
  color: #ff9800 !important;
  font-style: italic;
}

/* --- Contact Section --- */
.contact-card {
  padding: 4rem;
  text-align: center;
}

.contact-card p {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.social-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  transition: all 0.3s;
}

.social-btn svg {
  width: 24px;
  height: 24px;
}

.social-btn:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.social-btn.telegram:hover {
  border-color: #0088cc;
  color: #0088cc;
}

.social-btn.facebook:hover {
  border-color: #1877f2;
  color: #1877f2;
}

.social-btn.link:hover {
  border-color: #00f4ff;
  color: #00f4ff;
}

.social-btn.sarahah:hover {
  border-color: #f7a042;
  color: #f7a042;
}

/* --- Footer --- */
footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  margin-top: 2rem;
}

footer p {
  color: var(--text-secondary);
}

/* --- Animations & Utilities --- */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 {
  transition-delay: 0.1s;
}

.delay-2 {
  transition-delay: 0.2s;
}

.delay-3 {
  transition-delay: 0.3s;
}

.delay-4 {
  transition-delay: 0.4s;
}

/* 3D Tilt Card Base (JS Driven) */
.tilt-card {
  transform-style: preserve-3d;
  transform: perspective(1000px);
}

.tilt-card>* {
  transform: translateZ(20px);
}

/* --- Responsive Design (Mobile First Focus) --- */
@media (max-width: 992px) {
  .hero {
    flex-direction: column-reverse;
    /* Text bottom, Image top on Arabic it feels better, but let's just make it column */
    text-align: center;
    padding-top: 2rem;
    gap: 3rem;
  }

  .hero-text {
    align-items: center;
    display: flex;
    flex-direction: column;
  }

  .dynamic-text-container {
    justify-content: center;
  }

  .hero-cta {
    justify-content: center;
  }

  .highlight-project {
    flex-direction: column-reverse;
    text-align: center;
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 250px;
    height: 100vh;
    background: rgba(5, 8, 18, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 100px 2rem;
    transition: right 0.4s ease;
    border-left: 1px solid var(--glass-border);
  }

  .nav-links.nav-active {
    right: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .menu-toggle.toggle-active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
  }

  .menu-toggle.toggle-active span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.toggle-active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  .glitch {
    font-size: 2.8rem;
  }

  section {
    padding: 4rem 1rem;
  }

  .hero-image {
    width: 80%;
    max-width: 300px;
  }

  .contact-card {
    padding: 2rem 1rem;
  }

  .social-btn {
    width: 100%;
    justify-content: center;
  }
}