/* ── Scope Poppins & box-sizing to popup only ── */
#dlLibraryPopup,
#dlLibraryPopup * {
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

/* ── Overlay ── */
#dlLibraryPopup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(22, 22, 29, 0.88);
    overflow-y: auto;

    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#dlLibraryPopup.dl-open {
    visibility: visible;
    opacity: 1;
}

/* ── Modal ── */
#dlLibraryPopup .dl-modal {
    position: relative;
    width: 100%;
    max-width: 1120px;
    background: #16161D;
    border: 0.5px solid #FF4D04;
    border-radius: 4px;
    padding: 0;
    overflow: hidden;

    transform: scale(0.96) translateY(14px);
    opacity: 0;
    transition:
        transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        opacity   0.3s ease;
}
#dlLibraryPopup.dl-open .dl-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Header ── */
#dlLibraryPopup .dl-header {
    padding: 28px 30px 18px;
}

/* ── Filter bar ── */
#dlLibraryPopup .dl-filter-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 30px;
}
#dlLibraryPopup .dl-filter-inner {
    display: flex;
}
#dlLibraryPopup .dl-filter-btn {
    flex: 1;
    padding: 8px 18px;
    color: #F4F8F5;
    font-size: 13px;
    font-weight: 300;
    text-align: center;
    background: transparent;
    border: none;
    border-right: 1px solid #FF4D04;
    border-radius: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}
#dlLibraryPopup .dl-filter-btn:last-child { border-right: none; }
#dlLibraryPopup .dl-filter-btn.active { background: #FF4D04; color: #F4F8F5; border-right: none; }
#dlLibraryPopup .dl-filter-btn:has(+ .dl-filter-btn.active) { border-right: none; }
#dlLibraryPopup .dl-filter-btn:hover:not(.active) { background: rgba(255,77,4,0.15); }

/* ── Cards section ── */
#dlLibraryPopup .dl-cards-wrap {
    padding: 24px 30px 28px;
    position: relative;
}

/* ── Cards grid ── */
#dlLibraryPopup #dlCards {
    display: grid;
    gap: 16px;
    padding: 0 46px;
}

/* ── Individual card ── */
#dlLibraryPopup .dl-card-inner {
    border-radius: 3px;
    border: 0.5px solid #FF4D04;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background image layer — scaled independently for zoom effect */
#dlLibraryPopup .dl-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #1e1e2a;
    transition: transform 0.5s ease;
}
#dlLibraryPopup .dl-card-inner:hover .dl-card-bg {
    transform: scale(1.07);
}

/* Gradient overlay — transitions to solid on hover */
#dlLibraryPopup .dl-card-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(22,22,29,0.82) 0%, transparent 50%),
        linear-gradient(to top,    rgba(22,22,29,0.82) 0%, transparent 50%);
    transition: background 0.35s ease;
}
#dlLibraryPopup .dl-card-inner:hover .dl-card-overlay {
    background: rgba(22, 22, 29, 0.62);
}

/* Card content — title top, hover content fills middle, CTA bottom */
#dlLibraryPopup .dl-card-content {
    position: relative;
    z-index: 1;
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}
#dlLibraryPopup .dl-card-title {
    color: #F4F8F5;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.25;
    margin: 0;
}

/* ── Hover content: description + tags ── */
#dlLibraryPopup .dl-card-hover {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#dlLibraryPopup .dl-card-inner:hover .dl-card-hover {
    opacity: 1;
}

/* Description — sits immediately below title */
#dlLibraryPopup .dl-card-hover-desc {
    color: #F4F8F5;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.55;
}

/* Tags — anchored to bottom of hover area, above CTA */
#dlLibraryPopup .dl-card-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
}
#dlLibraryPopup .dl-card-tag {
    display: inline-block;
    padding: 3px 10px;
    border: 0.5px solid #FF4D04;
    border-radius: 4px;
    color: #FF4D04;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
}

/* ── Download button ── */
#dlLibraryPopup .dl-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 0;
    border: 1px solid #FF4D04;
    border-radius: 3px;
    color: #FF4D04;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    transition: background 0.2s, color 0.2s;
}
#dlLibraryPopup .dl-download-btn:hover {
    background: #FF4D04;
    color: #F4F8F5;
    opacity: 1;
}

/* ── Nav arrows ── */
#dlLibraryPopup .dl-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    z-index: 2;
    line-height: 0;
}
#dlLibraryPopup .dl-nav-arrow.dl-prev { left: 30px; }
#dlLibraryPopup .dl-nav-arrow.dl-next { right: 30px; }
#dlLibraryPopup .dl-nav-arrow:hover svg path { stroke: #fff; }

/* ── Responsive card heights ── */
#dlLibraryPopup .dl-card-inner { height: 280px; }

@media (min-width: 640px) {
    #dlLibraryPopup .dl-card-inner { height: 340px; }
}
@media (min-width: 1024px) {
    #dlLibraryPopup .dl-card-inner { height: 400px; }
}

/* ── Mobile: hover content always visible ── */
@media (max-width: 639px) {
    #dlLibraryPopup .dl-card-hover { opacity: 1; }
    #dlLibraryPopup .dl-card-overlay {
        background: rgba(22, 22, 29, 0.72);
    }
}

/* ── Mobile popup padding ── */
@media (max-width: 480px) {
    #dlLibraryPopup                       { padding: 10px; }
    #dlLibraryPopup .dl-header            { padding: 20px 16px 14px; }
    #dlLibraryPopup .dl-cards-wrap        { padding: 18px 16px 20px; }
    #dlLibraryPopup #dlCards              { padding: 0 36px; gap: 12px; }
    #dlLibraryPopup .dl-nav-arrow.dl-prev { left: 16px; }
    #dlLibraryPopup .dl-nav-arrow.dl-next { right: 16px; }
    #dlLibraryPopup .dl-nav-arrow svg     { width: 13px; height: 44px; }
    #dlLibraryPopup .dl-filter-wrap       { padding: 0; }
}
