/* ============================================================
   Dynamic Showcase v4 — Desktop + Mobile Accordion
   ============================================================ */

/* ── Reset & Wrapper ── */
.dynamic-showcase {
    display: flex;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 24px rgba(0,0,0,.06);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 520px;
}

/* ── Left: Two Item Columns ── */
.ds-columns {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
    padding: 36px 32px 36px 40px;
    border-right: 1px solid #f0f0f0;
    overflow-y: auto;
}

.ds-col {
    display: flex;
    flex-direction: column;
}

.ds-col-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 20px;
}

.ds-col-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Item ── */
.dynamic-item {
    border-radius: 10px;
    border-left: 3px solid transparent;
    transition: background .2s, box-shadow .2s, border-color .2s;
    cursor: pointer;
    user-select: none;
}

.ds-item-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
}

.dynamic-item:hover {
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.dynamic-item.active {
    background: #fef2f2;
    border-left-color: #b91c1c;
    box-shadow: 0 2px 12px rgba(185,28,28,.08);
}

/* Icon */
.ds-item-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #b91c1c;
    margin-top: 2px;
    transition: transform .2s;
}
.ds-item-icon i,
.ds-item-icon svg { width: 17px; height: 17px; }
.dynamic-item:hover .ds-item-icon { transform: scale(1.12); }

/* Text */
.ds-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.ds-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}
.ds-item-subtitle {
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.45;
}

/* Chevron — hidden on desktop */
.ds-item-chevron {
    display: none;
    flex-shrink: 0;
    color: #9ca3af;
    transition: transform .3s;
    margin-top: 3px;
}
.dynamic-item.active .ds-item-chevron {
    transform: rotate(180deg);
}

/* Mobile accordion body — hidden on desktop */
.ds-mob-content {
    display: none !important;
}

/* ── Right: Detail Panel (Desktop) ── */
.ds-detail {
    flex: 0 0 340px;
    max-width: 340px;
    background: #fafafa;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
}

.ds-detail-inner {
    position: sticky;
    top: 32px;
}

.ds-image-wrap {
    width: 100%;
    height: 190px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #e5e7eb;
}
.ds-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .3s, transform .3s;
}
.ds-image-wrap img.ds-fade-out { opacity: 0; transform: scale(.97); }
.ds-image-wrap img.ds-fade-in  {
    animation: ds-img-pulse .28s ease-out;
}
@keyframes ds-img-pulse {
    0%   { opacity: 0; transform: scale(.96); }
    100% { opacity: 1; transform: scale(1);   }
}

.ds-text-wrap {
    transition: opacity .3s, transform .3s;
}
.ds-text-wrap.ds-fade-out { opacity: 0; transform: translateY(8px); }
.ds-text-wrap.ds-fade-in  {
    animation: ds-text-pulse .24s ease-out;
}
@keyframes ds-text-pulse {
    0%   { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0);   }
}

.ds-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 10px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.35em * 2);
}
.ds-desc {
    font-size: 14px;
    line-height: 1.7;
    color: #6b7280;
    margin: 0 0 18px;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.7em * 6);
    max-height: calc(1.7em * 6);
}

/* Link */
.ds-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #b91c1c;
    text-decoration: none;
    transition: gap .2s, color .2s;
}
.ds-detail-link:hover { gap: 10px; color: #991b1b; }
.ds-link-arrow { font-size: 16px; }

/* ── Accessibility ── */
.dynamic-item:focus-visible {
    outline: 2px solid #b91c1c;
    outline-offset: -2px;
}

/* ============================================================
   TABLET ( ≤ 1024px )
   ============================================================ */
@media (max-width: 1024px) {
    .dynamic-showcase {
        flex-direction: column;
        min-height: auto;
    }

    .ds-columns {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 28px 24px;
    }

    .ds-detail {
        flex: none;
        max-width: 100%;
        padding: 24px;
    }
}

/* ============================================================
   MOBILE ( ≤ 768px ) — 2-Column Grid + Accordion
   ============================================================ */
@media (max-width: 768px) {
    .dynamic-showcase {
        flex-direction: column;
        border-radius: 10px;
        min-height: auto;
    }

    /* Hide desktop detail panel */
    .ds-detail {
        display: none !important;
    }

    /* Stack category groups vertically */
    .ds-columns {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 16px 12px;
        border-right: none;
        border-bottom: none;
    }

    .ds-col-heading {
        font-size: 17px;
        margin-bottom: 10px;
        padding-left: 4px;
    }

    /* ── 2-column item grid ── */
    .ds-col-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Compact card */
    .dynamic-item {
        border: 1px solid #f0f0f0;
        border-left: 3px solid transparent;
        border-radius: 10px;
        background: #fff;
        margin-bottom: 0;
    }

    .dynamic-item.active {
        border-left-color: #b91c1c;
        border-color: #fecaca;
        background: #fef2f2;
        grid-column: 1 / -1;
    }

    .ds-item-row {
        padding: 12px 10px;
        gap: 8px;
        align-items: center;
    }

    /* Smaller icon on mobile */
    .ds-item-icon {
        width: 18px;
        height: 18px;
        font-size: 14px;
        margin-top: 0;
    }
    .ds-item-icon i,
    .ds-item-icon svg { width: 14px; height: 14px; }

    /* Compact text */
    .ds-item-title {
        font-size: 13px;
        line-height: 1.3;
    }

    /* Hide subtitle on compact cards, show when active */
    .ds-item-subtitle {
        display: none;
    }
    .dynamic-item.active .ds-item-subtitle {
        display: block;
        font-size: 12px;
    }

    /* Show chevron on mobile */
    .ds-item-chevron {
        display: flex;
        align-items: center;
    }
    .ds-item-chevron svg {
        width: 14px;
        height: 14px;
    }

    /* Show accordion body on mobile (controlled by JS) */
    .ds-mob-content {
        display: none !important;
        padding: 0 10px 14px;
    }
    .dynamic-item.active .ds-mob-content {
        display: block !important;
    }

    .ds-mob-img-wrap {
        width: 100%;
        height: 140px;
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 12px;
        background: #e5e7eb;
    }
    .ds-mob-img-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    .ds-mob-title {
        font-size: 15px;
        font-weight: 700;
        color: #1f2937;
        margin: 0 0 6px;
    }
    .ds-mob-desc {
        font-size: 12px;
        line-height: 1.6;
        color: #6b7280;
        margin: 0 0 12px;
    }
}

/* ============================================================
   SMALL MOBILE ( ≤ 420px )
   ============================================================ */
@media (max-width: 420px) {
    .ds-columns {
        padding: 12px 8px;
    }

    .ds-col-list {
        gap: 6px;
    }

    .ds-item-row {
        padding: 10px 8px;
        gap: 6px;
    }

    .ds-item-title {
        font-size: 12px;
    }

    .ds-mob-content {
        padding: 0 8px 12px;
    }

    .ds-mob-img-wrap {
        height: 120px;
    }
}
