/* ==========================================================
   Bahia Palace Card Widget – style.css  v1.2.0
   Layout engine: CSS Grid (more stable than flexbox for
   mixed image+content cards with variable text length)
   ========================================================== */

/* ── Reset ── */
.bpc-card,
.bpc-card *,
.bpc-card *::before,
.bpc-card *::after {
    box-sizing: border-box;
}

/* ============================================================
   BASE CARD
   Always fills 100% of the Elementor column — never sized
   by its own content.
   ============================================================ */
.bpc-card {
    display: grid;                 /* CSS Grid — rock solid */
    width: 100%;
    background-color: #fff;
    border: 2px dashed #ccc;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
                box-shadow 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ============================================================
   HORIZONTAL  — grid: [image] [content]
   image column = CSS variable (default 42%)
   content column = everything that's left (1fr)
   ============================================================ */
.bpc-card--horizontal {
    grid-template-columns: var(--bpc-img-w-h, 42%) 1fr;
    grid-template-rows: 1fr;       /* single row, both cells full height */
    min-height: 160px;
}

.bpc-card--horizontal .bpc-card__image-wrap {
    grid-column: 1;
    grid-row: 1;
}

.bpc-card--horizontal .bpc-card__body {
    grid-column: 2;
    grid-row: 1;
}

/* ============================================================
   VERTICAL  — grid: [image] / [content]
   ============================================================ */
.bpc-card--vertical {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
}

.bpc-card--vertical .bpc-card__image-wrap {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: var(--bpc-img-ratio-v, 16/10);
}

.bpc-card--vertical .bpc-card__body {
    grid-column: 1;
    grid-row: 2;
}

/* ============================================================
   IMAGE WRAP + IMAGE
   ============================================================ */
.bpc-card__image-wrap {
    position: relative;
    overflow: hidden;
    /* Grid cell fills naturally — no width/height needed */
}

.bpc-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bpc-card:hover .bpc-card__image {
    transform: scale(1.04);
}

/* ============================================================
   BODY
   Uses flexbox internally to stack title / desc / button
   ============================================================ */
.bpc-card__body {
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 0;        /* let grid control height */
    overflow: hidden;
}

/* ============================================================
   TITLE
   ============================================================ */
.bpc-card__title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
    /* Clamp to 3 lines max — prevents overflow with long titles */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   DESCRIPTION
   Clamped to 3 lines — layout never depends on text length
   ============================================================ */
.bpc-card__desc {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 14px 0;
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    /* Min-height = exactly 1 line — prevents collapse with 0 words */
    min-height: 1.5em;
}

/* ============================================================
   BUTTON + PRICE ROW
   Pushed to bottom of body by margin-top: auto
   ============================================================ */
.bpc-card__btn-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    flex-wrap: nowrap;
    padding-top: 8px;
}

/* ── Button: underline via ::after, sized to text width ── */
.bpc-card__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #111;
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.25s ease, gap 0.25s ease;
}

.bpc-card__btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #111;
    border-radius: 2px;
}

.bpc-card__btn:hover { color: #444; gap: 10px; }
.bpc-card__btn:hover .bpc-card__btn-arrow { transform: translateX(4px); }

.bpc-card__btn-arrow {
    display: inline-block;
    font-size: 1em;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Hide old div-based elements */
.bpc-card__btn-line { display: none; }
.bpc-card__btn-col  { display: contents; }

/* ── Price ── */
.bpc-card__price {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    flex-shrink: 0;
}

.bpc-card__price-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    color: #555;
}

.bpc-card__price-amount {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #111;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bpc-card__price-currency {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
}

/* ============================================================
   HOVER LIFT
   ============================================================ */
.bpc-card--hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   MOBILE  ≤ 767px
   Both layouts collapse to horizontal (image left, text right)
   Image width controlled by --bpc-img-w-mobile variable
   ============================================================ */
@media (max-width: 767px) {

    /* Force both layouts into horizontal grid on mobile */
    .bpc-card--horizontal,
    .bpc-card--vertical {
        grid-template-columns: var(--bpc-img-w-mobile, 38%) 1fr;
        grid-template-rows: 1fr;
        min-height: 120px;
    }

    /* Image always in column 1 */
    .bpc-card--vertical .bpc-card__image-wrap,
    .bpc-card--horizontal .bpc-card__image-wrap {
        grid-column: 1;
        grid-row: 1;
        aspect-ratio: unset;   /* height driven by grid row, not aspect ratio */
    }

    /* Body always in column 2 */
    .bpc-card--vertical .bpc-card__body,
    .bpc-card--horizontal .bpc-card__body {
        grid-column: 2;
        grid-row: 1;
        padding: 12px 14px;
    }

    /* Scale down text on mobile */
    .bpc-card__title {
        font-size: clamp(0.85rem, 3.5vw, 1.2rem);
        margin-bottom: 6px;
        -webkit-line-clamp: 2;
    }

    .bpc-card__desc {
        font-size: clamp(0.7rem, 2.8vw, 0.82rem);
        margin-bottom: 8px;
        -webkit-line-clamp: 2;
        min-height: unset;
    }

    .bpc-card__btn {
        font-size: clamp(0.65rem, 2.8vw, 0.82rem);
    }

    .bpc-card__btn-row {
        gap: 10px;
        padding-top: 4px;
    }

    .bpc-card__price-amount { font-size: 1rem; }
}

/* ============================================================
   ENTRANCE ANIMATIONS
   ============================================================ */
.bpc-animate {
    opacity: 0;
    will-change: transform, opacity;
}

.bpc-animate--fade-up    { transform: translateY(30px); }
.bpc-animate--fade-in    { transform: none; }
.bpc-animate--zoom-in    { transform: scale(0.94); }
.bpc-animate--slide-left  { transform: translateX(-50px); }
.bpc-animate--slide-right { transform: translateX(50px); }

.bpc-animate.bpc-is-visible {
    animation: bpc-reveal var(--bpc-duration, 700ms) cubic-bezier(0.22, 0.61, 0.36, 1)
               var(--bpc-delay, 0ms) forwards;
}

@keyframes bpc-reveal {
    to { opacity: 1; transform: translate(0, 0) scale(1); }
}

.elementor-editor-active .bpc-animate {
    opacity: 1 !important;
    transform: none !important;
}
