/* Grid Sponsors Block Styles */
.grid-sponsors-container {
    width: 100%;
    opacity: 1 !important; /* Ensure sponsors are always visible */
}

/* Ensure sponsors are visible on frontend (override any conflicting rules) */
body:not(.wp-admin) .grid-sponsors-container {
    opacity: 1 !important;
}

/* Custom width class for sponsor logos */
.w-280px {
    width: 280px;
    max-width: 100%;
}

.grid-sponsors-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-sponsors-wrapper {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* Center grid when fewer than 4 items on desktop */
@media (min-width: 768px) {
    .grid-sponsors-wrapper:has(.sponsor-item:nth-child(1):nth-last-child(1)) {
        /* 1 item */
        justify-content: center;
        grid-template-columns: minmax(0, 300px);
    }

    .grid-sponsors-wrapper:has(.sponsor-item:nth-child(2):nth-last-child(1)) {
        /* 2 items */
        justify-content: center;
        grid-template-columns: repeat(2, minmax(0, 300px));
    }

    .grid-sponsors-wrapper:has(.sponsor-item:nth-child(3):nth-last-child(1)) {
        /* 3 items */
        justify-content: center;
        grid-template-columns: repeat(3, minmax(0, 300px));
    }
}

/* Sponsor Item Styles - Based on item-person styling */
.sponsor-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: white;
    border-radius: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sponsor-item:hover {
    transform: translateY(-2px);
}

.sponsor-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.sponsor-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-height: 280px;
    padding: 1.5rem;
}

.sponsor-logo {
    flex-shrink: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.sponsor-logo img {
    max-width: 280px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

@media (min-width: 1024px) {
    .sponsor-logo img {
        max-height: 140px;
    }
}

.sponsor-name {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 1.125rem;
    line-height: 1.5;
    color: #111827;
}

@media (min-width: 1024px) {
    .sponsor-name {
        font-size: 1.25rem;
    }
}

.sponsor-level {
    flex-shrink: 0;
    margin-top: auto;
    max-width: 100%;
}

.level-title {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    border-radius: 9999px;
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1;
}

@media (min-width: 1024px) {
    .level-title {
        font-size: 0.875rem;
    }
}

/* Ensure consistent spacing */
.grid-sponsors-title {
    margin-bottom: 1rem;
}

.grid-sponsors-description {
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .grid-sponsors-title {
        margin-bottom: 1rem;
    }
    
    .grid-sponsors-description {
        margin-bottom: 3rem;
    }
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .sponsor-item {
        padding: 1rem;
    }
    
    .sponsor-content {
        min-height: 240px;
        padding: 1rem;
    }
    
    .sponsor-logo img {
        max-width: 200px;
        max-height: 80px;
    }
}

/* Hover effects for links */
.sponsor-link:hover {
    text-decoration: none;
}

.sponsor-link:hover .sponsor-item {
    opacity: 0.75;
}

/* Ensure proper aspect ratio for sponsor logos */
.sponsor-logo {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 1024px) {
    .sponsor-logo {
        min-height: 100px;
    }
}