# Header Overlay

> A transparent header over the hero photo: once the hero passes under it, a solid bar comes down and the text turns dark along its edge; below 900 px, a full-screen menu.

Header · header, transparent header, nav, navbar, hero, sticky header, mobile menu, fullscreen menu · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-28
Demo: https://kodza.dev/components/header-overlay/
Source on GitHub: https://github.com/kodza-dev/kodza/tree/main/components/header-overlay

Takes the whole screen (or reacts to the page scroll): give it a page, not a small box.

## Files

The code below, served as files: byte for byte what the Kodza site copies (the CSS includes its theme guard).

- [`kodza-header-overlay.css`](https://kodza.dev/registry/header-overlay/kodza-header-overlay.css) · 37.2 KB
- [`kodza-header-overlay.js`](https://kodza.dev/registry/header-overlay/kodza-header-overlay.js) · 36.8 KB
- [`kodza-header-overlay.html`](https://kodza.dev/registry/header-overlay/kodza-header-overlay.html) · 3.1 KB · the markup, to adapt and paste into your page

**Can you run shell commands? Download the CSS and the JS, don't retype them.** Retyping costs thousands of tokens and can drop or change lines of the CSS. Put the files where your stack expects them (Use it says where: change the `-o` paths):

```bash
curl -fsSL --create-dirs -o kodza/kodza-header-overlay.css https://kodza.dev/registry/header-overlay/kodza-header-overlay.css
curl -fsSL --create-dirs -o kodza/kodza-header-overlay.js https://kodza.dev/registry/header-overlay/kodza-header-overlay.js
```

Then load the files from your page as Use it shows, instead of pasting the content. The HTML is the part you adapt (text, links, modifiers): paste it from the Code section. Copy the CSS and the JS from the Code section only if you can't run commands, exactly as they are. (Windows PowerShell: `curl.exe`.)

## API

- Root: `.kodza-header-overlay`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-header-overlay-fg: #ffffff`
  - `--kz-header-overlay-muted: rgba(255, 255, 255, 0.78)`
  - `--kz-header-overlay-soft: rgba(255, 255, 255, 0.16)` — the Menu button
  - `--kz-header-overlay-cta-bg: #ffffff`
  - `--kz-header-overlay-cta-fg: #0a0a0a`
  - `--kz-header-overlay-veil: rgba(0, 0, 0, 0.32)` — a shade at the top of the photo, so white reads
  - `--kz-header-overlay-solid-bg: #f2f2f0`
  - `--kz-header-overlay-solid-fg: #0a0a0a`
  - `--kz-header-overlay-solid-muted: rgba(10, 10, 10, 0.62)`
  - `--kz-header-overlay-solid-soft: rgba(10, 10, 10, 0.06)`
  - `--kz-header-overlay-solid-rule: rgba(10, 10, 10, 0.1)`
  - `--kz-header-overlay-solid-cta-bg: #0a0a0a`
  - `--kz-header-overlay-solid-cta-fg: #ffffff`
  - `--kz-header-overlay-top: var(--wp-admin--admin-bar--height, 0px)` — below the WordPress admin bar
  - `--kz-header-overlay-height: 76px`
  - `--kz-header-overlay-width: 1200px` — the row, centred
  - `--kz-header-overlay-pad: 24px`
  - `--kz-header-overlay-duration: 0.7s` — the blind
  - `--kz-header-overlay-ease: cubic-bezier(0.33, 1, 0.68, 1)` — off at once: it answers the scroll
  - `--kz-header-overlay-menu-bg: #0a0a0a`
  - `--kz-header-overlay-menu-fg: #f2f2f0`
  - `--kz-header-overlay-menu-muted: rgba(242, 242, 240, 0.62)`
  - `--kz-header-overlay-menu-top: calc(var(--wp-admin--admin-bar--height, 0px) + 18px)` — Close lands on Menu on its own; this is where it goes if Menu is somewhere else
  - `--kz-header-overlay-menu-side: 24px`
  - `--kz-header-overlay-menu-size: clamp(40px, min(10cqw + 12px, calc((100cqh - 230px) / 5.3)), 132px)`
  - `--kz-header-overlay-menu-curve: 1` — how far the edge bends on the way; 0 = a straight edge
  - `--kz-header-overlay-menu-shade: 0.5` — how dark the page gets under it
  - `--kz-header-overlay-menu-depth: 0.94` — the page's size once covered
  - `--kz-header-overlay-menu-duration: 1s`
  - `--kz-header-overlay-menu-ease: cubic-bezier(0.76, 0, 0.24, 1)`
  - `--kz-header-overlay-page: auto` — the page colour while it backs off; auto = the first background above it
- Attributes:
  - `data-hero`
  - `data-page`
- Lifecycle: `kodza:init` / `kodza:destroy` on `document`, with `{ detail: { root } }` to target a container.

## Keyboard

What each key does, by where the focus is. Keep it working when you adapt the HTML: same elements, same classes.

- On the Menu button, below 900 px (focus in `.kodza-header-overlay__toggle`):
  - `Enter` / `Space`: Opens the curtain on the current link, or the first
- In the curtain (focus in `.kodza-header-overlay__panel`):
  - `ArrowDown` / `ArrowUp`: Next or previous link, round and round
  - `Home` / `End`: First or last link
  - `Tab` / `Shift+Tab`: Stays inside the curtain, round and round
  - `PageUp` / `PageDown`: Held back, the page behind stays put
- Anywhere, while it's open (while `.kodza-header-overlay__toggle[aria-expanded="true"]` is on the page):
  - `Escape`: Lifts the curtain, focus back on Menu

## Dark mode

The values Kodza uses on a dark background (`#0a0a0a`). For a page that follows the system theme, add them after the component's CSS:

```css
@media (prefers-color-scheme: dark) {
  .kodza-header-overlay {
    --kz-header-overlay-solid-bg: #0a0a0a;
    --kz-header-overlay-solid-fg: #f2f2f0;
    --kz-header-overlay-solid-muted: rgba(242, 242, 240, 0.62);
    --kz-header-overlay-solid-soft: rgba(242, 242, 240, 0.08);
    --kz-header-overlay-solid-rule: rgba(242, 242, 240, 0.12);
    --kz-header-overlay-solid-cta-bg: #f2f2f0;
    --kz-header-overlay-solid-cta-fg: #0a0a0a;
    --kz-header-overlay-menu-bg: #f2f2f0;
    --kz-header-overlay-menu-fg: #0a0a0a;
    --kz-header-overlay-menu-muted: rgba(10, 10, 10, 0.62);
  }
}
```

A site with its own theme switch puts the same rules under its dark selector instead (`[data-theme="dark"] .kodza-header-overlay { … }`); a single dark section, under that section's class.

Every colour is a variable on the header. Over the photo it is white (--kz-header-overlay-fg, -muted, -soft, -cta-bg, -cta-fg); once the blind is down, the -solid-* set takes over (bg, fg, muted, soft, rule, cta-bg, cta-fg): set those for an ink blind on a dark site. The curtain has its own --kz-header-overlay-menu-* set (bg, fg, muted), so it can turn to paper.

## Use it

### Plain HTML page

- CSS: `kodza/kodza-header-overlay.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-header-overlay.css">`. Without a shell, paste it in a `<style>` in `<head>` instead. It only touches `kodza-` classes.
- HTML: where the component goes. Paste it as many times as you need: instances never interfere.
- Where it goes, step by step. (1) Right before the hero: it takes no height, so the hero starts at the very top under it. (2) The hero is what comes after it; if that's not your photo, name it with data-hero=".your-hero" on the header. (3) Mark the wrapper of your page with data-header-overlay-page so it backs off under the curtain on phones. (4) A light photo needs a darker --kz-header-overlay-veil, or the white text won't read.
- JS: `kodza/kodza-header-overlay.js`, loaded with `<script src="kodza/kodza-header-overlay.js" defer></script>` in `<head>`. Without a shell, paste it in a `<script>` before `</body>` (or in `<head>`: it waits for the page). One copy per page, whatever the number of instances.
- Restyle with the `--kz-…` variables, set on the component's root element itself (the root declares its own defaults, so a value on an ancestor is ignored), and with the modifiers / attributes listed under API.
- Font: it takes the page's own. The Kodza look is Geist: `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.
- Content added later (AJAX navigation, a SPA route, a builder preview): start it with `document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: container } }))`; before removing it, the same call with `'kodza:destroy'` stops it and puts the original markup back.

### Claude artifact (claude.ai)

- Paste the CSS in a `<style>` and the JS in a `<script>` at the end, in the artifact itself: it loads stylesheets only from Google Fonts and scripts only from a few CDNs, so no `<link>` or `<script src>` to Kodza.
- Writing the artifact file with a shell? Insert the downloaded files (Files) with a command instead of retyping them: a line `KODZA-CSS` alone inside the `<style>`, `KODZA-JS` inside the `<script>`, then `sed -e '/^KODZA-CSS$/{r kodza/kodza-header-overlay.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-header-overlay.js' -e 'd' -e '}' page.html > artifact.html`.
- Font: load Geist from Google Fonts (allowed): `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.
- Dark mode: the viewer sets `data-theme="dark"` or `"light"` on `<html>`, or nothing when it follows the system. Write the Dark mode rules twice: inside `@media (prefers-color-scheme: dark)` with `:root:not([data-theme="light"])` in front of each selector, and with `:root[data-theme="dark"]` in front of each selector.
- Where it goes, step by step. (1) Right before the hero: it takes no height, so the hero starts at the very top under it. (2) The hero is what comes after it; if that's not your photo, name it with data-hero=".your-hero" on the header. (3) Mark the wrapper of your page with data-header-overlay-page so it backs off under the curtain on phones. (4) A light photo needs a darker --kz-header-overlay-veil, or the white text won't read.

### WordPress

- HTML: a **Custom HTML** block (or a pattern / template part). WordPress keeps this markup as it is only for users allowed to post unfiltered HTML (Administrators; Super Admins on multisite): for anyone else it strips tags such as `<svg>`, `<input>` or `<dialog>`, so add it from the theme (a pattern or template part) instead.
- This one spans the page: a block theme keeps a Custom HTML block to the width of the text column, so put it inside a **Group** block set to **Full width**, with **Inner blocks use content width** turned off.
- CSS and JS: the downloaded files go in the theme, under `wp-content/themes/<your-theme>/kodza/` (the child theme if there is one), enqueued from its functions.php (or a code-snippets plugin):
  ```php
  add_action('wp_enqueue_scripts', function () {
    $dir = get_stylesheet_directory() . '/kodza/';
    $uri = get_stylesheet_directory_uri() . '/kodza/';
    wp_enqueue_style('kodza-header-overlay', $uri . 'kodza-header-overlay.css', [], filemtime($dir . 'kodza-header-overlay.css'));
    wp_enqueue_script('kodza-header-overlay', $uri . 'kodza-header-overlay.js', [], filemtime($dir . 'kodza-header-overlay.js'), true);
  });
  ```
  Scoped to `kodza-` classes, the CSS never touches the theme. One copy of the JS, whatever the number of blocks.
- No access to the theme files? The CSS can also go, as it is, in **Appearance → Customize → Additional CSS** (classic theme) or **Styles → Additional CSS** in the Site Editor (block theme).
- Theme with AJAX page transitions: fire `kodza:init` on the new content after each swap (and `kodza:destroy` on the old one).
- Performance plugin (WP Rocket, LiteSpeed Cache, Perfmatters…) with **Delay JavaScript execution** turned on: add `kodza` to the scripts it must not delay. Otherwise the component waits for the visitor's first scroll, tap or mouse move, and that first click can be lost.
- Colours: it takes the colour of the text around it (or keeps its own monochrome): nothing to point at the theme.
- WordPress turns straight quotes and `--` into typographic ones in the text of a Custom HTML block (not inside `<code>` or `<pre>`).
- Put it in the site header (Site Editor → Patterns → Header, or the theme's header.php) in place of the theme's own header, right before the hero (a Cover block works). The links can come from wp_nav_menu(['theme_location' => 'primary', 'container' => false, 'items_wrap' => '%3$s']) inside the ul, with the item class added by the nav_menu_link_attributes filter. The curtain is written from those links, and the wrapper of most themes is found on its own.

#### With Elementor

- HTML: an **HTML** widget (Elementor shows it to administrators only). It keeps the code exactly as pasted, straight quotes included.
- This one spans the page: give the widget its own container, **Content Width: Full Width**, padding 0.
- CSS and JS: as above. Elementor's Site Settings → Theme Style styles every button, field, link and image of the page, components included; the theme guard at the end of the CSS keeps the component's buttons, fields and link colours as they are.
- The Elementor editor redraws each widget after the page has loaded: without the script below, the component stays still in the editor preview (the published page works). Add it once per site, in the footer like the component's script (`kodza/elementor-editor.js`, or a code-snippets plugin):

```js
// Kodza in the Elementor editor: the editor redraws each HTML widget after the page has loaded.
// Start Kodza in what it draws, stop it in what it replaces or removes. Once per site.
window.addEventListener('elementor/frontend/init', () => {
  if (!elementorFrontend.isEditMode()) return;
  class KodzaWidget extends elementorModules.frontend.handlers.Base {
    onInit() {
      super.onInit();
      this.kodza = [...this.$element[0].children];
      document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: this.$element[0] } }));
    }
    onDestroy() {
      super.onDestroy();
      this.kodza.forEach((root) => document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } })));
    }
  }
  elementorFrontend.elementsHandler.attachHandler('html', KodzaWidget);
});
```

- No child theme: everything can go in the HTML widget instead, `<style>` with the CSS, the HTML, then `<script>` with the JS. It works on the page and in the editor without the script above. This one reads the page around it, and a script in the widget runs before the rest of the page exists: put its `<script>` in an HTML widget at the bottom of the page instead.

### Shopify

- Files: `assets/kodza-header-overlay.css` and `assets/kodza-header-overlay.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-header-overlay.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-header-overlay.js' | asset_url }}" defer></script>`, then the HTML.
- The theme editor re-renders sections: restart them with
  `document.addEventListener('shopify:section:load', (e) => document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: e.target } })));`
  and the same with `shopify:section:unload` → `kodza:destroy`.
- Where it goes, step by step. (1) Right before the hero: it takes no height, so the hero starts at the very top under it. (2) The hero is what comes after it; if that's not your photo, name it with data-hero=".your-hero" on the header. (3) Mark the wrapper of your page with data-header-overlay-page so it backs off under the curtain on phones. (4) A light photo needs a darker --kz-header-overlay-veil, or the white text won't read.

### React / Next.js

- Files, side by side (e.g. in `components/kodza/`): `HeaderOverlay.tsx` (below), the CSS block under Code saved as `header-overlay.css` and the JS block as `header-overlay.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { HeaderOverlay } from '@/components/kodza/HeaderOverlay';` then `<HeaderOverlay />`. Props: `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-header-overlay-fg': … }}`), `className`, `style` and the other props of its `<header>` (`onClick`, `aria-…`).
- Next.js App Router: it is a Client Component already (`'use client'`). Pages Router: Next.js takes global CSS only in `pages/_app`, so move the `import './header-overlay.css'` line there.
- Safe under StrictMode, client-side navigation and prop changes: when a prop changes, the `key` gives React a fresh element, `kodza:destroy` stops the script on the old one and `kodza:init` starts it on the new one.
- Built from your data (tabs, rows, options)? Add what the markup is made of to the `key`, as plain values (ids, text, numbers). What the visitor changes (the open tab, the sort, what they type) is the script's: follow it with `onClick` or `onInput` on the root, and change it from your code as a visitor would (click the tab; set the field's value, then dispatch a bubbling `input` event). Fields stay uncontrolled (`defaultValue`, `name`).

```tsx
'use client';
// Kodza — Header Overlay, for React. From https://kodza.dev/components/header-overlay/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: header-overlay.css and header-overlay.js, the component's CSS and JS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
// The script changes this markup once React has rendered it (it adds layers, splits text, moves
// nodes), so React must not patch it afterwards. When a prop changes, the key gives React a fresh
// element: kodza:destroy stops the script on the old one, kodza:init starts it on the new one.
// Built from your data (tabs, rows, options)? Put what the markup is made of in the key, as plain
// values (ids, text, numbers): a change starts the script again on fresh markup. What the visitor
// changes (the open tab, the sort, what they type) is the script's: keep it out of the key, follow
// it with onClick or onInput on the root, and change it from your code as a visitor would (click
// the tab; set the field's value, then dispatch a bubbling input event).
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './header-overlay.css';

export type HeaderOverlayProps = Omit<ComponentPropsWithoutRef<'header'>, "children" | "vars"> & {
  /** Settings, as CSS variables on the root */
  vars?: {
    /** default: #ffffff */
    "--kz-header-overlay-fg"?: string | number;
    /** default: rgba(255, 255, 255, 0.78) */
    "--kz-header-overlay-muted"?: string | number;
    /** the Menu button — default: rgba(255, 255, 255, 0.16) */
    "--kz-header-overlay-soft"?: string | number;
    /** default: #ffffff */
    "--kz-header-overlay-cta-bg"?: string | number;
    /** default: #0a0a0a */
    "--kz-header-overlay-cta-fg"?: string | number;
    /** a shade at the top of the photo, so white reads — default: rgba(0, 0, 0, 0.32) */
    "--kz-header-overlay-veil"?: string | number;
    /** default: #f2f2f0 */
    "--kz-header-overlay-solid-bg"?: string | number;
    /** default: #0a0a0a */
    "--kz-header-overlay-solid-fg"?: string | number;
    /** default: rgba(10, 10, 10, 0.62) */
    "--kz-header-overlay-solid-muted"?: string | number;
    /** default: rgba(10, 10, 10, 0.06) */
    "--kz-header-overlay-solid-soft"?: string | number;
    /** default: rgba(10, 10, 10, 0.1) */
    "--kz-header-overlay-solid-rule"?: string | number;
    /** default: #0a0a0a */
    "--kz-header-overlay-solid-cta-bg"?: string | number;
    /** default: #ffffff */
    "--kz-header-overlay-solid-cta-fg"?: string | number;
    /** below the WordPress admin bar — default: var(--wp-admin--admin-bar--height, 0px) */
    "--kz-header-overlay-top"?: string | number;
    /** default: 76px */
    "--kz-header-overlay-height"?: string | number;
    /** the row, centred — default: 1200px */
    "--kz-header-overlay-width"?: string | number;
    /** default: 24px */
    "--kz-header-overlay-pad"?: string | number;
    /** the blind — default: 0.7s */
    "--kz-header-overlay-duration"?: string | number;
    /** off at once: it answers the scroll — default: cubic-bezier(0.33, 1, 0.68, 1) */
    "--kz-header-overlay-ease"?: string | number;
    /** default: #0a0a0a */
    "--kz-header-overlay-menu-bg"?: string | number;
    /** default: #f2f2f0 */
    "--kz-header-overlay-menu-fg"?: string | number;
    /** default: rgba(242, 242, 240, 0.62) */
    "--kz-header-overlay-menu-muted"?: string | number;
    /** Close lands on Menu on its own; this is where it goes if Menu is somewhere else — default: calc(var(--wp-admin--admin-bar--height, 0px) + 18px) */
    "--kz-header-overlay-menu-top"?: string | number;
    /** default: 24px */
    "--kz-header-overlay-menu-side"?: string | number;
    /** default: clamp(40px, min(10cqw + 12px, calc((100cqh - 230px) / 5.3)), 132px) */
    "--kz-header-overlay-menu-size"?: string | number;
    /** how far the edge bends on the way; 0 = a straight edge — default: 1 */
    "--kz-header-overlay-menu-curve"?: string | number;
    /** how dark the page gets under it — default: 0.5 */
    "--kz-header-overlay-menu-shade"?: string | number;
    /** the page's size once covered — default: 0.94 */
    "--kz-header-overlay-menu-depth"?: string | number;
    /** default: 1s */
    "--kz-header-overlay-menu-duration"?: string | number;
    /** default: cubic-bezier(0.76, 0, 0.24, 1) */
    "--kz-header-overlay-menu-ease"?: string | number;
    /** the page colour while it backs off; auto = the first background above it — default: auto */
    "--kz-header-overlay-page"?: string | number;
  };
  className?: string;
};

export function HeaderOverlay({ vars, className, style, ...rest }: HeaderOverlayProps) {
  const ref = useRef<ComponentRef<'header'>>(null);
  const classes = ["kodza-header-overlay", className].filter(Boolean).join(' ');
  // Everything the markup is made of: when it changes, React gets a fresh element (see the top)
  const key = JSON.stringify([classes, vars, style, rest]);

  // Starts the script on this element once React has rendered it, stops it when it goes
  useEffect(() => {
    const root = ref.current;
    let live = true;
    // @ts-ignore: a plain script, no types to find
    import('./header-overlay.js').then(() => {
      if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
    });
    return () => {
      live = false;
      document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
    };
  }, [key]);

  return (
    <header key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <div className="kodza-header-overlay__bar">
        <span className="kodza-header-overlay__veil" aria-hidden="true" />
        {' '}
        <span className="kodza-header-overlay__blind" aria-hidden="true">
          <span className="kodza-header-overlay__fill" />
        </span>
        <div className="kodza-header-overlay__row">
          <a className="kodza-header-overlay__logo" href="#" aria-label="Quayside, home">
            <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true">
              <path fillRule="evenodd" d="M2 23V12a10 10 0 0 1 20 0v11zM7.5 23v-10a4.5 4.5 0 0 1 9 0v10z" />
            </svg>
            <span>Quayside</span>
          </a>
          <nav className="kodza-header-overlay__menu" aria-label="Main">
            <ul className="kodza-header-overlay__links">
              <li>
                <a className="kodza-header-overlay__item" href="#">Rooms</a>
              </li>
              <li>
                <a className="kodza-header-overlay__item" href="#">Dining</a>
              </li>
              <li>
                <a className="kodza-header-overlay__item" href="#">The House</a>
              </li>
              <li>
                <a className="kodza-header-overlay__item" href="#">Journal</a>
              </li>
            </ul>
          </nav>
          <div className="kodza-header-overlay__end">
            <a className="kodza-header-overlay__cta" href="#">Book a room</a>
            {' '}
            <button className="kodza-header-overlay__toggle" type="button" aria-haspopup="dialog" aria-expanded="false"><span className="kodza-header-overlay__lines" aria-hidden="true" />Menu</button>
          </div>
        </div>
      </div>
      <div className="kodza-header-overlay__panel" role="dialog" aria-modal="true" aria-label="Menu" tabIndex={-1} hidden>
        <span className="kodza-header-overlay__shade" aria-hidden="true" />
        {' '}
        <span className="kodza-header-overlay__curtain" aria-hidden="true">
          <svg className="kodza-header-overlay__edge" viewBox="0 0 100 100" preserveAspectRatio="none" focusable="false">
            <path d="M0 0Q50 200 100 0Z" />
          </svg>
        </span>
        <div className="kodza-header-overlay__body">
          <div className="kodza-header-overlay__head">
            <p className="kodza-header-overlay__label">Twelve rooms on the quay.</p>
            <button className="kodza-header-overlay__close" type="button">
              <span className="kodza-header-overlay__cross" aria-hidden="true" />
              <span className="kodza-header-overlay__say">
                <span>Close</span>
              </span>
            </button>
          </div>
          <div className="kodza-header-overlay__stage">
            <nav className="kodza-header-overlay__nav" aria-label="Main" />
            <div className="kodza-header-overlay__info">
              <div className="kodza-header-overlay__group">
                <p className="kodza-header-overlay__small">Book a room</p>
                <p>
                  <a href="#">stay@example.com</a>
                </p>
              </div>
              <div className="kodza-header-overlay__group">
                <p className="kodza-header-overlay__small">The house</p>
                <p>
                  <span className="kodza-header-overlay__line">Quai de Southampton</span>
                  <span className="kodza-header-overlay__line">Le Havre</span>
                </p>
              </div>
              <div className="kodza-header-overlay__group">
                <p className="kodza-header-overlay__small">Elsewhere</p>
                <p className="kodza-header-overlay__socials">
                  <a href="#">Instagram</a>
                  <a href="#">Maps</a>
                </p>
              </div>
              <p className="kodza-header-overlay__small">Esc closes it. So does Close.</p>
            </div>
          </div>
        </div>
      </div>
    </header>
  );
}
```

- Where it goes, step by step. (1) Right before the hero: it takes no height, so the hero starts at the very top under it. (2) The hero is what comes after it; if that's not your photo, name it with data-hero=".your-hero" on the header. (3) Mark the wrapper of your page with data-header-overlay-page so it backs off under the curtain on phones. (4) A light photo needs a darker --kz-header-overlay-veil, or the white text won't read.

## Code

```html
<header class="kodza-header-overlay">
  <div class="kodza-header-overlay__bar">
    <span class="kodza-header-overlay__veil" aria-hidden="true"></span>
    <span class="kodza-header-overlay__blind" aria-hidden="true"><span class="kodza-header-overlay__fill"></span></span>
    <div class="kodza-header-overlay__row">
      <a class="kodza-header-overlay__logo" href="#" aria-label="Quayside, home"><svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path fill-rule="evenodd" d="M2 23V12a10 10 0 0 1 20 0v11zM7.5 23v-10a4.5 4.5 0 0 1 9 0v10z"/></svg><span>Quayside</span></a>
      <nav class="kodza-header-overlay__menu" aria-label="Main">
        <ul class="kodza-header-overlay__links">
          <li><a class="kodza-header-overlay__item" href="#">Rooms</a></li>
          <li><a class="kodza-header-overlay__item" href="#">Dining</a></li>
          <li><a class="kodza-header-overlay__item" href="#">The House</a></li>
          <li><a class="kodza-header-overlay__item" href="#">Journal</a></li>
        </ul>
      </nav>
      <div class="kodza-header-overlay__end">
        <a class="kodza-header-overlay__cta" href="#">Book a room</a>
        <button class="kodza-header-overlay__toggle" type="button" aria-haspopup="dialog" aria-expanded="false"><span class="kodza-header-overlay__lines" aria-hidden="true"></span>Menu</button>
      </div>
    </div>
  </div>
  <div class="kodza-header-overlay__panel" role="dialog" aria-modal="true" aria-label="Menu" tabindex="-1" hidden>
    <span class="kodza-header-overlay__shade" aria-hidden="true"></span>
    <span class="kodza-header-overlay__curtain" aria-hidden="true"><svg class="kodza-header-overlay__edge" viewBox="0 0 100 100" preserveAspectRatio="none" focusable="false"><path d="M0 0Q50 200 100 0Z"/></svg></span>
    <div class="kodza-header-overlay__body">
      <div class="kodza-header-overlay__head">
        <p class="kodza-header-overlay__label">Twelve rooms on the quay.</p>
        <button class="kodza-header-overlay__close" type="button"><span class="kodza-header-overlay__cross" aria-hidden="true"></span><span class="kodza-header-overlay__say"><span>Close</span></span></button>
      </div>
      <div class="kodza-header-overlay__stage">
        <nav class="kodza-header-overlay__nav" aria-label="Main"></nav>
        <div class="kodza-header-overlay__info">
          <div class="kodza-header-overlay__group">
            <p class="kodza-header-overlay__small">Book a room</p>
            <p><a href="#">stay@example.com</a></p>
          </div>
          <div class="kodza-header-overlay__group">
            <p class="kodza-header-overlay__small">The house</p>
            <p><span class="kodza-header-overlay__line">Quai de Southampton</span><span class="kodza-header-overlay__line">Le Havre</span></p>
          </div>
          <div class="kodza-header-overlay__group">
            <p class="kodza-header-overlay__small">Elsewhere</p>
            <p class="kodza-header-overlay__socials"><a href="#">Instagram</a><a href="#">Maps</a></p>
          </div>
          <p class="kodza-header-overlay__small">Esc closes it. So does Close.</p>
        </div>
      </div>
    </div>
  </div>
</header>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Header Overlay
   The header that sits on your hero photo: white, no background. When the hero goes, a solid
   bar comes down from the top like a blind, and the text turns to ink along its edge: an ink
   copy of the row is cut to the blind's shape, so nothing ever changes colour at once. Scroll
   back to the hero and it all rolls away. Below 900 px the links give way to a Menu button and
   a full-screen curtain (Fullscreen Menu), written from the same links.
   Put it right before the hero; the hero is found on its own, or name it with
   data-hero="…". Mark the wrapper of your site with data-header-overlay-page, or name it with
   data-page="…" (the wrapper of most WordPress themes is found on its own).
   Everything is tuned with the --kz-header-overlay-* variables (--kz-header-overlay-menu-* for
   the curtain). */
.kodza-header-overlay {
  /* Over the hero */
  --kz-header-overlay-fg: #ffffff;
  --kz-header-overlay-muted: rgba(255, 255, 255, 0.78);
  --kz-header-overlay-soft: rgba(255, 255, 255, 0.16); /* the Menu button */
  --kz-header-overlay-cta-bg: #ffffff;
  --kz-header-overlay-cta-fg: #0a0a0a;
  --kz-header-overlay-veil: rgba(0, 0, 0, 0.32); /* a shade at the top of the photo, so white reads */
  /* Once the hero is gone */
  --kz-header-overlay-solid-bg: #f2f2f0;
  --kz-header-overlay-solid-fg: #0a0a0a;
  --kz-header-overlay-solid-muted: rgba(10, 10, 10, 0.62);
  --kz-header-overlay-solid-soft: rgba(10, 10, 10, 0.06);
  --kz-header-overlay-solid-rule: rgba(10, 10, 10, 0.1);
  --kz-header-overlay-solid-cta-bg: #0a0a0a;
  --kz-header-overlay-solid-cta-fg: #ffffff;
  --kz-header-overlay-top: var(--wp-admin--admin-bar--height, 0px); /* below the WordPress admin bar */
  --kz-header-overlay-height: 76px;
  --kz-header-overlay-width: 1200px; /* the row, centred */
  --kz-header-overlay-pad: 24px;
  --kz-header-overlay-duration: 0.7s; /* the blind */
  --kz-header-overlay-ease: cubic-bezier(0.33, 1, 0.68, 1); /* off at once: it answers the scroll */
  /* The curtain, below 900 px */
  --kz-header-overlay-menu-bg: #0a0a0a;
  --kz-header-overlay-menu-fg: #f2f2f0;
  --kz-header-overlay-menu-muted: rgba(242, 242, 240, 0.62);
  --kz-header-overlay-menu-top: calc(var(--wp-admin--admin-bar--height, 0px) + 18px); /* Close lands on Menu on its own; this is where it goes if Menu is somewhere else */
  --kz-header-overlay-menu-side: 24px;
  --kz-header-overlay-menu-size: clamp(40px, min(10cqw + 12px, calc((100cqh - 230px) / 5.3)), 132px);
  --kz-header-overlay-menu-curve: 1; /* how far the edge bends on the way; 0 = a straight edge */
  --kz-header-overlay-menu-shade: 0.5; /* how dark the page gets under it */
  --kz-header-overlay-menu-depth: 0.94; /* the page's size once covered */
  --kz-header-overlay-menu-duration: 1s;
  --kz-header-overlay-menu-ease: cubic-bezier(0.76, 0, 0.24, 1);
  --kz-header-overlay-page: auto; /* the page colour while it backs off; auto = the first background above it */

  /* It takes no room: the hero starts right under it, at the top of the page */
  position: sticky;
  top: var(--kz-header-overlay-top);
  z-index: 50;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
  container-type: inline-size;
}

.kodza-header-overlay__bar {
  position: relative;
  display: block;
  height: var(--kz-header-overlay-height);
  margin: 0;
  padding: 0;
}

/* A shade at the top of the photo, gone with the blind */
.kodza-header-overlay__veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: block;
  height: calc(var(--kz-header-overlay-height) * 1.8);
  background: linear-gradient(var(--kz-header-overlay-veil), transparent);
  pointer-events: none;
  transition: opacity var(--kz-header-overlay-duration) var(--kz-header-overlay-ease);
}

/* The blind: a solid bar that slides down from the top, its hairline on its edge */
.kodza-header-overlay__blind {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.kodza-header-overlay__fill {
  position: absolute;
  inset: 0;
  display: block;
  background: var(--kz-header-overlay-solid-bg);
  box-shadow: inset 0 -1px 0 var(--kz-header-overlay-solid-rule);
  transform: translateY(-100%);
  transition: transform var(--kz-header-overlay-duration) var(--kz-header-overlay-ease);
}

/* The row, and its ink copy (written by the script) on top of it. The copy shows above the
   blind's edge, the row below it: both clips move with the blind, on the same clock */
.kodza-header-overlay__row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  max-width: var(--kz-header-overlay-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--kz-header-overlay-pad);
  color: var(--kz-header-overlay-fg);
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--kz-header-overlay-duration) var(--kz-header-overlay-ease);
}

.kodza-header-overlay__row--ink {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

.kodza-header-overlay__row--ink,
.kodza-header-overlay.is-solid .kodza-header-overlay__row {
  --kz-header-overlay-fg: var(--kz-header-overlay-solid-fg);
  --kz-header-overlay-muted: var(--kz-header-overlay-solid-muted);
  --kz-header-overlay-soft: var(--kz-header-overlay-solid-soft);
  --kz-header-overlay-cta-bg: var(--kz-header-overlay-solid-cta-bg);
  --kz-header-overlay-cta-fg: var(--kz-header-overlay-solid-cta-fg);
}

/* Past the hero: the blind is down, the copy shows whole, the white row is cut away */
.kodza-header-overlay.is-down .kodza-header-overlay__fill {
  transform: translateY(0%);
}

.kodza-header-overlay.is-down .kodza-header-overlay__veil {
  opacity: 0;
}

.kodza-header-overlay.is-down .kodza-header-overlay__row {
  clip-path: inset(100% 0 0 0);
}

.kodza-header-overlay.is-down .kodza-header-overlay__row--ink {
  clip-path: inset(0 0 0 0);
}

/* Once it has landed, the row itself takes the ink (the copy can't be pointed at or focused) */
.kodza-header-overlay.is-solid .kodza-header-overlay__row {
  clip-path: inset(0 0 0 0);
}

.kodza-header-overlay.is-solid .kodza-header-overlay__row--ink {
  visibility: hidden;
}

/* Swapped in one frame, with nothing easing */
.kodza-header-overlay.is-swap .kodza-header-overlay__bar *,
.kodza-header-overlay.is-swap .kodza-header-overlay__bar *::before,
.kodza-header-overlay.is-swap .kodza-header-overlay__bar *::after {
  transition: none;
}

.kodza-header-overlay__logo {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  height: 40px;
  margin: 0;
  border-radius: 6px;
  color: var(--kz-header-overlay-fg);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.kodza-header-overlay__logo svg {
  display: block;
  flex: none;
  fill: currentColor;
}

.kodza-header-overlay__logo:focus-visible {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

.kodza-header-overlay__menu {
  display: block;
  margin: 0;
  padding: 0;
}

.kodza-header-overlay__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kodza-header-overlay__links > li {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A line draws itself under the link pointed at, from the left, and leaves to the right */
.kodza-header-overlay__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--kz-header-overlay-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.kodza-header-overlay__item::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 9px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.kodza-header-overlay__item[aria-current="page"],
.kodza-header-overlay__item:focus-visible {
  color: var(--kz-header-overlay-fg);
}

.kodza-header-overlay__item:focus-visible {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

@media (hover: hover) {
  .kodza-header-overlay__item:hover {
    color: var(--kz-header-overlay-fg);
  }

  .kodza-header-overlay__item:hover::after {
    transform: scaleX(1);
    transform-origin: 0% 50%;
  }
}

.kodza-header-overlay__item[aria-current="page"]::after {
  transform: scaleX(1);
}

.kodza-header-overlay__end {
  display: flex;
  grid-column: 3;
  align-items: center;
  justify-self: end;
  gap: 8px;
  margin: 0;
}

.kodza-header-overlay__cta {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--kz-header-overlay-cta-bg);
  color: var(--kz-header-overlay-cta-fg);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s;
}

@media (hover: hover) {
  .kodza-header-overlay__cta:hover {
    background: color-mix(in srgb, var(--kz-header-overlay-cta-bg) 86%, transparent);
  }
}

.kodza-header-overlay__cta:focus-visible {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

/* The Menu button, and Close on the curtain */
.kodza-header-overlay__toggle,
.kodza-header-overlay__close {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.kodza-header-overlay__toggle {
  background: var(--kz-header-overlay-soft);
  color: var(--kz-header-overlay-fg);
}

.kodza-header-overlay__close {
  background: var(--kz-header-overlay-menu-fg);
  color: var(--kz-header-overlay-menu-bg);
}

.kodza-header-overlay__toggle:focus-visible {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 3px;
}

.kodza-header-overlay__close:focus-visible,
.kodza-header-overlay__info a:focus-visible {
  outline: 2px solid var(--kz-header-overlay-menu-fg);
  outline-offset: 4px;
}

/* A link's focus is drawn on its word, so it rises with it instead of waiting there as an empty box */
.kodza-header-overlay__link:focus-visible {
  outline: none;
}

.kodza-header-overlay__link:focus-visible .kodza-header-overlay__word {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

/* Two lines on the button: they meet and cross as the curtain comes, and Close takes them
   over crossed, in the same place */
.kodza-header-overlay__lines,
.kodza-header-overlay__cross {
  position: relative;
  flex: none;
  width: 14px;
  height: 8px;
}

.kodza-header-overlay__lines::before,
.kodza-header-overlay__lines::after,
.kodza-header-overlay__cross::before,
.kodza-header-overlay__cross::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  /* On its own layer: drawn the same way at rest and while turning, so no snap at the end */
  will-change: transform;
}

.kodza-header-overlay__lines::before,
.kodza-header-overlay__cross::before {
  top: 0;
}

.kodza-header-overlay__lines::after,
.kodza-header-overlay__cross::after {
  top: 6px; /* whole pixels: both lines sit on the pixel grid the same way */
}

/* The script turns them on the same clock as the curtain: when its edge goes over the button,
   Close shows the lines exactly as they were, and closing plays it backwards */
.kodza-header-overlay__lines::before,
.kodza-header-overlay__lines::after {
  transition: clip-path 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Whole at rest, as an inset: the pointer slides it to a shorter one (from none it would jump) */
.kodza-header-overlay__lines::after {
  clip-path: inset(0 0 0 0);
}

.kodza-header-overlay__toggle:hover .kodza-header-overlay__lines::after {
  clip-path: inset(0 45% 0 0);
}

.kodza-header-overlay__toggle[aria-expanded="true"] .kodza-header-overlay__lines::after {
  clip-path: inset(0 0 0 0);
}

.kodza-header-overlay__cross::before {
  translate: 0 3px;
  rotate: 45deg;
}

.kodza-header-overlay__cross::after {
  translate: 0 -3px;
  rotate: -45deg;
}

/* The word rolls in from below its mask */
.kodza-header-overlay__say {
  display: grid;
  margin: -3px 0;
  padding: 3px 0;
  overflow: hidden;
}

.kodza-header-overlay__say > span {
  display: block;
}

/* The menu: over the whole screen, on top of everything while it is open */
.kodza-header-overlay__panel {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: var(--kz-header-overlay-menu-fg);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
  container-type: size;
  -webkit-font-smoothing: antialiased;
}

.kodza-header-overlay__panel[hidden] {
  display: none;
}

.kodza-header-overlay__panel:focus {
  outline: none;
}

.kodza-header-overlay__shade,
.kodza-header-overlay__curtain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.kodza-header-overlay__shade {
  background: rgba(0, 0, 0, var(--kz-header-overlay-menu-shade));
  /* Around the page once it has backed off: darker than the page, so its edge reads */
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.82);
}

.kodza-header-overlay__curtain {
  background: var(--kz-header-overlay-menu-bg);
}

/* The bend under the curtain: as deep as the curtain is fast, flat once it lands */
.kodza-header-overlay__edge {
  position: absolute;
  top: 100%;
  left: 0;
  display: block;
  width: 100%;
  height: calc(var(--kz-header-overlay-menu-curve) * min(22cqh, 32cqw, 200px)); /* a phone gets a gentler bend */
  margin-top: -1px;
  overflow: visible;
  fill: var(--kz-header-overlay-menu-bg);
  transform: scaleY(0);
  transform-origin: top;
}

/* What the curtain carries: it scrolls on its own on a short screen */
.kodza-header-overlay__body {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden auto;
  overscroll-behavior: contain;
}

.kodza-header-overlay__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--kz-header-overlay-menu-top) var(--kz-header-overlay-menu-side) 0;
}

.kodza-header-overlay__label,
.kodza-header-overlay__index,
.kodza-header-overlay__small {
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--kz-header-overlay-menu-muted);
}

.kodza-header-overlay__label {
  margin: 0;
}

/* The links, big, at the bottom left; the contact column at the bottom right */
.kodza-header-overlay__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 21cqw, 280px);
  align-items: end;
  gap: 32px clamp(32px, 6cqw, 96px);
  padding: 32px var(--kz-header-overlay-menu-side) clamp(20px, 4cqh, 36px);
}

.kodza-header-overlay__nav {
  display: grid;
  justify-items: start;
}

.kodza-header-overlay__link {
  display: grid;
  grid-template-columns: max-content auto;
  align-items: start;
  column-gap: calc(var(--kz-header-overlay-menu-size) * 0.1);
  color: inherit;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* The mask has the size of its word, so its room for descenders (g, j, p, q, y) is measured
   on the word */
.kodza-header-overlay__mask {
  display: block;
  margin: -0.06em 0 -0.22em;
  padding: 0.06em 0 0.22em;
  overflow: hidden;
  font-size: var(--kz-header-overlay-menu-size);
}

.kodza-header-overlay__word {
  display: block;
  font-size: var(--kz-header-overlay-menu-size);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.kodza-header-overlay__index {
  padding-top: calc(var(--kz-header-overlay-menu-size) * 0.1);
  transition: color 0.25s;
}

/* Pointed at: the other links step back, its number lights up */
.kodza-header-overlay__nav:hover .kodza-header-overlay__link:not(:hover),
.kodza-header-overlay__nav:has(.kodza-header-overlay__link:focus-visible) .kodza-header-overlay__link:not(:focus-visible) {
  opacity: 0.35;
}

.kodza-header-overlay__link:hover .kodza-header-overlay__index,
.kodza-header-overlay__link:focus-visible .kodza-header-overlay__index {
  color: var(--kz-header-overlay-menu-fg);
}

.kodza-header-overlay__info {
  display: grid;
  gap: 22px;
  padding-bottom: calc(var(--kz-header-overlay-menu-size) * 0.08);
}

.kodza-header-overlay__info p {
  margin: 0;
  text-wrap: pretty;
}

.kodza-header-overlay__group {
  display: grid;
  gap: 6px;
}

/* One line of an address */
.kodza-header-overlay__line {
  display: block;
}

.kodza-header-overlay__info a {
  color: var(--kz-header-overlay-menu-fg);
  text-decoration: none;
  border-radius: 2px;
}

.kodza-header-overlay__info a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.kodza-header-overlay__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* A phone: the links, then the contact column under them */
@container (max-width: 720px) {
  .kodza-header-overlay__stage {
    grid-template-columns: minmax(0, 1fr);
    align-content: end;
    gap: 40px;
  }

  .kodza-header-overlay__info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 16px;
    padding-bottom: 0;
  }
}

/* Under 900 px the links give way to the Menu button; under 520 px the call to action waits in
   the curtain */
@container (max-width: 899px) {
  .kodza-header-overlay__menu {
    display: none;
  }
}

@container (min-width: 900px) {
  .kodza-header-overlay__toggle {
    display: none;
  }
}

@container (max-width: 519px) {
  .kodza-header-overlay__row {
    padding: 0 16px;
  }

  .kodza-header-overlay__cta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kodza-header-overlay__veil,
  .kodza-header-overlay__fill,
  .kodza-header-overlay__row,
  .kodza-header-overlay__item,
  .kodza-header-overlay__item::after,
  .kodza-header-overlay__cta,
  .kodza-header-overlay__toggle *,
  .kodza-header-overlay__toggle *::before,
  .kodza-header-overlay__toggle *::after,
  .kodza-header-overlay__link,
  .kodza-header-overlay__index {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* kodza-guard f863eb59fa9f — generated by Kodza, do not edit.
   Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
   component. :not(#_) is always true and weighs as much as an id, so these lines win over
   theme rules made of classes and tags. Customise the component through its --kz-* variables. */

/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */

:where(.kodza-header-overlay__logo):not(#_),
:where(.kodza-header-overlay__toggle):not(#_) {
  outline: revert;
  transition: revert;
  outline-offset: revert;
}

:where(.kodza-header-overlay__menu):not(#_),
:where(.kodza-header-overlay__links):not(#_),
:where(.kodza-header-overlay__logo svg:where(:not([class*="kodza-"]))):not(#_),
:where(.kodza-header-overlay__links li:where(:not([class*="kodza-"]):not(.kodza-header-overlay__links [class*="kodza-"] *))):not(#_) {
  transition: revert;
}

:where(.kodza-header-overlay__item):not(#_),
:where(.kodza-header-overlay__cta):not(#_),
:where(.kodza-header-overlay__close):not(#_) {
  outline: revert;
  outline-offset: revert;
}

:where(.kodza-header-overlay__panel):not(#_),
:where(.kodza-header-overlay__link):not(#_) {
  outline: revert;
}

:where(.kodza-header-overlay__group a:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *))):not(#_),
:where(.kodza-header-overlay__socials a:where(:not([class*="kodza-"]))):not(#_) {
  outline: revert;
  outline-offset: revert;
  text-underline-offset: revert;
}

/* What the browser gives, on everything the component leaves to it */

.kodza-header-overlay:not(#_) {
  border: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-weight: revert;
  font-style: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__bar:not(#_),
.kodza-header-overlay__veil:not(#_),
.kodza-header-overlay__blind:not(#_),
.kodza-header-overlay__fill:not(#_),
.kodza-header-overlay__end:not(#_),
.kodza-header-overlay__lines:not(#_),
.kodza-header-overlay__shade:not(#_),
.kodza-header-overlay__curtain:not(#_),
.kodza-header-overlay__body:not(#_),
.kodza-header-overlay__head:not(#_),
.kodza-header-overlay__cross:not(#_),
.kodza-header-overlay__say:not(#_),
.kodza-header-overlay__stage:not(#_),
.kodza-header-overlay__mask:not(#_),
.kodza-header-overlay__word:not(#_),
.kodza-header-overlay__index:not(#_),
.kodza-header-overlay__info:not(#_),
.kodza-header-overlay__group:not(#_),
.kodza-header-overlay__line:not(#_),
.kodza-header-overlay__logo span:where(:not([class*="kodza-"])):not(#_),
.kodza-header-overlay__say span:where(:not([class*="kodza-"])):not(#_) {
  box-sizing: revert;
}

.kodza-header-overlay__logo:not(#_) {
  border: revert;
  padding: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-style: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__menu:not(#_) {
  border: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__links:not(#_),
.kodza-header-overlay__links li:where(:not([class*="kodza-"]):not(.kodza-header-overlay__links [class*="kodza-"] *)):not(#_) {
  border: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__item:not(#_) {
  border: revert;
  list-style: revert;
  float: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-style: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__cta:not(#_) {
  border: revert;
  list-style: revert;
  float: revert;
  position: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-style: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__toggle:not(#_) {
  text-decoration: revert;
  list-style: revert;
  float: revert;
  position: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  min-height: revert;
}

.kodza-header-overlay__panel:not(#_) {
  box-shadow: revert;
  outline-offset: revert;
}

.kodza-header-overlay__edge:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  margin-right: revert;
  margin-bottom: revert;
  margin-left: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__label:not(#_),
.kodza-header-overlay__small:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-style: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__close:not(#_) {
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  float: revert;
  position: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  min-height: revert;
}

.kodza-header-overlay__nav:not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__link:not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__socials:not(#_),
.kodza-header-overlay__group p:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__logo svg:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__group a:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_),
.kodza-header-overlay__socials a:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-header-overlay__label:not(#_):where(:not([hidden])),
.kodza-header-overlay__small:not(#_):where(:not([hidden])),
.kodza-header-overlay__group p:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_):where(:not([hidden])),
.kodza-header-overlay__group a:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_):where(:not([hidden])),
.kodza-header-overlay__socials a:where(:not([class*="kodza-"])):not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-header-overlay__label:not(#_):where([hidden]),
.kodza-header-overlay__small:not(#_):where([hidden]),
.kodza-header-overlay__group p:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_):where([hidden]),
.kodza-header-overlay__group a:where(:not([class*="kodza-"]):not(.kodza-header-overlay__group [class*="kodza-"] *)):not(#_):where([hidden]),
.kodza-header-overlay__socials a:where(:not([class*="kodza-"])):not(#_):where([hidden]) {
  display: none;
}

.kodza-header-overlay__item:not(#_)::after,
.kodza-header-overlay__lines:not(#_)::before,
.kodza-header-overlay__lines:not(#_)::after,
.kodza-header-overlay__cross:not(#_)::before,
.kodza-header-overlay__cross:not(#_)::after {
  box-sizing: revert;
}

/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */

.kodza-header-overlay:not(#_) {
  position: sticky;
  display: block;
  box-sizing: border-box;
  padding: 0;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
}

.kodza-header-overlay.is-swap .kodza-header-overlay__bar *:not(#_),
.kodza-header-overlay.is-swap .kodza-header-overlay__bar *:not(#_)::before,
.kodza-header-overlay.is-swap .kodza-header-overlay__bar *:not(#_)::after {
  transition: none;
}

.kodza-header-overlay__logo:not(#_) {
  display: inline-flex;
  margin: 0;
  border-radius: 6px;
  color: var(--kz-header-overlay-fg);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.kodza-header-overlay__logo svg:not(#_) {
  display: block;
}

.kodza-header-overlay__logo:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

.kodza-header-overlay__menu:not(#_) {
  display: block;
  margin: 0;
  padding: 0;
}

.kodza-header-overlay__links:not(#_) {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kodza-header-overlay__links > li:not(#_) {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kodza-header-overlay__item:not(#_) {
  position: relative;
  display: inline-flex;
  box-sizing: border-box;
  margin: 0;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--kz-header-overlay-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: color 0.2s;
}

.kodza-header-overlay__item[aria-current="page"]:not(#_),
.kodza-header-overlay__item:focus-visible:not(#_) {
  color: var(--kz-header-overlay-fg);
}

.kodza-header-overlay__item:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

@media (hover: hover) {
  .kodza-header-overlay__item:hover:not(#_) {
    color: var(--kz-header-overlay-fg);
  }
}

.kodza-header-overlay__cta:not(#_) {
  display: inline-flex;
  box-sizing: border-box;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--kz-header-overlay-cta-bg);
  color: var(--kz-header-overlay-cta-fg);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.2s;
}

@media (hover: hover) {
  .kodza-header-overlay__cta:hover:not(#_) {
    background: color-mix(in srgb, var(--kz-header-overlay-cta-bg) 86%, transparent);
  }
}

.kodza-header-overlay__cta:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 2px;
}

.kodza-header-overlay__toggle:not(#_),
.kodza-header-overlay__close:not(#_) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.kodza-header-overlay__toggle:not(#_) {
  background: var(--kz-header-overlay-soft);
  color: var(--kz-header-overlay-fg);
}

.kodza-header-overlay__close:not(#_) {
  background: var(--kz-header-overlay-menu-fg);
  color: var(--kz-header-overlay-menu-bg);
}

.kodza-header-overlay__toggle:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-fg);
  outline-offset: 3px;
}

.kodza-header-overlay__close:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-menu-fg);
  outline-offset: 4px;
}

.kodza-header-overlay__info a:focus-visible:not(#_) {
  outline: 2px solid var(--kz-header-overlay-menu-fg);
  outline-offset: 4px;
}

.kodza-header-overlay__link:focus-visible:not(#_) {
  outline: none;
}

.kodza-header-overlay__panel:focus:not(#_) {
  outline: none;
}

.kodza-header-overlay__edge:not(#_) {
  position: absolute;
  display: block;
  margin-top: -1px;
}

.kodza-header-overlay__label:not(#_),
.kodza-header-overlay__small:not(#_) {
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--kz-header-overlay-menu-muted);
}

.kodza-header-overlay__label:not(#_) {
  margin: 0;
}

.kodza-header-overlay__nav:not(#_) {
  display: grid;
}

.kodza-header-overlay__link:not(#_) {
  display: grid;
  color: inherit;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.kodza-header-overlay__info p:not(#_) {
  margin: 0;
}

.kodza-header-overlay__info a:not(#_) {
  color: var(--kz-header-overlay-menu-fg);
  text-decoration: none;
  border-radius: 2px;
}

.kodza-header-overlay__info a:hover:not(#_) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.kodza-header-overlay__socials:not(#_) {
  display: flex;
}

@container (max-width: 899px) {
  .kodza-header-overlay__menu:not(#_) {
    display: none;
  }
}

@container (min-width: 900px) {
  .kodza-header-overlay__toggle:not(#_) {
    display: none;
  }
}

@container (max-width: 519px) {
  .kodza-header-overlay__cta:not(#_) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kodza-header-overlay__item:not(#_),
  .kodza-header-overlay__cta:not(#_),
  .kodza-header-overlay__link:not(#_) {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
```

```js
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Header Overlay
// The header that sits on your hero photo, white with no background. Once the hero has gone
// under it, a solid bar comes down from the top like a blind and the text turns to ink along its
// edge; back on the hero it all rolls away. Below 900 px a Menu button opens a curtain of ink
// (Fullscreen Menu, same engine), its links written from the bar's own.
(() => {
  // The two lines that change from one menu of the family to the next
  const NAME = 'header-overlay';
  const VARS = ['menu-bg', 'menu-fg', 'menu-muted', 'menu-top', 'menu-side', 'menu-size', 'menu-curve', 'menu-shade'];

  // ---------- Menu engine (begin) ----------
  // The same block in every burger menu of the family (Trapdoor, Fullscreen, Side Reveal...),
  // copied as is. .kodza-NAME__toggle opens .kodza-NAME__panel and the menu's opening plays as
  // one timeline, backwards to close, from wherever it is. While open the panel leaves the menu
  // with its variables (VARS), the page stays put (wheel, swipe, keys), Tab stays inside, Escape
  // closes and the focus goes back to the button. A page that takes part (data-NAME-page,
  // data-page="…" on the menu, or a theme's wrapper) takes its fixed elements along and is put
  // back exactly as it was. Each menu only writes how it moves: see `menu`.
  const SELECTOR = `.kodza-${NAME}`;
  const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
  const RISE = 'cubic-bezier(0.22, 1, 0.36, 1)';
  const SWING = 'cubic-bezier(0.65, 0, 0.35, 1)';
  const BACK = 1.6; // closing replays the opening backwards, this much faster
  const FOCUSABLE = 'a[href], button:not([disabled]), input, select, textarea, [tabindex]:not([tabindex="-1"])';
  const taken = new WeakMap(); // page → how to put it back at once (one menu moves a page at a time)

  const transparent = (color) => !color || color === 'transparent' || /^rgba\(.*,\s*0\)$/.test(color);

  // [time, progress] pairs along a cubic-bezier(): when does the edge pass a given row?
  const curve = (easing) => {
    const n = (easing.match(/-?\d*\.?\d+/g) || []).map(Number);
    const [x1, y1, x2, y2] = n.length === 4 ? n : [0.76, 0, 0.24, 1];
    const at = (s, a, b) => 3 * (1 - s) * (1 - s) * s * a + 3 * (1 - s) * s * s * b + s * s * s;
    return Array.from({ length: 101 }, (_, i) => [at(i / 100, x1, x2), at(i / 100, y1, y2)]);
  };

  // A transform makes the page the containing block of its fixed elements: they are found
  // first, then moved back to where they were on screen (see `rideAlong`)
  const fixedInside = (page) => {
    const found = [];
    const walker = document.createTreeWalker(page, NodeFilter.SHOW_ELEMENT, {
      acceptNode: (el) => {
        const style = getComputedStyle(el);
        if (style.display === 'none') return NodeFilter.FILTER_REJECT;
        if (style.position !== 'fixed') return NodeFilter.FILTER_SKIP;
        found.push({ el, box: el.getBoundingClientRect(), shift: style.translate, inline: el.style.translate, attr: el.hasAttribute('style') });
        return NodeFilter.FILTER_REJECT;
      },
    });
    while (walker.nextNode()) {
      // acceptNode collects them
    }
    return found;
  };

  const rideAlong = (fixed, k) => fixed.forEach((item) => {
    const now = item.el.getBoundingClientRect();
    const [x = 0, y = 0] = item.shift === 'none' ? [] : item.shift.split(' ').map(parseFloat);
    item.el.style.translate = `${x + (item.box.left - now.left) / k}px ${y + (item.box.top - now.top) / k}px`;
  });

  const letGo = (fixed) => fixed.forEach(({ el, inline, attr }) => {
    el.style.translate = inline;
    if (!attr && !el.getAttribute('style')) el.removeAttribute('style');
  });

  // Where the page is, in screen pixels: its box, its scale (a scaled parent changes nothing
  // once divided by `k`), and the part of it that is on screen
  const view = (page) => {
    const r = page.getBoundingClientRect();
    const { clientWidth: vw, clientHeight: vh } = document.documentElement;
    return {
      r,
      k: page.offsetWidth ? r.width / page.offsetWidth : 1,
      top: Math.max(r.top, 0),
      bottom: Math.min(r.bottom, vh),
      left: Math.max(r.left, 0),
      right: Math.min(r.right, vw),
    };
  };

  // One menu. `setup(m)` receives its parts (toggle, panel, closer, links, one, all, css, cut, and
  // while open page, reduced) and returns what the menu does itself:
  //   page    'under' when the menu lies under the page that moves, 'over' when it covers the
  //           page that moves under it; without it the page stays as it is
  //   rig(page)     sets the flat page up for the ride, returns its geometry with `k` (its scale);
  //                 again on resize
  //   frames(g)     the page's keyframes, set again on resize
  //   build(add, mode, g)   the opening, add(el, keyframes, delay, duration, easing, options) per
  //                 animation; mode is 'page', 'flat' (no page found) or 'reduced'
  //   ready(), entry(), key(event), resize(), reset()   optional: before it opens, where the
  //                 keyboard enters, a key of its own (true once handled), after a resize, once closed
  const menu = (root, signal, setup) => {
    const toggle = root.querySelector(`.kodza-${NAME}__toggle`);
    const panel = root.querySelector(`.kodza-${NAME}__panel`);
    if (!toggle || !panel) return;
    const one = (s) => panel.querySelector(s);
    const all = (s) => [...panel.querySelectorAll(s)];
    const closer = one(`.kodza-${NAME}__close`);
    const links = all(`.kodza-${NAME}__link`);
    const home = [panel.parentNode, panel.nextSibling];
    const css = (name) => getComputedStyle(root).getPropertyValue(`--kz-${NAME}-${name}`).trim();

    let state = 'closed'; // closed, opening, open, closing
    let sequence = []; // the opening: animations on one clock, so it can run backwards
    let session = null; // what only lives while the menu is open
    let moving = null; // the page taking part, and what it looked like before
    let reduced = false;
    let run = 0;
    let then = null;

    // The page: named on the menu (data-page="…"), or the marked wrapper around it, or else
    // the wrapper of a WordPress theme (block themes, Astra, GeneratePress, Kadence, OceanWP,
    // Blocksy, Divi…). Without one, the menu plays its sequence without the page
    const findPage = () => {
      let el = null;
      try {
        el = root.dataset.page ? document.querySelector(root.dataset.page) : null;
      } catch {
        el = null;
      }
      el = el || root.closest(`[data-${NAME}-page]`) || document.querySelector(`[data-${NAME}-page]`) || root.closest('.wp-site-blocks, #page, #outer-wrap, #main-container, #page-container');
      if (!el || el === document.body || el === document.documentElement) return null;
      // It has to fill the screen (below the WordPress admin bar): otherwise part of the site, a
      // header outside it or the space under a short page, would be left out of the ride
      const r = el.getBoundingClientRect();
      const bar = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--wp-admin--admin-bar--height')) || 0;
      const { clientWidth: vw, clientHeight: vh } = document.documentElement;
      return r.top <= bar + 1 && r.left <= 1 && r.right >= vw - 1 && r.bottom >= vh - 1 ? el : null;
    };

    // The colour under the page's content, so the menu never shows through it
    const ground = (page) => {
      const own = css('page');
      if (own && own !== 'auto') return own;
      for (let el = page.parentElement; el; el = el.parentElement) {
        const color = getComputedStyle(el).backgroundColor;
        if (!transparent(color)) return color;
      }
      return '#ffffff';
    };

    // A flex or grid page shares its height out among its children: for the ride their sizes
    // are held as they are, so a shorter page box changes nothing inside
    const hold = (page, style) => {
      if (style.display.includes('grid')) {
        page.style.gridTemplateRows = style.gridTemplateRows;
        page.style.gridTemplateColumns = style.gridTemplateColumns;
      } else if (style.display.includes('flex')) {
        const column = style.flexDirection.startsWith('column');
        moving.held = [...page.children].map((el) => {
          const own = getComputedStyle(el);
          const item = { el, flex: el.style.flex, attr: el.hasAttribute('style') };
          el.style.flex = `0 0 ${column ? own.height : own.width}`;
          return item;
        });
      }
    };

    const release = () => {
      moving.held.forEach(({ el, flex, attr }) => {
        el.style.flex = flex;
        if (!attr && !el.getAttribute('style')) el.removeAttribute('style');
      });
      moving.held = [];
      Object.assign(moving.page.style, moving.cut);
    };

    // The page's box ends at `at` (its own pixels from its top) for the ride, the space it
    // leaves kept as margin: what moves below it would stretch the scroll area. Checked on the
    // spot: if that moves anything inside, even with the children held, the page is left as it
    // was. Returns where the box ends
    const cut = (at) => {
      const { page } = moving;
      const full = page.offsetHeight;
      if (at >= full) return full;
      const style = getComputedStyle(page);
      const edges = style.boxSizing === 'border-box' ? 0 : ['paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'].reduce((sum, side) => sum + parseFloat(style[side]), 0);
      const margin = parseFloat(style.marginBottom) || 0;
      const boxes = (els) => els.map((el) => el.getBoundingClientRect()).map((r) => [r.top, r.left, r.width, r.height]);
      const kids = [...page.children];
      const before = boxes(kids);
      const shorten = () => {
        page.style.height = `${Math.max(at - edges, 0)}px`;
        page.style.overflowY = 'clip';
        page.style.marginBottom = `${margin + full - at}px`;
        return boxes(kids).some((box, i) => box.some((n, j) => Math.abs(n - before[i][j]) > 0.5));
      };
      let moved = shorten();
      if (moved && /flex|grid/.test(style.display)) {
        release();
        hold(page, style);
        moved = shorten();
      }
      if (moved) release();
      return moved ? full : at;
    };

    const m = {
      root, toggle, panel, closer, links, one, all, css, cut,
      get page() {
        return moving ? moving.page : null;
      },
      get reduced() {
        return reduced;
      },
    };
    const own = setup(m);

    // With the page untransformed: where its fixed elements are, then the menu's own geometry
    const rig = () => {
      letGo(moving.fixed);
      release();
      moving.fixed = fixedInside(moving.page);
      return own.rig(moving.page);
    };

    // The opening, as one timeline. Every animation gets an end delay that makes it as long as
    // the longest, so running them all backwards is the exact reverse, even halfway through.
    const timeline = (mode, g) => {
      const steps = [];
      const add = (el, frames, delay, duration, easing = RISE, extra = {}) => {
        if (el) steps.push([el, frames, { delay, duration, easing, ...extra }]);
      };
      own.build(add, mode, g);
      const total = Math.max(...steps.map(([, , o]) => o.delay + o.duration));
      return steps.map(([el, frames, o]) => el.animate(frames, { ...o, fill: 'both', endDelay: total - o.delay - o.duration }));
    };

    const play = (forward) => {
      const token = ++run;
      sequence.forEach((animation) => {
        animation.updatePlaybackRate(forward ? 1 : -BACK);
        animation.play();
      });
      Promise.all(sequence.map((animation) => animation.finished)).then(() => {
        if (token !== run) return;
        if (forward) state = 'open';
        else land();
      }, () => {});
    };

    // Closed again: the animations, the borrowed styles and the listeners go, the panel goes home
    const land = () => {
      run++;
      sequence.forEach((animation) => animation.cancel());
      panel.getAnimations({ subtree: true }).forEach((animation) => animation.cancel());
      sequence = [];
      session?.abort();
      session = null;
      if (moving) {
        const { page, saved, attr } = moving;
        letGo(moving.fixed);
        release();
        Object.assign(page.style, saved);
        if (!attr && !page.getAttribute('style')) page.removeAttribute('style');
        if (taken.get(page) === land) taken.delete(page);
        moving = null;
      }
      try {
        if (panel.popover && panel.matches(':popover-open')) panel.hidePopover();
      } catch {
        // no popover support: it was a plain fixed layer
      }
      panel.removeAttribute('popover');
      panel.removeAttribute('style');
      panel.hidden = true;
      if (panel.parentNode !== home[0]) home[0].insertBefore(panel, home[1]?.parentNode === home[0] ? home[1] : null);
      own.reset?.();
      state = 'closed';
      const next = then;
      then = null;
      next?.();
    };

    // While open the page stays put: a wheel or a swipe only scrolls what scrolls in the menu
    const scrollsInside = (target, x, y, dy) => {
      for (let el = target; el instanceof Element && panel.contains(el); el = el.parentElement) {
        const box = el.getBoundingClientRect();
        if (x < box.left || x > box.right || y < box.top || y > box.bottom) continue;
        if (!/(auto|scroll)/.test(getComputedStyle(el).overflowY) || el.scrollHeight <= el.clientHeight + 1) continue;
        if (dy > 0 ? el.scrollTop + el.clientHeight < el.scrollHeight - 1 : el.scrollTop > 0) return true;
      }
      return false;
    };

    // The links you can reach now (a menu with levels hides the others)
    const rows = () => links.filter((link) => link.getClientRects().length && !link.closest('[inert]'));

    const keydown = (event) => {
      if (state === 'closing' || event.defaultPrevented) return;
      if (own.key?.(event)) return;
      if (event.key === 'Escape') {
        event.preventDefault();
        shut();
        return;
      }
      const current = document.activeElement;
      if (event.key === 'Tab') {
        const stops = all(FOCUSABLE).filter((el) => el.getClientRects().length && !el.closest('[inert]'));
        const first = stops[0];
        const last = stops[stops.length - 1];
        const outside = !panel.contains(current) || current === panel;
        if (outside || (event.shiftKey && current === first) || (!event.shiftKey && current === last)) {
          event.preventDefault();
          (event.shiftKey ? last : first)?.focus();
        }
        return;
      }
      const list = rows();
      const i = list.indexOf(current);
      if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
        event.preventDefault();
        const step = event.key === 'ArrowDown' ? 1 : -1;
        list[i < 0 ? (step > 0 ? 0 : list.length - 1) : (i + step + list.length) % list.length]?.focus();
      } else if (event.key === 'Home' || event.key === 'End') {
        event.preventDefault();
        list[event.key === 'Home' ? 0 : list.length - 1]?.focus();
      } else if ([' ', 'PageUp', 'PageDown'].includes(event.key) && !current?.closest?.('button, input, select, textarea')) {
        event.preventDefault();
      }
    };

    const listen = (s) => {
      let last = 0;
      const at = [scrollX, scrollY];
      document.addEventListener('wheel', (event) => {
        if (!scrollsInside(event.target, event.clientX, event.clientY, event.deltaY)) event.preventDefault();
      }, { passive: false, signal: s });
      document.addEventListener('touchstart', (event) => (last = event.touches[0].clientY), { passive: true, signal: s });
      document.addEventListener('touchmove', (event) => {
        const touch = event.touches[0];
        const dy = last - touch.clientY;
        last = touch.clientY;
        if (!scrollsInside(event.target, touch.clientX, touch.clientY, dy)) event.preventDefault();
      }, { passive: false, signal: s });
      document.addEventListener('keydown', keydown, { signal: s });
      // A scrollbar dragged anyway: the page goes back to where it was
      window.addEventListener('scroll', () => {
        if (scrollX !== at[0] || scrollY !== at[1]) window.scrollTo({ left: at[0], top: at[1], behavior: 'instant' });
      }, { signal: s });
      let queued = 0;
      window.addEventListener('resize', () => {
        if (queued) return;
        queued = requestAnimationFrame(() => {
          queued = 0;
          if (s.aborted) return;
          if (moving) {
            const effect = sequence.find((animation) => animation.effect.target === moving.page)?.effect;
            effect?.setKeyframes([]);
            const g = rig();
            effect?.setKeyframes(own.frames(g));
            rideAlong(moving.fixed, g.k);
          }
          own.resize?.();
        });
      }, { signal: s });
      s.addEventListener('abort', () => cancelAnimationFrame(queued));
      // A click on the page that moved aside brings it back
      moving?.page.addEventListener('click', (event) => {
        if (state === 'closing') return;
        event.preventDefault();
        event.stopPropagation();
        shut();
      }, { capture: true, signal: s });
    };

    const enter = (keyboard) => {
      const target = keyboard ? own.entry?.() || links.find((link) => link.getAttribute('aria-current')) || rows()[0] || closer : panel;
      target?.focus({ preventScroll: true });
    };

    const open = (keyboard) => {
      if (state === 'opening' || state === 'open') return;
      toggle.setAttribute('aria-expanded', 'true');
      if (state === 'closing') {
        state = 'opening';
        then = null;
        panel.style.pointerEvents = '';
        play(true);
        enter(keyboard);
        return;
      }
      reduced = motion.matches;
      const page = reduced || !own.page ? null : findPage();
      const under = page && own.page === 'under';
      let g = null;
      if (page) {
        taken.get(page)?.();
        const { transformOrigin, backgroundColor, position, zIndex, height, overflowY, marginBottom, gridTemplateRows, gridTemplateColumns } = page.style;
        moving = { page, saved: { transformOrigin, backgroundColor, position, zIndex }, cut: { height, overflowY, marginBottom, gridTemplateRows, gridTemplateColumns }, attr: page.hasAttribute('style'), fixed: [], held: [] };
        taken.set(page, land);
        g = rig();
        const shown = getComputedStyle(page);
        if (transparent(shown.backgroundColor)) page.style.backgroundColor = ground(page);
        // Under the page: page over panel over the rest of the theme (a header, a sticky bar),
        // under the admin bar
        const still = shown.position === 'static';
        if (under && (!still || ['top', 'right', 'bottom', 'left'].every((side) => shown[side] === 'auto'))) {
          if (still) page.style.position = 'relative';
          page.style.zIndex = '99991';
          panel.style.zIndex = '99990';
        }
      }
      // The panel leaves the menu while open, so the styles of a theme's content (links,
      // paragraphs) never reach it: right under the page, or on top of everything
      VARS.forEach((name) => panel.style.setProperty(`--kz-${NAME}-${name}`, css(name)));
      panel.style.fontFamily = getComputedStyle(root).fontFamily;
      if (under) page.before(panel);
      else document.body.append(panel);
      panel.hidden = false;
      if (!under) {
        try {
          panel.popover = 'manual';
          panel.showPopover();
        } catch {
          // no popover support: a fixed layer over the page
        }
      }
      own.ready?.();
      sequence = timeline(page ? 'page' : reduced ? 'reduced' : 'flat', g);
      if (moving) rideAlong(moving.fixed, g.k);
      session = new AbortController();
      listen(session.signal);
      state = 'opening';
      play(true);
      enter(keyboard);
    };

    const shut = (after) => {
      if (state === 'closed' || state === 'closing') return;
      then = after || null;
      state = 'closing';
      toggle.setAttribute('aria-expanded', 'false');
      toggle.focus({ preventScroll: true });
      // On its way out it lets clicks through: Menu, under it, opens it again from where it is
      panel.style.pointerEvents = 'none';
      play(false);
    };

    // Keyboard (Enter, Space) clicks have no detail: the focus then goes into the menu
    toggle.addEventListener('click', (event) => open(event.detail === 0), { signal });
    closer?.addEventListener('click', () => shut(), { signal });
    // A link to this very page (#section, or just #) closes the menu first, then goes there
    links.forEach((link) => link.addEventListener('click', (event) => {
      const here = link.origin === location.origin && link.pathname === location.pathname && link.search === location.search;
      if (!here || event.defaultPrevented || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
      event.preventDefault();
      const hash = link.hash;
      shut(hash ? () => (location.hash = hash) : null);
    }, { signal }));
    // Back from another page (bfcache): the menu is closed, the page as it was
    window.addEventListener('pageshow', (event) => event.persisted && state !== 'closed' && land(), { signal });

    // Stopped while open: the page is put back at once and the panel goes back in place
    signal.addEventListener('abort', () => {
      then = null;
      if (state !== 'closed') land();
    });
  };
  // ---------- Menu engine (end) ----------

  // Below 900 px the curtain shows the bar's own links: they are written from them, unless you
  // wrote your own (a wp_nav_menu() for instance)
  const drawer = (root) => {
    const nav = root.querySelector(`.kodza-${NAME}__nav`);
    if (!nav || nav.querySelector(`.kodza-${NAME}__link`)) return;
    root.querySelectorAll(`.kodza-${NAME}__links .kodza-${NAME}__item`).forEach((item, i) => {
      const span = (name, text) => {
        const el = document.createElement('span');
        el.className = `kodza-${NAME}__${name}`;
        if (text) el.textContent = text;
        return el;
      };
      const a = document.createElement('a');
      a.className = `kodza-${NAME}__link`;
      a.href = item.getAttribute('href') || '#';
      if (item.hasAttribute('aria-current')) a.setAttribute('aria-current', item.getAttribute('aria-current'));
      const mask = span('mask');
      mask.append(span('word', item.textContent.trim()));
      a.append(mask, span('index', String(i + 1).padStart(2, '0')));
      nav.append(a);
    });
  };

  // The blind: it comes down once the hero has gone under the bar, and rolls away when it comes
  // back. The row is cut below its edge, an ink copy of it above: the text turns along the edge.
  // Once landed, the row takes the ink itself (the copy can't be pointed at or focused)
  const blind = (root, signal) => {
    const bar = root.querySelector(`.kodza-${NAME}__bar`);
    const row = root.querySelector(`.kodza-${NAME}__row`);
    const fill = root.querySelector(`.kodza-${NAME}__fill`);
    if (!bar || !row || !fill) return;
    const ink = row.cloneNode(true);
    ink.classList.add(`kodza-${NAME}__row--ink`);
    ink.setAttribute('aria-hidden', 'true');
    ink.inert = true;
    ink.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));
    row.after(ink);

    // The hero: named with data-hero, or what comes right after the header (the first block of
    // a wrapper taller than the screen)
    let hero = null;
    const find = () => {
      if (hero?.isConnected) return hero;
      if (root.dataset.hero) return (hero = document.querySelector(root.dataset.hero));
      let el = root;
      while (el && !el.nextElementSibling) el = el.parentElement;
      el = el?.nextElementSibling;
      while (el?.firstElementChild && el.offsetHeight > window.innerHeight * 1.2) el = el.firstElementChild;
      return (hero = el || null);
    };

    // Swapped in one frame, with nothing easing
    const swap = (change) => {
      root.classList.add('is-swap');
      change();
      void root.offsetWidth;
      root.classList.remove('is-swap');
    };
    let down = null;
    const set = (next, now) => {
      if (next === down) return;
      down = next;
      if (now || motion.matches) {
        swap(() => {
          root.classList.toggle('is-down', next);
          root.classList.toggle('is-solid', next);
        });
        return;
      }
      if (next) {
        root.classList.add('is-down');
        if (!parseFloat(getComputedStyle(fill).transitionDuration)) swap(() => root.classList.add('is-solid'));
        return;
      }
      // Going back up from where it landed: the copy takes over first, then it all rolls away
      if (root.classList.contains('is-solid')) swap(() => root.classList.remove('is-solid'));
      root.classList.remove('is-down');
    };
    const check = (now) => {
      const el = find();
      // Two bars' height early: the blind is past the text before the photo is gone, so white text
      // doesn't sit on the page, even on a quick scroll
      const r = bar.getBoundingClientRect();
      const edge = r.bottom + r.height * 2;
      set(el ? el.getBoundingClientRect().bottom <= edge : window.scrollY > window.innerHeight - edge, now);
    };

    let frame = 0;
    const schedule = () => {
      if (!frame) frame = requestAnimationFrame(() => {
        frame = 0;
        check();
      });
    };
    document.addEventListener('scroll', schedule, { capture: true, passive: true, signal });
    window.addEventListener('resize', schedule, { signal });
    fill.addEventListener('transitionend', (event) => {
      if (event.target === fill && event.propertyName === 'transform' && down && !root.classList.contains('is-solid')) {
        swap(() => root.classList.add('is-solid'));
      }
    }, { signal });
    check(true);

    signal.addEventListener('abort', () => {
      cancelAnimationFrame(frame);
      ink.remove();
      root.classList.remove('is-down', 'is-solid', 'is-swap');
    }, { once: true });
  };

  function mount(root, signal) {
    drawer(root);
    blind(root, signal);
    menu(root, signal, (m) => {
      const { panel, toggle, closer, links, one, all, css } = m;
      const shade = one('.kodza-header-overlay__shade');
      const curtain = one('.kodza-header-overlay__curtain');
      const edge = one('.kodza-header-overlay__edge');
      const cross = one('.kodza-header-overlay__cross');
      const say = one('.kodza-header-overlay__say > span');
      const label = one('.kodza-header-overlay__label');
      const head = one('.kodza-header-overlay__head');
      const infos = all('.kodza-header-overlay__info > *');
      const lines = toggle.querySelector('.kodza-header-overlay__lines');
      const depth = () => parseFloat(css('menu-depth')) || 0.94;

      // The page backs off towards the bottom of the screen. Only its visible part shows, so its
      // rounded corners are the screen's; a smaller page never stretches the scroll area
      const rig = (page) => {
        const { r, k, top, bottom, left, right } = view(page);
        const hinge = (bottom - r.top) / k;
        const clip = [(top - r.top) / k, (r.right - right) / k, page.offsetHeight - hinge, (left - r.left) / k];
        page.style.transformOrigin = `${((left + right) / 2 - r.left) / k}px ${hinge}px`;
        return { k, clip: clip.map((n) => `${Math.max(n, 0)}px`).join(' ') };
      };
      const frames = (g) => [
        { transform: 'scale(1)', clipPath: `inset(${g.clip} round 0px)` },
        { transform: `scale(${depth()})`, clipPath: `inset(${g.clip} round 18px)` },
      ];

      // Around the page once it has backed off: its own colour on screen, much darker, so the
      // edge reads and the site's body never shows through
      const around = () => {
        const { clientWidth: vw, clientHeight: vh } = document.documentElement;
        let el = document.elementsFromPoint(vw / 2, vh / 2).find((node) => m.page.contains(node));
        for (; el && el !== m.page.parentElement; el = el.parentElement) {
          const color = getComputedStyle(el).backgroundColor;
          if (!transparent(color)) return `color-mix(in srgb, ${color} 18%, #000)`;
        }
        return '#000';
      };

      // The lines cross on the button, and Close shows them crossed once the edge is over it
      const turn = (el, sign) => {
        const pseudoElement = sign > 0 ? '::before' : '::after';
        return (add) => {
          add(el, [{ translate: '0 0' }, { translate: `0 ${3 * sign}px` }], 0, 200, SWING, { pseudoElement });
          add(el, [{ rotate: '0deg' }, { rotate: `${45 * sign}deg` }], 170, 300, RISE, { pseudoElement });
        };
      };

      // Close lands right where Menu was, wherever the bar puts it
      const ready = () => {
        head.removeAttribute('style');
        const t = toggle.getBoundingClientRect();
        const s = panel.getBoundingClientRect();
        const k = panel.offsetWidth ? s.width / panel.offsetWidth : 1;
        const dy = (t.top - s.top) / k;
        const dx = (s.right - t.right) / k;
        if (dy >= 0 && dy <= 96 && dx >= 0 && dx <= panel.offsetWidth / 3) {
          head.style.paddingTop = `${dy}px`;
          head.style.paddingRight = `${dx}px`;
        }
      };

      const build = (add, mode, g) => {
        if (mode === 'reduced') {
          add(panel, [{ opacity: 0 }, { opacity: 1 }], 0, 180, 'ease');
          return;
        }
        const time = (parseFloat(css('menu-duration')) || 1) * 1000;
        const ease = css('menu-ease') || 'cubic-bezier(0.76, 0, 0.24, 1)';
        const { top: y0, left: x0, width: w, height: h } = panel.getBoundingClientRect();

        // The curtain comes down on the curve; its edge bends as deep as it is fast
        const samples = curve(ease);
        const speed = samples.map((_, i) => {
          const [a, b] = [samples[Math.max(i - 1, 0)], samples[Math.min(i + 1, 100)]];
          return b[0] > a[0] ? (b[1] - a[1]) / (b[0] - a[0]) : 0;
        });
        const most = Math.max(...speed) || 1;
        const bend = speed.map((v, i) => (i === 0 || i === 100 ? 0 : v / most));
        const deep = parseFloat(getComputedStyle(edge).height) || 0;
        add(curtain, [{ transform: 'translateY(-100%)' }, { transform: 'translateY(0%)' }], 0, time, ease);
        add(edge, samples.map(([t], i) => ({ offset: t, transform: `scaleY(${bend[i]})` })).filter((_, i) => i % 5 === 0), 0, time, 'linear');

        // When the edge gets to `y` at `x` (screen pixels): the middle comes first, the sides last
        const reach = (y, x) => {
          const u = (2 * (x - x0)) / w - 1;
          const shape = Math.max(1 - u * u, 0);
          const i = samples.findIndex(([, p], j) => y0 + p * h + deep * bend[j] * shape >= y);
          return (i < 0 ? 1 : samples[i][0]) * time;
        };
        const far = (r) => (Math.abs(r.left - (x0 + w / 2)) > Math.abs(r.right - (x0 + w / 2)) ? r.left : r.right);

        // The page backs off and dims (without one, the shade alone). Only the dimming fades in:
        // what shows around the page is solid from the first frame
        const dim = getComputedStyle(shade).backgroundColor;
        if (mode === 'page') {
          add(m.page, frames(g), 0, time, ease);
          const scale = depth();
          // Where it lands, also written on the element: the open state holds without the animation
          Object.assign(shade.style, { boxShadow: `0 0 0 100vmax ${around()}`, borderRadius: `${18 * g.k}px` });
          add(shade, [
            { backgroundColor: 'rgba(0, 0, 0, 0)', transform: 'scale(1)', borderRadius: '0px', transformOrigin: '50% 100%' },
            { backgroundColor: dim, transform: `scale(${scale})`, borderRadius: `${18 * g.k}px`, transformOrigin: '50% 100%' },
          ], 0, time, ease);
        } else {
          add(shade, [{ backgroundColor: 'rgba(0, 0, 0, 0)' }, { backgroundColor: dim }], 0, time, ease);
        }

        // The button's lines cross, and Close is uncovered by the edge, its lines already crossed
        if (lines) [turn(lines, 1), turn(lines, -1)].forEach((go) => go(add));
        if (cross) [turn(cross, 1), turn(cross, -1)].forEach((go) => go(add));
        if (closer) {
          const r = closer.getBoundingClientRect();
          const x = r.left + r.width / 2;
          const from = reach(r.top - 8, x);
          add(closer, [
            { clipPath: 'inset(-8px -8px calc(100% + 8px) -8px round 28px)' },
            { clipPath: 'inset(-8px -8px -8px -8px round 28px)' },
          ], from, Math.max(reach(r.bottom + 8, x) - from, 1), 'linear');
          add(say, [{ transform: 'translateY(110%)' }, { transform: 'translateY(0%)' }], from + 120, 600);
        }
        if (label) {
          const r = label.getBoundingClientRect();
          add(label, [{ opacity: 0, transform: 'translateY(6px)' }, { opacity: 1, transform: 'translateY(0px)' }], reach(r.bottom, far(r)) + 100, 600);
        }

        // Each link rises from its mask once the edge has gone past all of it
        let at = 0;
        links.forEach((link) => {
          const mask = link.querySelector('.kodza-header-overlay__mask');
          const r = (mask || link).getBoundingClientRect();
          at = Math.max(at + 70, reach(r.bottom, far(r)));
          add(link.querySelector('.kodza-header-overlay__word'), [{ transform: 'translateY(135%)' }, { transform: 'translateY(0%)' }], at, 900);
          add(link.querySelector('.kodza-header-overlay__index'), [{ opacity: 0, transform: 'translateY(6px)' }, { opacity: 1, transform: 'translateY(0px)' }], at + 240, 600);
        });
        infos.forEach((info, i) => {
          const r = info.getBoundingClientRect();
          add(info, [{ opacity: 0, transform: 'translateY(10px)' }, { opacity: 1, transform: 'translateY(0px)' }], Math.max(at + 200 + i * 70, reach(r.bottom, far(r))), 650);
        });
      };

      // Back over 900 px, the links are back in the bar: the curtain closes
      const menuBar = root.querySelector('.kodza-header-overlay__menu');
      const watch = new ResizeObserver(() => {
        if (menuBar && getComputedStyle(menuBar).display !== 'none' && toggle.getAttribute('aria-expanded') === 'true') closer?.click();
      });
      watch.observe(root);
      signal.addEventListener('abort', () => watch.disconnect(), { once: true });

      const reset = () => {
        shade.removeAttribute('style');
        head.removeAttribute('style');
      };
      return { page: 'over', rig, frames, build, ready, reset };
    });
  }

  // Kodza lifecycle, the same in every component: `kodza:init` starts the instances inside
  // event.detail.root (the whole page by default), `kodza:destroy` stops them and puts their
  // markup back. For themes and apps that swap content without a page load. Each running root
  // keeps its markup as written under KODZA, shared by every Kodza script on the page: a Kodza
  // component inside another one is saved as written, not half-started, and stopped with it.
  const KODZA = Symbol.for('kodza');
  const instances = new WeakMap();
  const find = (scope = document) => [scope, ...scope.querySelectorAll(SELECTOR)].filter((el) => el.matches?.(SELECTOR));
  const attrsOf = (el) => [...el.attributes].map((a) => [a.name, a.value]);
  const put = (el, saved) => {
    [...el.attributes].forEach((a) => el.removeAttribute(a.name));
    saved.attrs.forEach(([name, value]) => el.setAttribute(name, value));
    el.innerHTML = saved.html;
  };
  // The markup inside a root as written: Kodza components already running in it give back their own
  const written = (root) => {
    const all = [...root.querySelectorAll('*')];
    if (!all.some((el) => el[KODZA])) return root.innerHTML;
    const copy = root.cloneNode(true);
    const twins = copy.querySelectorAll('*');
    let last = null;
    all.forEach((el, i) => {
      if (!el[KODZA] || last?.contains(el)) return;
      last = el;
      put(twins[i], el[KODZA]);
    });
    return copy.innerHTML;
  };
  const init = (scope) => find(scope).forEach((root) => {
    if (root.classList.contains('is-ready')) return; // already running, maybe from another copy of this script
    const controller = new AbortController();
    const saved = { html: written(root), attrs: attrsOf(root), stop: () => destroy(root) };
    instances.set(root, { controller, saved });
    root[KODZA] = saved;
    mount(root, controller.signal);
    root.classList.add('is-ready');
  });
  const destroy = (scope) => find(scope).forEach((root) => {
    const instance = instances.get(root);
    if (!instance) return;
    instances.delete(root);
    // The Kodza components running inside it stop first: once its markup is put back, their own
    // script could not find them any more
    root.querySelectorAll('*').forEach((el) => el[KODZA]?.stop());
    instance.controller.abort();
    delete root[KODZA];
    put(root, instance.saved);
  });
  document.addEventListener('kodza:init', (event) => init(event.detail?.root));
  document.addEventListener('kodza:destroy', (event) => destroy(event.detail?.root));
  init();
  // Loaded in <head>, the script runs before the markup exists: once more when it is parsed
  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => init(), { once: true });
})();
```

Free to use, from Kodza (https://kodza.dev).
