:root {
  --bg: #0f1724;
  --accent: #2b7cff;
  --text: #e6eef6;
  --muted: #9aa4b2;
  --card: #1e293b;
}

body.light-mode {
  --bg: #f4f6fa;
  --accent: #1a73e8;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --card: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.4s, color 0.4s;
}

/* Corrige a "âncora" do link para não ficar atrás do header */
section[id] {
  scroll-margin-top: 80px; /* Ajuste este valor (altura do seu header) */
}


/* --- HEADER --- */
header {
  background: rgba(15, 23, 36, 0.8);
  backdrop-filter: blur(5px);
  padding: 15px 5%;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 10;
}

body.light-mode header {
  background: rgba(255, 255, 255, 0.9);
}

.logo {
  color: var(--accent);
  font-weight: 700;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--text);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.5rem;
}

/* --- HERO --- */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 100vh;
  text-align: center;
}

.profile-pic {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  box-shadow: 0 0 20px rgba(43, 124, 255, 0.3);
}

/* --- EFEITO DE DIGITAÇÃO CSS --- */
#typing {
  /* 31 passos (30 caracteres + 1 emoji) */
  width: 31ch; 
  overflow: hidden;
  white-space: nowrap;
  border-right: 4px solid var(--accent);
  animation: typing 3s steps(31), blink 0.6s infinite;
  margin: 10px 0; /* Adiciona um espaço */
  /* Centraliza caso o texto quebre em telas menores */
  margin-left: auto;
  margin-right: auto;
}

@keyframes typing {
  from { width: 0; }
  to { width: 31ch; }
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}


.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s, background 0.3s;
}

.btn:hover {
  transform: scale(1.05);
  background: #478eff;
}

.btn.secondary {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn.secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* --- RESUMO --- */
.resumo-lista {
  list-style: none;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

/* --- TIMELINE --- */
.timeline {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  margin-top: 30px;
}

.timeline .item {
  margin-bottom: 25px;
}

.timeline h3 {
  color: var(--accent);
}

/* --- PROJETOS --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--card);
  padding: 20px;
  border-radius: 10px;
  transition: transform 0.3s;
}

.project-card:hover {
  transform: translateY(-5px);
}

/* --- CONTATO --- */
.contact-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* --- BOTÃO TOPO --- */
.back-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}

.back-top.show {
  opacity: 1;
  visibility: visible;
}

/* --- MATRIX --- */
canvas#matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: #000;
  opacity: 0.4;
}

/* --- LOADER PDF (Não é mais usado, mas pode manter se quiser) --- */
#pdf-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--text);
  padding: 20px 30px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 1000;
}

/* --- RESPONSIVO --- */
@media (max-width: 768px) {
  nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 5%;
    top: 60px;
    background: var(--bg);
    padding: 20px;
    border-radius: 8px;
  }
  nav ul.show {
    display: flex;
  }
  .menu-toggle {
    display: block;
  }
  
  /* Ajusta a animação de digitação em telas pequenas */
  #typing {
    width: 100%;
    white-space: normal;
    border-right: none;
    animation: none;
  }
}

/* --- ESTILOS DE IMPRESSÃO (PDF) --- */
@media print {
  /* Força fundo branco e texto preto, remove o tema */
  body, .project-card, body.light-mode {
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* Esconde elementos desnecessários */
  header, 
  #matrix-bg, 
  #themeToggle, 
  #baixarCurriculo,
  .btn-group a, /* Esconde o botão "Ver Projetos" */
  #backToTop,
  #contato,
  footer,
  .menu-toggle {
    display: none !important;
  }
  
  /* Garante que o CSS do tema claro não afete a impressão */
  body.light-mode header {
    background: transparent !important;
  }

  /* Garante que as seções principais ocupem a página toda */
  section, main {
    margin: 0 !important;
    padding: 1cm 0 !important;
    box-shadow: none !important;
    border: none !important;
    /* Remove animações de fade-in */
    transform: none !important;
    opacity: 1 !important;
  }
  
  .hero {
    min-height: auto;
    padding-top: 0 !important;
  }

  /* Evita quebras de página ruins */
  .timeline .item, .project-card, h2, h3 {
    page-break-inside: avoid;
  }
  
  .timeline .item, .projects-grid {
     page-break-before: auto;
  }

  /* Ajusta a foto do perfil */
  .profile-pic {
    border: 3px solid #000;
    box-shadow: none;
  }
  
  /* Remove o efeito de digitação na impressão */
  #typing {
    border-right: none !important;
    animation: none !important;
    width: auto !important;
    white-space: normal !important;
  }

  /* Mostra URLs de links (opcional, mas útil) */
  .project-card a::after {
    content: " (" attr(href) ")";
    color: #555;
    font-size: 0.9em;
    text-decoration: none;
  }
  
  .project-card a {
    color: #000 !important;
    text-decoration: underline;
  }
  
  nav ul {
    display: none !important;
  }
}

/* --- MELHORIA DE ACESSIBILIDADE (FOCO) --- */

/* Define um "anel" de foco personalizado.
  :focus-visible só aplica o estilo para navegação 
  via teclado (Tab), e não em cliques de mouse.
*/
a:focus-visible,
button:focus-visible,
.project-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px; /* Dá um espaço entre o elemento e o contorno */
  border-radius: 4px; /* Arredonda o contorno */
}

/* Alguns elementos (como o card) não têm 'outline' 
  por padrão, então removemos para quem não é :focus-visible
*/
.project-card:focus {
  outline: none;
}
