/* ============================================================
   USMLE Wise — Auth & landing pages (design guide)
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--uw-bg);
}

/* The auth top bar is `.site-header` / `.site-brand` in theme.css, shared with
   the landing nav — see partials/site/header.php. The old `.auth-header` and
   `.auth-lockup` rules that used to live here were a second copy of it and had
   drifted (40px emblem vs 32px, 1140px container vs 1200px, and the whole
   wordmark set in the display italic instead of only "Wise"). */

/* ============================================================
   Sign-in — split layout (login.php → partials/auth/login_view.php)
   Brand panel on the left at desktop widths; below 992px only the
   form column remains, because signing in is why the page is open.
   Structure follows the StepGenie sign-up page; every colour, type
   and spacing value is a design-system token.
   ============================================================ */
.auth-split {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
  background: var(--uw-bg);
}

.auth-panel {
  margin: var(--space-8) 0 var(--space-8) var(--space-8);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  color: var(--uw-on-brand);
  background:
    radial-gradient(720px 420px at 15% 0%, var(--uw-blue-400), transparent 70%),
    var(--uw-blue-600);
}

[data-theme="dark"] .auth-panel {
  background:
    radial-gradient(720px 420px at 15% 0%, var(--uw-blue-700), transparent 70%),
    var(--uw-blue-900);
  border: 1px solid var(--uw-border);
}

.auth-panel__inner { max-width: 440px; text-align: center; }

.auth-panel__emblem {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-6);
}

.auth-panel__eyebrow {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: color-mix(in srgb, var(--uw-on-brand) 72%, transparent);
}

/* White italic, not the usual red accent: red on brand blue is ~2:1. */
.auth-panel__title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-4xl);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--uw-on-brand);
}
.auth-panel__title em { font-style: italic; }

.auth-panel__lede {
  max-width: 34ch;
  margin: 0 auto;
  font-size: var(--fs-lg);
  line-height: 1.55;
  color: color-mix(in srgb, var(--uw-on-brand) 85%, transparent);
}

/* Takes the place of StepGenie's logo strip with something we can back up. */
.auth-panel__stat {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--r-lg);
  background: var(--uw-surface);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

/* nowrap + no shrink: as a flex item beside a long label the number was
   squeezed until "1,240" broke across two lines. */
.auth-panel__stat-num {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--uw-blue-500);
}
[data-theme="dark"] .auth-panel__stat-num { color: var(--uw-blue-300); }

.auth-panel__stat-label {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--uw-ink-700);
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-8);
}

.auth-main__bar { display: flex; justify-content: flex-end; }
.auth-main__bar .theme-toggle { width: 44px; height: 44px; }

/* 400px is Google's widest button, so the Google button and the fields line up. */
.auth-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding-block: var(--space-6);
}

.auth-form .site-brand { align-self: center; margin-bottom: var(--space-6); }
/* theme.css hides the wordmark under 380px to make room in the header bar;
   there is no bar here. */
.auth-form .site-brand__word { display: inline; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  padding: var(--space-1);
  border-radius: var(--r-lg);
  background: var(--uw-ink-75);
}

.auth-switch__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--uw-ink-600);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) {
  a.auth-switch__item:hover { color: var(--uw-ink-900); background: var(--uw-surface); }
}

.auth-switch__item:focus-visible {
  outline: 2px solid var(--uw-blue-300);
  outline-offset: 2px;
}

.auth-switch__item.is-active {
  background: var(--uw-blue-500);
  color: var(--uw-on-brand);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* `body.uw-theme` prefix: theme.css sets every `body.uw-theme h1` to the sans
   face, and main.css gives h1 a 52px line-height and weight 700. */
body.uw-theme .auth-form__title {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--uw-ink-900);
}

.auth-form__intro {
  margin: 0 0 var(--space-5);
  font-size: var(--fs-sm);
  color: var(--uw-ink-600);
}

.auth-checklist__label {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--uw-ink-900);
}

.auth-checklist {
  display: grid;
  gap: var(--space-2);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.auth-checklist li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--uw-ink-700);
}

.auth-checklist i {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 16px;
  color: var(--uw-blue-500);
}
[data-theme="dark"] .auth-checklist i { color: var(--uw-blue-300); }

.auth-form .callout { margin-bottom: var(--space-4); }
.auth-form .field { margin-bottom: var(--space-4); }
.auth-form form > .btn { width: 100%; min-height: 48px; margin-top: var(--space-2); }

.auth-google-block[hidden] { display: none; }

.auth-legal {
  margin: var(--space-8) 0 0;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--uw-ink-500);
}

@media (max-width: 991px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-panel { display: none; }
}

@media (max-width: 640px) {
  .auth-main { padding: var(--space-4); }
}

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--uw-ink-800);
  margin-bottom: 6px;
  display: block;
}

.auth-input-wrap { position: relative; }

.auth-input-wrap .input { padding-left: 40px; padding-right: 40px; }

.auth-input-wrap__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  /* ink-400 measured 2.7:1 on the card — under the 3:1 floor for a UI glyph. */
  color: var(--uw-ink-500);
  font-size: 18px;
  pointer-events: none;
}

.auth-input-wrap__toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--uw-ink-500);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
}

.auth-input-wrap__toggle:hover { color: var(--uw-blue-500); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--uw-ink-500);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--uw-border);
}

/* Google renders its button into this slot asynchronously. Reserving the real
   height keeps the card from jumping when it arrives, and keeps the gap from
   reading as a missing element if the script is blocked. */
.auth-google {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
}

.auth-note {
  margin: var(--space-3) 0 0;
  text-align: center;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--uw-ink-500);
}

.auth-page-footer {
  background: var(--uw-surface);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--uw-border);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--uw-ink-500);
}

/* Exam selection */
.exam-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--uw-bg);
}

.exam-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
}

.exam-panel {
  width: 100%;
  max-width: 720px;
  text-align: center;
}

.exam-panel__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  color: var(--uw-ink-900);
  margin: 0 0 var(--space-3);
  letter-spacing: -0.02em;
}

.exam-panel__lede {
  color: var(--uw-ink-600);
  font-size: var(--fs-md);
  margin: 0 0 var(--space-8);
  max-width: 48ch;
  margin-inline: auto;
}

.exam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  text-align: left;
}

@media (max-width: 640px) {
  .exam-grid { grid-template-columns: 1fr; }
}

.exam-option {
  position: relative;
  cursor: pointer;
}

.exam-option input { position: absolute; opacity: 0; pointer-events: none; }

.exam-option__card {
  background: var(--uw-surface);
  border: 1.5px solid var(--uw-border);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  transition: border-color var(--dur-fast), box-shadow var(--dur-med), transform var(--dur-fast);
  height: 100%;
}

.exam-option:hover .exam-option__card {
  border-color: var(--uw-blue-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.exam-option input:checked + .exam-option__card {
  border-color: var(--uw-blue-500);
  box-shadow: 0 0 0 3px var(--uw-blue-100);
  background: var(--uw-blue-50);
}

[data-theme="dark"] .exam-option input:checked + .exam-option__card {
  background: rgba(44, 51, 134, 0.2);
  box-shadow: 0 0 0 3px rgba(44, 51, 134, 0.35);
}

.exam-option__badge {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  margin-bottom: var(--space-3);
}

.exam-option__badge--step1 { background: var(--uw-blue-50); color: var(--uw-blue-700); }
.exam-option__badge--step2 { background: var(--uw-red-50); color: var(--uw-red-700); }

.exam-option__title {
  font-weight: 600;
  font-size: var(--fs-lg);
  color: var(--uw-ink-900);
  margin: 0 0 var(--space-2);
}

.exam-option__desc {
  font-size: var(--fs-sm);
  color: var(--uw-ink-600);
  margin: 0;
  line-height: 1.55;
}

.exam-submit { margin-top: var(--space-8); }

/* Coming soon */
.coming-panel {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-5);
}

.coming-panel__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-5);
  background: var(--uw-blue-50);
  color: var(--uw-blue-500);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
}

.coming-panel h1 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  color: var(--uw-ink-900);
  margin: 0 0 var(--space-3);
}

.coming-panel p {
  color: var(--uw-ink-600);
  font-size: var(--fs-md);
  margin: 0 0 var(--space-6);
  line-height: 1.55;
}

/* ---------- Dark mode legibility ----------
   `--uw-ink-500` maps to #636676 in dark mode, which is only 2.97:1 on the card
   surface — below the 4.5:1 this product commits to. Every muted text role on
   the auth pages therefore steps up to ink-600 (4.9:1) in dark mode rather than
   inheriting a colour that is fine on white and unreadable on near-black.
   (The token itself is left alone: it is used app-wide and re-pitching the dark
   ramp is a bigger change than this page should make on its own.) */
[data-theme="dark"] .auth-divider,
[data-theme="dark"] .auth-note,
[data-theme="dark"] .auth-legal,
[data-theme="dark"] .auth-page-footer {
  color: var(--uw-ink-600);
}

[data-theme="dark"] .auth-input-wrap__icon { color: var(--uw-ink-600); }
[data-theme="dark"] .auth-input-wrap__toggle { color: var(--uw-ink-600); }
[data-theme="dark"] .auth-input-wrap__toggle:hover { color: var(--uw-blue-300); }

/* ---------- Password toggle: a real target, and a real focus ring ----------
   It was a 26px tap target with the focus outline inherited from nowhere. */
.auth-input-wrap__toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
}
.auth-input-wrap__toggle:focus-visible {
  outline: 2px solid var(--uw-blue-500);
  outline-offset: 1px;
}

/* A 32px control is fine for a mouse and too small for a thumb. Touch devices
   get the full 44px without inflating the field on desktop. */
@media (pointer: coarse), (max-width: 640px) {
  .auth-input-wrap__toggle { width: 44px; height: 44px; right: 6px; }
  .auth-input-wrap .input { padding-right: 52px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .auth-switch__item,
  .auth-input-wrap__toggle { transition: none !important; }
}
