.search-ad-stages-section {
    background: var(--bg-surface-gradient);
    padding-top: 6rem;
    padding-bottom: 6rem;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .search-ad-stages-section {
        padding-top: 7.5rem;
        padding-bottom: 7.5rem;
    }
}

.stages-container {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.stages-header-block {
    text-align: center;
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 3rem;
}

.stages-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid var(--hairline);
    box-shadow: 0 1px 3px rgba(32, 33, 36, 0.04);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink);
    margin-bottom: 1.25rem;
}

.stages-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 4.5vw, 3.25rem);
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.stages-title .gold-accent {
    color: #fbbc05;
    background: linear-gradient(135deg, #fbbc05 0%, #ea8600 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stages-subhead {
    color: var(--soft);
    font-size: clamp(15px, 1.8vw, 17.5px);
    line-height: 1.6;
    margin-top: 1rem;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

/* --- Interactive Stage Step Progress Navigation Bar --- */
.stages-step-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2.75rem;
}

.stage-step-btn {
    appearance: none;
    background: #ffffff;
    border: 1px solid var(--hairline);
    color: var(--soft);
    padding: 8px 16px;
    border-radius: 9999px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 240ms cubic-bezier(0.2, 0, 0, 1);
    box-shadow: 0 1px 3px rgba(32, 33, 36, 0.03);
}

.stage-step-btn:hover {
    color: var(--ink);
    border-color: rgba(32, 33, 36, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32, 33, 36, 0.06);
}

.stage-step-btn.active {
    background: var(--ink);
    color: #ffffff;
    border-color: var(--ink);
    box-shadow: 0 4px 14px rgba(32, 33, 36, 0.18);
}

.stage-step-btn .step-num-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: #fbbc05;
}

.stage-step-btn.active .step-num-pill {
    color: #fbbc05;
}

/* --- 6 STAGES GRID --- */
.stages-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    position: relative;
}

@media (min-width: 640px) {
    .stages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stages-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Individual Stage Card */
.stage-card {
    background-color: #ffffff;
    border: 1px solid var(--hairline);
    border-radius: 1.5rem;
    padding: 1.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 320ms cubic-bezier(0.2, 0, 0, 1), box-shadow 320ms cubic-bezier(0.2, 0, 0, 1), border-color 320ms ease, background-color 320ms ease;
    box-shadow: 0 2px 8px rgba(32, 33, 36, 0.03);
}

.stage-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: var(--stage-accent, #4285f4);
    opacity: 0;
    transition: opacity 300ms ease;
}

.stage-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 48px -12px rgba(32, 33, 36, 0.12), 0 0 0 1px var(--stage-accent-border, rgba(66, 133, 244, 0.3));
    border-color: var(--stage-accent-border, rgba(66, 133, 244, 0.4));
}

.stage-card:hover::before {
    opacity: 1;
}

.stage-card.highlight-stage {
    border-color: #fbbc05 !important;
    box-shadow: 0 0 0 2px #fbbc05, 0 20px 40px rgba(251, 188, 5, 0.15) !important;
    transform: translateY(-6px) scale(1.02);
}

/* Card Top Header */
.stage-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.35rem;
}

.stage-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--stage-tint, #e8f0fe);
    border: 1px solid var(--stage-tint-border, rgba(66, 133, 244, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--stage-accent, #4285f4);
    flex-shrink: 0;
    transition: transform 300ms cubic-bezier(0.2, 0, 0, 1), box-shadow 300ms ease;
    box-shadow: 0 2px 6px rgba(32, 33, 36, 0.04);
}

.stage-card:hover .stage-icon-box {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: 0 6px 18px -3px var(--stage-glow, rgba(66, 133, 244, 0.25));
}

.stage-card-num-badge {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--stage-accent, #4285f4);
    background: var(--stage-tint, #e8f0fe);
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid var(--stage-tint-border, rgba(66, 133, 244, 0.2));
}

.stage-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.stage-desc {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--soft);
    margin-bottom: 1.5rem;
}

/* Card Bottom Micro-Widget */
.stage-preview-pill {
    margin-top: auto;
    padding: 9px 13px;
    border-radius: 12px;
    background: #f8f9fb;
    border: 1px solid var(--hairline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background-color 240ms ease, border-color 240ms ease;
}

.stage-card:hover .stage-preview-pill {
    background: #ffffff;
    border-color: var(--stage-tint-border, rgba(66, 133, 244, 0.3));
}

.stage-pill-text {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stage-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--stage-accent, #4285f4);
}

.stage-pill-metric {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    color: var(--stage-accent, #4285f4);
    background: var(--stage-tint, #e8f0fe);
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Connector bridge between horizontal stages on desktop */
@media (min-width: 1024px) {
    .stage-card.has-connector-right::after {
        content: '→';
        position: absolute;
        right: -1.15rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1.6rem;
        height: 1.6rem;
        border-radius: 50%;
        background: #ffffff;
        border: 1px solid var(--hairline);
        box-shadow: 0 2px 6px rgba(32, 33, 36, 0.08);
        color: var(--soft);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 700;
        z-index: 2;
        pointer-events: none;
    }
}

/* Stage Theme Colors */
.stage-theme-blue {
    --stage-accent: #4285f4;
    --stage-tint: #e8f0fe;
    --stage-tint-border: rgba(66, 133, 244, 0.22);
    --stage-glow: rgba(66, 133, 244, 0.28);
    --stage-accent-border: rgba(66, 133, 244, 0.35);
}

.stage-theme-red {
    --stage-accent: #ea4335;
    --stage-tint: #fce8e6;
    --stage-tint-border: rgba(234, 67, 53, 0.22);
    --stage-glow: rgba(234, 67, 53, 0.28);
    --stage-accent-border: rgba(234, 67, 53, 0.35);
}

.stage-theme-yellow {
    --stage-accent: #fbbc05;
    --stage-tint: #fef7e0;
    --stage-tint-border: rgba(251, 188, 5, 0.3);
    --stage-glow: rgba(251, 188, 5, 0.3);
    --stage-accent-border: rgba(251, 188, 5, 0.45);
}

.stage-theme-green {
    --stage-accent: #34a853;
    --stage-tint: #e6f4ea;
    --stage-tint-border: rgba(52, 168, 83, 0.22);
    --stage-glow: rgba(52, 168, 83, 0.28);
    --stage-accent-border: rgba(52, 168, 83, 0.35);
}

/* --- Bottom Pipeline Flow Strip --- */
.stages-pipeline-bar {
    margin-top: 2.75rem;
    background: #ffffff;
    border: 1px solid var(--hairline);
    border-radius: 1.25rem;
    padding: 1.15rem 1.5rem;
    box-shadow: 0 2px 8px rgba(32, 33, 36, 0.03);
}

.stages-pipeline-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.pipeline-step-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8f9fb;
    border: 1px solid var(--hairline);
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 12.5px;
}

.pipeline-arrow {
    color: #4285f4;
    font-weight: 700;
}

@media (max-width: 767px) {
    .search-ad-stages-section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    .stages-header-block {
        margin-bottom: 1.75rem;
    }

    .stages-step-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        gap: 6px;
        margin-bottom: 1.5rem;
        padding-bottom: 4px;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .stages-step-nav::-webkit-scrollbar {
        display: none;
    }

    .stage-step-btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 11.5px;
    }

    .stages-grid {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 0.85rem !important;
        padding-bottom: 0.85rem !important;
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .stages-grid::-webkit-scrollbar {
        display: none !important;
    }

    .stage-card {
        flex: 0 0 84vw !important;
        max-width: 84vw !important;
        scroll-snap-align: center !important;
        scroll-snap-stop: always !important;
        padding: 1.25rem 1.15rem;
        border-radius: 1.25rem;
    }

    .stages-pipeline-bar {
        padding: 0.85rem;
        margin-top: 2rem;
    }

    .pipeline-step-item {
        padding: 4px 10px;
        font-size: 11px;
    }
}

/* Card hover hint badge */
.stage-card-hover-hint {
    margin-top: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--stage-accent, #4285f4);
    opacity: 0.85;
    transition: opacity 180ms ease, transform 180ms ease;
}

.stage-card {
    cursor: pointer;
}

.stage-card:hover .stage-card-hover-hint {
    opacity: 1;
    transform: translateX(2px);
}

.stage-card:hover {
    transform: scale(1.04) translateY(-6px) !important;
    z-index: 40 !important;
    border-color: transparent !important;
    animation: google-multicolor-glow 2.5s linear infinite !important;
    box-shadow: 0 25px 60px -12px rgba(66, 133, 244, 0.32), 0 0 0 2px rgba(66, 133, 244, 0.45) !important;
}

/* ==========================================================================
   STAGE DEEP-DIVE MODAL & EXPANDED CARD EFFECTS
   ========================================================================== */

/* Modal Overlay */
.stage-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1), visibility 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.stage-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.stage-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 21, 24, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

/* Modal Card with Google Glow */
.stage-modal-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 660px;
    max-height: calc(100vh - 3.5rem);
    background: #ffffff;
    border-radius: 28px;
    padding: 2.25rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: scale(0.92) translateY(24px);
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    animation: google-modal-glow 2.8s linear infinite;
}

.stage-modal-overlay.is-active .stage-modal-card {
    transform: scale(1) translateY(0);
}

.stage-modal-scrollable {
    overflow-y: auto;
    max-height: 100%;
    padding-right: 0.25rem;
}

.stage-modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f3f4;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    cursor: pointer;
    z-index: 20;
    transition: background-color 180ms ease, transform 150ms ease;
}

.stage-modal-close-btn:hover {
    background: #e8eaed;
    transform: rotate(90deg);
}

.stage-modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-right: 2.5rem;
}

.stage-modal-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.4rem, 3.2vw, 1.85rem);
    color: var(--ink);
    line-height: 1.22;
    letter-spacing: -0.02em;
    margin: 0;
}

.stage-modal-overview {
    font-size: 15px;
    line-height: 1.62;
    color: var(--soft);
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
}

.stage-modal-section-heading {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--soft);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-modal-section-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

/* Strategic Pillars List in Modal */
.stage-modal-pillars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stage-pillar-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: #f8f9fb;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    transition: background-color 200ms ease;
}

.stage-pillar-card:hover {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(32, 33, 36, 0.04);
}

.stage-pillar-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e6f4ea;
    color: #137333;
    font-size: 11.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.stage-pillar-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--ink);
    margin-bottom: 2px;
}

.stage-pillar-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--soft);
}

/* Metrics Grid in Modal */
.stage-modal-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.stage-modal-metric-box {
    background: var(--stage-tint, #e8f0fe);
    border: 1px solid var(--stage-tint-border, rgba(66, 133, 244, 0.2));
    border-radius: 14px;
    padding: 0.85rem 0.75rem;
    text-align: center;
}

.stage-modal-metric-val {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--stage-accent, #1a73e8);
    margin-bottom: 2px;
}

.stage-modal-metric-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modal Actions Footer */
.stage-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hairline);
    margin-top: auto;
}

.stage-modal-dismiss-btn {
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--soft);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 180ms ease;
}

.stage-modal-dismiss-btn:hover {
    background: #f1f3f4;
    color: var(--ink);
}

.stage-modal-cta-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    background: var(--ink);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(32, 33, 36, 0.15);
    transition: all 200ms ease;
}

.stage-modal-cta-btn:hover {
    background: #fbbc05;
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 188, 5, 0.3);
}

@media (max-width: 640px) {
    .stage-modal-card {
        padding: 1.5rem 1.25rem;
        border-radius: 22px;
    }
    .stage-modal-metrics {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .stage-modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    .stage-modal-dismiss-btn,
    .stage-modal-cta-btn {
        width: 100%;
        justify-content: center;
    }
}
