/* Portfólio — do caos ao conhecimento. Escuro por padrão, claro pelo botão. Sem build. */
:root {
  --bg: #08090c;
  --surface: #0e1014;
  --surface-2: #15181d;
  --text: #edebe4;
  --muted: #8d919a;
  --border: #23262d;
  --accent: #f2b544;
  --accent-soft: rgba(242, 181, 68, .11);
  --accent-ink: #0b0b0c;
  --field: #9aa0ab;
  --code-bg: #15181d;
  --maxw: 1200px;
  --gutter: clamp(20px, 5vw, 56px);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f0e8;
  --surface: #faf8f2;
  --surface-2: #e8e4d8;
  --text: #16171a;
  --muted: #5c5f67;
  --border: #d3cebf;
  --accent: #a04d08;
  --accent-soft: rgba(160, 77, 8, .10);
  --accent-ink: #fffaf0;
  --field: #6b6e76;
  --code-bg: #e8e4d8;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent); }
img, svg { max-width: 100%; height: auto; }
strong { font-weight: 600; color: var(--text); }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .12em .4em; border-radius: 3px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* Campo de glifos: fica fixo atrás de tudo */
#field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main, footer { position: relative; z-index: 1; }

/* Cabeçalho */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { font: 400 1.35rem/1 var(--serif); color: var(--text); text-decoration: none; margin-right: auto; white-space: nowrap; }
.nav { display: none; gap: 26px; }
.nav a { color: var(--muted); text-decoration: none; font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.nav a:hover { color: var(--accent); }
@media (min-width: 900px) { .nav { display: flex; } }
.controls { display: flex; gap: 8px; }
.btn-icon, .lang-switch button {
  border: 0; background: transparent; color: var(--muted); height: 32px; min-width: 34px; padding: 0 10px;
  font: 600 .72rem var(--mono); letter-spacing: .08em; cursor: pointer;
}
.btn-icon { border: 1px solid var(--border); border-radius: 2px; font-size: .95rem; }
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 2px; overflow: hidden; }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Tipografia */
h1, h2, h3 { margin: 0 0 16px; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(2.7rem, 7.4vw, 6.4rem); line-height: .98; }
h2 { font-size: clamp(2.1rem, 4.8vw, 3.7rem); line-height: 1.04; }
h3 { font: 600 1.05rem/1.35 var(--font); }
h1 em, h2 em { font-style: italic; color: var(--accent); }
.eyebrow {
  font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 0 0 18px;
}
.lead { font-size: clamp(1.02rem, 1.4vw, 1.18rem); color: var(--muted); max-width: 62ch; margin: 0 0 1em; }
.muted { color: var(--muted); }

/* Seções: numeradas pelo CSS, na ordem em que aparecem */
main { counter-reset: sec; }
section { padding: clamp(72px, 11vw, 140px) 0; border-top: 1px solid var(--border); }
section[id] { counter-increment: sec; }
section[id] > .wrap > .eyebrow::before { content: counter(sec, decimal-leading-zero) " / "; color: var(--accent); }

/* Hero */
.hero { border-top: 0; min-height: calc(100svh - 60px); padding: clamp(56px, 13vh, 150px) 0 120px; position: relative; }
.hero h1 { max-width: 15ch; margin-bottom: 28px; }
.hero .role { font: 500 .8rem var(--mono); letter-spacing: .04em; color: var(--text); margin: 0 0 10px; }
.hero .lead { max-width: 52ch; }
.chaos { font-family: var(--mono); font-size: .74em; letter-spacing: -.04em; color: var(--muted); display: inline-block; white-space: nowrap; }
.js .chaos { position: relative; color: transparent; }
.js .chaos::after { content: attr(data-show); position: absolute; left: 0; top: 0; color: var(--muted); }
.scroll-hint {
  position: absolute; left: var(--gutter); bottom: 28px; margin: 0;
  font: 500 .7rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
.scroll-hint::before { content: ""; display: inline-block; width: 34px; height: 1px; background: var(--accent); vertical-align: middle; margin-right: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px;
  border-radius: 2px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text); text-decoration: none;
  font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .1em;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { border-color: var(--text); background: var(--text); color: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Faixa de números */
.band { padding: 0; }
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.grid.cols-4 { gap: 1px; background: var(--border); border: 1px solid var(--border); grid-template-columns: repeat(2, 1fr); }
.band .grid.cols-4 { border-width: 0 1px; }
@media (min-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg); padding: clamp(18px, 2.6vw, 34px); min-width: 0; }
.stat b { display: block; font: 400 clamp(2.2rem, 4.4vw, 3.6rem)/1 var(--serif); letter-spacing: -.02em; margin-bottom: 10px; }
.stat span { display: block; color: var(--muted); font: 500 .7rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .08em; }

/* Seção em duas colunas: título à esquerda, texto à direita */
@media (min-width: 900px) {
  .split > .wrap { display: grid; grid-template-columns: 5fr 7fr; column-gap: 56px; }
  .split > .wrap > .eyebrow { grid-column: 1 / -1; }
  .split > .wrap > h2 { grid-column: 1; grid-row: 2 / span 20; }
  .split > .wrap > :not(.eyebrow):not(h2) { grid-column: 2; }
}

/* Cartões */
.card {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--border); border-radius: 2px; padding: clamp(20px, 2.4vw, 30px);
}
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.card dl { margin: 0; }
.card dt { font: 500 .68rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 16px; }
.card dd { margin: 4px 0 0; }
.sub-title { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 64px 0 18px; }

/* Experiência */
.timeline { margin-top: 36px; border-bottom: 1px solid var(--border); }
.job { border-top: 1px solid var(--border); padding: 30px 0; display: grid; gap: 10px; }
.job .date { font: 500 .74rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; padding-top: 4px; }
.job h3 { font: 400 clamp(1.5rem, 2.6vw, 2rem)/1.15 var(--serif); margin-bottom: 12px; }
@media (min-width: 900px) { .job { grid-template-columns: 5fr 7fr; column-gap: 56px; } }
ul.check { list-style: none; padding: 0; margin: 8px 0 0; }
ul.check li { position: relative; padding-left: 1.6em; margin: 8px 0; color: var(--muted); }
ul.check li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-size: .85em; }

.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.tags li { font: 500 .72rem var(--mono); color: var(--muted); }
.tags li::before { content: "#"; color: var(--accent); opacity: .7; }

/* Stack */
.stack-grid { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); }
@media (min-width: 760px) { .stack-grid { grid-template-columns: repeat(2, 1fr); } }
.stack-group { background: var(--bg); padding: clamp(20px, 2.6vw, 32px); }
.stack-group h3 { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chip { font: 500 .78rem var(--mono); padding: 5px 10px; border-radius: 2px; border: 1px dashed var(--border); color: var(--muted); }
.chip.used { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; font: 500 .72rem var(--mono); color: var(--muted); margin: 0 0 28px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px; border: 1px dashed var(--muted); }
.legend i.used { border: 1px solid var(--accent); background: var(--accent-soft); }

/* Projeto em destaque */
.badge {
  display: inline-flex; align-items: center; gap: 8px; font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .12em;
  padding: 5px 10px; border-radius: 2px; border: 1px dashed var(--border); color: var(--muted); margin-bottom: 18px;
}
.badge.live { border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); background: var(--accent-soft); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.feature-title { font-size: clamp(3rem, 9vw, 7.5rem); line-height: .95; margin-bottom: 24px; }
.feature .card { margin-top: 16px; }
.feature .card h3 { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 14px; }

.pipeline { margin: 40px 0 16px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 86%, transparent); padding: 20px; overflow-x: auto; border-radius: 2px; }
.pipeline svg { display: block; min-width: 680px; width: 100%; }
.pipeline .node rect { fill: var(--bg); stroke: var(--border); rx: 2px; }
.pipeline .node.hl rect { fill: var(--accent-soft); stroke: var(--accent); }
.pipeline text { fill: var(--text); font: 600 12px var(--mono); }
.pipeline text.sub { fill: var(--muted); font: 400 10px var(--mono); }
.pipeline .edge { stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-dasharray: 4 4; animation: flow 1s linear infinite; }
.pipeline marker path { fill: var(--accent); }
.pipeline .edge-label { fill: var(--accent); font: 600 10px var(--mono); }
@keyframes flow { to { stroke-dashoffset: -8; } }

/* Números ao vivo do Órbita */
[hidden] { display: none !important; }
.live { margin: 40px 0 16px; }
.live .badge { margin: 0 0 12px; }
.live .stat b { color: var(--accent); font-variant-numeric: tabular-nums; }
.live + .grid { margin-top: 0; }

/* Próximos projetos */
.road-grid { margin-top: 40px; }
.road-grid .card { display: flex; flex-direction: column; }
.road-grid .card h3 { font: 400 1.6rem/1.15 var(--serif); }
.road-grid .card .tags { margin-top: auto; padding-top: 20px; }
.road-grid .badge { align-self: flex-start; }

/* Contato */
.contact h2 { font-size: clamp(3rem, 10vw, 8.5rem); line-height: .92; margin-bottom: 28px; }
.mail { display: inline-block; font: 400 clamp(1.4rem, 3.6vw, 2.6rem)/1.2 var(--serif); text-decoration: underline; text-decoration-thickness: 1px; margin-top: 12px; overflow-wrap: anywhere; }

footer { padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font: 500 .7rem var(--mono); letter-spacing: .06em; }

/* Entrada das seções */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* Estudo de caso */
.case section { padding: clamp(40px, 6vw, 72px) 0; }
.case .hero { min-height: 0; padding: clamp(56px, 9vw, 110px) 0 clamp(40px, 6vw, 72px); }
.case .hero h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); max-width: 18ch; }
.case h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.case .toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.case .toc a { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 6px 10px; border: 1px solid var(--border); border-radius: 2px; text-decoration: none; color: var(--muted); }
.case .toc a:hover { color: var(--accent); border-color: var(--accent); }
.case p, .case li { max-width: 72ch; color: var(--muted); }
.case .lead { max-width: 62ch; }
.case li { margin: 8px 0; }
.case li::marker { color: var(--accent); }
table { border-collapse: collapse; width: 100%; font: 400 .84rem var(--mono); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 2px; background: var(--surface); max-width: 72ch; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tr.hl td { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.case .callout { border-left: 2px solid var(--accent); background: var(--surface); padding: 14px 18px; margin: 20px 0; color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pipeline .edge, .badge.live::before { animation: none; }
}
