/**
 * Amed Framework - Default Theme
 * Affiliations Continuous Flow Band (Ultra-Polished Marquee)
 * templates/default/static/css/affiliations-band.css
 * Version: 2.0
 */

.affiliations-band-section {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #ffffff 100%);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 20px 0;
    overflow: hidden;
    user-select: none;
    z-index: 10;
}

[data-bs-theme="dark"] .affiliations-band-section,
.theme-dark .affiliations-band-section {
    background: linear-gradient(180deg, #090e17 0%, #0f172a 50%, #090e17 100%);
    border-color: rgba(255, 255, 255, 0.07);
}

.affiliations-marquee-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        rgba(0, 0, 0, 0.05) 1.5%,
        rgba(0, 0, 0, 0.25) 3.5%,
        rgba(0, 0, 0, 0.65) 6.5%,
        rgba(0, 0, 0, 0.95) 9.5%,
        #000000 12%,
        #000000 88%,
        rgba(0, 0, 0, 0.95) 90.5%,
        rgba(0, 0, 0, 0.65) 93.5%,
        rgba(0, 0, 0, 0.25) 96.5%,
        rgba(0, 0, 0, 0.05) 98.5%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        rgba(0, 0, 0, 0.05) 1.5%,
        rgba(0, 0, 0, 0.25) 3.5%,
        rgba(0, 0, 0, 0.65) 6.5%,
        rgba(0, 0, 0, 0.95) 9.5%,
        #000000 12%,
        #000000 88%,
        rgba(0, 0, 0, 0.95) 90.5%,
        rgba(0, 0, 0, 0.65) 93.5%,
        rgba(0, 0, 0, 0.25) 96.5%,
        rgba(0, 0, 0, 0.05) 98.5%,
        transparent 100%
    );
}

.affiliations-marquee-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: affiliationsGlide 40s linear infinite;
    will-change: transform;
}

.affiliations-marquee-track:hover,
.affiliations-marquee-track:focus-within {
    animation-play-state: paused;
}

@keyframes affiliationsGlide {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

.affiliations-item-group {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 12px;
}

.affiliation-link-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 6px 7px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 9999px;
    text-decoration: none;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.22s ease,
                background-color 0.22s ease,
                color 0.2s ease;
    white-space: nowrap;
    outline: none;
}

[data-bs-theme="dark"] .affiliation-link-card,
.theme-dark .affiliation-link-card {
    background: #172033;
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.affiliation-link-card:hover {
    background: #ffffff;
    border-color: rgba(14, 165, 233, 0.45);
    color: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -3px rgba(14, 165, 233, 0.14), 0 3px 8px -2px rgba(15, 23, 42, 0.05);
}

[data-bs-theme="dark"] .affiliation-link-card:hover,
.theme-dark .affiliation-link-card:hover {
    background: #1e2c47;
    border-color: rgba(56, 189, 248, 0.45);
    color: #38bdf8;
    box-shadow: 0 8px 22px -3px rgba(56, 189, 248, 0.18), 0 3px 8px -2px rgba(0, 0, 0, 0.3);
}

.affiliation-link-card:active {
    transform: translateY(0) scale(0.985);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.affiliation-link-card:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 3px;
}

.affiliation-logo-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.affiliation-link-card:hover .affiliation-logo-wrap {
    transform: scale(1.06);
    border-color: rgba(14, 165, 233, 0.3);
}

[data-bs-theme="dark"] .affiliation-logo-wrap,
.theme-dark .affiliation-logo-wrap {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
}

.affiliation-logo-wrap:has(.affiliation-icon-fallback) {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: rgba(14, 165, 233, 0.2);
}

[data-bs-theme="dark"] .affiliation-logo-wrap:has(.affiliation-icon-fallback),
.theme-dark .affiliation-logo-wrap:has(.affiliation-icon-fallback) {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(37, 99, 235, 0.15) 100%);
    border-color: rgba(56, 189, 248, 0.25);
}

.affiliation-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    box-sizing: border-box;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.affiliation-icon-fallback {
    font-size: 15px;
    color: #0284c7;
    line-height: 1;
}

[data-bs-theme="dark"] .affiliation-icon-fallback,
.theme-dark .affiliation-icon-fallback {
    color: #38bdf8;
}

.affiliation-name-text {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    transition: color 0.2s ease;
}

.affiliation-external-icon {
    font-size: 0.72rem;
    color: #94a3b8;
    opacity: 0.7;
    transform: translateY(-0.5px);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-left: 1px;
}

.affiliation-link-card:hover .affiliation-external-icon {
    opacity: 1;
    color: #0284c7;
    transform: translate(2px, -2px);
}

[data-bs-theme="dark"] .affiliation-link-card:hover .affiliation-external-icon,
.theme-dark .affiliation-link-card:hover .affiliation-external-icon {
    color: #38bdf8;
}

@media (max-width: 768px) {
    .affiliations-band-section {
        padding: 16px 0;
    }

    .affiliations-item-group {
        gap: 16px;
        padding: 0 8px;
    }

    .affiliation-link-card {
        padding: 5px 13px 5px 6px;
        gap: 8px;
    }

    .affiliation-logo-wrap {
        width: 28px;
        height: 28px;
    }

    .affiliation-icon-fallback {
        font-size: 13px;
    }

    .affiliation-name-text {
        font-size: 0.8rem;
    }

    .affiliations-marquee-track {
        animation-duration: 30s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .affiliations-marquee-track {
        animation: none;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        width: 100%;
        justify-content: flex-start;
        scroll-snap-type: x mandatory;
        padding: 4px 16px;
    }

    .affiliations-marquee-track::-webkit-scrollbar {
        display: none;
    }

    .affiliations-item-group[aria-hidden="true"] {
        display: none;
    }

    .affiliation-link-card {
        scroll-snap-align: start;
    }
}
