/* The sign-up and log-in pages (body.page-auth), loaded after site.css on those two pages only.
   Every colour is a site.css token. auth.js toggles the classes: `is-invalid` on a field with an
   error, `data-strength` on the meter, `is-sizing` with `--auth-h` on a card while its view
   changes, `is-leaving` and `is-entering` on the views, `is-open` on a role="status" region.
   Every animation and transition lives in the one no-preference block at the end. */

/* The hidden attribute wins over every display rule below. */
.page-auth [hidden] {
  display: none;
}

.auth-main {
  padding: 28px 0 72px;
}

/* Sign up: the form card, the log-in line, then the navy pitch; side by side from 1024px. */
.auth-signup {
  max-width: 560px;
}

.auth-card {
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card.is-sizing {
  height: var(--auth-h);
  overflow: hidden;
}

.auth-head {
  margin-bottom: 26px;
}

.auth-head-center {
  text-align: center;
}

.auth-title {
  font-size: clamp(1.75rem, 1.45rem + 1vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.auth-title:focus,
.auth-notice-text:focus {
  outline: none;
}

.auth-sub {
  margin-top: 8px;
  color: var(--text-2);
  text-wrap: pretty;
}

.auth-head-center .auth-sub {
  text-wrap: balance;
}

/* The plan picked on /pricing, named in the form's head while the pitch sits below the form. */
.auth-plan-chip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--hover);
  font-size: 0.875rem;
  font-weight: 600;
}

.auth-plan-chip a {
  font-weight: 650;
}

/* Fields */
.auth-form {
  display: grid;
  gap: 20px;
}

.auth-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.auth-form .field-input:focus-visible {
  border-color: var(--primary);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 4px var(--selection);
}

.auth-form .field-input[aria-invalid="true"]:focus-visible {
  border-color: var(--bad);
  box-shadow: 0 0 0 4px var(--bad-bg);
}

.auth-optional {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: 1px;
}

.auth-hint {
  color: var(--text-2);
  font-size: 0.875rem;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--bad);
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.35;
}

.auth-error .icon {
  margin-top: 1px;
  vertical-align: 0;
}

/* The password and its show or hide button. */
.auth-secret {
  position: relative;
}

.auth-secret .field-input,
.auth-secret .field-input[aria-invalid="true"] {
  padding-right: 54px;
}

.auth-eye {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}

.auth-eye:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -4px;
  border-radius: 8px;
}

.auth-eye:hover {
  background: var(--hover);
  color: var(--text);
}

.auth-eye .icon {
  width: 1.375rem;
  height: 1.375rem;
}

.auth-eye .icon-hide,
.auth-eye[aria-pressed="true"] .icon-show {
  display: none;
}

.auth-eye[aria-pressed="true"] .icon-hide {
  display: inline-block;
}

/* The strength meter: four bars over the rule and one word. */
.auth-meter {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.auth-meter-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.auth-meter-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auth-meter-bars > span {
  height: 6px;
  border-radius: 3px;
  background: var(--sunken);
}

.auth-meter-word {
  min-width: 3.75em;
  margin-left: auto;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 650;
  text-align: right;
}

.auth-meter:is([data-strength="short"], [data-strength="weak"]) {
  --meter: var(--bad);
}

.auth-meter[data-strength="fair"] {
  --meter: var(--caution);
}

.auth-meter[data-strength="good"] {
  --meter: var(--primary);
}

.auth-meter[data-strength="strong"] {
  --meter: var(--good);
}

.auth-meter:is([data-strength="short"], [data-strength="weak"]) > .auth-meter-bars > :nth-child(1),
.auth-meter[data-strength="fair"] > .auth-meter-bars > :nth-child(-n + 2),
.auth-meter[data-strength="good"] > .auth-meter-bars > :nth-child(-n + 3),
.auth-meter[data-strength="strong"] > .auth-meter-bars > span {
  background: var(--meter);
}

.auth-meter[data-strength] .auth-meter-word {
  color: var(--meter, var(--text-2));
}

/* The data region: two radio cards. */
.auth-regions > .field-label {
  float: left;
  width: 100%;
  margin-bottom: 2px;
  padding: 0;
}

.auth-regions > .auth-hint {
  clear: both;
}

/* The password's error says what its hint said, so the hint steps aside. */
.is-invalid .auth-meter .auth-hint {
  display: none;
}

.auth-choices {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.auth-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}

.auth-choice:hover {
  border-color: var(--text);
}

.auth-choice:has(:checked) {
  border-color: var(--primary);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.auth-choice:has(:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.is-invalid .auth-choice {
  border-color: var(--bad);
}

.auth-choice input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
  appearance: none;
  cursor: pointer;
}

.auth-choice input:checked {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--card);
}

.auth-choice input:focus-visible {
  outline: none;
}

.auth-choice-text {
  display: grid;
  min-width: 0;
}

/* A region that is not open yet: shown, dimmed, never chosen. */
.auth-choice-soon,
.auth-choice-soon input {
  cursor: not-allowed;
}

.auth-choice-soon {
  border-style: dashed;
  background: transparent;
}

.auth-choice-soon:hover {
  border-color: var(--border-strong);
}

.auth-choice-soon .auth-choice-text {
  opacity: 0.6;
}

.auth-choice-soon .coming {
  margin-left: auto;
}

.is-invalid .auth-choice-soon {
  border-color: var(--border-strong);
}

.auth-choice-code {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

.auth-choice-name {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.3;
}

.auth-legal {
  color: var(--text-2);
  font-size: 0.875rem;
  text-wrap: pretty;
}

.auth-submit {
  width: 100%;
  min-height: 52px;
  font-size: 1.0625rem;
}

.auth-noscript {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--sunken);
  color: var(--text-2);
  font-size: 0.9375rem;
  text-align: center;
}

.auth-switch {
  margin-top: 22px;
  color: var(--text-2);
  text-align: center;
}

.auth-switch a {
  font-weight: 650;
}

/* Google and GitHub: two white buttons above the email form, side by side where both labels fit,
   then a rule with "or" in it. The marks keep their own colours; GitHub's is currentColor. */
.auth-providers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 12px;
}

.auth-provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.auth-provider:hover {
  border-color: var(--text);
  background: var(--hover);
}

.auth-provider:active {
  background: var(--sunken);
}

.auth-provider-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
}

.auth-brand {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.auth-provider:disabled {
  border-color: transparent;
  background: var(--disabled-bg);
  color: var(--text-off);
  cursor: not-allowed;
}

.auth-provider:disabled .auth-brand {
  opacity: 0.45;
  filter: grayscale(1);
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 600;
}

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

/* The end state of sign-up. */
.auth-done {
  display: grid;
  justify-items: center;
  padding: 12px 0 4px;
  text-align: center;
}

.auth-check {
  width: 76px;
  height: 76px;
  margin-bottom: 22px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-check-ring {
  fill: var(--good-bg);
  stroke: var(--good);
  stroke-width: 3;
}

.auth-check-tick {
  stroke: var(--good);
  stroke-width: 4.5;
}

/* From Google or GitHub nothing was made or connected, so an "i" stands where the tick would. */
.auth-info .auth-check-ring {
  fill: var(--hover);
  stroke: var(--primary);
}

.auth-info .auth-check-tick {
  stroke: var(--primary);
}

.auth-done-text {
  max-width: 30rem;
  margin-top: 12px;
  color: var(--text-2);
  font-size: 1.0625rem;
  text-wrap: balance;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 28px;
}

.auth-actions .btn {
  flex: 1 1 180px;
  max-width: 240px;
}

.auth-done-note {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 0.875rem;
}

/* The navy pitch: the mark, the benefits and the chosen plan. */
.auth-pitch {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 40px;
  padding: 28px 22px;
  border-radius: 20px;
  background:
    radial-gradient(420px circle at 0% 0%, rgba(34, 196, 224, 0.24), transparent 420px), var(--navy);
}

.auth-arches {
  position: absolute;
  z-index: -1;
  fill: none;
  stroke: var(--d-card);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-pitch .auth-arches {
  top: -36px;
  right: -64px;
  width: 240px;
  height: 240px;
}

.auth-mark {
  width: 40px;
  height: 40px;
}

.auth-pitch-title {
  margin-top: 18px;
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.auth-benefits {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 0;
  color: var(--d-text-2);
  font-size: 0.9375rem;
  list-style: none;
  text-wrap: pretty;
}

.auth-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-benefits strong {
  color: var(--d-text);
  font-weight: 650;
}

.auth-benefits .icon {
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 50%;
  background: var(--d-card);
  color: var(--d-cyan);
  vertical-align: 0;
}

.auth-plan {
  margin-top: 26px;
  padding: 18px 20px 8px;
  border: 1px solid var(--d-border);
  border-radius: 16px;
  background: var(--d-card);
}

.auth-plan-label {
  color: var(--d-text-2);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.auth-plan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 6px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.auth-plan-per {
  color: var(--d-text-2);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
}

.auth-plan[data-plan="enterprise"] .auth-plan-price {
  color: var(--d-text-2);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: 0;
}

.auth-plan-volume {
  margin-top: 6px;
  font-weight: 600;
  text-wrap: balance;
}

.auth-plan-note {
  margin-top: 2px;
  color: var(--d-text-2);
  font-size: 0.9375rem;
}

.auth-plan-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  font-weight: 650;
}

/* Log in: a navy band with the mark and faint arches, and the card over its lower edge. */
.auth-login {
  position: relative;
  isolation: isolate;
  padding-top: 36px;
}

.auth-backdrop {
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 250px;
  overflow: hidden;
  border-radius: 0 0 50% 50% / 0 0 36px 36px;
  background:
    radial-gradient(520px circle at 50% 0%, rgba(34, 196, 224, 0.24), transparent 520px),
    var(--navy);
}

.auth-backdrop .auth-arches {
  z-index: 0;
  top: 36px;
  left: calc(50% + 96px);
  width: 260px;
  height: 260px;
  stroke-width: 0.9;
}

.auth-solo {
  width: min(100% - 2 * var(--gutter), 448px);
  margin-inline: auto;
}

.auth-solo-mark {
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}

.auth-solo-mark .auth-mark {
  width: 48px;
  height: 48px;
}

.auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 16px;
  margin-top: -6px;
}

.auth-check-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 0.9375rem;
  cursor: pointer;
}

.auth-check-label input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-forgot {
  font-size: 0.9375rem;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 8px;
  margin-top: -6px;
  font-size: 0.9375rem;
}

.auth-back .icon {
  transform: scaleX(-1);
}

/* A role="status" region: its notice row opens from 0 to its full height. */
.auth-status {
  display: grid;
  grid-template-rows: 0fr;
}

.auth-status.is-open {
  grid-template-rows: 1fr;
}

.auth-notice {
  min-height: 0;
  overflow: hidden;
}

.auth-notice-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--hover);
}

.auth-notice-box > .icon {
  width: 1.375rem;
  height: 1.375rem;
  color: var(--primary);
}

.auth-notice-text {
  font-weight: 550;
  line-height: 1.45;
}

.auth-notice-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-top: 2px;
}

.auth-notice-links a {
  padding: 10px 0;
  font-weight: 650;
}

.auth-notice-back {
  margin-top: 12px;
  background: var(--card);
}

.auth-form[hidden] + .auth-status .auth-notice-box {
  margin-top: 0;
}

@media (min-width: 400px) {
  .auth-card {
    padding: 32px 28px;
  }
}

@media (min-width: 440px) {
  .auth-choices {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .auth-choice {
    min-height: 68px;
    padding: 12px 14px;
  }
}

@media (min-width: 640px) {
  .auth-main {
    padding: 48px 0 96px;
  }

  .auth-card {
    padding: 40px;
  }

  .auth-pitch {
    padding: 36px 36px 28px;
  }

  .auth-login {
    padding-top: 48px;
  }

  .auth-backdrop {
    height: 290px;
  }

  .auth-backdrop .auth-arches {
    top: 28px;
    left: calc(50% + 250px);
    width: 380px;
    height: 380px;
  }
}

@media (min-width: 1024px) {
  .auth-signup {
    display: grid;
    grid-template-areas: "pitch card" ". switch";
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto auto;
    gap: 0 48px;
    align-items: start;
    max-width: none;
  }

  /* The card fills its row, as tall as the pitch, with its view centred in it. */
  .auth-signup > .auth-card {
    display: grid;
    grid-area: card;
    align-self: stretch;
    align-content: center;
    padding: 44px 48px;
  }

  .auth-plan-chip {
    display: none;
  }

  .auth-signup > .auth-switch {
    grid-area: switch;
  }

  .auth-pitch {
    display: flex;
    grid-area: pitch;
    flex-direction: column;
    align-self: stretch;
    margin-top: 0;
    padding: 48px 44px 36px;
  }

  .auth-pitch .auth-arches {
    top: auto;
    right: -70px;
    bottom: 90px;
    width: 440px;
    height: 440px;
  }

  .auth-pitch-title {
    margin-top: 28px;
  }

  .auth-benefits {
    gap: 18px;
    margin-top: 32px;
    margin-bottom: 40px;
    font-size: 1.0625rem;
  }

  .auth-plan {
    margin-top: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-card,
  .auth-pitch,
  .auth-solo-mark {
    animation: auth-in 600ms var(--ease-out) both;
  }

  .auth-pitch {
    animation-delay: 90ms;
  }

  .auth-card.is-sizing {
    transition: height 360ms var(--ease-out);
  }

  .auth-view.is-leaving {
    opacity: 0;
    transition: opacity 170ms ease-in;
  }

  .auth-view.is-entering {
    animation: auth-in 460ms var(--ease-out) both;
  }

  .auth-done .auth-check {
    animation: auth-pop 520ms var(--ease-out) both;
  }

  .auth-done .auth-check-ring,
  .auth-done .auth-check-tick {
    stroke-dasharray: 1;
    animation: auth-draw 560ms var(--ease-out) 120ms both;
  }

  .auth-done .auth-check-tick {
    animation-duration: 360ms;
    animation-delay: 480ms;
  }

  .auth-form .field-input,
  .auth-choice,
  .auth-provider,
  .auth-eye {
    transition:
      border-color 160ms ease,
      background-color 160ms ease,
      box-shadow 160ms ease,
      color 160ms ease;
  }

  .auth-meter-bars > span,
  .auth-meter-word {
    transition:
      background-color 220ms ease,
      color 220ms ease;
  }

  .auth-error:not([hidden]) {
    animation: auth-drop 220ms var(--ease-out) both;
  }

  .auth-status {
    transition: grid-template-rows 320ms var(--ease-out);
  }

  .auth-status.is-open .auth-notice-box {
    animation: auth-in 420ms var(--ease-out) both;
  }

  .auth-plan-change .icon {
    transition: transform 160ms var(--ease-out);
  }

  .auth-plan-change:hover .icon {
    transform: translateX(3px);
  }

  @keyframes auth-in {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
  }

  @keyframes auth-pop {
    from {
      opacity: 0;
      transform: scale(0.6);
    }
  }

  @keyframes auth-draw {
    from {
      stroke-dashoffset: 1;
    }

    to {
      stroke-dashoffset: 0;
    }
  }

  @keyframes auth-drop {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
  }
}
