/**
 * Content Card Carousel Block Styles (Child Theme Override)
 *
 * Client-specific styling adjustments:
 * - Smaller icons (48px instead of 64px)
 * - Smaller card titles
 * - Primary CTA button style instead of arrow link
 * - Clean link row styling (no bullets)
 *
 * @package TMW_Core_Child
 * @since 1.0.0
 * @version 1.4.0-client (based on plugin v2.1.0)
 */

/* ==========================================================================
   Block Section - width controlled by .container class
   ========================================================================== */

/* ==========================================================================
   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
   ========================================================================== */

.carousel-track-container {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 8px;
}

.carousel-track-container::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--row-gap);
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-md);
}

/* ==========================================================================
   Card Styling - Child Theme Overrides
   ========================================================================== */

.carousel-card {
    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 */
a.carousel-card {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

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

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

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

/* Card hover states */
.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 - CHILD THEME OVERRIDE: Smaller icons (48px)
   ========================================================================== */

.carousel-card-icon {
    width: 48px;
    height: 48px;
    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 - CHILD THEME OVERRIDE: Smaller titles
   ========================================================================== */

.carousel-card-title {
    margin-top: 0;
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-h5);
    color: var(--color-heading);
}

/* Ensure card content stays dark even when section has dark background */
/* Cards have white background so text should remain dark */
.content-card-carousel.has-dark-bg .carousel-card-title {
    color: var(--color-heading);
}

.content-card-carousel.has-dark-bg .carousel-card-description {
    color: var(--color-text-primary);
}

/* ==========================================================================
   Card Description
   ========================================================================== */

.carousel-card-description {
    margin-bottom: var(--space-md);
    flex-grow: 1;
}

/* ==========================================================================
   Link Rows - CHILD THEME OVERRIDE: Clean link styling (no bullets)
   Style bulleted lists as link rows per mockup
   ========================================================================== */

.carousel-card-description ul {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0 0 0;
}

.carousel-card-description ul li {
    padding: var(--space-xs) 0;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
}

.carousel-card-description ul li:last-child {
    border-bottom: none;
}

.carousel-card-description ul li a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-fast);
    display: block;
}

.carousel-card-description ul li a:hover {
    color: var(--color-tertiary);
    text-decoration: underline;
}

/* ==========================================================================
   Card Links List - CHILD THEME ADDITION
   Separate field for bulleted links that aligns vertically across grid cards
   ========================================================================== */

.carousel-card-links {
    margin-top: var(--space-md);
    margin-bottom: var(--space-lg);
    height: 100%;
}

.carousel-card-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.carousel-card-links ul li {
    padding: var(--space-xs) 0;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
}

.carousel-card-links ul li:last-child {
    border-bottom: none;
}

.carousel-card-links ul li a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-fast);
    display: block;
}

.carousel-card-links ul li a:hover {
    color: var(--color-tertiary);
    text-decoration: underline;
}

/* ==========================================================================
   CTA Button - CHILD THEME OVERRIDE: Primary button instead of arrow link
   ========================================================================== */

.carousel-card-link {
    align-self: flex-start;
    margin-top: auto;
}

/* Override arrow link style with primary button style */
.carousel-card-link.btn-arrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-button);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-button);
    text-decoration: none;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    border: none;
}

.carousel-card-link.btn-arrow:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Hide the arrow icon for primary button style */
.carousel-card-link.btn-arrow svg,
.carousel-card-link.btn-arrow .btn-icon {
    display: none;
}

/* ==========================================================================
   Carousel Navigation - CHILD THEME OVERRIDE: Arrow buttons instead of dots
   Positioned at bottom left per mockup
   ========================================================================== */

.content-card-carousel .carousel-navigation {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Hide dot navigation in favor of arrow buttons */
.content-card-carousel .carousel-nav-dot {
    display: none;
}

/* Arrow button styling - pill shape to match testimonial block */
.content-card-carousel .carousel-nav-arrow {
    width: 57px;
    height: 31px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-primary);
    background-color: transparent;
    cursor: pointer;
    transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.content-card-carousel .carousel-nav-arrow:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.content-card-carousel .carousel-nav-arrow:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.content-card-carousel .carousel-nav-arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.content-card-carousel .carousel-nav-arrow:disabled:hover {
    background-color: transparent;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.content-card-carousel .carousel-nav-arrow svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Flip the arrow for previous button */
.content-card-carousel .carousel-arrow-icon--prev {
    transform: scaleX(-1);
}

/* ==========================================================================
   Dark Background Navigation - CHILD THEME OVERRIDE
   Light-colored arrows when section has dark FSE background
   Uses semantic --dark-bg-* variables for consistency
   ========================================================================== */

.content-card-carousel.has-dark-bg .carousel-nav-arrow {
    border-color: var(--dark-bg-link);
    color: var(--dark-bg-link);
}

.content-card-carousel.has-dark-bg .carousel-nav-arrow:hover {
    background-color: var(--dark-bg-link);
    color: var(--color-primary);
    opacity: var(--dark-bg-link-hover-opacity);
}

.content-card-carousel.has-dark-bg .carousel-nav-arrow:focus-visible {
    outline-color: var(--dark-bg-focus);
}

.content-card-carousel.has-dark-bg .carousel-nav-arrow:disabled {
    border-color: var(--dark-bg-link);
    color: var(--dark-bg-link);
}

.content-card-carousel.has-dark-bg .carousel-nav-arrow:disabled:hover {
    background-color: transparent;
    border-color: var(--dark-bg-link);
    color: var(--dark-bg-link);
}

/* ==========================================================================
   Progress Bar - Hidden per client design
   ========================================================================== */

.content-card-carousel .carousel-progress-container {
    display: none;
}

/* ==========================================================================
   Grid Mode - CHILD THEME ADDITION
   Display cards in a responsive grid instead of carousel
   Uses CSS Subgrid for vertical alignment of content across cards
   ========================================================================== */

.content-card-carousel--grid .carousel-track-container {
    overflow: visible;
}

.content-card-carousel--grid .carousel-track {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Define shared rows: icon, title, description, links, cta */
    grid-template-rows: auto auto auto auto auto;
    gap: var(--row-gap);
    scroll-snap-type: none;
    align-items: start;
}

.content-card-carousel--grid .carousel-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    scroll-snap-align: none;
    /* Use subgrid to inherit row definitions from parent track */
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 5; /* Card spans all 5 rows */
    gap: 0;
}

.content-card-carousel--grid .carousel-card-description {
    margin-bottom: 0;
}

/* Ensure card children align to their grid rows */
.content-card-carousel--grid .carousel-card-icon {
    grid-row: 1;
}

.content-card-carousel--grid .carousel-card-title {
    grid-row: 2;
}

.content-card-carousel--grid .carousel-card-description {
    grid-row: 3;
    align-self: start;
}

.content-card-carousel--grid .carousel-card-links {
    grid-row: 4;
    align-self: start;
}

.content-card-carousel--grid .carousel-card-link {
    grid-row: 5;
    align-self: end;
    justify-self: start;
}

/* Grid responsive breakpoints */
@media (width >= 768px) and (width < 1024px) {
    .content-card-carousel--grid .carousel-track {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (width < 768px) {
    .content-card-carousel--grid .carousel-track {
        grid-template-columns: 1fr;
    }

    .content-card-carousel--grid .carousel-card {
        min-width: 0;
        width: 100%;
    }
}

/* ==========================================================================
   Single Card Centering
   When only one card is present, center it within the carousel track
   ========================================================================== */

/* Carousel mode (flexbox): center the single card */
.content-card-carousel.has-single-card .carousel-track {
    justify-content: center;
}

/* Grid mode: override 3-column grid to single centered column */
.content-card-carousel.has-single-card.content-card-carousel--grid .carousel-track {
    grid-template-columns: minmax(300px, 400px);
    justify-content: center;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (width <= 768px) {
    .carousel-section-subtitle {
        margin-bottom: var(--space-xl);
    }

    /* Mobile: keep icons at 48px */
    .carousel-card-icon {
        width: 48px;
        height: 48px;
    }

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

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