/* Funnel chart — vanilla port of FunnelChart + PatternLines (horizontal) */

.funnel-chart {
  position: relative;
  width: 100%;
  overflow: visible;
  user-select: none;
  aspect-ratio: var(--funnel-aspect-w, 2.2) / var(--funnel-aspect-h, 1);
  margin-top: 10px;
  min-height: 0;
}

.funnel-chart__canvas {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.funnel-chart__bands,
.funnel-chart__gridlines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}

.funnel-chart__segments {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: visible;
  gap: var(--funnel-gap, 4px);
}

.funnel-segment {
  position: relative;
  flex-shrink: 0;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.33, 1, 0.68, 1);
}

.funnel-chart.has-hover .funnel-segment:not(.is-hovered) {
  opacity: 0.4;
}

.funnel-segment.is-hovered {
  z-index: 10;
  opacity: 1 !important;
}

.funnel-segment__grow {
  position: absolute;
  inset: 0;
  overflow: visible;
  transform: scaleX(0) scaleY(0);
  transform-origin: left center;
  transition:
    transform 0.62s cubic-bezier(0.2, 0.75, 0.2, 1),
    opacity 0.28s cubic-bezier(0.33, 1, 0.68, 1);
}

.funnel-chart--in .funnel-segment__grow {
  transform: scaleX(1) scaleY(1);
}

.funnel-segment svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.funnel-ring path {
  transform-origin: center center;
  transform-box: fill-box;
  transition: transform 0.38s cubic-bezier(0.34, 1.2, 0.64, 1);
  --ring-boost: 0;
}

.funnel-segment.is-hovered .funnel-ring path {
  transform: scaleY(calc(1 + var(--ring-boost, 0)));
}

.funnel-chart__labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.funnel-label {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.28s cubic-bezier(0.33, 1, 0.68, 1);
}

.funnel-chart.has-hover .funnel-label:not(.is-hovered) {
  opacity: 0.4;
}

.funnel-label.is-hovered {
  opacity: 1 !important;
}

/* spread layout: valor arriba, % centro, etapa abajo */
.funnel-label__top {
  flex: 0 0 18%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}

.funnel-label__mid {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.funnel-label__bot {
  flex: 0 0 18%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
}

.funnel-label__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.funnel-label__pct {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 1px 3px rgba(28, 18, 8, 0.12);
  font-family: 'Geist Mono', ui-monospace, monospace;
}

.funnel-label__stage {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  padding: 0 2px;
}

.funnel-chart--in .funnel-label__inner {
  opacity: 1;
}

.funnel-label__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.38s ease-out;
  transition-delay: var(--funnel-lbl-delay, 0s);
}

.panel--funnel .panel__foot {
  margin-top: 12px;
  font-size: 10.5px;
  color: var(--fg-4);
  letter-spacing: 0.06em;
  text-transform: none;
}
