/**
 * Content Card Carousel Block Styles
 *
 * Horizontal scrolling carousel with progress bar and navigation controls
 * Uses flexbox with scroll-snap for smooth page-based scrolling
 * Design based on multi-column-boxed-content with unique class names
 *
 * @package TMW_Blocks
 */

/* Section Container */
.content-card-carousel {
    position: relative;
}

.content-card-carousel .section-subtitle {
    text-align: center;
}

/* Section Header */
.carousel-section-title,
.carousel-section-subtitle {
    text-align: center;
    max-width: var(--max-width-content-lg);
    margin-left: auto;
    margin-right: auto;
}

/* Carousel Track Container - Handles Horizontal Scrolling */
.carousel-track-container {
    max-width: var(--max-width-content-2xl);
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;

    /* Firefox */
    -ms-overflow-style: none;

    /* IE/Edge */
    padding-top: 8px;

    /* Space for hover lift effect */
    will-change: scroll-position;

    /* Hint to browser for optimized rendering during scroll */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.carousel-track-container::-webkit-scrollbar {
    display: none;
}

/* Carousel Track - Horizontal Scrolling Layout
 * Grid system (.row class) provides layout
 * Scroll-snap enables smooth page-based scrolling
 */
.carousel-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    padding-bottom: var(--space-lg);
}

/* Card Styling - Based on multi-column-boxed-content */
.carousel-card {
    /* flex-col utility class provides: display: flex; flex-direction: column */
    flex-shrink: 0;
    min-width: 300px;
    max-width: 400px;
    scroll-snap-align: start;
    background-color: var(--color-white);
    backdrop-filter: blur(8px);
    padding: var(--space-lg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-default);
    transition: all var(--transition-base);
    border: 1px solid var(--color-border);
    -webkit-font-smoothing: subpixel-antialiased;
}

/* Clickable card styling (when entire card is a link) */
a.carousel-card {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

/* Responsive card widths */
@media (width >=1024px) {
    .carousel-card {
        width: 30%;

        /* ~3.3 cards visible, showing peek of 4th card */
    }
}

@media (width >=768px) and (width < 1024px) {
    .carousel-card {
        width: 47%;

        /* ~2.1 cards visible, showing peek of 3rd card */
    }
}

@media (width < 768px) {
    .carousel-card {
        min-width: 90%;
        width: 90%;

        /* Slight peek of next card on mobile */
    }
}

/* Enhanced card hover states - matches team-member-grid pattern */
.carousel-card:hover,
.carousel-card:focus {
    background-color: var(--color-white);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--color-primary);
}

/* Card Icon */
.carousel-card-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Card Title */
.carousel-card-title {
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

/* Card Description */
.carousel-card-description {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
    flex-grow: 1;
}

/* Card Link - prevent full-width stretch in flex container */
.carousel-card-link {
    align-self: flex-start;
    margin-top: auto;

    /* Push link to bottom of flex container for consistent alignment */
}

/* Carousel Navigation Dots - positioned below progress bar */
.carousel-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.carousel-nav-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-primary);
    background-color: transparent;
    cursor: pointer;
    transition: background-color var(--transition-base), transform var(--transition-base);
    padding: 0;
}

.carousel-nav-dot:hover {
    transform: scale(1.2);
}

.carousel-nav-dot.active {
    background-color: var(--color-primary);
}

.carousel-nav-dot:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

/* Scrollbar Track */
.carousel-progress-container {
    width: 100%;
    max-width: var(--max-width-content-2xl);
    height: 8px;
    background-color: rgb(0 0 0 / 10%);
    border-radius: var(--radius-full);
    margin: var(--space-lg) auto 0;
    position: relative;
    cursor: pointer;
    transition: height var(--transition-base), background-color var(--transition-base);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Prevent default touch actions during drag */
}

.carousel-progress-container:hover {
    height: 10px;
    background-color: rgb(0 0 0 / 15%);
}

.carousel-progress-container:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

/* Scrollbar Thumb */
.carousel-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    transition: background-color var(--transition-base), box-shadow var(--transition-base);
    cursor: grab;
    min-width: 40px; /* Ensure thumb is always grabbable */
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto; /* Ensure thumb receives pointer events */
}

.carousel-progress-bar:hover {
    background-color: var(--color-primary-dark, var(--color-primary));
    box-shadow: 0 0 0 3px rgb(0 0 0 / 10%);
}

.carousel-progress-bar.dragging {
    cursor: grabbing;
    box-shadow: 0 0 0 4px rgb(0 0 0 / 15%);
    transition: none; /* Disable transitions during drag for immediate feedback */
}

/* Responsive Breakpoints */

/* REMOVED: Tablet/mobile grid overrides - grid system (.col-md-*, .col-sm-*) handles responsive layout */

/* Mobile adjustments (spacing/sizing only) */
@media (width <=768px) {
    .carousel-section-subtitle {
        margin-bottom: var(--space-xl);
    }

    .carousel-card-icon {
        width: 48px;
        height: 48px;
    }

    .carousel-progress-container {
        margin-top: var(--space-md);
    }

    .carousel-navigation {
        margin-top: var(--space-sm);
    }
}

/* Animation - Only hover effects on individual cards */