/* Projects page / project card styles
   Extracted from canonical styles.css to allow page-scoped loading
*/

.projects-page {
    padding: 80px 20px;
    background: white;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

/* High-specificity gallery fallback (kept for older layouts) */
.projects-page .projects-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2.5rem !important;
    justify-content: flex-start !important;
}

.projects-page .project-card {
    flex: 0 1 calc(33.333% - 1.666rem) !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

@media (max-width: 1024px) {
    .projects-page .project-card { flex: 0 1 calc(50% - 1.25rem) !important; }
}
@media (max-width: 600px) {
    .projects-page .project-card { flex: 0 1 100% !important; }
}

.projects-grid .project-card {
    border: 1.5px solid var(--text-dark);
    border-radius: var(--border-radius);
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: var(--light-color);
}
.projects-grid .project-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 24px rgba(245, 166, 35, 0.12);
    z-index: 2;
}

/* Image container: responsive aspect ratio */
.project-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: var(--light-alt);
}
.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
    display: block;
}
.project-card:hover .project-image img { transform: scale(1.05); }

/* Ensure rounded top corners only */
.project-card .project-image {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    overflow: hidden;
}
.project-card .project-image img {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    display: block;
}

.project-content {
    padding: 1.25rem; /* 20px */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.projects-page .project-content { margin:0; padding:20px !important; }
.projects-page .project-footer { padding:20px !important; margin:0 !important; }
.projects-page .project-description { margin-bottom: 0 !important; }

.project-content h3 { color: var(--primary-color); font-size: 1.5rem; margin-bottom: 0.5rem; font-weight:700; }
.project-type { color: var(--accent-color); font-weight:600; font-size:0.85rem; text-transform:uppercase; margin-bottom:1rem; }
.project-description { color: var(--text-light); line-height:1.6; }

.project-footer { padding-bottom: 20px; padding-left: 20px; }

/* Ensure footer sticks to the bottom of variable-height cards so
   the CTA sits bottom-left consistently. Also enforce 20px padding. */
.project-card .project-footer {
    margin-top: auto;
    padding: 20px !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Primary CTA button inside project cards */
.project-button {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 10px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid var(--accent-color);
    cursor: pointer;
    font-size: 1rem;
    margin: 0;
    align-self: flex-start;
    z-index: 3;
}
.project-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(232,140,0,0.18); }
.project-button:focus-visible { outline: 3px solid rgba(232,140,0,0.35); outline-offset: 2px; }

/* Filter buttons used on the projects listing */
.filter-buttons { display:flex; justify-content:center; gap:1rem; margin-bottom:3.5rem; flex-wrap:wrap; }
.filter-btn { background:white; border:2px solid var(--border-color); color:var(--text-dark); padding:10px 24px; border-radius:var(--border-radius); cursor:pointer; font-weight:600; font-size:0.95rem; transition:var(--transition); }
.filter-btn:hover { border-color:var(--accent-color); color:var(--accent-color); }
.filter-btn.active { background:var(--accent-color); color:white; border-color:var(--accent-color); }

/* Small utility: hide empty portfolio items when used as a grid fallback */
.portfolio-item.hidden { display:none; }
/* Center and scale lightbox image */
.lightbox-content {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    max-width: 100%;
}

.stat-item {
    background: transparent;
    padding: 0;
    border: none;
}

.stat-item:hover {
    background: transparent;
}

.stat-item strong {
    display: block; 
    color: var(--muted-2);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-family: "TDCArch", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.stat-item span {
    display: block;
    font-size: 1.45rem;
    color: var(--accent-color);
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

/* Ensure project stats use the system font stack for consistent rendering */
.project-stats {
    font-family: "TDCArch", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Use brand font for stats to match site typography */
.project-stats .stat-item,
.project-stats .stat-item span,
.project-stats .stat-item strong {
    font-family: "TDCArch", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Gallery Section */
.project-gallery {
    margin-bottom: 5rem;
    margin-top: 4rem;
}

.project-gallery h2 {
    font-size: 2.2rem;
    color: var(--text-dark);
    margin-bottom: 3rem;
    text-align: center;
    font-weight: 700;
}

.project-gallery {
    margin-bottom: 5rem;
    margin-top: 4rem;
}

.gallery-grid {
    position: relative;
    padding: 0 12px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Fallback column-based masonry when Masonry JS can't be loaded */
.gallery-grid.masonry-fallback {
    column-count: 3;
    column-gap: 24px;
}

.gallery-grid.masonry-fallback .gallery-item {
    display: inline-block;
    width: 100%;
    float: none;
    margin: 0 0 24px 0;
    -webkit-column-break-inside: avoid;
    -moz-column-break-inside: avoid;
    break-inside: avoid;
}

.grid-sizer {
    width: 33.333%;
    display: block;
}

.gallery-item {
    width: 33.333%;
    display: block;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--light-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s ease, opacity 0.35s ease;
    cursor: pointer;
    margin: 0; /* Masonry will handle gutter; fallback uses its own margins */
    box-sizing: border-box;
}

.gallery-item:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 48px rgba(0,0,0,0.25);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    object-position: center;
    border-radius: var(--border-radius);
}

@media (max-width: 1200px) {
    .grid-sizer, .gallery-item { width: 50%; }
    .gallery-grid.masonry-fallback { column-count: 2; }
}

@media (max-width: 800px) {
    .grid-sizer, .gallery-item { width: 50%; }
    .gallery-grid.masonry-fallback { column-count: 2; }
}

@media (max-width: 600px) {
    .grid-sizer, .gallery-item { width: 100%; }
    .gallery-grid.masonry-fallback { column-count: 1; }
}

/* Span classes to create the varied layout like the example image */
.gallery-item.size-2x2 { width: 66.666%; }
.gallery-item.size-2x1 { width: 66.666%; }
.gallery-item.size-1x2 { width: 33.333%; }
.gallery-item.solo-row { width: 100%; }
.gallery-item.duo-row { width: 50%; }

/* Ensure the column fallback ignores span classes and uses full column width */
.gallery-grid.masonry-fallback .gallery-item.size-2x2,
.gallery-grid.masonry-fallback .gallery-item.size-2x1,
.gallery-grid.masonry-fallback .gallery-item.size-1x2,
.gallery-grid.masonry-fallback .gallery-item.solo-row,
.gallery-grid.masonry-fallback .gallery-item.duo-row {
    width: 100% !important;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2147483647;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex !important;
    z-index: 2147483647 !important;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 1001;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    z-index: 1001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(245, 166, 35, 0.8);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    z-index: 1001;
}

/* Overview Section */
.project-overview {
    background: var(--light-alt);
    padding: 1rem;
    margin-top: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.project-overview h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 2rem;
}

.overview-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* If there are no highlights, make the overview text span the full width */
.overview-text {
    grid-column: 1 / -1;
}

/* If highlights are present, restore two-column layout and normal flow */
.overview-content:has(.overview-highlights) {
    grid-template-columns: 1fr 1fr;
}
.overview-content:has(.overview-highlights) .overview-text {
    grid-column: auto;
}

.overview-text p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.98rem;
}

.overview-highlights ul {
    list-style: none;
    padding: 0;
}

.overview-highlights li {
    color: var(--muted);
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.overview-highlights li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Features Section */
.project-features {
    margin-bottom: 3rem;
}

.project-features h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 2rem;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 5px 20px rgba(245, 166, 35, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.feature-card p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* CTA Section */
.project-cta {
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-dark) 100%);
    color: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.project-cta h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.project-cta p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.project-cta .cta-button {
    background: var(--accent-color);

}

.project-cta .cta-button:hover {
    background: var(--accent-dark);

}

/* Project hero layout (stacked title + photo) */
.project-hero {
    display: block;
    margin-bottom: 1.5rem;
}

.project-hero > h1 {
    grid-column: 1 / -1;
    font-size: 2.8rem;
    color: var(--text-dark);
    margin-top: 1.75rem;
    margin-bottom: 1rem;
}

.project-hero-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--border-radius);
}

.project-hero-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; 
}

.project-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: center;
}

/* Gold accent line between photo and stats */
.gold-line {
    height: 6px;
    width: 100%;
    background: var(--accent-color);
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
}

/* Back link spacing matching title spacing */
.project-back {
    text-align: center;
    margin: 1.75rem 0 1.75rem;
}

.project-back .back-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .project-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-stats {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    /* Keep gallery neutral on small screens; use column fallback if Masonry isn't available */
    .gallery-grid.masonry-fallback {
        column-count: 1;
        column-gap: 18px;
    }

    .gallery-item {
        width: 100%;
        margin-bottom: 18px;
    }

    .gallery-item img {
        width: 100%;
        height: auto;
    }

    .overview-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-hero > h1 {
        font-size: 2rem;
        margin-top: 1rem;
    }

    .project-overview {
        padding: 1rem;
    }
}

/* Projects in Planning section: match main projects grid/card styles */
.projects-planning { padding: 80px 20px; }
.planning-grid {
    /* Match the main projects grid behavior: use flexible card columns
       so multiple cards sit side-by-side and single cards don't stretch
       to fill the entire container. */
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.planning-grid .project-card {
    flex: 0 1 calc(33.333% - 1.666rem);
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .planning-grid .project-card { flex: 0 1 calc(50% - 1.25rem); }
}
@media (max-width: 600px) {
    .planning-grid .project-card { flex: 0 1 100%; }
}

/* Remove legacy planning-specific card styles; planning cards use .project-card markup */
.planning-grid .project-card { margin: 0; }
