/* ==========================================================================
   Sign in / register / reset - layout and the pieces the design system does
   not have. Fields, buttons, errors and hints are the shared m-* components;
   colours and radii come from the --m-* tokens on .mishnah-ui.

   Everything is scoped to .auth, which is also a .mishnah-ui host.
   ========================================================================== */

html { font-size: 62.5%; }
body.mishnah-auth-page { margin: 0; background: hsl(var(--m-bg)); }

.mishnah-ui.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: hsl(var(--m-bg));
}

/* ---- Brand panel --------------------------------------------------------- */
.auth .auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5rem 6rem;
  color: #fff;
  background: hsl(var(--m-navy));
}

.auth .auth-brand > * { position: relative; }

.auth .auth-brand__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}
.auth .auth-brand__blob--1 { width: 48rem; height: 48rem; top: -12rem; left: -10rem; background: hsl(var(--m-brand)); opacity: 0.75; }
.auth .auth-brand__blob--2 { width: 40rem; height: 40rem; bottom: -10rem; right: -8rem; background: #6a4bd8; opacity: 0.5; }
.auth .auth-brand__blob--3 { width: 30rem; height: 30rem; top: 40%; left: 45%; background: hsl(var(--m-action)); opacity: 0.32; }

.auth .auth-brand__grain {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(#000, transparent 85%);
}

.auth .auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
}

.auth .auth-logo img {
  display: block;
  width: auto;
  height: 4rem;
  max-width: 100%;
}

.auth .auth-logo__mark {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 1rem;
  font-size: 1.8rem;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--m-brand)), #7aa9ec);
}

.auth .auth-hero__title {
  margin: 0 0 2rem;
  font-size: var(--h1);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: #fff;
}

.auth .auth-hero__title em {
  font-style: normal;
  background: linear-gradient(90deg, #8bb8f2, #f0a58e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth .auth-hero__text {
  max-width: 44rem;
  font-size: 1.7rem;
  line-height: 1.55;
  color: #a9b8cc;
}

.auth .auth-cards { position: relative; height: 19rem; margin-top: 4rem; }

.auth .auth-card {
  position: absolute;
  padding: 1.8rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 1.8rem;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}
.auth .auth-card--1 { left: 0; top: 0; width: 30rem; }
.auth .auth-card--2 { left: 20rem; top: 8.5rem; width: 27rem; }
.auth .auth-card small { font-size: 1.2rem; color: #9db0c8; }
.auth .auth-card b { display: block; margin: 0.3rem 0 1.2rem; font-size: 1.6rem; font-weight: 600; }

.auth .auth-bar { height: 0.7rem; overflow: hidden; border-radius: 9px; background: rgba(255, 255, 255, 0.14); }
.auth .auth-bar i { display: block; width: 0; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #4f93ec, #8bd0ff); }

.auth .auth-dots { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.auth .auth-dots i { width: 1.6rem; height: 1.6rem; border-radius: 0.5rem; background: rgba(255, 255, 255, 0.15); }
.auth .auth-dots i.is-done { background: hsl(var(--m-viz-open)); }

/* ---- Form side ----------------------------------------------------------- */
.auth .auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 3rem;
}

.auth .auth-logo--small { display: none; margin-bottom: 3rem; color: hsl(var(--m-fg)); }

.auth .auth-panel { width: 100%; max-width: 42rem; }

.auth .auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.4rem;
  margin-bottom: 3rem;
  border-radius: var(--m-radius);
  background: hsl(var(--m-muted));
}

.auth .auth-tabs button {
  position: relative;
  z-index: 1;
  padding: 1rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 550;
  color: hsl(var(--m-muted-fg));
  cursor: pointer;
  transition: color 0.2s;
}
.auth .auth-tabs button.is-on { color: hsl(var(--m-fg)); }

.auth .auth-tabs__indicator {
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  left: 0;
  width: 50%;
  border-radius: calc(var(--m-radius) - 0.4rem);
  background: hsl(var(--m-card));
  box-shadow: var(--m-shadow-sm);
}

.auth .auth-tabs[hidden] { display: none; }
.auth.is-busy .auth-panel { opacity: 0.6; pointer-events: none; transition: opacity 0.2s; }

.auth .auth-stage { position: relative; }
.auth .auth-screen[hidden] { display: none; }

.auth .auth-title { margin: 0 0 0.8rem; font-size: 2.8rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.02em; }
.auth .auth-sub { margin: 0 0 2.4rem; font-size: 1.6rem; line-height: 1.55; color: hsl(var(--m-muted-fg)); }
.auth .auth-sub b { font-weight: 600; color: hsl(var(--m-fg)); }

.auth .auth-form { display: grid; gap: 1.8rem; }
.auth .auth-form .m-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.auth .m-field-row[hidden] { display: none; }

.auth .auth-submit { width: 100%; }
.auth .m-btn--brand.auth-submit { box-shadow: 0 6px 18px -6px hsl(var(--m-brand)); }
.auth .auth-submit[disabled] { opacity: 0.7; cursor: progress; }

.auth .auth-label-link {
  float: inline-end;
  font-size: 1.4rem;
  font-weight: 450;
  color: hsl(var(--m-brand));
  text-decoration: none;
}
.auth a:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth .auth-foot { margin: 2.4rem 0 0; text-align: center; font-size: 1.5rem; color: hsl(var(--m-muted-fg)); }
.auth .auth-foot a { font-weight: 550; color: hsl(var(--m-brand)); }
.auth .auth-fine { text-align: center; font-size: 1.3rem; line-height: 1.5; color: hsl(var(--m-muted-fg)); }

/* Google */
.auth .auth-google { display: flex; justify-content: center; min-height: 4rem; }
.auth .auth-or { display: flex; align-items: center; gap: 1.2rem; margin: 2rem 0; font-size: 1.4rem; color: hsl(var(--m-muted-fg)); }
.auth .auth-or::before, .auth .auth-or::after { content: ""; flex: 1; height: 1px; background: hsl(var(--m-border)); }

/* Checkbox */
.auth .auth-check { position: relative; display: flex; align-items: center; gap: 1rem; font-size: 1.5rem; cursor: pointer; }
.auth .auth-check input { position: absolute; opacity: 0; }
.auth .auth-check__box {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border: 1.5px solid hsl(var(--m-input));
  border-radius: 0.6rem;
  background: hsl(var(--m-card));
  color: transparent;
  transition: all 0.2s;
}
.auth .auth-check__box svg { width: 1.3rem; height: 1.3rem; stroke-width: 3; }
.auth .auth-check input:checked + .auth-check__box { border-color: hsl(var(--m-brand)); background: hsl(var(--m-brand)); color: #fff; }
.auth .auth-check input:focus-visible + .auth-check__box { box-shadow: 0 0 0 3px hsl(var(--m-ring) / 0.2); }
.auth .auth-checks { display: grid; gap: 1.2rem; }
.auth .auth-checks [hidden] { display: none; }

/* Password strength */
.auth .auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 1rem; }
.auth .auth-meter i { height: 0.4rem; border-radius: 9px; background: hsl(var(--m-border)); transition: background 0.3s; }
.auth .auth-meter[data-score="1"] i:nth-child(-n+1) { background: hsl(var(--m-danger)); }
.auth .auth-meter[data-score="2"] i:nth-child(-n+2) { background: #e8a33a; }
.auth .auth-meter[data-score="3"] i:nth-child(-n+3) { background: #e8a33a; }
.auth .auth-meter[data-score="4"] i { background: hsl(var(--m-viz-open)); }

/* Icons */
.auth .auth-icon {
  display: grid;
  place-items: center;
  width: 6rem;
  height: 6rem;
  margin-bottom: 2rem;
  border-radius: 50%;
  background: hsl(var(--m-brand-soft));
  color: hsl(var(--m-brand));
}
.auth .auth-icon svg { width: 2.8rem; height: 2.8rem; }
.auth .auth-icon--ok { background: hsl(var(--m-viz-done-track)); color: hsl(var(--m-viz-done)); }

/* Cloudflare slot: reserve the height so the form does not jump when it loads */
.auth .auth-captcha:not(:empty) { min-height: 6.5rem; }

/* Phone input (intl-tel-input) sits inside the field and inherits its width */
.auth .iti { display: block; width: 100%; }
.auth .iti .m-input { padding-inline-start: 5.4rem; }

/* Read-only email on an invitation */
.auth .m-input[readonly] { background: hsl(var(--m-muted)); color: hsl(var(--m-muted-fg)); }

/* ---- Small screens ------------------------------------------------------- */
@media (max-width: 900px) {
  .mishnah-ui.auth { grid-template-columns: 1fr; }
  .auth .auth-brand { display: none; }
  .auth .auth-logo--small { display: inline-flex; }
  .auth .auth-main { justify-content: flex-start; padding-top: 5rem; }
}

@media (max-width: 480px) {
  .auth .auth-form .m-field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .auth * { animation: none !important; transition: none !important; }
}
