:root {
  --primary: #38bdf8;
  --dark: #0f172a;
  --light: #f8fafc;
  --gray: #94a3b8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--dark);
  color: var(--light);
}

section {
  min-height: 100vh;
  padding: 80px 10%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h1 span {
  color: var(--primary);
}

p {
  color: var(--gray);
  max-width: 700px;
  line-height: 1.7;
}

/* ===========================
   HEADER
=========================== */
.menu-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--light);
  transition: 0.3s;
}

.header {
  position: fixed;
  top: 0;
  width: 100%;
  height: 70px;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10%;
  z-index: 1000;
}

.logo {
  color: var(--primary);
  font-weight: 700;
}

.header nav a {
  margin-left: 25px;
  color: var(--light);
  text-decoration: none;
  font-weight: 500;
  position: relative;
}

.header nav a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  background: var(--primary);
  bottom: -5px;
  left: 0;
  transition: 0.3s;
}

.header nav a:hover::after {
  width: 100%;
}

.header nav a.active {
  color: var(--primary);
}

/* ===========================
   THEME TOGGLE
=========================== */
.theme-toggle {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--light);
  margin-left: 20px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

/* ===========================
   TEMA CLARO
=========================== */
body.light {
  background: #f1f5f9;
  color: #0f172a;
  --dark: #f8fafc;
  --light: #0f172a;
  --gray: #475569;
}

body.light p {
  color: #000000;
}

body.light .header {
  background: rgba(241, 245, 249, 0.9);
}

body.light .header nav a {
  color: #0f172a;
}

body.light .header nav a.active {
  color: #0284c7;
}

body.light .project-card {
  background: #ffffff;
}

body.light .projects {
  background: #e2e8f0;
}

/* ===========================
   HERO
=========================== */
.hero {
  background: linear-gradient(rgba(15, 23, 42, .7), rgba(15, 23, 42, .9)), url('bg.jpg') center/cover fixed;
  align-items: center;
  text-align: center;
}

.hero img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  margin-bottom: 20px;
}

.hero h2 {
  color: var(--primary);
  font-weight: 400;
}

/* ===========================
   SCROLL ANIMATION
=========================== */
.reveal {
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.8s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   PROJECT CARD ANIMATION
=========================== */
.project-card {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}

.project-card.active {
  opacity: 1;
  transform: scale(1);
}

/* ===========================
   PROJECTS
=========================== */
.projects {
  background: #020617;
}

/* ===========================
   TECH STACK
=========================== */
.tech-stack {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-bottom: 60px;
}

.tech-card {
  position: relative;
  background: linear-gradient(145deg, #020617, #020617);
  border-radius: 20px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.tech-card img {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
}

.tech-card span {
  font-weight: 600;
  color: var(--light);
  letter-spacing: 1px;
}

.tech-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 25px 60px rgba(56, 189, 248, 0.3);
}

/* Tooltip das tech cards */
.tech-card::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 220px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.08);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.tech-card::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  border: 6px solid transparent;
  border-top-color: rgba(56, 189, 248, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.tech-card:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tech-card:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tech-card.react img {
  filter: drop-shadow(0 0 8px rgba(97, 218, 251, 0.7));
  transition: filter 0.4s ease, transform 0.4s ease;
}

.tech-card.react:hover img {
  filter: drop-shadow(0 0 16px rgba(97, 218, 251, 1));
  transform: scale(1.05);
}

/* ===========================
   CAROUSEL
=========================== */
.carousel {
  overflow: hidden;
  width: 100%;
  position: relative;
}

.carousel-track {
  display: flex;
  gap: 30px;
  animation: scroll 25s linear infinite;
}

.carousel:hover .carousel-track {
  animation-play-state: paused;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ===========================
   PROJECT CARD
=========================== */
.project-card {
  min-width: 320px;
  background: #020617;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.project-card:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 20px 50px rgba(56, 189, 248, 0.3);
}

.project-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.project-info {
  padding: 16px;
}

.project-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* ===========================
   SKELETON
=========================== */
.image-skeleton {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: 16px;
  background: #020617;
}

.image-skeleton::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #020617 25%,
    #0f172a 37%,
    #020617 63%
  );
  animation: skeleton 1.4s infinite;
}

@keyframes skeleton {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.lazy-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
  position: relative;
  z-index: 2;
}

.lazy-img.loaded {
  opacity: 1;
}

.image-skeleton.loaded::before {
  display: none;
}

/* ===========================
   CONTACT
=========================== */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
}

.contact-text p {
  margin-top: 15px;
}

.contact-icons {
  display: flex;
  justify-content: flex-end;
  gap: 30px;
}

.contact-icon {
  position: relative;
  width: 90px;
  height: 90px;
  background: #020617;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.contact-icon img {
  width: 45px;
}

.contact-icon:hover {
  transform: translateY(-12px) scale(1.05);
}

.contact-icon.github:hover {
  box-shadow: 0 25px 60px rgba(255, 255, 255, 0.35);
}

.contact-icon.linkedin:hover {
  box-shadow: 0 25px 60px rgba(10, 102, 194, 0.45);
}

.contact-icon.email:hover {
  box-shadow: 0 25px 60px rgba(56, 189, 248, 0.45);
}

/* Tooltip */
.contact-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: #020617;
  color: var(--light);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.contact-icon:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Micro animações */
.reveal-delay {
  transition-delay: 0.2s;
}

.reveal-delay-2 {
  transition-delay: 0.4s;
}

/* ===========================
   MAP
=========================== */
iframe {
  margin-top: 30px;
  width: 100%;
  height: 350px;
  border: none;
  border-radius: 16px;
}

/* ===========================
   RESPONSIVO
=========================== */
@media (max-width: 900px) {
  .tech-stack {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  #nav-menu {
    position: absolute;
    top: 70px;
    right: 0;
    background: #020617;
    width: 100%;
    flex-direction: column;
    display: none;
    padding: 20px 0;
  }

  #nav-menu.active {
    display: flex;
  }

  #nav-menu a {
    margin: 15px 0;
  }

  section {
    padding: 60px 5%;
  }

  .contact-wrapper {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .contact-icons {
    justify-content: center;
    margin-top: 30px;
  }

  .carousel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .carousel-track {
    animation: none;
    width: max-content;
    padding-bottom: 20px;
  }

  .project-card {
    scroll-snap-align: center;
  }

  .project-card:active {
    transform: scale(0.97);
  }
}

@media (max-width: 500px) {
  .tech-stack {
    grid-template-columns: 1fr;
  }
}