body, html {
    min-height: 100%;
}

html {
    /* fallback colour while the animated SVG background loads */
    background: #04263f;
}

body {
    font-family: "UEF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    margin: 0;
    color: rgba(47, 43, 61, 0.78);
    line-height: 1.467;
    font-size: 1rem;
    font-weight: 400;
    background-color: transparent;
}

/* "Honeycomb City" background layer (components/molecules/background.ftl):
   fixed full-viewport, behind the centered card.

   Four tiers, chosen per device by the selector in background.ftl and exposed as
   data-bg-tier on this element:
     A  CSS Ken Burns on the photo + 64 fading cells   (capable desktop)
     B  still photo + 24 cells                         (desktop that failed the probe)
     C  still photo + static honeycomb, nothing moves  (phones, reduced-motion, weak)
     D  blobs only, no photo requested                 (Save-Data / reduced-data)
   Everything above tier C must stay purely additive: tier C is what renders before
   the script runs, so it is also the no-JS result. */
.uef-login-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;

    /* The floor under every tier: four soft blobs as layered radial-gradients.
       One paint, nothing per frame -- no canvas, no rAF, no image bytes. Because it
       sits on the container rather than on a tier, it is also what shows through when
       the WebP fails to load, and what renders before any script has run.
       Radii are percentages of THIS element, not viewport units, so the same
       declaration works full-bleed on the login page and inside the welcome page's
       44%-wide brand panel. Measured contrast for white text: 7.04 at worst, and
       identical at every aspect ratio from a 390px phone to a 2K monitor. */
    background-color: #04263f;
    background-image:
        radial-gradient(ellipse 62% 62% at 22% 42%,     rgba(0, 114, 188, .42),  rgba(0, 114, 188, 0)),
        radial-gradient(ellipse 58% 58% at 93.9% 22.9%, rgba(46, 109, 180, .46), rgba(46, 109, 180, 0)),
        radial-gradient(ellipse 70% 70% at 65.8% 75%,   rgba(10, 60, 110, .70),  rgba(10, 60, 110, 0)),
        radial-gradient(ellipse 42% 42% at 16% 73.7%,   rgba(120, 160, 205, .22), rgba(120, 160, 205, 0));
    background-blend-mode: screen, screen, screen, screen;
}

/* The photo is a CSS background on its own element rather than an <image> inside the
   SVG. That is what makes the Ken Burns move compositable: a transform on this box is
   handed to the GPU, where the old <animateTransform> on an SVG <g> forced the 1920px
   bitmap to be re-sampled on the main thread every frame. */
.uef-bg-photo {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* background-image itself (and the 828/1280/1920 breakpoints) is emitted into the
   page by scripts/gen-login-bg.py — a relative url() in a stylesheet would resolve
   against the stylesheet, and the theme resources path is only known server-side.
   The phone gets a 73 KB image instead of the 573 KB desktop one, and as a CSS image
   it is genuinely not fetched when the box is not rendered (tier D) — which is not
   true of an <image> inside inline SVG. */

.uef-login-bg .uef-bg-grid {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

@keyframes uef-kenburns {
    0%, 100% { transform: scale(1) translate3d(0, 0, 0); }
    50%      { transform: scale(1.08) translate3d(-3.1%, -3.1%, 0); }
}

/* The one place will-change is earned: an actually composited transform animation.
   Putting it on the SVG instead would only add a layer that SMIL re-dirties anyway. */
.uef-login-bg[data-bg-tier="A"] .uef-bg-photo {
    animation: uef-kenburns 40s cubic-bezier(.4, 0, .6, 1) infinite;
    will-change: transform;
}

/* Tab hidden or window unfocused: stop burning frames on something nobody is looking
   at. SMIL is paused from JS; the CSS half is paused here. */
.uef-login-bg.uef-bg-frozen .uef-bg-photo { animation-play-state: paused; }

/* A promotion mounts cells into a page that is already on screen, so fade them in
   instead of letting two dozen hexagons pop into existence. The per-cell SMIL opacity
   is independent of this group-level fade, so the two multiply rather than fight. */
.uef-login-bg .uef-bg-cells { animation: uef-cells-in .7s ease both; }

@keyframes uef-cells-in { from { opacity: 0; } to { opacity: 1; } }


.uef-login-bg[data-bg-tier="D"] .uef-bg-photo,
.uef-login-bg[data-bg-tier="D"] .uef-bg-grid { display: none; }

.uef-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin: 0 auto 1rem;
}

.uef-logo {
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    width: 92px;
    height: auto;
    margin: 0;
    flex: 0 0 auto;
}

/* iOS WebKit collapses an inline <svg> that has a viewBox but no intrinsic
   width/height when it's a flex item (logo invisible on iPhone). Give it a
   definite width so WebKit derives the height from the viewBox aspect ratio. */
.uef-logo svg {
    display: block;
    width: 100%;
    height: auto;
}

.uef-logo-spacer {
    margin-bottom: 0.75rem;
}

.uef-account-title {
    margin: 0;
    padding-left: 0.9rem;
    border-left: 2px solid #d6dde4;
    font-weight: 800;
    line-height: 1.1;
    font-size: 1.85rem;
    letter-spacing: 0.02em;
    font-family: "UEF Pro", sans-serif;
    color: rgba(0, 114, 188, 0.85);
    text-transform: uppercase;
}

/* Login  account Title */
.uef-login-subtitle {
    margin: 0;
    line-height: 1.467;
    font-size: 0.9375rem;
    /* font-family: "Public Sans", sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; */
    font-weight: 400;
    color: rgba(47, 43, 61, 0.68);
    /* lightened to plain helper text (was a grey filled box that read like an alert) */
}

/* Language switcher — larger trigger + options for readability */
.uef-locale-current {
    font-size: 1rem;
}

.uef-locale-menu {
    min-width: 12rem;
}

.uef-locale-item {
    padding: 0.6rem 1.25rem;
}

.uef-locale-item a {
    font-size: 1rem;
}

/* Tighten the gap between the form fields and the action buttons
   (was space-y-4 margin + pt-4 padding = ~2rem; now ~1.5rem). */
.uef-btn-group {
    padding-top: 0.5rem;
}

/* ---- Mobile (phones) ---- */
@media (max-width: 640px) {
    /* Roomier card on a narrow viewport. */
    .uef-card {
        padding: 1.5rem 1.25rem;
        border-radius: 1rem;
    }

    /* Keep the inline brand name on one line next to the logo. */
    .uef-account-title {
        font-size: 1.4rem;
    }

    .uef-logo {
        width: 78px;
    }
}

.bg-primary-600,
.bg-primary-700 {
    --tw-bg-opacity: 1;
    background-color: rgba(0, 114, 188, var(--tw-bg-opacity)) !important;
    color: #fff !important;
}

/* Login Button */
.uef-btn-base {
    display: inline-flex;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: 0;
    border: 0;
    margin: 0 0 1rem;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    appearance: none;
    text-decoration: none;
    line-height: 1.2;
    font-size: 0.9375rem;
    letter-spacing: 0.43px;
    /* font-family: "Public Sans", sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; */
    font-weight: 500;
    border-radius: 6px;
    /* colour is set by the per-variant class (bg-primary-600 / uef-btn-secondary /
       uef-btn-success), not hardcoded here — otherwise it overrides every variant. */
    width: 100%;
    min-width: 50px;
    /*text-transform: none;*/
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    box-shadow: rgba(47, 43, 61, 0.14) 0 2px 6px 0;
    padding: 1rem 0.25rem;
    text-transform: uppercase;
}

.focus\:outline-none:focus {
    outline: 1px solid transparent;
    outline-offset: 1px
}

.focus\:ring:focus {
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)
}

a {
    color: rgb(0 114 188);
    text-decoration: inherit;
}

.help-link {
    line-height: 1.467;
    font-size: 0.9375rem;
    font-weight: 400;
    background-color: rgb(237 237 237);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-align: center;
    margin: 0 auto;
}

.text-primary-500,
.text-primary-600 {
    color: rgb(0 114 188);
}

.text-primary-500:hover,
.text-primary-600:hover {
    color: rgb(0 86 142);
}

/* "success" (green) button. The green Tailwind utilities are purged from the build,
   so the colour is defined here (!important guards against the shared .uef-btn-base
   layout class). Used by components/atoms/button.ftl color="success" — e.g. the
   passkey login button. */
.uef-btn-success {
    background-color: #16a34a !important; /* green-600 */
    color: #fff !important;
    --tw-ring-color: #16a34a;
}

.uef-btn-success:hover {
    background-color: #15803d !important; /* green-700 */
}

/* "secondary" button. The Tailwind secondary utilities (bg-white, text-secondary-*,
   border-secondary-*) are purged from the build, so the colour is defined here.
   Before .uef-btn-base was made colour-neutral, every secondary button rendered blue
   like primary. Used by components/atoms/button.ftl color="secondary". */
.uef-btn-secondary {
    background-color: #fff !important;
    color: rgba(47, 43, 61, 0.78) !important;
    border: 1px solid #d9d9e3 !important;
    box-shadow: rgba(47, 43, 61, 0.1) 0 2px 6px 0 !important;
}

.uef-btn-secondary:hover {
    background-color: #f5f5f7 !important;
    color: rgba(47, 43, 61, 0.95) !important;
}

/* Passkey sign-in button on the LOGIN page. The inherited base passkeys.ftl renders
   <a id="authenticateWebAuthnButton"> styled by base kcButton* classes this theme
   doesn't define, so it showed as a plain blue link. Style it here as the green
   success button (id selector beats the generic `a` rule, no !important needed). */
#authenticateWebAuthnButton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0; /* the passkey button is separated from the password button by the empty #webauth form, so drop the margin and let #webauth control the gap with its margin-top */
    padding: 1rem 0.25rem;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.43px;
    text-transform: uppercase;
    text-decoration: none;
    background-color: #16a34a; /* green-600 */
    color: #fff;
    box-shadow: rgba(47, 43, 61, 0.14) 0 2px 6px 0;
    transition: background-color 150ms ease;
}

#authenticateWebAuthnButton:hover {
    background-color: #15803d; /* green-700 */
    color: #fff;
}

/* the hidden WebAuthn form sits between the two buttons; browsers give <form> a
   default ~1em bottom margin, so zero it out — the hidden form must add no space.
   The visible gap is set by the passkey button's margin-top above. */
#webauth {
    margin: 0;
}

/* body.ftl uses `sm:py-16` = 4rem top+bottom padding for screens ≥640px WIDE. With
   min-h-screen + centered flex, on wide-but-SHORT viewports (e.g. 14" MacBook) the
   tall login card + 8rem padding overflows the viewport and the card top gets clipped.
   py-16 keys off width and ignores height, so trim the padding on short viewports.
   (Loads after dist/index.css per theme.properties, so this overrides the 4rem rule.) */
@media (min-width: 640px) and (max-height: 960px) {
    .sm\:py-16 {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* --- 2FA screens: setup, verify, choose a factor --- */
/* Same voice as .uef-login-subtitle on the other login pages: centred under the centred logo, not a bold left-aligned headline. */
.uef-title { margin: 0; text-align: center; font-size: 1.125rem; line-height: 1.35; font-weight: 600; color: #14233a; }
.uef-who { display: flex; align-items: center; gap: .625rem; }
.uef-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: #0072bc; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8125rem; }
.uef-who-name { flex: 1; min-width: 0; font-weight: 600; color: #14233a; overflow-wrap: anywhere; }
.uef-who-link { font-size: .8125rem; color: #0067ab; flex: none; }
.uef-mute { font-size: .8125rem; color: #5f5c6b; }
.uef-note { border-radius: 6px; padding: .625rem .75rem; font-size: .8125rem; background: #fff6e5; color: #744a00; }
.uef-qr { display: block; width: 148px; height: 148px; margin: 0 auto; border: 1px solid #e3e6eb; border-radius: 6px; image-rendering: pixelated; }
.uef-keybox { display: flex; align-items: center; gap: .5rem; background: #f3f5f8; border-radius: 6px; padding: .25rem .25rem .25rem .625rem; }
.uef-keybox code { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .6875rem; line-height: 1.3; color: #14233a; overflow-wrap: anywhere; }
.uef-copy { height: 30px; padding: 0 .625rem; flex: none; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; color: #14233a; font-weight: 600; font-size: .75rem; cursor: pointer; }
.uef-code-input { height: 54px; border: 1px solid #c9ced6; border-radius: 6px; text-align: center; font-size: 1.5rem; font-weight: 600; letter-spacing: .35em; font-variant-numeric: tabular-nums; color: #14233a; }
.uef-code-input::placeholder { color: #6b6877; font-size: .9375rem; font-weight: 400; letter-spacing: normal; }
.uef-btn-plain { background: none !important; color: #0067ab !important; box-shadow: none !important; text-transform: none !important; letter-spacing: 0 !important; font-weight: 600; text-decoration: none; }
.uef-btn-plain:disabled { color: #5f5c6b !important; cursor: default; }
.uef-hero { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: #e8f2fa; color: #0072bc; display: flex; align-items: center; justify-content: center; }
.uef-benefits { margin: 0 0 1rem; padding-left: 1.25rem; list-style: disc; display: flex; flex-direction: column; gap: .375rem; }
.uef-options { display: flex; flex-direction: column; gap: .625rem; }
.uef-option { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 44px; padding: .75rem; border: 1px solid #d7dbe2; border-radius: 8px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.uef-option:hover, .uef-option:focus-visible { border-color: #0072bc; }
.uef-option-top { border: 2px solid #0072bc; padding: calc(.75rem - 1px); }
.uef-option-icon { width: 40px; height: 40px; flex: none; border-radius: 8px; background: #e8f2fa; color: #0072bc; display: flex; align-items: center; justify-content: center; }
.uef-option-text { flex: 1; min-width: 0; }
.uef-option-text strong { display: block; font-weight: 600; color: #14233a; }
.uef-option-text small { display: block; font-size: .78rem; color: #5f5c6b; line-height: 1.4; }
/* "Other ways": the code by email and recovery codes, one tap away, under the stronger factors. */
.uef-more { margin-top: .75rem; }
.uef-more > summary { cursor: pointer; padding: .625rem .25rem; color: #0072bc; font-size: .875rem; font-weight: 500; list-style: none; text-align: center; }
.uef-more > summary::-webkit-details-marker { display: none; }
.uef-more > summary::before { content: "▸"; display: inline-block; width: 1rem; transition: transform .15s; }
.uef-more[open] > summary::before { transform: rotate(90deg); }
.uef-more > summary:focus-visible { outline: 2px solid #0072bc; outline-offset: 2px; border-radius: 4px; }
.uef-more > .uef-options { margin-top: .25rem; }
.uef-tag { display: inline-block; margin-left: .375rem; padding: 1px 6px; border-radius: 4px; background: #e8f2fa; color: #005a94; font-size: .6875rem; font-weight: 700; vertical-align: 1px; }
.uef-codes { columns: 2; column-gap: 1rem; list-style: decimal inside; background: #f3f5f8; border-radius: 6px; padding: .75rem 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: #14233a; line-height: 1.8; }
/* A phone cannot scan its own screen: narrow screens and touch tablets get the app link. */
.uef-only-phone { display: none; }
.uef-only-phone > p { margin-bottom: .75rem; font-size: .875rem; }
@media (max-width: 640px), (pointer: coarse) and (max-width: 900px) {
    .uef-only-phone { display: block; }
    .uef-only-desktop { display: none; }
}

/* Passkey: what a computer will ask for, or how to turn Windows Hello / Touch ID on; and the
   in-app browser notice on the login page. */
.uef-pk-hello { margin: 0 0 1rem; background: #eef6fc; color: #14233a; }
.uef-pk-hello p + p, .uef-pk-hello div > p + p { margin-top: .375rem; }
.uef-pk-hello a { color: #0067ab; font-weight: 600; text-decoration: underline; }
.uef-pk-recheck, .uef-inapp button { margin-top: .5rem; height: 30px; padding: 0 .75rem; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; color: #14233a; font-weight: 600; font-size: .75rem; cursor: pointer; overflow-wrap: anywhere; }
.uef-inapp { margin-bottom: 1rem; }
.uef-inapp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.uef-inapp-actions a { color: #0067ab; font-weight: 600; text-decoration: underline; margin-top: .5rem; }
