/* ==========================================================================
   Homepage — The Idea Behind Nebulight (.ib). The meaning of the name on a
   field of brand light, between the night of the hero and the pale
   Services section. On wide screens the headline runs as one line and the
   two paragraphs sit side by side beneath it, so the section stays short.
   The letters of "scattered" come together as it scrolls in (idea.js); the
   eyebrow, paragraphs and CTA rise in with the shared motion layer
   (motion.js). Without either, everything is simply shown.
   ========================================================================== */

.ib {
    /* The field settles to this colour along its lower edge; Services'
       rising corners are painted in it (motion.js). */
    --ib-base: #5524b4;
    /* Landing here (the hero's Explore button) leaves the eyebrow clear of
       the fixed navigation. */
    scroll-margin-top: 3.25rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: clamp(4.5rem, 8vw, 7rem) 0 clamp(4.5rem, 7.5vw, 6.5rem);
    /* Solid brand purple, deepening slightly toward the lower edge. */
    background: linear-gradient(180deg, #7c3aed 0%, #7c3aed 50%, var(--ib-base) 100%);
    color: #fff;
    font-family: "Manrope", sans-serif;
}

/* The field stays solid purple: the blooms are retired. */
.ib-field {
    display: none;
    position: absolute;
    inset: -12% -8% 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(34rem 24rem at 8% 6%, rgba(244, 114, 182, 0.42), transparent 62%),
        radial-gradient(38rem 26rem at 92% 48%, rgba(14, 165, 233, 0.38), transparent 64%),
        radial-gradient(30rem 20rem at 55% 30%, rgba(167, 139, 250, 0.3), transparent 66%);
    animation: ib-drift 26s ease-in-out infinite alternate;
}

.ib::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    height: 22%;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(85, 36, 180, 0), var(--ib-base));
}

@keyframes ib-drift {
    from { transform: translate3d(-2%, 0, 0) scale(1); }
    to { transform: translate3d(3%, 4%, 0) scale(1.06); }
}

.ib-shell {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.4vw, 2rem);
    max-width: var(--hx-max);
    margin: 0 auto;
    padding: 0 var(--hx-gutter);
}

.ib-label {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.86);
}

.ib-title {
    grid-column: 1 / -1;
    margin: clamp(1.25rem, 2.6vw, 2rem) 0 0;
    font-size: clamp(2.75rem, 13vw, 5.5rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.ib-line {
    display: inline;
}

/* The period: the one warm note in the white headline. */
.ib-dot {
    color: #fbcfe8;
}

.ib-body {
    grid-column: 1 / -1;
    display: grid;
    gap: 1.5rem;
    margin-top: clamp(2.25rem, 4.5vw, 3.5rem);
    padding-top: clamp(1.75rem, 3vw, 2.5rem);
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.ib-lede,
.ib-copy {
    margin: 0;
    max-width: 36rem;
}

.ib-lede {
    font-size: clamp(1.15rem, 1.5vw, 1.4rem);
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
}

.ib-copy {
    font-size: 1.02rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.9);
}

/* The CTA: a solid white button (6px corners, as every button on the
   site), the arrow lifting toward where it points and a light sweep across
   it on hover. */
.ib-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0 1.4rem;
    overflow: hidden;
    border-radius: 0.375rem;
    background: #fff;
    color: #2e1065;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: 0 18px 40px -22px rgba(30, 10, 80, 0.8);
    transition: scale 0.45s var(--hx-ease), box-shadow 0.45s var(--hx-ease);
}

.ib-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(124, 58, 237, 0.16) 50%, transparent 70%);
    transform: translateX(-110%);
    transition: transform 0.8s var(--hx-ease);
}

.ib-cta-text,
.ib-cta-arrow {
    position: relative;
}

/* An SVG arrow, not the ↗ character: phones draw that character as an
   emoji. */
.ib-cta-arrow {
    display: inline-block;
    width: 1.05rem;
    height: 1.05rem;
    color: #7c3aed;
    transition: transform 0.5s var(--hx-ease);
}

.ib-cta-arrow svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ib-cta:hover {
    scale: 1.03;
    box-shadow: 0 22px 46px -22px rgba(30, 10, 80, 0.9);
}

.ib-cta:hover::before {
    transform: translateX(110%);
}

.ib-cta:hover .ib-cta-arrow,
.ib-cta:focus-visible .ib-cta-arrow {
    transform: translate3d(2px, -2px, 0);
}

.ib-cta:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---------- Wider screens: one line, then the copy side by side ---------- */

@media (min-width: 900px) {
    /* The headline ("Beauty in what’s scattered.", about 12.3em wide) is
       sized to the content width, so it always holds one line. */
    .ib-title {
        font-size: calc((min(100vw, var(--hx-max)) - 2 * min(4.2vw, 3.5rem)) / 12.9);
        white-space: nowrap;
    }

    .ib-body {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: clamp(1rem, 2.4vw, 2rem);
        row-gap: 0;
        align-items: start;
    }

    .ib-lede {
        grid-column: 1 / span 6;
        grid-row: 1 / span 2;
        padding-right: clamp(0rem, 2vw, 2rem);
    }

    .ib-copy {
        grid-column: 7 / -1;
    }

    .ib-cta {
        grid-column: 7 / -1;
        margin-top: 1.75rem;
    }
}

@media (min-width: 1200px) {
    .ib-lede {
        grid-column: 1 / span 5;
    }
}

/* ---------- Arriving ----------
   idea.js arms the headline (its first words rise; the letters of
   "scattered" follow the scroll). The rest uses motion.js's fades. */

.ib.is-armed .ib-line:first-child {
    display: inline-block;
    opacity: 0;
    transform: translate3d(0, 0.35em, 0);
    transition: opacity 1s var(--hx-ease), transform 1.2s var(--hx-ease);
}

.ib.is-armed.is-in .ib-line:first-child {
    opacity: 1;
    transform: none;
}

.ib-ch {
    display: inline-block;
    will-change: transform, opacity;
}

.mx-on .ib .mx-fade {
    transform: translate3d(0, 14px, 0);
    transition:
        opacity 1s var(--hx-ease) calc(var(--mx-d, 0ms) + var(--ib-d, 0ms)),
        transform 1.2s var(--hx-ease) calc(var(--mx-d, 0ms) + var(--ib-d, 0ms));
}

.mx-on .ib .mx-fade.mx-in {
    transform: none;
}

.mx-on .ib-label.mx-fade {
    transform: translate3d(0, 8px, 0);
    transition-duration: 0.7s, 0.8s;
}

.ib-lede { --ib-d: 120ms; }
.ib-copy { --ib-d: 260ms; }
.ib-cta { --ib-d: 420ms; }

@media (prefers-reduced-motion: reduce) {
    .ib-field {
        animation: none;
    }

    .ib-cta,
    .ib-cta::before,
    .ib-cta-arrow {
        transition: none;
    }
}
