/* ==========================================================================
   Our Clients — Geoida (globe) / Grid view toggle
   Geoida is the default view and renders the section in dark mode; Grid keeps
   the original light logo grid. Behaviour lives in js-theme/geoida.js.
   ========================================================================== */

.brands-list {
    transition: background-color 0.45s ease;
}

.brands-list .header-title,
.brands-list .subtitle {
    transition: color 0.45s ease;
}

/* ---- Dark mode (Geoida) ---- */
.brands-list.is-geoida {
    background: #181C22;
    padding-bottom: 88px;
}

.brands-list.is-geoida h2.header-title {
    color: #FFFFFF;
}

.brands-list.is-geoida .subtitle {
    color: #D6D7D8;
}

/* The divider above the section sits on the light Services band; it reads as
   a stray line right above the dark section, so fade it (no layout shift). */
.section-divider-wrap .section-divider {
    transition: opacity 0.45s ease;
}

.section-divider-wrap.is-muted .section-divider {
    opacity: 0;
}

/* The panel that just appeared fades in, so the Grid never flashes its
   colour logos on the still-dark background (and vice versa). */
@keyframes clients-panel-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.brands-list [role="tabpanel"] {
    animation: clients-panel-in 0.35s ease 0.12s both;
}

/* ---- View toggle (segmented control) ---- */
.clients-view-toggle {
    position: relative;
    display: flex;
    width: max-content;
    margin: 28px auto 0;
    padding: 4px;
    border-radius: 16px;
    background: rgba(49, 54, 61, 0.07);
    transition: background-color 0.45s ease, box-shadow 0.45s ease;
}

.clients-view-toggle[hidden] {
    display: none;
}

.clients-view-toggle__thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 12px;
    background: #31363D;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.45s ease;
}

.clients-view-toggle[data-active="grid"] .clients-view-toggle__thumb {
    transform: translateX(100%);
}

.clients-view-toggle__btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 128px;
    margin: 0;
    padding: 12px 22px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-family: 'Noto Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 22px;
    letter-spacing: -0.2px;
    color: #31363D;
    cursor: pointer;
    transition: color 0.3s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.clients-view-toggle__btn[aria-selected="true"] {
    color: #FFFFFF;
    cursor: default;
}

.clients-view-toggle__btn[aria-selected="false"]:hover {
    opacity: 0.75;
}

.clients-view-toggle__btn:focus {
    outline: none;
}

.clients-view-toggle__btn:focus-visible {
    outline: 2px solid #008751;
    outline-offset: 2px;
}

.clients-view-toggle__btn svg {
    flex: none;
    width: 18px;
    height: 18px;
}

.is-geoida .clients-view-toggle {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.is-geoida .clients-view-toggle__thumb {
    background: #F5F5F5;
}

.is-geoida .clients-view-toggle__btn {
    color: #D6D7D8;
}

.is-geoida .clients-view-toggle__btn[aria-selected="true"] {
    color: #181C22;
}

.is-geoida .clients-view-toggle__btn:focus-visible {
    outline-color: #00E389;
}

/* ---- Globe stage ---- */
.geoida {
    padding-top: 24px;
}

.geoida[hidden],
.brands-list [role="tabpanel"][hidden] {
    display: none;
}

.geoida__stage {
    position: relative;
    height: 640px;
    height: clamp(520px, 52vw, 780px);
    /* …but never taller than the screen, so the whole globe fits in view. */
    height: min(clamp(520px, 52vw, 780px), max(480px, calc(100vh - 140px)));
    margin: 0 auto;
    overflow: hidden;
    overflow: clip;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

.geoida__bloom,
.geoida__sphere {
    position: absolute;
    pointer-events: none;
}

.geoida__bloom {
    border-radius: 50%;
}

/* The sphere is sized from --r (the globe radius). geoida.js sets it exactly;
   until then the same formula in container units places the loading
   placeholder precisely where the globe will appear. */
.geoida__sphere {
    --r: 240px;
    left: calc(50% - var(--r));
    top: calc(50% - var(--r));
    width: calc(var(--r) * 2);
    height: calc(var(--r) * 2);
    overflow: hidden;
    border-radius: 50%;
    background: radial-gradient(circle calc(var(--r) * 1.3) at 31% 27%, #272D36 0%, #1C2027 62%, #171A20 100%);
    /* Rim: a quiet stroke just outside the edge; lighter while hovered. */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 0 0 1.5px #31363D;
    transition: box-shadow 0.3s ease;
}

.geoida__stage.is-hover .geoida__sphere {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 0 0 1.5px #414851;
}

@supports (width: 1cqw) {
    .geoida__stage {
        container-type: size;
    }

    .geoida__sphere {
        --r: min(27cqw, 40cqh);         /* wide stages: R = min(0.27 W, 0.4 H) */
    }

    /* geoida.js goes compact below ~804px of stage width at the 520px stage
       height those widths get (exact rule: W < 843 and W < 0.8 H + 388). */
    @container (max-width: 803px) {
        .geoida__sphere {
            --r: min(40cqw, 36cqh);     /* compact stages: R = min(0.4 W, 0.36 H) */
        }
    }
}

/* ---- Loading placeholder ----
   Until the first frame is drawn (slow connection, or the globe is still being
   built) the sphere, already with its rim, shows a faint dot texture and a slow
   sheen; then it cross-fades into the live globe. */
.geoida__sphere::before,
.geoida__sphere::after {
    content: "";
    position: absolute;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.geoida__sphere::before {
    inset: 0;
    border-radius: 50%;
    background-image: radial-gradient(circle, rgba(168, 176, 186, 0.2) 1.4px, transparent 2px);
    background-size: 7px 7px;
    -webkit-mask-image: radial-gradient(circle closest-side, #000 55%, transparent 100%);
    mask-image: radial-gradient(circle closest-side, #000 55%, transparent 100%);
}

.geoida__sphere::after {
    top: 0;
    bottom: 0;
    left: -100%;
    width: 300%;
    background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, 0.07) 50%, transparent 62%);
    animation: geoida-sheen 2.4s ease-in-out infinite;
}

@keyframes geoida-sheen {
    from { transform: translateX(-34%); }
    to { transform: translateX(34%); }
}

.geoida__stage.is-ready .geoida__sphere::before,
.geoida__stage.is-ready .geoida__sphere::after {
    opacity: 0;
    animation-play-state: paused;
}

.geoida__canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.geoida__canvas,
.geoida__bloom {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.geoida__stage.is-ready .geoida__canvas,
.geoida__stage.is-ready .geoida__bloom {
    opacity: 1;
}

.geoida__stage.is-grabbable {
    cursor: grab;
}

.geoida__stage.is-dragging,
.geoida__stage.is-dragging .geoida-label {
    cursor: grabbing;
}

.geoida__labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.geoida__meta {
    margin: 12px 0 0;
    font-family: 'Noto Sans', sans-serif;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    color: #9AA1AB;
}

.geoida__meta strong {
    font-weight: 700;
    color: #D6D7D8;
}

/* ---- Logo labels ---- */
.geoida-label {
    --cell-w: 104px;
    --cell-h: 36px;
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px 8px 6px;
    border-radius: 12px;
    background: rgba(24, 28, 34, 0.9);
    border: 1px solid rgba(108, 116, 128, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.geoida-label.is-interactive {
    pointer-events: auto;
}

.geoida-label.is-hot {
    border-color: rgba(0, 227, 137, 0.55);
    background: rgba(24, 28, 34, 0.96);
}

.geoida-label__place {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px 4px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #D6D7D8;
}

.geoida-label__place::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00E389;
    box-shadow: 0 0 0 3px rgba(0, 227, 137, 0.18);
}

.geoida-label__logos {
    display: grid;
    grid-template-columns: repeat(var(--cols, 1), var(--cell-w));
    gap: 2px;
}

.geoida-logo {
    display: block;
    width: var(--cell-w);
    height: var(--cell-h);
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.geoida-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Brand logos are drawn for light backgrounds; flatten them to white.
       Files in images/brands/mono-logos are already white, so this is a no-op there. */
    filter: brightness(0) invert(1);
    opacity: 0;                      /* fades in once loaded (.is-loaded) */
    transition: opacity 0.2s ease;
    /* The link cell is the click target, not the (possibly scaled) image. */
    pointer-events: none;
}

.geoida-logo.is-loaded img {
    opacity: 0.82;
}

/* mono-logos use a 246 × 120 frame with more padding than the 339 × 119 grid
   logos (set by geoida.js from the image's proportions); scale them to match. */
.geoida-logo.is-mono-frame img {
    transform: scale(1.38);
}

a.geoida-logo:hover,
a.geoida-logo:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

a.geoida-logo:hover img,
a.geoida-logo:focus-visible img {
    opacity: 1;
}

a.geoida-logo:focus {
    outline: none;
}

a.geoida-logo:focus-visible {
    outline: 2px solid #00E389;
    outline-offset: 1px;
}

/* Compact stages (tablets, phones): fewer, smaller labels float by their pins. */
.geoida__stage.is-compact .geoida-label {
    --cell-w: 84px;
    --cell-h: 30px;
    padding: 6px 6px 4px;
    border-radius: 10px;
}

@media (max-width: 767px) {
    .brands-list.is-geoida {
        padding-bottom: 56px;
    }

    .clients-view-toggle {
        margin-top: 20px;
    }

    .clients-view-toggle__btn {
        min-width: 112px;
        padding: 10px 16px;
        font-size: 15px;
    }

    .geoida {
        padding-top: 8px;
    }

    .geoida__stage {
        height: 460px;
    }

    .geoida__stage.is-compact .geoida-label {
        --cell-w: 72px;
        --cell-h: 26px;
    }

    .geoida-label__place {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .geoida__meta {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brands-list,
    .brands-list .header-title,
    .brands-list .subtitle,
    .clients-view-toggle,
    .clients-view-toggle__thumb,
    .section-divider-wrap .section-divider {
        transition: none;
    }

    .brands-list [role="tabpanel"] {
        animation: none;
    }

    .geoida__sphere::before,
    .geoida__canvas,
    .geoida__bloom {
        transition: none;
    }

    .geoida__sphere::after {
        animation: none;
        opacity: 0;
    }
}

/* Windows High Contrast / forced colours: keep the labels' dark backing so the
   white logos stay visible, and mark the selected view with system colours. */
@media (forced-colors: active) {
    .geoida-label {
        forced-color-adjust: none;
        border-color: CanvasText;
    }

    #our-clients .clients-view-toggle__thumb {
        forced-color-adjust: none;
        background: Highlight;
    }

    #our-clients .clients-view-toggle__btn[aria-selected="true"] {
        forced-color-adjust: none;
        color: HighlightText;
    }

    .geoida__sphere,
    .geoida__bloom {
        forced-color-adjust: none;
    }
}

/* Print the plain logo grid. */
@media print {
    #our-clients .clients-view-toggle,
    #clients-panel-geoida {
        display: none !important;
    }

    #clients-panel-grid[hidden] {
        display: block !important;
    }

    .brands-list [role="tabpanel"] {
        animation: none !important;
    }

    #our-clients.is-geoida {
        background: none;
    }
}
