/*
IO3. iOS shell polish.

EVERY RULE IS SCOPED TO .nubi-ios-shell on <body> (App.razor sets it only when
AppPlatform.IsIosApp). Outside the iOS native shell the file still loads, but no selector
matches, so the browser and the Android build render exactly as before.

WHAT THIS DOES
  - Safe area padding on the app shell so content never sits under the status bar, notch or
    home indicator. padding-top uses max(env(safe-area-inset-top), <fallback>) so a device
    without a notch still gets a comfortable gap.
  - The auth section (sign in, sign up, OTP, forgot password, reset password) is pinned to the
    viewport and vertically centres the card. Works in portrait and landscape, iPhone and iPad.
    The brand background stays full-bleed under the safe area.
*/

html, body.nubi-ios-shell {
    /* Honouring the safe-area variables on <html> too keeps the brand colour painted under
       the status bar when a page scrolls past the top. */
    background-color: #F4F7EF;
}

/* ─────────────────────────────────────────────────────────────────────────────
   1. App shell safe-area padding.

   Blazor's sidebar + topbar layout (MainLayout.razor) wraps everything in a top-level <aside>
   and a <main>. The following padding applies to any direct top-level content wrapper that
   is NOT an auth section, so the auth pages can centre themselves without conflict.
   ───────────────────────────────────────────────────────────────────────────── */
body.nubi-ios-shell > #app,
body.nubi-ios-shell main {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. Auth pages centring and safe area.

   The four auth screens share this markup shape:
       <section class="bg-primary-50 min-h-screen ..."> <div> ... card ... </div> </section>
   They opt into `.nubi-auth-screen` via a server-rendered @if (AppPlatform.IsIosApp). The CSS
   below pins the section to the full viewport with safe-area padding and centres the card.
   ───────────────────────────────────────────────────────────────────────────── */
body.nubi-ios-shell .nubi-auth-screen {
    /* min-h-screen on the Blazor markup is 100vh; dvh prefers the dynamic viewport height so
       the URL bar hiding on iOS Safari does not create a jump. Fallback to 100vh for older iOS. */
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: max(env(safe-area-inset-top), 24px);
    padding-bottom: max(env(safe-area-inset-bottom), 24px);
    padding-left: max(env(safe-area-inset-left), 16px);
    padding-right: max(env(safe-area-inset-right), 16px);
    /* Flex-centre the card both axes. The `.min-h-screen` from Tailwind on the same element
       already sets the min-height; the flex rules here align regardless of the card's size. */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* The direct card container inside .nubi-auth-screen caps its width so iPad landscape does not
   render a 900-wide form. The inner card already sets its own max-width via sm:max-w-md /
   sm:max-w-lg; this guards the outer wrapper on iPad. */
body.nubi-ios-shell .nubi-auth-screen > * {
    width: 100%;
    max-width: 640px;
}
