:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --muted: #7b808b;
  --line: #e2e0d8;
  --grid: rgba(22, 24, 29, 0.045);
  --accent: #c2571a;
  --accent-soft: rgba(194, 87, 26, 0.1);
  --signal: #1f8a5b;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --max: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --surface: #16191e;
    --ink: #eceae4;
    --ink-2: #b4b7bf;
    --muted: #80858f;
    --line: #262a31;
    --grid: rgba(236, 234, 228, 0.035);
    --accent: #f08a4b;
    --accent-soft: rgba(240, 138, 75, 0.12);
    --signal: #4fd18f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1114;
  --surface: #16191e;
  --ink: #eceae4;
  --ink-2: #b4b7bf;
  --muted: #80858f;
  --line: #262a31;
  --grid: rgba(236, 234, 228, 0.035);
  --accent: #f08a4b;
  --accent-soft: rgba(240, 138, 75, 0.12);
  --signal: #4fd18f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
strong { font-weight: 600; color: var(--ink); }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: 16px; top: -60px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip:focus { top: 12px; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.mark {
  font: 500 18px var(--mono); text-decoration: none; letter-spacing: -0.02em;
}
.mark span { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
.nav nav { display: flex; gap: 22px; margin-left: auto; }
.nav nav a {
  font: 400 14px var(--mono); color: var(--ink-2); text-decoration: none;
}
.nav nav a:hover { color: var(--accent); }
.theme {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.theme:hover { border-color: var(--accent); }
.theme svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .i-moon { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme .i-moon { display: block; }
}

/* hero */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center;
  padding-top: 96px; padding-bottom: 96px;
}
.eyebrow { font: 400 13px var(--mono); color: var(--muted); margin: 0 0 18px; }
.hero h1 { font-size: clamp(42px, 7vw, 68px); font-weight: 700; letter-spacing: -0.035em; }
.role { font-size: clamp(18px, 2.4vw, 22px); color: var(--accent); font-weight: 500; margin: 14px 0 22px; }
.lede { color: var(--ink-2); max-width: 54ch; margin: 0 0 32px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; height: 42px; padding: 0 18px;
  border-radius: 8px; background: var(--ink); color: var(--bg);
  font: 500 14px var(--sans); text-decoration: none;
  border: 1px solid var(--ink); transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* stack figure */
.stack {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 20px 40px -24px rgba(0,0,0,.25);
}
.stack figcaption {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  font: 400 12px var(--mono); color: var(--muted);
}
.dot-live { display: inline-flex; align-items: center; gap: 7px; }
.dot-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal);
  box-shadow: 0 0 0 0 var(--signal); animation: ping 2s ease-out infinite;
}
.stack ol { list-style: none; margin: 0; padding: 10px 0; position: relative; }
.stack ol::before {
  content: ""; position: absolute; left: 30px; top: 22px; bottom: 22px; width: 1px; background: var(--line);
}
.stack ol::after {
  content: ""; position: absolute; left: 27px; top: 22px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: travel 6s ease-in-out infinite;
}
.stack li {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline;
  padding: 11px 18px 11px 48px; position: relative;
  animation: lit 6s ease-in-out infinite; animation-delay: calc(var(--i) * 0.5s);
}
.stack li::before {
  content: ""; position: absolute; left: 27px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--muted);
}
.layer { font: 500 13px var(--mono); color: var(--accent); }
.tech { font-size: 14px; color: var(--ink-2); }

/* sections */
.section { padding-top: 72px; padding-bottom: 24px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 32px;
}
.idx { font: 500 13px var(--mono); color: var(--accent); }
.section-head h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }

.tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font: 400 12px var(--mono); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: var(--bg);
}

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li {
  display: grid; grid-template-columns: 150px 1fr; gap: 24px;
  padding: 22px 0; border-bottom: 1px dashed var(--line);
}
.timeline > li:last-child { border-bottom: 0; }
.timeline time { font: 400 14px var(--mono); color: var(--muted); padding-top: 2px; }
.timeline h3 { font-size: 18px; font-weight: 600; }
.at { color: var(--accent); font-weight: 500; white-space: nowrap; }
.at::before { content: "@ "; font-family: var(--mono); font-size: .85em; color: var(--muted); }
.timeline p { margin: 8px 0 0; color: var(--ink-2); max-width: 68ch; }

/* projects */
.filter { margin-left: auto; display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.filter button {
  font: 400 13px var(--mono); color: var(--ink-2); background: none; border: 0;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.filter button:hover { color: var(--ink); }
.filter button.on { background: var(--ink); color: var(--bg); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; display: flex; flex-direction: column;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card[hidden] { display: none; }
.kind { font: 400 12px var(--mono); color: var(--accent); margin: 0 0 8px; text-transform: lowercase; }
.card h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.card > p:not(.kind):not(.links) { color: var(--ink-2); font-size: 15px; margin: 10px 0 0; }
.card .tags { margin-top: auto; padding-top: 16px; }
.links { margin: 14px 0 0; display: flex; gap: 16px; font: 500 13px var(--mono); }
.links a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }
.links a::after { content: " \2197"; color: var(--accent); }
.links a:hover { color: var(--accent); }
.links a.int::after { content: " \2192"; }
.card.feature { grid-column: span 2; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card.feature h3 { font-size: 22px; }
.links { flex-wrap: wrap; }

/* no ar agora */
.head-link { margin-left: auto; font: 400 13px var(--mono); color: var(--ink-2); text-decoration: none; }
.head-link::after { content: " \2197"; color: var(--accent); }
.head-link:hover { color: var(--accent); }
.live-lede { color: var(--ink-2); margin: -12px 0 18px; max-width: 70ch; }
.live { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.live li {
  display: grid; grid-template-columns: 14px 1fr auto auto; gap: 16px; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.live li:last-child { border-bottom: 0; }
.live strong { display: block; font-size: 16px; font-weight: 600; }
.live div span { font: 400 12px var(--mono); color: var(--muted); }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .5; }
.live .dot.up { background: var(--signal); opacity: 1; box-shadow: 0 0 0 0 var(--signal); animation: ping 2s ease-out infinite; }
.live .dot.down { background: var(--accent); opacity: 1; }
.live .uptime { font: 400 12px var(--mono); color: var(--ink-2); text-align: right; }
.live .links { margin: 0; }

/* artigos na home */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list a {
  display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px dashed var(--line); text-decoration: none;
}
.article-list li:last-child a { border-bottom: 0; }
.article-list .kind { margin: 0; }
.article-list strong { font-size: 17px; font-weight: 600; }
.article-list a:hover strong { color: var(--accent); }

/* tcc */
.tcc {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 36px;
}
.tcc-text { position: relative; z-index: 1; }
.tcc h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; max-width: 26ch; }
.tcc p { color: var(--ink-2); margin: 14px 0 0; }
.metrics { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; align-self: start; position: relative; z-index: 1; }
.metrics div { background: var(--surface); padding: 18px; }
.metrics dt { font: 400 12px var(--mono); color: var(--muted); }
.metrics dd { margin: 6px 0 0; font: 600 30px var(--sans); letter-spacing: -0.03em; color: var(--ink); }
.metrics small { font-size: 15px; color: var(--muted); margin-left: 2px; font-weight: 500; }

.systolic {
  position: absolute; right: -40px; bottom: -40px; z-index: 0;
  display: grid; grid-template-columns: repeat(8, 14px); gap: 6px; opacity: .55;
  transform: rotate(-8deg);
}
.systolic span {
  width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line);
  animation: wave 3.2s ease-in-out infinite; animation-delay: calc(var(--d) * 0.12s);
}

/* contact */
.contact { padding: 8px 0 24px; }
.contact-lede { color: var(--ink-2); max-width: 56ch; margin: 0 0 18px; }
.email {
  display: inline-block; font: 600 clamp(22px, 4.4vw, 40px) var(--sans); letter-spacing: -0.03em;
  text-decoration: none; border-bottom: 2px solid var(--accent); word-break: break-all;
}
.email:hover { color: var(--accent); }
.contact-links { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 24px; }
.contact-links a { font: 500 14px var(--mono); text-decoration: none; color: var(--ink-2); }
.contact-links a::after { content: " \2197"; color: var(--accent); }
.contact-links a:hover { color: var(--accent); }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 64px; padding-top: 22px; padding-bottom: 32px; border-top: 1px solid var(--line);
  font: 400 12px var(--mono); color: var(--muted);
}
.footer p { margin: 0; }

/* reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes travel {
  0%, 100% { top: 22px; }
  50% { top: calc(100% - 29px); }
}
@keyframes lit {
  0%, 30%, 100% { background: transparent; }
  8%, 14% { background: var(--accent-soft); }
}
@keyframes wave {
  0%, 60%, 100% { background: transparent; border-color: var(--line); }
  20% { background: var(--accent-soft); border-color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 56px; padding-bottom: 56px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .tcc { grid-template-columns: 1fr; padding: 26px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav nav { display: none; }
  .theme { margin-left: auto; }
  .grid { grid-template-columns: 1fr; }
  .card.feature { grid-column: auto; }
  .live li { grid-template-columns: 14px 1fr; row-gap: 6px; }
  .live .uptime, .live .links { grid-column: 2; text-align: left; }
  .head-link { margin-left: 0; }
  .timeline > li { grid-template-columns: 1fr; gap: 6px; }
  .article-list a { grid-template-columns: 1fr; gap: 4px; }
  .stack li { grid-template-columns: 1fr; gap: 0; padding-left: 46px; }
  .filter { margin-left: 0; width: 100%; }
  .filter button { flex: 1; }
  .metrics dd { font-size: 24px; }
  .systolic { display: none; }
}
