/* ============================================================
   PROJECT.CSS — Facility Solutions, Projects section
   ============================================================ */

/* ─── 1. PROJECT LIST CARDS ─── */
.project-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    align-items: start;
}

@media (min-width: 700px) {
    .project-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.project-list-card {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: var(--space-md);
    align-items: start;
    padding: var(--space-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    height: 100%;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

@media (min-width: 700px) {
    .project-list-card {
        grid-template-columns: 60px 1fr;
        padding: var(--space-md);
    }

    .project-list-card__logo {
        width: 60px;
        height: 60px;
    }
}

.project-list-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--accent-color-rgb), 0.4);
}

.project-list-card__logo {
    width: 65px;
    height: 65px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: var(--surface-alt);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-align: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

[data-theme="dark"] .project-list-card__logo img {
    filter: brightness(0) invert(1);
}

.project-list-card__logo i {
    font-size: 1.1rem;
    color: var(--accent-color);
    opacity: 0.7;
}

.project-list-card__top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
}

.project-list-card__name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.project-list-card__client {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 600;
}

.project-list-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: var(--space-sm) 0;
}

    .project-list-card__meta .tag i {
        margin-right: 4px;
        color: var(--accent-color);
    }

.project-list-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: var(--space-md);
}

.project-list-card__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.img-client--side {
    aspect-ratio: 1/1;
}

    .img-client--side img {
        width: 75%;
    }

[data-theme="dark"] .img-client--side img {
    filter: brightness(0) invert(1);
}

/* Status badge (shared modifier system — completed now, ongoing later) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

    .status-badge::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

.status-badge--completed {
    background: rgba(46, 125, 91, 0.12);
    color: var(--success);
}

.status-badge--ongoing {
    background: rgba(var(--accent-color-rgb), 0.15);
    color: var(--accent-color);
}

/* ─── 2. CASE STUDY GALLERY ─── */
.case-study {
    margin-top: var(--space-2xl);
    padding-top: var(--space-2xl);
    border-top: 1px solid var(--border);
}

    .case-study:first-of-type {
        margin-top: var(--space-xl);
        padding-top: 0;
        border-top: none;
    }

.case-study__header {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
    .case-study__header {
        grid-template-columns: 0.85fr 1.15fr;
        align-items: center;
    }
}

.case-study__info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.case-study__eyebrow {
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.case-study__title {
    margin: 4px 0 var(--space-md);
}

.case-study__facts {
    display: grid;
    gap: 8px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

    .case-study__facts div {
        display: flex;
        justify-content: space-between;
        gap: var(--space-md);
        font-size: 0.88rem;
    }

    .case-study__facts span:first-child {
        color: var(--text-muted);
    }

    .case-study__facts span:last-child {
        color: var(--primary-color);
        font-weight: 600;
        text-align: right;
    }

.case-study__desc {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.case-study__hero {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

@media (min-width: 768px) {
    .case-study__hero {
        aspect-ratio: 16 / 11;
    }
}

/* Gallery grid — responsive, used both standalone and within labeled groups */
.case-study-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

@media (min-width: 768px) {
    .case-study-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

.case-study-gallery--wide-first .gallery-item:first-child {
    grid-column: span 2;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    cursor: pointer;
}

.gallery-item__ph {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0px;
    color: var(--text-muted);
    font-size: 1.5rem;
    background: var(--surface-alt);
    overflow: hidden;
}

    /* Once a real photo is dropped in (an <img> inside .gallery-item__ph), it
   displays at its own natural size/aspect ratio — never cropped or forced
   into a fixed box, since source photos vary in dimensions. */
    .gallery-item__ph img {
        display: block;
        width: 100%;
        height: auto;
        transition: transform var(--transition-slow);
    }

.gallery-item:hover .gallery-item__ph img,
.gallery-item:hover .gallery-item__ph i {
    transform: scale(1.06);
}

.gallery-item__ph i {
    transition: transform var(--transition-slow);
}

/* Base subtle overlay — title always visible */
.gallery-item__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-md);
    background: linear-gradient(180deg, rgba(15, 24, 36, 0) 45%, rgba(15, 24, 36, 0.75) 100%);
    transition: background var(--transition-base);
}

.gallery-item__title {
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    transform: translateY(0);
    transition: transform var(--transition-base);
}

.gallery-item__desc {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    margin-top: 4px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height var(--transition-base), opacity var(--transition-base);
}

.gallery-item__view {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

/* Elegant hover / focus state */
.gallery-item:hover .gallery-item__overlay,
.gallery-item:focus-within .gallery-item__overlay {
    background: linear-gradient(180deg, rgba(15, 24, 36, 0.15) 0%, rgba(15, 24, 36, 0.88) 100%);
}

.gallery-item:hover .gallery-item__desc,
.gallery-item:focus-within .gallery-item__desc {
    max-height: 60px;
    opacity: 1;
}

.gallery-item:hover .gallery-item__view,
.gallery-item:focus-within .gallery-item__view {
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item__ph,
    .gallery-item__overlay,
    .gallery-item__desc,
    .gallery-item__view {
        transition: none;
    }
}

/* ─── 3. GALLERY GROUPS & LABELS ─── */
.gallery-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

@media (min-width: 640px) {
    .gallery-group {
        grid-template-columns: 40px 1fr;
        align-items: stretch;
    }
}

.gallery-group__label {
    display: none;
}

@media (min-width: 640px) {
    .gallery-group__label {
        display: flex;
        align-items: center;
        justify-content: center;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-family: var(--font-heading);
        font-weight: 700;
        font-size: 0.8rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--accent-color);
        background: var(--surface-alt);
        border-radius: var(--radius-md);
        padding: var(--space-md) 0;
    }
}

.gallery-group__label--mobile {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: var(--space-sm);
}

@media (min-width: 640px) {
    .gallery-group__label--mobile {
        display: none;
    }
}

/* ─── 4. RESPONSIVE FINE-TUNING ─── */
@media (max-width: 767px) {
    .project-list-card {
        grid-template-columns: 60px 1fr;
        padding: var(--space-md);
    }

    .project-list-card__logo {
        width: 60px;
        height: 60px;
    }

    .case-study-gallery--wide-first .gallery-item:first-child {
        grid-column: span 2;
    }
}

/* ============================================================
   GALLERY LIGHTBOX
   Scoped to .gallery-item images. Reads title/description straight
   from each item's existing markup — no changes to any project page
   were needed to wire this up.

   Full-bleed layout: the image fills almost the entire viewport;
   every control (close, prev/next, caption, counter, play/pause)
   floats over it at the edges rather than being stacked in a
   smaller centered box.
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 16, 0.95);
    z-index: 1300;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

    .lightbox-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }

.lightbox-shell {
    position: relative;
    width: 100%;
    height: 100%;
}

.lightbox-stage {
    position: absolute;
    inset: 76px 88px 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The image fills as much of the stage as possible — scaling up smaller
   photos and down larger ones — while object-fit:contain guarantees its
   own natural aspect ratio is always preserved, never cropped. */
.lightbox-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    opacity: 0;
    transform: scale(0.97);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

    .lightbox-image.is-visible {
        opacity: 1;
        transform: scale(1);
    }

.lightbox-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: rgba(255, 255, 255, 0.5);
    padding: var(--space-2xl);
    border: 1.5px dashed rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
}

    .lightbox-empty i {
        font-size: 2rem;
    }

.lightbox-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

    .lightbox-close:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--accent-tint);
    }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

    .lightbox-nav:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--accent-tint);
    }

.lightbox-nav--prev {
    left: var(--space-lg);
}

.lightbox-nav--next {
    right: var(--space-lg);
}

/* Bottom overlay bar: caption (left) / play-pause (center) / counter (right) */
.lightbox-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
}

.lightbox-caption {
    text-align: left;
    color: #fff;
    min-width: 0;
}

.lightbox-caption__project {
    display: block;
    color: var(--accent-tint);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.lightbox-caption__title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-caption__desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-counter {
    text-align: right;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.lightbox-play-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.95rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

    .lightbox-play-toggle span {
        display: none;
    }

    .lightbox-play-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--accent-tint);
    }

.lightbox-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.lightbox-progress__bar {
    height: 100%;
    width: 0%;
    background: var(--accent-tint);
}

    .lightbox-progress__bar.is-animating {
        transition: width linear;
    }

@media (max-width: 900px) {
    .lightbox-stage {
        inset: 64px 16px 88px;
    }

    .lightbox-nav--prev {
        left: var(--space-sm);
    }

    .lightbox-nav--next {
        right: var(--space-sm);
    }

    .lightbox-close {
        top: var(--space-sm);
        right: var(--space-sm);
    }

    .lightbox-footer {
        grid-template-columns: 1fr auto;
    }

    .lightbox-counter {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox-overlay, .lightbox-image, .lightbox-progress__bar {
        transition: none;
    }
}
