/* Entrance animation keyframes */
@keyframes bw-slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bw-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bw-step-layout {
    display: block;
    width: 100%;
    margin: 60px 0;
}

.bw-step-layout__inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    padding: 40px 20px;
    position: relative;
}

.bw-step-layout__card {
    position: relative;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    height: 630px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bw-step-layout__card:hover {
    /* Card itself doesn't move */
}

.bw-step-layout__card:hover .bw-step-layout__background img {
    transform: scale(1.1);
}

.bw-step-layout__card[data-has-image="true"] {
    color: #fff;
}

.bw-step-layout__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, var(--overlay-opacity-bottom, 0.8)) 0%, 
        rgba(0, 0, 0, var(--overlay-opacity-top, 0.2)) 100%);
    z-index: 2;
}

.bw-step-layout__card[data-has-image="true"] .bw-step-layout__content {
    position: relative;
    z-index: 3;
}

.bw-step-layout__card[data-has-image="true"] .bw-step-layout__title,
.bw-step-layout__card[data-has-image="true"] .bw-step-layout__description {
    color: #fff;
}

.bw-step-layout__background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.bw-step-layout__background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bw-step-layout__content {
    padding: 30px;
    position: relative;
    z-index: 2;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start; /* Align content to left */
}

.bw-step-layout__title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.bw-step-layout__description {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    opacity: 0.9;
}

.bw-step-layout__button {
    display: inline-block;
    padding: 12px 24px;
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    cursor: pointer;
    width: auto;
}

.bw-step-layout__button:hover {
    background: #fff;
    color: #333;
}

/* Step effect - Low to High with entrance animation */
.bw-step-layout--low-to-high .bw-step-layout__card {
    opacity: 0;
}

.bw-step-layout--low-to-high.in-view .bw-step-layout__card {
    animation: bw-slide-in-left 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.bw-step-layout--low-to-high .bw-step-layout__card--1 {
    margin-top: 80px;
}

.bw-step-layout--low-to-high.in-view .bw-step-layout__card--1 {
    animation-delay: 0s;
}

.bw-step-layout--low-to-high .bw-step-layout__card--2 {
    margin-top: 40px;
}

.bw-step-layout--low-to-high.in-view .bw-step-layout__card--2 {
    animation-delay: 0.3s;
}

.bw-step-layout--low-to-high .bw-step-layout__card--3 {
    margin-top: 0;
}

.bw-step-layout--low-to-high.in-view .bw-step-layout__card--3 {
    animation-delay: 0.6s;
}

/* Step effect - High to Low with entrance animation */
.bw-step-layout--high-to-low .bw-step-layout__card {
    opacity: 0;
}

.bw-step-layout--high-to-low.in-view .bw-step-layout__card {
    animation: bw-slide-in-right 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.bw-step-layout--high-to-low .bw-step-layout__card--1 {
    margin-top: 0;
}

.bw-step-layout--high-to-low.in-view .bw-step-layout__card--1 {
    animation-delay: 0s;
}

.bw-step-layout--high-to-low .bw-step-layout__card--2 {
    margin-top: 40px;
}

.bw-step-layout--high-to-low.in-view .bw-step-layout__card--2 {
    animation-delay: 0.3s;
}

.bw-step-layout--high-to-low .bw-step-layout__card--3 {
    margin-top: 80px;
}

.bw-step-layout--high-to-low.in-view .bw-step-layout__card--3 {
    animation-delay: 0.6s;
}

/* Cards without background images */
.bw-step-layout__card:not([data-has-image="true"]) {
    background: #f8f9fa;
}

.bw-step-layout__card:not([data-has-image="true"]) .bw-step-layout__title {
    color: #333;
}

.bw-step-layout__card:not([data-has-image="true"]) .bw-step-layout__description {
    color: #666;
}

.bw-step-layout__card:not([data-has-image="true"]) .bw-step-layout__button {
    background: #333;
    color: #fff;
    border-color: #333;
}

.bw-step-layout__card:not([data-has-image="true"]) .bw-step-layout__button:hover {
    background: transparent;
    color: #333;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .bw-step-layout__inner {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .bw-step-layout__card {
        height: 500px;
    }

    .bw-step-layout__title {
        font-size: 24px;
    }
}

/* Mobile Stacking */
@media (max-width: 768px) {
    .bw-step-layout__inner {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 20px 0;
    }

    /* Reset animations on mobile */
    .bw-step-layout--low-to-high .bw-step-layout__card,
    .bw-step-layout--high-to-low .bw-step-layout__card {
        opacity: 1;
        animation: none;
    }

    .bw-step-layout--low-to-high .bw-step-layout__card--1,
    .bw-step-layout--low-to-high .bw-step-layout__card--2,
    .bw-step-layout--low-to-high .bw-step-layout__card--3,
    .bw-step-layout--high-to-low .bw-step-layout__card--1,
    .bw-step-layout--high-to-low .bw-step-layout__card--2,
    .bw-step-layout--high-to-low .bw-step-layout__card--3 {
        margin-top: 0;
        animation-delay: 0;
    }

    .bw-step-layout__card {
        /* Use min-height instead of fixed aspect ratio to ensure content is visible */
        width: 100%;
        height: auto;
        min-height: 400px;
        position: relative;
        display: flex;
        flex-direction: column;
    }
    
    .bw-step-layout__card .bw-step-layout__background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }
    
    .bw-step-layout__card .bw-step-layout__overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2;
    }
    
    .bw-step-layout__card .bw-step-layout__content {
        position: relative;
        z-index: 3;
        padding: 30px 20px;
        margin-top: auto; /* Push content to bottom */
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        background: linear-gradient(to top, 
            rgba(0, 0, 0, 0.9) 0%, 
            rgba(0, 0, 0, 0.7) 50%,
            rgba(0, 0, 0, 0.4) 100%);
    }

    .bw-step-layout__title {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .bw-step-layout__description {
        font-size: 14px;
        margin-bottom: 16px;
        line-height: 1.5;
    }

    .bw-step-layout__button {
        padding: 10px 20px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* Ensure content is readable even with background image */
    .bw-step-layout__card[data-has-image="true"] .bw-step-layout__title,
    .bw-step-layout__card[data-has-image="true"] .bw-step-layout__description,
    .bw-step-layout__card[data-has-image="true"] .bw-step-layout__button {
        color: #fff;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
}

/* Wide and Full alignments */
.bw-step-layout.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.bw-step-layout.alignfull {
    max-width: 100%;
}

.bw-step-layout.alignfull .bw-step-layout__inner {
    max-width: 1400px;
    margin: 0 auto;
}

/* Plain Mode Styles */
.bw-step-layout__card--plain {
    background: transparent !important;
    box-shadow: none !important;
    height: 630px; /* Match regular card height */
    padding: 0 20px;
    position: relative;
}

.bw-step-layout__card--plain .bw-step-layout__content {
    padding: 0;
    background: transparent !important;
    position: absolute;
    top: 50%; /* True vertical center */
    transform: translateY(-50%); /* Center based on content height */
    z-index: 1;
    width: calc(100% - 40px);
    text-align: left;
}

.bw-step-layout__card--plain .bw-step-layout__title {
    color: #000;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
}

.bw-step-layout__card--plain .bw-step-layout__description {
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    opacity: 1;
}

/* Simple Mode Styles */
.bw-step-layout--simple-mode .bw-step-layout__card {
    min-height: 630px; /* Match normal mode height */
    height: 630px; /* Fixed height like normal mode */
}

.bw-step-layout--simple-mode .bw-step-layout__content {
    padding: 40px;
    position: absolute;
    bottom: 40px; /* Position at bottom like normal mode */
    left: 0;
    right: 0;
    z-index: 2;
}

.bw-step-layout--simple-mode .bw-step-layout__title {
    margin-bottom: 0;
    font-size: 28px; /* Slightly larger for better visual balance */
    font-weight: 600;
}

.bw-step-layout--simple-mode .bw-step-layout__title a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.bw-step-layout--simple-mode .bw-step-layout__title a:hover {
    opacity: 0.8;
}

.bw-step-layout--simple-mode .bw-step-layout__description,
.bw-step-layout--simple-mode .bw-step-layout__button {
    display: none !important;
}

/* Simple Mode + Plain Mode combination */
.bw-step-layout--simple-mode .bw-step-layout__card--plain .bw-step-layout__content {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 20px;
    width: calc(100% - 40px);
}

.bw-step-layout--simple-mode .bw-step-layout__card--plain {
    height: 630px; /* Match regular height */
    min-height: 630px;
    display: flex;
    align-items: center;
    position: relative;
}

.bw-step-layout--simple-mode .bw-step-layout__card--plain .bw-step-layout__title {
    color: #000;
}

/* Ensure no background elements show in plain mode */
.bw-step-layout__card--plain .bw-step-layout__background,
.bw-step-layout__card--plain .bw-step-layout__overlay {
    display: none !important;
}

/* Plain mode cards use grid alignment for true vertical centering */
.bw-step-layout__inner {
    align-items: start; /* Default for stepped layout */
}

/* When any card is plain, center it vertically in the grid */
.bw-step-layout__card--plain {
    margin-top: 0 !important; /* Remove step margins */
    align-self: center !important; /* Center vertically in grid cell */
}

/* Mobile plain mode */
@media (max-width: 768px) {
    .bw-step-layout__card--plain {
        padding: 40px 20px;
        height: auto;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .bw-step-layout__card--plain .bw-step-layout__content {
        position: relative;
        transform: none;
        top: auto;
        padding: 0;
        width: 100%;
        background: transparent !important;
        margin-top: 0;
    }
    
    .bw-step-layout--low-to-high .bw-step-layout__card--plain,
    .bw-step-layout--high-to-low .bw-step-layout__card--plain {
        margin-top: 0;
    }
    
    .bw-step-layout__card--plain .bw-step-layout__title {
        font-size: 24px;
    }
    
    .bw-step-layout__card--plain .bw-step-layout__description {
        font-size: 15px;
    }
    
    /* Simple mode on mobile */
    .bw-step-layout--simple-mode .bw-step-layout__card {
        min-height: 300px;
    }
    
    .bw-step-layout--simple-mode .bw-step-layout__content {
        padding: 30px 20px;
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin-top: auto;
    }
}