@import url("./hover-system.css?v=20260812-1");

.page--auth-portal {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 15%, rgb(var(--color-champagne-rgb) / 0.2), transparent 32rem),
    linear-gradient(145deg, #25191a 0%, #100c0d 56%, #310815 100%);
  color: var(--color-ivory);
}

.auth-portal-header {
  position: relative;
  z-index: 5;
  display: flex;
  width: min(100% - 2rem, 72rem);
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-inline: auto;
}

.auth-portal-header .brand,
.auth-portal-header > a:last-child {
  color: var(--color-ivory);
}

.auth-portal-header > a:last-child {
  text-underline-offset: 0.35rem;
}

.auth-portal-main {
  display: grid;
  min-height: calc(100dvh - 8.5rem);
  place-items: center;
  padding: clamp(1rem, 3vw, 3rem) 1rem;
}

.auth-portal {
  --portal-duration: 680ms;
  position: relative;
  isolation: isolate;
  width: min(100%, 68rem);
  min-height: 43rem;
  overflow: hidden;
  border: 1px solid rgb(var(--color-champagne-rgb) / 0.65);
  border-radius: clamp(1.1rem, 2vw, 1.8rem);
  background: #171112;
  box-shadow:
    0 1.5rem 5rem rgb(0 0 0 / 0.42),
    0 0 0 1px rgb(255 255 255 / 0.03) inset;
}

.auth-portal:has(.dev-test-panel:not([hidden])) {
  min-height: 52rem;
}

.auth-portal__curve,
.auth-portal__curve::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.auth-portal__curve--primary {
  inset: -22rem -18rem auto auto;
  width: 61rem;
  height: 62rem;
  border-radius: 46%;
  background:
    linear-gradient(150deg, rgb(var(--color-champagne-rgb) / 0.34), transparent 34%),
    linear-gradient(135deg, #9d0029, var(--color-brand) 55%, #3d0010);
  rotate: 16deg;
  transform-origin: bottom right;
  transition: translate 1s var(--ease-emphasized), rotate 1s var(--ease-emphasized);
}

.auth-portal__curve--secondary {
  inset: auto auto -33rem -27rem;
  width: 67rem;
  height: 66rem;
  border: 2px solid rgb(var(--color-champagne-rgb) / 0.58);
  border-radius: 44%;
  background: #211819;
  rotate: -11deg;
  transition: translate 1s var(--ease-emphasized), rotate 1s var(--ease-emphasized);
}

.auth-portal.is-register .auth-portal__curve--primary {
  translate: -45% 26%;
  rotate: -7deg;
}

.auth-portal.is-register .auth-portal__curve--secondary {
  translate: 48% -24%;
  rotate: 8deg;
}

/* Login starts without decorative/background motion; form feedback and the
   functional login/register panel transition remain available. */
.page--auth-portal[data-auth-initial="login"] .auth-portal__curve {
  transition: none;
}

.page--auth-portal[data-auth-initial="login"] .auth-portal.is-register .auth-portal__curve--primary,
.page--auth-portal[data-auth-initial="login"] .auth-portal.is-register .auth-portal__curve--secondary {
  translate: 0 0;
}

.page--auth-portal[data-auth-initial="login"] .auth-portal.is-register .auth-portal__curve--primary { rotate: 16deg; }
.page--auth-portal[data-auth-initial="login"] .auth-portal.is-register .auth-portal__curve--secondary { rotate: -11deg; }

.auth-portal__form,
.auth-portal__welcome {
  position: absolute;
  inset-block: 0;
  width: 52%;
  transition:
    opacity var(--portal-duration) ease,
    translate var(--portal-duration) var(--ease-emphasized),
    filter var(--portal-duration) ease;
}

.auth-portal__form {
  z-index: 2;
  display: grid;
  align-content: center;
  padding: clamp(2rem, 5vw, 4rem);
}

.auth-portal__form--login { inset-inline-start: 0; }
.auth-portal__form--register { inset-inline-end: 0; }
.auth-portal__welcome--login { inset-inline-end: 0; }
.auth-portal__welcome--register { inset-inline-start: 0; }

.auth-portal__form--register,
.auth-portal__welcome--register {
  visibility: hidden;
  opacity: 0;
  translate: 28% 0;
  filter: blur(0.6rem);
  pointer-events: none;
}

.auth-portal__form--login,
.auth-portal__welcome--login {
  visibility: visible;
  opacity: 1;
  translate: 0;
}

.auth-portal.is-register .auth-portal__form--login,
.auth-portal.is-register .auth-portal__welcome--login {
  visibility: hidden;
  opacity: 0;
  translate: -28% 0;
  filter: blur(0.6rem);
  pointer-events: none;
}

.auth-portal.is-register .auth-portal__form--register,
.auth-portal.is-register .auth-portal__welcome--register {
  visibility: visible;
  opacity: 1;
  translate: 0;
  filter: blur(0);
  pointer-events: auto;
}

.auth-portal__welcome {
  display: grid;
  align-content: center;
  padding: clamp(2.5rem, 7vw, 6.5rem);
}

.auth-portal__welcome h1,
.auth-portal__welcome h2 {
  max-width: 13ch;
  margin: 0 0 var(--space-4);
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.25;
}

.auth-portal__welcome p {
  max-width: 31ch;
  margin: 0;
  color: rgb(255 255 255 / 0.82);
}

.auth-portal__form header {
  margin-block-end: var(--space-5);
}

.auth-portal__form h2 {
  margin: 0 0 var(--space-2);
  color: #fff;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.auth-portal__form header p,
.auth-portal__switch,
.auth-portal__note,
.auth-portal__form .field-hint {
  color: rgb(255 255 255 / 0.7);
}

.auth-portal__form a {
  color: var(--color-champagne);
}

.auth-portal__fields,
.auth-portal__form form {
  display: grid;
  gap: var(--space-4);
}

.auth-portal__fields--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-field {
  position: relative;
  display: grid;
  gap: var(--space-1);
}

.auth-field > span:first-child {
  color: rgb(255 255 255 / 0.82);
  font-size: var(--text-sm);
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 2.7rem 0.75rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 0.8rem;
  outline: 0;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  caret-color: var(--color-champagne);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.auth-field input:focus {
  border-color: var(--color-champagne);
  background: rgb(255 255 255 / 0.1);
  box-shadow: 0 0 0 3px rgb(var(--color-champagne-rgb) / 0.17);
}

.auth-field__icon {
  position: absolute;
  inset-block-end: 0.88rem;
  inset-inline-start: 0.9rem;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-champagne);
  pointer-events: none;
}

.auth-field .password-field {
  display: block;
}

.auth-field .password-field input { padding-inline-end: 4.6rem; }

.auth-field [data-password-toggle] {
  position: absolute;
  inset-block: auto 0.55rem;
  inset-inline-end: 0.55rem;
  min-height: 2.2rem;
  padding-inline: 0.7rem;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--color-champagne);
}

.auth-portal__options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.auth-portal__options .checkbox,
.auth-portal__terms {
  color: rgb(255 255 255 / 0.78);
}

.auth-portal__submit {
  position: relative;
  min-height: 3.2rem;
  overflow: hidden;
  border: 1px solid var(--color-champagne);
  border-radius: var(--radius-pill);
  background: linear-gradient(115deg, var(--color-brand), #a60031 58%, #650019);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0.75rem 1.8rem rgb(var(--color-brand-rgb) / 0.3);
  transition: translate 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.auth-portal__submit:focus-visible { border-color: var(--color-champagne); box-shadow: 0 0.8rem 1.8rem rgb(var(--color-brand-rgb) / 0.34); }

@media (hover: hover) and (pointer: fine) {
  .auth-portal__submit:hover { translate: 0 -1px; border-color: var(--color-champagne); box-shadow: 0 0.8rem 1.8rem rgb(var(--color-brand-rgb) / 0.34); }
}
.auth-portal__submit:active { translate: 0 0; }
.auth-portal__submit:disabled { cursor: wait; filter: grayscale(0.4); opacity: 0.72; }

.auth-portal__otp-toggle {
  min-height: var(--touch-target);
  border: 1px solid rgb(var(--color-champagne-rgb) / 0.55);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.04);
  color: var(--color-champagne);
  font-weight: 800;
}

.otp-login-dialog {
  width: min(100% - 2rem, 30rem);
  padding: 0;
  border: 1px solid rgb(var(--color-champagne-rgb) / 0.7);
  border-radius: var(--radius-xl);
  background: #211819;
  color: #fff;
  box-shadow: 0 2rem 6rem rgb(0 0 0 / 0.55);
}

.otp-login-dialog::backdrop { background: rgb(10 5 7 / 0.78); backdrop-filter: blur(0.25rem); }
.otp-login-dialog__content { display: grid; gap: var(--space-4); padding: clamp(1.5rem, 5vw, 2.5rem); }
.otp-login-dialog__content h2 { margin: 0; }
.otp-login-dialog__content form { display: grid; gap: var(--space-4); }
.otp-login-dialog__close { position: absolute; inset-block-start: 0.75rem; inset-inline-end: 0.75rem; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: rgb(255 255 255 / 0.08); color: #fff; font-size: 1.5rem; }

.auth-portal__switch {
  margin: 0;
  text-align: center;
}

.auth-portal__switch button {
  min-height: var(--touch-target);
  padding-inline: var(--space-2);
  background: transparent;
  color: var(--color-champagne);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.3rem;
}

.auth-portal .form-errors {
  border-color: rgb(255 120 137 / 0.55);
  background: rgb(100 0 21 / 0.55);
  color: #ffe8ed;
}

.auth-portal .password-strength {
  color: var(--color-champagne);
  font-size: var(--text-xs);
}

.auth-portal-footer {
  display: flex;
  width: min(100% - 2rem, 72rem);
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-inline: auto;
  color: rgb(255 255 255 / 0.65);
  font-size: var(--text-sm);
}

.auth-portal-footer a { color: var(--color-champagne); }

@media (max-width: 52rem) {
  .auth-portal { min-height: auto; }
  .auth-portal:has(.dev-test-panel:not([hidden])) { min-height: auto; }
  .auth-portal__curve--primary { inset: -34rem -28rem auto auto; }
  .auth-portal__curve--secondary { display: none; }
  .auth-portal__welcome { display: none; }
  .auth-portal__form,
  .auth-portal__form--login,
  .auth-portal__form--register {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 38rem;
    padding: clamp(1.25rem, 6vw, 2.5rem);
  }
  .auth-portal__form--register { position: absolute; inset: 0; }
  .auth-portal.is-register .auth-portal__form--login { position: absolute; inset: 0; }
  .auth-portal.is-register .auth-portal__form--register {
    position: relative;
    inset: auto;
    min-height: 0;
  }
  .auth-portal__fields--two { grid-template-columns: 1fr; }
}

@media (max-width: 30rem) {
  .auth-portal-header { min-height: 4.5rem; }
  .auth-portal-header .brand__text { display: none; }
  .auth-portal-main { padding-inline: 0.65rem; }
  .auth-portal__options { align-items: start; flex-direction: column; }
  .auth-portal-footer { align-items: start; flex-direction: column; padding-block: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-portal__curve,
  .auth-portal__form,
  .auth-portal__welcome,
  .auth-portal__submit { transition: none; }
  .auth-portal__submit:hover { translate: 0 0; }
}
