/* ==========================================================================
   Auth — page layer (login + register, forgot password, reset password)
   --------------------------------------------------------------------------
   A form page on the Platform Element Spec: a 60px bar (brand left, the
   language switch right), one centred form column (≤ 560, here 400), a 26px
   form title (22 on a phone) with one muted lead line under it, DS fields
   (38 tall, 44 with 16px text on touch, 13/500 labels, 8px radius, a green
   border and soft ring on focus) and one 44px solid button.

   The dark side panel reuses the landing hero's wave still so signing in
   reads as the same product; it is decoration and drops out under 860px so
   the form stays above the fold on a phone.

   Errors name the problem and the recovery. A field error sits under its
   field in refusal red (.ds-field__error, aria-invalid); a server result
   sits in a hairline box above the button — red is text and hairline only,
   never a fill or a banner.

   Load order: reset.css -> sayohatchi-tokens.css -> sayohatchi-ds.css -> this.
   ========================================================================== */

.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--surface-card);
  color: var(--text-body);
  font-feature-settings: 'ss01';
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
  min-height: 100vh;
  min-height: 100svh;
}
.auth-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 var(--s-8) var(--s-5);
}
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 60px;
}
.auth-brand { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--h-lg); color: var(--text-strong); }
.auth-brand span { font: 600 var(--text-lead) / 1 var(--font-sans); letter-spacing: var(--tracking-page); }
.auth-lang { flex: none; }

/* The form, centred in whatever height is left between bar and footer. */
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--s-8) 0; }
.auth-stack { width: 100%; max-width: 400px; }

/* js/login.js toggles the two forms with inline display none / flex, so the
   visible state must be flex. */
.auth-form { display: flex; flex-direction: column; gap: var(--s-4); }
.auth-intro { display: grid; gap: var(--s-2); margin-bottom: var(--s-2); }
.auth-heading {
  margin: 0;
  font: var(--type-form-title);
  font-size: var(--title-form);
  letter-spacing: var(--tracking-page);
  color: var(--text-strong);
  text-wrap: balance;
}
.auth-sub { margin: 0; font: var(--type-lead); color: var(--text-muted); }

/* Label row carrying "Forgot password?" opposite the field name. */
.auth-field-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.auth-field-link { font: 500 var(--text-sm) / 1.35 var(--font-sans); color: var(--link); }
.auth-field-link:hover { color: var(--link-hover); text-decoration: underline; }

/* Password: a quiet text toggle inside the control's box. Text, not an eye
   glyph: the icon set has no eye, and "Show" says what it does. */
.auth-input-wrap { position: relative; display: block; }
.auth-input-wrap .ds-field__control { padding-right: 96px; }
.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: var(--s-1);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--h-sm);
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: 500 var(--text-sm) / 1 var(--font-sans);
  color: var(--text-body);
  cursor: pointer;
  transition: var(--transition-control);
}
.password-toggle-btn:hover { background: var(--hover-quiet-bg); color: var(--text-strong); }
.password-toggle-btn:focus-visible { outline-offset: 0; }

/* A server result: a hairline box. js writes `auth-message error|success|info`. */
.auth-message {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border-default);
  border-radius: var(--r);
  background: var(--surface-subtle);
  font: var(--type-meta);
  color: var(--text-strong);
}
.auth-message.error { border-color: var(--border-danger); background: var(--surface-card); }
.auth-message.error::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 var(--s-2) 1px 0;
  border-radius: 50%;
  background: var(--red-700);
}
.auth-message.success,
.auth-message.info { background: var(--surface-selected); border-color: var(--border-default); }
.auth-message a { color: var(--link); text-decoration: underline; }
/* The Terms + data/AI notice on a landing-request sign-up (P3a). */
.auth-form .ds-option__label a { color: var(--link); text-decoration: underline; }

/* Busy submit: the label changes, the button stays the same size. */
.auth-form .ds-btn[aria-busy="true"] { cursor: progress; }

.auth-switch { margin: 0; font: var(--type-meta); color: var(--text-muted); text-align: center; }
.auth-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: 500 var(--text-sm) / 1.45 var(--font-sans);
  color: var(--link);
  cursor: pointer;
}
.auth-link:hover { color: var(--link-hover); text-decoration: underline; }

/* forgot / reset: the "back to sign in" link sits where the brand does. */
.auth-back {
  display: inline-flex;
  align-items: center;
  min-height: var(--h-lg);
  font: 500 var(--text-dense) / 1 var(--font-sans);
  color: var(--text-body);
  transition: var(--transition-control);
}
.auth-back:hover { color: var(--text-strong); text-decoration: underline; }

/* Result states (link sent, password saved, link expired). */
.auth-success { display: grid; justify-items: center; gap: var(--s-2); text-align: center; }
.auth-success .auth-sub { max-width: 36ch; margin-bottom: var(--s-4); }
.auth-success .ds-btn { justify-self: stretch; }
.auth-success-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s-2);
  border-radius: 28%;
  background: var(--surface-selected);
  color: var(--green-700);
}
.auth-success-mark--attention { background: var(--surface-attention); color: var(--amber-700); }

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  flex-wrap: wrap;
  font: var(--type-meta);
  color: var(--text-muted);
}
.auth-foot a { color: var(--text-muted); transition: var(--transition-control); }
.auth-foot a:hover { color: var(--text-strong); text-decoration: underline; }
.auth-foot-links { display: inline-flex; gap: var(--s-4); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Dark side panel — decoration (aria-hidden)
   -------------------------------------------------------------------------- */
.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-12);
  background: var(--green-900) url('/assets/hero/hero-wave.jpg') center / cover no-repeat;
  color: var(--text-on-dark);
}
/* Flat ink wash, not a gradient: holds the copy readable wherever the wave's
   lime crest falls. */
.auth-aside::after { content: ''; position: absolute; inset: 0; background: rgb(15 46 38 / 0.62); }
.auth-aside-body { position: relative; z-index: 1; display: grid; gap: var(--s-8); }
.auth-statement {
  margin: 0;
  max-width: 18ch;
  font: var(--type-form-title);
  letter-spacing: var(--tracking-page);
  color: var(--text-on-dark);
  text-wrap: balance;
}
.auth-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4) var(--s-5);
  margin: 0;
  padding-top: var(--s-5);
  border-top: 1px solid var(--border-on-dark);
}
.auth-facts dt { font: var(--type-label); color: rgb(255 255 255 / 0.6); }
.auth-facts dd { margin: var(--s-1) 0 0; font: 600 var(--text-base) / 1.4 var(--font-sans); color: var(--text-on-dark); overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}

/* Phones: 16px page padding, 22px title, 44px targets (the DS lifts
   fields and buttons; the bar's language switch goes to 44 too). */
@media (max-width: 720px) {
  .auth-col { padding: 0 var(--s-4) var(--s-4); }
  .auth-main { padding: var(--s-6) 0; }
  .auth-heading { font-size: var(--title-page); }
  .auth-sub { font: var(--type-body); }
  .auth-foot { justify-content: center; text-align: center; }
  .auth-foot a { display: inline-flex; align-items: center; min-height: var(--h-lg); }
  /* Standalone links on their own line get the full target; the inline
     "Forgot password?" grows its hit area without moving the label row. */
  .auth-field-link { padding: 12px 0; margin: -12px 0; }
  .auth-switch .auth-link { display: inline-flex; align-items: center; min-height: var(--h-lg); }
  .password-toggle-btn { top: 0; right: 0; transform: none; min-width: var(--h-lg); height: var(--h-lg); }
}
