/* styles/info-counter.css */

.info-counter-section {
    position: relative;
    width: 100%;
    padding: 70px 24px;
    background: #f5f5f5;
    overflow: hidden;
    isolation: isolate;
}

.info-counter-section::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(29, 78, 216, 0.10);
    pointer-events: none;
    z-index: 0;
}

.info-counter-section::after {
    content: "";
    position: absolute;
    bottom: -140px;
    left: -140px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.09);
    pointer-events: none;
    z-index: 0;
}

/* =========================
   Background Flags Layer
========================= */
.info-counter-bg-flags {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.info-counter-bg-flag {
    position: absolute;
    width: 78px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;

    opacity: 0;
    transform: scale(0.3) translateY(20px);
    filter: grayscale(4%) saturate(110%) contrast(108%);
    user-select: none;
    -webkit-user-drag: none;

    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
}

/* Positioning Flags */
.info-counter-bg-flag.flag-1 {
    top: 12%;
    right: 8%;
}

.info-counter-bg-flag.flag-2 {
    top: 10%;
    right: 40%;
}

.info-counter-bg-flag.flag-3 {
    top: 58%;
    right: 5%;
}

.info-counter-bg-flag.flag-4 {
    top: 14%;
    left: 25%;
}

.info-counter-bg-flag.flag-5 {
    top: 50%;
    left: 8%;
}

.info-counter-bg-flag.flag-6 {
    bottom: 8%;
    left: 24%;
}

.info-counter-bg-flag.flag-7 {
    bottom: 10%;
    right: 38%;
}

/* Visible State: Bubble Load + Floating */
.info-counter-section.is-visible .info-counter-bg-flag.flag-1 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.10s forwards,
        bubbleFloat1 4.8s ease-in-out 1.1s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-2 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.22s forwards,
        bubbleFloat2 5.3s ease-in-out 1.22s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-3 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.34s forwards,
        bubbleFloat3 4.5s ease-in-out 1.34s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-4 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.16s forwards,
        bubbleFloat2 5.8s ease-in-out 1.16s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-5 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.28s forwards,
        bubbleFloat1 5.1s ease-in-out 1.28s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-6 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.40s forwards,
        bubbleFloat3 5.6s ease-in-out 1.40s infinite;
}

.info-counter-section.is-visible .info-counter-bg-flag.flag-7 {
    animation:
        bubbleFlagIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.48s forwards,
        bubbleFloat1 4.9s ease-in-out 1.48s infinite;
}

.info-counter-container {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 1180px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.info-counter-item {
    min-height: 210px;
    padding: 0 24px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;

    /* background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.55); */
    border-radius: 28px;

    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.07);

    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);

    opacity: 0;
    transform: translateY(28px);
    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease;
}

.info-counter-section.is-visible .info-counter-item {
    animation: infoCounterFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.info-counter-section.is-visible .info-counter-item:nth-child(1) {
    animation-delay: 0.05s;
}

.info-counter-section.is-visible .info-counter-item:nth-child(2) {
    animation-delay: 0.18s;
}

.info-counter-section.is-visible .info-counter-item:nth-child(3) {
    animation-delay: 0.31s;
}

.info-counter-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.10);
    /* background: rgba(255, 255, 255, 0.60); */
    /* border-color: rgba(255, 255, 255, 0.72); */
}

.info-counter-number {
    direction: ltr;
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
    color: var(--color-primary, #1d4ed8);
    margin-bottom: 18px;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.35);
}

.info-counter-text {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 2;
    color: var(--color-text, #1f2937);
}

.info-counter-inline {
    direction: ltr;
    display: inline-block;
    min-width: 18px;
    color: var(--color-primary, #1d4ed8);
    font-weight: 800;
}

/* Flags inside card */
.info-counter-flags {
    margin-top: 16px;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;

    padding-bottom: 4px;

    scrollbar-width: thin;
    scrollbar-color: rgba(29, 78, 216, 0.35) transparent;
}

.info-counter-flags::-webkit-scrollbar {
    height: 6px;
}

.info-counter-flags::-webkit-scrollbar-track {
    background: transparent;
}

.info-counter-flags::-webkit-scrollbar-thumb {
    background: rgba(29, 78, 216, 0.35);
    border-radius: 999px;
}

.info-counter-flag {
    flex: 0 0 auto;
    width: 33px;
    height: 30px;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: 6px;
}

/* Card Animation */
@keyframes infoCounterFadeUp {
    0% {
        opacity: 0;
        transform: translateY(28px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bubble appear animation */
@keyframes bubbleFlagIn {
    0% {
        opacity: 0;
        transform: scale(0.25) translateY(24px);
        filter: blur(8px);
    }
    55% {
        opacity: 0.24;
        transform: scale(1.12) translateY(-6px);
        filter: blur(0);
    }
    75% {
        opacity: 0.18;
        transform: scale(0.96) translateY(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* Floating motions */
@keyframes bubbleFloat1 {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    25% {
        transform: translate3d(6px, -10px, 0) rotate(1.5deg);
    }
    50% {
        transform: translate3d(-4px, -18px, 0) rotate(-1deg);
    }
    75% {
        transform: translate3d(5px, -8px, 0) rotate(1deg);
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}

@keyframes bubbleFloat2 {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    20% {
        transform: translate3d(-7px, -8px, 0) rotate(-1deg);
    }
    50% {
        transform: translate3d(4px, -16px, 0) rotate(1.2deg);
    }
    80% {
        transform: translate3d(-5px, -7px, 0) rotate(-0.8deg);
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}

@keyframes bubbleFloat3 {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    30% {
        transform: translate3d(5px, -12px, 0) rotate(1deg);
    }
    60% {
        transform: translate3d(-6px, -20px, 0) rotate(-1.5deg);
    }
    85% {
        transform: translate3d(3px, -9px, 0) rotate(0.8deg);
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .info-counter-section {
        padding: 56px 16px;
    }

    .info-counter-section::before {
        top: -90px;
        right: -90px;
        width: 150px;
        height: 150px;
    }

    .info-counter-section::after {
        bottom: -100px;
        left: -100px;
        width: 150px;
        height: 150px;
    }

    .info-counter-container {
        display: flex;
        gap: 16px;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-inline-end: 40px;
    }

    .info-counter-container::-webkit-scrollbar {
        display: none;
    }

    .info-counter-item {
        flex: 0 0 85%;
        min-height: 180px;
        padding: 30px 20px;
        scroll-snap-align: start;
    }

    .info-counter-number {
        font-size: 54px;
        margin-bottom: 14px;
    }

    .info-counter-text {
        font-size: 16px;
    }

    .info-counter-bg-flag {
        width: 54px;
        height: 40px;
        border-radius: 12px;
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .info-counter-section {
        padding: 44px 14px;
    }

    .info-counter-section::before {
        top: -65px;
        right: -65px;
        width: 120px;
        height: 120px;
    }

    .info-counter-section::after {
        bottom: -75px;
        left: -75px;
        width: 120px;
        height: 120px;
    }

    .info-counter-container {
        gap: 14px;
        padding-inline-end: 32px;
    }

    .info-counter-item {
        flex: 0 0 88%;
        min-height: 160px;
        border-radius: 22px;
    }

    .info-counter-number {
        font-size: 46px;
    }

    .info-counter-text {
        font-size: 14px;
        line-height: 1.9;
    }

    .info-counter-bg-flag {
        width: 32px;
        height: 20px;
        border-radius: 10px;
        opacity: 0;
    }
}


/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .info-counter-item {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .info-counter-item:hover {
        transform: none;
    }

    .info-counter-bg-flag {
        animation: none !important;
        opacity: 0.14 !important;
        transform: none !important;
        filter: none !important;
    }
}
