/* ─────────────────────────────────────────────
   BLOCO 4 — MECANISMO
   Continua dark ink. Headline serif gigante white.
   Box central com pílulas (instituições) trocando gráfico de barras horizontais.
   Auto-rotate 6s. Hover revela detalhe. Callout terracota mono.
   ───────────────────────────────────────────── */

.mecanismo {
  position: relative;
  background: var(--ink);
  color: var(--text-on-ink);
  padding: clamp(80px, 10vw, 140px) 0;
  overflow: hidden;
  isolation: isolate;
}

/* Mesh atmosférico animado lento (12s loop) */
.mecanismo::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(124, 58, 237, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(20, 184, 166, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(226, 82, 45, 0.14) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
  animation: meshDrift 18s ease-in-out infinite alternate;
  filter: blur(40px);
  opacity: 0.85;
}

@keyframes meshDrift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.02); }
  50%  { transform: translate3d(2%, 3%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 4%, 0) scale(1.04); }
}

.mecanismo__eyebrow {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--terracota);
  margin-bottom: 22px;
}

.mecanismo__eyebrow::before {
  content: "● ";
  color: var(--terracota);
}

.mecanismo h2 {
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(40px, 5.4vw, 84px);
  font-weight: 380;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--text-on-ink);
  max-width: 980px;
  margin: 0 auto 18px;
}

.mecanismo h2 .serif-italic {
  background: linear-gradient(120deg, #B388FF 0%, var(--terracota) 90%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mecanismo__sub {
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: rgba(251, 250, 247, 0.55);
  max-width: 540px;
  margin: 0 auto 64px;
}

/* ─── Box central ─────────────────────── */

.slider {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  background: rgba(10, 10, 18, 0.6);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 3.5vw, 44px);
  box-shadow:
    0 24px 60px -20px rgba(0, 0, 0, 0.5),
    0 1px 0 0 rgba(255, 255, 255, 0.05) inset;
}

.slider__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.slider__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(251, 250, 247, 0.55);
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider__title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55);
  animation: pulse 2.4s ease-out infinite;
}

.slider__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(251, 250, 247, 0.35);
}

/* Pílulas instituições */
.slider__pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.slider__pill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(251, 250, 247, 0.55);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 200ms, background 200ms, border-color 200ms, box-shadow 200ms;
  white-space: nowrap;
}

.slider__pill:hover {
  color: var(--text-on-ink);
  background: rgba(255, 255, 255, 0.08);
}

.slider__pill.is-active {
  color: var(--text-on-ink);
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 16px -2px rgba(124, 58, 237, 0.5);
}

/* Gráfico de barras horizontais */
.slider__chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 56px;
  align-items: center;
  gap: 18px;
  position: relative;
  cursor: default;
}

.bar-row__lbl {
  font-size: 14px;
  font-weight: 450;
  color: rgba(251, 250, 247, 0.85);
  letter-spacing: -0.005em;
}

.bar-row__bar {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.bar-row__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--purple) 0%, #B388FF 80%, rgba(255, 255, 255, 0.92) 100%);
  border-radius: 999px;
  transition: width 800ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 14px -2px rgba(124, 58, 237, 0.5);
}

.bar-row:first-child .bar-row__fill {
  background: linear-gradient(90deg, var(--terracota) 0%, #FF8A5C 80%, rgba(255, 255, 255, 0.95) 100%);
  box-shadow: 0 0 14px -2px rgba(226, 82, 45, 0.5);
}

.bar-row__val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-on-ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tooltip de detalhe ao hover */
.bar-row__tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 130px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.bar-row:hover .bar-row__tip {
  opacity: 1;
  transform: translateY(0);
}

/* Callout mono abaixo do gráfico */
.slider__callout {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: rgba(251, 250, 247, 0.65);
  text-align: center;
}

.slider__callout strong {
  color: var(--terracota);
  font-weight: 500;
}

/* Ring de auto-rotate (visual sutil indicando próximo trigger) */
.slider__ring {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider__ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.slider__ring circle {
  fill: none;
  stroke-width: 1.5;
}

.slider__ring circle.track {
  stroke: rgba(255, 255, 255, 0.08);
}

.slider__ring circle.progress {
  stroke: var(--purple);
  stroke-dasharray: 88;
  stroke-dashoffset: 88;
  transition: stroke-dashoffset 6000ms linear;
}

.slider__ring.is-running circle.progress {
  stroke-dashoffset: 0;
}

/* ─── Responsivo ─────────────────────── */

@media (max-width: 720px) {
  .slider {
    padding: 24px 18px;
  }
  .slider__pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 18px;
    margin-bottom: 22px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .slider__pills::-webkit-scrollbar { display: none; }
  .bar-row {
    grid-template-columns: 96px 1fr 44px;
    gap: 12px;
  }
  .bar-row__lbl {
    font-size: 13px;
  }
  .bar-row__tip {
    left: 0;
  }
  .slider__head {
    margin-bottom: 18px;
  }
  .slider__hint {
    display: none;
  }
}
