/*
Block Name: Expanding Columns
Description: Full-width row of image panels that expand on hover. Captions always visible.
Mobile: horizontal scroll with snap points.
*/


/* ─── Full width override ─────────────────────────────────────────── */
.block-expanding-columns .container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}


/* ─── Row ─────────────────────────────────────────────────────────── */
.block-expanding-columns .exp-row {
    display: flex;
    gap: 20px;
    height: 460px;
}


/* ─── Individual panel ────────────────────────────────────────────── */
.block-expanding-columns .exp-col {
    position: relative;
    overflow: hidden;
    flex: 1;
    border-radius: 6px;
    min-width: 0;
    transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.block-expanding-columns .exp-col:hover {
    flex: 3;
}


/* ─── Image ───────────────────────────────────────────────────────── */
.block-expanding-columns .exp-col img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.5s ease;
    display: block;
}

.block-expanding-columns .exp-col:hover img {
    transform: scale(1.04);
}


/* ─── Caption (always visible) ────────────────────────────────────── */
.block-expanding-columns .exp-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 64px 18px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 100%);
    z-index: 1;
}

.block-expanding-columns .exp-caption h3 {
    color: #fff;
    font-size: 3rem;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.block-expanding-columns .exp-caption p {
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ─── Link arrow (appears on hover) ──────────────────────────────── */
.block-expanding-columns .exp-link-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.block-expanding-columns .exp-col:hover .exp-link-arrow {
    opacity: 1;
    transform: translateY(0);
}


/* ─── Full-panel link overlay ─────────────────────────────────────── */
.block-expanding-columns .exp-link {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    text-decoration: none;
}


/* ─── Admin preview ───────────────────────────────────────────────── */
body.wp-admin .block-expanding-columns .exp-col {
    flex: 1 !important;
}

body.wp-admin .block-expanding-columns .exp-caption h3:empty::before,
body.wp-admin .block-expanding-columns .exp-caption p:empty::before {
    color: red;
    font-weight: 600;
    font-size: 12px;
}

body.wp-admin .block-expanding-columns .exp-caption h3:empty::before {
    content: "Add a name";
}

body.wp-admin .block-expanding-columns .exp-caption p:empty::before {
    content: "Add a subtitle";
}


/* ─── Mobile: horizontal scroll ──────────────────────────────────── */
@media(max-width: 768px) {
    .block-expanding-columns .container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .block-expanding-columns .exp-row {
        flex-wrap: nowrap;
        width: max-content;
        scroll-snap-type: x mandatory;
        height: 380px;
        gap: 12px;
        padding: 0 20px;
    }

    .block-expanding-columns .exp-col {
        flex: 0 0 72vw;
        scroll-snap-align: start;
        transition: none;
    }

    .block-expanding-columns .exp-col:hover {
        flex: 0 0 72vw;
    }

    .block-expanding-columns .exp-col img {
        transition: none;
    }

    .block-expanding-columns .exp-col:hover img {
        transform: none;
    }

    .block-expanding-columns .exp-link-arrow {
        opacity: 1;
        transform: translateY(0);
    }
}