/* LAION-fMRI homepage hero - full-viewport landing.
 *
 * The element is lifted out of the Sphinx article column at runtime and
 * inserted as document.body's first child. CSS here assumes that final
 * placement; before the lift the noscript fallback inside #lf-hero-root
 * is what renders. */

.lf-hero {
    position: relative;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
    color: var(--rv-fg);
    font-family: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    background:
        radial-gradient(
            120% 80% at 78% 28%,
            color-mix(in oklab, var(--rv-cyan) 18%, transparent) 0%,
            transparent 60%
        ),
        radial-gradient(
            100% 80% at 8% 100%,
            color-mix(in oklab, var(--rv-coral) 10%, transparent) 0%,
            transparent 55%
        ),
        var(--rv-bg);
    z-index: 1;
}

.lf-hero__inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 0 6vw;
}

.lf-hero__text {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 30rem;
    width: 38%;
    flex-shrink: 0;
}

.lf-hero__logo {
    height: 56px;
    width: auto;
    align-self: center;
    opacity: 0.95;
}

.lf-hero__title {
    font-size: clamp(2rem, 3.4vw, 3.4rem);
    font-weight: 700;
    line-height: 1.08;
    margin: 0.2rem 0 0;
    color: var(--rv-fg);
    letter-spacing: -0.015em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.lf-hero__title em {
    font-style: normal;
    color: var(--rv-cyan);
}

.lf-hero__lede {
    font-size: clamp(1rem, 1.05vw, 1.15rem);
    line-height: 1.55;
    color: var(--rv-fg-dim);
    margin: 0;
}

.lf-hero__ctas {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.lf-hero__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.78rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.98rem;
    text-decoration: none !important;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1;
}

.lf-hero__btn--primary {
    background: var(--rv-cyan);
    color: var(--rv-bg) !important;
    border-color: var(--rv-cyan);
}

.lf-hero__btn--primary:hover {
    transform: translateY(-1px);
    background: color-mix(in oklab, var(--rv-cyan) 88%, white);
}

.lf-hero__btn--ghost {
    background: transparent;
    color: var(--rv-fg) !important;
    border-color: var(--rv-slate);
}

.lf-hero__btn--ghost:hover {
    border-color: var(--rv-cyan-dim);
    color: var(--rv-cyan) !important;
}

.lf-hero__btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.lf-hero__meta {
    display: flex;
    gap: 1.4rem;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--rv-fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-wrap: wrap;
}

.lf-hero__meta span::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--rv-cyan);
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Canvas spans the full hero - the brain is shifted right in world space.
 * A left-side gradient overlay fades it behind the text column so there's
 * no hard seam between the two. */
.lf-hero__canvas-wrap {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.lf-hero__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.lf-hero__canvas-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background: linear-gradient(
        to right,
        var(--rv-bg) 0%,
        var(--rv-bg) 22%,
        transparent 58%,
        transparent 100%
    );
}

.lf-hero__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rv-fg-muted);
    font-size: 0.85rem;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 5;
}

.lf-hero.is-ready .lf-hero__loading {
    opacity: 0;
}

.lf-hero__scroll-hint {
    position: absolute;
    bottom: 1.6rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--rv-fg-muted);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 6;
}

.lf-hero__scroll-hint:hover {
    color: var(--rv-cyan);
}

.lf-hero__scroll-hint svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    animation: lf-hero-bob 2.2s ease-in-out infinite;
}

@keyframes lf-hero-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(5px); }
}

/* Top-edge fade so docs content peeking under the hero (when scrolling)
 * doesn't make a hard seam. */
.lf-hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -40px;
    height: 80px;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent 0%, var(--rv-bg) 60%);
    z-index: 7;
}

/* ── Stacked (phone + tablet portrait) ──────────────────────────────────
 *
 * Triggered for any narrow viewport OR portrait orientation, so iPads
 * in portrait (768×1024) stack the brain above the text the same way a
 * phone does, instead of spilling into the cramped desktop split. */

@media (max-width: 820px), (orientation: portrait) {
    .lf-hero {
        --lf-hero-brain-area: clamp(17rem, 46dvh, 38rem);
    }
    .lf-hero__inner {
        display: grid;
        grid-template-rows: var(--lf-hero-brain-area) minmax(0, 1fr);
        align-items: stretch;
        padding: 0;
    }
    /* Mobile uses two stable viewport zones: brain above, text below. */
    .lf-hero__canvas-wrap {
        grid-row: 1;
        position: relative;
        inset: auto;
        width: 100%;
        height: 100%;
        min-height: 0;
    }
    .lf-hero__canvas-wrap::before {
        background: none;
    }
    .lf-hero__canvas {
        -webkit-mask-image: linear-gradient(
            to bottom,
            black 0%,
            black 70%,
            transparent 100%
        );
        mask-image: linear-gradient(
            to bottom,
            black 0%,
            black 70%,
            transparent 100%
        );
    }
    .lf-hero__text {
        grid-row: 2;
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        width: auto;
        max-width: none;
        min-height: 0;
        padding: 0.45rem 6vw 2.4rem;
        gap: clamp(0.45rem, 1.2vh, 0.75rem);
        z-index: 5;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
    }
    .lf-hero__logo { height: 38px; align-self: center; }
    .lf-hero__title {
        font-size: clamp(1.5rem, 6.6vw, 2.05rem);
        line-height: 1.06;
    }
    .lf-hero__lede  {
        font-size: 0.9rem;
        line-height: 1.42;
    }
    .lf-hero__ctas  { justify-content: center; }
    .lf-hero__meta  { font-size: 0.7rem; gap: 1rem; justify-content: center; }
    .lf-hero__scroll-hint { bottom: 0.8rem; }
    .lf-hero__scroll-hint span { display: none; }
}

/* Very short phones need the text stack to compress too; otherwise the
 * measured brain band would be forced into a sliver above the logo. */
@media (max-width: 820px) and (max-height: 760px) {
    .lf-hero__text {
        padding: 0.35rem 6vw 1.7rem;
        gap: 0.55rem;
    }
    .lf-hero__logo { height: 32px; }
    .lf-hero__title {
        font-size: clamp(1.35rem, 6.1vw, 1.65rem);
        line-height: 1.05;
    }
    .lf-hero__lede {
        font-size: 0.8rem;
        line-height: 1.35;
        max-width: 21rem;
    }
    .lf-hero__ctas {
        margin-top: 0.1rem;
        gap: 0.5rem;
    }
    .lf-hero__btn {
        padding: 0.62rem 0.92rem;
        font-size: 0.86rem;
    }
    .lf-hero__meta,
    .lf-hero__scroll-hint {
        display: none;
    }
}

@media (max-width: 380px) and (max-height: 620px) {
    .lf-hero__text {
        padding-bottom: 1.5rem;
    }
    .lf-hero__lede {
        display: none;
    }
}

/* ── Tablet portrait (iPad-sized) ──────────────────────────────────────
 *
 * Stacked layout from above, but with type and breathing room scaled up
 * so a 768-wide viewport doesn't read as a stretched phone. Constrain
 * the text column width so lines don't span the full canvas. */

@media (orientation: portrait) and (min-width: 600px) {
    .lf-hero {
        --lf-hero-brain-area: clamp(25rem, 46dvh, 40rem);
    }
    .lf-hero__logo  { height: 56px; }
    .lf-hero__title { font-size: clamp(2rem, 4.6vw, 2.9rem); }
    .lf-hero__lede  { font-size: 1.05rem; line-height: 1.5; }
    .lf-hero__text {
        justify-self: center;
        padding: 0.7rem 8vw 3.2rem;
        gap: 0.85rem;
        max-width: 620px;
        margin: 0 auto;
        left: auto;
        right: auto;
        transform: none;
        width: 90%;
    }
    .lf-hero__meta  { font-size: 0.78rem; gap: 1.4rem; }
    .lf-hero__btn   { font-size: 1rem; padding: 0.85rem 1.3rem; }
    .lf-hero__scroll-hint span { display: inline; }
    /* Slightly more aggressive bottom mask: more sky between brain and text */
    .lf-hero__canvas {
        -webkit-mask-image: linear-gradient(
            to bottom, black 0%, black 60%, transparent 100%
        );
        mask-image: linear-gradient(
            to bottom, black 0%, black 60%, transparent 100%
        );
    }
}

@media (prefers-reduced-motion: reduce) {
    .lf-hero__scroll-hint svg { animation: none; }
}
