/* Uniform client tile grid + hover lightbox */
.clients-gallery {
    display: grid;
    width: 100%;
    gap: 0.625rem;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.clients-gallery--desktop {
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    max-width: 100%;
    margin: 0;
}

.clients-gallery--desktop .clients-tile__index {
    font-size: 10px;
    top: 0.45rem;
    left: 0.5rem;
}

.clients-gallery--desktop .clients-tile__zoom {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 15px;
}

.clients-gallery--desktop .clients-tile__label {
    font-size: 9px;
    padding: 2rem 0.55rem 0.5rem;
}

.clients-gallery--mobile {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.clients-tile {
    position: relative;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(201, 232, 241, 0.18);
    background: #0d2c33;
    cursor: default;
    overflow: hidden;
    isolation: isolate;
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.35s ease,
        box-shadow 0.35s ease;
}

.clients-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(201, 232, 241, 0.12) 0%, transparent 45%);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 2;
    pointer-events: none;
}

.clients-tile::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 2px solid #c9e8f1;
    opacity: 0;
    transform: scale(0.92);
    transition:
        opacity 0.35s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 3;
    pointer-events: none;
}

.clients-tile__media {
    position: absolute;
    inset: 0;
}

.clients-tile__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.clients-tile__index {
    position: absolute;
    top: 0.35rem;
    left: 0.4rem;
    z-index: 4;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    transition: color 0.3s ease;
}

.clients-tile__zoom {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid rgba(201, 232, 241, 0.35);
    border-radius: 999px;
    background: rgba(0, 23, 28, 0.72);
    color: #c9e8f1;
    font-size: 14px;
    opacity: 0;
    transform: translateY(6px) scale(0.85);
    transition:
        opacity 0.35s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.clients-tile__label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 1.75rem 0.45rem 0.4rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    color: rgba(255, 255, 255, 0.92);
    background: linear-gradient(to top, rgba(0, 23, 28, 0.92) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.35s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (hover: hover) and (pointer: fine) {
    .clients-tile:hover,
    .clients-tile:focus-visible {
        transform: translateY(-4px) scale(1.03);
        border-color: rgba(201, 232, 241, 0.55);
        box-shadow:
            0 12px 28px rgba(0, 23, 28, 0.35),
            0 0 0 1px rgba(201, 232, 241, 0.12);
    }

    .clients-tile:hover::before,
    .clients-tile:focus-visible::before {
        opacity: 1;
    }

    .clients-tile:hover::after,
    .clients-tile:focus-visible::after {
        opacity: 1;
        transform: scale(1);
    }

    .clients-tile:hover .clients-tile__media img,
    .clients-tile:focus-visible .clients-tile__media img {
        transform: scale(1.08);
    }

    .clients-tile:hover .clients-tile__zoom,
    .clients-tile:focus-visible .clients-tile__zoom,
    .clients-tile:hover .clients-tile__label,
    .clients-tile:focus-visible .clients-tile__label {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .clients-tile:hover .clients-tile__index,
    .clients-tile:focus-visible .clients-tile__index {
        color: #c9e8f1;
    }

    .clients-tile.is-active {
        border-color: #c9e8f1;
        box-shadow: 0 0 0 2px rgba(201, 232, 241, 0.35);
    }
}

.clients-tile:focus-visible {
    outline: 2px solid #c9e8f1;
    outline-offset: 2px;
}

/* Pre-preview jiggle — builds anticipation before ghost appears */
@keyframes clients-tile-jiggle {
    0%, 100% {
        transform: translateY(-4px) scale(1.03) rotate(0deg);
    }
    15% {
        transform: translateY(-5px) scale(1.035) rotate(-1.25deg);
    }
    30% {
        transform: translateY(-3px) scale(1.04) rotate(1.25deg);
    }
    45% {
        transform: translateY(-5px) scale(1.035) rotate(-0.85deg);
    }
    60% {
        transform: translateY(-3px) scale(1.04) rotate(0.85deg);
    }
    75% {
        transform: translateY(-4px) scale(1.045) rotate(-0.5deg);
    }
}

@media (hover: hover) and (pointer: fine) {
    .clients-tile.is-charging {
        animation: clients-tile-jiggle 0.42s ease-in-out infinite;
        border-color: rgba(201, 232, 241, 0.75);
        box-shadow:
            0 10px 24px rgba(0, 23, 28, 0.32),
            0 0 18px rgba(201, 232, 241, 0.22);
    }

    .clients-tile.is-charging .clients-tile__zoom {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Ghost hover preview — scales up from tile, follows cursor */
.clients-ghost {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: min(92vw, 840px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.06);
    transform-origin: 0 0;
    will-change: transform, opacity, left, top;
    transition:
        opacity 0.45s ease,
        transform 0.8s cubic-bezier(0.34, 1.45, 0.64, 1),
        visibility 0s linear 0.8s,
        left 0.32s ease-out,
        top 0.32s ease-out;
}

.clients-ghost.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition:
        opacity 0.5s ease,
        transform 0.85s cubic-bezier(0.34, 1.45, 0.64, 1),
        visibility 0s linear 0s,
        left 0.32s ease-out,
        top 0.32s ease-out;
}

.clients-ghost.is-closing {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.94);
    transition:
        opacity 0.35s ease,
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.4s,
        left 0.32s ease-out,
        top 0.32s ease-out;
}

.clients-ghost__card {
    position: relative;
    border: 1px solid rgba(201, 232, 241, 0.4);
    background: rgba(0, 23, 28, 0.72);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow:
        0 28px 70px rgba(0, 23, 28, 0.48),
        0 0 40px rgba(201, 232, 241, 0.12),
        0 0 0 1px rgba(201, 232, 241, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transform: scale(1);
    transition: transform 0.65s cubic-bezier(0.34, 1.25, 0.64, 1);
}

.clients-ghost.is-visible .clients-ghost__card {
    animation: clients-ghost-float 4s ease-in-out infinite;
}

.clients-ghost.is-closing .clients-ghost__card {
    animation: none;
}

@keyframes clients-ghost-float {
    0%, 100% {
        translate: 0 0;
    }
    50% {
        translate: 0 -6px;
    }
}

.clients-ghost__glow {
    position: absolute;
    inset: -40%;
    background: radial-gradient(
        circle at 50% 30%,
        rgba(201, 232, 241, 0.22) 0%,
        transparent 55%
    );
    pointer-events: none;
    animation: clients-ghost-pulse 3s ease-in-out infinite;
}

@keyframes clients-ghost-pulse {
    0%, 100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

.clients-ghost__image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 17, 22, 0.92);
    border-bottom: 1px solid rgba(201, 232, 241, 0.12);
    max-height: min(82vh, 820px);
    min-height: 240px;
}

.clients-ghost__image-wrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(82vh, 820px);
    object-fit: contain;
    opacity: 1;
    filter: saturate(1.08) contrast(1.04);
    transform: scale(1.18);
    transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.clients-ghost.is-visible .clients-ghost__image-wrap img {
    transform: scale(1);
}

.clients-ghost.is-closing .clients-ghost__image-wrap img {
    transform: scale(1.08);
    transition: transform 0.4s ease;
}

.clients-ghost__caption {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.85rem 0.85rem;
}

.clients-ghost__label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(201, 232, 241, 0.85);
}

.clients-ghost__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.125rem;
    line-height: 1.15;
    color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 640px) {
    .clients-ghost {
        width: min(92vw, 440px);
    }

    .clients-ghost__image-wrap {
        max-height: min(70vh, 520px);
        min-height: 160px;
    }

    .clients-ghost__image-wrap img {
        max-height: min(70vh, 520px);
    }
}

/* Section chrome (unchanged) */
.clients-section__header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .clients-section__header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        margin-bottom: 2.5rem;
    }
}

.clients-section__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
}

.clients-section__stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.clients-section__stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    line-height: 1;
    color: #c9e8f1;
}

.clients-section__stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(201, 232, 241, 0.65);
}

.clients-section--light .clients-tile {
    border-color: #e5e2e1;
    background: #f0eded;
}

.clients-section--light .clients-tile__index {
    color: rgba(0, 23, 28, 0.45);
}

.clients-section--light .clients-tile__zoom {
    background: rgba(255, 255, 255, 0.85);
    color: #00171c;
    border-color: rgba(0, 23, 28, 0.15);
}

.clients-section--light .clients-section__stat-value {
    color: #00171c;
}

.clients-section--light .clients-section__stat-label {
    color: #41484a;
}

@media (max-width: 1023px) {
    .clients-section__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .clients-section__stat-value {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .clients-tile,
    .clients-tile__media img,
    .clients-ghost,
    .clients-ghost__glow {
        transition: none !important;
        animation: none !important;
    }

    .clients-tile.is-charging {
        animation: none !important;
        box-shadow: 0 0 0 2px rgba(201, 232, 241, 0.45);
    }
}
