/* Sign In and Reset Password: one card on the navy-graded refinery photo, with
   the portal footer lockup in the corner. Light mode (admins only for now) turns
   the card light; the photo, the lockup and the gold button stay as they are. */

.auth-page {
  /* Resting field underline and box edge; light mode needs more ink for 3:1 on white. */
  --auth-line: var(--line-5);
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--stage-ink);
}

.auth-photo,
.auth-scrim,
.auth-grain {
  position: absolute;
  pointer-events: none;
}

/* Overscanned so the slight blur never shows a soft edge. */
.auth-photo {
  top: -12px;
  left: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  object-fit: cover;
  object-position: 60% 100%;
  filter: blur(0.6px);
}

.auth-scrim {
  inset: 0;
  background:
    linear-gradient(0deg, color-mix(in srgb, var(--stage-ink) 80%, transparent), transparent 32%),
    color-mix(in srgb, var(--stage-ink) 55%, transparent);
}

.auth-grain {
  inset: 0;
  background: url("/static/img/login-grain.png") 0 0 / 200px 200px;
  opacity: 0.07;
  mix-blend-mode: overlay;
}

.auth-theme {
  position: absolute;
  top: 32px;
  right: 40px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--stage-text);
  cursor: pointer;
  transition: background-color 0.15s;
}

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

.auth-theme:hover {
  background: color-mix(in srgb, var(--stage-text) 8%, transparent);
}

.auth-theme:focus-visible {
  outline: 2px solid var(--stage-text);
  outline-offset: 2px;
}

.auth-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 16px 40px;
}

.auth-card {
  width: 460px;
  max-width: 100%;
  padding: 48px 52px 44px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius);
  background: var(--surface-card);
  box-shadow: 0 30px 60px -24px var(--stage-shadow);
  color: var(--color-text-strong);
}

.auth-logo {
  display: block;
  height: 24px;
  width: auto;
}

.auth-title {
  margin-top: 32px;
  font-size: var(--type-display-size);
  font-weight: 300;
  line-height: 46px;
  letter-spacing: -0.8px;
}

.auth-form {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-field label {
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
}

/* A label with a live status on the right: password rule and strength, match. */
.auth-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

/* One line each, so a status change never moves the field under it. */
.auth-label-row > * {
  white-space: nowrap;
}

.auth-status {
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}

.auth-status[data-score="1"],
.auth-status.is-mismatch {
  color: var(--color-negative-text);
}

.auth-status[data-score="2"] {
  color: var(--color-orange);
}

.auth-status[data-score="3"],
.auth-status[data-score="4"],
.auth-status.is-match {
  color: var(--color-positive);
}

.auth-control {
  position: relative;
  display: flex;
}

.auth-input {
  flex: 1;
  width: 100%;
  height: 48px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--auth-line);
  border-radius: 0;
  background: transparent;
  color: var(--color-text-strong);
  caret-color: var(--gold);
  font: 500 16px/24px 'Manrope', -apple-system, sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input--password {
  padding-right: 44px;
}

.auth-input:hover {
  border-bottom-color: color-mix(in srgb, var(--color-text-strong) 55%, transparent);
}

.auth-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: inset 0 -1px 0 var(--gold);
}

.auth-input[aria-invalid="true"] {
  border-bottom-color: var(--color-negative);
  caret-color: var(--color-negative);
}

.auth-input[aria-invalid="true"]:focus {
  box-shadow: inset 0 -1px 0 var(--color-negative);
}

/* Browser autofill paints its own fill; keep the card showing through, and the
   focus and error lines with it. */
.auth-input:-webkit-autofill {
  -webkit-text-fill-color: var(--color-text-strong);
  box-shadow: inset 0 0 0 1000px var(--surface-card);
  transition: background-color 9999s;
}

.auth-input:-webkit-autofill:focus {
  box-shadow: inset 0 -1px 0 var(--gold), inset 0 0 0 1000px var(--surface-card);
}

.auth-input[aria-invalid="true"]:-webkit-autofill:focus {
  box-shadow: inset 0 -1px 0 var(--color-negative), inset 0 0 0 1000px var(--surface-card);
}

/* Edge adds its own reveal eye; the page has one already. */
.auth-input::-ms-reveal,
.auth-input::-ms-clear {
  display: none;
}

.auth-control .password-visibility {
  position: absolute;
  top: 6px;
  right: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-strong);
  cursor: pointer;
  transition: background-color 0.15s;
}

.auth-control .password-visibility[hidden] {
  display: none;
}

.auth-control .password-visibility:hover {
  background: var(--fill-3);
}

.auth-control .password-visibility:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0;
}

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

.password-visibility[aria-pressed="true"] .password-eye--hide {
  display: block;
}

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

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  cursor: pointer;
}

.auth-box {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.auth-box input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--auth-line);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.auth-box svg {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  color: var(--stage-ink);
}

.auth-check:hover .auth-box input:not(:checked) {
  border-color: color-mix(in srgb, var(--color-text-strong) 55%, transparent);
}

.auth-box input:checked {
  border-color: var(--gold);
  background: var(--brand-gold);
}

.auth-box input:checked + svg {
  opacity: 1;
}

.auth-box input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.auth-link {
  color: var(--color-text-strong);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--color-text-strong) 35%, transparent);
  transition: text-decoration-color 0.15s;
}

.auth-link:hover {
  text-decoration-color: currentColor;
}

.auth-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.auth-row .auth-link {
  font-size: 16px;
  line-height: 22px;
}

/* The message sits right above the button it answers. */
.auth-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-actions:has(> #auth-msg) {
  margin-top: 4px;
}

.auth-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}

.auth-msg svg {
  flex-shrink: 0;
}

.auth-msg--error {
  color: var(--color-negative-text);
}

.auth-msg--info {
  color: var(--color-text-strong);
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  /* Invisible here; Windows High Contrast draws it as the button's outline. */
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand-gold);
  color: var(--stage-ink);
  font: 700 16px/24px 'Manrope', -apple-system, sans-serif;
  cursor: pointer;
  transition: background-color 0.15s;
}

a.auth-submit {
  text-decoration: none;
}

.auth-submit:disabled {
  cursor: progress;
}

.auth-submit:hover {
  background: var(--brand-gold-hover);
}

.auth-submit:active {
  background: var(--brand-gold-press);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--color-text-strong);
  outline-offset: 3px;
}

.auth-foot {
  overflow-wrap: anywhere;
  margin-top: 32px;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
}

.auth-foot .auth-link {
  font-weight: 600;
}

/* The portal footer lockup: full logo and the two-row tagline. */
.auth-lockup {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: 0 40px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.auth-lockup img {
  display: block;
  height: 28px;
  width: auto;
  opacity: 0.95;
}

.auth-tag {
  font-family: 'Montserrat', -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 1.44px;
  text-transform: uppercase;
  color: var(--stage-text);
}

.auth-tag span {
  color: var(--brand-gold);
}

:root[data-theme="light"] .auth-page {
  --auth-line: color-mix(in srgb, var(--color-text-strong) 50%, transparent);
}

@media (max-width: 767px) {
  .auth-theme {
    top: 16px;
    right: 16px;
  }

  .auth-main {
    align-items: flex-start;
    padding: 72px 16px 32px;
  }

  .auth-card {
    padding: 36px 24px 32px;
  }

  .auth-lockup {
    align-self: center;
    margin: 0 16px 24px;
  }

  /* The portal footer's own size, so the tagline keeps to two rows. */
  .auth-lockup img {
    height: 24px;
  }

  .auth-tag {
    font-size: 10px;
    line-height: 15px;
    letter-spacing: 1.2px;
    white-space: nowrap;
  }
}
