/**
 * Homepage-specific performance and polish
 */

/* ── Unified intro band (hero + services header) ── */
.home-intro-band {
    position: relative;
    background: var(--color-bg-base);
    overflow: hidden;
    /* Extend grid backdrop behind the fixed nav padding zone */
    margin-top: calc(-1 * var(--site-nav-pill-offset, 6.75rem));
    padding-top: var(--site-nav-pill-offset, 6.75rem);
}

@media (max-width: 991.98px) {
    .home-intro-band {
        margin-top: calc(-1 * var(--site-nav-pill-offset-mobile, 6.25rem));
        padding-top: var(--site-nav-pill-offset-mobile, 6.25rem);
    }
}

.home-intro-band__backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.home-intro-band__backdrop .hero-signal-grid,
.home-intro-band__backdrop .hero-ambient {
    position: absolute;
    inset: 0;
}

.home-intro-band .hero-section--saas {
    position: relative;
    z-index: 1;
    background: transparent;
}

.home-intro-band .hero-signal-grid {
    opacity: 0.48;
}

.home-intro-band .hero-ambient::after {
    height: 100%;
    opacity: 0.7;
    background:
        radial-gradient(ellipse 80% 60% at 25% 35%, rgba(46, 107, 255, 0.14), transparent 68%),
        radial-gradient(ellipse 75% 55% at 85% 80%, rgba(108, 77, 255, 0.18), transparent 72%);
}

.hero-ambient__arc {
    position: absolute;
    right: -6%;
    bottom: -8%;
    width: min(78vw, 46rem);
    height: 18rem;
    border-radius: 50%;
    background: linear-gradient(
        118deg,
        rgba(108, 77, 255, 0.28) 0%,
        rgba(46, 107, 255, 0.18) 42%,
        rgba(37, 184, 245, 0.14) 100%
    );
    filter: blur(48px);
    opacity: 0.9;
    transform: rotate(-6deg);
}

#home-services.home-services-section {
    background: var(--color-bg-base);
    padding-top: clamp(2rem, 3.5vw, 3rem);
    padding-bottom: var(--space-8);
}

/* ── Hero copy — no scroll ghosting ── */
.hero-section--saas .hero-saas__copy,
.hero-section--saas .hero-saas__visual {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    min-height: 0;
}

.hero-section--saas .hero-saas__copy-inner,
.hero-section--saas .hero-saas__title,
.hero-section--saas .hero-saas__status,
.hero-section--saas .hero-saas__eyebrow,
.hero-section--saas .hero-saas__lead {
    transform: none !important;
    transition: none !important;
}

/* ── Hero layout shell (full-width container-fluid) ── */
.hero-section--saas > .container-fluid {
    max-width: none;
}

.hero-section--saas .hero-saas {
    display: flex;
    flex-direction: column;
    gap: clamp(1.15rem, 2vw, 1.5rem);
}

.hero-saas__main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.25rem, 2.5vw, 1.75rem);
    align-items: start;
}

/* Gradient accent headline lines */
.hero-section--saas .hero-saas__title .hero-saas__accent {
    position: relative;
    isolation: isolate;
    background: linear-gradient(120deg, #6c4dff 0%, #2e6bff 50%, #25b8f5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter:
        drop-shadow(0 0 12px rgba(108, 77, 255, 0.38))
        drop-shadow(0 0 22px rgba(37, 184, 245, 0.28));
}

/* ── Hero section rhythm ── */
.hero-section--saas.section-space {
    padding-top: clamp(1.5rem, 2.5vw, 2.5rem);
    padding-bottom: clamp(1.5rem, 2.5vw, 2rem);
}

.hero-section--saas .hero-saas__meta {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.hero-section--saas .hero-saas__status {
    margin: 0;
}

.hero-section--saas .hero-saas__eyebrow {
    margin: 0;
    color: var(--color-accent-primary-edge);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
}

.hero-section--saas .hero-saas__title {
    margin-bottom: 1rem;
}

.hero-section--saas .hero-saas__lead {
    margin-bottom: 1.25rem;
}

.hero-section--saas .hero-saas__actions {
    margin-bottom: 0;
}

.hero-section--saas .hero-saas__stats {
    margin-top: 0;
    margin-bottom: 0;
}

.hero-section--saas .hero-saas__trust {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* ── Ambient background ── */
.hero-ambient {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-ambient::after {
    content: "";
    position: absolute;
    left: -5%;
    right: -5%;
    bottom: 0;
    height: 55%;
    background:
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(46, 107, 255, 0.18), transparent 72%),
        linear-gradient(90deg, transparent 0%, rgba(108, 77, 255, 0.08) 35%, rgba(37, 184, 245, 0.12) 65%, transparent 100%);
    opacity: 0.75;
}

.hero-ambient__dot {
    position: absolute;
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 50%;
    background: rgba(234, 241, 248, 0.55);
    box-shadow: 0 0 8px rgba(57, 198, 244, 0.3);
}

.hero-ambient__dot--1 { top: 16%; left: 6%; }
.hero-ambient__dot--2 { top: 38%; left: 18%; opacity: 0.65; }
.hero-ambient__dot--3 { top: 24%; right: 14%; background: rgba(108, 77, 255, 0.65); }
.hero-ambient__dot--4 { bottom: 28%; right: 28%; opacity: 0.5; }
.hero-ambient__dot--5 { top: 52%; left: 42%; opacity: 0.35; }
.hero-ambient__dot--6 { bottom: 38%; left: 58%; opacity: 0.4; }

.hero-ambient__streak {
    position: absolute;
    width: min(58vw, 32rem);
    height: auto;
    opacity: 0.6;
}

.hero-ambient__streak--a {
    top: 10%;
    right: -6%;
}

.hero-ambient__streak--b {
    bottom: 6%;
    left: 32%;
    width: min(48vw, 26rem);
    opacity: 0.45;
}

/* ── Left column ── */
.hero-saas__copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-saas__copy-rail {
    position: relative;
    width: 100%;
    max-width: 32rem;
    padding-left: 0;
}

.hero-saas__copy-rail::before,
.hero-saas__copy-rail::after {
    content: none;
}

.hero-saas__copy-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-section--saas .hero-saas__status {
    align-self: center;
    padding: 0.32rem 0.7rem;
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    border-color: rgba(57, 198, 244, 0.45);
    background: rgba(46, 107, 255, 0.1);
    box-shadow: 0 0 14px rgba(57, 198, 244, 0.1);
}

.hero-section--saas .hero-saas__title {
    font-size: clamp(1.95rem, 3.65vw, 3rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.hero-section--saas .hero-saas__title-line {
    display: block;
}

.hero-section--saas .hero-saas__title-line + .hero-saas__title-line {
    margin-top: 0.08em;
}

.hero-saas__lead {
    max-width: 30rem;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--color-text-secondary);
}

.hero-saas__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.hero-section--saas .hero-saas__actions .btn {
    padding: 0.78rem 1.2rem;
    font-size: 0.875rem;
    border-radius: 0.65rem;
}

.hero-saas__btn-primary {
    background: linear-gradient(118deg, #6c4dff 0%, #4a5bff 45%, #25b8f5 100%) !important;
    border-color: rgba(57, 198, 244, 0.5) !important;
    box-shadow:
        0 4px 24px rgba(108, 77, 255, 0.32),
        0 8px 32px rgba(46, 107, 255, 0.22) !important;
}

.hero-saas__btn-primary:hover {
    filter: brightness(1.05);
    border-color: var(--color-accent-primary-edge) !important;
    box-shadow: 0 6px 26px rgba(46, 107, 255, 0.32) !important;
}

.hero-section--saas .hero-saas__actions .btn-outline-brand {
    border-color: rgba(149, 170, 196, 0.35);
    background: rgba(6, 17, 27, 0.55);
    color: var(--color-text-primary);
    border-radius: 0.65rem;
}

/* ── Full-width stats row ── */
.hero-saas__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    width: 100%;
}

.hero-stat {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3.65rem;
    padding: 0.75rem 0.85rem 0.75rem 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(57, 198, 244, 0.18);
    background: rgba(10, 23, 36, 0.78);
    min-width: 0;
    overflow: hidden;
}

.hero-stat__body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.hero-stat__value {
    position: relative;
    z-index: 1;
    display: inline;
    font-family: var(--font-heading);
    font-size: clamp(1.05rem, 1.75vw, 1.2rem);
    font-weight: 500;
    color: var(--color-accent-primary-edge);
    line-height: 1.2;
}

.hero-stat__label {
    position: relative;
    z-index: 1;
    display: inline;
    margin-top: 0;
    font-size: var(--type-caption);
    color: var(--color-text-secondary);
    line-height: 1.35;
}

.hero-stat::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(149, 170, 196, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(149, 170, 196, 0.06) 1px, transparent 1px);
    background-size: 18px 18px;
    border-radius: inherit;
}

.hero-stat__icon {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    z-index: 2;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--color-accent-primary-edge);
}

.hero-stat__index {
    position: absolute;
    top: 0.45rem;
    right: 0.55rem;
    margin: 0;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    opacity: 0.85;
}

/* ── Full-width trust rail ── */
.hero-saas__trust {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.9rem;
    width: 100%;
    padding-top: 0;
}

.hero-saas__trust > span {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.hero-saas__trust ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hero-saas__trust li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    border: 1px solid var(--color-border-subtle);
    background: rgba(14, 27, 43, 0.65);
    font-size: 0.72rem;
    color: var(--color-text-secondary);
}

.hero-saas__trust li i {
    font-size: 0.72rem;
    color: var(--color-accent-primary-edge);
    opacity: 0.85;
}

/* ── Desktop composition ── */
@media (min-width: 992px) {
    .hero-saas__main {
        grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
        gap: clamp(1.35rem, 2.4vw, 2.25rem);
        align-items: stretch;
        min-height: 0;
        width: 100%;
    }

    .hero-section--saas .hero-saas__copy {
        align-items: flex-start;
        text-align: left;
        max-width: none;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 0;
    }

    .hero-saas__copy-rail {
        max-width: none;
        padding-left: 1.15rem;
    }

    .hero-saas__copy-rail::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0.15rem;
        bottom: 0;
        width: 2px;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(37, 184, 245, 0.15) 0%, #25b8f5 18%, #6c4dff 100%);
        box-shadow: 0 0 12px rgba(57, 198, 244, 0.28);
    }

    .hero-saas__copy-rail::after {
        content: "";
        position: absolute;
        left: -3px;
        top: 0;
        width: 0.5rem;
        height: 0.5rem;
        border-radius: 50%;
        background: var(--color-accent-primary-edge);
        box-shadow:
            0 0 10px rgba(57, 198, 244, 0.65),
            0 0 18px rgba(37, 184, 245, 0.35);
    }

    .hero-section--saas .hero-saas__copy-inner {
        align-items: flex-start;
        max-width: none;
        padding-top: 0.85rem;
    }

    .hero-section--saas .hero-saas__meta {
        align-items: flex-start;
    }

    .hero-section--saas .hero-saas__status {
        align-self: flex-start;
        margin-left: 0;
    }

    .hero-section--saas .hero-saas__lead {
        margin-left: 0;
        margin-right: 0;
        max-width: 34rem;
    }

    .hero-section--saas .hero-saas__actions {
        justify-content: flex-start;
    }

    .hero-section--saas .hero-saas__visual {
        min-height: 0;
        padding: 0;
        display: flex;
        align-items: stretch;
        justify-content: stretch;
        width: 100%;
    }

    .hero-section--saas .hero-convergence {
        width: 100%;
        max-width: none;
        align-self: stretch;
        height: 100%;
    }
}

/* ── Homepage service grid perf ── */
@media (min-width: 992px) {
    .home-service-grid > .col-lg-6:nth-child(n+3) * {
        animation: none !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .home-service-grid > .col-md-6:nth-child(n+5) * {
        animation: none !important;
    }
}

@media (max-width: 767.98px) {
    .home-service-grid > .col-md-6:nth-child(n+4) * {
        animation: none !important;
    }
}

.home-service-grid > [class*="col-"] {
    content-visibility: auto;
    contain-intrinsic-size: auto 24rem;
}

@media (max-width: 575.98px) {
    .hero-saas__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-stat:last-child {
        grid-column: 1 / -1;
    }

    .hero-ambient__streak {
        opacity: 0.3;
    }

    .principles-timeline__panel {
        padding: 1rem 0.85rem 1.1rem;
    }

    .principle-proof {
        height: 4.35rem;
    }

    .principles-timeline__item {
        grid-template-columns: 2.65rem minmax(0, 1fr);
        gap: 0.65rem;
    }

    .principles-timeline__rail {
        left: 1.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-ambient__dot,
    .hero-ambient__streak {
        opacity: 0.35 !important;
    }
}

/* ── Services → Principles rhythm ── */
section.home-principles.section-space {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
}

/* ── Principles → Selected work rhythm ── */

section.home-selected-work.section-space {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
}

.home-selected-work__grid {
    margin-top: var(--space-8);
}

section.home-how-we-work.section-space {
    padding-top: var(--space-8);
}
