/* ═══════════════════════════════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════════════════════════════ */

.hero {
  position: relative;
  min-height: 100vh;
  padding-top: calc(var(--nav-h) + 40px);
  padding-bottom: 80px;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at 30% 40%, rgba(0,0,0,0.9) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, rgba(0,0,0,0.9) 0%, transparent 70%);
}
.hero__map {
  position: absolute;
  top: 50%; right: -8%;
  transform: translateY(-50%);
  width: min(1320px, 95vw);
  aspect-ratio: 1000 / 912;
  opacity: 0.95;
}
.hero__map svg { width: 100%; height: 100%; display: block; overflow: visible; }
.hero__cursor {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(125,124,217,0.28) 0%, rgba(125,124,217,0) 65%);
  transform: translate(-50%, -50%);
  transition: opacity 300ms var(--ease-std);
  opacity: 0;
}

.hero__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 64px;
  align-items: center;
}

.hero__copy { max-width: 640px; }

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-emphasis);
  margin-bottom: 28px;
}
.hero__badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
@keyframes hero-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero__title {
  font-size: clamp(34px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 24px;
  overflow-wrap: break-word;
}
.hero__title-accent {
  color: var(--text-secondary);
  font-weight: 400;
}

.hero__sub {
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.55;
  color: var(--text-body);
  max-width: 540px;
  margin-bottom: 36px;
}

.hero__ctas { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Hero card (3 variants: request | diagram | combo) ───── */
.hero__card {
  background: linear-gradient(180deg, rgba(20,22,28,0.88) 0%, rgba(10,11,15,0.94) 100%);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,0.6);
  overflow: hidden;
}

/* Variant gating — show/hide sub-blocks based on [data-hero-card] on <html> */
.hero-diagram, .hero-sample { display: none; }
:root[data-hero-card="request"] .hero-sample { display: flex; }
:root[data-hero-card="diagram"] .hero-diagram { display: flex; }
:root[data-hero-card="combo"]   .hero-diagram,
:root[data-hero-card="combo"]   .hero-sample { display: flex; }
:root[data-hero-card="combo"]   .hero-diagram { border-bottom: 1px solid var(--line-1); }

/* Sensible default when no attr set */
:root:not([data-hero-card]) .hero-sample { display: flex; }

/* ── Architecture diagram ────────────────────────────────── */
.hero-diagram {
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}
.hero-diagram__head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.hero-diagram__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 8px rgba(125,124,217,0.6);
  animation: hero-diagram-pulse 2.4s ease-in-out infinite;
}
.hero-diagram__label { color: var(--text-emphasis); }
.hero-diagram__meta {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}

@keyframes hero-diagram-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.hero-diagram__stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* ── Nodes ─────────────────────────────────────────────── */
.hero-diagram__node {
  padding: 14px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--bg-elev-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.hero-diagram__node-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.hero-diagram__node--proxy {
  border-color: rgba(125,124,217,0.4);
  background: linear-gradient(180deg, rgba(125,124,217,0.10) 0%, rgba(125,124,217,0.02) 100%);
  box-shadow: 0 0 0 1px rgba(125,124,217,0.1) inset, 0 8px 24px -12px rgba(125,124,217,0.35);
  padding: 16px 14px 18px;
}
.hero-diagram__node-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.hero-diagram__node--proxy .hero-diagram__node-title {
  color: var(--accent-purple-2);
}
.hero-diagram__node-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hero-diagram__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.hero-diagram__badges span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2.5px 7px;
  border-radius: 3px;
  color: var(--accent-purple-2);
  background: rgba(125,124,217,0.10);
  border: 1px solid rgba(125,124,217,0.25);
  letter-spacing: 0.04em;
}

/* ── Connecting wire (replaces .hero-diagram__arrow) ─────── */
.hero-diagram__wire {
  height: 56px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
/* dashed rail */
.hero-diagram__wire::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background-image: linear-gradient(
    to bottom,
    transparent 0, transparent 3px,
    var(--line-3) 3px, var(--line-3) 7px
  );
  background-size: 1px 7px;
  transform: translateX(-50%);
}
.hero-diagram__wire-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-elev-1);
  padding: 0 10px;
  position: relative;
  z-index: 2;
}
/* moving signal packets — down (request) and up (response) */
.hero-diagram__wire-packet {
  position: absolute;
  left: 50%;
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-purple-2);
  box-shadow: 0 0 12px var(--accent-purple-2), 0 0 4px #fff;
  transform: translateX(-50%);
  animation: hero-diagram-packet-down 2.4s linear infinite;
  will-change: top, opacity;
}
.hero-diagram__wire-packet--up {
  animation: hero-diagram-packet-up 2.4s linear infinite;
  animation-delay: 1.2s;
  background: var(--accent-purple);
}
@keyframes hero-diagram-packet-down {
  0%   { top: -2px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: calc(100% + 2px); opacity: 0; }
}
@keyframes hero-diagram-packet-up {
  0%   { top: calc(100% + 2px); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: -2px; opacity: 0; }
}

/* ── Live trace bar inside the Cumbuca proxy node ─────────── */
.hero-diagram__trace {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.hero-diagram__trace-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(74,222,128,0.55);
}
.hero-diagram__trace-text {
  text-transform: uppercase;
}
.hero-diagram__trace-meter {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.hero-diagram__trace-meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--accent-purple-2) 50%, transparent 100%);
  width: 30%;
  left: -30%;
  animation: hero-diagram-meter 2s linear infinite;
}
@keyframes hero-diagram-meter {
  0%   { left: -30%; }
  100% { left: 100%; }
}
.hero-diagram__trace-val {
  color: var(--text-emphasis);
}

/* ── Sample request / response ────────────────────────────── */
.hero-sample {
  flex-direction: column;
  min-width: 0;
}
.hero-sample__tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--line-1);
}
.hero-sample__tab {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px 8px;
  margin-bottom: -1px;
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  transition: color 160ms var(--ease-std), border-color 160ms var(--ease-std);
}
.hero-sample__tab:hover { color: var(--text-emphasis); }
.hero-sample__tab.is-active {
  color: var(--text-heading);
  border-bottom-color: var(--accent-data);
}
.hero-sample__endpoint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  padding: 0 4px 8px;
}

.hero-sample__pane {
  display: none;
  padding: 14px 16px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-body);
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.hero-sample__pane.is-active { display: block; }
.hero-sample__pane code { font-family: inherit; color: inherit; }

.hs-cmt  { color: var(--text-dim); font-style: normal; }
.hs-cmd  { color: var(--accent-purple-2); font-weight: 500; }
.hs-str  { color: #b8ffd5; }
.hs-key  { color: #a5b4fc; }
.hs-num  { color: var(--accent-data); }

.hero-sample__foot {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line-1);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.hero-sample__foot-item { display: flex; align-items: center; gap: 6px; }
.hero-sample__foot-item--muted { color: var(--text-dim); margin-left: auto; }
.hero-sample__foot-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(74,222,128,0.5);
}

/* ── Scroll hint ─────────────────────────────────────────── */
.hero__scroll {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero__scroll svg { width: 14px; height: 24px; opacity: 0.6; }

/* ── Brazil map — dot mesh + ripple (drawn by JS) ─ */
.hero__map { cursor: crosshair; pointer-events: auto; }

.hero__map .br-silhouette { transition: fill 300ms var(--ease-std); }
.hero__map .br-outline    { transition: stroke 300ms var(--ease-std); }

/* Base mesh dot — fills Brazil interior */
.hero__map circle.br-dot {
  fill: rgba(155, 152, 236, 0.42);
  transition: fill 200ms var(--ease-std);
}
/* Hubs — brighter & larger, read as "Pix endpoints" */
.hero__map circle.br-dot.is-hub {
  fill: var(--accent-purple);
  opacity: 0.9;
}

/* Per-dot pulse — JS adds .is-pulsing with a delay so it ripples from click origin.
   Animation uses only fill + transform (GPU-cheap). Drop-shadow is deliberately
   avoided — with 100+ dots active per wavefront, filter: drop-shadow() quickly
   saturates the GPU and causes visible jank. The brighter fill + scale alone
   already reads as a pulse. */
.hero__map circle.br-dot.is-pulsing {
  animation: br-dot-pulse 550ms var(--ease-std) 1;
  will-change: transform, fill;
}
.hero__map circle.br-dot.is-hub.is-pulsing {
  animation: br-dot-pulse-hub 550ms var(--ease-std) 1;
}

@keyframes br-dot-pulse {
  0%   { fill: rgba(155, 152, 236, 0.42); transform: scale(1); }
  32%  { fill: rgba(210, 208, 255, 1);    transform: scale(2.1); }
  100% { fill: rgba(155, 152, 236, 0.42); transform: scale(1); }
}
@keyframes br-dot-pulse-hub {
  0%   { fill: var(--accent-purple); transform: scale(1); }
  32%  { fill: #dcdaff;              transform: scale(1.8); }
  100% { fill: var(--accent-purple); transform: scale(1); }
}
.hero__map circle.br-dot {
  transform-box: fill-box;
  transform-origin: center;
}

/* Expanding ring from click point */
.hero__map circle.br-ripple-ring {
  fill: none;
  stroke: var(--accent-purple);
  stroke-width: 1.5;
  opacity: 0.9;
  animation: br-ripple 1.6s var(--ease-out) 1;
  pointer-events: none;
}
@keyframes br-ripple {
  0%   { r: 2;   opacity: 0.9;  stroke-width: 1.8; }
  100% { r: 280; opacity: 0;    stroke-width: 0.4; }
}

.hero__map .br-hit { cursor: crosshair; }

@media (max-width: 900px) {
  .hero { padding-top: calc(var(--nav-h) + 24px); padding-bottom: 56px; }
  .hero__inner { grid-template-columns: 1fr; gap: 32px; padding: 0 20px; }
  .hero__map { right: -10%; width: 110vw; opacity: 0.28; max-width: none; }
  .hero__scroll { display: none; }
}
@media (max-width: 560px) {
  .hero__title { font-size: clamp(30px, 8.5vw, 44px); }
  .hero__map { right: -8%; width: 105vw; opacity: 0.22; }
  .hero__inner { padding: 0 16px; }
  .hero-sample__pane { font-size: 10.5px; padding: 12px 14px; }
  .hero-sample__pane::-webkit-scrollbar { height: 4px; }
  .hero-sample__pane::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }
}
