/* =====================================================================
   Hishabee login — button morph + "ledger opening" welcome scene.
   Driven by LoginFx.js (HbLoginFx.loading / reset / success).
   ===================================================================== */

/* ---------- the button: cursor spotlight, pill -> ball -> check ---------- */
body.hb-auth .content .hb-submit { white-space: nowrap; }
.hb-submit__label { position: relative; z-index: 1; transition: opacity .2s ease, transform .3s ease; }
.hb-submit__spot {
    position: absolute; inset: 0; z-index: 0;
    border-radius: inherit;
    background: radial-gradient(120px circle at var(--bx, 50%) var(--by, 50%), rgba(255, 255, 255, .55), transparent 60%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
.hb-submit:hover .hb-submit__spot { opacity: 1; }

.hb-submit.is-morphing {
    transition: width .5s cubic-bezier(.65, 0, .35, 1), margin .5s cubic-bezier(.65, 0, .35, 1),
                border-radius .5s ease, padding .5s ease, box-shadow .3s ease, transform .2s ease !important;
}
body.hb-auth .content .hb-submit.is-loading,
body.hb-auth .content .hb-submit.is-success {
    padding: 0 !important;
    border-radius: 50%;
    transform: none !important;
    cursor: default;
}
.hb-submit.is-loading .hb-submit__label,
.hb-submit.is-success .hb-submit__label { opacity: 0; transform: scale(.6); }
.hb-submit.is-loading .hb-submit__spot { opacity: 0; }

.hb-submit__dots {
    position: absolute; inset: 0; z-index: 1;
    opacity: 0;
    transition: opacity .25s ease .25s;
    pointer-events: none;
    animation: hbOrbit 1.1s linear infinite;
}
.hb-submit__dots i {
    position: absolute; top: 50%; left: 50%;
    width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: var(--hb-ink);
    animation: hbDot 1.1s ease-in-out infinite;
}
.hb-submit__dots i:nth-child(1) { transform: rotate(0deg) translateY(-13px); }
.hb-submit__dots i:nth-child(2) { transform: rotate(120deg) translateY(-13px); animation-delay: -.37s; }
.hb-submit__dots i:nth-child(3) { transform: rotate(240deg) translateY(-13px); animation-delay: -.74s; }
.hb-submit.is-loading .hb-submit__dots { opacity: 1; }
@keyframes hbOrbit { to { rotate: 360deg; } }
@keyframes hbDot { 50% { scale: .55; opacity: .6; } }

.hb-submit__check {
    position: absolute; top: 50%; left: 50%; z-index: 1;
    font-size: 21px; line-height: 1;
    color: var(--hb-ink);
    transform: translate(-50%, -50%) scale(0) rotate(-45deg);
    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
}
.hb-submit.is-success .hb-submit__check { transform: translate(-50%, -50%) scale(1) rotate(0); }
.hb-submit.is-success { animation: hbGlow 1s ease-out; }
@keyframes hbGlow {
    0% { box-shadow: 0 0 0 0 rgba(31, 138, 99, .55); }
    100% { box-shadow: 0 0 0 22px rgba(31, 138, 99, 0); }
}

.hb-submit-status {
    margin: 0;
    min-height: 18px;
    text-align: center;
    font-size: 13px; font-weight: 500;
    color: var(--hb-muted);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .3s ease, transform .3s ease, color .3s ease;
}
.hb-submit-status.is-on { opacity: 1; transform: none; }
.hb-submit-status.is-done { color: var(--hb-jade); font-weight: 600; }

/* ---------- welcome scene ---------- */
.hb-welcome {
    position: fixed; inset: 0; z-index: 100000;
    display: grid; place-items: center;
    overflow: hidden;
    perspective: 1200px;
    color: #fff;
    font-family: var(--hb-body);
    background: radial-gradient(900px 600px at 50% 30%, rgba(190, 157, 90, .2), transparent 60%),
                linear-gradient(160deg, #122421 0%, #1b332e 70%, #17352d 100%);
    clip-path: circle(0 at var(--w-x, 50%) var(--w-y, 50%));
}
.hb-welcome.is-open { animation: hbIris .9s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes hbIris { to { clip-path: circle(150vmax at var(--w-x, 50%) var(--w-y, 50%)); } }

/* faint ledger ruling drifting upward */
.hb-welcome__rules {
    position: absolute; inset: -40px 0;
    background: repeating-linear-gradient(0deg, transparent 0 38px, rgba(255, 255, 255, .045) 38px 39px);
    animation: hbRules 6s linear infinite;
}
.hb-welcome__rules::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 12%;
    width: 2px; background: rgba(190, 157, 90, .22);
}
@keyframes hbRules { to { transform: translateY(-39px); } }

/* brass coins rising */
.hb-welcome__coins i {
    position: absolute; bottom: -30px;
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(145deg, #e3c88d, #be9d5a 50%, #a8853f);
    box-shadow: 0 0 10px rgba(190, 157, 90, .55);
    animation: hbCoinRise 3.2s ease-in infinite;
    opacity: 0;
}
.hb-welcome__coins i:nth-child(1) { left: 8%; animation-delay: .4s; }
.hb-welcome__coins i:nth-child(2) { left: 22%; animation-delay: 1.3s; width: 10px; height: 10px; }
.hb-welcome__coins i:nth-child(3) { left: 38%; animation-delay: .8s; }
.hb-welcome__coins i:nth-child(4) { left: 64%; animation-delay: 1.7s; width: 12px; height: 12px; }
.hb-welcome__coins i:nth-child(5) { left: 79%; animation-delay: .6s; }
.hb-welcome__coins i:nth-child(6) { left: 92%; animation-delay: 1.1s; width: 10px; height: 10px; }
@keyframes hbCoinRise {
    0% { transform: translateY(0) rotateY(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateY(-105vh) rotateY(720deg); opacity: 0; }
}

.hb-welcome__stage {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    width: min(520px, calc(100vw - 32px));
}

/* the emblem with the module tiles circling it on a tilted ellipse */
.hb-welcome__orbit {
    position: relative;
    width: 300px; height: 190px;
}
.hb-welcome__orbit::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%;
    height: 110px; margin-top: -55px;
    border-radius: 50%;
    border: 1px dashed rgba(190, 157, 90, .25);
}
.hb-welcome__tile {
    position: absolute; top: 0; left: 0;
    offset-path: path('M 0 95 A 150 55 0 1 0 300 95 A 150 55 0 1 0 0 95');
    offset-rotate: 0deg;
    animation: hbPath 10s linear infinite;
    animation-delay: var(--p);
}
@keyframes hbPath {
    /* first half runs along the front of the ellipse (in front of the mark), second half behind */
    0% { offset-distance: 0%; z-index: 3; }
    50% { offset-distance: 50%; z-index: 3; }
    50.01% { z-index: 1; }
    100% { offset-distance: 100%; z-index: 1; }
}
.hb-welcome__tile > i {
    display: grid; place-items: center;
    width: 46px; height: 46px;
    border-radius: 14px;
    background: linear-gradient(145deg, #1f3f37, #132a24);
    border: 1px solid rgba(190, 157, 90, .3);
    box-shadow: 6px 6px 14px rgba(0, 0, 0, .45), -3px -3px 9px rgba(80, 130, 115, .25);
    color: #d8bc7e; font-size: 18px; font-style: normal;
    animation: hbTileIn .55s cubic-bezier(.34, 1.56, .64, 1) backwards;
    animation-delay: var(--d);
}
@keyframes hbTileIn { from { opacity: 0; transform: scale(.2); } }

.hb-welcome__mark {
    position: absolute; top: 50%; left: 50%; z-index: 2;
    width: 92px; height: 92px; margin: -46px 0 0 -46px;
    display: grid; place-items: center;
    border-radius: 28px;
    background: linear-gradient(145deg, #e3c88d, #be9d5a 45%, #a8853f);
    color: #122421;
    font-family: var(--hb-display); font-size: 50px; font-weight: 600; line-height: 1;
    box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .6), inset 0 2px 0 rgba(255, 255, 255, .55), 0 0 50px rgba(190, 157, 90, .45);
    animation: hbMarkIn .9s .45s cubic-bezier(.34, 1.56, .64, 1) backwards, hbMarkFloat 3s 1.4s ease-in-out infinite;
}
@keyframes hbMarkIn { from { opacity: 0; transform: perspective(600px) rotateY(-540deg) scale(.2); } }
@keyframes hbMarkFloat { 50% { transform: translateY(-8px); } }
@keyframes hbSpin { to { transform: rotate(360deg); } }

/* raised glass card */
.hb-welcome__card {
    position: relative;
    width: 100%;
    margin-top: 10px;
    padding: 26px 28px 24px;
    border-radius: 26px;
    text-align: center;
    background: linear-gradient(150deg, rgba(31, 63, 55, .82), rgba(17, 37, 31, .9));
    border: 1px solid rgba(190, 157, 90, .22);
    box-shadow: 14px 14px 34px rgba(0, 0, 0, .45), -8px -8px 24px rgba(54, 92, 82, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    animation: hbCardUp .8s .5s cubic-bezier(.22, .61, .36, 1) backwards;
}
@keyframes hbCardUp { from { opacity: 0; transform: translateY(40px) rotateX(18deg); } }
.hb-welcome.is-leaving .hb-welcome__card,
.hb-welcome.is-leaving .hb-welcome__orbit { animation: hbOut .45s ease-in forwards; }
@keyframes hbOut { to { opacity: 0; transform: translateY(-24px) scale(.96); } }

.hb-welcome__eyebrow {
    margin: 0 0 10px;
    font-family: var(--hb-mono); font-size: 11.5px; letter-spacing: .18em;
    color: #be9d5a;
}
.hb-welcome__title {
    margin: 0 0 6px;
    font-family: var(--hb-display); font-size: clamp(26px, 4vw, 34px); font-weight: 600; line-height: 1.15;
    color: #fff;
}
.hb-welcome__title span {
    background: linear-gradient(100deg, #be9d5a 20%, #f3dfae 45%, #be9d5a 70%);
    background-size: 220% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: hbSheen 2.4s 1s ease-in-out infinite;
}
@keyframes hbSheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.hb-welcome__sub { margin: 0 0 18px; font-size: 14.5px; color: rgba(255, 255, 255, .72); }

.hb-welcome__steps {
    list-style: none;
    margin: 0 auto 18px; padding: 0;
    width: fit-content;
    text-align: left;
}
.hb-welcome__steps li {
    display: flex; align-items: center; gap: 11px;
    padding: 5px 0;
    font-size: 14px; color: rgba(255, 255, 255, .85);
    opacity: 0; transform: translateX(-10px);
    transition: opacity .35s ease, transform .35s ease;
}
.hb-welcome__steps li.is-in { opacity: 1; transform: none; }
.hb-welcome__steps b {
    position: relative; flex: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: #10231e;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .5), inset -2px -2px 4px rgba(80, 130, 115, .25);
}
.hb-welcome__steps b::before {
    content: ""; position: absolute; inset: 3px;
    border-radius: 50%;
    border: 2px solid rgba(190, 157, 90, .25); border-top-color: #be9d5a;
    animation: hbSpin .8s linear infinite;
}
.hb-welcome__steps li.is-done b { background: #1f8a63; box-shadow: 0 0 10px rgba(31, 138, 99, .6); }
.hb-welcome__steps li.is-done b::before {
    inset: 5px 6px 7px 6px;
    border: solid #fff; border-width: 0 2px 2px 0; border-radius: 0;
    transform: rotate(45deg);
    animation: none;
}

.hb-welcome__bar {
    height: 8px; border-radius: 8px;
    background: #10231e;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .5), inset -2px -2px 4px rgba(80, 130, 115, .2);
    overflow: hidden;
}
.hb-welcome__bar i {
    display: block; height: 100%; width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #a8853f, #e3c88d);
    box-shadow: 0 0 12px rgba(190, 157, 90, .7);
    animation: hbFill 2.6s .7s cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes hbFill { to { width: 100%; } }

@media (max-width: 480px) {
    .hb-welcome__orbit { transform: scale(.8); margin: -18px 0; }
    .hb-welcome__mark { width: 74px; height: 74px; margin: -37px 0 0 -37px; font-size: 40px; border-radius: 22px; }
    .hb-welcome__card { padding: 22px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .hb-welcome { display: none; }
}
