/* =====================================================
   1. TOKENS DE DESIGN
   Para mudar as cores do site inteiro, edite só aqui.
   ===================================================== */
:root {
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --header-h: 68px;
  --container: 1120px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Tema escuro (padrão): azul-noite com azul elétrico */
:root,
:root[data-theme="dark"] {
  --bg: #0f1526;
  --surface: #161e35;
  --surface-2: #1d2748;
  --line: #2a3558;
  --text: #e9edf8;
  --muted: #9aa6c4;
  --accent: #6c8cff;
  --accent-ink: #0b1124;
  --violet: #a78bfa;
  --code-bg: #0b1022;
  --code-key: #a78bfa;
  --code-type: #7fd1ff;
  --code-fn: #6c8cff;
  --code-com: #6f7b9e;
  color-scheme: dark;
}

/* Tema claro: papel azulado, sem tom creme */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eaeef9;
  --line: #d6ddee;
  --text: #121a33;
  --muted: #55617f;
  --accent: #2b55e6;
  --accent-ink: #ffffff;
  --violet: #6d4ae0;
  --code-bg: #121a33;
  --code-key: #b9a2ff;
  --code-type: #8fdcff;
  --code-fn: #8ea8ff;
  --code-com: #8894b5;
  color-scheme: light;
}

/* =====================================================
   2. BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;                 /* rolagem suave entre seções */
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color .35s var(--ease), color .35s var(--ease);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

section { padding-block: clamp(4.5rem, 9vw, 7.5rem); }

.section-title {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 700;
  margin-bottom: 2.5rem;
  max-width: 22ch;
}

/* Foco visível para navegação por teclado */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  z-index: 200; transition: top .2s;
}
.skip-link:focus { top: 1rem; }

/* =====================================================
   3. BOTÕES
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 1rem/1 var(--font-body);
  padding: .95rem 1.5rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }

.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* =====================================================
   4. NAVBAR (fixa)
   ===================================================== */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color .35s var(--ease), border-color .35s;
}

.nav {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem;
}
.logo::before {                       /* pontinho de acento ao lado do nome */
  content: "";
  width: .6rem; height: .6rem;
  background: var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
  transition: transform .4s var(--ease);
}
.logo:hover::before { transform: rotate(225deg); }

.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-links a {
  display: block;
  padding: .5rem .9rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: .98rem;
  transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }

.nav-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, transform .3s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; }

/* Alterna o ícone conforme o tema */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.theme-toggle:hover { transform: rotate(18deg); }

.menu-toggle { display: none; }

/* Menu mobile */
@media (max-width: 760px) {
  .menu-toggle { display: grid; }
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    padding: .75rem 1.25rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0; visibility: hidden;
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: .9rem 1rem; font-size: 1.05rem; }
}

/* =====================================================
   5. HERO
   ===================================================== */
.hero {
  padding-top: calc(var(--header-h) + clamp(3rem, 8vw, 6rem));
  padding-bottom: clamp(3.5rem, 8vw, 6rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 6.4vw, 4.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-role {
  margin-top: 1.5rem;
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 44ch;
}
.hero-role strong { color: var(--text); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: 2.25rem; }

/* Bloco de código: o elemento marcante da página.
   As linhas aparecem uma a uma quando a página carrega. */
.code-card {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 45%, transparent);
}
.code-top {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid color-mix(in srgb, #fff 10%, transparent);
  font: 400 .82rem var(--font-code);
  color: #8894b5;
}
.code-top i {
  width: .7rem; height: .7rem; border-radius: 50%;
  background: color-mix(in srgb, #fff 16%, transparent);
}
.code-top span { margin-left: .5rem; }

.code-body {
  margin: 0;
  padding: 1.4rem 1.3rem 1.6rem;
  font: 400 .95rem/1.85 var(--font-code);
  color: #dfe6fb;
  overflow-x: auto;
}
.code-line {
  display: block;
  white-space: pre;
  opacity: 0;
  animation: line-in .5s var(--ease) forwards;
  animation-delay: calc(.35s + var(--i) * .16s);
}
.k { color: var(--code-key); }
.t { color: var(--code-type); }
.f { color: var(--code-fn); }
.c { color: var(--code-com); }

@keyframes line-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: none; }
}

/* Entrada do título (uma única vez) */
.hero-copy > * { animation: rise .7s var(--ease) both; }
.hero-copy > :nth-child(2) { animation-delay: .08s; }
.hero-copy > :nth-child(3) { animation-delay: .16s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   6. SOBRE
   ===================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.about-text { display: grid; gap: 1.1rem; max-width: 56ch; color: var(--muted); }
.about-text strong { color: var(--text); font-weight: 600; }

/* Habilidades: cada linha é uma tecnologia com uma frase de contexto */
.skills li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  transition: padding-left .3s var(--ease), border-color .3s;
}
.skills li:last-child { border-bottom: 1px solid var(--line); }
.skills li:hover { padding-left: .6rem; border-top-color: var(--accent); }
.skills h3 { font-size: 1.35rem; font-weight: 700; }
.skills p { color: var(--muted); font-size: 1rem; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .skills li { grid-template-columns: 1fr; gap: .25rem; }
}

/* =====================================================
   7. PROJETOS
   ===================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.project {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.project:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 22px 40px -28px var(--accent);
}
.project h3 { font-size: 1.4rem; font-weight: 700; }
.project > p { margin-top: .75rem; color: var(--muted); font-size: 1rem; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.25rem; }
.tags li {
  font: 500 .82rem var(--font-code);
  padding: .3rem .7rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}

.project-links {
  display: flex; gap: 1.25rem;
  margin-top: auto; padding-top: 1.5rem;
}
.project-links a {
  font-weight: 600; font-size: .98rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.project-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Revelação suave ao rolar (CSS puro; navegadores sem suporte mostram normalmente) */
@supports (animation-timeline: view()) {
  .reveal {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

/* =====================================================
   8. CONTATO
   ===================================================== */
.contact-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.contact-intro { color: var(--muted); max-width: 40ch; }

.socials { margin-top: 2rem; display: grid; gap: .25rem; }
.socials a {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 0;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  transition: color .2s, padding-left .3s var(--ease);
}
.socials a:hover { color: var(--accent); padding-left: .5rem; }
.socials svg { width: 22px; height: 22px; flex: none; }

.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: .85rem 1rem;
  transition: border-color .2s, box-shadow .2s, background-color .35s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form .btn { justify-self: start; }
.form-status { min-height: 1.5rem; font-size: .95rem; color: var(--muted); }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   9. RODAPÉ
   ===================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--muted);
  font-size: .95rem;
}
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem;
}

/* =====================================================
   10. ACESSIBILIDADE: respeita quem prefere menos movimento
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-timeline: auto !important;
    transition-duration: .001ms !important;
  }
}
