.clients-terminal-page { --clients-accent: rgba(120, 255, 235, 0.9); }

.clients-terminal { display: flex; flex-direction: column; min-height: 100vh; }

.clients-counter-line { display: flex; align-items: baseline; gap: 0.5rem; }

.clients-counter {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.3em;
    color: var(--clients-accent);
    text-shadow: 0 0 12px rgba(120, 255, 235, 0.55);
}

.clients-grid-section { flex: 1; min-height: 0; padding: clamp(0.55rem, 1vw, 0.8rem); background: rgba(120, 255, 235, 0.1); }

.clients-panel { min-width: 0; border: 1px solid rgba(120, 255, 235, 0.26); background: rgba(3, 16, 19, 0.84); box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.35); height: 100%; display: flex; flex-direction: column; }

.clients-empty { padding: 1.5rem clamp(1rem, 2.5vw, 2rem); color: rgba(184, 252, 232, 0.64); }

.clients-logo-grid {
    display: grid;
    grid-auto-flow: dense;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: minmax(120px, auto);
    gap: clamp(0.7rem, 1.6vw, 1.2rem);
    padding: clamp(1rem, 2vw, 1.8rem);
    overflow-y: auto;
    perspective: 1000px;
}

/* Bento-style portfolio touch: a few tiles stand out bigger for visual rhythm. */
.clients-logo-card:nth-child(6n+1) { grid-column: span 2; grid-row: span 2; }
.clients-logo-card:nth-child(11n+5) { grid-column: span 2; }

.clients-logo-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 2.2vw, 1.6rem);
    border-radius: 18px;
    border: 1px solid rgba(120, 255, 235, 0.16);
    background: linear-gradient(160deg, rgba(13, 40, 45, 0.85), rgba(6, 20, 24, 0.75));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    opacity: 0;
    transform: translateY(18px) scale(0.92);
    will-change: transform;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.clients-logo-card.is-revealed {
    /* Base state once revealed (kept even after the animation is cleared by JS so hover-driven transforms apply cleanly). */
    opacity: 1;
    transform: none;
    animation: clients-card-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes clients-card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Rotating gradient ring, revealed on hover/focus for a colorful "wahou" accent around each tile. */
.clients-logo-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(from var(--angle, 0deg), #78ffeb, #ff8bd8, #ffd76b, #78ffeb);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    animation: clients-ring-spin 5s linear infinite;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

@supports (background: paint(something)) {
    @property --angle {
        syntax: '<angle>';
        inherits: false;
        initial-value: 0deg;
    }
}

@keyframes clients-ring-spin {
    to { --angle: 360deg; }
}

/* Cursor-follow spotlight glare, driven by --mx/--my custom properties set from JS. */
.clients-logo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.16), transparent 62%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.clients-panel .world-terminal-panel-head { flex-wrap: wrap; gap: 0.5rem; }

.clients-filter {
    flex: 1 1 150px;
    min-width: 0;
    max-width: 300px;
    align-self: center;
    margin: 0.3rem 0;
    padding: 0.28rem 0.55rem;
    border: 1px solid rgba(120, 255, 235, 0.3);
    border-radius: 0;
    outline: 0;
    background: rgba(2, 13, 16, 0.85);
    color: #d3fff4;
    font: inherit;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.clients-filter::placeholder { color: rgba(165, 255, 232, 0.4); }

.clients-filter:focus {
    border-color: #76f5d9;
    box-shadow: 0 0 0 2px rgba(118, 245, 217, 0.12);
}

.clients-logo-card.is-filtered-out { display: none; }

.clients-no-result { margin: 0; border-top: 1px dashed rgba(120, 255, 235, 0.18); }

@media (max-width: 620px) {
    .clients-filter { flex-basis: 100%; max-width: none; order: 3; }
}

.clients-logo-card:hover,
.clients-logo-card:focus-visible {
    border-color: rgba(120, 255, 235, 0.45);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(120, 255, 235, 0.18);
}

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

.clients-logo-card:hover::after,
.clients-logo-card:focus-visible::after {
    opacity: 1;
}

.clients-logo-card img {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Full color always: grayscale hides logos with light/white marks for some users. */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
    transition: transform 0.25s ease, filter 0.25s ease;
}

.clients-logo-card:hover img,
.clients-logo-card:focus-visible img {
    transform: scale(1.06);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
}

@media (prefers-reduced-motion: reduce) {
    .clients-logo-card,
    .clients-logo-card.is-revealed {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .clients-logo-card::before {
        animation: none;
    }
}

@media (max-width: 640px) {
    .clients-logo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .clients-logo-card:nth-child(6n+1),
    .clients-logo-card:nth-child(11n+5) { grid-column: span 1; grid-row: span 1; }
}
