/* ENHANCED STATISTICS - Inspired by Pillar Cards & Journey Items */
/* Beautiful hover effects + glassmorphism + premium animations */

.hero-journey-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    margin: var(--space-xl) 0;
    /* Fix overlapping issues */
    position: relative;
    z-index: 1;
}

/* Enhanced Journey Item with Flip Cards - Fixed Layout */
.journey-item {
    background: transparent;
    perspective: 1000px;
    height: 180px; /* Fixed height for consistency - COMPACT */
    border-radius: var(--border-radius-lg);
    transition: all 0.3s ease; /* Faster, cleaner transition */
    cursor: pointer;
    position: relative;
    z-index: 2; /* Ensure proper stacking */
}

/* Flip card inner container - Fixed */
.journey-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s ease-in-out; /* Smoother animation */
    transform-style: preserve-3d;
}

.journey-item:hover .journey-card-inner {
    transform: rotateY(180deg);
}

/* Front and back faces - Fixed dimensions */
.journey-card-front,
.journey-card-back {
    position: absolute;
    width: 100%;
    height: 180px; /* Match parent height exactly - COMPACT */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-md) var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    text-align: center;
    overflow: hidden;
    box-sizing: border-box; /* Ensure padding doesn't break layout */
}

.journey-card-front {
    /* Front face styles */
}

.journey-card-back {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 122, 204, 0.3);
    transform: rotateY(180deg);
    padding: var(--space-lg) var(--space-md);
}

/* Back card content styling */
.journey-back-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: var(--space-md);
    text-transform: none;
    line-height: 1.3;
}

.journey-back-text {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    text-align: center;
    margin: 0;
    max-width: 280px;
}

/* Clean hover effect - NO overlapping */
.journey-item:hover {
    /* Remove scale and translateY to prevent overlapping */
    z-index: 10; /* Bring to front during hover but no transform */
}

.journey-item:hover .journey-card-front,
.journey-item:hover .journey-card-back {
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(0, 122, 204, 0.15);
}

/* Removed animated effects to prevent overlapping issues */

/* Enhanced numbers with better typography */
.journey-number {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-sm);
    letter-spacing: -2px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.journey-item:hover .journey-number {
    transform: scale(1.1);
    color: #ffffff;
    text-shadow:
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 122, 204, 0.4);
}

/* Enhanced labels with better readability */
.journey-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0.5px;
    transition: all 0.6s ease;
    max-width: 280px;
    margin: 0 auto;
}

.journey-item:hover .journey-label {
    color: #ffffff;
    transform: translateY(-3px);
}

/* Flip Hint - Mobile Only */
.flip-hint {
    display: none; /* Hidden on desktop (hover works) */
    font-size: 0.75rem;
    color: rgba(0, 122, 204, 0.8);
    background: rgba(0, 122, 204, 0.15);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-top: var(--space-sm);
    position: absolute;
    bottom: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid rgba(0, 122, 204, 0.3);
    animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% {
        opacity: 0.7;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.05);
    }
}

/* Show flip hint on mobile/tablet only */
@media (max-width: 1024px) {
    .flip-hint {
        display: inline-block;
    }
}

/* SUCCESS VARIANT - Subtle Blue Theme */
.journey-item.success .journey-card-front,
.journey-item.success .journey-card-back {
    background: linear-gradient(135deg,
        rgba(0, 122, 204, 0.08) 0%,
        rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid rgba(0, 122, 204, 0.6);
}

.journey-item.success:hover .journey-card-front,
.journey-item.success:hover .journey-card-back {
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(0, 122, 204, 0.15);
}

.journey-item.success .journey-back-title {
    color: var(--accent-blue);
}

/* FAILURE VARIANT - Subtle Blue Theme */
.journey-item.failure .journey-card-front,
.journey-item.failure .journey-card-back {
    background: linear-gradient(135deg,
        rgba(0, 122, 204, 0.05) 0%,
        rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid rgba(0, 122, 204, 0.4);
}

.journey-item.failure:hover .journey-card-front,
.journey-item.failure:hover .journey-card-back {
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(0, 122, 204, 0.1);
}

.journey-item.failure .journey-back-title {
    color: rgba(0, 122, 204, 0.8);
}

/* TRIUMPH VARIANT - Enhanced Blue Theme */
.journey-item.triumph .journey-card-front,
.journey-item.triumph .journey-card-back {
    background: linear-gradient(135deg,
        rgba(0, 122, 204, 0.12) 0%,
        rgba(0, 122, 204, 0.06) 50%,
        rgba(255, 255, 255, 0.05) 100%);
    border-left: 4px solid var(--accent-blue);
}

.journey-item.triumph:hover .journey-card-front,
.journey-item.triumph:hover .journey-card-back {
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.2),
        0 0 25px rgba(0, 122, 204, 0.3);
}

.journey-item.triumph .journey-back-title {
    color: var(--accent-blue);
}

/* Removed triumph badge effect to prevent layout issues */

/* Progressive reveal animation */
.journey-item {
    opacity: 0;
    transform: translateY(40px);
    animation: revealStats 0.8s ease-out forwards;
}

.journey-item:nth-child(1) { animation-delay: 0.1s; }
.journey-item:nth-child(2) { animation-delay: 0.2s; }
.journey-item:nth-child(3) { animation-delay: 0.3s; }
.journey-item:nth-child(4) { animation-delay: 0.4s; }
.journey-item:nth-child(5) { animation-delay: 0.5s; }
.journey-item:nth-child(6) { animation-delay: 0.6s; }
.journey-item:nth-child(7) { animation-delay: 0.7s; }

@keyframes revealStats {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive enhancements for flip cards - Fixed */
@media (max-width: 768px) {
    .hero-journey-stats {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-lg);
    }

    .journey-item {
        height: 200px; /* Fixed height for mobile */
    }

    .journey-card-front,
    .journey-card-back {
        padding: var(--space-lg) var(--space-md);
        height: 200px; /* Match parent */
    }

    .journey-number {
        font-size: 2.8rem;
    }

    .journey-label {
        font-size: 0.9rem;
    }

    .journey-back-title {
        font-size: 1.2rem;
    }

    .journey-back-text {
        font-size: 0.9rem;
    }

    /* NO transform on mobile to prevent overlapping */
    .journey-item:hover {
        /* Only z-index change */
    }
}

@media (max-width: 480px) {
    .hero-journey-stats {
        grid-template-columns: 1fr;
    }

    .journey-item {
        height: 180px; /* Fixed height for small mobile */
    }

    .journey-card-front,
    .journey-card-back {
        padding: var(--space-md) var(--space-sm);
        height: 180px; /* Match parent */
    }

    .journey-number {
        font-size: 2.5rem;
    }

    .journey-back-title {
        font-size: 1.1rem;
    }

    .journey-back-text {
        font-size: 0.85rem;
        max-width: 240px;
    }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .journey-item,
    .journey-number,
    .journey-label {
        transition: none;
        animation: none;
    }

    .journey-item:hover {
        transform: none;
    }

    .journey-item::before,
    .journey-item::after {
        animation: none;
    }
}