/* ══════════════════════════════════════════════════════════════════════
   auth-polish.css — the five auth pages (register, vendor register, login,
   forgot password, reset password)
   ══════════════════════════════════════════════════════════════════════

   WHY THIS FILE EXISTS AT ALL
   The rules it corrects live in resources/frontend/css/dev1.css, which is
   Vite-compiled. Deploys here are a plain `git pull` with no asset build, so
   editing dev1.css changes nothing on staging or prod (CLAUDE.md says the
   same about style.css). Anything that has to ship goes in public/css/ or a
   Blade template. This follows the shop-polish / homepage-polish convention
   already in this directory: one sheet per surface, linked by the pages that
   need it, cache-busted with filemtime().

   WHAT IT CORRECTS
   dev1.css sizes the auth hero and its flex container to a hardcoded pixel
   height:

       .auth-portal-main { width: 100%; height: 798px; }
       .auth-portal      { height: 798px; padding: 94px 0 0;
                           align-items: center; align-content: center; }

   798px is a guess at how tall the tallest card would ever be, and the
   register card outgrew it: first name, last name, email, password, confirm,
   Turnstile, SIGN UP, Google, Apple, "Become a vendor" and "Already have an
   account", inside 48px/44px of padding. It is `height`, not `min-height`, so
   the container cannot grow — and because the content is CENTRED, the excess
   spills equally out of the top AND the bottom. That is exactly what the
   screenshot shows: "Create an Account" cut off behind the header, "Log In"
   spilling over the footer. The footer is not misplaced; it is laid out at
   798px down, as instructed, and the card simply reaches past it.

   On a laptop that is an overlap and nothing more. On a short mobile viewport
   it is also almost certainly the scroll bounce: a fixed-height hero that
   does not match its own content gives the document a height the browser
   re-resolves every time the iOS toolbar grows or shrinks, and the page
   springs back on release.

   THE FIX IS TO STOP GUESSING THE HEIGHT. Size to content and let the
   background image cover whatever that turns out to be. No viewport units —
   100vh/100dvh here would re-introduce the same class of problem on the same
   short viewports we are trying to fix.

   It also gives the card its top clearance, which is a story of its own —
   see the block on .auth-portal below. The bottom is dev1.css's own
   .main-padding figure (68px) rather than a new number, with a smaller step
   on phones.

   These rules need no !important: this sheet is linked after the Vite bundle,
   and the selectors match dev1.css's exactly, so source order decides.
   ────────────────────────────────────────────────────────────────────── */

.auth-portal-main {
    height: auto;
}

.auth-portal {
    height: auto;
    /* A floor, not a ceiling. Forgot-password and reset-password hold a short
       card, and sized purely to content their hero shrinks to a band — the
       grapes stop reading as a backdrop. min-height keeps the presence the
       798px was really there for, while still growing for a tall card, which
       is the whole point: it can never be the thing content overflows.
       560px because it sits just under the shortest viewport we expect to
       see (an iPhone SE is 568px tall), so on a phone the hero is never what
       forces a scroll — the card is, if anything. */
    min-height: 560px;

    /* ── TOP CLEARANCE FOR THE FIXED HEADER ───────────────────────────
       The site header is `position: fixed` (Bootstrap's .fixed-top), so it
       reserves NO space in the flow. Nothing else reserves it either: the
       first in-flow element in .main-site is the location-nudge banner, and
       it is laid out at y=0 — underneath the header, where it cannot be
       seen. The hero therefore starts partway up behind the header too, and
       every page is left to guess its own top padding. On a phone, measured
       on prod at 375x600, that guess was 40px against a 120.8px header:

           header bottom  120.8px
           card top       102.0px   ← 18.8px of the card, corners included,
                                      behind the header

       Desktop got away with it (94.8px header, 41px of banner above the
       hero, 100px padding → a 46px gap) which is why this only ever read as
       a phone bug.

       So pad by the amount of the header that is actually covering us,
       plus the gap we want to see. --pp-auth-overlap is that first part,
       measured at runtime by /js/auth-header-clearance.js and written to
       :root. It has to be MEASURED rather than hardcoded because the banner
       above the hero changes height with viewer state: 62px on a phone when
       no location is set (the invitation copy wraps to two lines), 41px once
       one is, and either way the header is two-tier below 992px and one-tier
       above. A single number is wrong for half our visitors.

       The var() fallbacks below are what the page uses until the script has
       run (and if it never does). They are measured, not guessed — 94.8-41
       for desktop, and a midpoint for phones, where the honest answer is
       58.8px or 79.8px depending on that banner. Both fallbacks still clear
       the header on their own; the script only makes the gap exact.

       Written to :root and not to .auth-portal on purpose. These are Livewire
       components, and an inline style on an element inside the component root
       is wiped by the next morph — the same trap CLAUDE.md records for
       x-show. :root is outside every component, and custom properties
       inherit, so the value survives. For the same reason .auth-portal must
       never DECLARE --pp-auth-overlap: a declaration here would beat the
       inherited one and the measurement would be ignored. */
    --pp-auth-gap: 68px;
    --pp-auth-overlap-fallback: 54px;
    padding: calc(var(--pp-auth-overlap, var(--pp-auth-overlap-fallback)) + var(--pp-auth-gap)) 0 68px;
}

@media (max-width: 991.98px) {
    /* The header goes two-tier here — .pp-nav-inner wraps and the search bar
       takes a row of its own. This is the header's own breakpoint, copied
       from layouts/header.blade.php, so the fallback changes where the thing
       it describes changes. */
    .auth-portal {
        --pp-auth-overlap-fallback: 70px;
    }
}

@media (max-width: 575.98px) {
    .auth-portal {
        /* Phones get the tighter gap, and the top now matches the bottom. */
        --pp-auth-gap: 40px;
        padding-bottom: 40px;
    }
}

.auth-portal.vender-signup {
    /* The signed-in half of the vendor flow (vendor-register-controller) is the
       one page here that rolled its own clearance: dev1.css gives it
       `margin: 150px auto 100px`. That margin and the padding above it are two
       answers to the same question, and stacking them put the card 249px down
       the page on a phone. The measurement is the better answer, so the margin
       hands the top back to it. Bottom is left alone — 100px of margin plus the
       hero's own padding is what that page has always looked like. */
    margin-top: 0;
}
