/* ==========================================================================
   Nicholai OS - Windows XP style welcome / log on screen.

   Shown on os.html only when scripts run: an inline snippet in the head adds
   `xp-login-ready` to <html>, and login.js takes it away once the desktop is
   ready. With JavaScript off the class is never added, so the overlay stays
   hidden and the desktop behaves exactly as before.
   ========================================================================== */

.xp-login {
  display: none;
}

html.xp-login-ready .xp-login {
  display: flex;
}

/* Keep the desktop from scrolling behind the log on screen */
html.xp-login-ready body {
  overflow: hidden;
}

.xp-login {
  position: fixed;
  inset: 0;
  z-index: 4000;
  flex-direction: column;
  color: #fff;
  font-family: Tahoma, "Pixelated MS Sans Serif", Arial, sans-serif;
  user-select: none;
  overflow: hidden;
  transition: opacity 840ms ease;
}

.xp-login.is-leaving {
  opacity: 0;
  pointer-events: none;
}

/* Selection / focus styling (beats the global body.xp-desktop :focus-visible rule) */
.xp-desktop .xp-login :focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.85);
  outline-offset: 1px;
}

.xp-login__user:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.7);
}

/* ---------- Top band ---------- */
.xp-login__top {
  flex: none;
  height: 8.5%;
  min-height: 34px;
  background: linear-gradient(180deg, #1550c4 0%, #0a3399 100%);
}

/* ---------- Middle ---------- */
.xp-login__main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  background:
    radial-gradient(ellipse 70% 85% at 18% 38%, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #7fa3eb 0%, #5b83dd 45%, #4a71d2 100%);
}

/* Left: wordmark */
.xp-login__brand {
  flex: 1 1 44%;
  max-width: 44%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 0 4%;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.28);
}

.xp-login__wordmark {
  display: flex;
  align-items: center;
  gap: 14px;
}

.xp-login__flag {
  width: 62px;
  height: 62px;
  flex: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.xp-login__title {
  font: 700 44px/1 "Franklin Gothic Medium", "Trebuchet MS", Tahoma, sans-serif;
  letter-spacing: -0.5px;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.4);
}

.xp-login__title-os {
  margin-left: 5px;
  font-size: 0.5em;
  vertical-align: 0.42em;
  color: #ffd85e;
  letter-spacing: 0;
}

.xp-login__prompt {
  margin: 0;
  font-size: 17px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.45);
}

/* Right: the user tile and log on button */
.xp-login__users {
  flex: 1 1 56%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 0 6% 0 7%;
}

.xp-login__signin {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* `hidden` needs to win over the display rule above */
.xp-login__signin[hidden],
.xp-login__prompt[hidden] {
  display: none;
}

.xp-login__user {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  align-self: flex-start;
  max-width: 100%;
  padding: 7px 14px 7px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  color: #fff;
  font: 400 19px/1.2 "Franklin Gothic Medium", "Trebuchet MS", Tahoma, sans-serif;
  text-align: left;
  cursor: pointer;
}

.xp-login__user:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
}

.xp-login__user:disabled {
  cursor: default;
}

.xp-login__tile {
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
  border: 3px solid #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  /* Same avatar treatment as the start menu .xp-start__avatar */
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.8) 0 12%, transparent 14%),
    linear-gradient(135deg, #ffd76e 0%, #ff9c3f 55%, #e86a17 100%);
}

.xp-login__tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xp-login__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.xp-login__actions {
  display: flex;
  align-items: center;
}

.xp-login__go {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px 7px 10px;
  border: 1px solid #1b4fa8;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #eef3fd 48%, #dbe6fa 52%, #c3d4f2 100%);
  color: #14346f;
  font: 700 15px/1 "Franklin Gothic Medium", "Trebuchet MS", Tahoma, sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.xp-login__go:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 48%, #e4edfc 52%, #cddffa 100%);
}

.xp-login__go:active {
  background: linear-gradient(180deg, #c3d4f2 0%, #e4edfc 100%);
}

.xp-login__go:disabled {
  opacity: 0.7;
  cursor: default;
}

.xp-login__go-arrow {
  width: 19px;
  height: 19px;
  flex: none;
}

/* ---------- Loading state ---------- */
.xp-login__loading {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.xp-login__loading[hidden] {
  display: none;
}

.xp-login__loading-text {
  margin: 0;
  font-size: 17px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.45);
}

.xp-login__bar {
  position: relative;
  width: 210px;
  height: 17px;
  border: 1px solid #2b4c8c;
  border-radius: 3px;
  background: #1c3f7a;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.xp-login__bar span {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: -18px;
  width: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, #d7e8ff 0%, #7fb2f2 50%, #3f7ede 100%);
  animation: xp-login-marquee 2.1s linear infinite;
  /* Hold the start-of-animation position during the staggered delays, so the
     blocks wait off-screen instead of sitting at left:auto (middle of track) */
  animation-fill-mode: backwards;
}

.xp-login__bar span:nth-child(2) {
  animation-delay: 0.35s;
}

.xp-login__bar span:nth-child(3) {
  animation-delay: 0.7s;
}

@keyframes xp-login-marquee {
  from {
    left: -18px;
  }
  to {
    left: 100%;
  }
}

/* ---------- Bottom bar ---------- */
.xp-login__bottom {
  flex: none;
  height: 9.5%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  background: linear-gradient(180deg, #ffab2e 0%, #ef7f00 55%, #d96900 100%);
  border-top: 1px solid #ffd08a;
}

.xp-login__power {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font: 700 20px/1 "Franklin Gothic Medium", "Trebuchet MS", Tahoma, sans-serif;
  text-shadow: 1px 1px 2px rgba(120, 50, 0, 0.55);
}

.xp-login__power-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff3d8 0%, #ffb648 35%, #e2450f 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45), 0 1px 3px rgba(120, 50, 0, 0.5);
  position: relative;
}

.xp-login__power-icon::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2.5px solid #7a2000;
  border-top-color: transparent;
  border-radius: 50%;
}

.xp-login__hint {
  margin: 0;
  max-width: 46ch;
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
  text-shadow: 1px 1px 2px rgba(120, 50, 0, 0.55);
}

/* ---------- Narrow screens: stack the two panes ---------- */
@media (max-width: 760px) {
  .xp-login__main {
    flex-direction: column;
  }

  .xp-login__brand {
    flex: 0 0 auto;
    max-width: none;
    gap: 18px;
    padding: 22px 6%;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.28);
  }

  .xp-login__flag {
    width: 46px;
    height: 46px;
  }

  .xp-login__title {
    font-size: 32px;
  }

  .xp-login__prompt {
    font-size: 15px;
  }

  .xp-login__users {
    flex: 1 1 auto;
    padding: 20px 8%;
  }

  .xp-login__bottom {
    padding: 0 14px;
  }

  .xp-login__power {
    font-size: 16px;
  }

  .xp-login__hint {
    display: none;
  }
}

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

  .xp-login__bar span {
    animation: none;
  }

  .xp-login__bar span:nth-child(1) {
    left: 8px;
  }

  .xp-login__bar span:nth-child(2) {
    left: 28px;
  }

  .xp-login__bar span:nth-child(3) {
    left: 48px;
  }
}
