/* ============================================================
   explorer.css
   Uses the same CSS variables as home.css (defined in base)
   ============================================================ */

/* ======================== PAGE HEADER ======================== */
.explorer__header {
    padding: 48px 40px 32px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.explorer__header-inner {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.explorer__title {
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.explorer__subtitle {
    font-size: 0.9rem;
    color: var(--text-body);
    line-height: 1.5;
}

.explorer__count {
    text-align: right;
    flex-shrink: 0;
}

.explorer__count-number {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--blue-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.explorer__count-label {
    font-size: 0.78rem;
    color: var(--text-body);
    font-weight: 500;
}

/* ======================== TOOLBAR ======================== */
.explorer__toolbar-section {
    padding: 24px 40px 0;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.explorer__toolbar-inner {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Search */
.search-form {
    flex: 1;
    min-width: 200px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box__icon {
    position: absolute;
    left: 12px;
    color: var(--text-body);
    pointer-events: none;
}

.search-box__input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box__input::placeholder {
    color: var(--text-body);
    opacity: 0.7;
}

.search-box__input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.search-box__clear {
    position: absolute;
    right: 12px;
    font-size: 1.1rem;
    color: var(--text-body);
    text-decoration: none;
    line-height: 1;
    transition: color 0.15s;
}

.search-box__clear:hover {
    color: var(--text-dark);
}

/* Sort */
.sort-select {
    padding: 10px 32px 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.sort-select:focus {
    border-color: var(--blue-primary);
}

/* ======================== FILTER BAR ======================== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-body);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--blue-primary);
    color: var(--blue-primary);
}

.filter-btn--active {
    background: var(--blue-primary);
    color: #fff;
    border-color: var(--blue-primary);
}

/* ======================== RESULTS SECTION ======================== */
.explorer__results {
    padding: 32px 40px 80px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* ======================== PROJECTS GRID ======================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ======================== PROJECT CARD ======================== */
.project-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    animation: cardIn 0.35s ease both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.project-card:hover {
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
    border-color: var(--blue-primary);
}

/* Staggered animation */
.project-card:nth-child(1) { animation-delay: 0.04s; }
.project-card:nth-child(2) { animation-delay: 0.08s; }
.project-card:nth-child(3) { animation-delay: 0.12s; }
.project-card:nth-child(4) { animation-delay: 0.16s; }
.project-card:nth-child(5) { animation-delay: 0.20s; }
.project-card:nth-child(6) { animation-delay: 0.24s; }
.project-card:nth-child(7) { animation-delay: 0.28s; }
.project-card:nth-child(8) { animation-delay: 0.32s; }
.project-card:nth-child(9) { animation-delay: 0.36s; }

/* Image */
.project-card__image-link {
    display: block;
    text-decoration: none;
}

.project-card__image-wrap {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: var(--blue-icon-bg);
}

.project-card__image,
.project-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.project-card:hover .project-card__image,
.project-card:hover .project-card__img {
    transform: scale(1.04);
}

.project-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-primary);
    opacity: 0.4;
}

/* Badges on image */
.project-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.project-card__badges-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.project-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    pointer-events: auto;
}

.project-card__badge--cat {
    background: rgba(255, 255, 255, 0.92);
    color: var(--blue-primary);
}

.project-card__badge--private {
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
}

.project-card__badge--funded {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

/* Progress bar on image */
.project-card__img-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
}

.project-card__img-progress-fill {
    height: 100%;
    background: var(--blue-primary);
    transition: width 0.8s ease;
}

.project-card__img-progress-fill--complete {
    background: #10b981;
}

/* Card Body */
.project-card__body {
    padding: 20px 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Creator */
.project-card__creator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-card__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--blue-icon-bg);
    color: var(--blue-primary);
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.project-card__creator-name {
    font-size: 0.75rem;
    color: var(--text-body);
    font-weight: 500;
}

/* Title */
.project-card__title-link {
    text-decoration: none;
}

.project-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
    transition: color 0.15s;
}

.project-card__title-link:hover .project-card__title {
    color: var(--blue-primary);
}

/* Description */
.project-card__desc {
    font-size: 0.82rem;
    color: var(--text-body);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stats */
.project-card__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--blue-icon-bg);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 4px;
}

.project-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-card__stat--center { text-align: center; }
.project-card__stat--right  { text-align: right; }

.project-card__stat-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.project-card__stat-value--blue {
    color: var(--blue-primary);
}

.project-card__stat-label {
    font-size: 0.66rem;
    color: var(--text-body);
    font-weight: 500;
}

/* Card Footer */
.project-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.project-card__goal {
    font-size: 0.75rem;
    color: var(--text-body);
    font-weight: 500;
}

/* Small button variant */
.btn--sm {
    padding: 7px 16px !important;
    font-size: 0.8rem !important;
}

/* ======================== EMPTY STATE ======================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 80px 20px;
}

.empty-state__icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--blue-icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-primary);
    margin-bottom: 24px;
}

.empty-state__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state__desc {
    font-size: 0.875rem;
    color: var(--text-body);
    margin-bottom: 24px;
    max-width: 360px;
    line-height: 1.6;
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 768px) {
    .explorer__header,
    .explorer__header-inner {
        padding: 32px 20px 24px;
        flex-direction: column;
        align-items: flex-start;
    }

    .explorer__count {
        text-align: left;
    }

    .explorer__toolbar-section {
        padding: 20px 20px 0;
    }

    .explorer__results {
        padding: 24px 20px 60px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .explorer__toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-select {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}