/* =============================================================================
   Portfólio — Luiz Augusto Moreira Barbosa
   CSS escrito à mão. Sem framework, sem build, sem CDN.

   Decisões:
   - Fontes do SISTEMA (nenhum download de webfont): a página renderiza no
     primeiro paint mesmo com internet ruim. Zero requisição externa.
   - Tokens de cor em :root (tema claro) e sobrescritos em prefers-color-scheme:
     dark. Contraste verificado para AA.
   - Largura de leitura ~70ch nos blocos de texto corrido.
   ========================================================================== */

/* ----------------------------------------------------------------- tokens */
:root {
  /* superfícies */
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f4f5f8;
  --border: #e0e2e9;
  --border-strong: #c9ccd6;

  /* texto */
  --text: #14161c;
  --text-muted: #5a6170;
  --text-faint: #858c9b;

  /* acento — teal técnico, sóbrio */
  --accent: #0d6b6b;
  --accent-hover: #0a5555;
  --accent-soft: #e3f1f1;
  --accent-border: #a9d3d3;

  /* estados */
  --ok: #1c6b3f;
  --ok-soft: #e4f3ea;
  --warn: #8a5a00;
  --warn-soft: #fdf1dc;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 20, 30, .05), 0 4px 16px rgba(16, 20, 30, .05);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono",
          "Segoe UI Mono", Menlo, Consolas, monospace;

  --nav-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #161922;
    --surface-2: #1c2029;
    --border: #272c38;
    --border-strong: #3a4152;

    --text: #e8eaf0;
    --text-muted: #a3abbb;
    --text-faint: #7c8493;

    --accent: #4fd1c5;
    --accent-hover: #7ee0d6;
    --accent-soft: #12292c;
    --accent-border: #2a4f52;

    --ok: #5fd398;
    --ok-soft: #12241b;
    --warn: #e8b862;
    --warn-soft: #2a2113;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 20px rgba(0, 0, 0, .28);
  }
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* scroll-padding evita que a nav fixa cubra o título da seção alvo */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 650; }
h1 { font-size: clamp(2rem, 5.2vw, 3.1rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.05rem); }
h3 { font-size: 1.16rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.15em; }
li { margin-bottom: .4em; }

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

/* link "pular para o conteúdo" — primeiro tab da página */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .7em 1.1em;
  border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------- utilitários */
.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.prose { max-width: 68ch; }
.mono { font-family: var(--mono); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
section + section { border-top: 1px solid var(--border); }

.eyebrow {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .7rem;
}

.lead { font-size: 1.1rem; color: var(--text-muted); }

/* --------------------------------------------------------------- navegação */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
/* fallback para navegadores sem color-mix */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .nav { background: var(--bg); }
}
.nav__inner { display: flex; align-items: center; gap: 1.5rem; width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.nav__brand {
  font-weight: 680; letter-spacing: -.02em; color: var(--text);
  text-decoration: none; font-size: .98rem; white-space: nowrap;
}
.nav__brand span { color: var(--accent); }
.nav__links { display: flex; gap: 1.35rem; margin-left: auto; flex-wrap: wrap; }
.nav__links a {
  color: var(--text-muted); text-decoration: none; font-size: .9rem; font-weight: 520;
  transition: color .15s ease;
}
.nav__links a:hover { color: var(--text); }
@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav__cta { margin-left: auto; }
}
.nav__cta {
  font-size: .86rem; padding: .42em 	.9em; border-radius: 999px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .nav__cta { color: #06201f; } }
.nav__cta:hover { background: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .nav__cta:hover { color: #06201f; } }

/* -------------------------------------------------------------------- hero */
.hero { padding-top: calc(var(--nav-h) + clamp(3rem, 9vw, 6rem)); padding-bottom: clamp(2.5rem, 6vw, 4rem); }
.hero__role {
  font-family: var(--mono); font-size: .84rem; color: var(--accent);
  letter-spacing: .06em; margin-bottom: 1rem;
}
.hero h1 { margin-bottom: .35em; }
.hero__tagline {
  font-size: clamp(1.12rem, 2.4vw, 1.4rem);
  color: var(--text-muted); max-width: 34ch; margin-bottom: 2rem;
  text-wrap: balance;
}
.hero__tagline strong { color: var(--text); font-weight: 640; }

.btns { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.15em; border-radius: var(--radius);
  font-size: .93rem; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #06201f; }
  .btn--primary:hover { color: #06201f; }
}
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.btn svg { width: 17px; height: 17px; flex: none; }

/* --------------------------------------------------------- faixa de números */
.stats {
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
}
.stats__grid {
  display: grid; gap: 1.6rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}
.stat__num {
  font-family: var(--mono); font-size: 1.65rem; font-weight: 600;
  color: var(--text); letter-spacing: -.03em; line-height: 1.1;
}
.stat__label { font-size: .855rem; color: var(--text-muted); margin-top: .3rem; }

/* -------------------------------------------------------------------- case */
.case__head { display: grid; gap: 2rem; margin-bottom: 2.5rem; }
@media (min-width: 900px) { .case__head { grid-template-columns: 1.35fr 1fr; align-items: start; } }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.2rem; }
.tag {
  font-family: var(--mono); font-size: .74rem; padding: .3em .6em;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--text-muted); white-space: nowrap;
}

.block { margin-bottom: 2.2rem; }
.block h3 {
  display: flex; align-items: baseline; gap: .6rem; margin-bottom: .6rem;
}
.block h3::before {
  content: ""; width: 18px; height: 2px; background: var(--accent); flex: none;
  transform: translateY(-4px);
}

/* decisões de arquitetura */
.decisions { display: grid; gap: 1rem; }
@media (min-width: 780px) { .decisions { grid-template-columns: 1fr 1fr; } }
.decision {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
}
.decision h4 {
  font-size: .97rem; margin-bottom: .4rem; display: flex; gap: .55rem; align-items: baseline;
}
.decision h4 .n {
  font-family: var(--mono); font-size: .78rem; color: var(--accent);
  border: 1px solid var(--accent-border); background: var(--accent-soft);
  width: 1.7em; height: 1.7em; display: inline-grid; place-items: center;
  border-radius: 5px; flex: none;
}
.decision p { font-size: .93rem; color: var(--text-muted); margin: 0; }
.decision p + p { margin-top: .55rem; }
.decision .why { color: var(--text); }
.decision .why b { color: var(--accent); font-weight: 620; }

/* números do case */
.metrics {
  display: grid; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
.metric { background: var(--surface); padding: 1rem 1.1rem; }
.metric b { font-family: var(--mono); font-size: 1.28rem; display: block; letter-spacing: -.02em; }
.metric span { font-size: .8rem; color: var(--text-muted); }

/* diagrama */
.diagram {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.2rem; margin-bottom: 1rem;
  overflow-x: auto;
}
.diagram figcaption {
  font-size: .82rem; color: var(--text-faint); margin-top: .9rem; text-align: center;
}

/* cartão de demonstração — o CTA mais importante da página */
.demo {
  border: 1px solid var(--accent-border);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 65%);
  border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow);
}
.demo__top { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: center; margin-bottom: 1rem; }
.demo__title { font-size: 1.05rem; font-weight: 640; margin: 0; }
.badge {
  font-family: var(--mono); font-size: .72rem; padding: .28em .6em; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid currentColor; font-weight: 600;
}
.badge--warn { background: var(--warn-soft); color: var(--warn); }

.creds { display: grid; gap: .6rem; margin: 1rem 0; }
.cred {
  display: grid; gap: .15rem .9rem; align-items: center;
  grid-template-columns: 1fr; padding: .75rem .9rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
@media (min-width: 620px) { .cred { grid-template-columns: 160px 1fr auto; } }
.cred__role { font-weight: 620; font-size: .9rem; }
.cred__what { font-size: .84rem; color: var(--text-muted); grid-column: 1 / -1; }
@media (min-width: 620px) { .cred__what { grid-column: 2; grid-row: 1; } }
.cred__keys { font-family: var(--mono); font-size: .84rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.cred__keys code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .2em .5em; border-radius: 5px; color: var(--text);
}
.demo__note { font-size: .84rem; color: var(--text-muted); margin: 0; }

/* galeria de capturas */
.shots { display: grid; gap: 1rem; margin-top: 2rem; }
@media (min-width: 760px) { .shots { grid-template-columns: repeat(3, 1fr); } }
.shot { margin: 0; }
.shot img {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); aspect-ratio: 16 / 10; object-fit: cover; object-position: top center;
}
.shot figcaption { font-size: .8rem; color: var(--text-faint); margin-top: .5rem; }

/* --------------------------------------------------- projetos secundários */
.cards { display: grid; gap: 1rem; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.card h3 { font-size: 1rem; margin: 0; }
.card p { font-size: .89rem; color: var(--text-muted); margin: 0; flex: 1; }
.card__foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .8rem; }
.card__lang { font-family: var(--mono); color: var(--text-faint); }
.pill {
  font-family: var(--mono); font-size: .7rem; padding: .22em .55em;
  border-radius: 999px; border: 1px solid var(--warn); color: var(--warn);
  background: var(--warn-soft); font-weight: 600;
}

/* ------------------------------------------------------------------ stack */
.stack { display: grid; gap: 1.6rem; }
@media (min-width: 720px) { .stack { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1020px) { .stack { grid-template-columns: repeat(3, 1fr); } }
.stack__group h3 { font-size: .84rem; font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-faint); margin-bottom: .7rem; }
.stack__list { display: flex; flex-wrap: wrap; gap: .4rem; }

/* --------------------------------------------------------- como eu trabalho */
.flow { display: grid; gap: .8rem; counter-reset: step; }
@media (min-width: 860px) { .flow { grid-template-columns: repeat(3, 1fr); } }
.flow__item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.05rem 1.15rem;
}
.flow__item h3 { font-size: .96rem; margin-bottom: .35rem; }
.flow__item p { font-size: .88rem; color: var(--text-muted); margin: 0; }

/* ---------------------------------------------------------------- contato */
.contact__grid { display: grid; gap: 1.2rem; }
@media (min-width: 780px) { .contact__grid { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.contact__list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.contact__list a { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 550; }
.contact__list a:hover { text-decoration: underline; }
.contact__list svg { width: 17px; height: 17px; flex: none; color: var(--text-faint); }

/* ----------------------------------------------------------------- rodapé */
.footer {
  border-top: 1px solid var(--border); padding: 2rem 0 2.5rem;
  font-size: .84rem; color: var(--text-faint);
}
.footer__inner { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between; }

/* --------------------------------------------------- diagramas (SVG inline) */
/* Os diagramas herdam os tokens de tema, então funcionam no claro e no escuro
   sem duplicar o SVG. Largura mínima evita que o texto amasse no celular —
   o contêiner .diagram rola horizontalmente quando necessário. */
.dg { min-width: 640px; width: 100%; height: auto; }
.dg-box {
  fill: var(--surface-2);
  stroke: var(--border-strong);
  stroke-width: 1;
}
.dg-box--accent { fill: var(--accent-soft); stroke: var(--accent-border); }
.dg-box--thin { fill: var(--surface); }
.dg-label {
  fill: var(--text); font-family: var(--font); font-size: 13px;
  font-weight: 600; text-anchor: middle;
}
.dg-label--sm { font-size: 12px; font-weight: 500; }
.dg-sub {
  fill: var(--text-muted); font-family: var(--mono); font-size: 10.5px;
  text-anchor: middle;
}
.dg-note {
  fill: var(--text-faint); font-family: var(--mono); font-size: 10.5px;
  text-anchor: middle;
}
.dg-arrow { stroke: var(--border-strong); stroke-width: 1.5; }
.dg-arrow--dash { stroke-dasharray: 4 3; stroke: var(--accent); }
.dg-head { fill: var(--border-strong); }

/* ------------------------------------------- revelação discreta ao rolar */
/* Regra de segurança: o conteúdo NUNCA nasce invisível no CSS. Só o JS
   "arma" a animação (.is-armed) logo antes de observar o elemento. Assim,
   se o JS não rodar, se o IntersectionObserver não existir ou se algo falhar
   no meio do caminho, a página continua legível — em vez de virar uma
   sequência de blocos em branco. */
.reveal { transition: opacity .5s ease, transform .5s ease; }
.reveal.is-armed { opacity: 0; transform: translateY(10px); }
.reveal.is-armed.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal.is-armed { opacity: 1; transform: none; }
}
