/* Reset e tokens */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

:root {
  --brand: 264 50% 57%;           /* roxo elegante */
  --brand-2: 198 80% 52%;         /* ciano acento */
  --bg: 250 24% 6%;
  --bg-elev: 248 22% 10%;
  --text: 0 0% 98%;
  --muted: 0 0% 73%;
  --border: 248 18% 20%;
  --ring: 264 80% 65%;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 10px 30px rgba(0,0,0,.35);
  --shadow-2: 0 20px 50px rgba(0,0,0,.45);

  --container: 1140px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 40px;
  --space-7: 64px;

  --font-1: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-2: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
}

:root.light {
  --bg: 0 0% 100%;
  --bg-elev: 0 0% 98%;
  --text: 240 10% 4%;
  --muted: 240 5% 40%;
  --border: 240 6% 90%;
  --shadow-1: 0 10px 30px rgba(0,0,0,.08);
  --shadow-2: 0 20px 50px rgba(0,0,0,.12);
}

body {
  margin: 0;
  background: hsl(var(--bg));
  color: hsl(var(--text));
  font-family: var(--font-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fundo decorativo */
.bg .blob {
  position: fixed;
  inset: auto auto 10% -10%;
  width: 600px; height: 600px;
  filter: blur(80px);
  opacity: .35;
  z-index: -2;
  transform: rotate(15deg);
}

.blob-1 {
  top: -10%; left: -10%;
  background: radial-gradient(600px 600px at 50% 50%,
    hsla(var(--brand), .6), transparent 60%);
}

.blob-2 {
  bottom: -10%; right: -10%;
  background: radial-gradient(600px 600px at 50% 50%,
    hsla(var(--brand-2), .55), transparent 60%);
}

.bg .noise {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Layout utilitários */
.container {
  width: 100%;
  max-width: var(--container);
  padding: 0 var(--space-4);
  margin: 0 auto;
}

.section {
  padding: var(--space-7) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.section-header h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem);
  margin: 0 0 var(--space-2);
}

.section-header p {
  color: hsl(var(--muted));
  margin: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.align-center {
  align-items: center;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, hsla(var(--bg), .7), hsla(var(--bg), .4));
  border-bottom: 1px solid hsl(var(--border));
  z-index: 50;
}

.nav {
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-1);
}

.avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, hsla(var(--brand), .35), hsla(var(--brand-2), .35));
  z-index: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.avatar.small {
  width: 36px;
  height: 36px;
}

.brand-text strong {
  display: block;
  font-weight: 700;
  letter-spacing: .2px;
}

.brand-text span {
  display: block;
  color: hsl(var(--muted));
  font-size: .9rem;
  margin-top: -2px;
}

.menu {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.menu-link {
  color: hsl(var(--muted));
  text-decoration: none;
  font-weight: 500;
  transition: color .2s ease;
}

.menu-link:hover {
  color: hsl(var(--text));
}

.actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--text));
  border-radius: 10px;
  padding: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease, border-color .2s;
}

.icon-btn:hover {
  background: hsla(var(--text), .05);
  border-color: hsla(var(--text), .18);
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
}

.mobile-toggle {
  display: none; /* Esconde por padrão, mostra em telas menores */
}

.mobile-menu {
  display: none; /* Esconde por padrão, mostra com JS */
  flex-direction: column;
  gap: 14px;
  padding: 14px var(--space-4) var(--space-4);
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--bg));
  position: absolute; /* Permite que ele se expanda abaixo do header */
  top: 72px; /* Altura do header */
  left: 0;
  width: 100%;
  z-index: 49; /* Menor que o header para ficar abaixo */
}

.mobile-menu.open {
  display: flex;
}

/* Hero */
.hero {
  padding-top: calc(var(--space-7) + 24px);
}

.chip {
  display: inline-block;
  font-size: .85rem;
  color: hsl(var(--text));
  background: linear-gradient(135deg, hsla(var(--brand), .22), hsla(var(--brand-2), .22));
  border: 1px solid hsla(var(--brand), .35);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-1);
}

h1 {
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem);
  line-height: 1.15;
  margin: var(--space-3) 0 var(--space-3);
}

.lead {
  font-size: clamp(1rem, .9rem + .4vw, 1.125rem);
  color: hsl(var(--muted));
  max-width: 52ch;
}

.gradient-text {
  background: linear-gradient(90deg, hsl(var(--brand)), hsl(var(--brand-2)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--text));
  transition: transform .15s ease, background .2s ease, border-color .2s, box-shadow .2s;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-lg {
  padding: 14px 22px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: .92rem;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 25px hsla(var(--brand), .28);
}

.btn-primary:hover {
  box-shadow: 0 16px 30px hsla(var(--brand), .36);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost:hover {
  background: hsla(var(--text), .06);
}

.btn-ghost.btn-lg {
  border-color: hsla(var(--text), .12);
}

.socials {
  display: flex;
  align-items: center;
  gap: 14px;
}

.socials a {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid hsl(var(--border));
  display: grid;
  place-items: center;
  color: hsl(var(--text));
  background: hsla(var(--text), .03);
  transition: transform .15s ease, background .2s;
}

.socials a:hover {
  transform: translateY(-2px);
  background: hsla(var(--text), .08);
}

.profile-card {
  position: relative;
  padding: 14px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(180deg, hsla(var(--bg-elev), .8), hsla(var(--bg-elev), .6));
  border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.profile-img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: var(--radius);
}

.profile-card .badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: hsl(var(--bg));
  border: 1px solid hsl(var(--border));
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .85rem;
  box-shadow: var(--shadow-1);
}

.accent-ring {
  position: absolute;
  inset: -20%;
  border-radius: 24px;
  pointer-events: none;
  border: 2px solid transparent;
  background: linear-gradient(hsl(var(--bg)), hsl(var(--bg))) padding-box, linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2))) border-box;
  filter: blur(16px);
  opacity: .25;
}

/* Cartões e listas */
.cards .card {
  background: linear-gradient(180deg, hsla(var(--bg-elev), .86), hsla(var(--bg-elev), .7));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

.cards .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: hsla(var(--brand), .35);
}

.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  margin-bottom: var(--space-3);
}

.gradient-bg {
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  box-shadow: 0 10px 25px hsla(var(--brand), .25);
}

.card h3 {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
}

.card p {
  margin: 0 0 var(--space-3);
  color: hsl(var(--muted));
}

.list {
  margin: 0;
  padding-left: 16px;
  color: hsl(var(--text));
}

.list li {
  margin: 4px 0;
}

/* Projetos */
.projects .project-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, hsla(var(--bg-elev), .86), hsla(var(--bg-elev), .7));
  box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

.projects .project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: hsla(var(--brand), .35);
}

.project-media {
  position: relative;
  overflow: hidden;
}

.project-media img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.project-media .overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, hsla(var(--bg), .0), hsla(var(--bg), .55));
  opacity: 0;
  transition: opacity .25s ease;
}

.project-card:hover .overlay {
  opacity: 1;
}

.project-body {
  padding: var(--space-4);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-3);
}

.tag {
  font-family: var(--font-2);
  font-weight: 600;
  font-size: .85rem;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted));
  padding: 6px 10px;
  border-radius: 999px;
}

/* CTA */
.cta {
  padding-top: 0;
}

.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-6);
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid hsl(var(--border));
  background: linear-gradient(135deg, hsla(var(--brand), .16), hsla(var(--brand-2), .16));
  box-shadow: var(--shadow-2);
}

.cta-content h3 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 1rem + .8vw, 1.7rem);
}

.cta-content p {
  margin: 0;
  color: hsl(var(--muted));
}

/* Contato */
.contact {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--space-6);
  align-items: start;
}

.contact-cards {
  display: grid;
  gap: var(--space-4);
}

.contact-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, hsla(var(--bg-elev), .86), hsla(var(--bg-elev), .7));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--space-4);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: hsla(var(--brand), .35);
}

.contact-card h4 {
  margin: 0 0 4px;
}

.form {
  background: linear-gradient(180deg, hsla(var(--bg-elev), .86), hsla(var(--bg-elev), .7));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: var(--space-4);
}

label {
  font-weight: 600;
}

input, textarea {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  background: hsla(var(--text), .03);
  color: hsl(var(--text));
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input:focus, textarea:focus {
  border-color: hsla(var(--brand), .5);
  box-shadow: 0 0 0 6px hsla(var(--brand), .18);
  background: hsla(var(--text), .05);
}

.error {
  color: #ff6b6b;
  min-height: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.form-note {
  color: hsl(var(--muted));
  margin: 0;
  font-size: .9rem;
}

.form-status {
  margin-top: 10px;
  font-weight: 600;
}

/* Footer */
.footer {
  border-top: 1px solid hsl(var(--border));
  background: hsla(var(--text), .02);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) 0;
}

.foot-links, .foot-socials {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.foot-links a, .foot-socials a {
  color: hsl(var(--muted));
  text-decoration: none;
  font-weight: 500;
}

.foot-links a:hover, .foot-socials a:hover {
  color: hsl(var(--text));
}

.copy {
  text-align: center;
  color: hsl(var(--muted));
  font-size: .95rem;
  padding: 14px 0 var(--space-4);
}

/* CTA fixa (mobile) */
.mobile-cta {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: none; /* Escondido por padrão, mostra em telas menores */
  gap: 10px;
  padding: 8px;
  background: hsla(var(--bg), .6);
  backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  z-index: 60;
}

/* Botão topo */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  background: hsla(var(--bg), .7);
  color: hsl(var(--text));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-1);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 55;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-4px);
}

/* Animações de entrada */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1);
}

/* Responsividade */
@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr; /* Colunas empilhadas */
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr); /* 2 colunas */
  }
  .cta-card {
    flex-direction: column; /* Botão abaixo do texto */
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  /* Blob Sizes - Ajuste para telas menores */
  .bg .blob {
    width: 400px;
    height: 400px;
    filter: blur(60px);
    opacity: .25;
  }
  .blob-1 {
    top: -8%; left: -8%;
  }
  .blob-2 {
    bottom: -8%; right: -8%;
  }

  /* Navegação e Menu Móvel */
  .menu {
    display: none; /* Esconde menu desktop */
  }
  .mobile-toggle {
    display: inline-grid; /* Mostra o botão de toggle para mobile */
  }

  /* Layout de Grids */
  .grid-3 {
    grid-template-columns: 1fr; /* 1 coluna */
  }
  .projects .project-media img {
    height: 200px; /* Ajusta a altura da imagem do projeto */
  }

  /* Seção de Contato */
  .contact {
    grid-template-columns: 1fr; /* Colunas empilhadas */
  }
  .contact-cards {
    margin-bottom: var(--space-5); /* Adiciona espaço entre os cartões de contato e o formulário */
  }

  /* CTA Fixo para Mobile */
  .mobile-cta {
    display: flex; /* Mostra o CTA fixo na parte inferior */
  }

  /* Rodapé */
  .footer-grid {
    grid-template-columns: 1fr; /* Itens do rodapé empilhados */
    text-align: center;
  }
}

@media (max-width: 500px) {
  /* Blob Sizes - Ajuste ainda menor para telas muito pequenas */
  .bg .blob {
    width: 250px;
    height: 250px;
    filter: blur(40px);
    opacity: .2;
  }
  .blob-1 {
    top: -5%; left: -5%;
  }
  .blob-2 {
    bottom: -5%; right: -5%;
  }
}

@media (max-width: 480px) {
  /* Container Padding - Ajuste para telas muito pequenas */
  .container {
    padding: 0 var(--space-3); /* Reduz o padding lateral de 20px para 14px */
  }

  /* Espaçamento geral para elementos grandes */
  .btn-lg {
    padding: 12px 18px; /* Ajusta o padding de botões grandes */
    font-size: .95rem;
  }
}


/* Ícones tema */
#themeToggle .sun {
  display: none;
}

:root.light #themeToggle .sun {
  display: block;
}

:root.light #themeToggle .moon {
  display: none;
}