.modern-counter-section {
    padding: 40px 20px 70px 20px;
    background: #f8f9fb;
}

.counter-container {
    max-width: 1200px;
    margin: auto;
}

.counter-heading {
    text-align: center;
    margin-bottom: 10px;
}

.counter-heading h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    color: #38eda2;
}

/* Font classes */
.font-arial { font-family: Arial, sans-serif; }
.font-roboto { font-family: 'Roboto', sans-serif; }
.font-poppins { font-family: 'Poppins', sans-serif; }
.font-poetsen { font-family: 'Poetsen One', sans-serif; }
.font-winky { font-family: 'Winky Rough', cursive; }

.counter-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* center cards */
    gap: 25px;
}


/* ================= CARD ================= */

.counter-card {
    position: relative;
    min-height: 140px; /* smaller base */
    border-radius: 16px;
    cursor: pointer;
    perspective: 1200px;
    height: auto;              /* allow resize */
    min-width: 140px;      /* prevent too small */
    max-width: 260px;      /* prevent too wide */
    flex: 0 0 auto;        /* prevent stretching */
}
/* Shine layer — moved BELOW flip */
.counter-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.6),
        rgba(255,255,255,0.1)
    );
    pointer-events: none;
    z-index: 1; /* BELOW faces now */
}

/* ================= FLIP CORE ================= */

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s ease;
    transform-style: preserve-3d;
 }

.flip-enabled.flipped .flip-inner {
    transform: rotateY(180deg);
}
.flip-enabled.flipped {
    transform: none !important;
}

.flip-face {
    position: absolute;
    inset: 0;
    padding: 25px 20px;
    border-radius: 16px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

}

/* Force hardware layer */
.flip-front,
.flip-back {
    transform: translateZ(0);
}

/* FRONT */
.flip-front {
    z-index: 3;
}

/* BACK */
.flip-back {
    transform: rotateY(180deg) translateZ(0);
    z-index: 2;
    text-align: center;
}
/* ================= COLOR CONTROL ================= */

.flip-front {
    background: var(--front-bg);
    color: var(--front-text);
}

.flip-front .counter-number {
    color: var(--front-text);
}

.flip-front .counter-label {
    color: var(--front-text);
}

.flip-back {
    background: var(--back-bg);
    color: var(--back-text);
}


/* ================= CARD STYLE OPTIONS ================= */

.shadow-soft .flip-face {
        box-shadow:
        8px 8px 20px rgba(0,0,0,0.08),
        -6px -6px 15px rgba(255,255,255,0.9);
}

.shadow-strong .flip-face {
       box-shadow:
        0 15px 35px rgba(0,0,0,0.12),
        0 5px 10px rgba(0,0,0,0.08);
}

.glass-3d .flip-face {
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.tilt-3d .flip-face {
   box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}


/* TEXT */

.counter-number {
    font-size: 40px;
    font-weight: 700;
    color: #002060;
    margin-bottom: 8px;
}

.counter-label {
    font-size: 15px;
    font-weight: 700;
    color: #555;
}
/* ================= FLIP DIRECTION ================= */

.modern-counter-section[data-flip-direction="vertical"] 
.flip-enabled.flipped .flip-inner {
    transform: rotateX(180deg);
}

.modern-counter-section[data-flip-direction="vertical"] 
.flip-back {
    transform: rotateX(180deg) translateZ(0);
}

.modern-counter-section[data-flip-direction="horizontal"] 
.flip-enabled.flipped .flip-inner {
    transform: rotateY(180deg);
}

.modern-counter-section[data-flip-direction="horizontal"] 
.flip-back {
    transform: rotateY(180deg) translateZ(0);
}
/* ================= COLOR CONTROL SYSTEM ================= */

/* DEFAULT FALLBACKS */
.modern-counter-section {
    --front-bg: #ffffff;
    --back-bg: #002060;
    --front-text: #002060;
    --back-text: #ffffff;
}

/* FRONT */
.flip-front {
    background: var(--front-bg);
    color: var(--front-text);
}

.flip-front .counter-number,
.flip-front .counter-label {
    color: var(--front-text);
}

/* BACK */
.flip-back {
    background: var(--back-bg);
    color: var(--back-text);
}


/* ================= GRADIENT SUPPORT ================= */

.modern-counter-section.gradient-front .flip-front {
    background: var(--front-gradient);
}

.modern-counter-section.gradient-back .flip-back {
    background: var(--back-gradient);
}


/* ================= ANIMATED GRADIENT ================= */

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.modern-counter-section.animated-gradient .flip-front,
.modern-counter-section.animated-gradient .flip-back {
    background-size: 200% 200%;
    animation: gradientMove 6s ease infinite;
}

