/*
 * CLOUD-806: defaults for the stable hooks of the header and footer (themes/icms/README.md).
 * Loaded before the design's idp.css, so every rule of a design wins at the same specificity. Exceptions on purpose:
 * the home link (no link colours) and the hidden client name (never visible).
 * Colours and fonts belong to idp.css; this file only keeps the new markup looking like the old one.
 */

/* the logo: 41px high as the attribute height="41" before (a design's rule wins) */
.idp-header__logo {
  height: var(--idp-logo-height, 41px);
  width: auto;
  max-width: var(--idp-logo-max-width, none);
}

/* FO21: the client's name before a logo without alternative text, for screen readers only. Important, with two ids,
   and once more in a cascade layer: an important declaration in a layer wins over every important declaration outside
   of layers (the designs have none), whatever their specificity; the rule outside the layer is for browsers without
   @layer (before Chrome 99, Firefox 97, Safari 15.4). display:block keeps it in the accessibility tree against a
   design's display:none; visibility is left to the design, so that a header a design hides stays silent. */
#header .idp-header__logo-name,
#header #logo .idp-header__logo-name {
  display: block !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
@layer idp-hidden-name {
  .idp-header__logo-name {
    display: block !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }
}

/* the home link around #logo: a block around the block #logo (same box as without it), no link colours;
   the browser's focus ring stays */
.idp-header__home {
  display: block;
}
#header a.idp-header__home:is(:link, :visited, :hover, :focus, :active) {
  color: inherit;
  text-decoration: none;
  /* SimpleSAMLphp's a:hover, a:focus give a dark background and padding */
  background: none;
  padding: 0;
  /* many designs darken links on hover (a:hover { filter: brightness(0.6) }): not the logo; the browser's focus ring
     stays the focus indicator */
  filter: none;
}

/* the footer: text and links in one line, links in the footer's colour (SimpleSAMLphp's #footer a is white) */
.idp-footer__text {
  display: inline;
}
/* one paragraph of Markdown sits in the line like plain text (many designs give #footer a fixed height of one line);
   more paragraphs stay blocks */
.idp-footer__text--markdown {
  display: inline;
}
.idp-footer__text--markdown > p:only-child {
  display: inline;
  margin: 0;
  padding: 0;
}
.idp-footer__text--markdown > :first-child {
  margin-top: 0;
}
.idp-footer__text--markdown > :last-child {
  margin-bottom: 0;
}
.idp-footer__links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--idp-footer-gap, 1rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.idp-footer__text + .idp-footer__links {
  margin-left: var(--idp-footer-gap, 1rem);
}
/* as specific as SimpleSAMLphp's #footer a (loaded before), so a design's #footer a (loaded after) still wins; in the
   footer's colour, so underlined, else a link looks like the text around it (WCAG 1.4.1) */
#footer a:where(.idp-footer__link, .idp-footer__text a),
#footer a:where(.idp-footer__link, .idp-footer__text a):visited {
  color: inherit;
  text-decoration: underline;
}
