/* Performance-Optimized CSS with Hardware Acceleration */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
  --main: #007f73;
  --bg: #fff;
  --text: #111;
  --card: #fff;
  --section: #f0fdfa;
  --shadow: rgba(0, 127, 115, 0.15);
  --transition-speed: 0.3s;
}

body.dark {
  --bg: #0f172a;
  --text: #f8fafc;
  --card: #1e293b;
  --section: #020617;
  --shadow: rgba(255, 255, 255, 0.1);
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background 0.5s ease, color 0.5s ease;
  scroll-behavior: smooth;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header - Hardware Accelerated */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 15px 8%;
  background: var(--main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.logo {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#menu {
  display: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition: transform var(--transition-speed) ease;
}

#menu:hover {
  transform: scale(1.1);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 5px;
}

.navbar a,
.navbar i {
  color: #fff;
  margin-left: 20px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition-speed) ease;
  will-change: transform;
  position: relative;
  padding: 8px 12px;
}

.navbar a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #fff;
  transition: width var(--transition-speed) ease, left var(--transition-speed) ease;
}

.navbar a:hover::after {
  width: 100%;
  left: 0;
}

.navbar a:hover,
.navbar i:hover {
  transform: translateY(-3px);
}

/* Mobile Nav - Optimized */
@media (max-width: 768px) {
  #menu {
    display: block;
  }
  
  .navbar {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--main);
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-20px);
    transition: max-height 0.5s ease, opacity 0.5s ease, transform 0.5s ease;
  }
  
  .navbar.active {
    max-height: 400px;
    opacity: 1;
    transform: translateY(0);
  }
  
  .navbar a,
  .navbar i {
    margin: 15px 0;
    width: 100%;
    text-align: center;
  }
}

/* Sections */
section {
  padding: 100px 8%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-title {
  text-align: center;
  font-size: clamp(28px, 5vw, 42px);
  margin-bottom: 40px;
  font-weight: 700;
}

.section-title span {
  color: var(--main);
}

/* Home Section - Hardware Accelerated Animations */
.home {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 50px;
  min-height: 100vh;
  padding-top: 80px;
}

.home-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 50px;
  width: 100%;
}

.home-text {
  flex: 1;
  min-width: 300px;
}

.home-text h3 {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 500;
  margin-bottom: 10px;
}

.home-text h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--main), #004d45);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-text h2 {
  font-size: clamp(20px, 3.5vw, 28px);
  font-weight: 600;
  color: var(--main);
  margin-bottom: 15px;
}

.home-text p {
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.8;
  margin-bottom: 25px;
  opacity: 0.85;
}

.home-text h1,
.home-text h2,
.home-text h3,
.home-text p {
  opacity: 0;
  transform: translateY(50px);
  animation: fadeInUp 1s forwards;
  will-change: opacity, transform;
}

.home-text h1 { animation-delay: 0.2s; }
.home-text h2 { animation-delay: 0.4s; }
.home-text h3 { animation-delay: 0.6s; }
.home-text p { animation-delay: 0.8s; }

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

/* CTA Buttons */
.home-cta {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 30px;
  opacity: 0;
  transform: translateY(50px);
  animation: fadeInUp 1s forwards 1s;
}

.btn-primary,
.btn-secondary {
  padding: 14px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: all var(--transition-speed) ease;
  display: inline-block;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--main);
  color: white;
  box-shadow: 0 4px 15px var(--shadow);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow);
}

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

.btn-secondary:hover {
  background: var(--main);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow);
}

/* Home Image */
.home-img {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 300px;
}

.home-img img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 40px var(--shadow);
  animation: scaleIn 1s forwards, float 3s ease-in-out infinite 1s;
  will-change: transform;
  transform: translateZ(0);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.float {
  animation: float 3s ease-in-out infinite;
}

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

/* About Section */
.about {
  display: flex;
  gap: 60px;
  align-items: center;
  flex-wrap: wrap;
}

.about-img {
  flex: 1;
  min-width: 280px;
  display: flex;
  justify-content: center;
}

.about-img img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 20px;
  box-shadow: 0 10px 40px var(--shadow);
  transition: transform var(--transition-speed) ease;
}

.about-img img:hover {
  transform: scale(1.05) rotate(2deg);
}

.about-text {
  flex: 1;
  min-width: 300px;
}

.about-text h3 {
  font-size: clamp(18px, 3vw, 22px);
  margin-bottom: 15px;
  color: var(--main);
  font-weight: 600;
}

.about-text p {
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.8;
  margin-bottom: 15px;
  opacity: 0.9;
}

/* Skills Section */
.skills {
  background: var(--section);
}

.skills-intro {
  text-align: center;
  font-size: clamp(16px, 2.5vw, 20px);
  margin-bottom: 40px;
  opacity: 0.8;
  font-style: italic;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  justify-items: center;
}

.skill-card {
  background: var(--card);
  padding: 30px 25px;
  border-radius: 20px;
  text-align: center;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 5px 20px var(--shadow);
  width: 100%;
  max-width: 300px;
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: var(--main);
  transition: left 0.5s ease;
}

.skill-card:hover::before {
  left: 0;
}

.skill-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px var(--shadow);
}

.skill-card h3 {
  margin-bottom: 20px;
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--main);
  font-weight: 700;
}

.skill-card p {
  font-size: 14px;
  opacity: 0.7;
  margin-top: 15px;
}

.skill-logos {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin: 15px 0;
}

.skill-logos img {
  width: 60px;
  height: 60px;
  transition: transform var(--transition-speed) ease;
  filter: grayscale(0);
}

.skill-logos img:hover {
  transform: scale(1.25) rotate(5deg);
}

/* Projects Section */
.projects-intro {
  text-align: center;
  font-size: clamp(16px, 2.5vw, 20px);
  margin-bottom: 40px;
  opacity: 0.8;
  font-style: italic;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 35px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--shadow);
  transition: all var(--transition-speed) ease;
  aspect-ratio: 16/10;
}

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

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px var(--shadow);
}

.card:hover img {
  transform: scale(1.15);
}

.layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 127, 115, 0.9));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity 0.4s ease;
  padding: 20px;
  text-align: center;
}

.card:hover .layer {
  opacity: 1;
}

.layer h3 {
  font-size: clamp(18px, 3vw, 24px);
  margin-bottom: 10px;
  font-weight: 700;
}

.layer p {
  font-size: clamp(14px, 2vw, 16px);
  opacity: 0.95;
}

/* Contact Section */
.contact {
  background: var(--section);
}

.contact-intro {
  text-align: center;
  font-size: clamp(16px, 2.5vw, 20px);
  margin-bottom: 40px;
  opacity: 0.8;
  font-style: italic;
}

.contact form {
  max-width: 550px;
  margin: 0 auto 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

input,
textarea {
  padding: 15px 20px;
  border-radius: 10px;
  border: 2px solid var(--main);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  transition: all var(--transition-speed) ease;
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--main);
  box-shadow: 0 0 0 3px var(--shadow);
  transform: translateY(-2px);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

button {
  padding: 15px 20px;
  border-radius: 10px;
  background: var(--main);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 15px var(--shadow);
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--shadow);
}

button:active {
  transform: translateY(-1px);
}

.contact-info {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  padding: 30px;
  background: var(--card);
  border-radius: 15px;
  box-shadow: 0 5px 20px var(--shadow);
}

.contact-info h3 {
  margin-bottom: 20px;
  color: var(--main);
  font-size: clamp(20px, 3vw, 26px);
}

.contact-info p {
  margin: 12px 0;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.6;
}

/* Scroll Animation - Performance Optimized */
.scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.scroll.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.footer {
  background: linear-gradient(135deg, var(--main), #004d45);
  color: #fff;
  text-align: center;
  padding: 60px 8% 30px;
}

.footer-content h3 {
  font-size: clamp(24px, 4vw, 32px);
  margin-bottom: 15px;
}

.footer-content p {
  font-size: clamp(14px, 2vw, 17px);
  opacity: 0.95;
  line-height: 1.6;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.footer-social a {
  width: 45px;
  height: 45px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  transition: all var(--transition-speed) ease;
  text-decoration: none;
}

.footer-social a:hover {
  background: #fff;
  color: var(--main);
  transform: translateY(-5px) rotate(360deg);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.footer-keywords {
  margin: 20px 0;
  opacity: 0.7;
  font-size: 13px;
}

.footer-copy {
  display: block;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  opacity: 0.8;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  section {
    padding: 80px 5%;
  }

  .home,
  .about,
  .home-content {
    flex-direction: column;
    text-align: center;
  }

  .home-img img {
    max-width: 280px;
  }

  .about-img img {
    max-width: 320px;
  }

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

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 300px;
  }

  .skill-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 25px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 12px 5%;
  }

  section {
    padding: 70px 4%;
  }
}

/* Performance: Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print Styles */
@media print {
  .header,
  .footer,
  .navbar,
  #menu,
  #darkToggle {
    display: none;
  }

  section {
    page-break-inside: avoid;
  }
}