/**
 * @file
 * Preheader region layout styling.
 *
 * A thin bar above the main header holding the language switcher (left)
 * and quick links like Contact/Donate (right) -- kept out of the main
 * navigation so the primary menu stays uncluttered.
 */

.preheader {
  background: var(--color--gray-5);
  color: var(--color--white);
  font-size: var(--font-size-xs);
  line-height: 1;
}

.preheader__inner {
  padding-block-start: 1rem;
  padding-block-end: 1rem;
}

/* .preheader__inner's actual DOM child is Drupal's auto-generated
 * .region--preheader wrapper (not the blocks directly) -- that's the real
 * flex container the two blocks (language switcher, preheader links menu)
 * need to sit side by side in, right-aligned, on one line. */
.preheader__inner .region--preheader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp2);
}

/* region.css (Olivero core) gives every direct child of any .region a
 * margin-block-end that grows at wider viewports (--sp/--sp2/--sp3) -- that
 * applies to the two block wrappers here (language switcher, preheader
 * links), not just their inner <ul>s, and is a separate source of bottom
 * spacing from the .links/.menu margin below. Zero it out at this
 * higher-specificity selector so it doesn't reappear at wider widths. */
.preheader .preheader__inner .region--preheader > * {
  margin-block-end: 0;
}

/* Both blocks' lists inline, not stacked -- selectors match the theme's
 * actual output classes (ul.links for the language switcher, ul.menu for
 * the Preheader Links menu), not just their block wrapper divs. */
.preheader__inner .links,
.preheader__inner .menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp1);
  margin-block-start: 0;
  margin-block-end: 0;
  padding: 0;
  list-style: none;
}

.preheader__inner .links li,
.preheader__inner .menu li {
  margin: 0;
}

.preheader__inner a {
  display: inline-block;
  padding-block: 0.35rem;
  text-decoration: none;
  color: var(--color--white);
}

.preheader__inner a:hover {
  text-decoration: underline;
}

/* Only show the link to switch to the *other* language. */
.preheader__inner .links li.is-active {
  display: none;
}

/* Donate link as a small green button, matching the donate banner's button
 * colors -- identified by its resolved system path (stable across
 * languages/alias changes) rather than href, since both language variants
 * point at different aliases for the same node. Scoped to .menu (the
 * Preheader Links menu) specifically, not just the attribute: when the
 * current page IS the Donate node, the .links language switcher's own
 * entries also carry data-drupal-link-system-path="node/38" (they link to
 * this same node in each language), so an unscoped attribute selector
 * wrongly greened the language switcher too on that page. */
.preheader__inner .menu a[data-drupal-link-system-path="node/38"] {
  display: inline-block;
  padding: 0.35rem 0.5rem;
  border-radius: var(--border-radius);
  background-color: rgb(139, 192, 0);
  color: var(--color--white);
}

.preheader__inner .menu a[data-drupal-link-system-path="node/38"]:hover,
.preheader__inner .menu a[data-drupal-link-system-path="node/38"]:focus {
  background-color: var(--color--black);
  text-decoration: none;
}
