/* =================================================================
   João Pedro Veras — Portfólio
   Design Spec v1 · Paleta monocromática + 1 acento (verde)
   ================================================================= */

/* ---------- 02 · CORES (tokens — mesmos nomes nos dois temas) ---------- */
:root {
  --bg:#fafafa; --card:#ffffff; --ink:#0a0a0a; --sub:#404040;
  --muted:#737373; --faint:#a3a3a3; --border:#e6e6e6; --line:#f0f0f0;
  --inv-bg:#0a0a0a; --inv-ink:#ffffff; --accent:#16a34a;

  /* 03 · LAYOUT & TOKENS */
  --container: 1080px;
  --pad-x: clamp(20px, 4.5vw, 40px);   /* horiz. fluido (≤ 40px do spec)  */
  --pad-y: clamp(44px, 6.5vw, 64px);   /* vert. fluido (48–64px do spec)  */
  --radius-card: 8px;
  --radius-pill: 6px;
  --nav-h: 56px;

  /* tipografia */
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg:#0e0e0e; --card:#161616; --ink:#f5f5f5; --sub:#c8c8c8;
  --muted:#9a9a9a; --faint:#6b6b6b; --border:#272727; --line:#1f1f1f;
  --inv-bg:#f5f5f5; --inv-ink:#0a0a0a; --accent:#22c55e;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  text-size-adjust: 100%;            /* evita inflar texto no mobile  */
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;                  /* trava scroll horizontal acidental */
  overflow-wrap: break-word;         /* quebra palavras/URLs longas    */
  transition: background-color .25s ease, color .25s ease;
}

html { scroll-padding-top: calc(var(--nav-h) + 12px); }

h1, h2 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* ---------- Acessibilidade ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 200;
  background: var(--ink);
  color: var(--inv-ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
}
.skip-link:focus { left: 12px; }

/* ---------- Prompts / detalhes em acento ---------- */
/* Prompts de terminal: minúsculos (comandos reais), como no mockup.
   O "UPPER" do Design Spec vale para rótulos/eyebrows de seção. */
.prompt {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: 20px;
}
.prompt-accent { color: var(--accent); }

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pulse 2.4s ease-out infinite;
  flex: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* =================================================================
   04 · NAV — barra fixa no topo
   ================================================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nav__path {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  min-width: 0;                 /* permite encolher */
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav__right { display: flex; align-items: center; gap: 8px; flex: none; }

.nav__links {
  display: flex;
  gap: 22px;
  margin-right: 8px;
}
.nav__links a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  transition: color .15s ease;
}
.nav__links a:hover { color: var(--ink); }

/* toggles (idioma / tema) */
.toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--faint);
  background: none;
  border: 0;
  padding: 6px 6px;
  cursor: pointer;
  transition: color .15s ease;
}
.toggle:hover { color: var(--ink); }

.toggle-group {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin-inline: 4px;
  padding-inline: 4px;
}
.toggle--lang.is-active { color: var(--ink); font-weight: 600; }
.toggle--theme { color: var(--muted); }

/* =================================================================
   HERO
   ================================================================= */
/* Hero usa o mesmo container (1080px) das outras seções, então a margem
   esquerda do "$ whoami" alinha com "$ ls ./projetos", stats, etc.
   A largura de leitura é limitada nos elementos de texto, não no bloco. */
.hero {
  padding-top: calc(var(--nav-h) + var(--pad-y));
  padding-bottom: var(--pad-y);
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  margin-bottom: 26px;
}
.hero__name {
  font-family: var(--font-mono);
  font-size: clamp(34px, 8.5vw, 60px);   /* fluido: nunca estoura o container */
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero__role {
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.4vw, 16px);
  font-weight: 500;
  color: var(--sub);
  margin-top: 18px;
}
.hero__bio {
  color: var(--sub);
  max-width: 56ch;       /* largura de leitura confortável */
  margin-top: 18px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary {
  background: var(--ink);
  color: var(--inv-ink);
  border-color: var(--ink);
}
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); border-color: transparent; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

/* =================================================================
   Seções genéricas
   ================================================================= */
.section {
  padding-top: var(--pad-y);
  padding-bottom: var(--pad-y);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

/* ---------- STATS (tabela 4 col.) ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--card);
}
.stats__cell {
  padding: clamp(18px, 3vw, 26px) clamp(14px, 2.4vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 1px solid var(--border);   /* divisórias verticais 1px */
}
.stats__cell:first-child { border-left: 0; }
.stats__num {
  font-family: var(--font-mono);
  font-size: clamp(26px, 4.4vw, 34px);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.stats__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- PROJETOS (grid 2 col · gap 14px, como no spec) ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
/* card ímpar sozinho na última linha ocupa as 2 colunas (vira destaque) */
.projects .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.card {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: clamp(18px, 2.6vw, 24px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* seta de link externo (detalhe, monocromático) */
.card__link {
  position: absolute;
  top: clamp(18px, 2.6vw, 24px);
  right: clamp(18px, 2.6vw, 24px);
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--faint);
  transition: color .18s ease, transform .18s ease;
}
.card:hover .card__link,
.card:focus-visible .card__link { color: var(--ink); transform: translate(2px, -2px); }
.card:hover {
  transform: translateY(-3px);
  border-color: var(--sub);
  box-shadow: 0 10px 30px -18px rgba(0,0,0,.45);
}
.card__idx {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);          /* índice em verde (detalhe) */
}
.card__title {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 10px;
}
.card__desc {
  color: var(--muted);
  margin-top: 10px;
}
.card__tags {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  margin-top: 16px;
}

/* ---------- TECNOLOGIAS (pills) ---------- */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pill {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.pill:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-2px); }

/* ---------- CERTIFICAÇÕES (divisórias tracejadas) ---------- */
.certs { border-top: 1px dashed var(--border); }
.cert {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  border-bottom: 1px dashed var(--border);
}
.cert__name {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
}
.cert__org {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
/* certificação com link de verificação (Credly) */
a.cert__name { transition: color .15s ease; }
a.cert__name:hover,
a.cert__name:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.cert__verify {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.82em;
  color: var(--faint);
  transition: color .15s ease, transform .15s ease;
}
a.cert__name:hover .cert__verify,
a.cert__name:focus-visible .cert__verify { color: var(--ink); transform: translate(2px, -2px); }

/* =================================================================
   CONTATO — painel invertido
   ================================================================= */
.contact {
  background: var(--inv-bg);
  color: var(--inv-ink);
  transition: background-color .25s ease, color .25s ease;
}
.contact__inner {
  padding-top: calc(var(--pad-y) + 8px);
  padding-bottom: calc(var(--pad-y) + 8px);
}
.prompt--inv { color: color-mix(in srgb, var(--inv-ink) 60%, transparent); }
.contact__title {
  font-family: var(--font-mono);
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.contact__sub {
  color: color-mix(in srgb, var(--inv-ink) 65%, transparent);
  max-width: 52ch;
  margin-bottom: 30px;
}
.contact__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn--inv {
  background: transparent;
  color: var(--inv-ink);
  border-color: color-mix(in srgb, var(--inv-ink) 30%, transparent);
}
.btn--inv:hover {
  background: var(--inv-ink);
  color: var(--inv-bg);
  border-color: var(--inv-ink);
}

/* =================================================================
   FOOTER
   ================================================================= */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
  padding-top: 22px;
  padding-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

/* =================================================================
   Reveal on scroll
   ================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* =================================================================
   Responsivo  (breakpoints em em — acompanham zoom e fonte do usuário)
   ================================================================= */

/* ≤ ~960px — alivia a navegação */
@media (max-width: 60em) {
  .nav__links { gap: 18px; }
}

/* ≤ ~720px — tablet / celular grande */
@media (max-width: 45em) {
  .nav__links { display: none; }
  .projects { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats__cell:nth-child(odd)  { border-left: 0; }
  .stats__cell:nth-child(n+3)  { border-top: 1px solid var(--border); }
  .cert { flex-direction: column; gap: 2px; }
  .cert__org { text-align: left; }
}

/* ≤ ~480px — celular: botões ocupam a largura para toque confortável */
@media (max-width: 30em) {
  .hero__actions,
  .contact__actions { width: 100%; }
  .hero__actions .btn,
  .contact__actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ≤ ~380px — telas mínimas: stats em 1 coluna e nav compacta */
@media (max-width: 24em) {
  .stats { grid-template-columns: 1fr; }
  .stats__cell { border-left: 0; }
  .stats__cell:nth-child(n+2) { border-top: 1px solid var(--border); }
  .nav__path { font-size: 13px; }
  .toggle { padding: 6px 4px; font-size: 12px; }
  .nav__inner { gap: 8px; }
}

/* =================================================================
   Movimento reduzido
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
