/* Auth: the sign-in and sign-up screen, with what Qiyal is beside the form */

.auth-view {
  display: flex;
  width: min(calc(100% - 32px), 1080px);
  min-height: 100vh;
  flex-direction: column;
  margin: 0 auto;
}

.auth-header {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-main {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  padding: 18px 0 42px;
}

.auth-landing {
  display: grid;
  width: 100%;
  gap: 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  overflow: hidden;
  border: 1px solid var(--card-line);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

/* What Qiyal is, beside the form: dark in both themes. */
.welcome-hero {
  position: relative;
  min-height: 600px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(124deg, rgba(102, 87, 199, 0.25), transparent 52%),
    var(--night);
}

.welcome-hero::before {
  position: absolute;
  top: -170px;
  right: -100px;
  width: 500px;
  height: 500px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 46px 44px 0;
}

.hero-copy .eyebrow {
  color: #ffe298;
}

.hero-copy h2 {
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 4.4vw, 3.4rem);
  line-height: 0.98;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 400px;
  margin-bottom: 24px;
  color: #dfdcf4;
  font-size: 1.05rem;
}

/* The hero is dark in both themes, so its gold button keeps dark ink. */
.hero-copy .button-primary {
  color: #26234f;
  background: #ffd66b;
  box-shadow: 0 10px 24px rgba(255, 209, 88, 0.2);
}

.hero-copy .button-primary:hover {
  background: #ffe08c;
}

/* The art keeps its own size and is drawn smaller in the hero's corner. */
.hero-art {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 360px;
  height: 430px;
  transform: scale(0.7);
  transform-origin: right bottom;
}

.hero-moon {
  position: absolute;
  top: 48px;
  right: 64px;
  width: 184px;
  height: 184px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.78) 0 5%, transparent 6%),
    radial-gradient(circle at 70% 55%, rgba(198, 173, 92, 0.19) 0 8%, transparent 9%),
    #ffe49c;
  box-shadow:
    0 0 0 18px rgba(255, 226, 147, 0.07),
    0 0 80px rgba(255, 222, 128, 0.32);
}

.hero-orbit {
  position: absolute;
  top: 89px;
  right: 23px;
  width: 270px;
  height: 124px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  transform: rotate(-17deg);
}

.hero-orbit::after {
  position: absolute;
  top: 82px;
  left: 17px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff8975;
  box-shadow: 0 0 0 7px rgba(255, 137, 117, 0.12);
  content: "";
}

.hero-book-stack {
  position: absolute;
  right: 40px;
  bottom: 37px;
  width: 270px;
  height: 188px;
}

.hero-book {
  position: absolute;
  right: 0;
  display: block;
  height: 45px;
  border: 4px solid rgba(27, 25, 61, 0.45);
  border-radius: 7px 13px 13px 7px;
  box-shadow: 0 12px 18px rgba(19, 17, 49, 0.22);
}

.hero-book::after {
  position: absolute;
  top: 7px;
  right: 10px;
  bottom: 7px;
  width: 70%;
  border-radius: 4px 9px 9px 4px;
  background: rgba(255, 255, 255, 0.75);
  content: "";
}

.hero-book-one {
  bottom: 0;
  width: 252px;
  background: #ee725f;
  transform: rotate(2deg);
}

.hero-book-two {
  right: 20px;
  bottom: 49px;
  width: 230px;
  background: #58b5a6;
  transform: rotate(-3deg);
}

.hero-book-three {
  right: 4px;
  bottom: 101px;
  width: 214px;
  background: #8d7bde;
  transform: rotate(4deg);
}

.hero-sprout {
  position: absolute;
  right: 130px;
  bottom: 171px;
  width: 6px;
  height: 50px;
  border-radius: 8px;
  background: #7fd4a3;
  transform: rotate(-5deg);
}

.hero-sprout::before,
.hero-sprout::after {
  position: absolute;
  width: 29px;
  height: 15px;
  border-radius: 100% 0 100% 0;
  background: #8be1ae;
  content: "";
}

.hero-sprout::before {
  top: 6px;
  left: 2px;
  transform: rotate(-15deg);
}

.hero-sprout::after {
  top: 23px;
  right: 1px;
  transform: scaleX(-1) rotate(-12deg);
}

.hero-star {
  position: absolute;
  color: #ffe092;
  font-size: 1.2rem;
  animation: soft-twinkle 3.2s ease-in-out infinite;
}

.hero-star-one {
  top: 63px;
  left: 30px;
}

.hero-star-two {
  top: 213px;
  right: 24px;
  font-size: 0.9rem;
  animation-delay: 0.8s;
}

.auth-guide {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  padding: 28px 32px;
  border: 1px solid rgba(102, 87, 199, 0.16);
  border-radius: 26px;
  background: var(--guide);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.guide-intro {
  align-self: center;
}

.guide-intro h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.guide-intro p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.auth-card {
  width: min(100%, 560px);
  padding: 44px;
  border-radius: 28px;
  background: var(--paper);
}

.auth-layout .auth-card {
  width: 100%;
  align-self: center;
  border-radius: 0;
}

/* The form alone, for a reader who came from a shared book. */
.auth-main > .auth-form-card {
  border: 1px solid var(--card-line);
  box-shadow: var(--shadow-lg);
}

.auth-message-card,
.auth-loading-card {
  border: 1px solid var(--card-line);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-message-card h1,
.auth-loading-card h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1;
}

.auth-message-card > p:not(.eyebrow),
.auth-loading-card > p:not(.eyebrow) {
  max-width: 430px;
  margin-right: auto;
  margin-bottom: 24px;
  margin-left: auto;
  color: var(--ink-soft);
}

.auth-card-spark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 20px 20px 20px 7px;
  color: #fff;
  background: var(--violet-fill);
  box-shadow: 0 8px 20px rgba(102, 87, 199, 0.24);
  font-size: 1.35rem;
}

.auth-loading-orbit {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 0 auto 19px;
  border: 2px solid var(--track);
  border-radius: 50%;
}

.auth-loading-orbit span {
  position: absolute;
  top: -5px;
  left: 28px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 3px 10px rgba(167, 116, 10, 0.3);
  animation: auth-orbit 1.8s linear infinite;
  transform-origin: 8px 41px;
}

/* Back to the shared book a reader left to sign up or log in. */
.auth-back-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  margin: -8px 0 14px -11px;
  padding: 8px 11px;
  border: 0;
  border-radius: 11px;
  color: var(--violet-dark);
  background: transparent;
  font-weight: 850;
}

.auth-back-button:hover {
  color: var(--ink);
  background: var(--violet-pale);
}

.auth-heading {
  margin-bottom: 26px;
}

.auth-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(2.15rem, 5vw, 3.25rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.auth-heading > p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-weight: 900;
}

.auth-field > label {
  font-weight: 900;
}

.auth-field > small {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--field-line);
  border-radius: 13px;
  background: var(--field);
  font-weight: 600;
}

.auth-field input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px var(--focus-glow);
  outline: 0;
}

.auth-field input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-glow);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 64px;
  min-height: 44px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--violet-dark);
  background: var(--violet-pale);
  font-size: 0.8rem;
  font-weight: 900;
}

.password-toggle:hover {
  background: var(--violet-hover);
}

.field-error {
  color: var(--error-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-small-print {
  padding: 14px 15px;
  border-radius: 14px;
  color: var(--ink-soft);
  background: var(--small-print);
  font-size: 0.77rem;
  line-height: 1.45;
}

.auth-small-print p {
  margin-bottom: 8px;
}

.auth-small-print p:last-child {
  margin-bottom: 0;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--ink-soft);
  text-align: center;
}

.auth-switch button {
  min-height: 44px;
  padding: 7px 8px;
  border: 0;
  color: var(--violet-dark);
  background: transparent;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 22px;
  border: 1px solid var(--violet-line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--violet-pale);
  font-size: 0.82rem;
  font-weight: 750;
}

.auth-notice > span {
  color: var(--gold);
  font-weight: 900;
}

.auth-notice p {
  margin: 0;
}

.auth-footer {
  padding: 4px 0 25px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 1000px) {
  .auth-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .auth-layout {
    display: block;
  }

  .welcome-hero {
    min-height: auto;
  }

  .hero-copy {
    padding: 36px 32px 32px;
  }

  .hero-art {
    display: none;
  }
}

@media (max-width: 780px) {
  .auth-view {
    width: min(calc(100% - 24px), 620px);
  }

  .auth-header {
    min-height: 74px;
  }

  .auth-main {
    align-items: start;
    padding-top: 8px;
  }

  .auth-layout {
    border-radius: 26px;
  }

  .auth-card {
    padding: 32px 25px;
  }

  .auth-guide {
    gap: 18px;
    padding: 23px 19px;
  }
}

@media (max-width: 500px) {
  .auth-view {
    width: min(calc(100% - 20px), 620px);
  }

  .auth-card {
    padding: 28px 18px;
  }

  .auth-heading h1 {
    font-size: 2.25rem;
  }

  .hero-copy {
    padding: 28px 22px 26px;
  }

  .hero-copy h2 {
    font-size: 2.1rem;
  }

  .hero-copy > p:not(.eyebrow) {
    margin-bottom: 18px;
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .auth-card {
    padding-inline: 15px;
  }

  .auth-field input {
    font-size: 1rem;
  }
}

@keyframes auth-orbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
