.block-best-fit-projects.bfp-block {
    --bfp-color-text: #373737;
    --bfp-color-card-text: #ffffff;
    --bfp-content-max: 1200px;
    --bfp-section-pad-y: 100px;
    --bfp-section-pad-x: 20px;
    --bfp-stack-gap: 50px;
    --bfp-header-gap: 10px;
    --bfp-grid-gap: 20px;
    --bfp-card-height: 400px;
    --bfp-card-radius: 20px;
    --bfp-card-pad: 10px;
    --bfp-copy-pad: 20px;
    --bfp-cols: 3;

    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    padding: var(--bfp-section-pad-y) var(--bfp-section-pad-x);
    color: var(--bfp-color-text);
    background: #f2f2f2;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.block-best-fit-projects.bfp-block *,
.block-best-fit-projects.bfp-block *::before,
.block-best-fit-projects.bfp-block *::after {
    box-sizing: border-box;
}

.bfp-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--bfp-stack-gap);
    width: 100%;
    max-width: var(--bfp-content-max);
    margin: 0 auto;
}

.bfp-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--bfp-header-gap);
    width: 100%;
    text-align: center;
}

.bfp-title {
    margin: 0;
    width: 100%;
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--bfp-color-text);
}

.bfp-subtitle {
    margin: 0;
    width: 100%;
    font-size: clamp(16px, 1.6vw, 20px);
    font-weight: 400;
    line-height: 1.5;
    color: var(--bfp-color-text);
}

.bfp-grid {
    display: grid;
    grid-template-columns: repeat(var(--bfp-cols, 3), minmax(0, 1fr));
    gap: var(--bfp-grid-gap);
    width: 100%;
}

.bfp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: var(--bfp-card-height);
    height: var(--bfp-card-height);
    padding: var(--bfp-card-pad);
    border-radius: var(--bfp-card-radius);
    overflow: hidden;
    margin: 0;
    text-decoration: none;
    color: inherit;
}

.bfp-card--link {
    cursor: pointer;
}

.bfp-card--link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(55, 55, 55, 0.25);
}

.bfp-card-media {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: var(--bfp-card-radius);
    overflow: hidden;
}

.bfp-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: var(--bfp-card-radius);
    transform: scale(1);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.bfp-card:hover .bfp-card-img,
.bfp-card:focus-within .bfp-card-img {
    transform: scale(1.05);
}

.bfp-card-overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--bfp-card-radius);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.4) 72.875%);
    transition: background 0.35s ease;
    pointer-events: none;
}

.bfp-card:hover .bfp-card-overlay,
.bfp-card:focus-within .bfp-card-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.24) 50%, rgba(0, 0, 0, 0.8) 100%);
}

.bfp-card-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: var(--bfp-copy-pad);
    color: var(--bfp-color-card-text);
    text-align: left;
}

.bfp-card-title {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.33;
}

.bfp-card-text {
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.56;
    transition: opacity 0.35s ease, max-height 0.35s ease;
}

.bfp-card:hover .bfp-card-text,
.bfp-card:focus-within .bfp-card-text {
    max-height: 120px;
    opacity: 1;
}

@media (max-width: 991px) {
    .block-best-fit-projects.bfp-block {
        --bfp-section-pad-y: 80px;
        --bfp-stack-gap: 40px;
        --bfp-card-height: 320px;
    }

    .bfp-grid.bfp-grid--cols-3,
    .bfp-grid.bfp-grid--cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bfp-card-title {
        font-size: 20px;
    }

    .bfp-card-text {
        font-size: 16px;
    }
}

@media (max-width: 767px) {
    .block-best-fit-projects.bfp-block {
        --bfp-section-pad-y: 64px;
        --bfp-card-height: 280px;
    }

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

@media (hover: none) {
    .bfp-card-text {
        max-height: 120px;
        opacity: 1;
    }

    .bfp-card-overlay {
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.24) 50%, rgba(0, 0, 0, 0.8) 100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .block-best-fit-projects.bfp-block * {
        transition: none !important;
        animation: none !important;
    }

    .bfp-card:hover .bfp-card-img,
    .bfp-card:focus-within .bfp-card-img {
        transform: none;
    }

    .bfp-card-text {
        max-height: none;
        opacity: 1;
    }

    .bfp-card-overlay {
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.24) 50%, rgba(0, 0, 0, 0.8) 100%);
    }
}
