.expanding-card {
    position: relative;
    padding: 0;
    background: #1a1b20;
    border: 1px solid rgba(102, 204, 254, 0.15);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    transition:
        all 0.35s ease;
    will-change:
        top,
        left,
        transform,
        box-shadow,
        border-color,
        height,
        width;
}

.expanding-card::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 15px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.02),
            rgba(102, 204, 254, 0.05));
    pointer-events: none;
    z-index: 0;
}

.expanding-card-close {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid rgba(102, 204, 254, 0.25);
    background: rgba(20, 21, 25, 0.8);
    color: var(--text-main);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    top: 1.5rem;
    position: absolute;
    display: flex;
    /* always there */
    opacity: 0;
    transform: scale(0%);
    margin-left: -2rem;
    pointer-events: none;
    /* not clickable while hidden */
    transition:
        opacity 0.18s ease-out,
        transform 0.4s var(--button-spring-bezier),
        border-color 0.16s ease,
        margin 0.4s var(--button-spring-bezier),
        background-color 0.16s ease;
}

.expanding-card-close:hover {
    transform: translateY(-1px);
    border-color: rgba(210, 56, 120, 0.6);
    background: rgba(20, 21, 25, 0.95);
}

.expanding-card-details {
    display: none;
    opacity: 0;
    max-height: 0;
    transition: opacity 0.2s ease, max-height 0.25s ease, margin-top 0.25s ease;
    margin-top: 0;
    padding: 0 3rem;
}

.expanding-card-content {
    height: 100%;
    padding: 1rem 1.25rem;
}

.expanding-card.is-expanded {
    position: fixed;
    text-align: left !important;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    z-index: 4000;
    max-width: 1040px;
    visibility: visible !important;

    /* beefier, more forward-looking shadow */
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.75),
        0 0 40px rgba(102, 204, 254, 0.35),
        0 0 30px rgba(210, 56, 120, 0.25);
}

.expanding-card.is-expanded,
.expanding-card.is-expanded * {
    visibility: visible !important;
}

.expanding-card.is-expanded .expanding-card-content {
    padding: 0;
}

.expanding-card.is-expanded .expanding-card-close {
    opacity: 1;
    margin-left: 1.5rem;
    transform: none;
    pointer-events: auto;
}

.expanding-card.is-expanded .expanding-card-details {
    display: block;
    opacity: 1;
    max-height: none;
    margin-bottom: 10rem;
    margin-top: 2rem;
    height: fit-content;
}

@media (prefers-reduced-motion: reduce) {
    .expanding-card {
        transition: none;
    }

    .expanding-card-content {
        transition: none;
        will-change: max-height, opacity, margin-top;
    }
}


/* ---------- MOBILE LAYOUT ---------- */
@media (max-width: 820px) {
    .expanding-card.is-expanded {
        margin-top: 0;
        left: 0;
        max-width: none;
        transform: none;
        border-radius: 16px 16px 0 0;
    }

    .expanding-card.is-expanded::before {
        border-radius: 15px 15px 0 0;
    }

    .expanding-card-details {
        padding: 0 2rem;
    }
}