/* ========= Design tokens ========= */
.eafe-fun-counter {
    /* sizing */
    --factor-gap: clamp(20px, 5vw, 30px);
    --icon-size: clamp(40px, 10vw, 60px);
    --icon-color: #000000;

    /* colors (light) */
    --bg: hsl(210 40% 98%);
    --surface: hsl(0 0% 100% / 0.7);
    --text: hsl(222 47% 11%);
    --muted: hsl(215 16% 45%);
    --shadow: 0 10px 30px hsl(220 40% 2% / 0.08);

    --font: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Inter,Arial,sans-serif;
}

.eafe-fun-counter-dark {
    /* Dark mode */
    --bg: hsl(222 22% 10%);
    --surface: hsl(222 18% 14% / 0.6);
    --text: hsl(0 0% 100%);
    --muted: hsl(218 11% 65%);
    --shadow: 0 10px 30px hsl(0 0% 0% / 0.45);
}

/* ========= Page background ========= */
.eafe-fun-counter-with-bg {
    background:
            radial-gradient(80rem 40rem at 15% -10%, hsl(254 82% 66% / .10), transparent 60%),
            radial-gradient(70rem 40rem at 95% 10%, hsl(199 89% 48% / .10), transparent 60%),
            var(--bg);
}

/* ========= Layout wrapper ========= */
.eafe-fun-counter {
    max-width: min(1100px, 95vw);
    margin: clamp(32px, 6vw, 72px) auto;
    padding: clamp(16px, 3vw, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--factor-gap);
    position: relative;
    backdrop-filter: blur(6px);
    font-family: var(--font);
    color: var(--text);
}

.eafe-fun-counter--vertical {
    flex-direction: column;
    align-items: center;
}

.eafe-fun-counter--grid {
    flex-wrap: wrap;
    justify-content: center;
}

/* each factor = icon + number + title */
.eafe-factor {
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
    padding: clamp(16px, 3vw, 24px);
    border-radius: 12px;
    background: linear-gradient(color-mix(in srgb, var(--factor-accent-color, #33484e) 10%, var(--surface)), var(--surface));
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, filter 0.25s ease;
    position: relative;
}

.eafe-fun-counter--grid .eafe-factor {
    flex: 0 0 calc(33.33% - var(--factor-gap));
    margin-bottom: var(--factor-gap);
}

@media (hover:hover) {
    .eafe-factor:hover {
        transform: translateY(-4px);
        filter: drop-shadow(0 10px 20px hsl(220 40% 2% / 0.12));
    }
}

/* ========= Icon/Image container ========= */
.eafe-factor-icon {
    width: var(--icon-size);
    height: var(--icon-size);
    margin: 0 auto clamp(12px, 3vw, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    color: var(--icon-color, currentColor) !important;
}

.eafe-factor-icon img,
.eafe-factor-icon svg,
.eafe-factor-icon i {
    width: calc(var(--icon-size) * 0.6);
    height: calc(var(--icon-size) * 0.6);
    object-fit: contain;
}

/* Ensure icon color is applied via Elementor selectors */
.eafe-factor-icon i {
    color: inherit !important;
}

/* SVG Color Fixes */
.eafe-factor-icon svg {
    fill: currentColor !important;
    color: currentColor !important;
    stroke: currentColor !important;
}

.eafe-factor-icon svg path {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.eafe-factor-icon svg circle {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.eafe-factor-icon svg rect {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.eafe-factor-icon svg polygon {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.eafe-factor-icon svg g {
    fill: currentColor !important;
    stroke: currentColor !important;
}

/* Specific selector for Elementor icons */
.eafe-factor-icon .eicon,
.eafe-factor-icon .elementor-icon {
    color: currentColor !important;
    fill: currentColor !important;
}

@media (hover:hover) {
    .eafe-factor-icon:hover {
        transform: scale(1.1);
    }
}

/* Number and Title */
.eafe-factor-number {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    color: var(--factor-accent-color, #33484e);
    margin: 0 0 clamp(8px, 2vw, 12px);
    line-height: 1.2;
}

.eafe-factor-title {
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

/* ========= Medium screens ========= */
@media (max-width: 992px) and (min-width: 769px) {
    .eafe-fun-counter--horizontal {
        flex-wrap: wrap;
        justify-content: center;
    }
    .eafe-fun-counter--horizontal .eafe-factor {
        flex: 0 0 calc(50% - var(--factor-gap));
        margin-bottom: var(--factor-gap);
    }
    .eafe-fun-counter--grid .eafe-factor {
        flex: 0 0 calc(50% - var(--factor-gap));
    }
}

/* ========= Mobile: stack vertically ========= */
@media (max-width: 768px) {
    .eafe-fun-counter--horizontal,
    .eafe-fun-counter--vertical {
        flex-direction: column;
        align-items: center;
        gap: clamp(20px, 6vw, 40px);
    }
    .eafe-fun-counter--grid {
        flex-direction: column;
        align-items: center;
    }
    .eafe-factor {
        width: 100%;
        max-width: 300px;
    }
}

/* ========= Small mobile ========= */
@media (max-width: 480px) {
    .eafe-fun-counter {
        gap: 20px;
    }
    .eafe-factor-icon {
        width: clamp(60px, 15vw, 80px);
        height: clamp(60px, 15vw, 80px);
    }
    .eafe-factor-icon img,
    .eafe-factor-icon svg,
    .eafe-factor-icon i {
        width: clamp(36px, 9vw, 48px);
        height: clamp(36px, 9vw, 48px);
    }
    .eafe-factor-number {
        font-size: clamp(20px, 4vw, 28px);
    }
    .eafe-factor-title {
        font-size: clamp(14px, 2.5vw, 16px);
    }
}

/* Focus styles for accessibility */
.eafe-factor:focus-within {
    outline: 2px solid var(--factor-accent-color, #33484e);
    outline-offset: 2px;
}

/* Active state on click */
.eafe-factor-active {
    transform: scale(1.05);
    box-shadow: 0 12px 24px hsl(220 40% 2% / 0.2);
}