:root {
  --bg-color: #0b0e14;
  --card-bg: rgba(22, 27, 34, 0.7);
  --primary: #58a6ff;
  --accent: #1f6feb;
  --text: #e6edf3;
  --muted: #8b949e;
  --glass-border: rgba(255, 255, 255, 0.1);
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
  /* Evita que textos muito longos quebrem o limite da tela */
}

html,
body {
  overflow-x: hidden;
  /* Trava mestre para impedir rolagem horizontal */
  width: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Background Mesh Effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 10% 20%, rgba(88, 166, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(31, 111, 235, 0.05) 0%, transparent 40%);
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 1.5rem;
  /* Ajustado padding geral */
}

/* Header */
header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  padding: 1.25rem 0;
  transition: var(--transition);
}

header .container {
  padding: 0 1.5rem;
}

header.scrolled {
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--glass-border);
}

.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -1px;
}

nav ul {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  padding: 0.5rem 0;
}

/* Efeito de sublinhado animado no hover (Desktop) */
nav a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary);
  transition: width 0.3s ease;
  border-radius: 2px;
}

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

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

.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 4rem;
  color: #fff;
}

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

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 1.5rem 100px;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, #fff, #58a6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 1000px;
  line-height: 1.2;
}

.hero p {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 700px;
  margin-bottom: 3rem;
}

.cta-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 1.1rem 2.5rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 0 25px rgba(88, 166, 255, 0.4);
  transform: translateY(-4px);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(88, 166, 255, 0.05);
}

/* --- SOBRE MIM --- */
.about-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4rem;
  align-items: center;
  justify-content: space-between;
}

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

.about-text h2 {
  text-align: left;
  margin-bottom: 2rem;
}

.about-text p {
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.8;
}

.about-img-container {
  flex: 0.5;
  display: flex;
  justify-content: center;
  min-width: 300px;
}

.about-img-inner {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1/1;
  /* Mantém quadrado responsivamente */
}

.about-blob {
  position: absolute;
  inset: -15px;
  border: 2px solid var(--primary);
  animation: blob 10s infinite alternate;
}

.about-img {
  width: 100%;
  height: 100%;
  background: #21262d;
  border-radius: 24px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

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

/* --- SERVIÇOS --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  padding: 3.5rem 2rem;
  border-radius: 24px;
  text-align: center;
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-12px);
  border-color: var(--primary);
  background: rgba(33, 38, 45, 0.9);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.service-card i {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  display: block;
}

.service-card h3 {
  margin-bottom: 1rem;
}

.service-card p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- JORNADA INTERCALADA --- */
.timeline-box {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.timeline-box::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  height: 100%;
  background: var(--glass-border);
  transform: translateX(-50%);
}

.timeline-item {
  margin-bottom: 4rem;
  position: relative;
  width: 50%;
  padding: 0 3rem;
}

.timeline-item.left {
  left: 0;
  text-align: right;
}

.timeline-item.right {
  left: 50%;
  text-align: left;
}

.timeline-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  top: 15px;
  box-shadow: 0 0 15px var(--primary);
  z-index: 2;
}

.left .timeline-dot {
  right: -10px;
}

.right .timeline-dot {
  left: -10px;
}

.timeline-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.timeline-content:hover {
  border-color: var(--primary);
  transform: scale(1.03);
}

.timeline-content h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.timeline-content span {
  font-weight: 800;
  color: var(--muted);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 1rem;
}

.timeline-content p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- PROJETOS --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2.5rem;
}

.project-card {
  grid-column: span 4;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem;
  transition: var(--transition);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.project-card.featured {
  grid-column: span 8;
  border-color: rgba(88, 166, 255, 0.3);
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.1), rgba(22, 27, 34, 0.7));
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.project-media {
  width: 100%;
  height: 220px;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  background: #161b22;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.featured .project-media {
  height: 320px;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(88, 166, 255, 0.2);
  font-weight: 600;
}

.project-info h3 {
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
  transition: var(--transition);
}

.project-card:hover h3 {
  color: var(--primary);
}

.project-info p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- SKILLS --- */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
}

.skill-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  padding: 1.2rem 2rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.skill-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px);
  background: rgba(88, 166, 255, 0.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.skill-card i {
  font-size: 1.5rem;
  color: var(--primary);
}

.skill-card span {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}

/* --- CLIENTES --- */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 3rem;
  justify-items: center;
  align-items: center;
}

.client-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  transition: var(--transition);
}

.client-logo-wrapper {
  width: 120px;
  height: 120px;
  background: rgb(226, 226, 226);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.client-card:hover .client-logo-wrapper {
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(88, 166, 255, 0.25);
}

.client-logo-wrapper img {
  width: 100%;
  border-radius: 50%;
}

.client-card span {
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  transition: var(--transition);
}

.client-card:hover span {
  color: #fff;
}

/* FAQ */
.faq-item {
  max-width: 850px;
  margin: 1.5rem auto;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  overflow: visible; /* ← aqui */
  transition: border-color 0.3s ease;
}

.faq-item.active {
  border-color: var(--primary);
}

.faq-btn {
  width: 100%;
  padding: 1.5rem 2rem;
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.faq-ans {
  max-height: 0;
  overflow: hidden; /* ← o hidden fica aqui */
  padding: 0 2rem;
  color: var(--muted);
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.active .faq-ans {
  max-height: 500px;
  padding: 0 2rem 1.5rem;
}

/* --- FOOTER --- */
.footer-site {
  width: 100%;
  text-align: center;
  padding-bottom: 4rem;
}

.footer-logo-main {
  margin-bottom: 2.5rem;
  display: flex;
  justify-content: center;
}

.footer-logo-main img {
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 0 15px rgba(88, 166, 255, 0.2));
  animation: floatLogo 6s ease-in-out infinite;
}

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

.footer-nav-main {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}

.footer-nav-main a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.6;
  transition: var(--transition);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.footer-nav-main a:hover {
  opacity: 1;
  color: var(--primary);
  transform: translateY(-2px);
}

.footer-social-main {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.footer-social-main a {
  width: 55px;
  height: 55px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.4rem;
  transition: var(--transition);
}

.footer-social-main a:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 10px 25px rgba(88, 166, 255, 0.2);
}

.footer-tagline {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.4;
  letter-spacing: 3px;
}

/* Mobile Menu Button */
#btn-mobile {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
  z-index: 1001; /* Garante que fica acima do menu dropdown */
}

#btn-mobile.active {
  color: var(--primary);
  transform: rotate(90deg);
}

/* =========================================
   MEDIA QUERIES - TABLETS & MOBILE MENU
   ========================================= */
@media (max-width: 992px) {
  .container {
    padding: 80px 1.5rem;
  }

  /* --- MENU MOBILE CONFIGURAÇÃO --- */
  #btn-mobile {
    display: block;
    margin-left: auto;
  }

  nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(11, 14, 20, 0.98);
    backdrop-filter: blur(15px);
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: column;
    text-align: center;
    
    /* Configuração para transição suave */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  nav ul.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  nav a {
    font-size: 1.15rem;
    display: block;
    width: 100%;
    padding: 12px 0;
  }

  /* Remove o sublinhado animado no telemóvel para ficar mais limpo */
  nav a::after {
    display: none;
  }
  /* ---------------------------------------------------------------- */

  /* Correção da Grade de Projetos para 1 coluna nos Mobile/Tablet */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-card,
  .project-card.featured {
    grid-column: span 1;
  }

  .featured .project-media {
    height: 250px;
  }

  /* Correção da Timeline para Tablet/Mobile */
  .timeline-box::before {
    left: 0;
  }

  .timeline-item {
    width: 100%;
    left: 0 !important;
    text-align: left !important;
    padding: 0 0 0 3rem;
    margin-bottom: 3rem;
  }

  .timeline-dot {
    left: -10px !important;
    right: auto !important;
  }

  .about-wrapper {
    gap: 3rem;
  }
}

/* =========================================
   MEDIA QUERIES - SMARTPHONES 
   ========================================= */
@media (max-width: 768px) {
  .container {
    padding: 60px 1.25rem;
  }

  .section-title {
    font-size: 2rem;
    margin-bottom: 2.5rem;
  }

  /* Hero Mobile */
  .hero {
    padding: 120px 1.25rem 60px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .cta-group {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    padding: 1rem;
  }

  /* Sobre Mim Mobile */
  .about-wrapper {
    flex-direction: column;
    text-align: center;
  }

  .about-text h2 {
    text-align: center;
  }

  .about-img-container {
    width: 100%;
  }

  .about-img-inner {
    max-width: 260px;
  }

  /* Grid Ajustes */
  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    padding: 2.5rem 1.5rem;
  }

  /* FAQ Ajustes */
  .faq-btn {
    padding: 1.2rem;
    font-size: 1rem;
  }

  .faq-ans {
    padding: 0 1.2rem;
  }

  /* Footer Ajustes */
  .footer-nav-central {
    flex-direction: column;
    gap: 1rem;
  }

  footer {
    padding: 60px 0 30px;
  }
}

/* =========================================
   MEDIA QUERIES - SMALL PHONES 
   ========================================= */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .project-card {
    padding: 1.2rem;
  }

  /* Diminui o padding interno para sobrar margem na tela */
  .project-media {
    height: 180px;
    margin-bottom: 1.2rem;
  }

  .service-card {
    padding: 2rem 1.2rem;
  }

  /* Impede que o card estoure as laterais */
  .timeline-item {
    padding: 0 0 0 2rem;
  }

  .timeline-content {
    padding: 1.2rem;
  }

  .skill-card {
    width: 100%;
    justify-content: center;
  }
}

@keyframes blob {
  0% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
  100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
}