/* =====================================================================
   RESOURCE CARD + DOWNLOAD MENU
   Markup: partials/icons/resource-item.hbs
   Used by every resource list, alphabet chart and project page.

   This file is the ONLY place these classes are styled. Page stylesheets
   may change the card's layout through their own wrapper class
   (e.g. `.resource-horizontal-list .resource-item-card`), but must not
   restyle the bare classes below — that is what used to make a change on
   one page break the cards on others.
   ===================================================================== */

/* ---- Card ---- */
.resource-item-card {
    background: var(--color-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: visible; /* lets the download menu pop out */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        border-color 0.4s ease;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.resource-item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(74, 124, 89, 0.1);
    border-color: var(--color-primary);
}

/* ---- Thumbnail + hover overlay ---- */
.resource-item-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background: var(--bg-light);
}

.resource-item-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.resource-item-card:hover .resource-item-thumbnail img {
    transform: scale(1.1);
}

.resource-actions-overlay {
    position: absolute;
    inset: 0;
    background: rgba(74, 124, 89, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.resource-item-thumbnail:hover .resource-actions-overlay,
.resource-item-thumbnail:focus-within .resource-actions-overlay {
    opacity: 1;
}

.overlay-download-link {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-primary);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-lg);
}

.resource-item-thumbnail:hover .overlay-download-link,
.resource-item-thumbnail:focus-within .overlay-download-link {
    transform: translateY(0);
}

/* ---- Text ---- */
.resource-item-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.resource-item-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.3;
}

.resource-item-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    flex-grow: 1;
}

/* Ghost file cards inside a description must never push past the card */
.resource-item-desc {
    max-width: 100%;
    min-width: 0;
}

.resource-item-desc .kg-file-card,
.resource-item-desc .kg-file-card-container {
    max-width: 100%;
    min-width: 0;
}

.resource-item-desc .kg-file-card-contents {
    min-width: 0;
}

.resource-item-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ---- Buttons ---- */
.explore-btn,
.single-download-btn,
.download-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--color-primary);
    color: var(--color-white) !important;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.explore-btn {
    width: fit-content;
    padding: 12px 30px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
}

.single-download-btn,
.download-dropdown-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.explore-btn:hover,
.single-download-btn:hover,
.download-dropdown-btn:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* ---- Download dropdown ---- */
.download-dropdown {
    position: relative;
    width: 100%;
}

.download-dropdown-btn .chevron {
    transition: transform 0.3s ease;
}

.download-dropdown:hover .download-dropdown-btn .chevron,
.download-dropdown.active .download-dropdown-btn .chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--color-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), visibility 0.3s;
    z-index: 10;
}

.download-dropdown:hover .dropdown-menu,
.download-dropdown:focus-within .dropdown-menu,
.download-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
    background: var(--bg-light);
    color: var(--color-primary);
    transform: translateX(4px);
}
