:root {
  /* Painel de instrumento noturno: vidro preto, agulha de cobalto viva, latão gasto. */
  --bg:      oklch(0.10 0 0);
  --surface: oklch(0.145 0.008 230);
  --line:    oklch(0.30 0.014 230);
  --hair:    oklch(0.22 0.010 230);
  --ink:     oklch(0.96 0 0);
  --muted:   oklch(0.745 0.014 230);
  --cobalt:  oklch(0.72 0.140 230);
  --brass:   oklch(0.80 0.100 78);

  --sans: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --mono: "Azeret Mono", ui-monospace, "Cascadia Mono", monospace;

  --gut: clamp(1.25rem, 5vw, 4.5rem);
  --wide: 76rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --z-bar: 20;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 1px;
}

.sr-only, .skip {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus-visible {
  position: fixed; top: 0.75rem; left: 0.75rem;
  width: auto; height: auto; margin: 0; padding: 0.6rem 0.9rem;
  clip-path: none; z-index: calc(var(--z-bar) + 1);
  background: var(--cobalt); color: oklch(0.14 0 0);
  font-family: var(--mono); font-size: 0.8rem;
}

/* ── barra ────────────────────────────────────────────── */
/* Alinha barra e rodape à mesma coluna do conteúdo, sem wrapper extra:
   recua até a borda da coluna centrada, nunca menos que a goteira. */
.bar, .foot { --pad: max(var(--gut), calc((100% - var(--wide)) / 2)); }
/* Na nota técnica a coluna é mais estreita; a barra acompanha. */
html:has(.prose) { --wide: 44rem; }

.bar {
  position: sticky; top: 0; z-index: var(--z-bar);
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.85rem var(--pad);
  border-bottom: 1px solid var(--hair);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
}
.bar__id { font-weight: 500; }
.bar__meta { color: var(--muted); margin-right: auto; }
@media (max-width: 34rem) { .bar__meta { display: none; } .bar__id { margin-right: auto; } }

.lang { display: flex; gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.lang button {
  font: inherit; letter-spacing: inherit;
  padding: 0.28rem 0.55rem; border: 0; cursor: pointer;
  background: var(--bg); color: var(--muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--cobalt); color: oklch(0.14 0 0); }

/* ── hero ─────────────────────────────────────────────── */
.hero {
  padding: clamp(4rem, 13vh, 8.5rem) var(--gut) clamp(2.5rem, 6vh, 4rem);
  max-width: var(--wide);
  margin-inline: auto;
}
h1 {
  font-size: clamp(2.1rem, 1.1rem + 4.4vw, 4.75rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.032em;
  max-width: 18ch;
}
.hero__sub {
  margin: 1.75rem 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
}
.hero__act { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-top: 2.5rem; }

.cta {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  background: var(--cobalt);
  color: oklch(0.13 0 0);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--cobalt), 0 8px 30px -12px var(--cobalt); }
.cta--lg {
  padding: 1.05rem 1.9rem;
  font-size: clamp(0.9rem, 0.8rem + 0.6vw, 1.15rem);
  margin-top: 2rem;
}
.ghost {
  font-family: var(--mono); font-size: 0.82rem;
  color: var(--muted); text-decoration: none;
  border-bottom: 1px solid var(--line); padding-bottom: 2px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.ghost:hover { color: var(--ink); border-color: var(--cobalt); }

/* ── diagrama ─────────────────────────────────────────── */
.diagram { padding: 0 var(--gut) clamp(3.5rem, 8vh, 6rem); max-width: var(--wide); margin-inline: auto; }
.diagram figure { margin: 0; }
/* Conteúdo largo rola dentro do próprio container; a página nunca rola lateral. */
.diagram__scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--hair);
  background: color-mix(in oklab, var(--surface) 45%, var(--bg));
}
.diagram svg { display: block; width: 100%; min-width: 46rem; height: auto; color: var(--hair); }

.grid { stroke: currentColor; stroke-width: 1; opacity: 0.55; }
.rail path { fill: none; stroke: var(--line); stroke-width: 1; }
.flow path {
  fill: none; stroke: var(--cobalt); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 26 460;
  animation: pulse 4.6s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
.flow path:nth-child(2) { animation-delay: 0.5s; }
.flow path:nth-child(3) { animation-delay: 1s; }
.flow path:nth-child(4) { animation-delay: 1.5s; }
.flow path:nth-child(5) { animation-delay: 2.5s; stroke: var(--brass); }
.flow path:nth-child(6) { animation-delay: 2.8s; stroke: var(--brass); }
.flow path:nth-child(7) { animation-delay: 3.1s; stroke: var(--brass); }
@keyframes pulse {
  0%   { stroke-dashoffset: 486; opacity: 0; }
  8%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.node--core rect { fill: color-mix(in oklab, var(--cobalt) 12%, var(--surface)); stroke: var(--cobalt); }
.node--agent rect { stroke: color-mix(in oklab, var(--brass) 45%, var(--line)); }
.port rect { fill: var(--cobalt); }

.tick path { stroke: color-mix(in oklab, var(--cobalt) 60%, transparent); stroke-width: 1; fill: none; }

.cap {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  fill: color-mix(in oklab, var(--muted) 75%, var(--bg));
}
.lbl { font-family: var(--mono); font-size: 13px; fill: var(--ink); }
.lbl--core { font-size: 15px; font-weight: 500; }
.lbl--dim { fill: var(--muted); font-size: 12px; }
.diagram figcaption {
  margin-top: 1.25rem; max-width: 64ch;
  color: var(--muted); font-size: 0.9rem;
}

/* ── seções ───────────────────────────────────────────── */
section h2 {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.readout, .offer, .track, .end, .note {
  padding: clamp(3rem, 7vh, 5rem) var(--gut);
  max-width: var(--wide);
  margin-inline: auto;
}

/* código: a prova legível */
pre {
  margin: 1.5rem 0;
  padding: 1.15rem 1.35rem;
  overflow-x: auto;
  background: color-mix(in oklab, var(--surface) 70%, var(--bg));
  border: 1px solid var(--hair);
  border-top: 1px solid color-mix(in oklab, var(--cobalt) 45%, var(--hair));
}
pre code { font-size: 0.82rem; line-height: 1.75; color: var(--ink); white-space: pre; }
code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: color-mix(in oklab, var(--cobalt) 78%, var(--ink));
}

.note p { max-width: 68ch; color: var(--muted); }
.note p:first-of-type { margin-top: 1.5rem; }
.note__more { margin-top: 1.75rem; }
.note__more a {
  font-family: var(--mono); font-size: 0.82rem;
  color: var(--cobalt); text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--cobalt) 40%, transparent);
  padding-bottom: 2px;
}
.note__more a:hover { border-color: var(--cobalt); }

.track__lead { max-width: 68ch; color: var(--muted); margin: 1.5rem 0 2rem; }


/* nota técnica (página própria) */
.prose { max-width: 44rem; margin-inline: auto; padding: clamp(3rem, 9vh, 5.5rem) var(--gut) 4rem; }
.prose h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3rem);
  font-weight: 600; letter-spacing: -0.028em; line-height: 1.08;
}
.prose h2 {
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.35rem);
  margin: 3rem 0 0; padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.prose p { color: var(--muted); margin: 1.15rem 0 0; }
.prose__lead { font-size: 1.1rem; color: var(--ink) !important; margin-top: 1.75rem !important; }
.prose__back { margin-top: 3.5rem; font-family: var(--mono); font-size: 0.82rem; }
.prose__back a, .foot a { color: var(--cobalt); text-decoration: none; }
a.bar__id { text-decoration: none; }

/* leitura de instrumento */
.readout dl { margin: 0; }
.readout div {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) 1fr;
  gap: 0 2rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--hair);
}
.readout dt {
  font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding-top: 0.18rem;
}
.readout dd { margin: 0; font-size: 0.98rem; }
.readout dd a { color: var(--cobalt); text-underline-offset: 3px; }
.readout .live { color: var(--brass); display: flex; align-items: center; gap: 0.6rem; }
.readout .live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass); animation: blink 2.6s var(--ease) infinite;
}
@keyframes blink { 0%, 55%, 100% { opacity: 1; } 70% { opacity: 0.25; } }
@media (max-width: 40rem) {
  .readout div { grid-template-columns: 1fr; gap: 0.3rem; padding: 0.85rem 0; }
}

/* oferta */
.offer ul { list-style: none; margin: 0; padding: 0; }
.offer li { padding: 1.75rem 0; border-bottom: 1px solid var(--hair); }
.offer h3 {
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  font-weight: 600; letter-spacing: -0.01em;
}
.offer p { margin: 0.6rem 0 0; max-width: 68ch; color: var(--muted); }

/* trajetória */
.track ol { list-style: none; margin: 0; padding: 0; }
.track li {
  display: grid;
  grid-template-columns: 6.5rem minmax(7rem, 10rem) 1fr;
  gap: 0 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
}
.track__y { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.track__c { font-weight: 600; }
.track__r { color: var(--muted); font-size: 0.93rem; }
@media (max-width: 44rem) {
  .track li { grid-template-columns: 5.5rem 1fr; }
  .track__r { grid-column: 2; }
}

/* fecho */
.end h2 { border-bottom: 0; padding-bottom: 0; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); letter-spacing: -0.025em; }
.end p { color: var(--muted); margin: 1rem 0 0; max-width: 52ch; }
.links { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-top: 3rem; }
.links a {
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
  text-decoration: none; transition: color 0.2s var(--ease);
}
.links a:hover { color: var(--cobalt); }

.foot {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between;
  padding: 1.6rem var(--pad); border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .flow path { stroke-dasharray: none; opacity: 0.55; }
}
