@font-face {
    font-family: Inter;
    src: url("../fonts/inter-login-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 720;
    font-display: swap;
}

:root {
    color-scheme: dark;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #eef5fb;
    background: #081522;
    --ice: #83d8ff;
    --rim: #425769;
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-layout {
    --page-edge: clamp(1rem, 5vw, 2.2rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(min-content, .66fr) auto minmax(min-content, 1fr);
    gap: clamp(1.2rem, 3.2vh, 1.8rem);
    justify-items: center;
    position: relative;
    isolation: isolate;
    overflow: clip;
    min-height: 100vh;
    min-height: 100svh;
    padding: max(1.5rem, env(safe-area-inset-top)) max(var(--page-edge), env(safe-area-inset-right))
             max(1rem, env(safe-area-inset-bottom)) max(var(--page-edge), env(safe-area-inset-left));
    background: radial-gradient(ellipse at 15% 0%, #1b344a, transparent 58%),
                linear-gradient(145deg, #101e2e, #071421 70%);
}
.login-layout::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: -1;
    background: repeating-radial-gradient(ellipse 98% 61% at 120% 106%,
        transparent 0 2.5rem, #71aece20 2.53rem, transparent 2.61rem 3.3rem);
    mask-image: linear-gradient(146deg, transparent 43%, #0009 85%);
}
.scene { display: none; }
.brand {
    align-self: end;
    display: flex;
    align-items: center;
    gap: clamp(.8rem, 4.1vw, 1.45rem);
    width: min(100%, 27.5rem);
    padding-inline: .2rem;
}
.brand img {
    display: block;
    width: clamp(9.5rem, 43vw, 13.3rem);
    height: auto;
    filter: drop-shadow(0 2px 8px #02091363);
}
.brand p {
    max-width: 8.5rem;
    border-inline-start: 1px solid #aac5d873;
    padding: .28rem 0 .28rem clamp(.65rem, 3.4vw, 1.2rem);
    color: #dce9f3;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.38;
    letter-spacing: .012em;
}

.access {
    position: relative;
    align-self: center;
    width: min(100%, 27.5rem);
    border: 1px solid #69879f70;
    border-radius: 1.22rem;
    padding: clamp(1.32rem, 5.3vw, 2.25rem);
    background: linear-gradient(143deg, #1a2e40f5, #102233f5 53%, #0c1c2bf5);
    box-shadow: 0 20px 65px -28px #01060dd4, inset 0 1px #e5f5ff0b;
}
.access::before {
    content: "";
    position: absolute;
    left: 7%;
    right: 7%;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8bd9f9a6 23%, #e0f4fb70 45%, transparent);
}
.access-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
h1 { font-size: clamp(1.26rem, 1.45vw, 1.5rem); font-weight: 620; line-height: 1.25; letter-spacing: -.035em; }
.seal {
    display: grid;
    place-items: center;
    width: 2.23rem;
    height: 2.23rem;
    flex: none;
    border: 1px solid #72b3d84a;
    border-radius: .63rem;
    color: #9fdaf4;
    background: #77c6f00c;
}
.lock {
    display: inline-block;
    position: relative;
    width: .88rem;
    height: .68rem;
    border: 1.5px solid currentColor;
    border-radius: .17rem;
}
.lock::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    width: .54rem;
    height: .42rem;
    border: 1.5px solid currentColor;
    border-bottom: 0;
    border-radius: .4rem .4rem 0 0;
}
.seal .lock { transform: translateY(2px); }
.seal .lock::after {
    content: ""; position: absolute; left: calc(50% - 1px); top: 24%;
    width: 2px; height: 45%; border-radius: 2px; background: currentColor;
}
form { margin-top: 1.65rem; }
.field + .field { margin-top: 1.06rem; }
.field label { display: block; color: #e4edf5; font-size: .915rem; font-weight: 560; line-height: 1.45; }
.input-shell { position: relative; margin-top: .4rem; color: #92abbe; }
.control {
    display: block;
    width: 100%;
    min-height: 3.15rem;
    border: 1px solid var(--rim);
    border-radius: .62rem;
    padding: .72rem .85rem .72rem 2.65rem;
    color: #f2f7fb;
    background: #0a1927;
    font-size: 1rem;
    line-height: 1.45;
    transition: border-color .16s, box-shadow .16s;
}
.control::placeholder { color: #9eadba; opacity: 1; }
.control:hover { border-color: #708798; }
.control:focus { outline: none; border-color: var(--ice); box-shadow: 0 0 0 3px #75ceff27; }
.control:-webkit-autofill {
    -webkit-text-fill-color: #f2f7fb;
    caret-color: #f2f7fb;
    -webkit-box-shadow: inset 0 0 0 4rem #142a3c;
}
.input-shell:focus-within { color: var(--ice); }
.field-icon { position: absolute; pointer-events: none; left: 1rem; top: 50%; transform: translateY(-50%); }
.field-icon.lock { transform: translateY(-28%); }
.envelope { width: 1rem; height: .76rem; border: 1.5px solid currentColor; border-radius: .15rem; overflow: hidden; }
.envelope::before {
    content: ""; position: absolute; width: .69rem; height: .69rem; left: 50%; top: -.43rem;
    border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateX(-50%) rotate(45deg);
}
.password-control .control { padding-right: 5.2rem; }
.password-toggle {
    position: absolute; right: .24rem; top: 50%; transform: translateY(-50%);
    min-height: 2.75rem; border: 0; border-radius: .42rem; background: transparent;
    color: #c4d8e7; padding: 0 .67rem; font-size: .875rem; font-weight: 550;
}
.password-toggle:hover { color: #fff; background: #23394b; }
.remember {
    display: flex; gap: .62rem; align-items: center; width: fit-content; min-height: 2.75rem;
    margin-top: .4rem; color: #cbd7e1; font-size: .9rem; cursor: pointer;
}
.remember input { margin: 0; width: 1.05rem; height: 1.05rem; accent-color: #80ccff; cursor: pointer; }
.submit {
    width: 100%; min-height: 3.15rem; margin-top: .53rem; padding: .72rem 1rem;
    border: 1px solid #54a8f4; border-radius: .64rem;
    background: linear-gradient(110deg, #1169c7, #0c58ae 70%, #084d9c);
    box-shadow: inset 0 1px #c9edff24, 0 6px 17px #00102238;
    color: #fff; font-size: 1rem; font-weight: 640; line-height: 1.45;
    transition: border-color .16s, box-shadow .16s;
}
.submit:hover { border-color: #a3e2ff; box-shadow: inset 0 0 0 20rem #298dff26, 0 6px 17px #00102238; }
.submit:active { box-shadow: inset 0 0 0 20rem #0029474a; }
button:focus-visible, input[type="checkbox"]:focus-visible { outline: 3px solid var(--ice); outline-offset: 3px; }
.error { color: #ffe2dc; background: #422a2e; border-inline-start: 3px solid #ff9a84; border-radius: .4rem; margin-top: 1.25rem; padding: .72rem .88rem; font-size: .91rem; line-height: 1.45; }
.error + form { margin-top: 1.1rem; }
.publisher {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    align-self: end; width: min(100%, 27.5rem); padding: .45rem .18rem 0;
    color: #b5c5d2; font-size: .8rem; line-height: 1.5;
}
.publisher::after {
    content: ""; width: 1.8rem; height: .38rem;
    background: repeating-linear-gradient(126deg, #8bbbd0 0 2px, transparent 2px 7px);
}

/* A paisagem pertence à janela inteira. Somente o formulário tem largura máxima. */
@media (min-width: 48rem) and (min-height: 32.01rem), (min-width: 64.01rem) {
    .login-layout {
        --page-edge: clamp(2.25rem, 6.25vw, 24rem);
        grid-template-columns: minmax(0, 1fr) clamp(23.5rem, 30vw, 28.5rem);
        grid-template-rows: auto minmax(min-content, 1fr) auto;
        column-gap: clamp(1.6rem, 5vw, 8rem);
        row-gap: 1rem;
        justify-items: stretch;
        padding: max(clamp(1.6rem, 5.7vh, 6.8rem), env(safe-area-inset-top))
                 max(var(--page-edge), env(safe-area-inset-right))
                 max(clamp(1.15rem, 3.3vh, 4.3rem), env(safe-area-inset-bottom))
                 max(var(--page-edge), env(safe-area-inset-left));
        background: #122338;
    }
    .scene {
        display: block; position: absolute; inset: 0; z-index: -2;
        background: #26374a url("../img/login-serra.webp") 20% 62% / cover no-repeat;
    }
    .login-layout::before {
        mask-image: none;
        background:
            linear-gradient(180deg, #06121ee8 0%, #08172689 13%, transparent 36%, transparent 70%, #07131ee8 100%),
            linear-gradient(90deg, #08131d28 0%, transparent 42%, #0817252b 61%, #0817269c 100%);
    }
    .brand {
        grid-area: 1 / 1; align-self: start; width: max-content; max-width: 100%; padding: 0;
        gap: clamp(1.1rem, 1.6vw, 2.3rem);
    }
    .brand img { width: clamp(11.25rem, 15.3vw, 18rem); }
    .brand p {
        font-size: clamp(1rem, 1.23vw, 1.3125rem); max-width: 9em; padding-inline-start: clamp(.9rem, 1.5vw, 1.6rem);
        color: #ecf2f6; text-shadow: 0 1px 5px #010c1b99;
    }
    .access {
        grid-area: 1 / 2 / 4 / 3; justify-self: end; width: 100%;
        margin-block: 2.2rem; padding: clamp(1.8rem, 2.55vw, 2.65rem); border-radius: 1.3rem;
        background: linear-gradient(135deg, #182d41ee, #0e2030f0 55%, #0c1c2cf5);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }
    .publisher {
        grid-area: 3 / 1 / 4 / -1; width: 100%; border-top: 1px solid #d2e5f42d;
        padding: .9rem 0 0; color: #c4d0d9;
    }
}
@media (min-width: 120rem) {
    .login-layout {
        grid-template-columns: minmax(0, 1fr) clamp(28.5rem, 15vw, 32rem);
        padding-inline-end: max(clamp(7rem, 11.75vw, 44rem), env(safe-area-inset-right));
    }
    .brand img { width: clamp(18rem, 10vw, 24rem); }
    .access { padding: clamp(2.6rem, 1.48vw, 3rem); }
    .field label { font-size: 1rem; }
    .control, .submit { min-height: 3.35rem; font-size: 1.06rem; }
    .remember, .password-toggle { font-size: .95rem; }
}
@media (min-width: 48rem) and (min-aspect-ratio: 19/10) and (min-height: 32.01rem),
       (min-width: 64.01rem) and (min-aspect-ratio: 19/10) {
    .scene { background-image: url("../img/login-serra-panorama.webp"); background-position: 50% 60%; }
}
@media (min-width: 64.01rem) and (min-aspect-ratio: 3/1) {
    .scene { background-position: 50% 74%; }
}
@media (min-width: 56rem) and (max-width: 69.99rem) and (min-height: 32.01rem) {
    .login-layout { --page-edge: min(4vw, 3rem); grid-template-columns: minmax(0, 1fr) 21.25rem; }
    .access { padding: 1.65rem; }
}
@media (min-width: 48rem) and (min-height: 32.01rem) and (max-width: 55.99rem),
       (min-width: 48rem) and (max-width: 69.99rem) and (min-height: 32.01rem) and (max-aspect-ratio: 6/5),
       (min-width: 48rem) and (min-height: 32.01rem) and (max-aspect-ratio: 1/1) {
    .login-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(10rem, 31vw) auto minmax(min-content, 1fr);
        justify-items: center; row-gap: 1.4rem; background: #0a1929;
    }
    .scene {
        height: clamp(22rem, 63vw, 60vh);
        background-image: url("../img/login-serra.webp"); background-position: 36% 65%;
    }
    .login-layout::before {
        background: linear-gradient(180deg, #071728b0, transparent 29%, #0a1929 99%) top / 100% clamp(22rem, 63vw, 60vh) no-repeat;
    }
    .brand { grid-area: 1 / 1; justify-self: start; }
    .access { grid-area: 3 / 1; justify-self: center; width: min(100%, 28.5rem); margin: 0; }
    .publisher { grid-area: 4 / 1; }
}
@media (max-width: 64rem) and (max-height: 32rem),
       (min-width: 64.01rem) and (max-height: 34rem) {
    .login-layout { row-gap: 1rem; padding-block: max(1rem, env(safe-area-inset-top)) max(.8rem, env(safe-area-inset-bottom)); }
    .access { margin-block: 0; }
}
@media (max-width: 47.99rem) and (max-height: 40rem) {
    .login-layout { grid-template-rows: auto auto minmax(min-content, 1fr); row-gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
@media (forced-colors: active) {
    .login-layout::before, .access::before { display: none; }
    .control:focus { outline: 2px solid Highlight; }
    .access, .submit { border-color: ButtonText; }
    .lock, .envelope { color: CanvasText; }
}
