/*
 * Login page - brand-matched split layout.
 * Palette comes from the Be Quarks logo: grey wordmark and the magenta -> purple gem.
 */
:root {
    color-scheme: light;
    --bq-magenta: #d6155d;
    --bq-purple: #6d2c9b;
    --bq-purple-dark: #57227e;
    --bq-ink: #3e4b55;
    --bq-text: #55636e;
    --bq-muted: #667780;
    --bq-line: #d7d7de;
}

* { box-sizing: border-box; }

html, body.bq-login {
    height: 100%;
    margin: 0;
}

body.bq-login {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--bq-ink);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

.bq-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr);
    min-height: 100vh;
}

/* ---------- brand side ---------- */
.bq-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fcfcfe;
    border-right: 1px solid #ececf2;
}

#particles-js {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .35;
    /* Behind the logo the network is only barely visible (22%), so the wordmark stays readable. */
    -webkit-mask-image: radial-gradient(ellipse 300px 170px at 50% 50%, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 55%, #000 100%);
    mask-image: radial-gradient(ellipse 300px 170px at 50% 50%, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 55%, #000 100%);
}

.bq-brand-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 32px 32px 64px;
    text-align: center;
    pointer-events: none;
}

.bq-brand-identity { width: 100%; }
.bq-brand-intro { --intro-y: -9px; width: min(68%, 300px); margin: -20px auto 0; opacity: 0; visibility: hidden; transform: translate(-2.5%, var(--intro-y)); }
.bq-logo-anim.bq-ready + .bq-brand-intro { visibility: visible; animation: bq-intro-in .5s ease 2.45s both; }
@keyframes bq-intro-in { from { opacity: 0; transform: translate(-2.5%, calc(var(--intro-y) + 8px)); } to { opacity: 1; transform: translate(-2.5%, var(--intro-y)); } }
.bq-brand-intro h2 { margin: 0; color: var(--bq-text); font-size: 13px; font-weight: 500; line-height: 1.3; }
.bq-brand-intro p { margin: 2px 0 0; color: var(--bq-muted); font-size: 10px; line-height: 1.35; }

.bq-brand-showcase { position: absolute; right: 32px; bottom: 70px; left: 32px; width: min(calc(100% - 64px), 440px); margin: 0 auto; pointer-events: auto; }
.bq-brand-slides { position: relative; height: 64px; opacity: 1; transition: opacity .25s ease-in-out; }
.bq-brand-showcase.is-switching .bq-brand-slides { opacity: 0; }
.bq-brand-slide { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 9px; }
.bq-brand-slide.is-active { display: flex; }
.bq-brand-slide-icon { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 50%; background: rgba(109, 44, 155, .09); color: var(--bq-purple); }
.bq-brand-slide-icon svg { width: 15px; height: 15px; stroke-width: 1.8; }
.bq-brand-slide-copy { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-width: 0; }
.bq-brand-slide h2 { flex: 0 0 auto; margin: 0; color: var(--bq-ink); font-size: 15px; font-weight: 600; line-height: 1.3; }
.bq-brand-slide p { min-width: 0; margin: 0; color: var(--bq-muted); font-size: 12px; line-height: 1.5; }
.bq-brand-pagination { display: flex; align-items: center; justify-content: center; gap: 9px; height: 16px; }
.bq-brand-pagination button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: #bfc0ca; cursor: pointer; transition: background .2s, transform .2s; }
.bq-brand-pagination button.is-active { background: var(--bq-purple); transform: scale(1.2); }
.bq-brand-pagination button:focus-visible { outline: 2px solid var(--bq-purple); outline-offset: 4px; }

.bq-logo-anim {
    position: relative;
    width: min(440px, 70%);
    aspect-ratio: 801 / 345;
    margin: 0 auto;
}
.bq-logo-anim img { position: absolute; display: block; height: auto; user-select: none; -webkit-user-drag: none; }

/*
 * Smoothness rules: only transform and opacity are animated (compositor-only, no repaint), every piece is its
 * own GPU layer, and nothing starts until all logo images are decoded (class .bq-ready, set in login.php),
 * so there is no pop-in or hitch at the start.
 */
.bq-logo-anim img, .bq-gem { will-change: transform, opacity; backface-visibility: hidden; transform: translateZ(0); }
.bq-logo-anim:not(.bq-ready) img { opacity: 0; }
.bq-logo-anim:not(.bq-ready) .bq-gem { visibility: hidden; }

/* 1. Letters rise one by one, then a soft shine (a brief fade-dip) runs along them, left to right. */
.bq-ready .bq-ch {
    animation:
        bq-rise .6s cubic-bezier(.2, .8, .2, 1) calc(.55s + var(--i) * .07s) both,
        bq-shine 1.4s ease-in-out calc(2.1s + var(--i) * .08s);
}
@keyframes bq-rise { from { opacity: 0; transform: translate3d(0, 16%, 0); } }
@keyframes bq-shine { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.bq-ready .bq-tag { animation: bq-tag 1s ease 1.4s both; }
@keyframes bq-tag { from { opacity: 0; transform: scaleX(1.14); } }

/* 2. The gem assembles from its 10 facets, then keeps floating gently and shimmering. */
.bq-gem { position: absolute; display: block; }
.bq-ready .bq-gem { animation: bq-float 4.2s ease-in-out 2.4s infinite; }
.bq-gem .bq-f { left: 0; top: 0; width: 100%; height: 100%; transform-origin: center; scale: 1.014; } /* tiny overlap hides hairline seams between the smoothed facet edges */
.bq-ready .bq-f {
    animation:
        bq-fly .8s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * .08s) both,
        bq-shimmer 4.2s ease-in-out calc(2.4s + var(--i) * .3s) infinite;
}
/* Pieces start soft/blurred and sharpen as they land, so the moving edges never look cut out. */
@keyframes bq-fly { from { opacity: 0; filter: blur(3px); transform: translate3d(var(--dx), var(--dy), 0) scale(.4) rotate(var(--rot)); } 70% { filter: blur(.6px); } }
@keyframes bq-float { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -7%, 0); } }
@keyframes bq-shimmer { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }


@media (prefers-reduced-motion: reduce) {
    .bq-logo-anim *, .bq-gem { animation: none !important; }
}

.bq-copy {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    bottom: 18px;
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: #8d8d97;
}

.bq-copy a { color: inherit; text-decoration: none; }
.bq-copy a:hover { color: var(--bq-purple); }

/* ---------- form side ---------- */
.bq-form-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: #fff;
}

.bq-form-wrap { width: 100%; max-width: 380px; }

.bq-theme-toggle { position: absolute; top: 24px; right: 24px; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--bq-line); border-radius: 8px; background: #fff; color: var(--bq-text); cursor: pointer; }
.bq-theme-toggle:hover { color: var(--bq-purple); border-color: var(--bq-purple); }
.bq-theme-toggle:focus-visible { outline: 3px solid rgba(109, 44, 155, .35); outline-offset: 2px; }
.bq-theme-toggle svg { width: 17px; height: 17px; stroke: currentColor; }
.bq-theme-icon--sun { display: none; }
html[data-bq-theme="dark"] .bq-theme-icon--moon { display: none; }
html[data-bq-theme="dark"] .bq-theme-icon--sun { display: inline; }

.bq-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--bq-ink); }
.bq-sub { margin: 0 0 26px; font-size: 14.5px; color: var(--bq-muted); }

.bq-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 11px 13px;
    border: 1px solid #f6cdd6;
    border-radius: 8px;
    background: #fdf0f3;
    color: #8f1239;
    font-size: 13px;
    line-height: 1.45;
}
.bq-alert i { margin-top: 2px; color: var(--bq-magenta); }
.bq-alert strong { display: block; font-weight: 600; }

.bq-field { margin: 0 0 16px; }
.bq-field label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--bq-text); }

.bq-input {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--bq-line);
    border-radius: 10px;
    background: #fff;
    color: #8d8d97;
    transition: border-color .15s, box-shadow .15s;
}
.bq-input:focus-within {
    border-color: var(--bq-purple);
    box-shadow: 0 0 0 3px rgba(109, 44, 155, .15);
    color: var(--bq-purple);
}
.bq-input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 14.5px;
    color: var(--bq-ink);
}
.bq-input input::placeholder { color: #a6a6b0; }

.bq-eye {
    border: 0;
    background: transparent;
    padding: 6px;
    margin-right: -6px;
    color: #8d8d97;
    cursor: pointer;
    border-radius: 6px;
}
.bq-eye:hover { color: var(--bq-purple); }
.bq-eye:focus-visible { outline: 2px solid var(--bq-purple); outline-offset: 1px; }

.bq-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 20px;
    font-size: 13px;
}

.bq-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--bq-text); cursor: pointer; }
.bq-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.bq-box {
    position: relative;
    width: 16px;
    height: 16px;
    border: 1px solid #c3c3cd;
    border-radius: 4px;
    background: #fff;
    transition: background .15s, border-color .15s;
}
.bq-check input:checked + .bq-box { background: var(--bq-purple); border-color: var(--bq-purple); }
.bq-check input:checked + .bq-box::after {
    content: "";
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.bq-check input:focus-visible + .bq-box { outline: 2px solid var(--bq-purple); outline-offset: 2px; }

.bq-forgot { color: #b0125a; font-weight: 500; text-decoration: none; }
.bq-forgot:hover { color: var(--bq-magenta); text-decoration: underline; }

.bq-submit {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bq-magenta) 0%, var(--bq-purple) 100%);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.bq-submit:hover { filter: brightness(1.06) saturate(1.05); }
.bq-submit:active { transform: scale(.995); }
.bq-submit:focus-visible { outline: 3px solid rgba(109, 44, 155, .35); outline-offset: 2px; }

.bq-ip { margin: 22px 0 8px; text-align: center; font-size: 12.5px; color: #8d8d97; }
.bq-ip a { color: var(--bq-purple); text-decoration: none; }
.bq-ip a:hover { text-decoration: underline; }

.bq-links { display: flex; justify-content: center; gap: 8px; font-size: 12.5px; color: #b4b4bd; }
.bq-links a { color: #8d8d97; text-decoration: none; }
.bq-links a:hover { color: var(--bq-purple); }

html[data-bq-theme="dark"] {
    color-scheme: dark;
    --bq-ink: #e7eef0;
    --bq-text: #d3dee2;
    --bq-muted: #aab9bf;
    --bq-line: #4a606a;
}
html[data-bq-theme="dark"] body.bq-login,
html[data-bq-theme="dark"] .bq-split { background: #11191d; }
html[data-bq-theme="dark"] .bq-brand { background: #141e23; border-color: #34454d; }
html[data-bq-theme="dark"] .bq-ch,
html[data-bq-theme="dark"] .bq-tag { filter: brightness(1.4); }
html[data-bq-theme="dark"] .bq-form-side { background: #1b262b; }
html[data-bq-theme="dark"] .bq-input,
html[data-bq-theme="dark"] .bq-theme-toggle { background: #243239; color: var(--bq-text); }
html[data-bq-theme="dark"] .bq-input:focus-within { color: #dbafea; border-color: #ba7acc; box-shadow: 0 0 0 3px rgba(186, 122, 204, .2); }
html[data-bq-theme="dark"] .bq-input input::placeholder { color: #9cabb1; }
html[data-bq-theme="dark"] .bq-eye,
html[data-bq-theme="dark"] .bq-copy,
html[data-bq-theme="dark"] .bq-ip,
html[data-bq-theme="dark"] .bq-links,
html[data-bq-theme="dark"] .bq-links a { color: var(--bq-muted); }
html[data-bq-theme="dark"] .bq-box { background: #243239; border-color: var(--bq-line); }
html[data-bq-theme="dark"] .bq-forgot,
html[data-bq-theme="dark"] .bq-ip a,
html[data-bq-theme="dark"] .bq-copy a:hover,
html[data-bq-theme="dark"] .bq-links a:hover,
html[data-bq-theme="dark"] .bq-theme-toggle:hover,
html[data-bq-theme="dark"] .bq-eye:hover { color: #e6b3ed; }
html[data-bq-theme="dark"] .bq-alert { background: #3d2532; border-color: #744155; color: #ffd5e1; }
html[data-bq-theme="dark"] .bq-alert i { color: #ff8db1; }
html[data-bq-theme="dark"] .bq-brand-slide-icon { background: rgba(230, 179, 237, .12); color: #e6b3ed; }
html[data-bq-theme="dark"] .bq-brand-pagination button { background: #647780; }
html[data-bq-theme="dark"] .bq-brand-pagination button.is-active { background: #e6b3ed; }

/* ---------- phones / small tablets: compact brand header + rounded form sheet ---------- */
@media (max-width: 860px) {
    .bq-split {
        grid-template-columns: 1fr;
        grid-template-rows: 270px 1fr;
        min-height: 100vh;
        min-height: 100dvh;
        background: #f6f6f9;
    }
    .bq-brand { border-right: 0; }
    #particles-js {
        -webkit-mask-image: radial-gradient(ellipse 210px 90px at 50% 45%, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 55%, #000 100%);
        mask-image: radial-gradient(ellipse 210px 90px at 50% 45%, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 55%, #000 100%);
    }
    .bq-brand-inner { padding: 0; }
    .bq-brand-identity { position: absolute; top: 10px; left: 0; right: 0; }
    .bq-logo-anim { width: min(170px, 56%); }
    .bq-brand-intro { --intro-y: -2px; width: min(68%, 300px); margin-top: -8px; }
    .bq-brand-intro h2 { font-size: 11px; }
    .bq-brand-intro p { font-size: 9px; }
    .bq-brand-showcase { right: 20px; bottom: 32px; left: 20px; width: calc(100% - 40px); }
    .bq-brand-slides { height: 64px; }
    .bq-brand-slide-icon { width: 24px; height: 24px; }
    .bq-brand-slide-icon svg { width: 14px; height: 14px; }
    .bq-brand-slide h2 { font-size: 13px; }
    .bq-brand-slide p { font-size: 11px; line-height: 1.35; }
    .bq-brand-slide-copy { gap: 5px; }
    .bq-copy { display: none; }

    .bq-form-side {
        align-items: stretch;
        padding: 34px 20px calc(20px + env(safe-area-inset-bottom));
        margin-top: -22px;
        position: relative;
        z-index: 2;
        background: #fff;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -6px 24px rgba(43, 43, 51, .06);
    }
    .bq-theme-toggle { top: 12px; right: 20px; }
    /* Form on top; IP and footer links sit at the bottom of the screen. */
    .bq-form-wrap { max-width: 440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; min-height: 100%; }
    .bq-ip { margin-top: auto; padding-top: 28px; }
    .bq-title { font-size: 22px; margin-bottom: 4px; }
    .bq-sub { font-size: 14px; margin-bottom: 20px; }
    .bq-field { margin-bottom: 14px; }
    .bq-input { height: 48px; border-radius: 12px; }
    .bq-input input { font-size: 16px; } /* 16px stops iOS from zooming into the field */
    .bq-row { margin: 2px 0 18px; font-size: 13.5px; }
    .bq-check { min-height: 32px; }
    .bq-submit { height: 50px; border-radius: 12px; font-size: 16px; }
    .bq-links { flex-wrap: wrap; row-gap: 4px; }
}

@media (max-width: 340px) {
    .bq-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .bq-brand-slide h2 { font-size: 12px; }
    .bq-brand-slide p { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .bq-input, .bq-submit, .bq-box { transition: none; }
    .bq-brand-slides, .bq-brand-pagination button { transition: none; }
    .bq-brand-intro { opacity: 1; visibility: visible; animation: none !important; }
}
