/* Home Search */
.home-search {
    background: #f8f9fa;
    padding: 0 20px;
}

.home-search-row {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
}

.home-search-spacer {
    flex: 1 1 0;
}

.home-search .search-wrapper {
    width: 400px;
    flex-shrink: 0;
}

.home-search-row .tag-filter-bar {
    flex: 0 0 auto;
}

/* Search Results */
.search-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

.search-results-count {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 16px;
}

.search-no-results {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 40px;
    text-align: center;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.search-result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.search-result-card:hover {
    border-color: #003545;
    box-shadow: 0 2px 8px rgba(0, 53, 69, 0.1);
}

.search-result-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    background: white;
    padding: 3px;
    flex-shrink: 0;
}

.search-result-logo--empty {
    background: #f8f9fa;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #003545;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-category {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category Cards Grid */
.categories-section {
    max-width: 1200px;
    margin: 40px auto 80px;
    padding: 0 20px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.category-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 26px 28px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.category-card:hover {
    border-color: #003545;
    box-shadow: 0 4px 16px rgba(0, 53, 69, 0.1);
    transform: translateY(-2px);
}

.category-card-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #003545;
    line-height: 1.35;
    min-height: calc(2 * 1.2rem * 1.35);
}

.category-card-desc {
    font-size: 1rem;
    color: #6c757d;
    line-height: 1.4;
    margin-top: 1.2rem;
}


.category-card-logos {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.category-card-logos.visible {
    opacity: 1;
}

.category-card-logos-grid {
    display: grid;
    grid-template-columns: repeat(4, 48px);
    grid-template-rows: repeat(2, 48px);
    gap: 10px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    mask-image: linear-gradient(to right, black calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 16px), transparent 100%);
}

.category-card-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    background: white;
    padding: 4px;
}

.category-card-arrow {
    margin-left: auto;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.category-card:hover .category-card-arrow {
    border-color: #003545;
    background: #003545;
    color: white;
    transform: translateX(3px);
}

/* Machine-readable data aside for AI agents */
.llms-data {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 20px 20px 0;
    border-top: 1px solid #e9ecef;
    font-size: 0.72rem;
    color: #adb5bd;
    line-height: 1.6;
}

.llms-data summary.llms-data-heading {
    font-weight: 600;
    cursor: pointer;
    list-style: revert;
    margin-bottom: 6px;
}

.llms-data a {
    color: #adb5bd;
}

.llms-data ul {
    margin: 6px 0 0 16px;
    padding: 0;
}

.llms-data li {
    margin-bottom: 2px;
}


@media (max-width: 768px) {
    .home-search-spacer {
        display: none;
    }

    .home-search-row {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .home-search .search-wrapper {
        width: 100%;
        flex: 1 1 100%;
        order: 1;
    }

    .sponsors-btn {
        order: 2;
    }

    .tag-filter-bar {
        justify-content: center;
        order: 2;
    }

    .tag-filter-container {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tag-filter-wrapper.open .tag-filter-container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #adb5bd transparent;
        max-height: calc(3.5 * (30px + 6px));
        padding: 8px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        background: rgba(233, 236, 239, 0.3);
    }

    .tag-filter-container::-webkit-scrollbar {
        width: 4px;
    }

    .tag-filter-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .tag-filter-container::-webkit-scrollbar-thumb {
        background: #adb5bd;
        border-radius: 2px;
    }

    .tag-filter-btn {
        flex-shrink: 0;
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .tag-filter-clear {
        flex-shrink: 0;
        padding: 5px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 900px) {
    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 560px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }

    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-card-logos-grid {
        grid-template-rows: 48px;
    }

    .category-card-logo:nth-child(n+5) {
        display: none;
    }

    .category-card-desc {
        margin-top: 0.5rem;
    }

    .category-card-arrow {
        align-self: center;
    }
}
