/* iaJus landing — visual system (dark codex, gold accent). Shared by index.html,
   cobertura.html and integracoes.html. Progressive enhancement via html.js / html.vt
   classes set inline in <head>; everything degrades to a static, readable page. */

:root {
  /* Ink & paper — a legal codex at night */
  --bg: #080b14;
  --bg-2: #0b101d;
  --bg-3: #0e1424;
  --ink: #f2f0e9;          /* warm parchment white */
  --ink-soft: #d7dae4;
  --muted: #98a2bd;
  --muted-2: #868fa8;   /* AA-safe on dark (≥5.6:1) — used for small mono labels & placeholders */
  --gold: #e6bf63;
  --gold-bright: #f3d488;
  --gold-soft: #c9a227;
  --indigo: #6f74f2;
  --sky: #57c7f5;
  --rule: rgba(230, 191, 99, 0.22);
  --hair: rgba(255, 255, 255, 0.09);
  --card: rgba(255, 255, 255, 0.028);
  --card-strong: rgba(255, 255, 255, 0.05);
  --err: #f6a6a0;
  --ok: var(--gold-bright);
  --maxw: 1200px;
  --gutter: clamp(20px, 5vw, 56px);
  /* Family palette — used by the donut + legend + family chips */
  --fam-superiores: #e6bf63;
  --fam-tjs: #6f74f2;
  --fam-trfs: #57c7f5;
  --fam-trts: #5fd0a6;
  --fam-tres: #d98ad9;
  --fam-tcs: #f0a36a;
  --fam-administrativo: #c08bf0;
  --fam-turmas_recursais: #8fb4e6;
  --fam-default: #9aa6c2;
  /* Fluid type scale */
  --step-eyebrow: clamp(0.72rem, 0.68rem + 0.2vw, 0.82rem);
  --step-body: clamp(1.02rem, 0.97rem + 0.4vw, 1.22rem);
  --step-h2: clamp(1.9rem, 1.3rem + 2.6vw, 3.1rem);
  --step-h3: clamp(1.18rem, 1.05rem + 0.6vw, 1.4rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--bg);
  font-size: var(--step-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: rgba(230, 191, 99, 0.28); color: #fff; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Accessibility: focus + skip link ---- */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: 6px;
}
.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--gold); color: #1a1405; font-weight: 600;
  font-family: 'Spline Sans Mono', ui-monospace, monospace;
  padding: 11px 18px; border-radius: 10px; text-decoration: none;
  font-size: 0.85rem; transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

/* ---- Atmosphere: aurora + parchment grain + ledger rules ---- */
.bg-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.aurora { overflow: hidden; }
.aurora::before, .aurora::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(130px); opacity: 0.55;
}
.aurora::before {
  width: 760px; height: 760px; top: -300px; left: -200px;
  background: radial-gradient(circle, rgba(111,116,242,0.42), transparent 70%);
}
.aurora::after {
  width: 680px; height: 680px; bottom: -320px; right: -180px;
  background: radial-gradient(circle, rgba(230,191,99,0.30), transparent 70%);
}
.ledger {
  background-image:
    linear-gradient(90deg, transparent calc(var(--gutter) - 1px), rgba(230,191,99,0.10) calc(var(--gutter) - 1px), rgba(230,191,99,0.10) var(--gutter), transparent var(--gutter));
  mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 92%, transparent 100%);
  opacity: 0.6;
}
.grain {
  opacity: 0.045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.inline-link { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.inline-link:hover { border-bottom-color: var(--gold); }
.code-key {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.92em;
  color: var(--gold-bright); background: rgba(230,191,99,0.10);
  border: 1px solid var(--rule); border-radius: 6px; padding: 2px 7px;
}

/* ---- Reveal: progressive enhancement only (html.js + motion ok) ---- */
.js .reveal { opacity: 0; transform: translateY(22px); }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity .8s cubic-bezier(.22,.61,.36,1), transform .8s cubic-bezier(.22,.61,.36,1);
}
.js .reveal.in[data-d="1"] { transition-delay: .08s; }
.js .reveal.in[data-d="2"] { transition-delay: .16s; }
.js .reveal.in[data-d="3"] { transition-delay: .24s; }
.js .reveal.in[data-d="4"] { transition-delay: .32s; }

/* =========================================================
   NAV — sticky, with mobile toggle
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--hair);
  background: rgba(8, 11, 20, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  transition: box-shadow .25s ease, background .25s ease;
}
.topbar.scrolled { box-shadow: 0 18px 40px -28px rgba(0,0,0,0.9); background: rgba(8, 11, 20, 0.9); }
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 16px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand b {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.42rem;
  letter-spacing: -0.015em; line-height: 1;
}
.brand b span { color: var(--gold); }
.brand small {
  display: block; font-family: 'Spline Sans Mono', monospace; font-size: 0.6rem;
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px;
}
.nav-right { display: flex; align-items: center; gap: 22px; }
.nav-link {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--muted); text-decoration: none; transition: color .2s ease;
}
.nav-link:hover, .nav-link.active { color: var(--gold); }
.nav-link.nav-cta {
  color: var(--gold); border: 1px solid var(--rule); padding: 8px 15px; border-radius: 999px;
  background: rgba(230,191,99,0.05);
}
.nav-link.nav-cta:hover { background: rgba(230,191,99,0.12); }
.nav-tag {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted-2); border: 1px solid var(--hair);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.nav-toggle {
  display: none; flex-direction: column; gap: 5px; cursor: pointer;
  background: transparent; border: 1px solid var(--hair); border-radius: 10px;
  padding: 10px 11px; width: 44px; height: 44px;
}
.nav-toggle-bar { display: block; width: 20px; height: 2px; background: var(--ink-soft); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-right {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(11, 16, 29, 0.98);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hair);
    padding: 8px var(--gutter) 20px;
    max-height: 0; overflow: hidden; opacity: 0; visibility: hidden;
    transition: max-height .3s ease, opacity .25s ease, visibility .25s;
  }
  .nav-right.open { max-height: 70vh; opacity: 1; visibility: visible; }
  .nav-link { padding-block: 14px; border-bottom: 1px solid var(--hair); font-size: 0.92rem; }
  .nav-link.nav-cta { margin-top: 12px; text-align: center; border-radius: 12px; }
  .nav-tag { display: none; }
}

/* =========================================================
   HERO — asymmetric editorial split
   ========================================================= */
header { position: relative; z-index: 1; padding-block: clamp(48px, 7vw, 96px) clamp(36px, 5vw, 64px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 72px); align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: 'Spline Sans Mono', monospace;
  font-size: var(--step-eyebrow); letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold); font-weight: 500; margin-bottom: 24px;
}
.eyebrow::before { content: ""; width: 34px; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); }
h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 500;
  font-size: clamp(2.5rem, 1.4rem + 5.2vw, 5rem); line-height: 1.02;
  letter-spacing: -0.025em; text-wrap: balance; margin-bottom: 26px;
}
h1 .hl { color: var(--gold); font-style: italic; font-weight: 500; }
h1 .hl::after {
  content: ""; display: block; height: 2px; margin-top: 6px;
  background: linear-gradient(90deg, var(--gold), transparent);
  transform-origin: left; transform: scaleX(0);
}
.js h1 .hl::after { animation: underline 1.1s .5s cubic-bezier(.22,.61,.36,1) forwards; }
@keyframes underline { to { transform: scaleX(1); } }
.lede {
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.32rem); color: var(--ink-soft);
  max-width: 54ch; line-height: 1.68;
}
.lede strong { color: var(--ink); font-weight: 500; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 36px; }

/* Counter — the typographic monument */
.counter-card {
  position: relative;
  border: 1px solid var(--rule); border-radius: 20px;
  padding: clamp(28px, 4vw, 40px) clamp(24px, 3vw, 34px);
  background:
    linear-gradient(165deg, rgba(255,255,255,0.05), rgba(230,191,99,0.035)),
    var(--bg-2);
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
}
.counter-card::before {
  content: "N.º"; position: absolute; top: 16px; right: 20px;
  font-family: 'Spline Sans Mono', monospace; font-size: 0.7rem; letter-spacing: 0.2em;
  color: var(--muted-2);
}
.counter-eyebrow {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
.counter-num {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  font-size: clamp(2.7rem, 1.6rem + 5vw, 4.4rem); line-height: 0.98;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  background: linear-gradient(180deg, #fffdf6 18%, var(--gold) 125%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold);
}
.counter-label { color: var(--muted); font-size: 0.98rem; margin-top: 12px; line-height: 1.5; }
.counter-live {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
  font-family: 'Spline Sans Mono', monospace; font-size: 0.78rem; color: var(--gold);
  padding-top: 16px; border-top: 1px solid var(--hair); width: 100%;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); position: relative; flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--gold); animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .counter-card { max-width: 520px; }
}

/* =========================================================
   ACERVO — family stats strip (juris ∪ legis ∪ doutrina ∪ qualificadas)
   ========================================================= */
.acervo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  border: 1px solid var(--hair); border-radius: 18px; overflow: hidden; background: var(--hair); }
.acervo .stat { background: var(--bg-2); padding: clamp(22px, 3vw, 32px); position: relative; }
.acervo .stat .ic { color: var(--gold); margin-bottom: 14px; display: block; }
.acervo .stat .v {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  font-size: clamp(1.7rem, 1.1rem + 2.2vw, 2.6rem); line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; color: var(--ink);
}
.acervo .stat .k { color: var(--muted); font-size: 0.95rem; margin-top: 8px; line-height: 1.45; }
.acervo .stat .sub { color: var(--muted-2); font-size: 0.82rem; margin-top: 4px;
  font-family: 'Spline Sans Mono', monospace; }
.stats-updated { margin-top: 14px; font-family: 'Spline Sans Mono', monospace;
  font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted-2); }
@media (max-width: 980px) { .acervo { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .acervo { grid-template-columns: 1fr; } }

/* Ontology tree (SVG strokes draw in on reveal) */
.tree-wrap { margin-top: 36px; display: grid; grid-template-columns: 1fr; gap: 16px; }
.ontology-tree { width: 100%; height: auto; max-width: 760px; margin-inline: auto; display: block; }
.ontology-tree .edge {
  fill: none; stroke: var(--rule); stroke-width: 1.6;
  stroke-dasharray: var(--len, 300); stroke-dashoffset: var(--len, 300);
}
.js .ontology-tree.in .edge { animation: draw 1.1s cubic-bezier(.22,.61,.36,1) forwards; }
.js .ontology-tree.in .edge.e2 { animation-delay: .15s; }
.js .ontology-tree.in .edge.e3 { animation-delay: .3s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ontology-tree .node-box { fill: var(--bg-3); stroke: var(--rule); stroke-width: 1.2; }
.ontology-tree .node-root { fill: rgba(230,191,99,0.10); stroke: var(--gold); stroke-width: 1.4; }
.ontology-tree text { font-family: 'Spline Sans Mono', monospace; fill: var(--ink-soft);
  font-size: 12px; letter-spacing: 0.02em; }
.ontology-tree .root-label { fill: var(--gold); font-weight: 600; }
.ontology-tree .node-glow { opacity: 0; }
.js .ontology-tree.in .node-glow { animation: nodefade .6s ease forwards; animation-delay: .9s; }
@keyframes nodefade { to { opacity: 1; } }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: 'Spline Sans Mono', monospace; font-weight: 600; font-size: 0.92rem;
  letter-spacing: 0.02em; text-decoration: none;
  padding: 15px 26px; border-radius: 12px; cursor: pointer; border: 0;
  transition: transform .16s ease, box-shadow .24s ease, background .24s ease, border-color .24s ease, color .24s ease;
}
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(4px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-soft));
  color: #1a1405; box-shadow: 0 16px 38px -14px rgba(230,191,99,0.65);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 48px -14px rgba(230,191,99,0.75); }
.btn-ghost { background: rgba(255,255,255,0.02); color: var(--ink); border: 1px solid var(--hair); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* =========================================================
   MARQUEE — courts ticker (paused on reduced motion / hover)
   ========================================================= */
.marquee {
  position: relative; z-index: 1; border-block: 1px solid var(--hair);
  padding-block: 18px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex; gap: 0; width: max-content; align-items: center;
  animation: marquee 46s linear infinite;
}
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee .item {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.86rem; letter-spacing: 0.04em;
  color: var(--muted); padding-inline: 26px; white-space: nowrap; display: inline-flex; gap: 9px;
}
.marquee .item b { color: var(--ink); font-weight: 600; }
.marquee .item::after { content: "·"; color: var(--gold); margin-left: 17px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================
   SECTIONS
   ========================================================= */
section.block { padding-block: clamp(48px, 7vw, 88px); position: relative; z-index: 1; }
.sec-head { max-width: 64ch; }
.kicker {
  display: inline-flex; align-items: baseline; gap: 12px;
  font-family: 'Spline Sans Mono', monospace; color: var(--gold);
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
}
.kicker .idx { color: var(--muted-2); }
h2 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: var(--step-h2);
  letter-spacing: -0.02em; line-height: 1.08; margin: 16px 0 18px; text-wrap: balance;
}
.intro { color: var(--muted); max-width: 62ch; font-size: 1.1rem; line-height: 1.66; }
.intro strong { color: var(--ink); font-weight: 500; }

/* Feature grid — index-numbered ledger entries */
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 44px;
  border: 1px solid var(--hair); border-radius: 20px; overflow: hidden; background: var(--hair); }
.feature {
  background: var(--bg-2); padding: clamp(26px, 3vw, 36px);
  position: relative; transition: background .25s ease;
}
.feature:hover { background: var(--bg-3); }
.feature .num {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.74rem; letter-spacing: 0.16em;
  color: var(--muted-2); margin-bottom: 18px;
}
.feature .ic {
  width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(230,191,99,0.10); color: var(--gold); margin-bottom: 18px;
  border: 1px solid var(--rule);
}
.feature h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: var(--step-h3); margin-bottom: 10px; }
.feature p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }

/* "What's coming" — numbered editorial list */
.roadmap { margin-top: 40px; display: grid; gap: 1px; border-top: 1px solid var(--hair); }
.road-item {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(18px, 3vw, 40px);
  align-items: start; padding-block: clamp(22px, 3vw, 34px);
  border-bottom: 1px solid var(--hair); transition: padding-left .25s ease;
}
.road-item:hover { padding-left: 8px; }
.road-item .step {
  font-family: 'Fraunces', Georgia, serif; font-style: italic; font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--gold); line-height: 1; min-width: 1.6ch;
}
.road-item h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: var(--step-h3); margin-bottom: 7px; }
.road-item p { color: var(--muted); font-size: 1.02rem; max-width: 60ch; }

/* Coverage chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; list-style: none; }
.chip {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.84rem; color: var(--muted);
  border: 1px solid var(--hair); padding: 8px 15px; border-radius: 999px;
  background: rgba(255,255,255,0.018); transition: border-color .2s ease, color .2s ease;
}
.chip:hover { border-color: var(--rule); color: var(--ink); }
.chip strong { color: var(--ink); font-weight: 600; }

/* =========================================================
   STATS REGION — interactive corpus explorer
   ========================================================= */
.stats-region { margin-top: 40px; }
.stats-region[data-stats-state="loading"] .stats-error,
.stats-region[data-stats-state="loading"] .stats-content,
.stats-region[data-stats-state="error"] .stats-skeleton,
.stats-region[data-stats-state="error"] .stats-content,
.stats-region[data-stats-state="ready"] .stats-skeleton,
.stats-region[data-stats-state="ready"] .stats-error { display: none; }

/* Skeleton */
.stats-skeleton { display: grid; gap: 18px; }
.sk { border-radius: 16px; background:
  linear-gradient(100deg, var(--bg-2) 30%, var(--bg-3) 50%, var(--bg-2) 70%);
  background-size: 220% 100%; }
.js .sk { animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }
.sk-bars { height: 220px; border: 1px solid var(--hair); }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sk-card { height: 220px; border: 1px solid var(--hair); }
@media (max-width: 760px) { .sk-grid { grid-template-columns: 1fr; } }

/* Error */
.stats-error { border: 1px solid var(--hair); border-radius: 16px; background: var(--bg-2);
  padding: 32px; text-align: center; }
.stats-error p { color: var(--muted); margin-bottom: 18px; }

/* Loaded grid */
.stats-content { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.chart-card {
  background: var(--bg-2); border: 1px solid var(--hair); border-radius: 18px;
  padding: clamp(22px, 3vw, 30px);
}
.chart-span { grid-column: 1 / -1; }
.chart-head { margin-bottom: 22px; }
.chart-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.chart-head h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.32rem; }
.chart-sub { color: var(--muted-2); font-size: 0.86rem; margin-top: 4px;
  font-family: 'Spline Sans Mono', monospace; letter-spacing: 0.02em; }
@media (max-width: 760px) { .stats-content { grid-template-columns: 1fr; } }

/* Year histogram */
.histo { display: flex; align-items: flex-end; gap: clamp(4px, 1vw, 10px); height: 200px; }
.histo .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.histo .bar-track { width: 100%; display: flex; align-items: flex-end; flex: 1; }
.histo .bar {
  width: 100%; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-soft));
  height: 0; transition: height .9s cubic-bezier(.22,.61,.36,1);
  min-height: 3px;
}
.histo .bar-col:hover .bar { filter: brightness(1.12); }
.histo .bar-val { font-family: 'Spline Sans Mono', monospace; font-size: 0.62rem; color: var(--muted); white-space: nowrap; }
.histo .bar-yr { font-family: 'Spline Sans Mono', monospace; font-size: 0.66rem; color: var(--muted-2); }
@media (max-width: 560px) { .histo .bar-val { display: none; } .histo { height: 160px; } }

/* Family donut */
.donut-wrap { display: grid; grid-template-columns: 168px 1fr; gap: 22px; align-items: center; }
.donut { width: 168px; height: 168px; transform: rotate(-90deg); }
.donut-hole { fill: none; stroke: var(--bg-3); stroke-width: 4.2; }
.donut .seg { fill: none; stroke-width: 4.2; stroke-linecap: butt;
  stroke-dasharray: 0 100; transition: stroke-dasharray 1s cubic-bezier(.22,.61,.36,1); }
.donut-center { transform: rotate(90deg); transform-origin: 21px 21px; }
.donut-center-num { font-family: 'Fraunces', serif; font-weight: 600; font-size: 5.4px; fill: var(--ink); text-anchor: middle; }
.donut-center-lbl { font-family: 'Spline Sans Mono', monospace; font-size: 2.1px; fill: var(--muted-2); text-anchor: middle; letter-spacing: 0.04em; }
.donut-legend { list-style: none; display: grid; gap: 9px; }
.donut-legend li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-soft); }
.donut-legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.donut-legend .lg-name { flex: 1; }
.donut-legend .lg-val { font-family: 'Spline Sans Mono', monospace; font-size: 0.8rem; color: var(--muted); }
.donut-legend .lg-pct { font-family: 'Spline Sans Mono', monospace; font-size: 0.72rem; color: var(--muted-2); min-width: 3.4ch; text-align: right; }
@media (max-width: 480px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }

/* Órgão explorer */
.explorer-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.explorer-search {
  width: clamp(180px, 40vw, 280px); padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--hair); background: rgba(0,0,0,0.32); color: var(--ink);
  font-family: 'Spline Sans Mono', monospace; font-size: 0.82rem;
}
.explorer-search::placeholder { color: var(--muted-2); }
.explorer-search:focus:not(:focus-visible) { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,191,99,0.18); }
.explorer-sort { display: inline-flex; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; }
.sort-btn {
  background: transparent; border: 0; cursor: pointer; color: var(--muted);
  font-family: 'Spline Sans Mono', monospace; font-size: 0.74rem; letter-spacing: 0.04em;
  padding: 10px 14px; transition: background .2s ease, color .2s ease;
}
.sort-btn + .sort-btn { border-left: 1px solid var(--hair); }
.sort-btn.is-active { background: rgba(230,191,99,0.12); color: var(--gold); }
.orgao-list { list-style: none; display: grid; gap: 4px; max-height: 440px; overflow-y: auto; padding-right: 6px; }
.orgao-list li { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px;
  padding: 9px 6px; border-radius: 8px; transition: background .18s ease; }
.orgao-list li:hover { background: var(--bg-3); }
.orgao-list .o-name { font-family: 'Spline Sans Mono', monospace; font-size: 0.82rem; color: var(--ink); }
.orgao-list .o-fam { font-size: 0.66rem; color: var(--muted-2); display: block; letter-spacing: 0.04em; }
@media (max-width: 420px) { .orgao-list li { grid-template-columns: minmax(56px, 88px) 1fr auto; gap: 8px; } }
.orgao-list .o-bar { height: 8px; border-radius: 4px; background: var(--gold-soft); min-width: 4px;
  transition: width .8s cubic-bezier(.22,.61,.36,1); }
.orgao-list .o-val { font-family: 'Spline Sans Mono', monospace; font-size: 0.8rem; color: var(--muted); text-align: right; }
.orgao-empty { color: var(--muted-2); font-family: 'Spline Sans Mono', monospace; font-size: 0.84rem; padding: 12px 6px; }

/* Rank lists (relatores / turmas) */
.rank-list { list-style: none; display: grid; gap: 10px; }
.rank-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.rank-list .r-idx { font-family: 'Spline Sans Mono', monospace; font-size: 0.74rem; color: var(--gold); min-width: 2ch; }
.rank-list .r-body { min-width: 0; }
.rank-list .r-name { font-size: 0.96rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-list .r-meta { font-family: 'Spline Sans Mono', monospace; font-size: 0.68rem; color: var(--muted-2); }
.rank-list .r-track { height: 6px; border-radius: 3px; background: var(--bg-3); margin-top: 6px; overflow: hidden; }
.rank-list .r-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); width: 0; transition: width .8s cubic-bezier(.22,.61,.36,1); }
.rank-list .r-val { font-family: 'Spline Sans Mono', monospace; font-size: 0.82rem; color: var(--muted); }

/* Qualificadas chips */
.kind-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kind-grid li { border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px; background: var(--bg-3); }
.kind-grid .kd-val { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.4rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.kind-grid .kd-name { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }

/* =========================================================
   INTEGRATIONS
   ========================================================= */
.integrations { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.intg-card {
  background: var(--bg-2); border: 1px solid var(--hair); border-radius: 16px;
  padding: 26px 24px; transition: transform .2s ease, border-color .25s ease, background .25s ease;
}
.intg-card:hover { transform: translateY(-3px); border-color: var(--rule); background: var(--bg-3); }
.intg-mark { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255,255,255,0.04); color: var(--ink-soft); margin-bottom: 16px; border: 1px solid var(--hair); }
.intg-card h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.22rem; margin-bottom: 8px; }
.intg-card p { color: var(--muted); font-size: 0.94rem; line-height: 1.55; margin-bottom: 16px; }
.intg-badge {
  font-family: 'Spline Sans Mono', monospace; font-size: 0.66rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); border: 1px solid var(--hair);
  padding: 5px 11px; border-radius: 999px;
}
.intg-soon { border-style: dashed; border-color: var(--rule); }
.intg-soon .intg-mark { color: var(--gold); background: rgba(230,191,99,0.06); }
.intg-badge-soon { color: var(--gold); border-color: var(--rule); background: rgba(230,191,99,0.06); }
.intg-celeris { background: linear-gradient(165deg, rgba(111,116,242,0.10), rgba(230,191,99,0.04)), var(--bg-2); border-color: var(--rule); }
.intg-celeris .intg-mark { color: var(--gold-bright); background: rgba(230,191,99,0.10); }
.intg-badge-celeris { color: var(--gold-bright); border-color: var(--rule); background: rgba(230,191,99,0.08); }
.integ-note { margin-top: 30px; color: var(--muted); font-size: 1rem; max-width: 70ch; }
.integ-note strong { color: var(--ink); }
@media (max-width: 980px) { .integrations { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .integrations { grid-template-columns: 1fr; } }

/* =========================================================
   NOTIFY / forms
   ========================================================= */
.notify {
  margin-block: clamp(40px, 6vw, 72px) 0;
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 120% at 12% 0%, rgba(111,116,242,0.14), transparent 55%),
    radial-gradient(120% 120% at 92% 100%, rgba(230,191,99,0.10), transparent 55%),
    var(--bg-2);
  border: 1px solid var(--rule); border-radius: 26px;
  padding: clamp(36px, 5vw, 64px) clamp(24px, 4vw, 56px); text-align: center;
}
.notify .seal {
  width: 52px; height: 52px; margin: 0 auto 22px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--rule); color: var(--gold);
  background: rgba(230,191,99,0.06);
}
.notify h2 { margin-bottom: 12px; }
.notify .intro { margin-inline: auto; }
form { margin-top: 30px; }
.fields { display: flex; gap: 12px; max-width: 580px; margin-inline: auto; flex-wrap: wrap; text-align: left; }
.field { flex: 1; min-width: 200px; }
.field.email { flex: 1.35; }
label {
  display: block; font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; font-weight: 500;
}
label .opt { color: var(--muted-2); text-transform: none; letter-spacing: 0; }
input, textarea {
  width: 100%; padding: 15px 17px; border-radius: 12px;
  border: 1px solid var(--hair); background: rgba(0,0,0,0.32); color: var(--ink);
  font-size: 1.02rem; font-family: 'Newsreader', Georgia, serif;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus:not(:focus-visible), textarea:focus:not(:focus-visible) { outline: none; border-color: var(--gold); background: rgba(0,0,0,0.42); box-shadow: 0 0 0 3px rgba(230,191,99,0.18); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 3px rgba(246,166,160,0.15); }
.submit-row { margin-top: 20px; }
button[type="submit"] { min-width: 230px; justify-content: center; }
button[type="submit"][aria-busy="true"] { opacity: 0.85; cursor: progress; }
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(26,20,5,0.35); border-top-color: #1a1405;
  animation: spin .7s linear infinite; display: none;
}
button[aria-busy="true"] .spinner { display: inline-block; }
button[aria-busy="true"] .btn-label { opacity: 0.85; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-msg {
  margin-top: 20px; font-family: 'Spline Sans Mono', monospace; font-size: 0.92rem;
  font-weight: 500; min-height: 1.4em;
  display: none; align-items: center; justify-content: center; gap: 9px;
}
.form-msg.show { display: flex; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.privacy { font-family: 'Spline Sans Mono', monospace; color: var(--muted-2); font-size: 0.78rem; margin: 18px auto 0; max-width: 48ch; line-height: 1.5; }

@media (max-width: 620px) {
  .fields { flex-direction: column; }
  .field, .field.email { flex: 1 1 100%; }
  button[type="submit"] { width: 100%; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; }
}

/* =========================================================
   FOOTER
   ========================================================= */
footer { border-top: 1px solid var(--hair); padding-block: 48px 64px; margin-top: clamp(56px, 8vw, 96px); color: var(--muted-2); position: relative; z-index: 1; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: clamp(24px, 4vw, 56px); padding-bottom: 32px; border-bottom: 1px solid var(--hair); }
.foot-brand { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.96rem; }
.foot-brand svg { width: 30px; height: 30px; flex: none; }
.foot-brand strong { color: var(--ink-soft); font-weight: 500; }
.foot-tagline { color: var(--muted-2); font-size: 0.92rem; margin-top: 14px; max-width: 42ch; line-height: 1.55; }
.foot-links { display: flex; flex-direction: column; gap: 11px; }
.foot-links h4 { font-family: 'Spline Sans Mono', monospace; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 5px; font-weight: 500; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 0.92rem; transition: color .2s ease; }
.foot-links a:hover { color: var(--gold); }
.foot-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 26px; }
footer small { font-family: 'Spline Sans Mono', monospace; color: var(--muted-2); font-size: 0.78rem; letter-spacing: 0.02em; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand-col { grid-column: 1 / -1; } }
@media (max-width: 480px) { .foot-grid { grid-template-columns: 1fr; } .foot-row { flex-direction: column; text-align: center; } }

/* =========================================================
   COBERTURA / INTEGRAÇÕES standalone-page header
   ========================================================= */
.page-head { padding-block: clamp(40px, 6vw, 72px) clamp(20px, 3vw, 36px); }
.page-head .back { font-family: 'Spline Sans Mono', monospace; font-size: 0.76rem; color: var(--muted); text-decoration: none; letter-spacing: 0.04em; }
.page-head .back:hover { color: var(--gold); }
.page-head h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.6rem); margin: 18px 0 16px; }

/* =========================================================
   REDUCED MOTION — disable all non-essential motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none !important; }
  h1 .hl::after { transform: scaleX(1) !important; }
}

/* View Transitions — gentle cross-fade between same-page anchors */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
}
