﻿/**
 * Creajeux Formation Panels Module
 * Volets accordeon survolables
 */

/* Container */
.cj-formation-panels {
    display: flex;
    gap: 6px;
    height: var(--cj-fp-height, 540px);
}

/* Individual card */
.cj-formation-card {
    position: relative;
    flex-basis: 0;
    flex-grow: 1;
    min-width: 0;
    cursor: pointer;
    overflow: hidden;
    transition: flex-grow 0.55s cubic-bezier(0.7, 0, 0.2, 1);
    background: #f5f2ec;
    color: #15130f;
}

/* Active state - expanded */
.cj-formation-card.is-active {
    flex-grow: var(--cj-fp-expand-ratio, 4.2);
}

/* Compact number (visible when collapsed) */
.cj-formation-compact-number {
    position: absolute;
    top: 32px;
    left: 28px;
    z-index: 2;
    font-family: "Saira Condensed", sans-serif;
    font-size: clamp(32px, 3.4vw, 54px);
    font-weight: 900;
    line-height: 0.85;
    color: #eb5d0f;
    transition: opacity 0.22s ease;
}

/* Compact title wrapper */
.cj-formation-compact-title-wrap {
    position: absolute;
    bottom: 26px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 2;
}

/* Compact title (vertical text when collapsed) */
.cj-formation-compact-title {
    font-family: "Saira Condensed", sans-serif;
    font-weight: 800;
    font-size: 26px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #15130f;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* Hide compact elements when active */
.cj-formation-card.is-active .cj-formation-title-compact,
.cj-formation-card.is-active .cj-formation-compact-number {
    opacity: 0;
    pointer-events: none;
}

/* Expanded panel (hidden by default) */
.cj-formation-panel {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Show panel when active */
.cj-formation-card.is-active .cj-formation-panel {
    opacity: 1;
    pointer-events: auto;
}

/* Background image */
.cj-formation-image {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
    object-position: right center;
    opacity: 0.7;
    z-index: 1;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(
        to right,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 1) 100%
    );
    mask-image: linear-gradient(
        to right,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 1) 100%
    );
}

/* Content container */
.cj-formation-content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(680px, calc(100vw - 72px));
    max-width: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 36px;
    z-index: 2;
}

/* Kicker (small label above title) */
.cj-formation-kicker {
    font-family: var(--cj-font-display);
    font-size: 13px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #eb5d0f;
    margin-bottom: 10px;
}

/* Main title */
.cj-formation-title {
    margin: 0 0 6px;
    font-family: "Saira Condensed", sans-serif;
    font-weight: 900;
    font-size: clamp(34px, 3.6vw, 58px);
    line-height: 0.9;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: #15130f;
}

/* Subtitle */
.cj-formation-subtitle {
    font-family: "Saira", sans-serif;
    font-size: 18px;
    color: #544e45;
    margin-bottom: 20px;
}

/* Description */
.cj-formation-description {
    margin: 0 0 22px;
    max-width: 440px;
    font-size: 15px;
    line-height: 1.55;
    color: #5c564c;
}

/* Tags container */
.cj-formation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

/* Individual tag */
.cj-formation-tag {
    font-family: var(--cj-font-display);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #15130f;
    border: 1px solid rgba(0, 0, 0, 0.22);
    padding: 7px 12px;
}

/* CTA button */
.cj-formation-link-button {
    display: inline-flex;
    align-self: flex-start;
    align-items: stretch;
    height: 46px;
    cursor: pointer;
    font-family: "Saira Condensed", sans-serif;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
}

.cj-formation-link-label {
    background: #15130f;
    color: #f5f2ec;
    padding: 0 20px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.cj-formation-link-icon {
    background: #eb5d0f;
    color: #0b0a09;
    width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* Accent bar on left side */
.cj-formation-accent-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #eb5d0f;
    z-index: 3;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1080px) {
    .cj-formation-panels {
        height: 500px;
    }

    .cj-formation-content {
        width: min(560px, calc(100vw - 64px));
        padding: 30px;
    }
}

@media (min-width: 721px) and (max-width: 1180px), (orientation: portrait) and (min-width: 721px) {
    .cj-formation-panels {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
        height: auto;
        min-height: 0;
        gap: 14px;
    }

    .cj-formation-card,
    .cj-formation-card.is-active {
        display: flex;
        flex: none !important;
        min-height: 0;
        cursor: default;
        transition: none;
    }

    .cj-formation-compact-title-wrap,
    .cj-formation-compact-number {
        display: none;
    }

    .cj-formation-panel,
    .cj-formation-card.is-active .cj-formation-panel {
        position: relative;
        flex: 1 1 auto;
        height: 100%;
        min-height: clamp(520px, 52vh, 680px);
        opacity: 1;
        pointer-events: auto;
    }

    .cj-formation-content {
        position: relative;
        inset: auto;
        width: 100%;
        height: 100%;
        min-height: inherit;
        padding: clamp(24px, 3vw, 34px);
    }

    .cj-formation-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.34;
        -webkit-mask-image: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.75) 44%,
            rgba(0, 0, 0, 0.08) 100%
        );
        mask-image: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.75) 44%,
            rgba(0, 0, 0, 0.08) 100%
        );
    }

    .cj-formation-title {
        font-size: clamp(34px, 5.4vw, 52px);
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    .cj-formation-description {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .cj-formation-link-button {
        max-width: 100%;
    }

    .cj-formation-link-label {
        min-width: 0;
        white-space: normal;
        line-height: 1.05;
    }

    .cj-formation-accent-bar {
        position: absolute;
        inset: 0 auto 0 0;
        height: auto;
    }
}

@media (max-width: 720px) {
    .cj-formation-panels {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 5px;
    }

    .cj-formation-card {
        flex: 0 0 auto !important;
        min-height: 88px;
        max-height: 88px;
        transition: max-height 0.45s cubic-bezier(0.7, 0, 0.2, 1);
    }

    .cj-formation-card.is-active {
        min-height: 0;
        max-height: 980px;
    }

    .cj-formation-compact-number {
        top: 20px;
        left: 22px;
        font-size: 34px;
    }

    .cj-formation-compact-title-wrap {
        top: 22px;
        bottom: auto;
        left: 78px;
        right: 18px;
        justify-content: flex-start;
    }

    .cj-formation-compact-title {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 22px;
        line-height: 1;
    }

    .cj-formation-content {
        position: relative;
        inset: auto;
        width: 100%;
        min-height: 520px;
        padding: 26px 22px 24px;
    }

    .cj-formation-card.is-active .cj-formation-panel {
        position: relative;
        min-height: 0;
    }

    .cj-formation-image {
        opacity: 0.42;
    }

    .cj-formation-title {
        font-size: clamp(30px, 10.5vw, 44px);
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    .cj-formation-description {
        max-width: min(430px, 100%);
        font-size: 14px;
        overflow-wrap: break-word;
    }

    .cj-formation-tags {
        gap: 6px;
        margin-bottom: 16px;
    }

    .cj-formation-tag {
        font-size: 9px;
        padding: 6px 9px;
    }

    .cj-formation-link-button {
        max-width: 100%;
        height: 42px;
        font-size: 12px;
    }

    .cj-formation-link-label {
        min-width: 0;
        white-space: normal;
    }
}

@media (max-width: 420px) {
    .cj-formation-content {
        min-height: 560px;
        padding-inline: 18px;
    }

    .cj-formation-card.is-active {
        max-height: 1120px;
    }
}
