/*
 * Bootstrap Package wraps every colPos-0 element in a `.section` div with
 * `overflow: hidden` (components/_section.scss). Any ancestor with a
 * non-visible overflow breaks `position: sticky` on a descendant, so this
 * has to be reset specifically where it would wrap this block - same fix
 * as mission-control's own CSS.
 */
.section:has(> .agency-stack) {
    overflow: visible;
}

.agency-stack {
    position: relative;
    background: var(--pm-color-ink);
    color: var(--pm-color-paper);
}

.agency-sticky {
    position: relative;
    isolation: isolate;
    padding-block: clamp(56px, 8vw, 96px);
}

.agency-bg,
.agency-bg span {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.agency-bg {
    z-index: -1;
    background:
        linear-gradient(120deg, rgba(10, 12, 15, 0.94), rgba(17, 24, 32, 0.86)),
        var(--pm-wallpaper-image) center / cover;
}

.agency-grid {
    opacity: 0.28;
    background:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 58px 58px;
    mask-image: radial-gradient(circle at 58% 52%, #000 0, transparent 72%);
}

.agency-glow {
    border-radius: 50%;
    filter: blur(54px);
}

.agency-glow-orange {
    width: 42vw;
    height: 42vw;
    left: 42%;
    top: 20%;
    background: rgba(245, 158, 1, 0.17);
}

.agency-glow-cyan {
    width: 28vw;
    height: 28vw;
    right: 4%;
    bottom: 6%;
    background: rgba(114, 216, 255, 0.12);
}

.agency-layout {
    position: relative;
    z-index: 1;
    width: min(100% - 40px, var(--pm-container-wide));
    margin-inline: auto;
    padding-inline: clamp(22px, 4.4vw, 64px);
    display: grid;
    grid-template-columns: minmax(320px, 640px) minmax(320px, 640px);
    gap: clamp(24px, 3vw, 48px);
    align-items: center;
}

.agency-copy {
    position: relative;
    z-index: 2;
    max-width: 670px;
}

.agency-copy .kicker {
    margin: 0 0 14px;
    color: var(--pm-color-orange);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.agency-copy h2 {
    margin: 0 0 20px;
    color: var(--pm-color-paper);
    font-size: clamp(36px, 4vw, 60px);
    line-height: 1.02;
    font-weight: 900;
    text-shadow: 0 4px 32px rgba(0, 0, 0, 0.48);
}

.agency-copy p {
    margin: 0;
    max-width: 560px;
    color: rgba(255, 253, 248, 0.86);
    font-size: 18px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.44);
}

.agency-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
    min-height: 32px;
}

.agency-tags span {
    border-radius: 999px;
    border: 1px solid var(--pm-color-line-dark);
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    color: rgba(255, 253, 248, 0.78);
    font-size: 12px;
    font-weight: 800;
}

.agency-stage {
    position: relative;
    z-index: 1;
    min-height: min(70svh, 640px);
    width: 100%;
    max-width: 100%;
}

.agency-stage::before,
.agency-stage::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.agency-stage::before {
    width: 82%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.13);
}

.agency-stage::after {
    width: 58%;
    aspect-ratio: 1;
    border: 1px solid rgba(245, 158, 1, 0.22);
}

.agency-stage-core {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 5;
    width: 150px;
    height: 150px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(245, 158, 1, 0.58);
    background:
        radial-gradient(circle at 36% 26%, rgba(255, 255, 255, 0.2), transparent 22%),
        rgba(17, 24, 32, 0.88);
    box-shadow:
        0 0 0 14px rgba(245, 158, 1, 0.04),
        0 0 90px rgba(245, 158, 1, 0.34);
}

.agency-stage-core strong {
    color: var(--pm-color-paper);
    font-size: 42px;
    line-height: 1;
    text-shadow: 0 0 24px rgba(245, 158, 1, 0.56);
}

.agency-stage-layer {
    position: absolute;
    z-index: 4;
    width: min(250px, 36%);
    min-height: 90px;
    display: grid;
    align-content: center;
    gap: 6px;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-color-line-dark);
    background: rgba(10, 12, 15, 0.68);
    backdrop-filter: blur(14px);
    padding: 14px 16px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
    opacity: 0.46;
    transform: scale(0.95);
    transition: opacity 0.28s ease, transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.agency-stage-layer.is-active {
    opacity: 1;
    transform: translateY(-6px) scale(1.06);
    border-color: rgba(245, 158, 1, 0.58);
    box-shadow: 0 26px 72px rgba(245, 158, 1, 0.16);
}

.agency-stage-layer span {
    color: var(--pm-color-orange);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.agency-stage-layer strong {
    color: var(--pm-color-paper);
    font-size: 16px;
    line-height: 1.25;
}

.layer-regional {
    left: 8%;
    top: 12%;
}

.layer-web {
    right: 6%;
    top: 18%;
}

.layer-media {
    left: 2%;
    top: 46%;
}

.layer-ai {
    right: 4%;
    bottom: 20%;
    border-color: rgba(114, 216, 255, 0.28);
}

.layer-care {
    left: 30%;
    bottom: 4%;
}

.agency-stage-axis {
    position: absolute;
    left: 50%;
    top: 12%;
    bottom: 10%;
    z-index: 1;
    width: 2px;
    transform: translateX(-50%) scaleY(0.9);
    background: linear-gradient(180deg, transparent, rgba(245, 158, 1, 0.72), rgba(114, 216, 255, 0.5), transparent);
}

.agency-stage-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 0;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(245, 158, 1, 0.18), transparent 58%);
    filter: blur(4px);
}

.agency-progress {
    position: relative;
    z-index: 1;
    width: min(100% - 40px, var(--pm-container-wide));
    margin: 18px auto 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.agency-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--pm-color-orange), var(--pm-color-cyan));
}

/* Steps: readable, visible cards by default - permanent no-JS/reduced-motion
   baseline, not just a loading state (same principle as mission-control). */
.agency-steps {
    position: relative;
    z-index: 1;
    width: min(100% - 40px, var(--pm-container-wide));
    margin: clamp(32px, 5vw, 56px) auto 0;
    padding-inline: clamp(22px, 4.4vw, 64px);
    display: grid;
    gap: 16px;
}

.agency-step {
    padding: 22px 24px;
    border-radius: var(--pm-radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(10, 12, 15, 0.72);
    color: rgba(255, 253, 248, 0.74);
}

.agency-step.is-active {
    border-color: rgba(245, 158, 1, 0.5);
}

.agency-step-index {
    display: block;
    color: var(--pm-color-orange);
    font-weight: 900;
}

.agency-step h3 {
    margin: 6px 0 10px;
    color: var(--pm-color-paper);
    font-size: 22px;
}

.agency-step p {
    margin: 0;
    color: rgba(255, 253, 248, 0.82);
}

@media (max-width: 900px) {
    .agency-layout {
        grid-template-columns: 1fr;
    }

    .agency-stage {
        min-height: 420px;
    }

    .agency-stage-layer {
        position: static;
        width: 100%;
        transform: none;
        opacity: 1;
        margin-bottom: 10px;
    }

    .agency-stage-layer.is-active {
        transform: none;
    }

    .agency-stage::before,
    .agency-stage::after,
    .agency-stage-core,
    .agency-stage-axis,
    .agency-stage-pulse {
        display: none;
    }

    .agency-progress {
        display: none;
    }
}

/*
 * Progressive enhancement: agency-stack.js only adds this class once
 * GSAP/ScrollTrigger loaded successfully, the visitor has not requested
 * reduced motion, and the viewport is wide enough (>900px, same threshold
 * as mission-control - mobile always keeps the plain readable step list
 * above, no sticky/pin behaviour).
 */
.agency-stack.is-enhanced {
    min-height: 500vh;
}

.agency-stack.is-enhanced .agency-sticky {
    position: sticky;
    top: 70px;
    min-height: calc(100svh - 70px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.agency-stack.is-enhanced .agency-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    margin: 0;
}

.agency-stack.is-enhanced .agency-steps {
    margin: -100svh auto 0;
    padding-top: 100svh;
    pointer-events: none;
}

.agency-stack.is-enhanced .agency-step {
    min-height: 82vh;
    width: min(390px, 100%);
    margin-left: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-color: transparent;
    background: transparent;
    color: transparent;
    opacity: 0;
}
