/* =========================================================================
   AUTH_PAGE_STYLE=flow (the default) - loaded after auth.css by
   layout/auth-head when the style is flow.

   A dark page in both themes: brand copy on the left, the form in a floating
   sheet on the right, ribbons of the logo colours flowing behind it
   (assets/js/custom/auth-flow.js reads --ua-flow-*). The form components are
   the shared ones from auth.css; this file re-points their tokens for the
   sheet and lays out the page. Below 1000px: logo, sheet, legal, stacked.
   ========================================================================= */

body.u360-auth--flow {
    color-scheme: dark;
    --ua-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ua-font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
    --ua-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* the page (dark in both themes) */
    --ua-flow-bg-1: #070A18;
    --ua-flow-bg-2: #0E1030;
    --ua-flow-glow-a: rgba(119, 42, 136, 0.26);
    --ua-flow-glow-b: rgba(0, 155, 219, 0.13);
    --ua-flow-vignette: rgba(3, 4, 12, 0.62);
    --ua-flow-scrim: 5, 7, 20;
    --ua-on-ink-1: #F3F4FB;
    --ua-on-ink-2: #AEB4CF;
    --ua-on-ink-3: #8A90AE;
    --ua-on-ink-focus: #9CC2FF;

    /* ribbon colours read by the canvas script (hex only): the logo ribbons */
    --ua-flow-0: #A847B4; /* purple  #9B3B95 */
    --ua-flow-1: #F2449E; /* magenta #EB2D91 */
    --ua-flow-2: #FDC23A; /* amber   #FDB813 */
    --ua-flow-3: #4CC765; /* green   #3FB851 */
    --ua-flow-4: #2FB0F0; /* sky     #009BDB */
    --ua-flow-intensity: 1;
    --ua-flow-dust: 1;

    /* the sheet - light theme: a white card */
    --ua-sheet-w: 440px;
    --ua-sheet-bg: #FFFFFF;
    --ua-sheet-edge: transparent;
    --ua-sheet-foot-bg: #F6F7FB;
    --ua-sheet-line: #E7EAF1;
    --ua-sheet-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 1px 2px rgba(2, 4, 14, 0.3),
        0 14px 34px -12px rgba(2, 4, 14, 0.6),
        0 50px 100px -30px rgba(2, 4, 14, 0.9);

    /* shared component tokens (auth.css), as they look inside the sheet */
    --ua-ink: #0B1220;
    --ua-ink-2: #2E384D;
    --ua-body: #2E384D;
    --ua-muted: #5B6478;
    --ua-surface: #FFFFFF;
    --ua-surface-2: #F6F7FB;
    --ua-hairline: #E7EAF1;
    --ua-field-bg: #FFFFFF;
    --ua-field-border: #8A93A6;
    --ua-field-border-hover: #646E84;
    --ua-field-icon: #6B7489;
    --ua-placeholder: #6B7489;
    --ua-focus: #2470E8;
    --ua-focus-ring: rgba(36, 112, 232, 0.22);
    --ua-check-on: #2266DD;
    --ua-link: #1F5BD0;
    --ua-link-hover: #1747A6;
    --ua-btn-bg: linear-gradient(180deg, #2A6FE6 0%, #1D58CC 100%);
    --ua-btn-bg-hover: linear-gradient(180deg, #3478EC 0%, #2161D6 100%);
    --ua-btn-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 0 0 1px rgba(9, 34, 104, 0.45),
        0 1px 2px rgba(7, 18, 56, 0.3),
        0 10px 24px -10px rgba(29, 88, 204, 0.7);
    --ua-btn-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 0 0 1px rgba(9, 34, 104, 0.45),
        0 1px 2px rgba(7, 18, 56, 0.3),
        0 16px 32px -12px rgba(29, 88, 204, 0.85);
}

[data-bs-theme="dark"] body.u360-auth--flow {
    --ua-flow-bg-1: #05070F;
    --ua-flow-bg-2: #0A0C24;
    --ua-flow-glow-a: rgba(119, 42, 136, 0.2);
    --ua-flow-glow-b: rgba(0, 155, 219, 0.1);
    --ua-flow-vignette: rgba(1, 2, 8, 0.7);
    --ua-flow-intensity: 0.86;
    --ua-flow-dust: 0.8;

    /* the sheet - dark theme: blurred glass */
    --ua-sheet-bg: linear-gradient(180deg, rgba(30, 34, 74, 0.72) 0%, rgba(15, 17, 42, 0.8) 100%);
    --ua-sheet-edge: rgba(255, 255, 255, 0.1);
    --ua-sheet-foot-bg: rgba(255, 255, 255, 0.03);
    --ua-sheet-line: rgba(255, 255, 255, 0.08);
    --ua-sheet-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 1px 2px rgba(0, 0, 0, 0.4),
        0 30px 80px -24px rgba(0, 0, 0, 0.75);

    --ua-ink: #F2F4FB;
    --ua-ink-2: #CBD0E3;
    --ua-body: #CBD0E3;
    --ua-muted: #A0A6C2;
    --ua-surface: #151937;
    --ua-surface-2: rgba(255, 255, 255, 0.04);
    --ua-hairline: rgba(255, 255, 255, 0.08);
    --ua-field-bg: rgba(255, 255, 255, 0.035);
    --ua-field-border: #5F6787;
    --ua-field-border-hover: #8089AB;
    --ua-field-icon: #8C93B0;
    --ua-placeholder: #8C93B0;
    --ua-autofill: #1B1F42;
    --ua-reveal-hover: rgba(255, 255, 255, 0.08);
    --ua-focus: #7AA9FF;
    --ua-focus-ring: rgba(122, 169, 255, 0.26);
    --ua-check-on: #4D7FF0;
    --ua-link: #8DB8FF;
    --ua-link-hover: #B8D2FF;
    /* re-stated: the shared dark block in auth.css is more specific than the
       light flow block above */
    --ua-btn-bg: linear-gradient(180deg, #2A6FE6 0%, #1D58CC 100%);
    --ua-btn-bg-hover: linear-gradient(180deg, #3478EC 0%, #2161D6 100%);
    --ua-btn-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 0 0 1px rgba(9, 34, 104, 0.45),
        0 1px 2px rgba(0, 0, 0, 0.4),
        0 10px 24px -10px rgba(29, 88, 204, 0.7);
    --ua-btn-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 0 0 1px rgba(9, 34, 104, 0.45),
        0 1px 2px rgba(0, 0, 0, 0.4),
        0 16px 32px -12px rgba(29, 88, 204, 0.85);
}

/* ---------- page ---------- */

body.u360-auth--flow {
    display: block;   /* Metronic makes body a 100%-tall flex column */
    height: auto;
    min-height: 100%;
    background-color: var(--ua-flow-bg-1);
    color: var(--ua-on-ink-1);
    overflow-x: hidden;
}

/* back to front: backdrop < canvas < vignette + grain < content */
.u360-auth .ua-flow-backdrop,
.u360-auth .ua-flow-atmos {
    position: fixed;
    inset: 0;
    pointer-events: none;
}
.u360-auth .ua-flow-backdrop {
    z-index: 0;
    background:
        radial-gradient(60% 50% at 6% 0%, var(--ua-flow-glow-a), transparent 72%),
        radial-gradient(50% 45% at 100% 100%, var(--ua-flow-glow-b), transparent 70%),
        linear-gradient(160deg, var(--ua-flow-bg-1) 0%, var(--ua-flow-bg-2) 100%);
}
.u360-auth .ua-flow-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100lvh;   /* ignores mobile toolbar resizes */
    pointer-events: none;
}
.u360-auth .ua-flow-atmos {
    z-index: 1;
    background: radial-gradient(135% 105% at 58% 46%, transparent 56%, var(--ua-flow-vignette) 100%);
}
.u360-auth .ua-flow-atmos::after {   /* fine grain */
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.55;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- shell (mobile first: logo, sheet, legal) ---------- */

.u360-auth .ua-shell {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "main" "foot";
    align-content: center;
    justify-items: center;
    gap: 24px;
    width: 100%;
    max-width: 1360px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding:
        max(24px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
}
.u360-auth .ua-shell--solo {   /* guest error pages: logo + one sheet, centred at every width */
    --ua-sheet-w: 520px;
    grid-template-areas: "head" "main";
}

/* soft ink pool behind the brand copy keeps it legible over the ribbons */
.u360-auth .ua-shell__scrim {
    display: none;
    position: relative;
    z-index: 0;
    pointer-events: none;
}
.u360-auth .ua-shell__scrim::before {
    content: "";
    position: absolute;
    inset: -16% -8% -18% -20%;
    background: radial-gradient(closest-side,
        rgba(var(--ua-flow-scrim), 0.74) 0%,
        rgba(var(--ua-flow-scrim), 0.5) 55%,
        rgba(var(--ua-flow-scrim), 0) 100%);
}

/* ---------- logo on the dark page ---------- */

.u360-auth .ua-shell__head {
    grid-area: head;
    position: relative;
    z-index: 1;
    justify-self: center;
    animation: ua-fade 0.9s var(--ua-ease) 0.1s backwards;
    --ua-focus: var(--ua-on-ink-focus);
}
.u360-auth .ua-shell__head .ua-lockup { align-self: center; }
/* the page is ink in both themes: always the dark-background logo */
.u360-auth .ua-shell__head .ua-lockup__img--on-light { display: none; }
.u360-auth .ua-shell__head .ua-lockup__img--on-dark {
    display: block;
    height: 46px;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
}

/* ---------- brand story (desktop only) ---------- */

.u360-auth .ua-shell__story {
    grid-area: story;
    position: relative;
    z-index: 1;
    display: none;
    animation: ua-fade 1s var(--ua-ease) 0.18s backwards;
}
.u360-auth .ua-display {
    display: inline-block;
    margin: 0 0 22px;
    padding-bottom: 0.06em;
    font-family: var(--ua-font-display);
    font-size: clamp(44px, 4.7vw, 80px);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.045em;
    color: var(--ua-on-ink-1);
}
/* Sized to the story column, not the viewport: the column is ~390px wide at a
   1000px window and up to 640px wider up, and each headline line must stay
   whole across that range. */
.u360-auth .ua-shell__story { container-type: inline-size; }
@supports (font-size: 1cqi) {
    .u360-auth .ua-display { font-size: clamp(30px, 10.5cqi, 80px); }
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .u360-auth .ua-display {
        background-image: linear-gradient(112deg, #FFF4D6 0%, #FFDCA0 20%, #FFBEDC 44%, #D9C3FF 68%, #A8D9FF 88%, #BDEFC5 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}
.u360-auth .ua-display-lede {
    max-width: 30em;
    margin: 0 0 32px;
    font-size: 18px;
    line-height: 1.6;
    color: var(--ua-on-ink-2);
    text-wrap: balance; /* a short line: split it evenly, never one word alone */
}
.u360-auth .ua-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.u360-auth .ua-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #C9CEE4;
    transition: color 0.2s var(--ua-ease);
}
.u360-auth .ua-legend__swatch {   /* a ribbon offcut, rising like the logo */
    flex: none;
    width: 20px;
    height: 9px;
    background: linear-gradient(90deg, var(--ua-swatch-a), var(--ua-swatch-b));
    clip-path: polygon(0 42%, 100% 0, 100% 58%, 0 100%);
    transform-origin: 0 50%;
    transition: transform 0.25s var(--ua-ease);
}
.u360-auth .ua-legend__item--reviews { --ua-swatch-a: #FBD30F; --ua-swatch-b: #FDB813; }
.u360-auth .ua-legend__item--social { --ua-swatch-a: #F25CA6; --ua-swatch-b: #EB2D91; }
.u360-auth .ua-legend__item--messaging { --ua-swatch-a: #37A5D8; --ua-swatch-b: #009BDB; }
.u360-auth .ua-legend__item--contacts { --ua-swatch-a: #3FB851; --ua-swatch-b: #95CF95; }
.u360-auth .ua-legend__item--ai { --ua-swatch-a: #9B3B95; --ua-swatch-b: #C45FC6; }
@media (hover: hover) {
    .u360-auth .ua-legend__item:hover { color: #FFFFFF; }
    .u360-auth .ua-legend__item:hover .ua-legend__swatch { transform: scaleX(1.35); }
}

/* ---------- legal ---------- */

.u360-auth .ua-shell__legal {
    grid-area: foot;
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 22px;
    margin: 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--ua-on-ink-3);
}
.u360-auth .ua-shell__legal-link {
    position: relative;
    border-radius: 4px;
    color: var(--ua-on-ink-2);
    text-decoration: none;
    transition: color 0.18s var(--ua-ease);
}
.u360-auth .ua-shell__legal-link::after {   /* 44px hit area without moving anything */
    content: "";
    position: absolute;
    inset: -13px -6px;
}
.u360-auth .ua-shell__legal-link:hover,
.u360-auth .ua-shell__legal-link:focus {
    color: var(--ua-on-ink-1);
    /* Metronic: body a:hover, a:focus { text-decoration: none !important } */
    text-decoration-line: underline !important;
    text-underline-offset: 3px;
}
.u360-auth .ua-shell__legal-link:focus-visible {
    outline: 2px solid var(--ua-on-ink-focus);
    outline-offset: 3px;
}

/* ---------- the sheet (the form card) ---------- */

.u360-auth .ua-shell__main {
    grid-area: main;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--ua-sheet-w);
}
.u360-auth .ua-sheet {
    position: relative;
    width: 100%;
    border: 1px solid var(--ua-sheet-edge);
    border-radius: 22px;
    background: var(--ua-sheet-bg);
    box-shadow: var(--ua-sheet-shadow);
    color: var(--ua-ink);
    color-scheme: light;
    /* backwards, not both: a held end state would stay applied after the
       entrance and make the sheet a backdrop root */
    animation: ua-rise 0.75s var(--ua-ease) 0.05s backwards;
}
[data-bs-theme="dark"] .u360-auth .ua-sheet {
    color-scheme: dark;
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    backdrop-filter: blur(22px) saturate(150%);
}
.u360-auth .ua-sheet__body { padding: 28px 24px 24px; }
.u360-auth .ua-sheet__foot {
    padding: 16px 24px;
    border-top: 1px solid var(--ua-sheet-line);
    border-radius: 0 0 21px 21px;
    background: var(--ua-sheet-foot-bg);
}
.u360-auth .ua-sheet__foot .ua-alt { margin: 0; }

/* shared components, sized for the sheet */
.u360-auth .ua-sheet .ua-head { margin-bottom: 24px; }
.u360-auth .ua-sheet .ua-title { font-size: 24px; letter-spacing: -0.018em; }

/* the guest error views size themselves for the app shell; here the sheet does */
.u360-auth .ua-sheet--error .ua-sheet__body { padding: 36px 24px; }
.u360-auth .ua-sheet--error .error-shell { min-height: 0; }
.u360-auth .ua-sheet--error .error-card { max-width: none; padding: 0; }

/* ---------- motion ---------- */

@keyframes ua-rise {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}
@keyframes ua-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- responsive ---------- */

@media (min-width: 480px) {
    .u360-auth .ua-sheet__body { padding: 40px 40px 32px; }
    .u360-auth .ua-sheet__foot { padding: 18px 40px; }
    .u360-auth .ua-sheet .ua-head { margin-bottom: 28px; }
    .u360-auth .ua-sheet .ua-title { font-size: 28px; }
    .u360-auth .ua-sheet--error .ua-sheet__body { padding: 44px 40px; }
}

@media (min-width: 640px) {
    .u360-auth .ua-shell { gap: 28px; }
    .u360-auth .ua-shell__head .ua-lockup__img--on-dark { height: 54px; }
}

@media (min-width: 1000px) {
    .u360-auth .ua-shell:not(.ua-shell--solo) {
        grid-template-columns: minmax(0, 1fr) var(--ua-sheet-w);
        /* Row 2 centres the brand in the first screen; a taller form (register,
           consent) grows row 5, so the brand never slides down. */
        grid-template-rows: 88px max(0px, calc(50vh - 282px)) auto auto 1fr 88px;
        grid-template-areas:
            ".     main"
            ".     main"
            "head  main"
            "story main"
            ".     main"
            "foot  main";
        align-content: stretch;
        justify-items: stretch;
        gap: 0 clamp(48px, 7vw, 140px);
        padding: 0 clamp(40px, 5vw, 80px);
    }
    .u360-auth .ua-shell:not(.ua-shell--solo) .ua-shell__scrim { display: block; grid-area: 3 / 1 / 5 / 2; }
    .u360-auth .ua-shell:not(.ua-shell--solo) .ua-shell__head { justify-self: start; }
    .u360-auth .ua-shell:not(.ua-shell--solo) .ua-lockup__img--on-dark { height: 88px; }
    .u360-auth .ua-shell__story { display: block; max-width: 640px; margin-top: 52px; }
    .u360-auth .ua-shell:not(.ua-shell--solo) .ua-shell__main { align-self: center; justify-self: end; padding: 48px 0; }
    .u360-auth .ua-shell__legal { justify-content: flex-start; align-self: center; }
}

@media (min-width: 1000px) and (max-height: 760px) {
    .u360-auth .ua-shell:not(.ua-shell--solo) { grid-template-rows: 64px max(0px, calc(50vh - 250px)) auto auto 1fr 64px; }
    .u360-auth .ua-shell__story { margin-top: 36px; }
    .u360-auth .ua-shell:not(.ua-shell--solo) .ua-shell__main { padding: 32px 0; }
}

@media (forced-colors: active) {
    .u360-auth .ua-display {
        background: none;
        -webkit-text-fill-color: CanvasText;
    }
    .u360-auth .ua-sheet { border-color: CanvasText; }
}
