/*
 * Server-rendered placeholder shown instead of `.home-header.splide` when
 * the AI assistant switch is on (D-110). This is the LCP for that page state
 * — it must paint with zero bytes of the widget bundle, so this file stays a
 * small, static, non-animated stylesheet with no interactive elements.
 *
 * Heights below are the measured height of `.home-header--assistant` AFTER
 * the real widget bundle (plan 06-11) has mounted inside `#ai-assistant`,
 * not the old slider height plan 06-10 measured before the bundle existed.
 * The widget's own `Hero` component is a full, self-contained hero section
 * (background image, its own H1/subtitle/trust badges, the chat card) — it
 * needs materially more room than the old slider did, so matching the SSR
 * placeholder's static height to the slider was only ever a stand-in until
 * the real artifact existed to measure against (06-10-SUMMARY.md's own
 * "Next Phase Readiness" note anticipated this). Re-measured live via
 * `tests/e2e/specs/home-header-metrics.spec.ts` on both Playwright projects
 * after this plan wired `AiAssistantAsset` in:
 * Measured across a width sweep, because one number per breakpoint only
 * works if the breakpoints match where the hero actually changes shape:
 *     320px -> 1051    460px ->  928    720px ->  897   1279px ->  559
 *     360px -> 1018    520px ->  892    767px ->  849   1280px ->  559
 *     390px -> 1018    560px ->  892    768px ->  849   1440px ->  559
 *     412px ->  964    600px ->  801    900px ->  849   2560px ->  559
 *     430px ->  928    640px ->  897   1024px ->  559
 * Worst remaining slack is 48px at 767px, where the hero has already dropped
 * to its 768px height while still inside the 640px bucket.
 * Each bucket below takes the TALLEST value in its range: over-reserving
 * leaves dead space, under-reserving moves everything below the hero the
 * instant the widget mounts, and only one of those is a bug users can see
 * as motion (HOME-03).
 *
 * The old two-bucket ladder (1364 / 1162) came from measuring the two
 * Playwright viewports and nothing in between, so it was 9px short across
 * the whole 768-1023 band and 70px short at 320px — both silent, because
 * the gate only ever measured at 1440 and Pixel 7. It also predated two
 * changes that each shortened the hero: removing the `max-width: 920px`
 * clamp below (which let the >=1024px layout become two columns), and
 * taking the server-rendered placeholder out of flow, which gave back the
 * 144px it used to hold above `#ai-assistant` at every width.
 *
 * If the widget's own Hero markup changes height, re-run
 * `tests/e2e/specs/home-header-metrics.spec.ts` and redo this sweep, then
 * update the ladder and this comment together.
 *
 * Colors mirror the widget's own CSS variables (06-UI-SPEC.md Color table)
 * so the swap between this placeholder and the hydrated widget causes no
 * visible color flash:
 *   --background: hsl(222 25% 12%) ~= #171d24 (already bls.ua's own body
 *     background color, template/src — a happy pre-existing match)
 *   --card:       hsl(222 25% 16%) ~= #1f2533
 *
 * Deliberately NOT `display: flex; align-items: center` (as an earlier
 * version of this file was): centering a single growing block vertically
 * inside a fixed-height parent means every byte of extra content added to
 * that block (exactly what happens the instant the widget mounts real
 * content into `#ai-assistant`) re-centers the whole block and moves its
 * already-painted top edge — a real, measured layout shift (CLS 0.37-0.49
 * on this project's own gate, canaried live) even though the *container's*
 * own height never changes. Plain top-aligned block flow means content
 * already above `#ai-assistant` (the title, the skeleton) never moves when
 * `#ai-assistant` grows below it — only genuinely new pixels appear in
 * previously-empty space, which the Layout Instability API does not count
 * as a shift.
 */

.home-header--assistant {
    min-height: 1051px;
    background-color: #171d24;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-sizing: border-box;
    /* The widget's Hero paints its own full-bleed background (photo plus
       gradient, `absolute inset-0`). Now that it reaches the edges of this
       block, its square corners would sit on top of the radius above unless
       this block clips them. The widget's own overlays are unaffected — the
       restart dialog renders through a Radix portal, outside this subtree. */
    overflow: hidden;
}

/*
 * Single column below 1024px; the widget's own type scale steps at Tailwind's
 * `sm` (640px), which is why the profile is not monotonic — the hero gets
 * SHORTER from 430 to 620 as lines fit, then taller again at 640 when the H1
 * jumps a size. Buckets follow that shape rather than pretending it is a ramp.
 *
 * Every number is the tallest of the three languages at that width, not the
 * Ukrainian page alone: the same copy wraps differently in ru/uk/en, and a
 * ladder measured on one of them under-reserves on the others. That is not
 * hypothetical — it is how this ladder was wrong when first written here.
 */
@media screen and (min-width: 360px) {
    .home-header--assistant {
        min-height: 1018px;
    }
}

@media screen and (min-width: 412px) {
    .home-header--assistant {
        min-height: 964px;
    }
}

@media screen and (min-width: 430px) {
    .home-header--assistant {
        min-height: 928px;
    }
}

@media screen and (min-width: 520px) {
    .home-header--assistant {
        min-height: 892px;
    }
}

@media screen and (min-width: 600px) {
    .home-header--assistant {
        min-height: 801px;
    }
}

/* `sm:text-5xl` — the H1 steps up a size here and the hero grows again. */
@media screen and (min-width: 640px) {
    .home-header--assistant {
        min-height: 849px;
    }
}

@media screen and (min-width: 768px) {
    .home-header--assistant {
        min-height: 897px;
    }
}

/*
 * `lg:grid-cols-2` in the widget's Hero turns on at 1024px — the hero becomes
 * two columns and roughly a third shorter. One bucket covers everything above
 * it: the title is a flat `lg:text-[3.5rem]` now, so nothing steps up again at
 * xl the way `xl:text-7xl` used to, and the height is identical from 1024px to
 * 2560px.
 */
@media screen and (min-width: 1024px) {
    .home-header--assistant {
        min-height: 559px;
    }
}

/*
 * No padding either. This element hosts `#ai-assistant`, and the widget's Hero
 * is a full-bleed section painting its own background to its own edges — an
 * inset here does not read as breathing room, it reads as a flat frame around
 * the hero photo, because the strip between the two backgrounds is this
 * block's plain fill. The widget brings the inner spacing content actually
 * needs (`container px-6`, `pt-12 pb-16 lg:py-20` in `Hero.tsx`), so padding
 * here only ever double-counted it.
 */
.home-header-placeholder {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
}

/*
 * The server-rendered title and skeleton live OUT of flow, in the same box
 * `#ai-assistant` will fill, rather than stacked above it.
 *
 * In flow they cost 168px of permanent empty space at the top of the hero:
 * they were hidden with `visibility: hidden` once the widget mounted, which
 * keeps an element's box, so the widget stayed pushed down by a title and a
 * skeleton nobody could see. `display: none` is not the fix either and was
 * already tried and reverted here — collapsing the box reflows `#ai-assistant`
 * upward after it has painted, which is a real shift.
 *
 * Out of flow, neither problem exists: `#ai-assistant` starts at the top of
 * the box from the first byte and never moves, and the placeholder occupies
 * the space it is covering rather than space of its own. Its
 * `top`/`left`/`right` are its own inset, not an echo of the parent's padding
 * (the parent has none): this group is a brief skeleton and wants a small
 * gutter, which the full-bleed hero that replaces it does not.
 *
 * The group is one element rather than two absolutely positioned siblings on
 * purpose: the title and skeleton keep their normal relationship inside it, so
 * a title wrapping to two or three lines on a narrow screen still pushes the
 * skeleton down instead of overlapping it.
 */
.home-header-placeholder-ssr {
    position: absolute;
    top: 24px;
    left: 16px;
    right: 16px;
    /* Centering belongs to this group, not to the host above it. On the host
       it was inherited by everything the widget renders — `text-align` is an
       inherited property and Tailwind's preflight does not reset it — so the
       hero's subtitle and every line inside a car card came out centered, and
       the list rows in particular read as ragged. Only the two nodes below
       ever wanted it. */
    text-align: center;
}

.home-header-placeholder-title {
    max-width: 920px;
    margin: 0 auto 24px;
    color: #fff;
    /* Display token, 06-UI-SPEC.md Typography: 20px / 600 / line-height 1.2.
       Deliberately smaller than the real Hero H1 (text-4xl+) so this never
       becomes a second, larger LCP candidate once the widget hydrates. */
    font: 600 20px/1.2 HelveticaNeueCyr, Helvetica, Arial, sans-serif;
}

.home-header-placeholder-skeleton {
    height: 96px;
    max-width: 420px;
    margin: 0 auto;
    border-radius: 16px;
    background-color: #1f2533;
}

/*
 * The widget's own `Hero` component renders its own H1 (same copy, per
 * 06-UI-SPEC.md's Copywriting Contract: "заглушка и итоговый Hero должны
 * показывать один и тот же H1 дословно") plus a full decorative hero of its
 * own. Once `#ai-assistant` actually has content, this bls.ua-rendered
 * title and skeleton silhouette would otherwise sit duplicated above it.
 *
 * `visibility: hidden` rather than `display: none` is kept for the same reason
 * it was chosen originally — never reflow anything as a consequence of the
 * widget arriving. It no longer costs anything, because the group it hides is
 * out of flow (see `.home-header-placeholder-ssr` above): the box it keeps
 * occupying is empty space nothing else wanted, not 168px stolen from the top
 * of the hero as it was while this group sat in normal flow.
 */
.home-header-placeholder:has(#ai-assistant:not(:empty)) .home-header-placeholder-ssr {
    visibility: hidden;
}
