/*!
 * Sign-in / registration dialog.
 * Frame artwork: assets/img/auth/auth-frame.png. The form is placed over it
 * in percentages so it holds its position as the dialog scales.
 */
/* Measured off the artwork: panel spans 31.9%-69.6%, from 18.5% down. */
.auth-modal {
    --frame-ratio: 1406 / 709;   /* artwork's own proportions */
    --form-left: 35.8%;          /* centres the column on the panel's 50.8% */
    --form-width: 30%;           /* inset inside the panel's 37.7% */
    --form-top: 23%;             /* clear of the title worked into the art */
    --form-bottom: 8%;

    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 2147482000;         /* under the navigation loader, over the page */
}

.auth-modal[hidden] {
    display: none;
}

/* The page keeps its scroll position; only the scrolling is stopped. */
body.auth-modal-open {
    overflow: hidden;
}

.auth-modal__backdrop {
    backdrop-filter: blur(3px);
    background: rgba(6, 9, 14, 0.72);
    inset: 0;
    position: absolute;
}

.auth-modal__dialog {
    animation: auth-modal-in 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
    max-height: calc(100vh - 48px);
    max-width: 1280px;
    overflow: auto;
    position: relative;
    width: 100%;
}

@keyframes auth-modal-in {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal__dialog {
        animation: none;
    }
}

.auth-modal__close {
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 26px;
    height: 38px;
    line-height: 1;
    position: absolute;
    right: 8px;
    top: 8px;
    width: 38px;
    z-index: 3;
}

.auth-modal__close:hover {
    background-color: rgba(0, 0, 0, 0.66);
}

/* Sits on the diamond boss at 97.3% / 16.6% of the 1406x709 artwork. */
@media (min-width: 901px) {
    .auth-modal__close {
        aspect-ratio: 71 / 72;   /* the supplied artwork's own proportions */
        background: url('../../img/close.png') center / contain no-repeat;
        border-radius: 0;
        font-size: 0;            /* the cross is drawn into the image */
        height: auto;
        left: 97.3%;
        padding: 0;
        right: auto;
        top: 16.6%;
        transform: translate(-50%, -50%);
        transition: filter 120ms ease, transform 120ms ease;
        width: 4.2%;             /* just over the boss, so it covers it cleanly */
    }

    .auth-modal__close:hover {
        background-color: transparent;
        filter: brightness(1.18);
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal__close {
        transition: none;
    }
}

/* Bootstrap's reboot rings every focused button; keep it for keyboard only. */
.auth-modal__dialog :focus {
    outline: 0;
}

.auth-modal__dialog :focus-visible:not(.auth-modal__input) {
    outline: 2px solid #b99a4e;
    outline-offset: 2px;
}

/* The artwork is the panel; no fill behind it. */
.auth-modal__frame {
    aspect-ratio: var(--frame-ratio);
    background: url('../../img/auth/auth-frame.png') center / contain no-repeat;
    position: relative;
    width: 100%;
}

/* Heading is in the artwork; kept in the markup for screen readers. */
.auth-modal__title {
    clip-path: inset(50%);
    height: 1px;
    margin: 0;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Bounded top and bottom rather than only from the top, so the sign-in form —
   two fields against the register form's six — sits centred in the panel
   instead of leaving the lower half of it empty. */
.auth-modal__body {
    bottom: var(--form-bottom);
    display: flex;
    flex-direction: column;
    gap: 2.4%;
    justify-content: center;
    left: var(--form-left);
    position: absolute;
    top: var(--form-top);
    width: var(--form-width);
}

/* The tab row belongs at the top of the panel, not floated with the fields. */
.auth-modal__body > .auth-modal__tabs {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
}

.auth-modal__form {
    display: flex;
    flex-direction: column;
    gap: 2.4%;
}

.auth-modal__tabs {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-bottom: 3.4%;
}

.auth-modal__tab {
    background: none;
    border: 0;
    color: #8b8f96;
    cursor: pointer;
    font-size: clamp(12px, 1.15vw, 16px);
    font-weight: 600;
    padding: 2px 0;
}

.auth-modal__tab.is-active {
    border-bottom: 2px solid #b99a4e;
    color: #2f3440;
}

.auth-modal__tab-divider {
    background: #c9ccd2;
    height: 16px;
    width: 1px;
}

.auth-modal__note {
    color: #c0392b;
    font-size: clamp(9px, 0.78vw, 12px);
    line-height: 1.5;
    margin: 0;
}

.auth-modal__alert {
    background: #fdecea;
    border: 1px solid #f5c2bd;
    border-radius: 5px;
    color: #a2302a;
    font-size: clamp(10px, 0.85vw, 13px);
    padding: 7px 10px;
}

.auth-modal__alert[hidden] {
    display: none;
}

.auth-modal__field {
    position: relative;
}

.auth-modal__input {
    background: #fbfbfc;
    border: 1px solid #cfd3d9;
    border-radius: 4px;
    color: #23272f;
    font-family: inherit;
    font-size: clamp(11px, 0.95vw, 15px);
    padding: 3.4% 6%;
    width: 100%;
}

.auth-modal__input::placeholder {
    color: #a6abb3;
}

.auth-modal__input:focus {
    border-color: #b99a4e;
    box-shadow: 0 0 0 3px rgba(185, 154, 78, 0.16);
    outline: 0;
}

.auth-modal__reveal {
    background: none;
    border: 0;
    color: #8b8f96;
    cursor: pointer;
    padding: 0 10px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.auth-modal__field--captcha {
    align-items: stretch;
    display: flex;
    gap: 8px;
}

.auth-modal__captcha {
    background: #fff;
    border: 1px solid #cfd3d9;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 38%;
    line-height: 0;
    overflow: hidden;
    padding: 0;
}

.auth-modal__captcha img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.auth-modal__terms {
    align-items: flex-start;
    color: #5c626c;
    display: flex;
    font-size: clamp(9px, 0.75vw, 12px);
    gap: 7px;
    line-height: 1.45;
    margin: 1% 0 0;
}

.auth-modal__terms input {
    flex: 0 0 auto;
    margin-top: 2px;
}

.auth-modal__submit {
    background: linear-gradient(180deg, #c9ad6b 0%, #a98c46 100%);
    border: 0;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(12px, 1.1vw, 17px);
    font-weight: 700;
    margin-top: 2%;
    padding: 3.8% 0;
    width: 100%;
}

.auth-modal__submit:hover:not(:disabled) {
    filter: brightness(1.06);
}

.auth-modal__submit:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.auth-modal__link {
    color: #8b7333;
    font-size: clamp(9px, 0.78vw, 12px);
    text-align: center;
}

/* Below the artwork's width the frame steps aside for a plain panel. */
@media (max-width: 900px) {
    .auth-modal__frame {
        aspect-ratio: auto;
        background: #f4f5f7;
        border-radius: 10px;
        padding: 26px 20px 30px;
    }

    /* Without the artwork there is nothing carrying the heading, so it comes
       back as real text here. */
    .auth-modal__title {
        clip-path: none;
        color: #6b5a2e;
        font-size: 18px;
        height: auto;
        overflow: visible;
        position: static;
        text-align: center;
        white-space: normal;
        width: auto;
    }

    .auth-modal__body {
        gap: 12px;
        left: auto;
        margin-top: 18px;
        position: static;
        top: auto;
        width: 100%;
    }

    .auth-modal__input {
        font-size: 15px;    /* at or above 16px iOS does not zoom on focus */
        padding: 11px 13px;
    }

    .auth-modal__submit {
        font-size: 16px;
        padding: 13px 0;
    }

    .auth-modal__note,
    .auth-modal__terms,
    .auth-modal__link {
        font-size: 12px;
    }
}
