/* Login page: neon card with a diagonal curtain and a short welcome screen after sign-in. */

@font-face { font-family: "Onest"; src: url("../fonts/onest-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Onest"; src: url("../fonts/onest-semibold.woff2") format("woff2"); font-weight: 500 900; font-display: swap; }

:root {
  color-scheme: dark;
  --login-bg: #1b1717;
  --login-card: #151313;
  --login-accent: #f0602a;
  --login-accent-soft: #ffd2c2;
  --login-error: #ff1e1e;
  --login-error-text: #ff6b6b;
  --login-text: #ffffff;
  --login-text-dim: #e0e0e0;
  --login-line: rgba(255, 255, 255, .55);
  --login-border: rgba(240, 96, 42, .75);
  --login-curtain-end: rgba(240, 96, 42, .34);
  --login-curtain-edge: rgba(240, 96, 42, .6);
  /* Wide, layered halo: a tight rim plus two soft falloffs. */
  --login-halo:
    0 0 24px rgba(240, 96, 42, .30),
    0 0 70px rgba(240, 96, 42, .18),
    0 0 140px rgba(240, 96, 42, .10);
  --login-card-width: 750px;
  --login-card-height: 450px;
  --login-ease-curtain: cubic-bezier(.7, 0, .3, 1);
  --login-ease-pop: cubic-bezier(.175, .885, .32, 1.275);
}

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

body.login-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(240, 96, 42, .07), transparent 70%),
    var(--login-bg);
  color: var(--login-text);
  font: 15px/1.5 "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Card ---------- */
.login-card {
  position: relative;
  width: min(var(--login-card-width), 100%);
  height: var(--login-card-height);
  overflow: hidden;
  border: 2px solid var(--login-border);
  border-radius: 12px;
  background: var(--login-card);
  box-shadow: var(--login-halo);
  transition: border-color .3s, box-shadow .3s;
}
.login-card.is-setup { --login-card-height: 560px; }
.login-card.is-error {
  border-color: var(--login-error);
  box-shadow: 0 0 35px var(--login-error);
}
.login-card.is-shaking { animation: login-shake .4s ease-in-out; }

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* Diagonal curtain; on success it fills the whole card. */
.login-curtain {
  position: absolute;
  z-index: 1;
  top: -4px;
  right: 0;
  width: 850px;
  height: 600px;
  border-bottom: 2px solid var(--login-curtain-edge);
  background: linear-gradient(45deg, var(--login-card) 15%, var(--login-curtain-end));
  transform: rotate(10deg) skewY(40deg);
  transform-origin: bottom right;
  transition: transform 1.2s var(--login-ease-curtain) .4s;
}
.login-card.is-active .login-curtain { transform: rotate(0) skewY(0); transition-delay: .2s; }

/* Staggered exit/return of the form and the side text. */
.login-anim {
  opacity: 1;
  filter: blur(0);
  transform: translateX(0);
  transition: transform .7s ease, opacity .7s ease, filter .7s ease;
  transition-delay: calc(.1s * var(--j));
}
.login-card.is-active .login-anim {
  opacity: 0;
  filter: blur(10px);
  pointer-events: none;
  transition-delay: calc(.1s * var(--i));
}
.login-card.is-active .login-form-box .login-anim { transform: translateX(-120%); }
.login-card.is-active .login-info .login-anim { transform: translateX(120%); }

/* ---------- Form ---------- */
.login-form-box {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 40px 0 35px;
}
.login-form-box h1 {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.login-card.is-setup .login-form-box h1 { font-size: 26px; }
.login-form { margin: 0; }

.login-field {
  position: relative;
  width: 100%;
  height: 50px;
  margin: 22px 0;
}
.login-card.is-setup .login-field { margin: 16px 0; }
.login-field input {
  width: 100%;
  height: 100%;
  padding: 0 30px 0 0;
  border: 0;
  border-bottom: 2px solid var(--login-line);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--login-text);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  transition: border-color .5s;
}
.login-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--login-text);
  transition: background-color 9999s ease 0s;
}
.login-field label {
  position: absolute;
  top: 50%;
  left: 0;
  color: var(--login-text);
  font-size: 16px;
  pointer-events: none;
  transform: translateY(-50%);
  transition: top .5s, font-size .5s, color .5s;
}
.login-field input:focus,
.login-field input:not(:placeholder-shown) { border-bottom-color: var(--login-accent); }
.login-field input:focus ~ label,
.login-field input:not(:placeholder-shown) ~ label {
  top: -5px;
  color: var(--login-accent);
  font-size: 13px;
}
/* Browser autofill (Chrome hides the value until the first interaction, so :placeholder-shown
   still matches). Kept as separate rules: an unknown pseudo-class would void a whole selector list. */
.login-field input:-webkit-autofill { border-bottom-color: var(--login-accent); }
.login-field input:-webkit-autofill ~ label { top: -5px; color: var(--login-accent); font-size: 13px; }
.login-field input:-webkit-autofill ~ .login-field-icon { color: var(--login-accent); }
.login-field input:autofill { border-bottom-color: var(--login-accent); }
.login-field input:autofill ~ label { top: -5px; color: var(--login-accent); font-size: 13px; }
.login-field input:autofill ~ .login-field-icon { color: var(--login-accent); }
.login-card.is-error .login-field input { border-bottom-color: var(--login-error); }

.login-field-icon {
  position: absolute;
  top: 50%;
  right: 0;
  width: 18px;
  height: 18px;
  color: var(--login-text);
  transform: translateY(-50%);
  transition: color .5s;
}
.login-field input:focus ~ .login-field-icon,
.login-field input:not(:placeholder-shown) ~ .login-field-icon { color: var(--login-accent); }

.login-reveal {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  right: -4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.login-reveal .ico { width: 18px; height: 18px; }
.login-reveal:focus-visible { outline: 2px solid var(--login-accent); outline-offset: 2px; }
.login-reveal-open,
.login-reveal[aria-pressed="true"] .login-reveal-closed { display: none; }
.login-reveal[aria-pressed="true"] .login-reveal-open { display: block; }

/* Error line: reserved height so the layout does not jump. */
.login-error {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: -8px 0 8px;
  color: var(--login-error-text);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
}
.login-error .ico { width: 16px; height: 16px; flex: 0 0 auto; }
.login-error.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

.login-submit {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 45px;
  margin-top: 5px;
  overflow: hidden;
  border: 2px solid var(--login-accent);
  border-radius: 40px;
  outline: none;
  background: transparent;
  color: var(--login-text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.login-submit::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -100%;
  left: 0;
  width: 100%;
  height: 300%;
  background: linear-gradient(var(--login-card), var(--login-accent), var(--login-card), var(--login-accent));
  transition: top .5s;
}
.login-submit:hover::before,
.login-submit:focus-visible::before { top: 0; }
.login-submit:focus-visible { box-shadow: 0 0 0 3px rgba(255, 69, 0, .35); }
.login-submit[aria-busy="true"] { cursor: progress; }

/* ---------- Side text ---------- */
.login-info {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 48px 56px 0;
  text-align: right;
}
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--login-accent-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.login-brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.login-info h2 {
  margin: 0;
  font-size: 38px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.01em;
}
.login-info-rule {
  width: 44px;
  height: 3px;
  margin-top: 20px;
  border-radius: 3px;
  background: var(--login-accent-soft);
  opacity: .7;
}
.login-info-text {
  max-width: 250px;
  margin: 16px 0 0;
  color: var(--login-text-dim);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Welcome screen after successful sign-in ---------- */
.login-welcome {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
.login-welcome-icon {
  width: 75px;
  height: 75px;
  margin-bottom: 10px;
  opacity: 0;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, .6));
  transform: scale(0) rotate(-45deg);
  transition: transform .6s var(--login-ease-pop), opacity .6s var(--login-ease-pop);
}
.login-welcome-title {
  margin: 0;
  max-width: 100%;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 5px 25px rgba(0, 0, 0, .5);
  opacity: 0;
  filter: blur(10px);
  transform: translateY(30px) scale(.9);
  transition: transform .7s ease, opacity .7s ease, filter .7s ease;
}
.login-welcome-title span {
  display: block;
  margin-bottom: 5px;
  color: var(--login-accent-soft);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 5px;
}
.login-welcome-name {
  font: inherit;
}
.login-welcome-name.is-personalized {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.login-welcome-brand:not([hidden]) {
  display: block;
  margin-top: 12px;
  color: var(--login-accent-soft);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 3px;
}
.login-loader {
  width: 220px;
  height: 4px;
  margin-top: 30px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, .25);
  opacity: 0;
  transform: translateY(20px);
  transition: transform .5s ease, opacity .5s ease;
}
.login-loader::after {
  content: "";
  display: block;
  width: 0;
  height: 100%;
  background: var(--login-text);
  box-shadow: 0 0 10px var(--login-text);
}
.login-card.is-active .login-welcome-icon { opacity: 1; transform: scale(1) rotate(0); transition-delay: .9s; }
.login-card.is-active .login-welcome-title { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); transition-delay: 1.05s; }
.login-card.is-active .login-loader { opacity: 1; transform: translateY(0); transition-delay: 1.2s; }
.login-card.is-active .login-loader::after { width: 100%; transition: width 1s linear 1.2s; }

/* ---------- Narrow screens: single column, curtain becomes the card background ---------- */
@media (max-width: 720px) {
  .login-card,
  .login-card.is-setup { height: auto; min-height: 0; }
  .login-curtain { inset: 0; width: auto; height: auto; border: 0; opacity: 0; transform: none; transition: opacity .8s ease .2s; }
  .login-card.is-active .login-curtain { opacity: 1; transform: none; }
  .login-form-box { position: relative; width: 100%; height: auto; padding: 36px 24px 28px; }
  .login-info { display: none; }
  .login-welcome-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card *,
  .login-card *::before,
  .login-card *::after,
  .login-card { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
