/* =====================================================================
   login.css  -  extra styles for the login and forgot-password pages
   (theme.css must be loaded first)
   ---------------------------------------------------------------------
   Everything on these pages is measured in "u" (a scaling unit), so the
   window and the decorations grow together on big monitors and shrink
   together on small laptops and phones.
       calc(80 * var(--u))  means  "80 pixels on a normal laptop"
   ===================================================================== */


/* The scaling unit ------------------------------------------------------- */
:root {
    /* about 1px on a 1366 x 768 laptop and 1.36px on a 1920 x 1080 monitor.
       min() follows whichever is tighter (width or height), so the
       window always fits on the screen; clamp() keeps it within limits. */
    --u: clamp(0.82px, min(0.09vw, 0.126vh), 1.5px);
    --taskbar-h: max(54px, calc(46 * var(--u)));
}


/* The stage fills the screen and centres the window --------------------- */
.login-stage {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    grid-template-columns: minmax(0, 1fr);   /* never wider than the screen */
    min-height: 100vh;
    padding: calc(58 * var(--u)) 20px calc(var(--taskbar-h) + 16 * var(--u));
    overflow: clip;    /* the glow below can be bigger than the screen; cut off the extra */
}

/* a soft pink-and-blue glow behind the window that slowly "breathes" */
.login-stage::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: -1;
    width: calc(980 * var(--u));
    height: calc(780 * var(--u));
    margin: calc(-390 * var(--u)) 0 0 calc(-490 * var(--u));
    background:
        radial-gradient(closest-side at 38% 45%, rgba(255, 201, 222, .75), transparent),
        radial-gradient(closest-side at 64% 58%, rgba(194, 226, 255, .75), transparent);
    animation: halo 8s ease-in-out infinite;
    pointer-events: none;
}


/* The login window ----------------------------------------------------- */
.window-login {
    width: min(calc(540 * var(--u)), 100%);
    border-radius: calc(18 * var(--u));
    box-shadow: calc(9 * var(--u)) calc(9 * var(--u)) 0 var(--blue-300);
    animation: pop-in .7s cubic-bezier(.2, 1.3, .4, 1) both;
}

/* while the loading screen is showing, keep the window hidden;
   effects.js removes .booting and the window pops in */
.booting .window-login { opacity: 0; animation: none; }

/* a bigger title bar with bigger window buttons */
.window-login .window-titlebar {
    padding: calc(9 * var(--u)) calc(11 * var(--u)) calc(9 * var(--u)) calc(16 * var(--u));
    font-size: calc(18 * var(--u));
    border-radius: calc(18 * var(--u) - 2px) calc(18 * var(--u) - 2px) 0 0;
}

.window-login .window-title { gap: calc(10 * var(--u)); }
.window-login .window-title img { width: calc(24 * var(--u)); }
.window-login .window-controls { gap: calc(7 * var(--u)); }

.window-login .window-controls > span {
    width: calc(28 * var(--u));
    height: calc(28 * var(--u));
    border-radius: calc(7 * var(--u));
}

/* keep the little symbols centred inside the bigger buttons */
.window-login .ctrl-min::before   { left: 22%; right: 22%; bottom: 22%; }
.window-login .ctrl-max::before   { inset: 20%; }
.window-login .ctrl-close::before,
.window-login .ctrl-close::after  { left: 16%; right: 16%; top: calc(50% - 1.5px); }

.window-login .window-body {
    padding: calc(30 * var(--u)) calc(46 * var(--u)) calc(34 * var(--u));
    text-align: center;
}

/* the pixel bow sitting on top of the window, swaying gently */
.login-bow {
    position: absolute;
    top: calc(-50 * var(--u));
    left: 50%;
    z-index: 2;
    width: calc(120 * var(--u));
    margin-left: calc(-60 * var(--u));
    transform-origin: 50% 80%;
    animation: bow-sway 4s ease-in-out infinite;
}

.login-emblem {
    display: block;
    width: calc(176 * var(--u));
    margin: calc(6 * var(--u)) auto calc(14 * var(--u));
    animation: float 5s ease-in-out infinite;
}

/* the big pixel LOGIN word with a pink and a blue shadow */
.login-title {
    margin: 0;
    font-size: calc(84 * var(--u));
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: .1em;
    color: var(--ink);
    text-shadow: calc(4 * var(--u)) calc(4 * var(--u)) 0 var(--pink-300),
                 calc(8 * var(--u)) calc(8 * var(--u)) 0 var(--blue-300);
}

.login-company {
    margin: calc(12 * var(--u)) 0 0;
    font-size: calc(20 * var(--u));
    font-weight: 700;
    color: var(--ink-soft);
}

.login-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: calc(16 * var(--u));
    margin-top: calc(26 * var(--u));
}

.window-login .alert {
    margin: calc(20 * var(--u)) 0 0;
    font-size: max(15px, calc(16 * var(--u)));
}

/* when an error message is showing, the logo and title shrink a little
   so the window still fits on a laptop screen without scrolling */
.window-login:has(.alert) .login-emblem { width: calc(120 * var(--u)); margin-bottom: calc(8 * var(--u)); }
.window-login:has(.alert) .login-title  { font-size: calc(68 * var(--u)); }
.window-login:has(.alert) .alert        { margin-top: calc(14 * var(--u)); }
.window-login:has(.alert) .login-form   { margin-top: calc(18 * var(--u)); }


/* Pill-shaped input boxes with little hearts --------------------------- */
.pill-field {
    display: flex;
    align-items: center;
    height: calc(64 * var(--u));
    padding: 0 calc(10 * var(--u)) 0 calc(20 * var(--u));
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-pill);
    box-shadow: inset 0 calc(-5 * var(--u)) 0 var(--pink-100);
    transition: box-shadow .15s ease, border-color .15s ease;
}

.pill-field:focus-within {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 calc(5 * var(--u)) var(--blue-200), inset 0 calc(-5 * var(--u)) 0 var(--blue-100);
}

.pill-field > img { flex: none; width: calc(26 * var(--u)); }
.pill-field > .pill-end { width: calc(24 * var(--u)); margin-right: calc(10 * var(--u)); }
.pill-field:focus-within > img:first-of-type { animation: heartbeat 1.2s ease-in-out infinite; }

.pill-field input {
    flex: 1;
    width: 100%;     /* without this, the Japanese-style font makes empty boxes too wide */
    min-width: 0;
    height: 100%;
    padding: 0 calc(12 * var(--u));
    font: inherit;
    font-size: max(16px, calc(19 * var(--u)));   /* 16px or more stops phones from zooming in */
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: none;
}

/* the eye button that shows or hides the password */
.pill-eye {
    display: grid;
    place-items: center;
    flex: none;
    width: calc(46 * var(--u));
    height: calc(46 * var(--u));
    padding: 0;
    background: var(--blue-100);
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .15s ease;
}

.pill-eye img { width: calc(30 * var(--u)); }
.pill-eye:hover { background: var(--blue-200); }
.pill-eye[aria-pressed="true"] { background: var(--pink-200); }

.btn-login {
    width: 100%;
    min-height: calc(66 * var(--u));
    margin-top: calc(6 * var(--u));
    font-size: calc(26 * var(--u));
    border-radius: var(--radius-pill);
}

.btn-login img { width: calc(26 * var(--u)); }

.forgot-link {
    display: inline-block;
    margin-top: calc(22 * var(--u));
    font-size: max(15px, calc(18 * var(--u)));
    font-weight: 700;
    text-decoration: underline dotted 2px;
}


/* Window used by the forgot-password page ------------------------------ */
.window-help {
    width: min(calc(560 * var(--u)), 100%);
    animation: pop-in .6s cubic-bezier(.2, 1.3, .4, 1) both;
}

.window-help .window-body {
    padding: calc(28 * var(--u)) calc(36 * var(--u)) calc(32 * var(--u));
    font-size: max(15px, calc(17 * var(--u)));
}

.help-icon {
    display: block;
    width: calc(84 * var(--u));
    margin: 0 auto calc(14 * var(--u));
    animation: float 5s ease-in-out infinite;
}

.help-title {
    font-size: calc(36 * var(--u));
    text-align: center;
}

.help-steps { margin: 0 0 calc(24 * var(--u)); padding-left: 22px; }
.help-steps li { margin-bottom: calc(10 * var(--u)); padding-left: 4px; }

.help-actions { text-align: center; }


/* Little pop-up windows around the login window (decoration) ----------- */
.popup {
    position: absolute;
    z-index: 1;
    width: calc(330 * var(--u));
    background: var(--white);
    border: var(--border);
    border-radius: calc(14 * var(--u));
}

.popup .window-titlebar {
    padding: calc(6 * var(--u)) calc(8 * var(--u)) calc(6 * var(--u)) calc(12 * var(--u));
    font-size: calc(16 * var(--u));
    border-radius: calc(14 * var(--u) - 2px) calc(14 * var(--u) - 2px) 0 0;
}

.popup .window-controls > span {
    width: calc(24 * var(--u));
    height: calc(24 * var(--u));
}

.popup .ctrl-close::before,
.popup .ctrl-close::after { left: 16%; right: 16%; top: calc(50% - 1.5px); }

.popup-a {
    top: 12%;
    right: 4%;
    box-shadow: calc(7 * var(--u)) calc(7 * var(--u)) 0 var(--pink-300);
    animation: float 7s ease-in-out infinite;
}
.popup-a .window-titlebar { background: var(--pink-200); }

.popup-b {
    bottom: calc(var(--taskbar-h) + 12%);
    left: 4%;
    box-shadow: calc(7 * var(--u)) calc(7 * var(--u)) 0 var(--blue-300);
    animation: float 8s ease-in-out -3s infinite;
}
.popup-b .window-titlebar { background: var(--blue-200); }

.popup-body {
    display: flex;
    align-items: center;
    gap: calc(14 * var(--u));
    padding: calc(16 * var(--u)) calc(18 * var(--u));
    font-size: calc(18 * var(--u));
    font-weight: 700;
}

.popup-body > img { width: calc(46 * var(--u)); flex: none; }
.popup-body > span { white-space: nowrap; }   /* keep the little heart on the same line */
.popup-body .inline-heart { width: calc(20 * var(--u)); }

.popup.closing { animation: pop-out .25s ease forwards; }


/* Desktop icons: top-left and bottom-right corners (decoration) -------- */
.desktop-icons {
    position: absolute;
    top: calc(30 * var(--u));
    left: calc(30 * var(--u));
    z-index: 1;
    display: grid;
    gap: calc(22 * var(--u));
    margin: 0;
    padding: 0;
    list-style: none;
}

/* the second column sits in the opposite corner, above the taskbar */
.desktop-icons-right {
    top: auto;
    left: auto;
    right: calc(30 * var(--u));
    bottom: calc(var(--taskbar-h) + 26 * var(--u));
}

.desktop-icons li {
    display: grid;
    justify-items: center;
    gap: calc(8 * var(--u));
    width: calc(140 * var(--u));
    font-size: calc(15 * var(--u));
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.desktop-icons img {
    width: calc(72 * var(--u));
    height: calc(64 * var(--u));
    object-fit: contain;      /* icons of different shapes get the same box */
}

.desktop-icons li:hover img { animation: bob .6s ease; }

.desktop-icons span {
    padding: calc(2 * var(--u)) calc(9 * var(--u));
    background: rgba(255, 255, 255, .85);
    border-radius: calc(7 * var(--u));
}


/* Clouds, hearts and sparkles in the background ------------------------ */
/* clouds drift across the screen at different heights and speeds */
.cloud-1 { top: 5%;  width: calc(300 * var(--u)); animation-delay: -20s; }
.cloud-2 { top: 60%; width: calc(220 * var(--u)); animation-duration: 95s;  animation-delay: -60s; }
.cloud-3 { top: 32%; width: calc(380 * var(--u)); animation-duration: 120s; animation-delay: -5s; }
.cloud-4 { top: 80%; width: calc(260 * var(--u)); animation-duration: 105s; animation-delay: -85s; opacity: .85; }

/* sparkles twinkle in the empty spaces around the window */
.sparkle-1 { top: 15%; left: 33%;  width: calc(56 * var(--u)); }
.sparkle-2 { top: 84%; left: 20%;  width: calc(64 * var(--u)); animation-delay: -1s; }
.sparkle-3 { top: 24%; right: 28%; width: calc(52 * var(--u)); animation-delay: -1.8s; }
.sparkle-4 { top: 84%; right: 34%; width: calc(60 * var(--u)); animation-delay: -.6s; }
.sparkle-5 { top: 40%; left: 14%;  width: calc(40 * var(--u)); animation-delay: -2.2s; }
.sparkle-6 { top: 34%; right: 9%;  width: calc(44 * var(--u)); animation-delay: -1.3s; }

/* big hearts that float up and down and tilt from side to side */
.float-heart { position: absolute; animation: heart-float 7s ease-in-out infinite; }
.float-heart-1 { top: 22%; left: 21%;  width: calc(92 * var(--u)); }
.float-heart-2 { top: 57%; left: 27%;  width: calc(66 * var(--u)); animation-duration: 8.5s; animation-delay: -2s; }
.float-heart-3 { top: 45%; right: 19%; width: calc(82 * var(--u)); animation-duration: 7.5s; animation-delay: -4s; }
.float-heart-4 { top: 72%; right: 25%; width: calc(60 * var(--u)); animation-duration: 9s;   animation-delay: -1s; }
.float-heart-5 { top: 4%;  right: 27%; width: calc(50 * var(--u)); animation-duration: 6.5s; animation-delay: -3s; }
.float-heart-6 { top: 86%; left: 27%;  width: calc(46 * var(--u)); animation-duration: 8s;   animation-delay: -5s; }


/* Taskbar along the bottom (decoration + clock) ------------------------ */
.taskbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--taskbar-h);
    padding: 0 calc(14 * var(--u));
    font-family: var(--font-pixel);
    background: rgba(255, 255, 255, .85);
    border-top: var(--border);
    backdrop-filter: blur(6px);
}

.start-btn,
.task {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: max(36px, calc(40 * var(--u)));
    padding: 0 calc(16 * var(--u));
    border: var(--border);
    border-radius: 10px;
}

.start-btn {
    font-size: max(16px, calc(17 * var(--u)));
    font-weight: 600;
    background: linear-gradient(90deg, var(--pink-200), var(--blue-200));
}

.start-btn img { width: max(20px, calc(22 * var(--u))); }

.task {
    font-size: max(14px, calc(15 * var(--u)));
    background: var(--blue-100);
}

.tray {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    font-size: max(15px, calc(16 * var(--u)));
}

.tray-credit { color: var(--ink-soft); }


/* Animations used only on these pages ---------------------------------- */
@keyframes halo {
    0%, 100% { transform: scale(.94); opacity: .75; }
    50%      { transform: scale(1.04); opacity: 1; }
}

@keyframes bow-sway {
    0%, 100% { transform: rotate(-5deg); }
    50%      { transform: rotate(5deg); }
}

@keyframes heart-float {
    0%, 100% { transform: translateY(0) rotate(-8deg); }
    50%      { transform: translateY(calc(-22 * var(--u))) rotate(8deg); }
}


/* Smaller screens ------------------------------------------------------- */
/* not enough room beside the window for the pop-ups */
@media (max-width: 1280px) {
    .popup { display: none; }
}

/* tablets and phones: hide the desktop icons and a few background pieces */
@media (max-width: 900px) {
    .desktop-icons,
    .float-heart-5,
    .float-heart-6,
    .sparkle-5,
    .sparkle-6 { display: none; }
}

@media (max-width: 560px) {
    .login-stage { padding-left: 14px; padding-right: 14px; }
    .window-login .window-body,
    .window-help .window-body { padding: calc(24 * var(--u)) 20px calc(28 * var(--u)); }
    .task,
    .tray-credit { display: none; }
}
