@scope (.site-header) {
  :scope {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 2.5rem 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
  }
  a {
    color: var(--color-text);
    text-decoration: none;
    /* Deterministic box height regardless of font-size — without this,
       the logo (1.1rem) and nav links (0.95rem) round their default
       line-heights to a different number of sub-pixels, so align-items:
       center centers them a fraction of a pixel apart depending on which
       page happens to repaint first. Visible as the header appearing to
       "shift" by ~1px between page loads, not a real per-page layout
       difference (confirmed by measuring — logo/nav position is what
       varies, not header height or search position). */
    line-height: 1.2;
  }
  a:hover {
    color: var(--color-accent);
  }

  .site-logo {
    /* font-weight set globally (globals.css) — every browser-bold-by-
       default element gets this site's subtler 600, not standard 700. */
    font-size: 1.1rem;
  }

  .site-nav {
    display: flex;
    gap: 1.25rem;
    /* Grows to soak up the space between the logo and the search box,
       rather than the three sitting flush together at small widths. */
    flex: 1 1 auto;
  }

  .site-nav a {
    font-size: 0.95rem;
  }

  .site-search {
    position: relative;
    flex: 0 1 16rem;
  }

  .site-search input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-text);
    border-radius: 0.3rem;
  }

  .site-search input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }

  .site-search-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    width: min(24rem, 90vw);
    max-height: 70vh;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--color-bg);
    border: 1px solid var(--color-text);
    border-radius: 0.3rem;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
    z-index: 10;
  }

  .site-search-results a {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: 0.2rem;
    font-size: 0.9rem;
  }

  .site-search-results a:hover,
  .site-search-results a:focus-visible {
    background: var(--color-accent);
    color: var(--color-bg);
    outline: none;
  }

  .site-search-result-title {
    display: block;
    font-weight: 600;
  }

  .site-search-result-excerpt {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
  }

  .site-search-result-excerpt mark {
    background: none;
    color: inherit;
    font-weight: 700;
  }

  .site-search-empty {
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
    opacity: 0.7;
  }
}
