/* Site header (lib/header.js): a black "Latest" strip, then one bold row with the red logo, the
   uppercase menu (current section in red), search and dark mode, over a thick black rule.
   Colours follow the theme's dark scheme ([data-scheme="dark"] on <html>); the strip stays black. */
.cm-header {
  --cmh-accent: #cc0100;
  --cmh-ink: #0a0a0a;
  --cmh-bg: #fff;
  --cmh-bar: #0b0b0b;
  --cmh-bar-muted: #9a9a9a;
  --cmh-rule: #0a0a0a;
  position: relative;
  z-index: 50;
  background: var(--cmh-bg);
}
[data-scheme="dark"] .cm-header { --cmh-accent: #ff3b33; --cmh-ink: #fff; --cmh-bg: #232323; --cmh-rule: #fff; }
.cm-header .cs-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.cm-header i.cs-icon { font-size: 18px; color: var(--cmh-ink); }
.cm-header button.navbar-toggle { padding: 0; border: 0; background: none; cursor: pointer; line-height: 1; }

/* "Latest" strip */
.cm-header__latest { background: var(--cmh-bar); color: #fff; }
.cm-header__latestrow { display: flex; align-items: center; gap: 16px; min-height: 36px; }
.cm-header__label { flex: none; padding: 4px 9px; background: #cc0100; color: #fff; font-family: Poppins, sans-serif; font-size: .66rem; font-weight: 700; letter-spacing: .1em; line-height: 1.2; text-transform: uppercase; }
.cm-header__headline { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #fff !important; font-family: Poppins, sans-serif; font-size: .8rem; font-weight: 500; text-decoration: none !important; }
.cm-header__headline:hover, .cm-header__headline:focus-visible { text-decoration: underline !important; text-underline-offset: 3px; }
.cm-header__date { flex: none; font-family: Lato, sans-serif; font-size: .8rem; color: var(--cmh-bar-muted); white-space: nowrap; }

/* main row: logo | menu (right-aligned) | tools; the theme's sticky bar */
.cm-header .navbar-primary.cm-header__nav { position: relative; background: var(--cmh-bg) !important; border-bottom: 4px solid var(--cmh-rule); box-shadow: none; }
.cm-header__row { display: grid !important; grid-template-columns: auto 1fr auto; align-items: center; gap: 36px; min-height: 80px; padding: 0 !important; border: 0 !important; /* the theme's own faint line */ }
.cm-header__brand { display: flex; align-items: center; gap: 14px; }
.cm-header__logo { position: static !important; display: flex !important; align-items: center; margin: 0 !important; opacity: 1 !important; visibility: visible !important; transform: none !important; } /* the theme centres its logo absolutely on phones */
.cm-header__logo img.logo-image { display: block; height: 30px; width: auto !important; max-width: none; }
.cm-header__menu { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.cm-header__menu .navbar-nav { display: flex; align-items: center; gap: 24px; margin: 0; padding: 0; list-style: none; }
.cm-header__menu .navbar-nav > li > a { display: block; padding: 0; line-height: 80px; font-family: Poppins, sans-serif; font-size: .82rem !important; font-weight: 800 !important; letter-spacing: .06em !important; text-transform: uppercase !important; color: var(--cmh-ink) !important; text-decoration: none !important; transition: color .15s; }
.cm-header__menu .navbar-nav > li > a:hover, .cm-header__menu .navbar-nav > li > a:focus-visible,
.cm-header__menu .navbar-nav > li.current-menu-item > a, .cm-header__menu .navbar-nav > li.current-menu-parent > a { color: var(--cmh-accent) !important; }
.cm-header__menu .navbar-widgets-btn { color: var(--cmh-ink); }
/* "…" pages dropdown: the hover area spans the full height of the row, so moving the mouse from the
   dots down to the dropdown (which opens below the row) never crosses a gap that closes it. It also
   stays open while the button or a link in it has focus (a click, a tap or the keyboard). */
.cm-header__menu .navbar-multi-column-widgets { display: flex; align-items: center; align-self: stretch; height: 80px; padding: 0 6px; cursor: pointer; }
.cm-header__menu .navbar-multi-column-widgets:hover .navbar-widgets-btn i,
.cm-header__menu .navbar-multi-column-widgets:focus-within .navbar-widgets-btn i { color: var(--cmh-accent); }
.cm-header__menu .navbar-multi-column-widgets:focus-within .navbar-widgets-container { display: block; opacity: 1; visibility: visible; }
@media (min-width: 1020px) { .cm-header .navbar-primary.sticky-nav .cm-header__menu .navbar-multi-column-widgets { height: 64px; } }
.cm-header__tools { display: flex; align-items: center; gap: 18px; }
.cm-header .navbar-scheme-toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.cm-header .navbar-search:hover i, .cm-header .navbar-scheme-toggle:hover i { color: var(--cmh-accent); }
.cm-header__mobile { display: none !important; }
/* while stuck to the top of the screen (desktop; on phones the whole header sticks instead) */
@media (min-width: 1020px) {
  .cm-header .navbar-primary.sticky-nav { position: fixed; top: 0; left: 0; right: 0; }
  .cm-header .navbar-primary.sticky-nav .cm-header__row { min-height: 64px; }
  .cm-header .navbar-primary.sticky-nav .cm-header__menu .navbar-nav > li > a { line-height: 64px; }
  .cm-header .navbar-primary.sticky-nav .cm-header__logo img.logo-image { height: 24px; }
}
@media (max-width: 1019px) { .cm-header .navbar-primary.cm-header__nav { position: relative !important; top: auto !important; transform: none !important; } }

/* red logo: the brighter copy on the dark scheme */
.cm-header .logo-image-dark { display: none !important; }
[data-scheme="dark"] .cm-header .logo-image-dark { display: block !important; }
[data-scheme="dark"] .cm-header .logo-image-dark + .logo-image { display: none !important; }

/* phones and tablets: menu button | logo | search, dark mode; the categories move to the side panel */
@media (max-width: 1019px) {
  .cm-header { position: sticky; top: 0; } /* the theme's sticky bar is desktop-only */
  .cm-header__date { display: none; }
  .cm-header__latestrow { gap: 10px; min-height: 32px; }
  .cm-header__row { grid-template-columns: 1fr auto; gap: 12px; min-height: 60px; height: 60px !important; }
  .cm-header__menu { display: none !important; }
  .cm-header__mobile { display: inline-flex !important; }
  .cm-header__logo img.logo-image { height: 22px; }
  .cm-header .navbar-primary.cm-header__nav { border-bottom-width: 3px; }
}

/* article pages: the theme pulled its full-screen photo header up under its transparent menu bar
   (a negative margin) and sized it to the whole screen. The header is solid now, so the photo starts
   below it and fills the rest of the screen, keeping the headline above the fold.
   Header height: strip 36 + row 80 + rule 4 = 120px (phones: 32 + 60 + 3 = 95px). */
.cm-header ~ .page-header-large { margin-top: 0 !important; height: calc(100vh - 120px) !important; min-height: 460px; }
.cm-header ~ .page-header-large .overlay-outer { height: 100% !important; padding-top: 0 !important; }
@media (max-width: 1019px) { .cm-header ~ .page-header-large { height: calc(100vh - 95px) !important; min-height: 380px; } }
