/*
 * The sign-in pages (auth/login.php, auth/mfa.php) in the customlaunch.co.uk look:
 * its type, colours, glass card, cyan button and the drifting colour + flowing
 * grid behind every page of the site (.flow-bg, from the website's site.css).
 * The page sets --login-bg, --login-primary, --login-second and --login-on
 * from cl_signin_theme(), so a white-label tenant gets its own colours.
 */
@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap; src: url('../fonts/space-grotesk-latin.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url('../fonts/inter-latin.woff2') format('woff2'); }

:root {
    --login-bg: #05070d; --login-primary: #00e5ff; --login-second: #06d6a0; --login-on: #00161b;
    --ac: var(--login-primary);
    --ac-soft: color-mix(in srgb, var(--ac) 12%, transparent);
    --surface: #0c1220;
    --line: rgba(148,178,214,.11); --line-2: rgba(148,178,214,.2);
    --text: #eef3f9; --text-2: #b0bccd; --text-3: #7a879c;
    --red: #ff5d73; --green: #06d6a0;
    --grad: linear-gradient(100deg, var(--ac) 0%, color-mix(in srgb, var(--ac) 45%, var(--login-second)) 55%, var(--login-second) 100%);
    --ease: cubic-bezier(.16,1,.3,1);
    --display: 'Space Grotesk', Arial, sans-serif;
    --body: 'Inter', Arial, sans-serif;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    --brand-h: clamp(84px, 8vw, 116px); --brand-space: calc(56px + var(--brand-h));
    /* The space under the logo; the card is centred in it. */
    padding: calc(var(--brand-space) + 24px) 16px 24px; background: var(--login-bg); color: var(--text); font: 400 1rem/1.6 var(--body);
    overflow-x: clip; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }

/* ── The website's background: slow drifting colour and a faint grid that flows down ── */
.flow-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.flow-bg i { position: absolute; }
.flow-bg i:first-child {
    inset: -25%;
    background:
        radial-gradient(30% 34% at 22% 28%, color-mix(in srgb, var(--ac) 16%, transparent), transparent 70%),
        radial-gradient(28% 32% at 78% 62%, color-mix(in srgb, var(--login-second) 13%, transparent), transparent 70%),
        radial-gradient(26% 30% at 48% 92%, rgba(124,92,255,.13), transparent 70%),
        radial-gradient(22% 26% at 90% 12%, color-mix(in srgb, var(--ac) 9%, transparent), transparent 70%);
}
.flow-bg i + i {
    inset: -64px 0 0;
    background:
        linear-gradient(color-mix(in srgb, var(--ac) 5.5%, transparent) 1px, transparent 1px) 0 0 / 64px 64px,
        linear-gradient(90deg, color-mix(in srgb, var(--ac) 4.5%, transparent) 1px, transparent 1px) 0 0 / 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 80%);
            mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 80%);
}
@media (prefers-reduced-motion: no-preference) {
    .flow-bg i:first-child { animation: bg-drift 40s ease-in-out infinite alternate; will-change: transform; }
    .flow-bg i + i { animation: bg-grid 14s linear infinite; will-change: transform; }
}
@keyframes bg-drift { 0% { transform: translate3d(-5%,-3%,0) rotate(0deg); } 50% { transform: translate3d(4%,3%,0) rotate(7deg); } 100% { transform: translate3d(-2%,5%,0) rotate(-5deg); } }
@keyframes bg-grid { to { transform: translate3d(0,64px,0); } }

/* ── The website's hero globe (globe.js), large behind the card. Custom Launch's
   own portal only: its colours are the brand's, so white-label pages leave it out. ── */
.signin-globe {
    position: fixed; left: 50%; z-index: -1; aspect-ratio: 1;
    /* Centred in the space under the logo, like the card, and sized so the
       sphere (about 78% of the canvas) fits there: the logo sits above the
       globe, never on it. */
    top: calc(50% + var(--brand-space) / 2);
    width: min(1000px, 125vmin, calc((100vh - var(--brand-space) - 24px) * 1.28));
    translate: -50% -50%; pointer-events: none;
}
.signin-globe::before {
    content: ''; position: absolute; inset: 6%; border-radius: 50%; filter: blur(18px);
    background: radial-gradient(circle, rgba(0,229,255,.16) 52%, rgba(0,229,255,.06) 64%, transparent 72%);
}
.signin-globe canvas { position: relative; display: block; width: 100%; height: 100%; opacity: .001; transition: opacity 1.4s ease; }
.signin-globe canvas.on { opacity: .85; }

/* ── The card: clear glass over the globe. Only a light blur and a thin tint, so
   the globe still shows through; the fields carry their own darker fill. A
   top highlight and inner edge give the glass its thickness. ── */
.signin-card {
    position: relative; width: 100%; max-width: 400px; padding: clamp(1.4rem, 5vw, 2rem);
    border-radius: 22px; border: 1px solid rgba(255,255,255,.12);
    background:
        linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.015) 40%, transparent),
        radial-gradient(70% 60% at 0% 0%, color-mix(in srgb, var(--ac) 9%, transparent), transparent 60%),
        rgba(8,12,22,.42);
    -webkit-backdrop-filter: blur(5px) saturate(140%); backdrop-filter: blur(5px) saturate(140%);
    box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 0 0 1px color-mix(in srgb, var(--ac) 10%, transparent) inset,
        0 40px 90px -30px rgba(0,0,0,.8), 0 0 80px -40px color-mix(in srgb, var(--ac) 55%, transparent);
    animation: card-in .7s var(--ease) both;
}
@keyframes card-in { from { transform: translateY(14px) scale(.985); } }
.signin-logo { display: flex; justify-content: center; margin-bottom: 1.4rem; }
.signin-logo img { max-height: 84px; max-width: 260px; object-fit: contain; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--ac) 35%, transparent)); }
/* The logo centred at the top of the page, out of the flow, above the globe.
   The body's top padding keeps the space under it for the card and globe. */
.signin-brand { position: absolute; top: 36px; left: 50%; translate: -50% 0; margin: 0; }
.signin-brand img { max-height: var(--brand-h); max-width: min(360px, 80vw); filter: drop-shadow(0 6px 22px rgba(0,0,0,.7)) drop-shadow(0 0 22px color-mix(in srgb, var(--ac) 40%, transparent)); }
.kicker {
    display: flex; align-items: center; justify-content: center; gap: .5rem; margin-bottom: .7rem;
    font: 600 .74rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ac);
}
.kicker::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
h1 {
    font: 700 clamp(1.7rem, 6vw, 2.05rem)/1.1 var(--display); letter-spacing: -.035em; text-align: center; color: var(--text);
    margin-bottom: .45rem; text-wrap: balance;
}
h2 { font: 600 1.05rem/1.3 var(--display); letter-spacing: -.02em; color: var(--text); margin: 0 0 .55rem; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.signin-sub { text-align: center; color: var(--text-2); font-size: .92rem; margin-bottom: 1.6rem; }

/* ── Fields and buttons: the website's form card ── */
.field { display: grid; gap: .4rem; margin-bottom: 1rem; font-size: .82rem; font-weight: 500; color: var(--text-2); }
.field input {
    width: 100%; padding: .8rem .9rem; border-radius: 10px; background: rgba(5,8,15,.6); border: 1px solid var(--line-2);
    color: var(--text); font-size: .95rem; transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #55627a; }
.field input:focus { outline: none; border-color: color-mix(in srgb, var(--ac) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 15%, transparent); }
.btn {
    position: relative; isolation: isolate; overflow: hidden; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .85rem 1.25rem; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
    font: 600 .98rem/1.2 var(--body); letter-spacing: -.005em; color: var(--login-on);
    background: linear-gradient(180deg, color-mix(in srgb, var(--ac) 60%, #fff), var(--ac) 55%, color-mix(in srgb, var(--ac) 90%, #000));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ac) 50%, transparent), 0 1px 0 rgba(255,255,255,.5) inset, 0 10px 30px -10px color-mix(in srgb, var(--ac) 55%, transparent);
    transition: transform .2s ease, box-shadow .25s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn::after {
    content: ''; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%); transition: transform .8s var(--ease);
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.65) 48%, transparent 66%);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ac) 70%, transparent), 0 1px 0 rgba(255,255,255,.55) inset, 0 16px 40px -10px color-mix(in srgb, var(--ac) 75%, transparent); }
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .2s ease; }
.btn:hover .ic-arrow { transform: translateX(3px); }
.btn-ghost {
    color: var(--text); background: rgba(5,8,15,.5); border-color: var(--line-2); box-shadow: none;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.btn-ghost::after { content: none; }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--ac) 45%, transparent); background: var(--ac-soft); box-shadow: 0 0 24px -8px color-mix(in srgb, var(--ac) 45%, transparent); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }

/* ── Messages ── */
.alert { display: flex; gap: .55rem; align-items: flex-start; padding: .7rem .9rem; border-radius: 10px; font-size: .86rem; line-height: 1.45; margin: 0 0 1.1rem; }
.alert::before { content: ''; flex: none; width: 6px; height: 6px; margin-top: .45em; border-radius: 50%; background: currentColor; }
.alert-error { background: rgba(255,93,115,.08); border: 1px solid rgba(255,93,115,.3); color: #ff8a9a; }
.alert-ok { background: rgba(6,214,160,.08); border: 1px solid rgba(6,214,160,.3); color: #4ee6bd; }

.or { display: flex; align-items: center; gap: .75rem; margin: 1.3rem 0 1rem; color: var(--text-3); font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.signin-foot { margin-top: 1.4rem; text-align: center; font-size: .78rem; color: var(--text-3); }
.signin-foot a { color: var(--text-3); text-decoration: none; transition: color .2s; }
.signin-foot a:hover { color: var(--ac); }
.signin-foot span { margin: 0 .45rem; opacity: .6; }

@media (prefers-reduced-motion: reduce) {
    .signin-card { animation: none; }
    * { transition: none !important; }
}
