@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/ahn-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/ahn-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --noite: #1d1a24;
  --veludo: #27232f;
  --veludo2: #2e2938;
  --borda: #3a3445;
  --texto: #ece6f5;
  --nevoa: #9a91a8;
  --lilas: #b8a6e6;
  --lacre: #e2557a;
  --ok: #8fd4b4;
  --tinta: #2a2238;
  --papel: #ece6f5;
  --gutter: 20px;
  font-family: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--noite);
  color: var(--texto);
  line-height: 1.55;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lilas); }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 var(--gutter) 80px; }

/* Topo */
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--noite) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
}
.logo { font-weight: 700; letter-spacing: -0.02em; font-size: 1.5rem; text-decoration: none; color: var(--texto); white-space: nowrap; direction: ltr; }
.logo .i { position: relative; display: inline-block; }
.logo .i::before {
  content: '';
  position: absolute; left: 50%; top: 0.02em;
  width: 0.2em; height: 0.2em; margin-left: -0.1em;
  border-radius: 50%;
  background: var(--lilas);
}
.logo .i:nth-of-type(1)::before { opacity: 1; }
.logo .i:nth-of-type(2)::before { opacity: 0.55; }
.logo .i:nth-of-type(3)::before { opacity: 0.2; }
.topnav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-inline-start: auto; }
.topnav a {
  text-decoration: none;
  color: var(--nevoa);
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.topnav a:hover { color: var(--texto); background: var(--veludo); }
.topnav a[aria-current='page'] { color: var(--texto); border-color: var(--borda); }

/* Cabeçalho da página */
.hero { padding: 56px 0 8px; }
.eyebrow { margin: 0 0 10px; color: var(--lilas); font-weight: 700; font-size: 0.875rem; letter-spacing: 0.02em; }
h1 { margin: 0; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; }
.sub { margin: 16px 0 0; font-size: 1.1875rem; color: var(--nevoa); max-width: 40ch; }

h2 { margin: 48px 0 10px; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
h3 { margin: 28px 0 6px; font-size: 1.125rem; }
p { margin: 12px 0; max-width: 64ch; }
.lead { font-size: 1.125rem; }
strong { color: #fff; }
.muted { color: var(--nevoa); }

ul.clean { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 12px; max-width: 64ch; }
ul.clean li { padding-inline-start: 20px; position: relative; color: var(--texto); }
ul.clean li::before { content: ''; position: absolute; inset-inline-start: 0; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--lilas); }
ul.clean li.no::before { background: var(--lacre); }
ul.clean li.yes::before { background: var(--ok); }

code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.9em; background: var(--veludo2); padding: 1px 6px; border-radius: 6px; }

/* Cartões das estatísticas */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.stat { border: 1px solid var(--borda); border-radius: 16px; padding: 18px 16px; background: var(--veludo); text-align: center; }
.stat .num { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .num.live { color: var(--ok); }
.stat .lbl { margin-top: 2px; font-size: 0.875rem; color: var(--nevoa); }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

/* Figuras / diagramas */
figure { margin: 24px 0; }
.diagram {
  border: 1px solid var(--borda);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--veludo) 0%, var(--noite) 140%);
  padding: 20px 14px;
}
.diagram svg { display: block; width: 100%; height: auto; }
figcaption { margin-top: 10px; font-size: 0.9375rem; color: var(--nevoa); }

/* Elementos de SVG estilizados por classe (CSP bloqueia style inline) */
.d-box { fill: var(--veludo2); stroke: var(--borda); stroke-width: 1.5; }
.d-box-key { fill: color-mix(in srgb, var(--lilas) 16%, var(--veludo2)); stroke: var(--lilas); stroke-width: 1.5; }
.d-box-bad { fill: color-mix(in srgb, var(--lacre) 15%, var(--veludo2)); stroke: var(--lacre); stroke-width: 1.5; }
.d-box-srv { fill: var(--noite); stroke: var(--borda); stroke-width: 1.5; stroke-dasharray: 5 4; }
.d-title { fill: var(--texto); font-weight: 700; font-size: 14px; }
.d-text { fill: var(--texto); font-size: 12px; }
.d-sub { fill: var(--nevoa); font-size: 11px; }
.d-key { fill: var(--lilas); font-size: 11px; font-weight: 700; }
.d-bad { fill: var(--lacre); font-size: 11px; font-weight: 700; }
.d-ok { fill: var(--ok); font-size: 11px; font-weight: 700; }
.d-line { stroke: var(--nevoa); stroke-width: 1.6; fill: none; }
.d-line-key { stroke: var(--lilas); stroke-width: 1.8; fill: none; }
.d-line-bad { stroke: var(--lacre); stroke-width: 1.8; fill: none; stroke-dasharray: 5 4; }
.d-fillnevoa { fill: var(--nevoa); }
.d-filllilas { fill: var(--lilas); }
.d-filllacre { fill: var(--lacre); }

/* Seletor de idioma (chip) */
#lang-slot { display: contents; }
.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding-inline: 9px 7px;
  border: 1px solid var(--borda);
  border-radius: 999px;
  background: var(--veludo);
  color: var(--texto);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
}
.lang:hover { border-color: var(--nevoa); background: var(--veludo2); }
.lang:focus-within { outline: 2px solid var(--lilas); outline-offset: 2px; }
.lang svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-globe { width: 15px; height: 15px; color: var(--lilas); }
.lang-chev { width: 13px; height: 13px; color: var(--nevoa); }
.lang-current { white-space: nowrap; }
.lang-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; appearance: none; }
.lang-select option { background: var(--veludo); color: var(--texto); font-weight: 400; }

/* Diagramas ficam sempre da esquerda para a direita, mesmo em árabe */
.diagram, code { direction: ltr; unicode-bidi: isolate; }
:root:lang(ar) { font-family: 'Atkinson Hyperlegible Next', 'SF Arabic', 'Geeza Pro', 'Noto Naskh Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif; }
[dir='rtl'] .topbar { flex-direction: row-reverse; }
[dir='rtl'] .footer { flex-direction: row-reverse; }

.footer { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--borda); color: var(--nevoa); font-size: 0.9375rem; display: flex; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--nevoa); }
.footer a:hover { color: var(--texto); }

@media (max-width: 560px) {
  .topnav { gap: 3px; }
  .topnav a { padding: 6px 9px; font-size: 0.875rem; }
  .hero { padding: 36px 0 8px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
