/*
 * Scroll hero on /pl/ai/ and /en/ai/: the animated rail map gives way to the logo,
 * then to a sample AI conversation. Pure CSS scroll-driven animations, no JS.
 *
 * The section is 220svh tall and its stage sticks for the extra 120svh, so the
 * whole sequence plays within the first screen-and-a-bit of scrolling.
 * Without animation-timeline support (Firefox today) or with reduced motion the
 * section collapses to one screen showing the final state: logo + conversation.
 */

.ai-hero {
    --hero-bg: #08170f;
    --hero-green: #00bf63;
    --hero-text: #f2fbf5;
    --hero-muted: #a9c7b5;
    position: relative;
    height: 220svh;
    background: var(--hero-bg);
    color: var(--hero-text);
}

.ai-hero__stage {
    position: sticky;
    top: 0;
    height: 100svh;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 4.5rem 1rem 1.5rem;
    background:
        radial-gradient(60% 50% at 50% 55%, rgba(0, 191, 99, 0.22), transparent 70%),
        var(--hero-bg);
}

/* All layers share one grid cell and are centred on top of each other. */
.ai-hero__layer {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 640px;
    width: 100%;
}

/* Layer 1: the app */
.ai-hero__intro-title {
    font-weight: 700;
    font-size: clamp(1.5rem, 4.2vw, 2.6rem);
    line-height: 1.2;
    margin: 0 0 1.25rem;
}

.ai-hero__map {
    width: min(100%, calc(min(58svh, 560px) * 640 / 610));
    height: auto;
    aspect-ratio: 640 / 610;
}

.ai-hero__hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--hero-muted);
}

/* Layer 2: the logo */
.ai-hero__logo {
    width: clamp(240px, 52vw, 480px);
    height: auto;
    filter: drop-shadow(0 12px 40px rgba(0, 191, 99, 0.5));
}

.ai-hero__tagline {
    margin: 1.25rem 0 0;
    font-weight: 700;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    line-height: 1.2;
}

.ai-hero__tagline span { color: var(--hero-green); }

/* Layer 3: the conversation, under the logo */
.ai-hero__chat {
    margin-top: 1.75rem;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ai-hero__bubble {
    border-radius: 1.1rem;
    padding: 0.7rem 1rem;
    margin: 0;
}

.ai-hero__bubble--user {
    align-self: flex-end;
    max-width: 85%;
    background: var(--hero-green);
    color: #04140b;
    font-weight: 600;
    border-bottom-right-radius: 0.3rem;
}

.ai-hero__bubble--ai {
    align-self: flex-start;
    max-width: 92%;
    background: #15271d;
    border: 1px solid #24402f;
    color: var(--hero-text);
    border-bottom-left-radius: 0.3rem;
}

.ai-hero__bubble--ai small {
    display: block;
    margin-top: 0.35rem;
    color: var(--hero-muted);
}

.ai-hero__caption {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--hero-muted);
    text-align: center;
}

/* The page body that follows no longer sits right under the fixed navbar. */
.ai-hero + .page-wrap { padding-top: 2.5rem; }

/* Final state: the default, and what browsers without scroll timelines show. */
.ai-hero__layer--app { visibility: hidden; }

@supports not (animation-timeline: scroll()) {
    .ai-hero { height: auto; }
    .ai-hero__stage { position: relative; height: auto; min-height: 100svh; }
}

@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .ai-hero__layer--app { visibility: visible; }

        .ai-hero__layer--app,
        .ai-hero__logo,
        .ai-hero__tagline,
        .ai-hero__chat {
            animation-timing-function: linear;
            animation-fill-mode: both;
            animation-timeline: scroll(root);
        }

        .ai-hero__layer--app {
            animation-name: ai-hero-app-out;
            animation-range: 0 45svh;
        }

        .ai-hero__logo {
            animation-name: ai-hero-logo-in;
            animation-range: 15svh 65svh;
        }

        .ai-hero__tagline {
            animation-name: ai-hero-rise;
            animation-range: 45svh 80svh;
        }

        .ai-hero__chat {
            animation-name: ai-hero-rise;
            animation-range: 70svh 110svh;
        }
    }
}

@keyframes ai-hero-app-out {
    to { opacity: 0; transform: scale(0.82) translateY(-4%); filter: blur(6px); }
}

@keyframes ai-hero-logo-in {
    from { opacity: 0; transform: scale(2.4); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes ai-hero-rise {
    from { opacity: 0; transform: translateY(2.5rem); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 575.98px) {
    .ai-hero__chat { font-size: 0.875rem; }
}
