/**
 * CPS Related Items Styles
 * Displays related Products, Services based on ACF relationships
 * Based on screenshot design - fully clickable cards with hover effects
 */

/* Remove Fusion Builder column margins */
.fusion_builder_column:has(.cps-related-items) {
    --awb-margin-bottom-large: 0px !important;
    --awb-margin-top-large: 0px !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}

.fusion-column-wrapper:has(.cps-related-items) {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
}

/* Full-width section */
.cps-related-items {
    width: 100vw;
    margin: 0 !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding: 80px 0;
}

/* Remove bottom padding from last related items section before footer */
.cps-related-items:last-of-type {
    padding-bottom: 0;
}

/* If there are multiple related items sections, only the last one should have no bottom padding */
.cps-related-items:not(:last-of-type) {
    padding-bottom: 80px;
}

.cps-related-items-container {
    max-width: var(--awb-content-max-width, 1280px);
    margin: 0 auto;
    padding: 0 var(--awb-content-padding-left, 30px) 0 var(--awb-content-padding-right, 30px);
}

/* Header */
.cps-related-items-header {
    text-align: center;
    margin-bottom: 48px;
}

.cps-related-items-heading {
    font-family: refrigerator-deluxe, Impact, Charcoal, sans-serif !important;
    font-size: 36px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    margin: 0 0 12px 0 !important;
}

.cps-related-items-subheading {
    font-family: 'DIN', sans-serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
}

/* Grid Layout */
.cps-related-items-grid {
    display: grid;
    gap: 32px;
}

.cps-related-items-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cps-related-items-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cps-related-items-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Card Link - fully clickable */
.cps-related-item-card-link {
    display: block;
    text-decoration: none;
    height: 100%;
    transition: transform 0.3s ease;
    outline: none;
}

.cps-related-item-card-link:hover,
.cps-related-item-card-link:focus {
    transform: translateY(-4px);
}

/* Card Container */
.cps-related-item-card {
    border-radius: 12px;
    border: 1px solid;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

.cps-related-item-card-link:hover .cps-related-item-card,
.cps-related-item-card-link:focus .cps-related-item-card {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3),
                0 0 0 3px var(--awb-color1, #D41F38),
                0 0 20px 0 rgba(212, 31, 56, 0.5);
}

/* Image Section */
.cps-related-item-image-wrap {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
}

.cps-related-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cps-related-item-card-link:hover .cps-related-item-image {
    transform: scale(1.1);
}

.cps-related-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
}

/* Icon Badge */
.cps-related-item-icon {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.cps-related-item-icon i {
    font-size: 20px;
    color: #ffffff;
}

/* Content Section */
.cps-related-item-content {
    padding: 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Title */
.cps-related-item-title {
    font-family: refrigerator-deluxe, Impact, Charcoal, sans-serif !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    margin: 0 !important;
}

/* Description */
.cps-related-item-description {
    font-family: 'DIN', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    flex: 1;
}

.cps-related-item-description p {
    margin: 0 0 12px 0;
}

.cps-related-item-description p:last-child {
    margin-bottom: 0;
}

/* Button */
.cps-related-item-button {
    font-family: 'DIN', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    margin-top: auto;
}

.cps-related-item-button:hover {
    transform: scale(1.05);
    border-color: currentColor;
}

.cps-related-item-button i {
    margin-left: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .cps-related-items-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .cps-related-items {
        padding: 60px 0;
    }

    .cps-related-items-header {
        margin-bottom: 32px;
    }

    .cps-related-items-heading {
        font-size: 28px !important;
    }

    .cps-related-items-subheading {
        font-size: 18px;
    }

    .cps-related-items-grid {
        gap: 24px;
    }

    .cps-related-items-cols-2,
    .cps-related-items-cols-3,
    .cps-related-items-cols-4 {
        grid-template-columns: 1fr;
    }

    .cps-related-item-content {
        padding: 24px;
    }

    .cps-related-item-title {
        font-size: 20px !important;
    }
}

