/* Sign-in / sign-up pages (HAAC-91). Only used by Layout/SignInLayout.razor. The rest of the site
   takes its colours, font and button finish from these (app.css, HAAC-105). */

/* Nunito's @font-face is in app.css (every page uses it since HAAC-105). */

.signin {
    --signin-ink: #110E3B;
    --signin-label: #14123A;
    --signin-muted: #3D3A66;
    --signin-link: #1736E6;
    --signin-field-border: #C9C4EC;
    --signin-field-focus: #4B3FE0;
    --signin-error: #B32121;
    --signin-brand-gradient: linear-gradient(90deg, #2A8DF6 0%, #1F5CD6 30%, #3B2BC8 55%, #9A2F9A 78%, #EE3F7E 100%);
    --signin-button-gradient: linear-gradient(90deg, #12D2F4 0%, #1677F2 45%, #1C1BE0 100%);
    --signin-art-gradient: linear-gradient(160deg, #18C8F0 0%, #2266E8 30%, #2A26C8 60%, #6B22CE 82%, #B92CD6 100%);

    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    color: var(--signin-ink);
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Stacked (phone / tablet): form, art, footer. */
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "main"
        "art"
        "footer";
}

/* Side by side (desktop): the art gets a bit under half the width, like the mockup. */
@media (min-width: 1024px) {
    .signin {
        grid-template-columns: minmax(520px, 1.25fr) 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "main art"
            "footer art";
    }
}

.signin-main {
    grid-area: main;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.25rem 2rem;
}

.signin-form-wrap {
    width: 100%;
    max-width: 30rem;
}

/* ---- Logo lockup ---- */

.hubvi-lockup {
    text-align: center;
    margin-bottom: 1.75rem;
}

.hubvi-lockup-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.hubvi-lockup-symbol {
    width: clamp(3.5rem, 12vw, 5rem);
    height: auto;
}

.hubvi-lockup-wordmark {
    font-size: clamp(3.4rem, 13vw, 5rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.02em;
    /* Room for the descender-less wordmark's bottom edge so the clip doesn't nip it. */
    padding-bottom: 0.08em;
    background: var(--signin-brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hubvi-lockup-tagline {
    margin: 0.2rem 0 0;
    font-size: clamp(1.15rem, 4.4vw, 1.5rem);
    font-weight: 800;
    color: var(--signin-ink);
}

/* ---- Form ---- */

.signin-title {
    margin: 0 0 1.5rem;
    text-align: center;
    font-size: clamp(1.6rem, 6vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--signin-ink);
}

.signin-error {
    margin: 0 0 1rem;
    color: var(--signin-error);
    font-weight: 700;
}

.signin-field {
    margin-bottom: 1.1rem;
}

.signin-field > label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 800;
    color: var(--signin-label);
}

.signin-input {
    position: relative;
    display: flex;
    align-items: center;
}

.signin-input input {
    width: 100%;
    min-height: 3rem;
    padding: 0.6rem 3rem 0.6rem 3rem;
    border: 1.5px solid var(--signin-field-border);
    border-radius: 8px;
    background: #fff;
    color: var(--signin-ink);
    font: inherit;
    font-size: 1rem;
}

.signin-input--plain input {
    padding-left: 1rem;
}

.signin-input input::placeholder {
    color: #4A4775;
    opacity: 1;
}

.signin-input input:focus {
    outline: none;
    border-color: var(--signin-field-focus);
    box-shadow: 0 0 0 3px rgba(75, 63, 224, 0.2);
}

.signin-input-icon {
    position: absolute;
    left: 1rem;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--signin-ink);
    pointer-events: none;
}

.signin-input-action {
    position: absolute;
    right: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--signin-muted);
    cursor: pointer;
}

.signin-input-action .fa-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.signin-input-action:hover {
    color: var(--signin-ink);
}

.signin-input-action:focus-visible {
    outline: 3px solid rgba(75, 63, 224, 0.45);
}

/* Blazor's validation classes: no green "valid" outline here, a red border when invalid. */
.signin-input input.valid.modified,
.signin-input input.invalid {
    outline: none;
}

.signin-input input.invalid {
    border-color: var(--signin-error);
}

.signin-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin: 0.25rem 0 1.4rem;
}

.signin-check {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--signin-label);
    cursor: pointer;
}

.signin-check input {
    width: 1.35rem;
    height: 1.35rem;
    margin: 0;
    accent-color: var(--signin-field-focus);
    cursor: pointer;
}

.signin-choice {
    margin: 0 0 1.4rem;
    padding: 0;
    border: 0;
}

.signin-choice legend {
    margin-bottom: 0.4rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--signin-label);
}

.signin-choice .signin-check {
    display: flex;
    margin-bottom: 0.45rem;
}

.signin-choice.invalid-choice legend {
    color: var(--signin-error);
}

.signin-submit {
    width: 100%;
    min-height: 3rem;
    border: 0;
    border-radius: 8px;
    background: var(--signin-button-gradient);
    color: #fff;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(28, 27, 224, 0.22);
}

.signin-submit:hover:not(:disabled) {
    filter: brightness(1.07);
}

.signin-submit:focus-visible {
    outline: 3px solid #90CAF9;
    outline-offset: 2px;
}

.signin-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.signin-switch {
    margin: 1.4rem 0 0;
    text-align: center;
    font-size: 1.05rem;
    color: var(--signin-ink);
}

.signin-switch a,
.signin-link {
    margin-left: 0.4rem;
    color: var(--signin-link);
    font-weight: 800;
    text-decoration: none;
}

.signin-switch a:hover,
.signin-link:hover {
    text-decoration: underline;
}

/* Sign-up agreement line (HAAC-98). */
.signin-legal {
    margin: 0.2rem 0 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--signin-muted);
}

.signin-legal a {
    color: var(--signin-link);
    font-weight: 700;
}

/* ---- Footer ---- */

.signin-footer {
    grid-area: footer;
    padding: 1rem 1.25rem 1.5rem;
}

.signin-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 0;
    max-width: 34rem;
    margin: 0 auto;
    padding-top: 1rem;
}

@media (min-width: 1024px) {
    .signin-footer nav {
        border-top: 1px solid #E4E2F2;
    }
}

.signin-footer a {
    padding: 0.25rem clamp(0.45rem, 2vw, 1.1rem);
    color: #2A2760;
    font-size: clamp(0.82rem, 3.4vw, 0.92rem);
    font-weight: 600;
    text-decoration: none;
}

/* The "|" separators between links, desktop only (the mockup's stacked layouts don't have them). */
@media (min-width: 1024px) {
    .signin-footer a + a {
        border-left: 1.5px solid #B9B6D6;
    }
}

.signin-footer a:hover {
    text-decoration: underline;
}

/* ---- Art panel (HAAC-94) ---- */

.signin-art {
    grid-area: art;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: clamp(30rem, 118vw, 50rem);
    background: #fff;
}

@media (min-width: 1024px) {
    /* Exactly the window's height, and it stays put while a taller form column scrolls past
       (short windows). The drawing is laid out in proportion to this height, so stretching the
       panel to a taller page would shift the waves against the headline. */
    .signin-art {
        min-height: 0;
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        height: 100dvh;
    }
}

/* The layered waves fill the panel; only one drawing shows at a time. */
.signin-art-waves {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.signin-art-waves--side {
    display: none;
}

@media (min-width: 1024px) {
    .signin-art-waves--side {
        display: block;
    }

    .signin-art-waves--top {
        display: none;
    }
}

/* Headline + swoosh, sitting on the front wave below its top edge. On desktop it's nudged right
   so it centres on the front wave rather than the whole panel (whose left part is the edge). */
.signin-art-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: clamp(5.5rem, 22vw, 9.5rem) 1.25rem 0;
}

@media (min-width: 1024px) {
    .signin-art-content {
        /* Near the top, as in the mockup; the blue area's edge curves up round the icon arc below. */
        padding: clamp(4rem, 9vh, 6.5rem) 1.5rem 0 max(clamp(6rem, 12vw, 11rem), 26%);
    }
}

.signin-art-headline {
    margin: 0;
    color: #fff;
    text-align: center;
    font-size: clamp(2.6rem, 10.5vw, 4.4rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.01em;
    text-shadow: 0 4px 18px rgba(20, 10, 90, 0.35);
}

@media (min-width: 1024px) {
    .signin-art-headline {
        /* Capped by height too, so on short, wide windows it stays clear of the blue area below. */
        font-size: min(clamp(2.8rem, 4.4vw, 4.6rem), 7vh);
    }
}

.signin-art-swoosh {
    width: min(78%, 22rem);
    height: clamp(1rem, 3vw, 1.6rem);
    margin-top: 0.7rem;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

/* Headline first, then the picture filling the rest of the panel (HAAC-95). */
.signin-art-content {
    order: 1;
}

.signin-art-scene {
    order: 3;
    position: relative;
    /* The network graph's node count follows the scene's own width (HAAC-96). */
    container-type: inline-size;
    flex: 1 1 auto;
    align-self: stretch;
    min-height: 15rem;
    /* Tuck the faded top of the picture up under the swoosh. */
    margin-top: clamp(-4rem, -7vw, -2rem);
}

.signin-art-scene img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    /* The sky fades into the waves behind it. */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
}

@media (min-width: 1024px) {
    /* Side by side: start right of the wave bands, and fade the left edge into the front wave. */
    /* Anchored to the bottom at a near-square shape, so cropping keeps the villages at both sides
       (and the network graph, which follows the same crop). The icon arc (HAAC-97) sits on top of
       it; the space above, under the headline, is where the blue area's edge curves round. */
    .signin-art-scene {
        flex: 0 0 auto;
        aspect-ratio: 1.12;
        max-height: 72%;
        margin-left: max(clamp(4.5rem, 9vw, 8.5rem), 21%);
    }

    .signin-art-scene img {
        -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 15%), linear-gradient(to right, transparent 0, #000 18%);
        -webkit-mask-composite: source-in;
        mask-image: linear-gradient(to bottom, transparent 0, #000 15%), linear-gradient(to right, transparent 0, #000 18%);
        mask-composite: intersect;
    }
}

/* Front-most layer: the purple floor wave over the bottom of the picture. */
.signin-art-floor {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    width: 100%;
    height: clamp(1.75rem, 7%, 4.5rem);
    z-index: 2;
}

@media (min-width: 1024px) {
    /* An SVG with width: auto takes its natural width rather than stretching between left and
       right, so the width is spelled out. */
    .signin-art-floor {
        left: max(clamp(4.5rem, 9vw, 8.5rem), 21%);
        width: calc(100% - max(clamp(4.5rem, 9vw, 8.5rem), 21%));
    }
}

/* ---- Network graph over the picture (HAAC-96) ---- */

.signin-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Same fade as the picture, so nodes don't float in the sky's fade-out. */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
}

.sn-edge-glow {
    fill: none;
    stroke: #FFD45A;
    stroke-width: 22;
    stroke-linecap: round;
    opacity: 0.55;
}

.sn-edge-line {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
}

.sn-stem {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 5;
}

.sn-foot {
    fill: #fff;
}

.sn-halo {
    fill: rgba(140, 200, 255, 0.85);
}

.sn-ring {
    fill: #fff;
}

/* Tiers: 1 always; 2 from a medium-width scene; 3 when wide. Edge sets follow the same steps. */
.sn-t2,
.sn-t3,
.sn-edge {
    display: none;
}

.sn-edge.sn-e1 {
    display: inline;
}

@container (min-width: 480px) {
    .sn-t2 {
        display: inline;
    }

    .sn-edge {
        display: none;
    }

    .sn-edge.sn-e2 {
        display: inline;
    }
}

@container (min-width: 700px) {
    .sn-t3 {
        display: inline;
    }

    .sn-edge {
        display: none;
    }

    .sn-edge.sn-e3 {
        display: inline;
    }
}

/* ---- Icon arc between the headline and the picture (HAAC-97) ---- */

/* Desktop only, as in the mockups; the stacked layouts go straight to the picture. */
.signin-arc {
    display: none;
    order: 2;
}

.signin-arc svg {
    display: block;
    width: 100%;
    height: auto;
}

.sarc-line {
    fill: none;
    stroke-width: 4;
}

.sarc-glow {
    fill: none;
    stroke: #8FEAFF;
    stroke-width: 14;
    opacity: 0.45;
}

.sarc-halo {
    opacity: 0.55;
}

/* One layout per badge count; the arc's own width picks which. */
.sarc-set {
    display: none;
}

.sarc-n4 {
    display: inline;
}

@container (min-width: 420px) {
    .sarc-set { display: none; }
    .sarc-n5 { display: inline; }
}

@container (min-width: 560px) {
    .sarc-set { display: none; }
    .sarc-n6 { display: inline; }
}

@container (min-width: 700px) {
    .sarc-set { display: none; }
    .sarc-n7 { display: inline; }
}

/* Shown when side by side and there's height for it. It takes the free space above it, and its
   lower ends dip into the picture's faded sky so it reads as a dome over the valley. */
@media (min-width: 1024px) and (min-height: 800px) {
    .signin-arc {
        display: block;
        position: relative;
        z-index: 1;
        container-type: inline-size;
        align-self: stretch;
        margin: auto 0 -9% max(clamp(4.5rem, 9vw, 8.5rem), 21%);
        padding: 0 4%;
    }

    .signin-arc + .signin-art-scene {
        margin-top: 0;
    }
}

/* Floor wave shapes: full width when stacked; on desktop its left end dives off the bottom. */
.signin-art-floor-taper {
    display: none;
}

@media (min-width: 1024px) {
    .signin-art-floor-full {
        display: none;
    }

    .signin-art-floor-taper {
        display: inline;
    }
}

/* ---- "Get the app" store badges (HAAC-104) ---- */

.get-the-app {
    margin-top: 1.6rem;
    padding-top: 1.3rem;
    border-top: 1px solid #E4E2F2;
    text-align: center;
}

.get-the-app-title {
    margin: 0 0 0.8rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--signin-muted);
}

.get-the-app-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem 1rem;
}

.get-the-app-badge {
    display: inline-flex;
    border-radius: 8px;
}

.get-the-app-badge:focus-visible {
    outline: 3px solid rgba(75, 63, 224, 0.45);
    outline-offset: 2px;
}

.get-the-app-badge img {
    display: block;
    width: auto;
}

/* Apple's badge has no padding; Google's PNG has transparent padding built in, so it's drawn
   taller with negative margins to sit at the same visible height (about 44px). */
.get-the-app-badge--apple img {
    height: 44px;
}

.get-the-app-badge--google img {
    height: 65px;
    margin: -10.5px -9px;
}
