* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --accent: #10b981;
  --dark: #0f172a;
  --dark-light: #1e293b;
  --gray: #64748b;
  --light: #f8fafc;
  --white: #ffffff;
}

[data-theme='light'] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-dark: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --header-bg: rgba(255, 255, 255, 0.95);
  --card-bg: #ffffff;
  --particle-color: rgba(99, 102, 241, 0.15);
}

[data-theme='dark'] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-dark: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --header-bg: rgba(15, 23, 42, 0.95);
  --card-bg: #1e293b;
  --particle-color: rgba(99, 102, 241, 0.3);
}

[dir='rtl'] {
  direction: rtl;
}

[dir='rtl'] .hero-content {
  direction: rtl;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
    sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  background: var(--bg-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

/* Animated Background */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.geometric-shape {
  position: absolute;
  animation: drift 30s infinite ease-in-out;
  transition: border 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

/* Light theme - line art only */
[data-theme='light'] .geometric-shape {
  border: 2px solid rgba(99, 102, 241, 0.3);
  background: transparent;
}

/* Dark theme - filled with glow */
[data-theme='dark'] .geometric-shape {
  border: 1px solid rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3),
    inset 0 0 20px rgba(99, 102, 241, 0.1);
}

/* Triangle */
.geometric-shape:nth-child(1) {
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid;
  border-bottom-color: rgba(99, 102, 241, 0.3);
  top: 15%;
  left: 10%;
  background: transparent !important;
  animation-delay: 0s;
}

[data-theme='dark'] .geometric-shape:nth-child(1) {
  border-bottom-color: rgba(99, 102, 241, 0.4);
  filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.4));
}

/* Circle */
.geometric-shape:nth-child(2) {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  top: 50%;
  right: 15%;
  animation-delay: -10s;
}

/* Square */
.geometric-shape:nth-child(3) {
  width: 60px;
  height: 60px;
  bottom: 25%;
  left: 20%;
  animation-delay: -5s;
}

/* Pentagon */
.geometric-shape:nth-child(4) {
  width: 70px;
  height: 70px;
  top: 70%;
  right: 30%;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  animation-delay: -15s;
}

/* Diamond */
.geometric-shape:nth-child(5) {
  width: 55px;
  height: 55px;
  top: 30%;
  right: 45%;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation-delay: -20s;
}

/* Hexagon */
.geometric-shape:nth-child(6) {
  width: 65px;
  height: 65px;
  bottom: 40%;
  left: 60%;
  clip-path: polygon(
    30% 0%,
    70% 0%,
    100% 30%,
    100% 70%,
    70% 100%,
    30% 100%,
    0% 70%,
    0% 30%
  );
  animation-delay: -8s;
}

/* Small Triangle */
.geometric-shape:nth-child(7) {
  width: 0;
  height: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 50px solid;
  border-bottom-color: rgba(236, 72, 153, 0.3);
  top: 10%;
  right: 10%;
  background: transparent !important;
  animation-delay: -12s;
}

[data-theme='dark'] .geometric-shape:nth-child(7) {
  border-bottom-color: rgba(236, 72, 153, 0.4);
  filter: drop-shadow(0 0 15px rgba(236, 72, 153, 0.4));
}

/* Small Circle */
.geometric-shape:nth-child(8) {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  bottom: 15%;
  right: 25%;
  animation-delay: -18s;
}

[data-theme='light'] .geometric-shape:nth-child(2),
[data-theme='light'] .geometric-shape:nth-child(8) {
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme='dark'] .geometric-shape:nth-child(2),
[data-theme='dark'] .geometric-shape:nth-child(8) {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.4;
  }
  25% {
    transform: translate(50px, -40px) rotate(90deg);
    opacity: 0.7;
  }
  50% {
    transform: translate(-30px, -80px) rotate(180deg);
    opacity: 0.5;
  }
  75% {
    transform: translate(-60px, 30px) rotate(270deg);
    opacity: 0.6;
  }
}

/* Theme and Language Controls */
.controls {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

.control-btn {
  width: 48px;
  height: 48px;
  background: var(--card-bg);
  border: 1px solid var(--particle-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.2rem;
}

.control-btn:hover {
  background: var(--primary);
  transform: scale(1.1);
  border-color: var(--primary);
}

/* Header */
header {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 1rem 0;
  transition: background 0.3s ease;
}

nav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s ease;
}

.logo span {
  color: var(--primary);
}

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

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--primary);
}

.cta-btn {
  background: var(--primary);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
}

.cta-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

/* Hero */
.hero {
  min-height: 100vh;
  background: var(--bg-dark);
  padding: 8rem 1.5rem 4rem;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease;
}

.hero::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: var(--primary);
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.15;
  top: -100px;
  right: -100px;
  animation: float 20s infinite ease-in-out;
}

.hero::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: var(--secondary);
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.1;
  bottom: -100px;
  left: -100px;
  animation: float 25s infinite ease-in-out reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(50px, 50px);
  }
}

.hero-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 3rem;
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
  transition: color 0.3s ease;
}

.hero-text .highlight {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text p {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  transition: color 0.3s ease;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
}

.hero-visual {
  width: 100%;
  height: 400px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
}

.scene-3d {
  width: 300px;
  height: 300px;
  position: relative;
  transform-style: preserve-3d;
  animation: rotate3d 20s infinite linear;
}

@keyframes rotate3d {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(360deg) rotateY(360deg);
  }
}

.cube {
  width: 200px;
  height: 200px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -100px 0 0 -100px;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.cube-face {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.8;
}

.cube-face-front {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.6),
    rgba(236, 72, 153, 0.6)
  );
  transform: translateZ(100px);
}

.cube-face-back {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.6),
    rgba(16, 185, 129, 0.6)
  );
  transform: translateZ(-100px) rotateY(180deg);
}

.cube-face-right {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.6),
    rgba(99, 102, 241, 0.6)
  );
  transform: rotateY(90deg) translateZ(100px);
}

.cube-face-left {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.6),
    rgba(99, 102, 241, 0.6)
  );
  transform: rotateY(-90deg) translateZ(100px);
}

.cube-face-top {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.6),
    rgba(16, 185, 129, 0.6)
  );
  transform: rotateX(90deg) translateZ(100px);
}

.cube-face-bottom {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.6),
    rgba(236, 72, 153, 0.6)
  );
  transform: rotateX(-90deg) translateZ(100px);
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.orbit-shape {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  animation: orbit 15s infinite ease-in-out;
}

.orbit-shape:nth-child(1) {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.orbit-shape:nth-child(2) {
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  top: 70%;
  right: 15%;
  animation-delay: -5s;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.orbit-shape:nth-child(3) {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  bottom: 20%;
  left: 20%;
  animation-delay: -10s;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

@keyframes orbit {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(30px, -30px) rotate(90deg);
  }
  50% {
    transform: translate(0, -50px) rotate(180deg);
  }
  75% {
    transform: translate(-30px, -30px) rotate(270deg);
  }
}

.scene-3d.interacting {
  animation: none !important;
}

/* Section Styles */
section {
  padding: 5rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

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

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  transition: color 0.3s ease;
}

/* About */
.about {
  background: var(--bg-secondary);
  transition: background 0.3s ease;
}

.about-grid {
  display: grid;
  gap: 3rem;
}

.about-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  transition: color 0.3s ease;
}

.about-text p {
  margin-bottom: 1.5rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.skill-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.skill-card h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s ease;
}

.skill-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.2rem;
}

/* Work Grid */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.work-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s ease;
  cursor: pointer;
}

.work-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.work-image {
  width: 100%;
  height: 250px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  position: relative;
  overflow: hidden;
  border-bottom: 0;
}

/* Fix: make images behave correctly */
.work-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s;
}

.work-card:hover .work-image::before {
  opacity: 0;
}

.work-content {
  padding: 1.5rem;
}

.work-content h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
  transition: color 0.3s ease;
}

.work-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.work-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--bg-secondary);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.3s ease;
}

/* Assets Section */
.assets {
  background: var(--bg-dark);
  transition: background 0.3s ease;
}

.assets .section-header h2,
.assets .section-header p {
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.course-links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Email Capture */
.email-capture {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  text-align: center;
  border-radius: 24px;
  padding: 4rem 2rem;
}

.email-capture h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 1rem;
}

.email-capture p {
  margin-bottom: 2rem;
  opacity: 0.9;
}

.email-form {
  display: flex;
  gap: 1rem;
  max-width: 500px;
  margin: 0 auto;
  flex-direction: column;
}

.email-form input {
  flex: 1;
  padding: 1rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
}

.email-form button {
  background: var(--dark);
  color: var(--white);
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s;
}

.email-form button:hover {
  transform: scale(1.05);
}

/* Footer */
footer {
  background: var(--bg-dark);
  color: var(--text-primary);
  padding: 3rem 1.5rem 2rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  text-align: center;
}

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

.social-link {
  width: 48px;
  height: 48px;
  background: var(--card-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s;
}

.social-link:hover {
  background: var(--primary);
  transform: translateY(-3px);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--particle-color);
  color: var(--text-secondary);
  transition: color 0.3s ease, border-color 0.3s ease;
}

/* Responsive */
@media (max-width: 640px) {
  .course-links {
    flex-direction: column;
    text-align: center;
  }

  .course-links a {
    width: 100%;
    margin-left: 0 !important; /* remove your inline margin */
  }
}

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

  .hero-content {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  flex-wrap: wrap;
  gap: 1rem;

  .about-grid {
    grid-template-columns: 1fr;
  }

  .email-form {
    flex-direction: row;
  }

  .footer-content {
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
  }

  .social-links {
    justify-content: flex-start;
  }
}

@media (min-width: 1024px) {
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeIn 0.8s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.work-card:nth-child(1) {
  animation-delay: 0.1s;
}
.work-card:nth-child(2) {
  animation-delay: 0.2s;
}
.work-card:nth-child(3) {
  animation-delay: 0.3s;
}
