:root {
    color-scheme: light;
    --navy: #0f2a6b;
    --navy-deep: #0a1d4d;
    --gold: #ffc20e;
    --gold-deep: #eda900;
    --ink: #1b2a4e;
    --muted: #66738e;
    --line: #dfe5f1;
    --surface: rgba(255, 255, 255, .92);
    --info-bg: #eaf2ff;
    --danger: #c93636;
    --font-body: 'Lato', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
    --shadow-card: 0 28px 70px -28px rgba(10, 29, 77, .48), 0 10px 28px rgba(10, 29, 77, .10);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background: #e9eef6;
    font-family: var(--font-body);
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.stage {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(390px, min(42vw, 490px));
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: clamp(28px, 5vw, 88px);
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(24px, 4vh, 48px) clamp(24px, 6vw, 104px) clamp(24px, 4vh, 48px) clamp(24px, 4vw, 64px);
    overflow: hidden;
}

/* Latar belakang dan elemen dekoratif */
.sky {
    position: absolute;
    z-index: -5;
    inset: 0;
    background:
        radial-gradient(circle at 16% 78%, rgba(255, 255, 255, .6), transparent 29%),
        linear-gradient(155deg, #c7dced 0%, #e8edf5 48%, #f8ecd5 100%);
}

.photo {
    position: absolute;
    z-index: -4;
    left: 0;
    bottom: clamp(38px, 8vh, 88px);
    width: min(65vw, 1200px);
    aspect-ratio: 3 / 2;
    
    background: 
        linear-gradient(135deg, rgba(253, 176, 88, 0.65) 0%, rgba(255, 255, 255, 0.15) 100%),
        url('../images/background-login.png') center / cover no-repeat;
    
    background-blend-mode: multiply;

    backface-visibility: hidden;
    will-change: transform;
    animation: photo-drift 15s cubic-bezier(.45, 0, .55, 1) infinite alternate;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 86%, transparent 100%),
                        linear-gradient(to right, #000 66%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 86%, transparent 100%),
                linear-gradient(to right, #000 66%, transparent 100%);
    mask-composite: intersect;
}

/* Cahaya ambient dan sapuan cahaya tipis di atas foto kampus. */
.photo::before,
.photo::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.photo::before {
    inset: -12% -35%;
    background: linear-gradient(115deg, transparent 43%, rgba(255, 255, 255, .16) 50%, transparent 57%);
    transform: translate3d(-48%, 0, 0) skewX(-8deg);
    animation: photo-shimmer 32s cubic-bezier(.45, 0, .55, 1) infinite;
}

.photo::after {
    inset: -8%;
    background: radial-gradient(ellipse at 28% 72%, rgba(255, 255, 255, .30), transparent 48%);
    opacity: .18;
    animation: photo-glow 12s ease-in-out infinite alternate;
}

.veil {
    position: absolute;
    z-index: -3;
    inset: 0;
    background: linear-gradient(100deg, rgba(255, 255, 255, .02) 25%, rgba(255, 255, 255, .52) 63%, rgba(255, 255, 255, .88) 100%);
    pointer-events: none;
}

.swoosh {
    position: absolute;
    z-index: -2;
    display: block;
    pointer-events: none;
}

.swoosh-top {
    top: 0;
    right: 0;
    width: min(44vw, 700px);
    height: clamp(90px, 15vh, 150px);
}

.swoosh-bottom-left {
    bottom: 0;
    left: 0;
    width: min(66vw, 1000px);
    height: clamp(150px, 25vh, 240px);
}

.swoosh-bottom-right {
    right: 0;
    bottom: 0;
    width: min(24vw, 360px);
    height: clamp(40px, 8vh, 80px);
}

/* Identitas kampus */
.left-panel {
    grid-column: 1;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: clamp(14px, 1.6vw, 22px);
    animation: fade-up .8s .08s both cubic-bezier(.2, .7, .2, 1);
}

.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: clamp(72px, 7.5vw, 108px);
    height: auto;
    filter: drop-shadow(0 6px 12px rgba(10, 29, 77, .24));
}

.brand-divider {
    /* align-self: stretch; */
    width: 3px;
    min-height: 110px;
    border-radius: 99px;
    background: var(--navy);
}

.brand-name {
    max-width: 320px;
    color: var(--navy);
    font-family: var(--font-heading);
    font-size: xx-large;
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tagline {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 clamp(4px, 2vh, 18px);
    color: #fff;
    font-size: clamp(15px, 1.4vw, 20px);
    font-style: italic;
    text-shadow: 0 2px 10px rgba(10, 29, 77, .22);
    animation: fade-up .8s .42s both cubic-bezier(.2, .7, .2, 1);
}

.tagline::before {
    width: 3px;
    height: 28px;
    border-radius: 99px;
    background: var(--gold);
    content: '';
}

/* Kartu login */
.card-wrap {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    perspective: 1200px;
    animation: fade-up .9s .18s both cubic-bezier(.2, .7, .2, 1);
}

.card {
    position: relative;
    padding: clamp(24px, 3vh, 34px) clamp(22px, 3vw, 42px) clamp(22px, 2.8vh, 30px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .94);
    border-radius: 30px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
    text-align: center;
    -webkit-backdrop-filter: blur(18px) saturate(1.25);
    backdrop-filter: blur(18px) saturate(1.25);
    transition: box-shadow .35s ease, transform .25s ease-out;
}

.card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--navy), var(--gold), var(--navy));
    content: '';
    opacity: .9;
}

.card::after {
    position: absolute;
    top: -120px;
    right: -100px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 194, 14, .13), transparent 70%);
    content: '';
    pointer-events: none;
}

.card-logo {
    display: block;
    width: clamp(68px, 11vh, 96px);
    height: auto;
    margin: 0 auto 5px;
    filter: drop-shadow(0 7px 13px rgba(15, 42, 107, .2));
    animation: logo-float 5.5s ease-in-out infinite;
}

.title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .18em;
    color: var(--navy);
    font-family: var(--font-heading);
    font-size: clamp(36px, min(4.2vw, 6.6vh), 54px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.035em;
    white-space: nowrap;
}

.title-one {
    display: inline-flex;
    align-items: center;
    color: var(--gold-deep);
}

.key-o {
    flex: 0 0 auto;
    width: .78em;
    height: .78em;
    margin-right: .04em;
    filter: drop-shadow(0 3px 6px rgba(240, 171, 0, .32));
    animation: float-key 4s ease-in-out infinite;
}

.sso-label {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 9px 0 17px;
    color: var(--navy);
    font-size: clamp(16px, 1.65vw, 21px);
    font-weight: 700;
}

.sso-label::before,
.sso-label::after {
    flex: 1 1 auto;
    height: 1.5px;
    min-width: 12px;
    background: linear-gradient(90deg, transparent, rgba(15, 42, 107, .66));
    content: '';
}

.sso-label::after {
    background: linear-gradient(270deg, transparent, rgba(15, 42, 107, .66));
}

.welcome {
    margin: 0;
    color: var(--navy);
    font-size: clamp(18px, 1.7vw, 22px);
    font-weight: 900;
    line-height: 1.3;
}

.subtitle {
    margin: 5px 0 clamp(16px, 2.2vh, 22px);
    color: var(--muted);
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.5;
    text-wrap: balance;
}

/* Input dan validasi */
.field {
    position: relative;
    margin-bottom: 13px;
    text-align: left;
}

.field-icon {
    position: absolute;
    top: 50%;
    left: 17px;
    width: 21px;
    height: 21px;
    color: var(--navy);
    fill: currentColor;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color .2s ease, transform .2s ease;
}

.field input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 0 54px 0 54px;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    outline: none;
    background: rgba(255, 255, 255, .96);
    color: var(--ink);
    font-size: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input::placeholder {
    color: #8792aa;
    opacity: 1;
}

.field input:hover {
    border-color: #c3cee2;
}

.field input:focus {
    border-color: var(--gold-deep);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 194, 14, .2), 0 7px 18px -9px rgba(15, 42, 107, .25);
}

.field:focus-within .field-icon {
    color: var(--gold-deep);
    transform: translateY(-50%) scale(1.08);
}

.field.is-invalid input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(201, 54, 54, .12);
    animation: input-shake .32s ease;
}

.field-message {
    display: none;
    margin: -5px 0 10px 4px;
    color: var(--danger);
    font-size: 12.5px;
    line-height: 1.35;
    text-align: left;
}

.field-message.is-visible {
    display: block;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #65718a;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .2s ease, color .2s ease;
}

.password-toggle:hover {
    background: #eef2fb;
    color: var(--navy);
}

.password-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.password-toggle .icon-visible,
.password-toggle.is-visible .icon-hidden {
    display: none;
}

.password-toggle.is-visible .icon-visible {
    display: block;
}

/* Notifikasi Error */
.alert-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(201, 54, 54, .2);
    border-radius: 12px;
    background: #fdf3f3;
    color: var(--danger);
    font-size: 13.5px;
    line-height: 1.4;
    text-align: left;
    animation: fade-up .4s ease-out;
}

.alert-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

/* Tombol masuk */
.submit-button {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-top: 3px;
    padding: 0 18px;
    overflow: hidden;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(180deg, #ffd13d 0%, var(--gold) 58%, var(--gold-deep) 100%);
    box-shadow: 0 11px 23px -11px rgba(237, 169, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .58);
    color: var(--navy-deep);
    cursor: pointer;
    font-size: 17px;
    font-weight: 900;
    transition: transform .2s ease, box-shadow .25s ease, filter .2s ease;
}

.submit-button:hover:not(:disabled) {
    box-shadow: 0 16px 28px -12px rgba(237, 169, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .58);
    filter: saturate(1.04);
    transform: translateY(-2px);
}

.submit-button:active:not(:disabled) {
    transform: translateY(0) scale(.99);
}

.submit-button:disabled {
    cursor: wait;
    opacity: .8;
}

.submit-button::after {
    position: absolute;
    top: 0;
    left: -75%;
    width: 42%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .58), transparent);
    content: '';
    pointer-events: none;
    transform: skewX(-20deg);
}

.submit-button:hover::after {
    animation: button-shine .75s ease;
}

.submit-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.3;
    transition: transform .2s ease;
}

.submit-button:hover svg {
    transform: translateX(3px);
}

.button-spinner {
    display: none;
    width: 21px;
    height: 21px;
    border: 3px solid rgba(10, 29, 77, .22);
    border-top-color: var(--navy-deep);
    border-radius: 50%;
    animation: spinner .7s linear infinite;
}

.submit-button.is-loading .button-icon,
.submit-button.is-loading .button-label {
    display: none;
}

.submit-button.is-loading .button-spinner {
    display: block;
}

.form-status {
    min-height: 0;
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.4;
    text-align: center;
}

.form-status:not(:empty) {
    margin-top: 10px;
}

/* Informasi login lokal */
.section-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: clamp(15px, 2vh, 19px) 0 11px;
    color: #52617d;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.section-label::before,
.section-label::after {
    flex: 1;
    height: 1px;
    background: var(--line);
    content: '';
}

.info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(45, 127, 240, .08);
    border-radius: 13px;
    background: var(--info-bg);
    color: #1d56a8;
    font-size: 13.5px;
    line-height: 1.45;
    text-align: left;
}

.info-icon {
    flex: 0 0 31px;
    width: 31px;
    height: 31px;
}

/* Footer */
.foot {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    margin: clamp(13px, 2vh, 20px) 0 0;
    color: var(--navy);
    font-size: 13px;
    text-align: center;
    animation: fade-up .8s .55s both;
}

.foot strong {
    font-weight: 900;
}

.foot .dot {
    margin: 0 8px;
    color: var(--gold-deep);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--gold-deep);
    outline-offset: 3px;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Gerakan ala Ken Burns: zoom dan pergeseran kecil agar foto terasa hidup. */
@keyframes photo-drift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        transform: translate3d(12px, -7px, 0) scale(1.055);
    }
}

@keyframes photo-glow {
    0% { opacity: .14; }
    100% { opacity: .38; }
}

@keyframes photo-shimmer {
    0%, 12% {
        opacity: 0;
        transform: translate3d(-48%, 0, 0) skewX(-8deg);
    }
    22%, 78% { opacity: .7; }
    88%, 100% {
        opacity: 0;
        transform: translate3d(48%, 0, 0) skewX(-8deg);
    }
}

@keyframes photo-drift-mobile {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(0, -5px, 0) scale(1.025); }
}

@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes input-shake {
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes button-shine {
    from { left: -75%; }
    to { left: 135%; }
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

@keyframes float-key {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Tablet dan perangkat dengan layar lebih kecil */
@media (max-width: 1023px) {
    .stage {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(min-content, 1fr) auto;
        row-gap: 0;
        min-height: 100vh;
        min-height: 100svh;
        padding: 22px clamp(18px, 4vw, 42px) 0;
        overflow: visible;
    }

    .photo {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: min(60vh, 560px);
        aspect-ratio: auto;
        background-position: center bottom;
        opacity: .36;
        transform-origin: center bottom;
        animation: photo-drift-mobile 10s ease-in-out infinite alternate;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 42%, #000 100%);
        mask-image: linear-gradient(to bottom, transparent 0%, #000 42%, #000 100%);
        -webkit-mask-composite: source-over;
        mask-composite: add;
    }

    .veil {
        background: linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, .58));
    }

    .swoosh-bottom-left,
    .swoosh-bottom-right {
        display: none;
    }

    .swoosh-top {
        width: min(38vw, 280px);
        height: clamp(38px, 6vh, 60px);
    }

    .left-panel {
        grid-column: 1;
        grid-row: 1;
        display: block;
        width: min(100%, 560px);
        margin: 0 auto;
    }

    .brand {
        gap: 12px;
    }

    .brand-logo {
        width: 48px;
    }

    .brand-divider {
        width: 2px;
        min-height: 34px;
    }

    .brand-name {
        max-width: 70%;
        font-size: clamp(12px, 2.2vw, 16px);
        line-height: 1.3;
    }

    .brand-name br {
        display: none;
    }

    .tagline {
        display: none;
    }

    .card-wrap {
        grid-column: 1;
        grid-row: 2;
        align-self: center;
        width: min(100%, 490px);
        margin: 0 auto;
        padding: 24px 0 28px;
    }

    .card {
        padding: 25px clamp(22px, 5vw, 36px) 24px;
        border-radius: 26px;
    }

    .card-logo {
        width: 78px;
    }

    .title {
        font-size: clamp(34px, 8vw, 46px);
    }

    .foot {
        grid-column: 1;
        grid-row: 3;
        align-self: stretch;
        margin: 0 calc(clamp(18px, 4vw, 42px) * -1) 0;
        padding: 15px 18px calc(15px + env(safe-area-inset-bottom));
        border-top: 3px solid var(--gold);
        background: var(--navy);
        color: #fff;
        font-size: 12.5px;
    }

    .foot .dot {
        color: var(--gold);
    }
}

@media (max-width: 600px) {
    .stage {
        padding: 17px 16px 0;
    }

    .foot {
        margin-right: -16px;
        margin-left: -16px;
    }

    .card-wrap {
        width: 100%;
        max-width: 440px;
        padding: 19px 0 22px;
    }

    .card {
        padding: 22px clamp(17px, 5vw, 25px) 21px;
        border-radius: 23px;
    }

    .card-logo {
        width: 70px;
    }

    .sso-label {
        gap: 9px;
        margin: 8px 0 15px;
        font-size: 16px;
    }

    .welcome {
        font-size: clamp(17px, 4.7vw, 20px);
    }

    .subtitle {
        margin-bottom: 17px;
        font-size: 14px;
    }

    .field input {
        height: 52px;
        font-size: 16px;
    }

    .submit-button {
        min-height: 52px;
    }

    .info {
        gap: 10px;
        padding: 12px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .stage {
        padding-right: 12px;
        padding-left: 12px;
    }

    .foot {
        margin-right: -12px;
        margin-left: -12px;
    }

    .brand-logo {
        width: 42px;
    }

    .brand-name {
        font-size: 11.5px;
    }

    .card {
        padding-right: 14px;
        padding-left: 14px;
    }

    .title {
        font-size: 33px;
    }

    .sso-label {
        font-size: 15px;
    }

    .field-icon {
        left: 14px;
        width: 19px;
        height: 19px;
    }

    .field input {
        padding-right: 48px;
        padding-left: 46px;
    }

    .password-toggle {
        right: 5px;
        width: 38px;
        height: 38px;
    }

    .info {
        align-items: flex-start;
        font-size: 12.5px;
    }
}

/* Layar pendek: tetap bisa discroll tanpa memotong kartu */
@media (max-height: 720px) and (min-width: 1024px) {
    .stage {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .card {
        padding-top: 20px;
        padding-bottom: 19px;
    }

    .card-logo {
        width: 66px;
    }

    .subtitle {
        margin-bottom: 13px;
    }

    .field {
        margin-bottom: 10px;
    }

    .field input,
    .submit-button {
        height: 49px;
        min-height: 49px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}