/* ================================================
   Funnel Chart Visualization
   ================================================ */
.funnel-visualization {
    display: flex;
    gap: var(--spacing-2xl);
    justify-content: center;
    flex-wrap: wrap;
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-xl);
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    /* No overflow: hidden here so labels can stick out if needed, 
       but funnel container handles animation overflow */
}

.funnel-container {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    text-align: center;
    position: relative;
    padding-bottom: 20px;
}

.funnel-container h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text);
    font-weight: 700;
}

/* Base Funnel Shape */
.funnel {
    display: flex;
    flex-direction: column;
    gap: 1px;
    /* Tiny gap for visual separation */
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 300px;
    /* Fixed Unified Height */
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    /* Clips the layers to the trapezoid shape */
}

/* Flow Animation Overlay */
.funnel::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 30%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.1) 70%,
            transparent 100%);
    transform: rotate(0deg);
    animation: flowDown 3s infinite linear;
    pointer-events: none;
    z-index: 10;
}

@keyframes flowDown {
    0% {
        transform: translateY(-50%);
    }

    100% {
        transform: translateY(50%);
    }
}

.layer {
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-sm);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    /* Allow text and arrow to stack */
    align-items: center;
    justify-content: center;
    font-weight: 500;
    position: relative;
    width: 100%;
    flex: 1;
    /* Distribute height equally */
    transition: opacity 0.3s ease;
}

/* Internal Arrow for flow indication */
.layer:not(:last-child)::after {
    content: '↓';
    font-size: 0.8rem;
    line-height: 1;
    opacity: 0.6;
    margin-top: 2px;
    display: block;
}

.layer:hover {
    filter: brightness(1.1);
}

/* SEO Funnel - Sharp Drop (Narrow Bottom) */
/* Top: 100%, Bottom: 40% (Widened to fit text) */
.seo-funnel {
    clip-path: polygon(0 0, 100% 0, 70% 100%, 30% 100%);
}

.seo-funnel .layer-1 {
    opacity: 0.5;
}

.seo-funnel .layer-2 {
    opacity: 0.7;
}

.seo-funnel .layer-3 {
    opacity: 0.85;
}

.seo-funnel .layer-4 {
    opacity: 1;
    background: var(--color-secondary);
    font-weight: bold;
    /* Ensure text doesn't wrap awkwardly */
    white-space: nowrap;
}

/* GEO Funnel - High Conversion (Wide Bottom) */
/* Top: 100%, Bottom: 80% */
.geo-funnel {
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

.geo-funnel .layer-1 {
    opacity: 0.5;
}

.geo-funnel .layer-2 {
    opacity: 0.7;
}

.geo-funnel .layer-3 {
    opacity: 0.85;
}

.geo-funnel .layer-4 {
    opacity: 1;
    background: var(--color-secondary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .funnel-visualization {
        flex-direction: column;
        align-items: center;
    }

    .funnel-container {
        width: 100%;
        margin-bottom: var(--spacing-xl);
    }
}