/* ==========================================================================
   Page header themes

   The site header is rendered by the layout, outside every page's slot, so a
   page cannot restyle it locally. Until now each subpage shipped its own copy
   of the same <style> block to recolour the nav — eleven near-identical blocks
   that drifted apart and were simply missing on any new page.

   These are the two themes those blocks were reproducing. Select one per page:

       <x-layout.default header-variant="overlay">   dark hero behind the bar
       <x-layout.default header-variant="solid">     white bar, dark text

   The layout puts `header-overlay` / `header-solid` on <body>, which is why
   everything here is scoped to a body class. Pass no variant and none of this
   applies — the base style.css rules stand.
   ========================================================================== */

:root {
  --page-header-light: #ffffff;
  --page-header-dark: #2c3e50;
  --page-header-accent: #d4af37;
  --page-header-solid-bg: rgba(255, 255, 255, 0.98);
}

/* ==========================================================================
   Overlay — the bar sits transparent on top of a dark hero, so its content is
   white; once scrolled the bar turns solid and the content flips to dark.
   ========================================================================== */

/* Top-level items only — `.ul-header-nav a` would also match the links inside
   .ul-header-submenu, whose panel is white (linear-gradient #fff → #f8f9fa),
   painting them white-on-white. Those keep their own colour, set further down. */
.header-overlay .ul-header .ul-header-nav > a,
.header-overlay .ul-header .ul-header-nav > .has-sub-menu > a,
.header-overlay .ul-header .ul-header-nav > * > a:not([href]):not([class]),
.header-overlay .ul-header .logo-text {
  color: var(--page-header-light) !important;
}

/* :not(.ul-menu-btn) throughout this file. That button is not a bare icon on
   the bar — it is a filled navy pill (gold while the panel is open) that
   carries its own label colour, set in nav-curtain.css. Theming it with the
   rest of the cluster paints its label the bar's colour and leaves it on the
   pill's own background: dark-on-navy at 1.37:1, which is what "the menu text
   goes black on the inner pages" was. The language switcher beside it is bare text
   and does want the theme; the search opener takes its colour from the disc
   it sits on, which nav-curtain.css owns. */
/* .ul-header-lang-switcher (the "EN"/"ع" toggle) is an <a>, not a <button> —
   main.js listens for clicks on a[href] there, so a <button> would bypass it
   entirely. It sits in the same corner as the search button but was missed
   by the button-only selector above, leaving it in its default dark colour
   over the dark hero instead of following the theme like its neighbour. */
/* :not(:hover):not(:focus-visible) throughout the corner-control rules below.
   These set the RESTING colour of the search opener and the language switcher,
   with !important and from a deeper selector than the pair block that owns
   their hover swap (nav-curtain.css). Left unqualified they applied while
   hovered too, and the swap could never take — white letters stayed white on
   the white they had just swapped to. The theme keeps the resting colour; the
   pair block keeps the interaction. */
.header-overlay .ul-header .ul-header-bottom-right button:not(.ul-menu-btn):not(:hover):not(:focus-visible),
.header-overlay .ul-header .ul-header-bottom-right .ul-header-lang-switcher:not(:hover):not(:focus-visible) {
  color: var(--page-header-light) !important;
}

.header-overlay .ul-header .ul-header-nav .has-sub-menu > a::after {
  color: var(--page-header-light);
}

/* Scrolled: solid bar, dark content (top level only, same reason as above) */
.header-overlay .ul-header.scrolled .ul-header-nav > a,
.header-overlay .ul-header.scrolled .ul-header-nav > .has-sub-menu > a,
.header-overlay .ul-header.scrolled .ul-header-nav > * > a:not([href]):not([class]),
.header-overlay .ul-header.scrolled .logo-text,
.header-overlay .ul-header.scrolled .ul-header-nav .has-sub-menu > a::after {
  color: var(--page-header-dark) !important;
}

.header-overlay .ul-header.scrolled .ul-header-bottom-right button:not(.ul-menu-btn):not(:hover):not(:focus-visible),
.header-overlay .ul-header.scrolled .ul-header-bottom-right .ul-header-lang-switcher:not(:hover):not(:focus-visible) {
  color: var(--page-header-dark) !important;
}

.header-overlay .ul-header .ul-header-nav > a:hover,
.header-overlay .ul-header .ul-header-nav > .has-sub-menu > a:hover {
  color: var(--page-header-accent) !important;
}

/* ==========================================================================
   Solid — the bar is always an opaque white strip with dark content.
   ========================================================================== */

.header-solid .ul-header,
.header-solid .ul-header.scrolled {
  background-color: var(--page-header-solid-bg) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-solid .ul-header-bottom-content {
  background-color: transparent !important;
}

.header-solid .ul-header .logo-text,
.header-solid .ul-header-nav > a,
.header-solid .ul-header-nav > .has-sub-menu > a,
.header-solid .ul-header-nav > * > a:not([href]):not([class]) {
  color: var(--page-header-dark) !important;
}

.header-solid .ul-header .ul-header-nav .has-sub-menu > a::after {
  color: var(--page-header-dark);
}

.header-solid .ul-header-nav > a:hover,
.header-solid .ul-header-nav > .has-sub-menu > a:hover {
  color: var(--page-header-accent) !important;
}

/* THE RESTING COLOUR ONLY. This rule used to add a translucent wash and a
   hairline border to both controls as well, which put a grey pill around two
   letters that have no box of their own — and on the college sites, which are
   the ones that use this bar, that pill was the whole of what looked wrong.
   Both are bare on the university's front page and they are bare here too;
   the hover swap that replaced the wash lives with the rest of the pair's
   treatment in nav-curtain.css. */
.header-solid .ul-header-bottom-right button:not(.ul-menu-btn):not(:hover):not(:focus-visible),
.header-solid .ul-header-bottom-right .ul-header-lang-switcher:not(:hover):not(:focus-visible) {
  color: var(--page-header-dark) !important;
}

/* ==========================================================================
   Dropdown panels — never themed

   .ul-header-submenu is a white panel that hangs below the bar, so its links
   must stay dark whichever theme is active. This is a backstop: the rules
   above are already scoped to top-level items, and this makes sure a future
   broad selector can't turn the dropdown unreadable again.

   Below 992px main.js moves the nav out of .ul-header and into .ul-sidebar,
   so nothing here applies on mobile.
   ========================================================================== */

.header-overlay .ul-header .ul-header-submenu a,
.header-solid .ul-header .ul-header-submenu a {
  color: var(--ul-black, #0F0D1D) !important;
}

.header-overlay .ul-header .ul-header-submenu a:hover,
.header-solid .ul-header .ul-header-submenu a:hover {
  color: var(--page-header-dark) !important;
}

/* Pages using this theme sit under an opaque bar, so their first block needs
   clearance. Kept with the theme because the required offset is a property of
   the header, not of any one page. */
.header-solid .ul-breadcrumb {
  padding-top: clamp(90px, 10.5vw, 200px);
  padding-bottom: clamp(45px, 5.25vw, 100px);
}

/* AND SO DOES THE OVERLAY THEME. The bar is `position: fixed` whether it is
   opaque or transparent, so the strip starts underneath it either way — but
   only the solid theme above was ever given room, and the news pages use this
   one. Their headline began level with the wordmark.

   --ul-header-clearance is the header's own measurements, summed once in the
   locale sheets; the page-header band uses the same value. */
.header-overlay .ul-breadcrumb {
  padding-top: var(--ul-header-clearance, clamp(90px, 10.5vw, 200px));
}
