/* ============================================================
 * /services — all-services index + client-side search/category filter.
 * Scoped under .ad-page-page--services. Locked Figma geometry:
 *   desktop node 952:761 (1440) + mobile node 952:1594 (375).
 * Container + side padding + mobile shell come from the shared
 * .ad-page-shell / --ad-shell-wide (no container redefinition here).
 * All design colors map to existing --ad-* tokens; the grey control
 * fills (#f2f2f2 / #616161 / #979797 — sampled from the frame) are
 * not tokenized, so they live as scoped --ad-services-* vars.
 * ============================================================ */

.ad-page-page--services {
    --ad-services-control-bg: #f2f2f2;
    --ad-services-control-text: #616161;
    --ad-services-control-icon: #1d1d1d;
    --ad-services-chevron: #979797;
}

/* ---- Section vertical padding: Figma Index frame = 64 top / 112 bottom (desktop). ---- */
.ad-page-page--services .ad-services-index {
    padding-top: 64px;
    /* No bottom padding: the last (tinted) section band flows straight into the
       final-CTA band — avoids an orphaned white strip between them. */
    padding-bottom: 0;
}

/* ---- Section vertical rhythm: header -> grid gap 48 (desktop) ---- */
.ad-page-page--services .ad-services-index__inner {
    display: flex;
    flex-direction: column;
    /* Sections butt together; their own padding-block provides the rhythm and
       lets the full-bleed tinted bands meet edge-to-edge. */
    gap: 0;
}

/* ---- Section header: H1 left, controls right ---- */
.ad-page-page--services .ad-services-index__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    /* Inter-section gap is 0 so the bands butt together; the header needs its own
       breathing room before the first tinted band starts. */
    margin-bottom: 40px;
}

.ad-page-page--services .ad-services-index__title {
    margin: 0;
    color: var(--ad-color-blue-deep);
    font-family: var(--ad-font-primary);
    font-weight: var(--ad-font-weight-semibold);
    font-size: 48px;
    line-height: 1.1;
}

/* ---- Controls ---- */
.ad-page-page--services .ad-services-index__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

/* Search: 248x40, r4, pad 8/12, inner gap 12 (icon + input). Filled grey, no border. */
.ad-page-page--services .ad-services-search {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 248px;
    height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--ad-radius-sm);
    background: var(--ad-services-control-bg);
}

.ad-page-page--services .ad-services-search__icon {
    display: flex;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--ad-services-control-icon);
}

.ad-page-page--services .ad-services-search__input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--ad-color-blue-deep);
    font-family: var(--ad-font-primary);
    font-size: 16px;
    line-height: 1.25;
    appearance: none;
}

.ad-page-page--services .ad-services-search__input::placeholder {
    color: var(--ad-services-control-text);
    opacity: 1;
}

.ad-page-page--services .ad-services-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* Category select: 128x40, r4, pad 8/12, grey fill, no border, custom chevron. */
.ad-page-page--services .ad-services-select-wrap {
    flex: 0 0 auto;
}

.ad-page-page--services .ad-services-select {
    width: auto;
    min-width: 168px;
    max-width: 220px;
    height: 40px;
    padding: 8px 36px 8px 12px;
    border: 0;
    border-radius: var(--ad-radius-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
    background-color: var(--ad-services-control-bg);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23979797' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    color: var(--ad-color-blue-deep);
    font-family: var(--ad-font-primary);
    font-size: 16px;
    line-height: 1.25;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.ad-page-page--services .ad-services-search__input:focus-visible,
.ad-page-page--services .ad-services-select:focus-visible {
    outline: 2px solid var(--ad-color-teal-deep);
    outline-offset: 2px;
}

/* ---- Grid: 3 columns, gap 32 (card width 416 derived: (1312 - 2*32)/3). ---- */
.ad-page-page--services .ad-services-index__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 32px;
    row-gap: 32px;
}

/* ---- Empty state ---- */
.ad-page-page--services .ad-services-index__empty {
    margin: 0;
    color: var(--ad-color-copy-soft);
    font-family: var(--ad-font-primary);
    font-size: 18px;
    line-height: 1.5;
}

/* ---- Filter utility (JS toggles on non-matching cards + the empty-state). ---- */
.ad-page-page--services .is-hidden {
    display: none !important;
}

/* ---- Visually-hidden labels (a11y). ---- */
.ad-page-page--services .ad-services-index__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Page intro lede (matches the .ad-page-page p lede convention). ---- */
.ad-page-page--services .ad-services-index__intro-block {
    flex: 1 1 360px;
    min-width: 0;
}

.ad-page-page--services .ad-services-index__intro {
    margin: 16px 0 0;
    max-width: 680px;
    color: var(--ad-text-soft);
    font-family: var(--ad-font-primary);
    font-size: 18px;
    line-height: 1.62;
}

/* ---- Category sections: left-aligned eyebrow + H2 + lede (reuses the
 * .ad-page-section-heading pattern), then the existing 3-col grid per section. ---- */
.ad-page-page--services .ad-services-section {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-block: 56px;
}

.ad-page-page--services .ad-services-section.is-hidden {
    display: none !important;
}

/* Alternating full-bleed bands: tinted odd sections, painted with a box-shadow
 * bleed + horizontal clip-path so the colour reaches the viewport edges without
 * any layout shift or horizontal scroll. Cards flip to white to keep contrast
 * (the default card fill is the same mist family as the tint). */
.ad-page-page--services .ad-services-section:nth-of-type(odd) {
    background: var(--ad-color-ice);
    box-shadow: 0 0 0 100vmax var(--ad-color-ice);
    clip-path: inset(0 -100vmax);
}

.ad-page-page--services .ad-services-section:nth-of-type(odd) .ad-services-card {
    background: var(--ad-color-white);
}

.ad-page-page--services .ad-services-section__heading {
    max-width: 760px;
    margin: 0;
    text-align: left;
}

.ad-page-page--services .ad-services-section__heading .ad-page-overline {
    margin: 0 0 10px;
    color: var(--ad-color-teal-deep);
    font-size: 16px;
    font-weight: var(--ad-font-weight-semibold);
}

.ad-page-page--services .ad-services-section__heading h2 {
    margin: 0;
    color: var(--ad-color-blue-deep);
    font-family: var(--ad-font-primary);
    font-weight: var(--ad-font-weight-semibold);
    font-size: 40px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.ad-page-page--services .ad-services-section__heading p {
    margin: 12px 0 0;
    max-width: 680px;
    color: var(--ad-text-soft);
    font-family: var(--ad-font-primary);
    font-size: 18px;
    line-height: 1.62;
}

/* ---- Tablet band: drop the controls to their own full-width row before the
 * 640 stack, so search + filter never cram beside the title. ---- */
@media (max-width: 900px) {
    /* 3-up cards get too narrow below ~860; step to 2-up before the 640 stack. */
    .ad-page-page--services .ad-services-index__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ad-page-page--services .ad-services-index__header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    /* In the stacked header, flex-basis would otherwise apply on the vertical
       axis and reserve ~360px, dumping a huge gap above the controls. */
    .ad-page-page--services .ad-services-index__intro-block {
        flex: 0 0 auto;
    }

    .ad-page-page--services .ad-services-index__controls {
        width: 100%;
    }

    .ad-page-page--services .ad-services-search {
        flex: 1 1 auto;
        width: auto;
    }

    .ad-page-page--services .ad-services-select {
        flex: 0 0 auto;
    }
}

/* ============================================================
 * MOBILE (<=640px): shell becomes 335/20; header stacks; controls
 * full-width stacked; grid 1-col; card r8 + image 223; section gap 60.
 * ============================================================ */
@media (max-width: 640px) {
    .ad-page-page--services .ad-services-index {
        padding-top: 60px;
        padding-bottom: 0;
    }

    .ad-page-page--services .ad-services-index__inner {
        gap: 0;
    }

    .ad-page-page--services .ad-services-index__header {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        margin-bottom: 24px;
    }

    .ad-page-page--services .ad-services-index__title {
        font-size: 36px;
    }

    .ad-page-page--services .ad-services-index__controls {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
    }

    .ad-page-page--services .ad-services-search,
    .ad-page-page--services .ad-services-select-wrap,
    .ad-page-page--services .ad-services-select {
        width: 100%;
        max-width: none;
    }

    .ad-page-page--services .ad-services-index__grid {
        grid-template-columns: 1fr;
    }

    .ad-page-page--services .ad-services-index__intro {
        font-size: 16px;
    }

    .ad-page-page--services .ad-services-section {
        gap: 20px;
        padding-block: 40px;
    }

    .ad-page-page--services .ad-services-section__heading h2 {
        font-size: 28px;
    }
}
