/**
 * Vertical Scrolling Cards Block Styles
 *
 * @package TMW_Blocks
 * @since 1.0.0
 * @version 1.1.0
 */

/* Vertical Scrolling Cards Section - Force overflow-y visible and remove contain on all parent containers */
.vertical-scrolling-cards,
.vertical-scrolling-cards .container {
    overflow-y: visible !important;
    contain: none !important;
    width: 100%;
    box-sizing: border-box;
}

/* Layout container - allow vertical overflow */
.vertical-scrolling-cards-layout {
    overflow-y: visible !important;
    contain: none !important;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure all child elements respect parent width */
.vertical-scrolling-cards * {
    box-sizing: border-box;
}

/* Critical: Override parent theme's overflow settings - only Y axis for sticky positioning */
main,
section {
    overflow-y: visible !important;
}

.vertical-scrolling-cards-header {
    /* Width controlled by col-5 class */
    position: -webkit-sticky !important;

    /* Safari support */
    position: sticky !important;
    align-self: flex-start !important;

    /* Height shouldn't exceed viewport */
    max-height: calc(100vh - 150px);
    z-index: 10;
    top: calc(var(--header-height) + var(--announcement-bar-height) + var(--sticky-element-top-offset));
}

.vertical-scrolling-cards-header .section-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.vertical-scrolling-cards-header .section-subtitle {
    margin: 0 0 var(--space-lg) 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.admin-bar .vertical-scrolling-cards-header {
    top: calc(var(--header-height) + var(--announcement-bar-height) + 32px + var(--sticky-element-top-offset) + 35px);
}

/* Right side cards container - vertical card stack */
.vertical-scrolling-cards-grid {
    /* Width controlled by col-7 class */

    /* flex-col utility class provides: display: flex; flex-direction: column */
    gap: var(--space-lg);
}

/* CTA Button in header */
.vertical-scrolling-cards-cta {
    margin-top: var(--space-lg);
}

/* Card styling */
.vertical-scrolling-card {
    background: var(--color-white);
    padding: var(--space-lg);
    border-radius: var(--radius-card);
    border: var(--border-width-thin) solid var(--color-border);
    position: relative;
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

/* Hover effects only for clickable card links */
.vertical-scrolling-card.card-link-wrapper {
    transition: all var(--transition-slow);
    cursor: pointer;
    display: flex;
}

.vertical-scrolling-card.card-link-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    transition: left var(--transition-slow) ease;
}

.vertical-scrolling-card.card-link-wrapper:hover {
    transform: translateY(var(--transform-offset-sm));
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.vertical-scrolling-card.card-link-wrapper:hover::before {
    left: 100%;
}

/* Icon styling - floated to left */
.vertical-scrolling-card-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon transition only for clickable cards */
.vertical-scrolling-card.card-link-wrapper .vertical-scrolling-card-icon {
    transition: all var(--transition-base);
}

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

/* Icon scale effect only for clickable cards */
.vertical-scrolling-card.card-link-wrapper:hover .vertical-scrolling-card-icon {
    transform: scale(1.05);
}

/* Card content wrapper */
.vertical-scrolling-card-content {
    flex: 1;
    min-width: 0;
}

.vertical-scrolling-card-content h3 {
    margin-bottom: var(--space-md);
    color: var(--color-primary) !important;
}

.vertical-scrolling-card-content p {
    color: var(--color-text-secondary);
}

.vertical-scrolling-card-content p:last-of-type {
    margin-bottom: 0 !important;
}

/* List styling */
.vertical-scrolling-card-content ul,
.vertical-scrolling-card-content ol {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

/* Add spacing when list follows paragraph */
.vertical-scrolling-card-content p + ul,
.vertical-scrolling-card-content p + ol {
    margin-top: var(--space-sm);
}

/* Remove bottom margin from last list */
.vertical-scrolling-card-content ul:last-child,
.vertical-scrolling-card-content ol:last-child {
    margin-bottom: 0;
}

.vertical-scrolling-card-content .btn {
    margin-top: var(--space-md);
}

.vertical-scrolling-card-content .btn-arrow {
    margin-top: var(--space-md);
}

/* Card Background Colors */

/* Framework defaults using design system - child themes override with brand colors */
.vertical-scrolling-card.bg-option-1 {
    background: var(--color-bg-secondary);
}

.vertical-scrolling-card.bg-option-2 {
    background: var(--color-bg-secondary);
}

.vertical-scrolling-card.bg-option-3 {
    background: var(--color-bg-secondary);
}

.vertical-scrolling-card.bg-option-4 {
    background: var(--color-bg-secondary);
}

/* Highlighted Statistic Box */
.highlighted-statistic {
    background: var(--color-white);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid var(--color-primary);
    font-size: var(--font-size-lead);
    font-weight: 400;
    color: var(--color-primary);
    display: inline-block;
}

.highlighted-statistic p {
    color: var(--color-primary);
}

/* Generic card link wrapper - reusable for any clickable card */
.card-link-wrapper {
    text-decoration: none;
    color: inherit;
}

.card-link-wrapper:hover {
    color: inherit;
}

/* Accessibility: Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .vertical-scrolling-card {
        transition: none;
    }
}

/* Tablet (1024px and below) - col-md-12 handles stacking */
@media (width <=1024px) {
    .vertical-scrolling-cards-header {
        position: static !important;
        align-self: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
        text-align: center;
    }

    .vertical-scrolling-cards-header .section-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .vertical-scrolling-cards-grid {
        gap: var(--space-md);
    }
}

/* Mobile Responsive (768px and below) */
@media (width <=768px) {
    /* Ensure no horizontal overflow on mobile */
    .vertical-scrolling-cards,
    .vertical-scrolling-cards .container,
    .vertical-scrolling-cards-layout,
    .vertical-scrolling-cards-grid {
        overflow-x: clip !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Fix grid layout for mobile - reduce gap dramatically */
    .vertical-scrolling-cards-layout.row {
        gap: 20px !important;
        grid-template-columns: 1fr !important;
    }

    /* Force grid columns to full width on mobile */
    .vertical-scrolling-cards-layout [class*="col-"],
    .vertical-scrolling-cards-header,
    .vertical-scrolling-cards-grid {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Add width constraints and text wrapping on mobile */
    .vertical-scrolling-cards-header {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .vertical-scrolling-cards-header .section-title,
    .vertical-scrolling-cards-header .section-subtitle {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        width: 100%;
        max-width: 100%;
    }

    .vertical-scrolling-card.card-link-wrapper {
        flex-direction: column;
    }

    .vertical-scrolling-card-icon {
        width: 60px;
        height: 60px;
    }

    .vertical-scrolling-card {
        padding: var(--space-lg);
        max-width: 100%;
        width: 100%;
        overflow-x: clip;
        box-sizing: border-box;
    }

    /* Ensure all text content respects mobile width */
    .vertical-scrolling-card-content {
        max-width: 100%;
        width: 100%;
        overflow-x: clip;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Force aggressive word breaking on mobile for long words */
    .vertical-scrolling-card-content p,
    .vertical-scrolling-card-content h3,
    .vertical-scrolling-card-content strong {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .highlighted-statistic {
        max-width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .highlighted-statistic p,
    .highlighted-statistic strong {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}