/* ==========================================================================
   POLY — Services
   A "connected constellation" of floating service cards: one lead card that
   opens the section, then staggered tiles wired together with dashed guides
   and blue nodes. Inspired by design-009 — soft shadows, inset media panels
   and gradient icon chips instead of the default bordered grid.
   ========================================================================== */

.poly-services {
    --svc-radius: 24px;
    --svc-radius-inner: 15px;
    --svc-inset: 9px;
    --svc-shadow: 0 1px 2px rgba(16, 23, 58, .04), 0 24px 48px -32px rgba(16, 23, 58, .38);
    --svc-shadow-lift: 0 2px 5px rgba(16, 23, 58, .06), 0 44px 74px -38px rgba(16, 23, 58, .5);
    --svc-chip: linear-gradient(142deg, var(--poly-accent-400) 0%, var(--poly-brand) 62%);
    --svc-dash: linear-gradient(90deg, var(--poly-line-strong) 0 7px, transparent 7px 15px);
    isolation: isolate;
}

/* --------------------------------------------------------------- backdrop */

/* Two wide tints lift the flat mist into the airy gradient of the reference. */
.poly-services__aura {
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
}

.poly-services__aura--one {
    inset-block-start: -18%;
    inset-inline-end: -12%;
    width: min(820px, 78vw);
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(47, 134, 201, .18), rgba(47, 134, 201, 0) 66%);
}

.poly-services__aura--two {
    inset-block-end: -24%;
    inset-inline-start: -14%;
    width: min(640px, 66vw);
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(57, 67, 155, .13), rgba(57, 67, 155, 0) 68%);
}

/* Dashed guides + nodes: the "everything is one system" motif. Decorative
   only, so they disappear as soon as the layout stops being three wide. */
.poly-services__wires {
    position: absolute;
    inset: 0;
    z-index: 0;
    max-width: var(--poly-max);
    margin-inline: auto;
    padding-inline: var(--poly-gutter);
    pointer-events: none;
}

.poly-services__wire {
    position: absolute;
    border: 2px dashed var(--poly-line-strong);
    opacity: .7;
}

.poly-services__wire--one {
    inset-inline-start: 3%;
    inset-block-start: 44%;
    width: 13%;
    height: 22%;
    border-block-start: 0;
    border-inline-end: 0;
    border-end-start-radius: 40px;
}

.poly-services__wire--two {
    inset-inline-end: 4%;
    inset-block-start: 30%;
    width: 12%;
    height: 18%;
    border-block-end: 0;
    border-inline-start: 0;
    border-start-end-radius: 40px;
}

.poly-services__node {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--poly-brand);
    box-shadow: 0 0 0 5px var(--poly-mist), 0 8px 16px -6px rgba(57, 67, 155, .7);
}

.poly-services__node--one   { inset-inline-start: 3%;  inset-block-start: calc(44% - 5px); margin-inline-start: -5px; }
.poly-services__node--two   { inset-inline-end: 4%;    inset-block-start: calc(48% - 5px); margin-inline-end: -5px; }

/* ------------------------------------------------------------------- head */

.poly-services__head {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: clamp(26px, 4vw, 84px);
    align-items: end;
    padding-bottom: clamp(34px, 3.8vw, 54px);
    margin-bottom: clamp(40px, 4.6vw, 68px);
}

/* Dashed rule instead of a hairline — same language as the wires. */
.poly-services__head::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    height: 2px;
    background-image: var(--svc-dash);
    background-size: 15px 2px;
    background-repeat: repeat-x;
    opacity: .8;
}

.poly-services__title { max-width: 16ch; }

.poly-services__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.poly-services__intro {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--poly-body);
    max-width: 46ch;
}

.poly-services__count {
    display: inline-flex;
    align-items: baseline;
    gap: .6rem;
    margin-top: 1.5rem;
    padding: .55rem 1.05rem;
    background: var(--poly-white);
    border-radius: 100px;
    box-shadow: var(--svc-shadow);
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--poly-muted);
}

.poly-services__count strong {
    font-family: var(--poly-font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--poly-brand);
}

/* ------------------------------------------------------------------ cards */

.poly-services__grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
    gap: clamp(20px, 2.2vw, 32px);
    align-items: start;
}

.poly-service-card { display: flex; }
.poly-service-card--lead { grid-column: 1 / -1; }

.poly-service-card__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--poly-white);
    border-radius: var(--svc-radius);
    box-shadow: var(--svc-shadow);
    transition: transform .55s var(--poly-ease-out), box-shadow .55s var(--poly-ease);
}

.poly-service-card__inner:hover {
    transform: translateY(-8px);
    box-shadow: var(--svc-shadow-lift);
}

/* The picture sits inset inside the card, the way the reference nests its
   blue panels inside white frames. */
.poly-service-card__visual {
    position: relative;
    padding: var(--svc-inset) var(--svc-inset) 0;
}

.poly-service-card__media {
    aspect-ratio: 16 / 11;
    border-radius: var(--svc-radius-inner);
    overflow: hidden;
}

.poly-service-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 23, 58, 0) 48%, rgba(16, 23, 58, .34));
    opacity: .8;
    transition: opacity .55s var(--poly-ease);
}

.poly-service-card__inner:hover .poly-service-card__media::after { opacity: .45; }

.poly .poly-service-card__media img {
    transition: transform 1.15s var(--poly-ease-out);
}

.poly-service-card__inner:hover .poly-service-card__media img { transform: scale(1.06); }

/* Fallback panel when a service has no photo: dot grid + oversized glyph. */
.poly-service-card__media--plain {
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 1px 1px, var(--poly-line-strong) 1px, transparent 1.1px) 0 0 / 18px 18px,
        radial-gradient(120% 100% at 50% 120%, rgba(57, 67, 155, .1), rgba(57, 67, 155, 0) 62%),
        var(--poly-mist);
}

.poly-service-card__media--plain::after { display: none; }

.poly-service-card__ghost .poly-icon {
    width: 84px;
    height: 84px;
    color: var(--poly-brand);
    opacity: .22;
    stroke-width: 1.1;
}

.poly-service-card__index {
    position: absolute;
    z-index: 2;
    inset-block-start: calc(var(--svc-inset) + 14px);
    inset-inline-end: calc(var(--svc-inset) + 14px);
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    height: 27px;
    padding-inline: .55rem;
    border-radius: 100px;
    background: rgba(255, 255, 255, .93);
    font-family: var(--poly-font-display);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--poly-brand);
    box-shadow: 0 8px 18px -10px rgba(16, 23, 58, .55);
}

/* Gradient chip that floats off the picture and bridges into the text. */
.poly-service-card__icon {
    position: absolute;
    z-index: 2;
    inset-inline-start: calc(var(--svc-inset) + 16px);
    inset-block-end: -26px;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--svc-chip);
    color: var(--poly-white);
    box-shadow: 0 18px 32px -16px rgba(57, 67, 155, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
    transition: transform .55s var(--poly-ease-out), border-radius .55s var(--poly-ease);
}

.poly-service-card__icon .poly-icon { width: 24px; height: 24px; stroke-width: 1.7; }

.poly-service-card__inner:hover .poly-service-card__icon {
    transform: translateY(-5px) rotate(-7deg);
    border-radius: 24px;
}

.poly-service-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 46px clamp(22px, 2vw, 30px) clamp(24px, 2.2vw, 32px);
}

.poly-service-card__title {
    font-size: clamp(1.15rem, 1.5vw, 1.35rem);
    font-weight: 700;
    letter-spacing: -.024em;
}

.poly-service-card__title a { color: inherit; text-decoration: none; }

/* The whole card is clickable while the link itself stays the focus target. */
.poly-service-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: var(--svc-radius);
}

.poly-service-card__text {
    margin-top: .85rem;
    font-size: .9375rem;
    line-height: 1.72;
    color: var(--poly-muted);
}

.poly-service-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: 1.35rem;
}

.poly-service-card__meta li {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    padding: .36em .85em;
    background: var(--poly-mist);
    border-radius: 100px;
    font-size: .73rem;
    font-weight: 500;
    letter-spacing: .01em;
    color: var(--poly-muted);
}

.poly-service-card__meta li::before {
    content: "";
    width: 5px;
    height: 5px;
    flex: none;
    border-radius: 50%;
    background: var(--poly-accent);
}

.poly-service-card__cta {
    display: inline-flex;
    align-items: center;
    gap: .75em;
    margin-top: auto;
    padding-top: 1.7rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--poly-brand);
}

.poly-service-card__arrow {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid var(--poly-line-strong);
    border-radius: 50%;
    transition: background-color .4s var(--poly-ease), border-color .4s var(--poly-ease),
                color .4s var(--poly-ease), transform .45s var(--poly-ease-out);
}

.poly-service-card__arrow .poly-icon { width: 15px; height: 15px; stroke-width: 1.8; }

.poly-service-card__inner:hover .poly-service-card__arrow {
    background: var(--poly-brand);
    border-color: transparent;
    color: var(--poly-white);
    transform: translateX(5px);
}

/* ------------------------------------------------------------- lead card */

/* Stacked (narrow) the lead picture stays a letterbox so it cannot swallow
   the fold; from 1000px up it becomes a full height column instead. */
@media (max-width: 999px) {
    .poly-service-card--lead .poly-service-card__media { aspect-ratio: 21 / 10; }
    .poly-service-card--lead .poly-service-card__text { max-width: 62ch; }
}

@media (min-width: 1000px) {
    .poly-service-card--lead .poly-service-card__inner {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        align-items: stretch;
    }

    .poly-service-card--lead .poly-service-card__visual {
        padding: var(--svc-inset);
        height: 100%;
    }

    .poly-service-card--lead .poly-service-card__media {
        height: 100%;
        min-height: 320px;
        aspect-ratio: auto;
    }

    /* On the wide card the chip floats over the top corner instead of the seam. */
    .poly-service-card--lead .poly-service-card__icon {
        inset-block-start: calc(var(--svc-inset) + 16px);
        inset-block-end: auto;
        width: 62px;
        height: 62px;
        border-radius: 20px;
    }

    .poly-service-card--lead .poly-service-card__icon .poly-icon { width: 27px; height: 27px; }

    .poly-service-card--lead .poly-service-card__body {
        justify-content: center;
        padding: clamp(34px, 3.2vw, 56px) clamp(30px, 3vw, 54px);
    }

    .poly-service-card--lead .poly-service-card__title { font-size: clamp(1.5rem, 2.1vw, 2.05rem); }
    .poly-service-card--lead .poly-service-card__text { margin-top: 1.05rem; font-size: 1.0125rem; max-width: 48ch; }
    .poly-service-card--lead .poly-service-card__cta { margin-top: 2rem; padding-top: 0; }
}

/* Zigzag: the second and fourth tile drop a little so the row reads as a
   composition rather than a table. */
@media (min-width: 1101px) {
    .poly-service-card:not(.poly-service-card--lead):nth-of-type(even) {
        margin-block-start: clamp(18px, 2.6vw, 44px);
    }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
    .poly-services__wires { display: none; }
}

@media (max-width: 900px) {
    .poly-services__head { grid-template-columns: 1fr; align-items: start; }
    .poly-services__title { max-width: 22ch; }
}

@media (max-width: 620px) {
    .poly-services {
        --svc-radius: 20px;
        --svc-radius-inner: 13px;
    }

    .poly-service-card__icon { width: 50px; height: 50px; border-radius: 16px; }
    .poly-service-card__body { padding-top: 42px; }
}
