/* Sign in / sign up: a plain full-screen split. No navbar, no cards.
   Left or right half is the form (white-on-ice, one column), the other half is the launch panel. */

body.auth-page { background: var(--color-ice-surface); }
.auth-page .scroll-progress { display: none; }

.auth-split {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
/* Sign in: form on the left half, panel on the right. Sign up: mirrored.
   Only the visual order changes; the DOM keeps the form first so keyboard and screen-reader order stay form-first. */
body[data-auth='signup'] .auth-visual { order: -1; }

/* ---------- Form half ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(18px, 3.2svh, 32px) clamp(24px, 5vw, 72px) clamp(16px, 2.4svh, 24px);
  background: var(--color-ice-surface);
}
.auth-form__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--color-edge-navy);
  font-size: 22px; line-height: 1; font-weight: 700; letter-spacing: -.01em;
  text-decoration: none; white-space: nowrap;
}
.auth-brand img { width: 34px; height: 34px; }
.auth-brand .tld { color: var(--color-orange-text); font-weight: 500; }
.auth-back {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 4px;
  color: var(--color-edge-navy); font-size: 15px; font-weight: 500; text-decoration: none;
}
.auth-back:hover { text-decoration: underline; }
.auth-back .icon { width: 16px; height: 16px; transform: scaleX(-1); }

.auth-form__body {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  gap: clamp(12px, 2.1svh, 20px);
  width: 100%; max-width: 440px; margin-inline: auto;
  padding-block: clamp(14px, 3svh, 30px);
}
.auth-form__foot { text-align: center; font-size: 13.5px; line-height: 20px; color: var(--color-graphite); }
.auth-form__foot .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; color: var(--color-edge-navy); }

.auth__title { font-size: clamp(28px, 3vw, 34px); line-height: 1.2; font-weight: 700; text-wrap: balance; }
.auth__sub { margin-top: 8px; font-size: 16px; line-height: 24px; color: var(--color-graphite); }
.auth__step-title { font-size: 24px; line-height: 30px; font-weight: 700; }
.auth__step-title:focus, #done-title:focus { outline: none; }
.auth__lead { font-size: 16px; line-height: 24px; }
.auth__form { display: grid; gap: clamp(10px, 1.7svh, 16px); }
.auth__form[hidden], .auth__done[hidden], .auth__head[hidden], .field[hidden], fieldset[hidden] { display: none; }
.auth__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; }
.auth__switch { padding-top: clamp(10px, 1.8svh, 16px); border-top: 1px solid var(--color-mist-divider); font-size: 15.5px; line-height: 24px; }
.auth__switch a { font-weight: 700; }
.btn--block { width: 100%; }
.auth-page .btn--xl { font-size: 18px; line-height: 24px; --btn-pad-y: 14px; }

.link-btn {
  background: none; border: 0; padding: 0 2px; min-height: 44px;
  color: var(--color-edge-navy);
  font-size: 15px; line-height: 22px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:disabled { color: var(--color-graphite); text-decoration: none; cursor: default; }
.link-btn:not(:disabled):hover { color: var(--color-launch-bay); }

/* ---------- Fields ---------- */
.auth-page .field { gap: 6px; }
.auth-page .input, .auth-page .select {
  min-height: 48px;
  border: 1px solid #6f8cab;            /* 3:1 against the page for the field boundary */
  background-color: #fff;
}
.auth-page .input { padding-right: 14px; }
.auth-page .select:hover, .auth-page .input:hover { border-color: var(--color-edge-navy); }
.input::placeholder { color: #5f7690; opacity: 1; }
.input:focus-visible, .select:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-edge-navy); }
.field__hint { font-size: 13.5px; line-height: 20px; color: var(--color-graphite); }
.field__error { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--color-error); display: flex; gap: 6px; }
.field__error::before { content: '!'; flex: none; width: 17px; height: 17px; margin-top: 1px; border-radius: 50%; background: var(--color-error); color: #fff; font-size: 12px; line-height: 17px; text-align: center; font-weight: 700; }
.field__error[hidden] { display: none; }
.input[aria-invalid='true'], .select[aria-invalid='true'] { border: 2px solid var(--color-error); background-color: var(--color-error-bg); padding-left: 13px; }

.phone { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.phone__cc {
  display: grid; place-items: center;
  padding-inline: 14px; min-height: 48px;
  background: var(--color-cloud-canvas);
  border: 1px solid #6f8cab; border-right: 0;
  border-radius: var(--radius-buttons) 0 0 var(--radius-buttons);
  font-weight: 500;
}
.phone .input { border-radius: 0 var(--radius-buttons) var(--radius-buttons) 0; }

.otp {
  text-align: center;
  font-size: 28px; line-height: 36px; font-weight: 700;
  letter-spacing: .5em; padding-left: calc(14px + .5em);
  min-height: 60px;
  font-variant-numeric: tabular-nums;
}
.otp::placeholder { letter-spacing: .5em; }

/* segmented control (mobile / email, age) */
.seg--light { background: var(--color-cloud-canvas); border: 1px solid #b3c9e0; }
.seg--light label { display: grid; place-items: center; min-height: 44px; padding: 0 8px; text-align: center; color: var(--color-edge-navy); }
.seg--light label:has(input:checked) { background: var(--color-edge-navy); color: #fff; }
.seg--light label:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.seg--light label:hover:not(:has(input:checked)) { background: rgba(24, 61, 109, .08); }
.seg--light input { position: absolute; opacity: 0; pointer-events: none; }

.group { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.group > legend { padding: 0; font-size: 14px; line-height: 22px; font-weight: 500; margin-bottom: 6px; }
.guardian {
  display: grid; gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #b3c9e0;
  border-radius: var(--radius-cards);
}
.guardian p { font-size: 14.5px; line-height: 22px; }
.guardian h2 { font-size: 17px; line-height: 24px; font-weight: 700; }

.check { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; cursor: pointer; font-size: 15px; line-height: 23px; }
.check input { appearance: none; width: 24px; height: 24px; margin: 0; border: 2px solid var(--color-edge-navy); border-radius: 7px; background: #fff; cursor: pointer; }
.check input:checked { background: var(--color-edge-navy) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='m9.2 16.2-4.4-4.4-1.4 1.4 5.8 5.8L21 7.2l-1.4-1.4z'/></svg>") center / 16px no-repeat; }
.check input:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.check input[aria-invalid='true'] { border-color: var(--color-error); box-shadow: 0 0 0 3px var(--color-error-bg); }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.7svh, 14px) 14px; }
@media (max-width: 520px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stepper ---------- */
.stepper { display: flex; align-items: center; margin-top: clamp(12px, 2svh, 18px); }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--color-graphite); }
.stepper li + li::before { content: ''; flex: none; width: clamp(18px, 5vw, 44px); height: 2px; margin-inline: 8px; background: #b3c9e0; border-radius: 2px; }
.stepper__dot { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #8aa4c0; background: #fff; font-size: 13px; font-weight: 700; color: var(--color-graphite); transition: background-color .3s ease, border-color .3s ease, color .3s ease; }
.stepper li[aria-current='step'] { color: var(--color-edge-navy); }
.stepper li[aria-current='step'] .stepper__dot { background: var(--color-edge-navy); border-color: var(--color-edge-navy); color: #fff; }
.stepper li.is-done { color: var(--color-edge-navy); }
.stepper li.is-done + li::before, .stepper li[aria-current='step']::before { background: var(--color-edge-navy); }
.stepper li.is-done .stepper__dot { background: var(--color-signal-orange); border-color: var(--color-signal-orange); color: var(--color-launch-bay); }
/* narrow screens: keep only the current label visible, but never remove the others from assistive tech */
@media (max-width: 440px) {
  .stepper li:not([aria-current='step']) .stepper__label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

/* ---------- Loading + success ---------- */
.btn.is-loading { pointer-events: none; opacity: .92; }
.btn.is-loading::after {
  content: ''; width: 18px; height: 18px; flex: none;
  border: 3px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth__done { display: grid; gap: 16px; justify-items: start; }
.auth__done h1 { font-size: 30px; line-height: 38px; font-weight: 700; }
.done__badge { width: 64px; height: 64px; border-radius: 50%; background: var(--gradient-coral-launch); display: grid; place-items: center; animation: pop .6s cubic-bezier(.34, 1.56, .64, 1) both; }
.done__badge svg { width: 32px; height: 32px; fill: #fff; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.done__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.done__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Panel half ---------- */
.auth-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(32px, 5.5svh, 64px) clamp(32px, 5vw, 72px) 0;
  color: #fff;
  background:
    radial-gradient(640px 460px at 82% 14%, rgba(58, 74, 190, .45), transparent 65%),
    radial-gradient(520px 380px at 0% 100%, rgba(26, 106, 190, .32), transparent 62%),
    var(--color-launch-bay);
}
.auth-visual::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .8;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 12%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 30% 30%, #cfe5ff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 55% 8%, #ffd9a8 50%, transparent 52%),
    radial-gradient(1px 1px at 78% 22%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 92% 40%, #cfe5ff 50%, transparent 52%),
    radial-gradient(1px 1px at 6% 58%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 88% 70%, #ffd9a8 50%, transparent 52%),
    radial-gradient(1px 1px at 40% 90%, #cfe5ff 50%, transparent 52%);
}
.auth-visual .chip { align-self: flex-start; }
.auth-visual h2 { margin-top: 16px; max-width: 460px; font-size: clamp(32px, 3.4vw, 46px); line-height: 1.15; font-weight: 700; text-wrap: balance; }
.auth-visual > p { margin-top: 14px; max-width: 440px; font-size: 18px; line-height: 27px; opacity: .95; }
.auth-visual .ticks { margin-top: 22px; max-width: 440px; }
.auth-visual .ticks li { font-size: 16.5px; line-height: 25px; }

/* the art takes the space left under the text and scales to fit it, so it never overlaps the copy */
.auth__stage {
  flex: 1 1 0;
  min-height: 180px;
  margin-inline: calc(clamp(32px, 5vw, 72px) * -1);
  container-type: size;
  display: grid;
  place-items: end center;
}
.auth__art { position: relative; width: min(100cqw, calc(100cqh * 640 / 600), 560px); aspect-ratio: 640 / 600; animation: none; }
.auth__art img { position: absolute; }
@supports not (width: 1cqw) { .auth__art { width: min(100%, 420px); } }

/* ---------- Tablet and phone: the form takes the whole screen, the panel is dropped ---------- */
@media (max-width: 900px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-form { padding-inline: clamp(20px, 6vw, 40px); }
  .auth-form__body { justify-content: flex-start; padding-top: clamp(20px, 5svh, 44px); }
}
/* short desktop screens: trim secondary copy so the form still sits on one screen */
@media (min-width: 901px) and (max-height: 820px) {
  .auth__sub { display: none; }
  .field__hint:not(.always) { display: none; }
  .auth-visual > p { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .btn.is-loading::after { animation-duration: 1.6s !important; }
  .done__badge { animation: none; }
}

/* the hidden attribute must win over the display rules above */
.stepper[hidden] { display: none; }
@media (min-width: 901px) and (max-height: 940px) {
  #form-sizes .auth__lead { display: none; }
}
