/* ============================================================
   Interactive Cards Widget — FR Grid System
   Desktop + Tablet: Row (2fr active, 1fr inactive)
   Mobile: Column (1fr each)
   ============================================================ */

/* ── Base Wrapper ── */
.ic-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--ic-card-count, 3), 1fr);
    gap: 12px;
    box-sizing: border-box;
    padding: 0;
    width: 100%;
}

/* ── Individual Card ── */
.ic-card {
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
    background-color: #F4F1EC;
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
    outline: none;
    min-height: 340px;
    transition:
        background-color 500ms ease,
        border-radius 500ms ease,
        box-shadow 500ms ease,
        padding 300ms ease;
}

.ic-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(30, 42, 94, 0.4);
}

/* ── Active Card — 2fr span ── */
.ic-card.ic-active {
    grid-column: span 1;
    background-color: #1E2A5E;
    cursor: default;
}

/* ── Transition Lock ── */
.ic-wrapper.ic-is-transitioning .ic-card {
    overflow: hidden;
}

/* ── Number Badge ── */
.ic-number {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #F4F1EC;
    color: #1E2A5E;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 3;
    transition:
        background-color 500ms ease,
        color 500ms ease,
        border 500ms ease;
}

.ic-card.ic-active .ic-number {
    background-color: #1E2A5E;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ── Expanded Content (Active Card) ── */
.ic-expanded {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: 14px;
    transition:
        opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
        visibility 250ms step-end;
}

.ic-card:not(.ic-active) .ic-expanded {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    visibility: hidden;
    pointer-events: none;
}

.ic-card.ic-active .ic-expanded {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
}

/* ── Collapsed Content (Inactive Card) ── */
.ic-collapsed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 8px;
    z-index: 2;
    overflow: hidden;
    transition:
        opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
        visibility 250ms step-end;
}

.ic-card.ic-active .ic-collapsed {
    opacity: 0;
    transform: scale(0.9);
    visibility: hidden;
    pointer-events: none;
}

.ic-card:not(.ic-active) .ic-collapsed {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
    pointer-events: auto;
}

/* ── Inactive Card Rotated Title ── */
.ic-card-rotated-title {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: #1E2A5E;
    max-height: 80%;
    overflow: hidden;
    text-overflow: clip;
    letter-spacing: 0.3px;
    user-select: none;
    transition: all 300ms ease;
}

/* ── Active Card Title ── */
.ic-card-title {
    margin: 12px 0;
    padding: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
    flex-shrink: 0;
    width: 100%;
    transition: color 500ms ease;
}

/* ── Image ── */
.ic-card-image {
    width: 100%;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    flex-shrink: 0;
    margin-bottom: 12px;
}

.ic-card-image img {
    display: block;
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 300ms ease;
}

.ic-card.ic-active .ic-card-image img {
    transform: scale(1.02);
}

/* ── Description ── */
.ic-card-desc {
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #b0b8cc;
    width: 100%;
    transition: color 500ms ease;
}

/* ============================================================
   RESPONSIVE — Tablet (768px – 1024px) — Row rehega
   ============================================================ */
@media (max-width: 1024px) and (min-width: 768px) {
    .ic-wrapper {
        gap: 10px;
    }

    .ic-card {
        min-height: 280px;
    }

    .ic-number {
        width: 42px;
        height: 42px;
        font-size: 13px;
    }

    .ic-card-title {
        font-size: 15px;
    }

    .ic-card-desc {
        font-size: 12px;
    }
}

/* ============================================================
   RESPONSIVE — Mobile (767px se neeche) — Column ho jao
   ============================================================ */
@media (max-width: 767px) {
    .ic-wrapper {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .ic-card,
    .ic-card.ic-active {
        grid-column: span 1 !important;
        min-height: unset !important;
        padding: 16px;
    }

    .ic-number {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    .ic-card-rotated-title {
        writing-mode: horizontal-tb !important;
        transform: none !important;
        text-align: center;
        font-size: 13px;
        white-space: normal;
        max-height: none;
        line-height: 1.4;
    }

    .ic-collapsed {
        padding-top: 52px;
        align-items: flex-start;
        justify-content: center;
    }

    .ic-expanded {
        margin-top: 10px;
    }

    .ic-card-title {
        font-size: 15px;
        margin: 8px 0;
    }

    .ic-card-desc {
        font-size: 12px;
        line-height: 1.5;
    }

    .ic-card-image {
        margin-bottom: 8px;
    }
}

/* ============================================================
   RESPONSIVE — Extra Small (480px se neeche)
   ============================================================ */
@media (max-width: 480px) {
    .ic-wrapper {
        gap: 6px;
    }

    .ic-card {
        padding: 14px;
        border-radius: 12px;
    }

    .ic-number {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }

    .ic-card-title {
        font-size: 14px;
    }

    .ic-card-desc {
        font-size: 11px;
    }
}

/* ============================================================
   ENTRY ANIMATION
   ============================================================ */
@keyframes icSmoothEntry {
    0%   { opacity: 0; transform: translateY(15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0)    scale(1);    }
}

.ic-card.ic-active .ic-expanded {
    animation: icSmoothEntry 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ============================================================
   HARDWARE ACCELERATION
   ============================================================ */
.ic-card,
.ic-expanded,
.ic-collapsed,
.ic-number {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* ============================================================
   REDUCED MOTION SUPPORT
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .ic-card,
    .ic-expanded,
    .ic-collapsed,
    .ic-number,
    .ic-card-title,
    .ic-card-image img {
        transition-duration: 0.01ms !important;
        animation-duration:  0.01ms !important;
    }
}