/* === RESPONSIVE LINKS SECTION === */
.links-section {
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

/* Mobile first - full width with side padding */
@media (max-width: 768px) {
    .links-section {
        padding: var(--spacing-sm);
        margin: var(--spacing-sm) 0;
        border-radius: var(--radius-sm);
    }
}

/* Adjust margin for very small screens */
@media (max-width: 480px) {
    .links-section {
        margin: var(--spacing-xs) 0;
        padding: 12px;
    }
}

.links-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-sm);
    padding: 8px;
    width: 100%;
}

/* Responsive grid adjustments */
@media (max-width: 480px) {
    .links-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
        padding: 4px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .links-container {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .links-container {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .links-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (min-width: 1441px) {
    .links-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--spacing-md);
    }
}

.link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--dark);
    transition: all var(--transition-fast);
    padding: clamp(8px, 2vw, 12px);
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
    min-height: 90px;
    justify-content: center;
    width: 100%;
}

/* Touch-friendly on mobile */
@media (hover: none) and (pointer: coarse) {
    .link-item {
        min-height: 100px;
        padding: 12px 8px;
    }
}

@media (max-width: 480px) {
    .link-item {
        min-height: 85px;
        padding: 8px 6px;
    }
}

.link-item:hover {
    background: linear-gradient(135deg,
            rgba(229, 48, 73, 0.05) 0%,
            rgba(148, 17, 103, 0.05) 100%);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.link-logo {
    width: clamp(40px, 8vw, 60px);
    height: clamp(40px, 8vw, 60px);
    object-fit: contain;
    margin-bottom: clamp(4px, 1vw, 8px);
    filter: grayscale(0%);
    opacity: 1;
    transition: all 0.25s ease;
    transform: scale(1.08);
}

@media (max-width: 480px) {
    .link-logo {
        width: 40px;
        height: 40px;
        margin-bottom: 4px;
    }
}

.link-item:hover .link-logo {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.15);
}

.link-text {
    font-size: clamp(11px, 1.5vw, 13px);
    font-weight: 600;
    text-align: center;
    color: var(--primary-dark);
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
    padding: 0 2px;
}

@media (max-width: 480px) {
    .link-text {
        font-size: 10px;
        line-height: 1.2;
    }
}

.link-item:hover .link-text {
    color: var(--primary);
}

/* === RESPONSIVE SPONSORS SECTION === */
.sponsors-section {
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .sponsors-section {
        padding: var(--spacing-sm);
        margin: var(--spacing-sm) 0;
        border-radius: var(--radius-sm);
    }
}

@media (max-width: 480px) {
    .sponsors-section {
        margin: var(--spacing-xs) 0;
        padding: 12px;
    }
}

.sponsors-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--spacing-sm);
    padding: 8px;
    width: 100%;
}

/* Responsive grid for sponsors */
@media (max-width: 480px) {
    .sponsors-container {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 10px;
        padding: 4px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .sponsors-container {
        grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
        gap: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sponsors-container {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .sponsors-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (min-width: 1441px) {
    .sponsors-container {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: var(--spacing-md);
    }
}

.sponsor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(8px, 2vw, 12px);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: var(--gray-100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    min-height: 110px;
    justify-content: center;
    width: 100%;
}

@media (hover: none) and (pointer: coarse) {
    .sponsor-item {
        min-height: 120px;
        padding: 12px 8px;
    }
}

@media (max-width: 480px) {
    .sponsor-item {
        min-height: 100px;
        padding: 8px 6px;
    }
}

.sponsor-item:hover {
    background: linear-gradient(135deg,
            rgba(229, 48, 73, 0.08) 0%,
            rgba(148, 17, 103, 0.08) 100%);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sponsor-logo {
    width: clamp(50px, 10vw, 80px);
    height: clamp(50px, 10vw, 80px);
    object-fit: contain;
    margin-bottom: clamp(4px, 1vw, 8px);
    filter: grayscale(0%);
    opacity: 1;
    transition: all 0.25s ease;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .sponsor-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 4px;
    }
}

.sponsor-item:hover .sponsor-logo {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

.sponsor-name {
    font-size: clamp(10px, 1.3vw, 12px);
    color: var(--primary-dark);
    text-align: center;
    font-weight: 600;
    margin-top: clamp(2px, 0.5vw, 6px);
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
    padding: 0 2px;
}

@media (max-width: 480px) {
    .sponsor-name {
        font-size: 9.5px;
        line-height: 1.2;
    }
}

.sponsor-item:hover .sponsor-name {
    color: var(--primary);
}

/* Accent lines - responsive */
.link-item::before,
.sponsor-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.link-item:hover::before,
.sponsor-item:hover::before {
    opacity: 1;
    height: 3px;
}

/* Remove transform on touch devices for better performance */
@media (hover: none) and (pointer: coarse) {

    .link-item,
    .sponsor-item {
        transform: none;
    }

    .link-item:hover,
    .sponsor-item:hover {
        transform: none;
    }

    .link-item:hover .link-logo,
    .sponsor-item:hover .sponsor-logo {
        transform: scale(1.08);
    }
}

/* === RESPONSIVE ADS SECTION WITH PROPER CAROUSEL === */
.ads-section {
    padding: var(--spacing-md);
    background: transparent;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    position: relative;
    overflow: hidden;
    display: block;
    /* Change from flex to block */
    width: 100%;
    box-sizing: border-box;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .ads-section {
        padding: var(--spacing-sm);
        margin: var(--spacing-sm) 0;
        border-radius: var(--radius-sm);
        min-height: 100px;
    }
}

@media (max-width: 480px) {
    .ads-section {
        padding: 10px;
        margin: var(--spacing-xs) 0;
        min-height: 90px;
    }
}

/* The "viewport" that hides the overflow */
.ads-viewport {
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* The Track - ensure it doesn't wrap */
.ad-container {
    display: flex;
    width: max-content;
    gap: 16px;
    /* Use a fixed gap for easier math */
    animation: carousel-scroll 20s linear infinite;
}

/* Different animation speeds for different screen sizes */
@media (max-width: 768px) {
    .ad-container {
        animation-duration: 25s;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .ad-container {
        animation-duration: 20s;
        gap: 10px;
    }
}

/* Pause on hover for readability */
.ad-container:hover {
    animation-play-state: paused;
}

/* Remove hover pause on touch devices */
@media (hover: none) and (pointer: coarse) {
    .ad-container:hover {
        animation-play-state: running;
    }
}

/* FIXED: Ad item with FIXED WIDTH */
.ad-item {
    flex: 0 0 auto;
    width: 280px;
    /* Increased from 250px */
    height: 160px;
    /* Increased from 120px for taller images */
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile ad sizes */
@media (max-width: 480px) {
    .ad-item {
        width: 180px;
        /* ← Make sure this matches the image */
        height: 70px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .ad-item {
        width: 220px;
        /* ← Make sure this matches the image */
        height: 85px;
    }
}

.ad-item:hover {
    transform: scale(1.05);
}

/* Remove hover transform on touch devices */
@media (hover: none) and (pointer: coarse) {
    .ad-item:hover {
        transform: none;
    }
}

/* FIXED: Image matches container width */
.ad-image {
    width: 100%;
    /* ← CHANGED from 250px to 100% */
    height: 100%;
    object-fit: contain;
    display: block;
}

/* FIXED: Correct animation - now using 50% */
@keyframes carousel-scroll {
    from {
        transform: translateX(0);
    }

    to {
        /* Move exactly half the container. 
           If you have 4 ads duplicated (8 total), -50% is 
           the exact moment the 5th ad hits the start line. */
        transform: translateX(-33.333333%);
    }
}

@keyframes carousel-scroll-mobile {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-33.333333%);
    }
}

/* Ensure mobile uses the same -50% logic */
@media (max-width: 768px) {
    .ad-container {
        animation: carousel-scroll 15s linear infinite;
    }
}

/* Update the mobile animation to be consistent */
@keyframes carousel-scroll-mobile {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(calc(-50%));
        /* Half of a smaller mobile gap */
    }
}

/* For very wide screens, show more ads */
@media (min-width: 1920px) {
    .ad-container {
        gap: 20px;
    }

    .ad-item {
        width: 350px;
        height: 140px;
    }
}

/* For very narrow screens, adjust animation */
@media (max-width: 360px) {
    .ad-item {
        width: 160px;
        height: 60px;
    }

    .ad-container {
        gap: 8px;
    }
}