/**
 * Mortgage product cards — expandable, compact by default
 * Hover (desktop) / click (mobile) to reveal full content
 * Mobile-first: 1 col → 2 cols → 3 cols
 */

/* ——— MOBILE (base) ——— */
.loan-products {
    padding: clamp(1.75rem, 5vw, 2.5rem) 0;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-secondary) 45%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.loan-products::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 40%;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(11, 22, 53, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.loan-products .section-header,
.loan-products .sec-head,
.loan-products .products-grid,
.loan-products .products-disclaimer {
    position: relative;
    z-index: 1;
}

.loan-products .section-header,
.loan-products .sec-head {
    max-width: var(--container, 1200px);
    margin: 0 auto clamp(2rem, 4vw, 2.5rem);
    padding: 0 var(--gutter, 1rem);
}

.loan-products .section-header h2,
.loan-products .sec-head h2 {
    color: var(--navy, var(--brand-navy));
    margin: 0 0 0.5rem 0;
    display: block;
}

.loan-products .section-header p,
.loan-products .sec-head p {
    color: var(--muted, var(--text-secondary));
    margin: 0;
    display: block;
}

/* ——— Products disclaimer (mobile-first) ——— */
.loan-products .products-disclaimer-wrap {
    width: 100%;
    max-width: var(--container, 1200px);
    margin: clamp(1.5rem, 5vw, 2rem) auto 0;
    padding: 0 var(--gutter, 1rem) clamp(0.5rem, 2vw, 1rem);
    position: relative;
    z-index: 1;
}

.loan-products .products-disclaimer {
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 1.25rem) 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    max-width: 42rem;
    color: var(--muted, var(--text-secondary));
    font-size: clamp(0.75rem, 1.8vw, 0.8125rem);
    line-height: 1.65;
    letter-spacing: 0.02em;
    text-align: center;
}

.products-grid {
    max-width: var(--container, 1200px);
    margin: 0 auto;
    padding: 0 var(--gutter, 1rem);
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}

/* ——— Expandable card (compact by default) ——— */
.product-card {
    background: #FFFFFF;
    border-radius: var(--radius-card);
    padding: clamp(0.9rem, 2.5vw, 1.05rem) clamp(0.9rem, 2.5vw, 1.2rem);
    position: relative;
    box-shadow: 0 2px 10px rgba(11, 22, 53, 0.06);
    border: 1px solid rgba(11, 22, 53, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease,
                border-color 0.2s ease,
                background 0.2s ease;
    min-width: 0;
    width: 100%;
}

.product-card:focus-visible {
    outline: 2px solid var(--gold, var(--brand-orange));
    outline-offset: 2px;
}

.product-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    position: relative;
    padding-right: 2.25rem;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0;
}

/* Expand chevron (in HTML, enhanced by JS) — click target on mobile (44px min) */
.product-card-chevron {
    position: absolute;
    top: -0.15rem;
    right: -0.15rem;
    width: 1.9rem;
    height: 1.9rem;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid rgba(11, 22, 53, 0.12);
    border-radius: var(--radius-btn);
    cursor: pointer;
    color: var(--gold, var(--brand-orange));
    font-size: 0.85rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto;
    z-index: 3;
}

.product-card-chevron:focus-visible {
    outline: 2px solid var(--gold, var(--brand-orange));
    outline-offset: 2px;
}

.product-card-chevron::before {
    content: '›';
    display: block;
    transform: rotate(90deg);
}

/* Desktop: card has pointer for hover; mobile: only chevron is interactive */
@media (hover: none) {
    .product-card {
        cursor: default;
    }
    .product-card-chevron {
        cursor: pointer;
    }
}

.product-card.expanded .product-card-chevron {
    transform: rotate(180deg);
    color: var(--gold, var(--brand-orange));
    background: #eef2f7;
    border-color: rgba(11, 22, 53, 0.2);
}

.product-card-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.25rem;
}

.product-icon {
    width: clamp(28px, 6vw, 34px);
    height: clamp(28px, 6vw, 34px);
    flex-shrink: 0;
    color: var(--gold, var(--brand-orange));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent;
    border: none;
}

.product-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.product-number {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted, var(--text-secondary));
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.product-card h3 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    font-weight: 700;
    color: var(--charcoal, var(--brand-navy-light));
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Description + bottom: collapsed by default */
.product-card-top > p,
.product-card-bottom {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                padding 0.3s ease,
                margin 0.3s ease;
}

.product-card-top > p {
    font-size: 0.8125rem;
    color: var(--muted, var(--text-secondary));
    line-height: 1.6;
    margin: 0;
    flex-basis: 100%;
    width: 100%;
    overflow-wrap: anywhere;
}

/* Expanded state: show content */
.product-card.expanded .product-card-top > p,
.product-card.expanded .product-card-bottom {
    max-height: 2000px;
    overflow: visible;
    opacity: 1;
}

.product-card.expanded .product-card-top {
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(11, 22, 53, 0.08);
    margin-bottom: 0;
}

.product-card.expanded .product-card-top > p {
    margin-top: 0.5rem;
}

.product-card-bottom {
    padding-top: 0;
    margin-top: 0;
}

.product-card.expanded .product-card-bottom {
    padding-top: 0.85rem;
}

.product-card.expanded {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(11, 22, 53, 0.1);
    border-color: rgba(11, 22, 53, 0.16);
}

.product-highlights-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(11, 22, 53, 0.62);
    margin: 0 0 0.55rem 0;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
/* Remove "HIGHLIGHTS" label per design request */
.product-highlights-title { display: none; }

.product-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.product-features li {
    padding: 0.44rem 0.625rem;
    color: var(--charcoal, var(--brand-navy-light));
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
    border-radius: var(--radius-btn);
    background: linear-gradient(180deg, rgba(255, 102, 0, 0.08) 0%, rgba(255, 102, 0, 0.03) 100%);
    border: 1px solid rgba(255, 102, 0, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(255, 102, 0, 0.08);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    overflow-wrap: anywhere;
    word-break: break-word;
}


.product-features li::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.95rem;
    height: 0.95rem;
    min-width: 0.95rem;
    font-size: 0.52rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, #ff7d20 0%, var(--brand-orange) 100%);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 5px rgba(255, 102, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Desktop/web hover effects (visual only; no auto-open) */
@media (hover: hover) and (pointer: fine) {
    .product-features li:hover {
        background: linear-gradient(180deg, rgba(255, 102, 0, 0.14) 0%, rgba(255, 102, 0, 0.07) 100%);
        border-color: rgba(255, 102, 0, 0.28);
        color: var(--navy, var(--brand-navy));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 3px 8px rgba(255, 102, 0, 0.16);
    }

    .product-features li:hover::before {
        transform: scale(1.08);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 3px 8px rgba(255, 102, 0, 0.45);
    }
}

/* Mobile bug fixes: prevent clipping and oversized cards */
@media (max-width: 639px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0 max(0.75rem, var(--gutter, 1rem));
    }

    .product-card {
        padding: 0.85rem 0.85rem;
    }

    .product-card-chevron {
        right: -0.05rem;
        top: -0.05rem;
        width: 2rem;
        height: 2rem;
        min-width: 36px;
        min-height: 36px;
    }

    .product-card.expanded .product-card-bottom,
    .product-card.expanded .product-card-top > p {
        overflow: visible;
    }

    .product-features li {
        align-items: flex-start;
    }
    .product-card:hover,
    .product-card.expanded {
        transform: none;
        box-shadow: 0 6px 16px rgba(11, 22, 53, 0.09);
    }
}

/* ——— TABLET (640px+) ——— */
@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(1rem, 2.5vw, 1.5rem);
        padding: 0 var(--gutter);
    }

    .product-card {
        padding: clamp(1rem, 2.5vw, 1.25rem) clamp(1rem, 2.5vw, 1.5rem);
    }

    .product-card h3 {
        font-size: 1.0625rem;
    }

    .product-card-top > p {
        font-size: 0.875rem;
    }

    .product-features li {
        font-size: 0.875rem;
        padding: 0.45rem 0.625rem;
    }
}

/* ——— TABLET (768px+) ——— */
@media (min-width: 768px) {
    .products-grid {
        gap: 1.5rem;
    }

    .product-card {
        padding: 1.25rem 1.5rem;
    }
}

/* ——— DESKTOP (1024px+) ——— */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    .product-card {
        padding: 1.25rem 1.5rem;
    }

    .product-card h3 {
        font-size: 1.125rem;
    }

    .product-card:nth-child(8) {
        grid-column: 2 / 3;
    }
}

/* ——— Reduced motion ——— */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-card-chevron,
    .product-card-top > p,
    .product-card-bottom {
        transition-duration: 0.01ms !important;
    }
}
