/* ============================================================================
   PD Case — Account console branding (parent: keycloak.v3)

   DESIGN RULE (learned the hard way):
     Override COMPONENT tokens (--pf-v5-c-*) and NEVER global colour tokens
     (--pf-v5-global--BackgroundColor--*, --pf-v5-global--Color--*).

   Why: PatternFly REUSES global tokens with different meanings per theme.
   --pf-v5-global--BackgroundColor--dark-100 means "dark masthead" in the light
   theme, but in dark theme it becomes the PAGE background. Overriding it at
   :root therefore inverts contrast somewhere unpredictable, and text ends up
   dark-on-dark. Same for `body { color: ... }` — that pins text colour in both
   themes and makes pages unreadable.

   Everything below is either a component token, a font, or a scoped rule, so it
   cannot invert PatternFly's own light/dark contrast pairing.

   Palette from the official logo: navy #243650, gold #F4BC1D.
   ========================================================================== */
:root {
  --pd-navy:        #243650;
  --pd-navy-strong: #16233A;
  --pd-blue:        #3D6EA8;   /* link colour, light theme */
  --pd-blue-light:  #8CB4E3;   /* link colour, dark theme */
  --pd-accent:      #F4BC1D;   /* brand gold — readable on both themes */
  --pd-font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* ---- Typography (theme-neutral, safe to set globally) ----------------- */
  --pf-v5-global--FontFamily--text:       var(--pd-font);
  --pf-v5-global--FontFamily--heading:    var(--pd-font);
  --pf-v5-global--FontFamily--sans-serif: var(--pd-font);
  --pf-global--FontFamily--sans-serif:    var(--pd-font);   /* PF4 fallback */

  /* ---- Masthead / page header: COMPONENT tokens only -------------------- */
  --pf-v5-c-masthead--BackgroundColor:               var(--pd-navy);
  --pf-v5-c-masthead--c-toolbar--BackgroundColor:    var(--pd-navy);
  --pf-v5-c-page__header--BackgroundColor:           var(--pd-navy);

  /* ---- Links (light theme) --------------------------------------------- */
  --pf-v5-global--link--Color:        var(--pd-blue);
  --pf-v5-global--link--Color--hover: var(--pd-navy-strong);
}

/* Font only. NEVER set `color` on body — see the design rule above. */
body { font-family: var(--pd-font); }

/* ---- Masthead ------------------------------------------------------------
   Navy in BOTH themes: it is dark by design, so it needs no dark variant.
   The inner toolbar paints its own background, hence the transparent rule. */
.pf-v5-c-masthead,
.pf-v5-c-page__header,
.pf-c-masthead,
.pf-c-page__header {
  background-color: var(--pd-navy);
  border-bottom: 3px solid var(--pd-accent);
}
.pf-v5-c-masthead .pf-v5-c-toolbar,
.pf-c-masthead .pf-c-toolbar {
  --pf-v5-c-toolbar--BackgroundColor: transparent;
  background-color: transparent;
}
.pf-v5-c-masthead__brand img,
.pf-c-masthead__brand img,
.pf-v5-c-page__header-brand img { height: 34px; width: auto; }

/* ---- Primary buttons ------------------------------------------------------
   Scoped to the component so it cannot affect body text. */
.pf-v5-c-button.pf-m-primary,
.pf-c-button.pf-m-primary {
  background-color: var(--pd-navy);
  color: #fff;
  border-radius: 8px;
}
.pf-v5-c-button.pf-m-primary:hover,
.pf-c-button.pf-m-primary:hover { background-color: var(--pd-navy-strong); }

/* ---- Accents -------------------------------------------------------------- */
.pf-v5-c-nav__link.pf-m-current,
.pf-c-nav__link.pf-m-current { border-left: 3px solid var(--pd-accent); }

.pf-v5-c-card, .pf-c-card { border-radius: 12px; }

/* ============================================================================
   DARK THEME
   PatternFly sets .pf-v5-theme-dark on <html>. Only two things need adjusting:
   navy is too dark to read as a LINK or BUTTON FILL against a dark page.
   Text and surface colours are deliberately left to PatternFly.
   ========================================================================== */
.pf-v5-theme-dark {
  --pf-v5-global--link--Color:        var(--pd-blue-light);
  --pf-v5-global--link--Color--hover: #B3CFF0;
}

.pf-v5-theme-dark .pf-v5-c-button.pf-m-primary {
  background-color: #4E7DBA;
  color: #fff;
}
.pf-v5-theme-dark .pf-v5-c-button.pf-m-primary:hover {
  background-color: #6E9AD1;
}

/* Some builds apply dark via the media query rather than the class. */
@media (prefers-color-scheme: dark) {
  :root:not(.pf-v5-theme-light) {
    --pf-v5-global--link--Color:        var(--pd-blue-light);
    --pf-v5-global--link--Color--hover: #B3CFF0;
  }
}
