/* Services — Mentoring & Coaching Formats */
.services-formats-section {
    padding: 0 120px;
}

.services-formats-container {
    max-width: 1200px;
    margin: 0 auto;
}

.services-formats-header {
    margin-bottom: 48px;
}

.formats-title {
    color: #ed6a59;
    font-family: 'IvyOra Display', serif;
    font-weight: 700;
    font-size: 32px;
    margin: 0 0 16px 0;
}

/* utility class for emphasizing part of the formats title */
.formats-title em,
.formats-title-italic {
    font-style: italic;
    font-weight: 500;
}

.formats-intro {
    color: #403936;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    font-weight: normal;
    margin: 0 0 24px 0;
}

/* 3-column grid for desktop and tablet (≥1200px) */
.formats-grid--3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 156px);
    gap: 18.85px 26.79px;
    margin-bottom: 19px;
    align-items: stretch;
}

.formats-body:last-child {
    margin-bottom: 0;
}

.formats-illustration--grid {
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: stretch;
}

/* Ensure the cards wrapper doesn't break grid layout on desktop
   display: contents lets children participate in parent grid */
.formats-cards-wrap {
    display: contents;
}

.formats-illustration-inner {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.formats-illustration-inner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.formats-illustration-inner:hover::after {
    opacity: 1;
}

.formats-body--image-left .formats-illustration {
    border-radius: 200px 20px 20px 200px;
    overflow: hidden;
}

.formats-body--image-right .formats-illustration {
    border-radius: 20px 200px 200px 20px;
    overflow: hidden;
}

.formats-illustration-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* display: block; */
}

/* default: show desktop image, hide mobile image */
.formats-img--mobile {
    display: none;
}

.formats-img--desktop {
    display: block;
}

/* .formats-cards no longer needed in grid layout */

.formats-card {
    background: #eed1cc;
    min-height: 156px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-width: 0;
}

.formats-card--active-initial .formats-card-description {
    opacity: 1;
    max-height: 120px;
    /* You can set this to your preferred value */
    margin-top: 12px;
    transition:
        opacity 0.28s,
        max-height 0.32s,
        margin-top 0.28s;
}

.formats-card--empty {
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

/* Initial active state for first card to show interactivity */
.formats-card--active-initial {
    background: #ed6a59;
    color: #fff;
}

.formats-card--active-initial .formats-card-title {
    color: #fff;
}

/* Reset active-initial card when hovering on any other card */
.formats-cards-wrap:has(.formats-card:hover) .formats-card--active-initial:not(:hover) {
    background: #eed1cc;
    color: inherit;
}

.formats-cards-wrap:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-title {
    color: inherit;
}

.formats-cards-wrap:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-description {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
}

/* Also apply the same reset when any card in the grid is hovered.
   Some layouts place cards outside the same .formats-cards-wrap, so
   target the grid ancestor to ensure the initial-active card resets
   whenever any card is hovered. */
.formats-grid--3col:has(.formats-card:hover) .formats-card--active-initial:not(:hover) {
    background: #eed1cc;
    color: inherit;
}

.formats-grid--3col:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-title {
    color: inherit;
}

.formats-grid--3col:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-description {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
}

/* Fallback: also apply at the section level to cover other markup variations */
.services-formats-section:has(.formats-card:hover) .formats-card--active-initial:not(:hover) {
    background: #eed1cc;
    color: inherit;
}

.services-formats-section:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-title {
    color: inherit;
}

.services-formats-section:has(.formats-card:hover) .formats-card--active-initial:not(:hover) .formats-card-description {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
}

.formats-card {
    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

/* Apply orange background on hover for all cards */
.formats-card:hover {
    background: #ed6a59;
    color: #fff;
}

.formats-card:hover .formats-card-title {
    color: inherit;
}

.formats-card-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 20px;
    text-align: center;
    margin: 0;
    color: inherit;
}

/* Add hover effect to show title and description */
.formats-card {
    position: relative;
    overflow: hidden;
}

.formats-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.formats-card-title {
    color: inherit;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 20px;
    text-align: center;
    font-weight: 700;
    margin: 0;
    transition:
        color 0.24s,
        transform 0.28s;
    z-index: 2;
}

.formats-card-description {
    color: #fff;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 20px;
    text-align: center;
    margin: 0;
    margin-top: 12px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition:
        opacity 0.28s,
        max-height 0.32s,
        margin-top 0.28s;
}

.formats-card:hover .formats-card-title {
    color: #fff;
}

.formats-card:hover .formats-card-description {
    opacity: 1;
    max-height: 85px;
    margin-top: 12px;
}

@media (max-width: 1200px) {
    .services-formats-section {
        padding: 0 60px;
    }

    /* Tablet: 2x2 card grid, image below cards */
    .formats-grid--3col {
        display: flex;
        flex-direction: column;
        gap: 18.85px;
        margin-bottom: 19px;
    }

    .formats-cards-wrap {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0;
    }

    .formats-cards-wrap .formats-card {
        width: 49%;
        min-width: 0;
        min-height: 0;
        margin-bottom: 0;
        display: inline-block;
        margin-right: 2%;
    }

    .formats-card {
        height: 156px;
    }

    .formats-cards-wrap .formats-card:nth-child(2),
    .formats-cards-wrap .formats-card:nth-child(4) {
        margin-right: 0;
    }

    .formats-cards-wrap .formats-card:nth-child(1),
    .formats-cards-wrap .formats-card:nth-child(2) {
        margin-bottom: 18.85px;
    }

    .formats-illustration--after-cards {
        width: 100%;
        height: 570px;
        /* tablet image height per Figma */
        margin-top: 18.85px;
        margin-bottom: 0;
        order: 2;
        grid-column: auto;
        grid-row: auto;
        display: flex;
    }

    .formats-illustration-inner {
        width: 100%;
        max-height: 570px;
        min-height: 0;
        min-width: 0;
    }

    /* Hide desktop image, show mobile image below 1200px */
    .formats-img--desktop {
        display: none;
    }

    .formats-img--mobile {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 767px) {
    .services-formats-section {
        padding: 0 24px;
    }

    .formats-grid--3col {
        gap: 12px;
    }

    .formats-grid--3col .formats-card {
        width: 100%;
        display: block;
        margin-right: 0;
        margin-bottom: 12px;
        height: auto;
        min-height: 156px;
    }

    .formats-grid--3col .formats-illustration--grid {
        height: 327px;
        /* mobile image height per Figma */
        margin-top: 12px;
    }

    .formats-illustration-inner {
        width: 100%;
    }

    .formats-illustration-inner img {
        width: 100%;
        height: 100%;
        max-height: 327px;
        object-fit: cover;
        object-position: center;
    }

    /* swap images on mobile */
    .formats-img--desktop {
        display: none;
    }

    .formats-img--mobile {
        display: block;
    }

    .formats-title {
        font-size: 24px;
        text-align: left;
    }
}
