/* lib/styles/components/foundations_triptych_section.css */

.triptych-section {
    background-color: var(--color-paper-white);
    padding: var(--space-3xl) 0;
    position: relative;
    overflow-x: hidden;
}

.triptych-section__header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.triptych-section__eyebrow {
    font-family: var(--font-heading);
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
    color: var(--color-support-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.triptych-section__title {
    margin-top: 0;
    color: var(--color-justice-blue);
    font-size: clamp(2rem, 1.7rem + 1vw, 2.5rem);
}

/* =========================================
   The Flex Accordion Logic
   ========================================== */
.triptych-container {
    display: flex;
    gap: var(--space-lg);
    height: 560px;
    width: 100%;
}

.triptych-card {
    flex: 1 1 0%;
    position: relative;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: default;
    box-shadow: var(--shadow-sm);
    transition: flex-grow 1.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.8s ease;
}

.triptych-container:hover .triptych-card {
    flex-grow: 1;
}

.triptych-container .triptych-card:hover {
    flex-grow: 3;
    box-shadow: var(--shadow-lg);
}

/* =========================================
   Image & Overlay Layer
   ========================================== */
.triptych-card__media-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: height 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.triptych-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.5s ease;
}

.triptych-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 32, 48, 0.2) 0%, rgba(16, 32, 48, 0.85) 100%);
    transition: opacity 1.2s ease;
}

.triptych-card:hover .triptych-card__media-layer {
    height: 45%;
}

.triptych-card:hover .triptych-card__image {
    transform: scale(1.05);
}

/* =========================================
   Content Layer (The Glide Animation)
   ========================================== */
.triptych-card__content-layer {
    position: absolute;
    top: 100%;
    transform: translateY(calc(-100% - var(--space-2xl)));
    left: var(--space-2xl);
    right: var(--space-2xl);
    min-width: 280px;
    z-index: 2;
    transition:
        top 1.2s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.triptych-card:hover .triptych-card__content-layer {
    top: 45%;
    transform: translateY(var(--space-2xl));
}

.triptych-card__title {
    margin: 0;
    font-size: var(--fs-h2);
    color: var(--color-white);
    transition: color 0.6s ease 0.15s;
}

.triptych-card__subtitle {
    margin: var(--space-xs) 0 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--fs-body);
    opacity: 1;
    max-height: 50px;
    /* Sped up the subtitle fade-out slightly to ensure it vanishes before the card shrinks */
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.triptych-card__desc {
    margin: 0;
    color: var(--color-neutral-navy);
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.8s ease 0.3s, max-height 0.8s ease 0.15s, margin 0.8s ease;
}

/* =========================================
   Hover State Triggers
   ========================================== */
.triptych-card:hover .triptych-card__title {
    color: var(--color-justice-blue);
}

/* CRITICAL FIX: Hide subtitle for ALL cards when ANY card is hovered */
.triptych-container:hover .triptych-card__subtitle {
    opacity: 0;
    max-height: 0;
    margin: 0;
}

.triptych-card:hover .triptych-card__desc {
    opacity: 1;
    max-height: 300px;
    margin-top: var(--space-md);
}

/* =========================================
   Responsive Fallbacks (Mobile Stack)
   ========================================== */
@media (max-width: 1024px) {
    .triptych-container {
        height: 480px;
    }

    .triptych-card__desc {
        font-size: var(--fs-body);
    }
}

@media (max-width: 768px) {
    .triptych-container {
        flex-direction: column;
        height: auto;
    }

    .triptych-card {
        height: 400px;
        flex: auto !important;
    }

    .triptych-card__media-layer {
        height: 40% !important;
    }

    .triptych-card__content-layer {
        top: 40% !important;
        transform: translateY(var(--space-xl)) !important;
        left: var(--space-xl);
        right: var(--space-xl);
        min-width: auto;
    }

    .triptych-card__title {
        color: var(--color-justice-blue) !important;
        font-size: var(--fs-h3);
    }

    .triptych-card__subtitle {
        display: none;
    }

    .triptych-card__desc {
        opacity: 1 !important;
        max-height: 500px !important;
        margin-top: var(--space-sm) !important;
    }
}