:root {
  color-scheme: light;
  --samas-ink: #16231d;
  --samas-muted: #5c6862;
  /* The card is white, so the page behind it cannot be. At #f7f8f7 the two were
     within a few percent of each other and the card had no edge to speak of —
     the whole screen read as one flat white sheet with a form drawn on it. A
     tinted canvas is what makes the card look like a card. */
  --samas-canvas: #e7ece8;
  --samas-border: #d4ddd7;
  --samas-action: #075b45;
  --samas-action-hover: #064936;
  --pf-v5-global--primary-color--100: var(--samas-action);
  --pf-v5-global--primary-color--200: var(--samas-action-hover);
}

body,
.login-pf body,
.login-pf-page {
  color: var(--samas-ink);
  background: var(--samas-canvas);
  font-family: Inter, "Noto Sans", "Segoe UI", sans-serif;
}

/*
 * PatternFly reserves a great deal of vertical air around the brand once the
 * viewport passes its xl breakpoint: four rems above the header and three below
 * the mark, on top of the header's own margin. Centred in a tall window that
 * separation read as the wordmark and the sign-in card belonging to two
 * different pages. The three are zeroed so the margin on #kc-header below is the
 * one gap, and it is the same gap at every width.
 */
.pf-v5-c-login {
  --pf-v5-c-login__header--xl--MarginTop: 0;
  --pf-v5-c-login__header--MarginBottom: 0;
  --pf-v5-c-login__header--xl--MarginBottom: 0;
  --pf-v5-c-login__header--c-brand--MarginBottom: 0;
  --pf-v5-c-login__header--c-brand--xl--MarginBottom: 0;
}

/*
 * On a tall screen the default centring leaves the form floating in the middle
 * of an empty window. Sitting it above the optical centre is where the eye looks
 * for a form, and it keeps the brand in the upper half where a page header
 * belongs. Short viewports keep the centring, which is what stops the card being
 * pushed off the bottom of a laptop screen.
 */
@media (min-height: 44rem) {
  .pf-v5-c-login {
    align-items: flex-start;
    padding-block-start: clamp(3rem, 13vh, 8rem);
  }
}

.pf-v5-c-login__container {
  grid-template-areas: "header" "main";
  grid-template-columns: minmax(0, 26rem);
  justify-content: center;
  /* Vertical placement is set on .pf-v5-c-login above, where it can be told
     apart from a short viewport; the container only insets from the edges. */
  padding: 0 1.25rem;
}

/*
 * The brand sits centred above the card: a green mark with the product's
 * initial, then the product name. Keycloak's header is a text element, so the
 * mark is drawn with a pseudo-element rather than shipped as an image file —
 * one less asset to serve, and it recolours with the tokens above.
 */
#kc-header {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 1.5rem;
  text-align: center;
}

#kc-header-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--samas-ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: none;
  /* Letter-spacing is added after the final letter too, which drags a centred
     word visibly to the left. Re-indenting by the same amount puts the word
     back on the axis the card is centred on. */
  text-indent: 0.08em;
}

#kc-header-wrapper::before {
  content: "S";
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  border-radius: 1rem;
  background: var(--samas-action);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0;
}

.pf-v5-c-login__main,
.card-pf {
  border: 1px solid var(--samas-border);
  border-radius: 0.875rem;
  background: white;
  box-shadow: none;
}

#kc-page-title {
  color: var(--samas-ink);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
}

.pf-v5-c-form__label-text,
label {
  color: var(--samas-ink);
  font-weight: 650;
}

.pf-v5-c-form-control,
input[type="text"],
input[type="password"] {
  min-height: 2.875rem;
  border-color: var(--samas-border);
  border-radius: 0.375rem;
  color: var(--samas-ink);
  background: white;
}

.pf-v5-c-form-control:focus-within,
input:focus {
  border-color: var(--samas-action);
  outline: 2px solid rgb(7 91 69 / 20%);
  outline-offset: 1px;
}

.pf-v5-c-input-group {
  overflow: hidden;
  border: 1px solid var(--samas-border);
  border-radius: 0.375rem;
  background: white;
}

.pf-v5-c-input-group .pf-v5-c-form-control {
  border: 0;
  border-radius: 0;
}

.pf-v5-c-button.pf-m-control {
  min-height: 2.875rem;
  border: 0;
  color: var(--samas-ink);
  background: #f0f3f1;
}

.pf-v5-c-button.pf-m-primary,
#kc-login {
  min-height: 2.875rem;
  border-radius: 0.375rem;
  background: var(--samas-action);
  font-weight: 700;
}

.pf-v5-c-button.pf-m-primary:hover,
#kc-login:hover {
  background: var(--samas-action-hover);
}

a,
.pf-v5-c-button.pf-m-link {
  color: var(--samas-action);
}

.pf-v5-c-login__main-footer-band,
#kc-info-wrapper {
  border-color: var(--samas-border);
  background: #f0f3f1;
}

@media (max-width: 600px) {
  .pf-v5-c-login__container {
    padding: 0 1rem;
  }

  .pf-v5-c-login__main {
    border-radius: 0.75rem;
  }
}
