/*
 * Project browser — projects.php only, via extra_css.
 *
 * This block was already the most token-aware on the site: brand text, the gradient,
 * --on-brand, --gray, --input-border and --light-gray were all in use before it moved.
 * What it did not have was the shadow ramp, and seven literals sat within a rounding
 * error of tokens that already existed: #fff, #ddd, #e0e0e0 twice and #333 twice.
 *
 * #f8f9fa on .suggestion-item:hover is kept as a literal. It is Bootstrap's grey and
 * nothing in this system is within 1.05:1 of it, so converting it would be a visible
 * change made while moving a file rather than a decision anyone took.
 *
 * TWO THINGS FIXED BECAUSE THE MOVE MADE THEM MEASURABLE
 *
 * The narrow-width media query is gone - see .empty-state-actions below.
 *
 * Every auto-fit grid track now reads minmax(min(Npx, 100%), 1fr). A bare minmax(Npx,
 * 1fr) cannot shrink below Npx, so at 320px .project-grid was 30px wider than the space
 * it had. 320 is under the smallest approved breakpoint and is still a real phone.
 *
 * WHAT WAS NOT DONE
 *
 * .button.secondary and .button.outline-primary are global button variants declared
 * here, on one page, and in no stylesheet at all. welcome_changemaker.php writes its
 * own .next-steps .button.secondary in Bootstrap greys - #e9ecef and #dee2e6 - so one
 * variant has two palettes. Promoting a button variant to css/styles.css reaches the
 * dashboard on the same deploy and is a decision made before the file is written. It
 * is not made here.
 */

.projects-browser-container {
    padding: 120px 2rem 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.projects-browser-header {
    text-align: center;
    margin-bottom: 3rem;
}

.projects-browser-header h1 {
    font-size: 3rem;
    color: var(--brand-text);
    margin-bottom: 0.5rem;
}

.projects-browser-header p {
    font-size: 1.1rem;
    color: var(--gray);
    max-width: 700px;
    margin: 0 auto;
}

.project-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 1rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.cta-banner {
    background: var(--gradient-primary);
    color: var(--on-brand);
    text-align: center;
    padding: 1rem;
    margin-bottom: 3rem;
    border-radius: 8px;
}

.cta-banner p {
    margin: 0;
    font-size: 1.1rem;
}

.cta-banner a {
    color: var(--on-brand);
    font-weight: bold;
    text-decoration: underline;
}

#pagination-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

#pagination-container button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--light-gray);
    background-color: var(--white);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

#pagination-container button:hover {
    background-color: var(--light-gray);
}

#pagination-container button.active {
    background-color: var(--primary-color);
    color: var(--on-brand);
    border-color: var(--primary-color);
}

#loading-indicator {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: var(--gray);
}

@media (max-width: 768px) {
    .projects-browser-header h1 {
        font-size: 2.5rem;
    }
    .project-filters {
        grid-template-columns: 1fr;
    }
    .project-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
    }
}

/* Autocomplete styles */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-default);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 8px 8px;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
    color: var(--brand-text);
}

/* Empty State Styles */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--border-default);
    margin-bottom: 1.5rem;
}

.empty-state h2 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--gray);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 2rem auto;
    line-height: 1.6;
}

/* Wrapping rather than a breakpoint. 600px was not one of the style guide's four,
   and the padding it took away with !important did not solve the problem it was
   aimed at: at 360px the "Join community" button still clipped 12px of its own
   label, and at 390px 3px. .button carries overflow: hidden for its gradient
   sweep, so the text was cut with no scrollbar and no page overflow - invisible
   to tools/probes/overflow.js, which measures the document and not the element.
   Wrapping keeps the designed padding, clips nothing from 360px up, and needs no
   width to be named. */
.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.button.secondary {
    background-color: var(--light-gray);
    color: var(--text-color);
}

.button.secondary:hover {
    background-color: var(--border-default);
}

.button.outline-primary {
    background-color: transparent;
    color: var(--brand-text);
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.button.outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--on-brand);
}
