/* ==========================================================================
   Unyte app pages: log in, sign up, dashboard, 404.
   Same starfield, glass and type as the home page, laid out for single screens.
   ========================================================================== */

/* html already paints black. A transparent body lets the fixed backdrop (z-index -1) show through. */
body { min-height: 100svh; background: transparent; }

/* ---- Space backdrop ------------------------------------------------------ */
.space { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--black); pointer-events: none; }
.space__stars { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.space__earth {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: min(32vh, 46vw); min-height: 220px;
  object-fit: cover; object-position: 74% 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 60%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 60%);
}
.space--photo .space__stars { opacity: 1; }
.space--low .space__earth { height: min(26vh, 36vw); min-height: 180px; }

/* ---- Shared motion ------------------------------------------------------- */
/* Glass reads the photo behind it. Anything faded with opacity (or filtered, masked or clipped)
   becomes a "backdrop root", and glass inside it sees nothing until the fade ends, then snaps on.
   So never fade an ancestor of glass: slide the container, fade the leaves. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise  { from { opacity: 0; transform: translateY(14px); } }
  @keyframes fade  { from { opacity: 0; } }
  @keyframes slide { from { transform: translateY(14px); } }

  .rise       { animation: rise  .9s var(--ease) backwards; animation-delay: var(--d, 0s); }
  .rise-slide { animation: slide .9s var(--ease) backwards; animation-delay: var(--d, 0s); }

  /* Leaves on the log in, sign up and 404 pages */
  .auth :is(.panel__head, .field > label, .field__hint, .panel__alt, .form__error, .control input,
            .control .glass, .reveal, .submit > *, .brand__name, .brand .mark > *) {
    animation: fade .9s var(--ease) backwards;
    animation-delay: var(--d, 0s);
  }
}

/* ---- Auth layout --------------------------------------------------------- */
.auth {
  --pad: clamp(22px, 6vw, 64px);
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(26px, 5vh, 44px);
  padding: calc(env(safe-area-inset-top, 0px) + clamp(32px, 6vh, 72px)) var(--pad) calc(env(safe-area-inset-bottom, 0px) + clamp(40px, 8vh, 96px));
}
.auth .brand { width: clamp(136px, 28vw, 184px); }

.panel { position: relative; isolation: isolate; width: min(100%, 460px); display: grid; gap: 24px; --d: .12s; }
/* Soft dark halo so text stays readable when the Earth sits behind the form. */
.panel::before {
  content: "";
  position: absolute;
  inset: -56px -72px -40px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgb(0 0 0 / .62) 0%, rgb(0 0 0 / .46) 48%, transparent 76%);
}
.panel__head { display: grid; gap: 10px; text-align: center; }
.panel__title {
  font-size: clamp(30px, 6vw, 40px);
  font-weight: 590;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.panel__lead {
  font-size: clamp(17px, 4vw, 20px);
  font-weight: 274;
  line-height: 1.5;
  color: rgb(255 255 255 / .82);
}
.panel__alt {
  text-align: center;
  font-size: 17px;
  font-weight: 274;
  color: var(--cue);
}
.panel__alt a {
  color: var(--white);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / .4);
  text-underline-offset: 4px;
  transition: text-decoration-color .3s var(--ease);
}
.panel__alt a:hover { text-decoration-color: rgb(255 255 255 / .9); }
.panel__alt a:focus-visible { outline: 2px solid rgb(255 255 255 / .9); outline-offset: 4px; border-radius: 4px; }

/* ---- Form ---------------------------------------------------------------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label {
  padding-left: 24px;
  font-size: 16px;
  font-weight: 400;
  color: rgb(255 255 255 / .86);
}
.field__hint, .field__error {
  padding: 0 24px;
  font-size: 15px;
  line-height: 1.4;
}
.field__hint { color: var(--muted); font-weight: 274; }
.field__error { color: #ff9d9d; }
.field__error:empty { display: none; }

.control {
  --tint: var(--silver);
  --tint-a: .12;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  height: 64px;
  border-radius: 999px;
  transition: box-shadow .35s var(--ease);
}
.control .glass { transition: background-color .35s var(--ease); }
.control:focus-within {
  --tint: var(--blue);
  --tint-a: .22;
  box-shadow: 0 0 0 3px rgb(0 153 255 / .32);
}
.control[data-invalid="true"] { --tint: 255 99 99; --tint-a: .2; }
.control[data-invalid="true"]:focus-within { box-shadow: 0 0 0 3px rgb(255 99 99 / .3); }

.control input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 28px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--white);
  font: 274 20px/1 var(--font);
  letter-spacing: .005em;
}
.control input::placeholder { color: rgb(255 255 255 / .38); }
.control input:-webkit-autofill,
.control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--white);
  caret-color: var(--white);
  box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 99999s ease-out;
}

.reveal {
  margin-right: 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cue);
  font: 274 15px/1 var(--font);
  cursor: pointer;
  transition: color .3s var(--ease), background-color .3s var(--ease);
}
.reveal:hover { color: var(--white); background: rgb(255 255 255 / .08); }
.reveal:focus-visible { outline: 2px solid rgb(255 255 255 / .9); outline-offset: 2px; }

.form__error {
  padding: 0 24px;
  text-align: center;
  font-size: 16px;
  line-height: 1.4;
  color: #ff9d9d;
}
.form__error:empty { display: none; }

.submit {
  width: 100%;
  height: 64px;
  margin-top: 6px;
  border: 0;
  padding: 0;
  background: none;
  font-family: var(--font);
  font-size: 22px;
  cursor: pointer;
}
.submit[aria-busy="true"] { cursor: progress; filter: brightness(.9); pointer-events: none; }

.link-btn { height: 64px; padding: 0 40px; font-size: 22px; }

@media (max-width: 480px) {
  .control, .submit, .link-btn { height: 60px; }
  .control input { font-size: 19px; padding: 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .control, .control .glass, .reveal, .panel__alt a { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
