  /* Keep the mobile masthead pinned; visibility never changes its position. */
  @media (max-width: 767px) {
    .template-header,
    .template-header.is-hidden {
      position: fixed;
      top: 0;
      transform: none;
      will-change: auto;
      transition: opacity 120ms ease;
    }
    body.client-preview-visible .template-header {
      top: 38px;
    }
    .template-header.is-scrolled:not(.is-hidden) {
      background: transparent;
      opacity: 1;
    }
    /* Safari owns the status-area background; no offscreen paint extension. */
    .template-header::before,
    .template-header.is-scrolled::before {
      top: 0;
      background: transparent;
      opacity: 0;
      transition: none;
    }
    .template-header__group:last-child {
      display: contents !important;
      position: static !important;
    }
    .template-header .header-language { position: absolute !important; }
    .template-header .header-language__menu {
      position: absolute !important;
      top: calc(100% + 4px) !important;
      right: 0 !important;
    }
    html:has(.template-header.is-scrolled),
    body:has(.template-header.is-scrolled) { background: #fff; }
  }

/* Header controls retain their physical positions in every language. */
@media (max-width: 767px) {
  .template-header { direction: ltr; }
  .template-header .header-language summary { direction: ltr; }
  .template-header .menu-toggle { grid-column: 1; justify-self: start; }
  html[dir="rtl"] .template-header .header-language__menu { direction: rtl; }
  html[lang="fr"] #top .hero__actions .line-link--button:not(.hero-cta--primary) {
    white-space: normal;
    padding: 6px 12px;
    font-size: 1.2rem;
    line-height: 1.1;
    text-align: center;
  }
  .section-progress { display: none; }
}

/* Adapt transparent mobile controls to the pixels beneath the masthead. */
@media (max-width: 767px) {
  .template-header,
  .template-header.is-scrolled {
    color: #fff;
    background: transparent;
    mix-blend-mode: normal;
  }
  .template-header.is-scrolled {
    mix-blend-mode: difference;
  }
  .template-header .wordmark img,
  .template-header.is-scrolled .wordmark img,
  .template-header.is-scrolled .wordmark:hover img {
    filter: brightness(0) invert(1);
  }
  .template-header .header-language summary,
  .template-header.is-scrolled .header-language summary {
    color: #fff !important;
  }
  /* Keep the open language panel's white surface and dark text readable. */
  .template-header:has(.header-language[open]) {
    mix-blend-mode: normal;
  }
}
