/* Testimonial Gallery Page Styles */

/* Wide container for this specific page to use more width */
.container-wide {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
}

.container-wide.limit-2-columns {
    max-width: 1200px;
    /* Narrower width for better 2-column appearance */
}

.testimonial-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-flow: dense;
    gap: 15px;
    margin-top: 40px;
    /* Ensure there is enough space for staggered items at the bottom */
    padding-bottom: 0px;
    /* Reduced from 100px */
}

.testimonial-gallery.limit-2-columns {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 769px) {
    .testimonial-gallery.no-desktop-shadows img {
        box-shadow: none !important;
    }
}

@media (max-width: 768px) {
    .testimonial-gallery.no-mobile-shadows img {
        box-shadow: none !important;
    }
}

.testimonial-gallery img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 2s ease-out;
    margin: 0 auto;
    display: block;
    /* Use CSS variable for random vertical shifts without affecting grid rows */
    transform: translateY(var(--y-offset, 0)) scale(var(--img-scale, 1));
}

/* Slower fade in without Y transition for gallery images */
.testimonial-gallery img.pre-fade {
    opacity: 0 !important;
}

.testimonial-gallery img.pre-fade.fade-in {
    opacity: 1 !important;
}

.testimonial-gallery img:hover {
    --img-scale: 1.02;
}

.full-width-cta {
    /* On desktop: single cell with styled text wrapping */
    text-align: center;
    padding: 20px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Style the button text to wrap gracefully on desktop */
.full-width-cta .btn-primary.large {
    padding: 16px 24px;
    line-height: 1.4;
    text-wrap: balance;
    /* Centers text on each line for a cleaner multi-line look */
}

/* On mobile: buttons span full width for better readability */
@media (max-width: 768px) {
    .full-width-cta {
        grid-column: 1 / -1;
        padding: 30px 0;
        width: 100%;
    }
}

/* Ensure headings don't cause horizontal overflow */
.container-wide h1,
.container-wide h2 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* ========================================
   Button Animation Styles
   Replicating the visual effect from full_test.html
   ======================================== */
@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 500% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.full-width-cta .btn-primary {
    /* Gradient background similar to full_test button */
    background: linear-gradient(90deg, #0086B3 0%, #00b8d4 50%, #0086B3 100%);
    background-size: 200% 100%;
    letter-spacing: 1px;
    /* Animation properties */
    animation: shimmer 6s ease-in-out infinite;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;

    /* Shadow and formatting */
    box-shadow: 0 10px 30px rgba(0, 134, 179, 0.3);
    border: none;
    text-transform: uppercase;
    text-shadow: 0 0px 4px rgba(1, 33, 38, 0.307);
    /* Subtle light shadow */
    /* Ensure consistency */
}

.section-padding.bg-tan .btn-primary {
    /* Green Gradient for the last button - increased contrast, less bright highlight */
    background: linear-gradient(90deg, #02946b 0%, #04b083 50%, #02946b 100%);
    background-size: 200% 100%;
    letter-spacing: 0.2px;
    font-weight: 500;
    padding: 20px !important;
    /* Animation properties */
    animation: shimmer 12s ease-in-out infinite;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;

    /* Shadow and formatting */
    box-shadow: 0 10px 30px rgba(6, 214, 160, 0.4);
    border: none;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 40, 30, 0.4);
}

.full-width-cta .btn-primary:hover {
    animation: none;
    background: linear-gradient(135deg, #00b8d4 0%, #0086B3 100%) !important;
    background-size: 100% 100% !important;
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 184, 212, 0.5);
    opacity: 1;
}

.section-padding.bg-tan .btn-primary:hover {
    animation: none;
    background: linear-gradient(135deg, #06D6A0 0%, #02946b 100%) !important;
    background-size: 100% 100% !important;
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(6, 214, 160, 0.5);
    opacity: 1;
}

.full-width-cta .btn-primary:active,
.section-padding.bg-tan .btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 5px 15px rgba(26, 54, 93, 0.4);
    opacity: 0.9;
}

/* Revert to 2 columns on small desktops/large tablets */
@media (max-width: 1200px) {
    .testimonial-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 1 column on mobile */
@media (max-width: 768px) {
    .testimonial-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
        padding-bottom: 40px;
    }

    .container-wide {
        padding: 0 15px;
        /* Slightly less padding on very small screens */
    }

    .testimonial-gallery img {
        max-width: 100%;
        /* Ensure it never exceeds container */
        width: auto;
        margin: 0 auto;
        /* Disable random offsets on mobile for better alignment */
        transform: none !important;
    }

    /* Override large button for gallery context AND the final CTA */
    .testimonial-gallery .full-width-cta .btn-primary.large,
    .section-padding.bg-tan .btn-primary.large {
        padding: 18px 25px !important;
        height: auto !important;
        min-height: 55px;
        /* Keep min-height for touch targets */
        min-width: 0;
        /* Allow shrinking below content size */
        white-space: normal;
        /* Allow wrap */
        width: auto !important;
        max-width: 90%;
        /* gap around the button */
        text-align: center;
        line-height: 1.25;
        font-size: clamp(13px, 4vw, 18px) !important;
        word-break: break-word;
        overflow-wrap: break-word;
        text-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .testimonial-gallery {
        gap: 15px;
    }

    .full-width-cta {
        padding: 20px 0;
    }
}

/* Celebration Animation */
.celebrate-target {
    position: relative;
    display: inline-block;
}

.celebrate-target.celebrate {
    animation: pop-celebrate 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Confetti pseudo-elements */
.celebrate-target::before,
.celebrate-target::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.celebrate-target.celebrate::before {
    box-shadow:
        -30px -40px #ff0000, 30px -40px #ffd700,
        -50px 0px #00ff00, 50px 0px #0000ff,
        -30px 40px #ff00ff, 30px 40px #00ffff;
    animation: confetti-explode 0.8s ease-out forwards;
}

.celebrate-target.celebrate::after {
    width: 8px;
    height: 8px;
    box-shadow:
        -20px -50px #ffd700, 20px -50px #ff0000,
        -60px -20px #00ffff, 60px -20px #ff00ff,
        -20px 50px #0000ff, 20px 50px #00ff00;
    animation: confetti-explode 1s ease-out 0.1s forwards;
}

@keyframes pop-celebrate {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes confetti-explode {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(5);
        /* Expands outward */
    }
}


/* Adjustment for final section spacing */
@media (min-width: 769px) {
    .section-padding.bg-tan {
        padding-bottom: 120px !important;
    }

    /* Decrease "You Made it!" font size on desktop */
    .section-padding.bg-tan h2 {
        font-size: 45px;
        /* Reduced from default ~65px */
    }

    /* Increase button size and font on desktop */
    .section-padding.bg-tan .btn-primary {
        padding: 25px 40px !important;
        /* Larger padding */
        font-size: 22px !important;
        /* Larger font */
    }
}

@media (max-width: 768px) {
    .section-padding.bg-tan {
        padding-bottom: 60px !important;
    }
}