/* =============================================================================
   LSF PROJECTS FEATURE CSS
   Brand colors: Navy #00205b  |  Red #bf0d3e  |  Font: Montserrat
   ============================================================================= */


/* ─── Shared / Utilities ────────────────────────────────────────────────────── */

.project-space-tag {
    display: inline-block;
    background: rgba(0, 32, 91, 0.08);
    color: #00205b;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    margin: 2px 3px 2px 0;
    transition: background 0.2s, color 0.2s;
}

.project-space-tag.active {
    background: #00205b;
    color: white;
}

/* Clickable pills — archive cards */
.project-space-tag-link {
    cursor: pointer;
    border: none;
    font-family: "Montserrat", sans-serif;
    position: relative;
    z-index: 2;
}

.project-space-tag-link:hover,
.project-space-tag-link:focus {
    background: #bf0d3e;
    color: white;
    outline: none;
}

/* Pill filter buttons — single project hero */
.project-space-pill-btn {
    cursor: pointer;
    border: 2px solid rgba(0, 32, 91, 0.3);
    background: rgba(0, 32, 91, 0.08);
    font-family: "Montserrat", sans-serif;
    color: #00205b;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

.project-space-pill-btn:hover {
    background: rgba(0, 32, 91, 0.18);
    border-color: #00205b;
    transform: translateY(-1px);
}

.project-space-pill-btn.active {
    background: #bf0d3e;
    border-color: #bf0d3e;
    color: white;
}

.project-space-pill-all {
    border-style: dashed;
}

.project-space-pill-all.active {
    border-style: solid;
}


/* ─── Projects Archive ──────────────────────────────────────────────────────── */

#projects-archive {
    padding: 151px 0 80px;
}

#projects-archive h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #00205b;
    text-transform: uppercase;
}

/* Controls wrap */
#projects-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

/* Search bar */
#projects-search-wrap {
    position: relative;
    max-width: 500px;
}

#projects-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: #00205b;
    pointer-events: none;
    opacity: 0.5;
}

#projects-search {
    width: 100%;
    padding: 10px 42px 10px 40px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    border: 2px solid #dde2ef;
    border-radius: 30px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #00205b;
    background: white;
}

#projects-search:focus {
    border-color: #00205b;
    box-shadow: 0 0 0 3px rgba(0, 32, 91, 0.1);
}

#projects-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.2s;
}

#projects-search-clear:hover { color: #bf0d3e; }

/* Filter bar */
#projects-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.projects-filter-btn {
    background: white;
    color: #00205b;
    border: 2px solid #00205b;
    border-radius: 30px;
    padding: 8px 20px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.projects-filter-btn:hover {
    background: #00205b;
    color: white;
    transform: translateY(-1px);
}

.projects-filter-btn.active {
    background: #00205b;
    color: white;
}

/* Result count */
#projects-result-info {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 16px;
    min-height: 1.2em;
    font-style: italic;
}


/* ─── Split layout ──────────────────────────────────────────────────────────── */

#projects-split {
    display: grid;
    /* Left col: project cards — grows/shrinks freely, min 280px
       Right col: gallery panel — fixed 380px on desktop */
    grid-template-columns: 1fr 680px;
    gap: 32px;
    align-items: start;
}

/* When the gallery column is hidden (grade-level categories),
   let the card grid stretch to full width */
#projects-split.no-gallery-col {
    grid-template-columns: 1fr;
}

/* Left column */
#projects-grid-col {
    min-width: 0; /* prevent grid blowout */
}

/* Cards grid inside left col: 1 wide, or 2 if there's room */
#projects-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.2s;
}

#projects-grid .project-card {
    flex: 0 1 260px;
    min-width: 260px;
    max-width: 400px;
    flex-grow: 1;
}

#projects-grid.is-filtering {
    opacity: 0.6;
    pointer-events: none;
}

/* Right column — sticky so gallery travels with scroll */
#projects-gallery-col {
    min-width: 0;
}

#pgc-sticky {
    position: sticky;
    top: 120px; /* clears fixed header */
    max-height: calc(100vh + 290px);
    overflow-y: auto;
    /* hide scrollbar but allow scroll */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,32,91,0.2) transparent;
    background: #f4f6fb;
    border-radius: 14px;
    border: 1px solid #dde2ef;
    padding: 22px 18px 24px;
}

#pgc-sticky::-webkit-scrollbar { width: 5px; }
#pgc-sticky::-webkit-scrollbar-track { background: transparent; }
#pgc-sticky::-webkit-scrollbar-thumb { background: rgba(0,32,91,0.2); border-radius: 10px; }

#pgc-header {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid #dde2ef;
}

#pgc-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #00205b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 4px;
}

#pgc-subtitle {
    font-size: 0.78rem;
    color: #888;
    margin: 0;
    font-style: italic;
}

#pgc-loading {
    text-align: center;
    padding: 30px 0;
    color: #555;
    font-size: 0.85rem;
}

/* The gallery grid inside the right col uses 2 columns */
#pgc-grid.gallery-grid {
    columns: 2;
    column-gap: 8px;
}

#pgc-grid .gallery-item {
    margin-bottom: 8px;
}

/* Fade transition when swapping gallery content */
#pgc-grid.pgc-fading {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.18s;
}

#pgc-grid {
    transition: opacity 0.25s;
}

.pgc-empty {
    color: #aaa;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 0;
}

.pcg-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(0, 32, 91, 0.2);
    border-top-color: #00205b;
    border-radius: 50%;
    animation: pcg-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes pcg-spin { to { transform: rotate(360deg); } }


/* ─── Project card ──────────────────────────────────────────────────────────── */

.project-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 32, 91, 0.1);
    transition: transform 0.25s, box-shadow 0.25s;
    background: white;
}

.project-card.hidden { display: none; }

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 32, 91, 0.18);
}

.project-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.project-card-img-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #e8ecf4;
}

.project-card-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s, opacity 0.25s;
}

.project-card-cover.swapping { opacity: 0; }

.project-card:hover .project-card-cover { transform: scale(1.04); }

.project-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,32,91,0.65) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
    display: flex;
    align-items: flex-end;
    padding: 16px;
}

.project-card:hover .project-card-overlay { opacity: 1; }

.project-card-cta {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.project-card-body { padding: 14px 16px 16px; }

.project-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #00205b;
    margin: 0 0 5px;
    line-height: 1.3;
}

.project-card-excerpt {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card-spaces { margin-top: 7px; }

/* No results */
#projects-no-results {
    text-align: center;
    padding: 40px 0;
    color: #555;
    font-size: 1rem;
}

#projects-clear-filter {
    background: none;
    border: none;
    color: #bf0d3e;
    font-weight: 700;
    cursor: pointer;
    font-family: "Montserrat", sans-serif;
    font-size: 1rem;
    text-decoration: underline;
}

#projects-empty {
    text-align: center;
    padding: 40px 0;
    color: #888;
}


/* ─── Pagination ────────────────────────────────────────────────────────────── */

#projects-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pgn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid #dde2ef;
    border-radius: 8px;
    background: white;
    color: #00205b;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
    line-height: 1;
    user-select: none;
}

.pgn-btn:hover:not(.pgn-disabled):not(.pgn-active) {
    background: #f0f3f9;
    border-color: #00205b;
    transform: translateY(-1px);
}

.pgn-btn.pgn-active {
    background: #00205b;
    border-color: #00205b;
    color: white;
    cursor: default;
}

.pgn-btn.pgn-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pgn-prev span,
.pgn-next span {
    font-size: 1.3rem;
    line-height: 1;
}

.pgn-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 38px;
    font-size: 0.9rem;
    color: #999;
    letter-spacing: 0.1em;
    padding: 0 2px;
}


/* ─── Single Project ────────────────────────────────────────────────────────── */

#project-hero-img {
    transition: opacity 0.2s;
}

#project-hero-img.swapping-hero { opacity: 0; }

/* Pills container — centered, with breathing room from box edges */
.project-single-spaces {
    margin-top: 16px;
    margin-bottom: 50px;
    /* Padding keeps pills away from the card edges */
    padding: 0 8px;
    display: flex;
    flex-wrap: wrap;
    /* Center the pills; if they fit on one line they'll be centered,
       if they wrap the whole flex block is centered thanks to the
       justify-content below combined with the parent being text-center */
    gap: 6px;
    justify-content: center;
}

/* Back nav bar */
#project-single-nav {
    background: #f4f6fb;
    border-bottom: 1px solid #dde2ef;
    padding: 14px 0;
}

#project-single-nav .container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

#project-back-link {
    color: #00205b;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

#project-back-link:hover { color: #bf0d3e; }

#project-filter-context {
    font-size: 0.85rem;
    color: #555;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#project-single-content { padding: 40px 0 10px; }

/* Gallery */
#project-gallery-section { padding: 40px 0 80px; }

.gallery-group { margin-bottom: 50px; }
.gallery-group:last-child { margin-bottom: 0; }

.gallery-group-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #00205b;
    margin: 0 0 22px;
    padding-bottom: 10px;
    border-bottom: 3px solid #00205b;
    display: inline-block;
}

.gallery-grid {
    columns: 3;
    column-gap: 14px;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 14px;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    background: #e8ecf4;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s, filter 0.25s;
}

.gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(0.88);
}

.gallery-item-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: white;
    font-size: 0.78rem;
    padding: 18px 10px 8px;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.gallery-item:hover .gallery-item-caption { opacity: 1; }


/* ─── Lightbox ──────────────────────────────────────────────────────────────── */

#lsf-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}

#lsf-lightbox.open {
    opacity: 1;
    pointer-events: all;
}

#lsf-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 88vh;
    text-align: center;
}

#lsf-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#lsf-lightbox-caption {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    margin-top: 12px;
    font-style: italic;
    min-height: 1.2em;
}

#lsf-lightbox-counter {
    color: rgba(255,255,255,0.45);
    font-size: 0.8rem;
    margin-top: 4px;
}

#lsf-lightbox-close {
    position: fixed;
    top: 20px; right: 24px;
    background: none; border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000;
}

#lsf-lightbox-close:hover { opacity: 1; transform: scale(1.15); }

#lsf-lightbox-prev,
#lsf-lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: none;
    color: white;
    font-size: 2.8rem;
    width: 52px; height: 52px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lsf-lightbox-prev { left: 16px; }
#lsf-lightbox-next { right: 16px; }

#lsf-lightbox-prev:hover,
#lsf-lightbox-next:hover { background: rgba(255,255,255,0.25); }

body.lightbox-open { overflow: hidden; }


/* ─── Responsive ────────────────────────────────────────────────────────────── */

/* Medium — collapse to single column, gallery below */
@media (max-width: 1099px) {
    #projects-split {
        grid-template-columns: 1fr;
    }

    #projects-gallery-col {
        order: 2; /* gallery goes below cards */
    }

    #projects-grid-col {
        order: 1;
    }

    #pgc-sticky {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    #pgc-grid.gallery-grid {
        columns: 3;
        column-gap: 10px;
    }
}

@media (max-width: 767px) {
    #pgc-grid.gallery-grid { columns: 2; }
    .gallery-grid           { columns: 2; }
    #lsf-lightbox-prev      { left: 8px; }
    #lsf-lightbox-next      { right: 8px; }
}

@media (max-width: 575px) {
    #projects-archive       { padding-top: 120px; }
    #projects-archive h1    { font-size: 1.7rem; }
    #projects-grid          { flex-direction: column; align-items: stretch; }
    .projects-filter-btn    { padding: 6px 14px; font-size: 0.8rem; }
    .gallery-grid           { columns: 1; }
    #pgc-grid.gallery-grid  { columns: 2; }
    #lsf-lightbox-prev,
    #lsf-lightbox-next      { width: 40px; height: 40px; font-size: 2rem; }
    #project-single-nav .container { flex-direction: column; align-items: flex-start; gap: 8px; }
    #projects-search-wrap   { max-width: 100%; }
}