/*
 * The sign-in form in index.html. It stands in for a Compose screen and has to look like one, so
 * every size here is the one Material 3 and the portal's theme gave that screen: the colours are
 * PortalColors, a px is a dp, and text is bodyLarge (16px on 24px, 0.5px tracking) wherever the
 * screen did not say otherwise.
 */

/*
 * The Roboto that Compose draws the canvas with, byte for byte: Skiko embeds this one file in
 * skiko.wasm and has no other face. SemiBold text is synthesised from it, on the canvas and here.
 */
@font-face {
    font-family: "Portal Roboto";
    src: url("fonts/Roboto-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

.signin {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 24px;
    background: #000000;
    color: #ECE6F0;
    color-scheme: dark;
    font-family: "Portal Roboto", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.5px;
}

.signin[hidden] {
    display: none;
}

/* margin: auto centres the column, and still lets a short window scroll to its top. */
.signin__form {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    margin: auto;
}

.signin__form > *,
.signin__brand > * {
    margin: 0;
}

.signin__form > * + * {
    margin-top: 18px;
}

.signin__brand {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.signin__name {
    font-size: 16px;
    font-weight: 600;
    color: #ECE6F0;
}

.signin__product {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #B9B3C1;
}

/* Compose gives a line shorter than its font the font's own height, which is 38px here. */
.signin__title {
    font-size: 32px;
    font-weight: 400;
    line-height: 38px;
    color: #ECE6F0;
}

/*
 * The outlined field. Its text starts 16px in, whatever the width of the outline. The 8px above
 * the outline is where the label sits once it moves up, hiding the outline behind it with the
 * page's own black.
 */
.signin__field {
    position: relative;
    padding-top: 8px;
}

.signin__input {
    display: block;
    width: 100%;
    height: 56px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 15px;
    border: 1px solid #5A5563;
    border-radius: 4px;
    outline: none;
    background: transparent;
    color: #ECE6F0;
    caret-color: #A777C7;
    font: inherit;
    letter-spacing: inherit;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.signin__input:focus {
    border-width: 2px;
    border-color: #A777C7;
    padding: 0 14px;
}

.signin__input::placeholder {
    color: transparent;
}

.signin__input::selection {
    background: rgba(167, 119, 199, 0.4);
}

/* A password manager's fill keeps the field black, not the browser's tint for filled fields. */
.signin__input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #000000 inset;
    -webkit-text-fill-color: #ECE6F0;
    caret-color: #A777C7;
}

.signin__label {
    position: absolute;
    top: 24px;
    left: 12px;
    padding: 0 4px;
    background: #000000;
    color: #B9B3C1;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
    pointer-events: none;
    transition-property: top, font-size, line-height, letter-spacing, color;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focused or holding text, the label is bodySmall on the outline. */
.signin__input:focus + .signin__label,
.signin__input:not(:placeholder-shown) + .signin__label {
    top: 0;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
}

/* Apart from the rule above, because a browser that does not know :-webkit-autofill drops the
   whole rule it appears in. */
.signin__input:-webkit-autofill + .signin__label {
    top: 0;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
}

.signin__input:focus + .signin__label {
    color: #A777C7;
}

.signin__row {
    display: flex;
    justify-content: flex-end;
}

.signin__text-button,
.signin__submit {
    box-sizing: border-box;
    padding: 11px 18px;
    border: 0;
    border-radius: 9999px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: default;
}

.signin__text-button {
    margin: 0;
    background: transparent;
    color: #A777C7;
}

.signin__text-button[aria-disabled="true"] {
    color: #5A5563;
}

.signin__submit {
    width: 100%;
    background-color: #A777C7;
    color: #381E72;
}

/* Material's hover and press layers, in the content colour Compose used for them: black. */
.signin__submit:not([aria-disabled="true"]):hover {
    background-image: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08));
}

.signin__submit:not([aria-disabled="true"]):active {
    background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1));
}

.signin__submit[aria-disabled="true"] {
    background-color: #32303C;
    color: #5A5563;
}

.signin__text-button:focus-visible,
.signin__submit:focus-visible {
    outline: 2px solid #D4BBFF;
    outline-offset: 2px;
}

/* The two messages take their place in the column only while they have something to say, and
   stay in the page when empty so a screen reader announces them as they arrive. */
.signin__form > .signin__messages {
    margin-top: 0;
}

.signin__message {
    margin: 0;
    color: #B9B3C1;
    font-size: 13px;
    line-height: 18px;
}

.signin__message:not(:empty) {
    margin-top: 18px;
}

.signin__message--error {
    color: #F2B8B5;
}

.signin__footnote {
    color: #B9B3C1;
    font-size: 13px;
    line-height: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .signin__input,
    .signin__label {
        transition: none;
    }
}
