/*
 * The sign-in pages in the website's style (web/site): paper and ink by day, the site's night by night, the editorial
 * serif for the title, pill buttons and the Certillio word mark. Keycloak switches dark mode with the
 * .pf-v5-theme-dark class (from the system preference).
 */
@font-face {
  font-family: "Plus Jakarta Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Newsreader Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("../fonts/geist-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --t-canvas: #fdfcfa;
  --t-surface: #ffffff;
  --t-surface-2: #faf9f6;
  --t-line: #e9e6df;
  --t-line-strong: #d9d4ca;
  --t-fg: #16172b;
  --t-fg-muted: #5d564c;
  --t-fg-subtle: #6b645a;
  --t-accent: #16172b;
  --t-accent-hover: #2a2b45;
  --t-accent-fg: #fdfcfa;
  --t-link: #4b3fc4;
  --t-focus: #5847e0;
  --t-danger: #b93434;
  --t-dots: rgb(22 23 43 / 0.09);
  --t-shadow: 0 0 0 1px var(--t-line), 0 40px 80px -48px rgb(22 23 43 / 0.32);
  --t-button-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 10px 24px -12px rgb(22 23 43 / 0.6);
  --t-mark: url("../img/certillio-ink.svg");
  --t-font: "Plus Jakarta Sans Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-serif: "Newsreader Variable", "Iowan Old Style", Georgia, serif;
  --t-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --keycloak-card-top-color: transparent;
  --pf-v5-global--FontFamily--text: var(--t-font);
  --pf-v5-global--FontFamily--heading: var(--t-font);
  --pf-v5-global--FontFamily--redhatfont--text: var(--t-font);
  --pf-v5-global--FontFamily--redhatfont--heading: var(--t-font);
  --pf-v5-global--link--Color: var(--t-link);
  --pf-v5-global--link--Color--hover: var(--t-link);
  --pf-v5-global--primary-color--100: var(--t-accent);
  --pf-v5-global--primary-color--200: var(--t-accent-hover);
}

/* The site's night (its dark sections): ink-black ground, paper type, the light violet. */
:root.pf-v5-theme-dark {
  --t-canvas: #0c0c14;
  --t-surface: #14141c;
  --t-surface-2: #1a1a23;
  --t-line: #25252f;
  --t-line-strong: #34343f;
  --t-fg: #fdfcfa;
  --t-fg-muted: #b3b2b6;
  --t-fg-subtle: #9a99a0;
  --t-accent: #fdfcfa;
  --t-accent-hover: #ffffff;
  --t-accent-fg: #16172b;
  --t-link: #a99eff;
  --t-focus: #a99eff;
  --t-danger: #f2716b;
  --t-dots: rgb(255 255 255 / 0.07);
  --t-shadow: 0 0 0 1px var(--t-line), 0 40px 80px -40px rgb(0 0 0 / 0.7);
  --t-button-shadow: none;
  --t-mark: url("../img/certillio-night.svg");
  --pf-v5-global--link--Color: var(--t-link);
  --pf-v5-global--link--Color--hover: var(--t-link);
  --pf-v5-global--primary-color--100: var(--t-accent);
  --pf-v5-global--primary-color--200: var(--t-accent-hover);
}

/* Page: plain canvas instead of Keycloak's polygon background. */
.login-pf body,
.login-pf .pf-v5-c-login {
  background: var(--t-canvas) !important;
  color: var(--t-fg);
  font-family: var(--t-font);
  -webkit-font-smoothing: antialiased;
}
/* The site's dotted stage behind the card, fading out towards the edges. */
.login-pf .pf-v5-c-login::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--t-dots) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(60% 55% at 50% 42%, #000, transparent);
  mask-image: radial-gradient(60% 55% at 50% 42%, #000, transparent);
}
.pf-v5-c-login__container {
  position: relative;
}

.pf-v5-c-login__container {
  grid-template-columns: minmax(0, 26rem);
  padding-inline: 1rem;
}

/* Brand: the Certillio word mark above the card; the realm's label (displayNameHtml, e.g. "Staging · demodata") sits
   under it as the site's small mono label. The realm's name itself stays in the page title. */
.pf-v5-c-login__header {
  padding-block: 0 1.75rem;
}
#kc-header-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 0;
  font-family: var(--t-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--t-fg-subtle) !important; /* Keycloak's header text is white for its dark background */
  white-space: normal;
}
#kc-header-wrapper::before {
  content: "";
  flex: none;
  width: 146px;
  height: 35px;
  background: var(--t-mark) center / contain no-repeat;
}

/* Card */
.pf-v5-c-login__main {
  position: relative;
  background: var(--t-surface);
  border: 0;
  border-radius: 28px;
  box-shadow: var(--t-shadow);
  overflow: hidden;
}
.pf-v5-c-login__main-header {
  border-top: 0;
  padding-block-start: 64px;
  padding-inline: 40px;
  row-gap: 0.75rem;
  align-items: center;
}
/* The language picker is a small pill in the card's corner, so the title has the whole width. */
.pf-v5-c-login__main-header {
  grid-template-columns: minmax(0, 1fr) !important; /* PatternFly splits the row 70 / 30 from its md breakpoint */
}
.pf-v5-c-login__main-header-utilities {
  position: absolute;
  top: 16px;
  right: 16px;
}
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control {
  border-radius: 999px;
  min-height: 34px;
}
.pf-v5-c-login__main-header-utilities .pf-v5-c-form-control > select {
  font-size: 13px;
  font-weight: 600;
  color: var(--t-fg-muted);
  padding-block: 6px;
  padding-inline-start: 14px;
}
.pf-v5-c-login__main-body,
.pf-v5-c-login__main-footer {
  padding-inline: 40px;
}
@media (max-width: 480px) {
  .pf-v5-c-login__main-header {
    padding-block-start: 60px;
    padding-inline: 24px;
  }
  .pf-v5-c-login__main-body,
  .pf-v5-c-login__main-footer {
    padding-inline: 24px;
  }
}
.pf-v5-c-login__main-footer {
  padding-block-end: 1.5rem;
}
/* Keycloak renders an empty footer when there are no social sign-in options. */
.pf-v5-c-login__main-footer:not(:has(*)),
.pf-v5-c-login__main-footer:has(> :only-child:empty) {
  display: none;
}
.pf-v5-c-login__main-body {
  padding-block-end: 0.5rem;
}
#kc-page-title,
.pf-v5-c-title.pf-m-3xl {
  font-family: var(--t-serif);
  font-size: 34px;
  font-weight: 380;
  font-optical-sizing: auto;
  letter-spacing: -0.028em;
  line-height: 1.05;
  color: var(--t-fg);
}

/* Fields */
.pf-v5-c-form__label-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--t-fg);
}
.pf-v5-c-form-control {
  --pf-v5-c-form-control--BackgroundColor: var(--t-surface-2);
  --pf-v5-c-form-control--Color: var(--t-fg);
  border-radius: 14px;
  min-height: 48px;
  background-color: var(--t-surface-2);
  box-shadow: inset 0 0 0 1px var(--t-line-strong);
  transition: box-shadow 0.15s;
}
.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
  border: 0 !important;
}
.pf-v5-c-form-control:hover {
  box-shadow: inset 0 0 0 1px var(--t-fg-subtle);
}
.pf-v5-c-form-control:focus-within {
  box-shadow: inset 0 0 0 2px var(--t-focus);
}
.pf-v5-c-form-control > input,
.pf-v5-c-form-control > select {
  font-size: 15px;
  color: var(--t-fg);
}
/* The field's own ring (focus-within above) shows focus; the browser's outline would draw a second one. */
.pf-v5-c-form-control > input:focus,
.pf-v5-c-form-control > select:focus {
  outline: none;
}
.pf-v5-c-form-control.pf-m-error {
  box-shadow: inset 0 0 0 1px var(--t-danger);
}
.pf-v5-c-input-group {
  gap: 0.375rem;
}
.pf-v5-c-button.pf-m-control {
  border-radius: 14px;
  min-width: 48px;
  background: var(--t-surface-2);
  color: var(--t-fg-muted);
}
.pf-v5-c-button.pf-m-control::after {
  border: 0 !important;
  box-shadow: inset 0 0 0 1px var(--t-line-strong);
  border-radius: 14px;
}

/* Buttons */
.pf-v5-c-button.pf-m-primary {
  --pf-v5-c-button--m-primary--BackgroundColor: var(--t-accent);
  --pf-v5-c-button--m-primary--hover--BackgroundColor: var(--t-accent-hover);
  --pf-v5-c-button--m-primary--focus--BackgroundColor: var(--t-accent-hover);
  --pf-v5-c-button--m-primary--active--BackgroundColor: var(--t-accent-hover);
  --pf-v5-c-button--m-primary--Color: var(--t-accent-fg);
  --pf-v5-c-button--m-primary--hover--Color: var(--t-accent-fg);
  --pf-v5-c-button--m-primary--focus--Color: var(--t-accent-fg);
  --pf-v5-c-button--m-primary--active--Color: var(--t-accent-fg);
  border-radius: 999px;
  min-height: 52px;
  font-size: 15.5px;
  font-weight: 600;
  box-shadow: var(--t-button-shadow);
  transition: background-color 0.3s;
}
/* Secondary actions (Back, Cancel): the site's ghost pill. */
.pf-v5-c-button.pf-m-secondary {
  border-radius: 999px;
  min-height: 52px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--t-fg);
}
.pf-v5-c-button.pf-m-secondary::after {
  border-radius: 999px;
  border-color: var(--t-line-strong) !important;
}

/* Links, helper text and the sign-up line */
.login-pf a {
  color: var(--t-link);
}
.login-pf a:hover {
  color: var(--t-fg);
  text-decoration: underline;
}
.pf-v5-c-helper-text__item-text {
  font-size: 13px;
}
.pf-v5-c-login__main-footer-band {
  border-top-color: var(--t-line) !important;
  color: var(--t-fg-muted);
  font-size: 13px;
}

/* Language picker */
#login-select-toggle,
.pf-v5-c-login__main-header-utilities .pf-v5-c-menu-toggle {
  border-radius: 999px;
  font-size: 13px;
  color: var(--t-fg-muted);
}
.pf-v5-c-login__main-header-utilities .pf-v5-c-menu-toggle::before {
  border-color: var(--t-line) !important;
  border-radius: 999px;
}

/* Messages (errors, info) */
.pf-v5-c-alert {
  border-radius: 14px;
  font-size: 13px;
}

/* Focus: the site's 2px violet outline. */
.login-pf a:focus-visible,
.login-pf button:focus-visible,
.login-pf .pf-v5-c-button:focus-visible {
  outline: 2px solid var(--t-focus);
  outline-offset: 2px;
}

/* Setting up the authenticator app (login-config-totp.ftl). The device name only tells several apps apart, and
   Keycloak makes it optional for a person's first app (no required marker on its label): then the field and the
   line asking for it are hidden, and the app is saved without a name. From the second app on it is required and
   shows as usual. Browsers without :has() simply show it. (:has() cannot nest, hence the second rule finds the
   field's group by position: the code comes first, the device name second.) */
#kc-totp-settings-form > div:has(#userLabel):not(:has(.pf-v5-c-form__label-required)) {
  display: none;
}
body:has(#userLabel):not(:has(#kc-totp-settings-form > div:nth-child(2) .pf-v5-c-form__label-required)) #kc-totp-settings > li:last-child > p:nth-of-type(2) {
  display: none;
}
