/*
 * FIOR login theme. Mirrors the AI Gateway sign-in page
 * (fiordc.aigateway.fior.group, src/pages/Auth.tsx): navy gradient backdrop,
 * the horizontal wordmark above a frosted max-w-md card, Poppins headings,
 * Lato body, purple gradient primary button. Brand tokens as in the gateway's
 * src/index.css: Purple #7840A8 · Teal #00B4B4 · Navy #0F1428.
 *
 * Fonts are bundled in this theme: the login page makes no third-party request.
 */

@font-face {
  font-family: "Lato";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/lato-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/lato-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2");
}

:root,
.pf-v5-theme-dark {
  --fior-navy: hsl(228 45% 11%);
  --fior-card: hsl(228 40% 14%);
  --fior-border: hsl(220 20% 18%);
  --fior-input: hsl(220 25% 12%);
  --fior-foreground: hsl(210 20% 96%);
  --fior-muted-foreground: hsl(228 15% 62%);
  --fior-primary: hsl(272 45% 45%);
  /* Readable purple for text on navy (5.6:1); the button colour is 2.45:1 as text. */
  --fior-primary-text: hsl(272 55% 72%);
  --fior-gradient-primary: linear-gradient(135deg, hsl(272 45% 45%), hsl(260 70% 65%));

  --pf-v5-global--FontFamily--text: "Lato", system-ui, sans-serif;
  --pf-v5-global--FontFamily--heading: "Poppins", system-ui, sans-serif;
  --pf-v5-global--primary-color--100: var(--fior-primary-text);
  --pf-v5-global--link--Color: var(--fior-primary-text);
  --pf-v5-global--link--Color--hover: var(--fior-primary-text);
  --pf-v5-global--active-color--100: var(--fior-primary-text);
  --pf-v5-global--BorderRadius--sm: 0.5rem;
}

/* Backdrop: the gateway's bg-gradient-dark, replacing Keycloak's artwork. */
.login-pf body {
  background: linear-gradient(180deg, hsl(228 45% 11%), hsl(228 50% 5%)) fixed;
  color: var(--fior-foreground);
  font-family: var(--pf-v5-global--FontFamily--text);
}

/* Gateway proportions (shadcn Card + Input + Button), not PatternFly's roomier
   defaults: 32px brand-to-card, 24px card padding, 16px between fields, 8px
   label-to-input, 40px controls with 14px text. */
.pf-v5-c-login__container {
  grid-template-columns: min(28rem, 100%);
  row-gap: 2rem;
}

/* Brand block: wordmark above the product name (realm displayNameHtml).
   Keycloak's base CSS adds 64px above the header and 48px under the brand;
   the container's 32px row gap is the only spacing we want (the gateway's mb-8). */
#kc-header {
  margin-top: 0;
}
#kc-header-wrapper {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--pf-v5-global--FontFamily--heading);
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  color: var(--fior-foreground);
  text-transform: none;
}
#kc-header-wrapper::before {
  content: "";
  display: block;
  width: 16rem;
  aspect-ratio: 1198 / 302;
  margin-bottom: 1rem;
  background: url("../img/fior-logo-horizontal.png") center / contain no-repeat;
}
#kc-header-wrapper em {
  display: block;
  font-family: var(--pf-v5-global--FontFamily--text);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fior-muted-foreground);
}

/* The card: bg-card/80, border-border/50, blurred, like the gateway's Auth card. */
.pf-v5-c-login__main {
  background: hsl(228 40% 14% / 0.8);
  border: 1px solid hsl(220 20% 18% / 0.5);
  border-radius: 0.5rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -10px hsl(228 50% 3% / 0.6);
}
.pf-v5-c-login__main-header {
  border-top: none;
  padding: 1.5rem 1.5rem 1rem;
}
.pf-v5-c-login__main-body {
  padding: 0 1.5rem 1.5rem;
}
.pf-v5-c-login__main-footer {
  padding: 0 1.5rem 1.5rem;
}
.pf-v5-c-login__main-footer-band {
  padding: 1rem 0 0;
  margin-block-start: 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--fior-muted-foreground);
}
/* keycloak.v2 always renders footer bands; empty ones only add padding. */
.pf-v5-c-login__main-footer:not(:has(*)) {
  display: none;
}
.pf-v5-c-form {
  --pf-v5-c-form--GridGap: 1rem;
  gap: 1rem;
}
.pf-v5-c-form__group-label.pf-v5-u-pb-xs {
  padding-bottom: 0.5rem !important;
}
.pf-v5-c-form__label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}
#kc-page-title {
  /* Span the row: PatternFly reserves a column for a locale picker we don't enable. */
  grid-column: 1 / -1;
  font-family: var(--pf-v5-global--FontFamily--heading);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--fior-foreground);
}

/* Inputs on the gateway's --input surface: one 1px border all round (PatternFly
   draws its own with ::before/::after, which gave mismatched fields) and a
   purple focus ring. */
.pf-v5-c-form-control {
  background: var(--fior-input);
  border: 1px solid var(--fior-border);
  border-radius: 0.375rem;
  min-height: 2.5rem;
  font-size: 0.875rem;
}
.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
  border: none;
}
.pf-v5-c-form-control:focus-within {
  border-color: hsl(272 45% 45%);
  box-shadow: 0 0 0 2px hsl(272 45% 45% / 0.35);
}
.pf-v5-c-form-control > input {
  color: var(--fior-foreground);
  font-size: 0.875rem;
  outline: none;
}

/* Password field + show/hide button read as one control. */
.pf-v5-c-input-group .pf-v5-c-input-group__item:first-child .pf-v5-c-form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control {
  background: var(--fior-input);
  color: var(--fior-muted-foreground);
  border: 1px solid var(--fior-border);
  border-left: none;
  border-radius: 0 0.375rem 0.375rem 0;
  min-height: 2.5rem;
}
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control::after {
  border: none;
}

/* Primary action: full-width gradient button (bg-gradient-primary hover:opacity-90). */
.pf-v5-c-button.pf-m-primary {
  --pf-v5-c-button--m-primary--BackgroundColor: transparent;
  --pf-v5-c-button--m-primary--hover--BackgroundColor: transparent;
  --pf-v5-c-button--m-primary--focus--BackgroundColor: transparent;
  --pf-v5-c-button--m-primary--active--BackgroundColor: transparent;
  --pf-v5-c-button--m-primary--Color: #fff;
  --pf-v5-c-button--m-primary--hover--Color: #fff;
  background: var(--fior-gradient-primary);
}
.pf-v5-c-button.pf-m-primary,
.pf-v5-c-button.pf-m-secondary {
  min-height: 2.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.pf-v5-c-button.pf-m-primary:hover {
  opacity: 0.9;
}

a,
.pf-v5-c-button.pf-m-link {
  color: var(--fior-primary-text);
}
