/*===============================================*\
|| TerraLoc auth: sign in, register, reset        ||
|| ---------------------------------------------- ||
|| The valley, full bleed. One night-ground screen ||
|| carrying the contour rings and the day's        ||
|| profile, with the form on a paper card.         ||
|| Replaces the stock JScms split, which put a     ||
|| stock photo and a JScms marketing quote on half ||
|| the screen.                                     ||
\*===============================================*/

/*
 * The forms themselves are core. DynamicAuthForms renders login, forgot and
 * reset into #authContainer with their labels above the field, and the
 * register form comes from DynamicRegisterForms with floating labels. Nothing
 * here rewrites that markup, it only dresses it, so a core update does not
 * land on a fork of the login form.
 */

.tl-auth {
  /*
   * These screens carry no app chrome, so they cannot inherit the landing's
   * palette pin and need their own. Same reason as tl-landing.css: the site
   * theme flips --tl-paper to near-black, and the card would go with it.
   */
  --tl-paper:        #F3F2EC;
  --tl-paper-deep:   #E9E7DD;
  --tl-panel:        #FAF9F4;
  --tl-ink:          #23281F;
  --tl-muted:        #5C6253;
  --tl-dim:          #8B8F80;
  --tl-hairline:     #DFDCCB;
  --tl-accent:       #46603C;
  --tl-accent-ink:   #F3F2EC;
  --tl-accent-hover: #2E4228;
  --tl-cta:          #C86B3F;
  --tl-cta-ink:      #F3F2EC;
  --tl-cta-hover:    #A8512E;
  --tl-sage:         #9FB08A;
  --tl-night:        #14180F;
  --tl-night-ink:    #C9CDBD;
  --tl-night-line:   #2C3625;
  --tl-night-muted:  #8B937D;
  --tl-night-faint:  #55604A;
  --tl-ink-rgb:      35, 40, 31;
  --tl-cta-rgb:      200, 107, 63;

  --bs-body-color:      var(--tl-ink);
  --bs-heading-color:   var(--tl-ink);
  --bs-emphasis-color:  var(--tl-ink);
  --bs-secondary-color: var(--tl-muted);
  --bs-border-color:    var(--tl-hairline);
  --bs-link-color:      var(--tl-accent);
  --bs-link-hover-color: var(--tl-accent-hover);

  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
  background: var(--tl-night);
  color: var(--tl-night-ink);
  font-family: var(--tl-font-body, "Archivo", Helvetica, Arial, sans-serif);
}

/* The ridge glow, warm, off the same corner as the landing's finale. */
.tl-auth-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 520px at 78% 8%, rgba(var(--tl-cta-rgb), 0.13), transparent 65%);
  pointer-events: none;
}

/* The contour rings. Same two clusters as the finale, so the screen you sign
   in on is recognisably the screen you were just reading. */
.tl-auth-contours {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 760px;
  opacity: 0.7;
  pointer-events: none;
}

.tl-auth-inner {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  width: min(94%, 1240px);
  margin: 0 auto;
  padding: 6rem 0 4rem;
  gap: clamp(2rem, 6vw, 5rem);
}

/* ---------- the brand, top left ---------- */

.tl-auth-brand {
  position: absolute;
  top: 2rem;
  left: max(3%, calc((100% - 1240px) / 2));
  z-index: 3;
  display: inline-flex;
  align-items: center;
}
.tl-auth-brand img { display: block; height: 26px; width: auto; }

/* ---------- the pitch beside the card ---------- */

.tl-auth-pitch { flex: 1 1 auto; max-width: 30rem; }

.tl-auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--tl-sage);
}

.tl-auth-h1 {
  margin: 1.5rem 0 0;
  font-family: var(--tl-font-display, "Bricolage Grotesque", sans-serif);
  font-size: clamp(2.25rem, 4.4vw, 3.75rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--tl-paper);
}
.tl-auth-h1 em { font-style: italic; color: var(--tl-cta); }

.tl-auth-lede {
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--tl-night-ink);
}

/* Three plain lines rather than a feature grid: this is a door, not a pitch
   deck, and the landing has already made the argument. */
.tl-auth-points {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.tl-auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9375rem;
  color: var(--tl-night-ink);
}
.tl-auth-points svg { flex: 0 0 auto; margin-top: 2px; color: var(--tl-sage); }

/* ---------- the card ---------- */

.tl-auth-card {
  flex: 0 0 26.5rem;
  max-width: 100%;
  /* A flex item's automatic minimum size is its content, not its basis: the
     2FA state's six code boxes pushed the card past 26.5rem and off the right
     of the screen, taking the verify button with it. */
  min-width: 0;
  padding: 2.5rem;
  border-radius: 14px;
  background: var(--tl-panel);
  color: var(--tl-ink);
  box-shadow: 0 40px 80px -32px rgba(0, 0, 0, 0.75), 0 8px 24px -12px rgba(0, 0, 0, 0.45);
}

.tl-auth-card-head { margin-bottom: 1.75rem; }
.tl-auth-card-eyebrow {
  display: block;
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tl-accent);
}
.tl-auth-card h2 {
  margin: 0.75rem 0 0;
  font-family: var(--tl-font-display, "Bricolage Grotesque", sans-serif);
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tl-ink);
}

/*
 * The card's heading follows the form inside it. Default is the sign-in head;
 * the forgot head replaces it when that form is present, and the reset state
 * prints its own <h4>, so both of ours stand down.
 */
.tl-auth-card-head[data-tl-state="forgot"],
.tl-auth-card-head[data-tl-state="2fa"] { display: none; }
.tl-auth-card:has(#forgotPasswordForm) .tl-auth-card-head[data-tl-state="login"] { display: none; }
.tl-auth-card:has(#forgotPasswordForm) .tl-auth-card-head[data-tl-state="forgot"] { display: block; }
/* The 2FA form's id starts with a digit, so it has to be escaped: #2faForm is
   not a valid selector and the whole rule was being dropped. */
.tl-auth-card:has(#resetPasswordForm) .tl-auth-card-head,
.tl-auth-card:has(#\32 faForm) .tl-auth-card-head[data-tl-state="login"],
.tl-auth-card:has(#\32 faForm) .tl-auth-card-head[data-tl-state="forgot"],
.tl-auth-card-head[data-tl-state="2fa"] { display: none; }
.tl-auth-card:has(#\32 faForm) .tl-auth-card-head[data-tl-state="2fa"] { display: block; }

.tl-auth-card #authContainer h4 {
  margin: 0 0 0.5rem;
  font-family: var(--tl-font-display, "Bricolage Grotesque", sans-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tl-ink);
}

/* The description the core form prints above its fields. */
.tl-auth-card #authContainer > p,
.tl-auth-card .jscms-register-intro {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--tl-muted);
}

/* ---------- the core form ----------
   The fields, the labels and the buttons are dressed once in tl-forms.css,
   under .tl-form, which this card carries. Only what is specific to an auth
   card is left here. */

/*
 * The core puts "remember me" and "forgot password" in one
 * justify-content-between row, which assumes a wider column than this card
 * has: at 26.5rem the two ran into each other with no space between them.
 */
.tl-auth-card #authContainer .d-flex.justify-content-between:not(.autotab) {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

/*
 * The login state's description says "Welcome back, please login with your
 * email address", which is the card's own headline again in longer words.
 * Hidden only there: on the forgot and reset states the same paragraph is the
 * only thing explaining what is about to happen, so it stays.
 */
.tl-auth-card #authContainer:has(#loginForm) > p { display: none; }

/*
 * The 2FA code: six boxes in a row, not six full-width fields. They are
 * .form-control like every other input, so the field padding and the 100%
 * width both have to be undone here.
 */
.tl-auth-card .autotab { flex-wrap: nowrap; }
.tl-auth-card .autotab .form-control {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 56px;
  padding: 0 !important;
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.tl-auth-card .login-countdown {
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tl-muted);
}

/* ---------- the door to the other screen ---------- */

.tl-auth-alt {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--tl-hairline);
  font-size: 0.9375rem;
  color: var(--tl-muted);
  text-align: center;
}
.tl-auth-alt a { font-weight: 600; }

/* ---------- the day's profile, along the foot ---------- */

.tl-auth-profile {
  position: relative;
  z-index: 2;
  width: min(94%, 1240px);
  margin: 0 auto;
  padding-bottom: 2rem;
}
.tl-auth-profile svg { display: block; width: 100%; height: 84px; }
.tl-auth-profile-marks {
  position: relative;
  height: 1rem;
  margin-top: 0.625rem;
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.tl-auth-profile-marks span { position: absolute; top: 0; white-space: nowrap; }
.tl-auth-mark-start  { left: 0; color: var(--tl-night-faint); }
.tl-auth-mark-summit { left: 26%; transform: translateX(-50%); color: var(--tl-night-muted); }
.tl-auth-mark-end    { right: 0; color: var(--tl-sage); }

@keyframes tl-auth-pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }
.tl-auth .pulse { animation: tl-auth-pulse 2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .tl-auth .pulse { animation: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 991.98px) {
  /* The pitch is the first thing to go: the card is why anyone is here. */
  .tl-auth-inner { flex-direction: column; align-items: stretch; padding-top: 5.5rem; }
  .tl-auth-pitch { max-width: none; }
  .tl-auth-h1 { font-size: clamp(2rem, 6vw, 2.75rem); }
  .tl-auth-card { flex: 1 1 auto; align-self: center; width: 100%; max-width: 28rem; }
  .tl-auth-profile { padding-bottom: 1.5rem; }
}

@media (max-width: 767.98px) {
  .tl-auth-inner { padding: 5rem 0 2.5rem; gap: 2.25rem; }
  .tl-auth-card { padding: 1.75rem 1.375rem; }
  .tl-auth-points { gap: 0.625rem; }
  .tl-auth-brand { left: 3%; top: 1.5rem; }
  /* At this width the summit label collides with both of its neighbours. */
  .tl-auth-mark-summit { display: none; }
  .tl-auth-profile svg { height: 60px; }
}
