# Shutter Menu

> A menu that comes down under your header like a shutter: each link rises as the edge reaches it, Menu rolls to Close. The panel is a native popover, so Escape, a click outside and focus return come free.

Navigation · menu, burger, fullscreen, nav, popover · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-27
Demo: https://kodza.dev/components/shutter-menu/
Source on GitHub: https://github.com/kodza-dev/kodza/tree/main/components/shutter-menu

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-shutter-menu.css`](https://kodza.dev/registry/shutter-menu/kodza-shutter-menu.css) · 15.9 KB
- [`kodza-shutter-menu.js`](https://kodza.dev/registry/shutter-menu/kodza-shutter-menu.js) · 9.8 KB
- [`kodza-shutter-menu.html`](https://kodza.dev/registry/shutter-menu/kodza-shutter-menu.html) · 1.4 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-shutter-menu.css https://kodza.dev/registry/shutter-menu/kodza-shutter-menu.css
curl -fsSL --create-dirs -o kodza/kodza-shutter-menu.js https://kodza.dev/registry/shutter-menu/kodza-shutter-menu.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-shutter`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-shutter-bg: #0a0a0a` — the menu
  - `--kz-shutter-fg: #f2f2f0`
  - `--kz-shutter-muted: rgba(242, 242, 240, 0.62)`
  - `--kz-shutter-line: rgba(242, 242, 240, 0.16)`
  - `--kz-shutter-ink: #0a0a0a` — the Menu button, on the page
  - `--kz-shutter-on-ink: #ffffff`
  - `--kz-shutter-top: auto` — where the shutter starts; auto = the bottom of the header that holds the button
  - `--kz-shutter-side: 24px`
  - `--kz-shutter-size: clamp(36px, min(9cqw, calc((100cqh - 190px) / 4.9)), 112px)`
  - `--kz-shutter-duration: 0.8s`
  - `--kz-shutter-ease: cubic-bezier(0.76, 0, 0.24, 1)`
- 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 button (focus in `.kodza-shutter__toggle`):
  - `Enter` / `Space`: Opens or closes the shutter
- In the menu (focus in `.kodza-shutter__panel a`):
  - `Escape`: Rolls it back up, focus back on Menu
  - `Tab`: Past the last link, rolls it up and goes on with the page

## 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-shutter {
    --kz-shutter-bg: #f2f2f0;
    --kz-shutter-fg: #0a0a0a;
    --kz-shutter-muted: rgba(10, 10, 10, 0.62);
    --kz-shutter-line: rgba(10, 10, 10, 0.14);
    --kz-shutter-ink: #f2f2f0;
    --kz-shutter-on-ink: #0a0a0a;
  }
}
```

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

## Use it

### Plain HTML page

- CSS: `kodza/kodza-shutter-menu.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-shutter-menu.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.
- Inside the site's header, at its right end, in place of the header's links and burger. The site's own links go in the menu, one kodza-shutter__link each. The shutter starts under the header that holds the button, so the header and Close stay in view; to start it elsewhere, set --kz-shutter-top on .kodza-shutter (e.g. --kz-shutter-top: 72px).
- JS: `kodza/kodza-shutter-menu.js`, loaded with `<script src="kodza/kodza-shutter-menu.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-shutter-menu.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-shutter-menu.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.
- Inside the site's header, at its right end, in place of the header's links and burger. The site's own links go in the menu, one kodza-shutter__link each. The shutter starts under the header that holds the button, so the header and Close stay in view; to start it elsewhere, set --kz-shutter-top on .kodza-shutter (e.g. --kz-shutter-top: 72px).

### 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 is inline (it flows like a word): pasted alone, many themes leave it at the edge of the page (block themes, and classic ones like Twenty Twenty-One or Blocksy), so put the Custom HTML block inside a **Group** block to line it up with the text.
- 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-shutter-menu', $uri . 'kodza-shutter-menu.css', [], filemtime($dir . 'kodza-shutter-menu.css'));
    wp_enqueue_script('kodza-shutter-menu', $uri . 'kodza-shutter-menu.js', [], filemtime($dir . 'kodza-shutter-menu.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: by default, match the theme's palette. After the component's CSS, point these variables at the theme's colours, on the component root, Kodza's value as the fallback:
  `.kodza-shutter { --kz-shutter-ink: var(ACCENT, #0a0a0a); --kz-shutter-on-ink: var(BACKGROUND, #ffffff); }`
  TEXT, BACKGROUND and ACCENT (the colour the theme fills its own buttons with) are the theme's own colour variables — block themes (theme.json, like Twenty Twenty-Five): `--wp--preset--color--contrast`, `--wp--preset--color--base`, `--wp--preset--color--contrast` (they fill their buttons with it; their accent-1… colours are decorative); Astra: `--ast-global-color-2`, `--ast-global-color-4`, `--ast-global-color-0`; Kadence: `--global-palette3`, `--global-palette9`, `--global-palette1`; GeneratePress: `--contrast`, `--base-3`, `--accent`; Blocksy: `--theme-palette-color-4`, `--theme-palette-color-8`, `--theme-palette-color-1`. Use only these names, and only if the site really has them (the theme's CSS, or Styles → Colors): the `--wp--preset--color--black`, `--white`, `--vivid-…` that WordPress adds everywhere are not the theme's palette. Another theme, or one without these variables (Hello Elementor, OceanWP): leave the variables alone, it keeps Kodza's monochrome; same when the developer asks for monochrome or the Kodza look. Leave the translucent greys (`rgba(10, 10, 10, …)`) as they are: they suit any light background. On a dark palette, set the other variables from Dark mode too.
- WordPress turns straight quotes and `--` into typographic ones in the text of a Custom HTML block (not inside `<code>` or `<pre>`).

#### With Elementor

- HTML: an **HTML** widget (Elementor shows it to administrators only). It keeps the code exactly as pasted, straight quotes included.
- 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.

### Shopify

- Files: `assets/kodza-shutter-menu.css` and `assets/kodza-shutter-menu.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-shutter-menu.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-shutter-menu.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`.
- Inside the site's header, at its right end, in place of the header's links and burger. The site's own links go in the menu, one kodza-shutter__link each. The shutter starts under the header that holds the button, so the header and Close stay in view; to start it elsewhere, set --kz-shutter-top on .kodza-shutter (e.g. --kz-shutter-top: 72px).

### React / Next.js

- Files, side by side (e.g. in `components/kodza/`): `ShutterMenu.tsx` (below), the CSS block under Code saved as `shutter-menu.css` and the JS block as `shutter-menu.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { ShutterMenu } from '@/components/kodza/ShutterMenu';` then `<ShutterMenu />`. Props: `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-shutter-bg': … }}`), `className`, `style` and the other props of its `<div>` (`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 './shutter-menu.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 — Shutter Menu, for React. From https://kodza.dev/components/shutter-menu/
// 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: shutter-menu.css and shutter-menu.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 './shutter-menu.css';

export type ShutterMenuProps = Omit<ComponentPropsWithoutRef<'div'>, "children" | "vars"> & {
  /** Settings, as CSS variables on the root */
  vars?: {
    /** the menu — default: #0a0a0a */
    "--kz-shutter-bg"?: string | number;
    /** default: #f2f2f0 */
    "--kz-shutter-fg"?: string | number;
    /** default: rgba(242, 242, 240, 0.62) */
    "--kz-shutter-muted"?: string | number;
    /** default: rgba(242, 242, 240, 0.16) */
    "--kz-shutter-line"?: string | number;
    /** the Menu button, on the page — default: #0a0a0a */
    "--kz-shutter-ink"?: string | number;
    /** default: #ffffff */
    "--kz-shutter-on-ink"?: string | number;
    /** where the shutter starts; auto = the bottom of the header that holds the button — default: auto */
    "--kz-shutter-top"?: string | number;
    /** default: 24px */
    "--kz-shutter-side"?: string | number;
    /** default: clamp(36px, min(9cqw, calc((100cqh - 190px) / 4.9)), 112px) */
    "--kz-shutter-size"?: string | number;
    /** default: 0.8s */
    "--kz-shutter-duration"?: string | number;
    /** default: cubic-bezier(0.76, 0, 0.24, 1) */
    "--kz-shutter-ease"?: string | number;
  };
  className?: string;
};

export function ShutterMenu({ vars, className, style, ...rest }: ShutterMenuProps) {
  const ref = useRef<ComponentRef<'div'>>(null);
  const classes = ["kodza-shutter", 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('./shutter-menu.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 (
    <div key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <button className="kodza-shutter__toggle" type="button" aria-expanded="false">
        <span className="kodza-shutter__lines" aria-hidden="true" />
        <span className="kodza-shutter__label">
          <span className="kodza-shutter__say">Menu</span>
          <span className="kodza-shutter__say" aria-hidden="true">Close</span>
        </span>
      </button>
      <div className="kodza-shutter__panel" popover="" aria-label="Menu">
        <nav className="kodza-shutter__nav" aria-label="Main">
          <a className="kodza-shutter__link" href="#">
            <span className="kodza-shutter__index">01</span>
            <span className="kodza-shutter__mask">
              <span className="kodza-shutter__word">Work</span>
            </span>
          </a>
          {' '}
          <a className="kodza-shutter__link" href="#">
            <span className="kodza-shutter__index">02</span>
            <span className="kodza-shutter__mask">
              <span className="kodza-shutter__word">Services</span>
            </span>
          </a>
          {' '}
          <a className="kodza-shutter__link" href="#">
            <span className="kodza-shutter__index">03</span>
            <span className="kodza-shutter__mask">
              <span className="kodza-shutter__word">Journal</span>
            </span>
          </a>
          {' '}
          <a className="kodza-shutter__link" href="#">
            <span className="kodza-shutter__index">04</span>
            <span className="kodza-shutter__mask">
              <span className="kodza-shutter__word">Contact</span>
            </span>
          </a>
        </nav>
        <div className="kodza-shutter__info">
          <p>Mon–Fri, 9 to 6. Closed when it's done.</p>
          <p className="kodza-shutter__socials">
            <a href="#">GitHub</a>
            <a href="#">X</a>
            <a href="#">RSS</a>
          </p>
        </div>
      </div>
    </div>
  );
}
```

- Inside the site's header, at its right end, in place of the header's links and burger. The site's own links go in the menu, one kodza-shutter__link each. The shutter starts under the header that holds the button, so the header and Close stay in view; to start it elsewhere, set --kz-shutter-top on .kodza-shutter (e.g. --kz-shutter-top: 72px).

## Code

```html
<div class="kodza-shutter">
  <button class="kodza-shutter__toggle" type="button" aria-expanded="false"><span class="kodza-shutter__lines" aria-hidden="true"></span><span class="kodza-shutter__label"><span class="kodza-shutter__say">Menu</span><span class="kodza-shutter__say" aria-hidden="true">Close</span></span></button>
  <div class="kodza-shutter__panel" popover aria-label="Menu">
    <nav class="kodza-shutter__nav" aria-label="Main">
      <a class="kodza-shutter__link" href="#"><span class="kodza-shutter__index">01</span><span class="kodza-shutter__mask"><span class="kodza-shutter__word">Work</span></span></a>
      <a class="kodza-shutter__link" href="#"><span class="kodza-shutter__index">02</span><span class="kodza-shutter__mask"><span class="kodza-shutter__word">Services</span></span></a>
      <a class="kodza-shutter__link" href="#"><span class="kodza-shutter__index">03</span><span class="kodza-shutter__mask"><span class="kodza-shutter__word">Journal</span></span></a>
      <a class="kodza-shutter__link" href="#"><span class="kodza-shutter__index">04</span><span class="kodza-shutter__mask"><span class="kodza-shutter__word">Contact</span></span></a>
    </nav>
    <div class="kodza-shutter__info">
      <p>Mon–Fri, 9 to 6. Closed when it's done.</p>
      <p class="kodza-shutter__socials"><a href="#">GitHub</a><a href="#">X</a><a href="#">RSS</a></p>
    </div>
  </div>
</div>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Shutter Menu
   The menu comes down from under your header like a shop shutter, and each link rises from its
   mask as the edge gets to it. The button stays in view: its lines cross, Menu rolls to Close.
   The panel is a native popover: Escape, a click outside and the focus going back to the button
   are the browser's own. Everything is tuned with the --kz-shutter-* variables. */
.kodza-shutter {
  --kz-shutter-bg: #0a0a0a; /* the menu */
  --kz-shutter-fg: #f2f2f0;
  --kz-shutter-muted: rgba(242, 242, 240, 0.62);
  --kz-shutter-line: rgba(242, 242, 240, 0.16);
  --kz-shutter-ink: #0a0a0a; /* the Menu button, on the page */
  --kz-shutter-on-ink: #ffffff;
  --kz-shutter-top: auto; /* where the shutter starts; auto = the bottom of the header that holds the button */
  --kz-shutter-side: 24px;
  --kz-shutter-size: clamp(36px, min(9cqw, calc((100cqh - 190px) / 4.9)), 112px);
  --kz-shutter-duration: 0.8s;
  --kz-shutter-ease: cubic-bezier(0.76, 0, 0.24, 1);

  display: inline-block;
}

/* The button: two lines meet, then cross; the label rolls without changing the width */
.kodza-shutter__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin: 0;
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--kz-shutter-ink);
  color: var(--kz-shutter-on-ink);
  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-shutter__toggle:focus-visible {
  outline: 2px solid var(--kz-shutter-ink);
  outline-offset: 3px;
}

.kodza-shutter__lines {
  position: relative;
  flex: none;
  width: 14px;
  height: 8px;
}

.kodza-shutter__lines::before,
.kodza-shutter__lines::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;
  /* Closing: they uncross first, then part */
  transition:
    rotate 0.22s cubic-bezier(0.65, 0, 0.35, 1),
    translate 0.22s cubic-bezier(0.65, 0, 0.35, 1) 0.18s,
    clip-path 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.kodza-shutter__lines::before {
  top: 0;
}

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

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

.kodza-shutter__toggle:hover .kodza-shutter__lines::after {
  clip-path: inset(0 45% 0 0);
}

.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__lines::before,
.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__lines::after {
  clip-path: inset(0 0 0 0);
  transition:
    translate 0.2s cubic-bezier(0.65, 0, 0.35, 1),
    rotate 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.17s,
    clip-path 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__lines::before {
  translate: 0 3px;
  rotate: 45deg;
}

.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__lines::after {
  translate: 0 -3px;
  rotate: -45deg;
}

.kodza-shutter__label {
  display: grid;
  margin: -3px 0;
  padding: 3px 0;
  overflow: hidden;
}

/* The script rolls the words both ways: the old one goes up, the new one comes up from below */
.kodza-shutter__say {
  grid-area: 1 / 1;
}

.kodza-shutter__say + .kodza-shutter__say {
  translate: 0 115%;
}

.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__say {
  translate: 0 -115%;
}

.kodza-shutter__toggle[aria-expanded="true"] .kodza-shutter__say + .kodza-shutter__say {
  translate: 0 0;
}

/* The shutter: from the bottom of your header to the bottom of the screen, rolled up until it opens */
.kodza-shutter__panel {
  position: fixed;
  inset: var(--kz-shutter-from, 0px) 0 0 0;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0 var(--kz-shutter-side);
  border: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  background: var(--kz-shutter-bg);
  color: var(--kz-shutter-fg);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
  container-type: size;
  z-index: 99990;
  /* Here and not on the open state: the panel keeps its rows while it rolls back up */
  grid-template-rows: 1fr auto;
  -webkit-font-smoothing: antialiased;
  clip-path: inset(0 0 100% 0);
  /* Closing: quicker than it came down */
  transition:
    clip-path calc(var(--kz-shutter-duration) * 0.7) var(--kz-shutter-ease),
    display calc(var(--kz-shutter-duration) * 0.7) allow-discrete,
    overlay calc(var(--kz-shutter-duration) * 0.7) allow-discrete;
}

.kodza-shutter__panel:popover-open {
  display: grid;
  clip-path: inset(0 0 0 0);
  transition:
    clip-path var(--kz-shutter-duration) var(--kz-shutter-ease),
    display var(--kz-shutter-duration) allow-discrete,
    overlay var(--kz-shutter-duration) allow-discrete;
}

@starting-style {
  .kodza-shutter__panel:popover-open {
    clip-path: inset(0 0 100% 0);
  }
}

.kodza-shutter__nav {
  align-self: center;
  display: grid;
  padding: 28px 0;
}

/* Each row: its hairline draws in, then the word rises from its mask */
.kodza-shutter__link {
  position: relative;
  display: grid;
  grid-template-columns: clamp(44px, 9cqw, 132px) minmax(0, 1fr);
  align-items: start;
  padding: 14px 0 10px;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.kodza-shutter__link::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--kz-shutter-line);
  scale: 0 1;
  transform-origin: left center;
  transition: scale 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.kodza-shutter__index {
  padding-top: 0.4em;
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--kz-shutter-muted);
  opacity: 0;
  transition: opacity 0.2s, color 0.25s;
}

/* The mask has the size of its word, so its room for descenders (g, j, p, q, y) and its step
   aside are measured on the word */
.kodza-shutter__mask {
  display: block;
  margin: -0.06em 0 -0.24em;
  padding: 0.06em 0 0.24em;
  overflow: hidden;
  font-size: var(--kz-shutter-size);
  transition: translate 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.kodza-shutter__word {
  display: block;
  font-size: var(--kz-shutter-size);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
  translate: 0 135%;
  /* Closing: the words drop back into their masks while the shutter rolls up */
  transition: translate 0.32s cubic-bezier(0.65, 0, 0.35, 1);
}

.kodza-shutter__info {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--kz-shutter-line);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--kz-shutter-muted);
  opacity: 0;
  translate: 0 8px;
  transition: opacity 0.2s, translate 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.kodza-shutter__info p {
  margin: 0;
}

.kodza-shutter__socials {
  display: flex;
  gap: 20px;
}

.kodza-shutter__socials a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

/* Open: each part starts when the edge reaches it (the script sets --kz-shutter-delay) */
.kodza-shutter__panel.is-open .kodza-shutter__link::before {
  scale: 1 1;
  transition: scale 0.9s cubic-bezier(0.22, 1, 0.36, 1) var(--kz-shutter-delay, 0s);
}

.kodza-shutter__panel.is-open .kodza-shutter__index {
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--kz-shutter-delay, 0s) + 0.12s), color 0.25s;
}

.kodza-shutter__panel.is-open .kodza-shutter__word {
  translate: 0 0;
  transition: translate 0.75s cubic-bezier(0.22, 1, 0.36, 1) var(--kz-shutter-delay, 0s);
}

.kodza-shutter__panel.is-open .kodza-shutter__info {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--kz-shutter-delay, 0s),
    translate 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--kz-shutter-delay, 0s);
}

/* Pointed at: the word steps aside and its number lights up */
.kodza-shutter__link:hover .kodza-shutter__mask,
.kodza-shutter__link:focus-visible .kodza-shutter__mask {
  translate: 0.14em 0;
}

.kodza-shutter__link:hover .kodza-shutter__index,
.kodza-shutter__link:focus-visible .kodza-shutter__index,
.kodza-shutter__socials a:hover {
  color: var(--kz-shutter-fg);
}

.kodza-shutter__link:focus-visible .kodza-shutter__word {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

.kodza-shutter__socials a:focus-visible {
  outline: 2px solid var(--kz-shutter-fg);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-shutter__panel,
  .kodza-shutter__panel *,
  .kodza-shutter__panel *::before,
  .kodza-shutter__toggle *,
  .kodza-shutter__toggle *::before,
  .kodza-shutter__toggle *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* kodza-guard f2b6a432fe24 — 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-shutter__toggle):not(#_),
:where(.kodza-shutter__socials a:where(:not([class*="kodza-"]))):not(#_) {
  outline: revert;
  outline-offset: revert;
}

:where(.kodza-shutter__nav):not(#_),
:where(.kodza-shutter__link):not(#_),
:where(.kodza-shutter__socials):not(#_),
:where(.kodza-shutter__info p:where(:not([class*="kodza-"]):not(.kodza-shutter__info [class*="kodza-"] *))):not(#_) {
  transition-duration: revert;
  transition-delay: revert;
}

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

.kodza-shutter:not(#_),
.kodza-shutter__lines:not(#_),
.kodza-shutter__label:not(#_),
.kodza-shutter__say:not(#_),
.kodza-shutter__index:not(#_),
.kodza-shutter__mask:not(#_),
.kodza-shutter__word:not(#_),
.kodza-shutter__info:not(#_) {
  box-sizing: revert;
}

.kodza-shutter__toggle:not(#_) {
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: 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-shutter__nav:not(#_) {
  border: revert;
  margin: 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;
  transition-property: revert;
  transition-timing-function: revert;
}

.kodza-shutter__link:not(#_) {
  border: revert;
  margin: revert;
  border-radius: revert;
  list-style: revert;
  box-sizing: revert;
  float: 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;
  transition-property: revert;
  transition-timing-function: revert;
}

.kodza-shutter__socials:not(#_),
.kodza-shutter__info p:where(:not([class*="kodza-"]):not(.kodza-shutter__info [class*="kodza-"] *)):not(#_) {
  border: 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;
  transition-property: revert;
  transition-timing-function: revert;
}

.kodza-shutter__socials a:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: 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-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-shutter__info p:where(:not([class*="kodza-"]):not(.kodza-shutter__info [class*="kodza-"] *)):not(#_):where(:not([hidden])),
.kodza-shutter__socials a:where(:not([class*="kodza-"])):not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-shutter__info p:where(:not([class*="kodza-"]):not(.kodza-shutter__info [class*="kodza-"] *)):not(#_):where([hidden]),
.kodza-shutter__socials a:where(:not([class*="kodza-"])):not(#_):where([hidden]) {
  display: none;
}

.kodza-shutter__lines:not(#_)::before,
.kodza-shutter__lines:not(#_)::after,
.kodza-shutter__link:not(#_)::before {
  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-shutter__toggle:not(#_) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin: 0;
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--kz-shutter-ink);
  color: var(--kz-shutter-on-ink);
  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-shutter__toggle:focus-visible:not(#_) {
  outline: 2px solid var(--kz-shutter-ink);
  outline-offset: 3px;
}

.kodza-shutter__nav:not(#_) {
  display: grid;
  padding: 28px 0;
}

.kodza-shutter__link:not(#_) {
  position: relative;
  display: grid;
  padding: 14px 0 10px;
  color: inherit;
  text-decoration: none;
  outline: none;
}

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

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

.kodza-shutter__socials a:not(#_) {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.kodza-shutter__socials a:hover:not(#_) {
  color: var(--kz-shutter-fg);
}

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

@media (prefers-reduced-motion: reduce) {
  .kodza-shutter__panel *:where(nav, a, p):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 — Shutter Menu
// The panel is a native popover: the button opens and closes it, Escape and a click outside close
// it, and the focus goes back to the button. The script starts the shutter under your header,
// times each link to rise when the edge reaches it, and keeps the page still while it is open.
(() => {
  const SELECTOR = '.kodza-shutter';
  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

  // When (0 to 1 of the duration) a cubic-bezier curve gets to the progress p
  const timeAt = ([x1, y1, x2, y2], p) => {
    const at = (a, b, s) => 3 * a * s * (1 - s) ** 2 + 3 * b * s * s * (1 - s) + s ** 3;
    let lo = 0;
    let hi = 1;
    for (let i = 0; i < 24; i++) {
      const mid = (lo + hi) / 2;
      if (at(y1, y2, mid) < p) lo = mid;
      else hi = mid;
    }
    return at(x1, x2, (lo + hi) / 2);
  };

  // A wheel or a swipe only scrolls what can scroll in the panel, under the pointer
  const scrollsInside = (panel, 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;
  };

  // One instance, with its own state: two copies on a page never interfere. Everything it
  // starts is tied to `signal`, so kodza:destroy stops it all.
  function mount(root, signal) {
    const toggle = root.querySelector('.kodza-shutter__toggle');
    const panel = root.querySelector('.kodza-shutter__panel');
    if (!toggle || !panel || !('popover' in panel)) return;
    toggle.popoverTargetElement = panel;
    const words = [...toggle.querySelectorAll('.kodza-shutter__say')];
    const parts = [...panel.querySelectorAll('.kodza-shutter__link, .kodza-shutter__info')];
    let open = false;
    let started = 0;
    let held = null;
    const rolls = new Map();

    // The shutter starts under the header that holds the button (or at --kz-shutter-top)
    const place = () => {
      const top = getComputedStyle(root).getPropertyValue('--kz-shutter-top').trim();
      if (top && top !== 'auto') {
        panel.style.setProperty('--kz-shutter-from', top);
        return;
      }
      // Under the header, or just under the button when there is none: Close always stays in view
      const bar = root.closest('header, [role="banner"]');
      const below = toggle.getBoundingClientRect().bottom;
      const edge = bar ? Math.max(bar.getBoundingClientRect().bottom, below) : below + 16;
      panel.style.setProperty('--kz-shutter-from', `${Math.max(0, Math.round(edge))}px`);
    };

    // Each row starts when the edge of the shutter gets to it
    const time = () => {
      const style = getComputedStyle(root);
      const raw = style.getPropertyValue('--kz-shutter-duration').trim();
      const duration = reduceMotion ? 0 : parseFloat(raw) * (/ms$/.test(raw) ? 1 : 1000) || 800;
      const match = style.getPropertyValue('--kz-shutter-ease').match(/cubic-bezier\(([^)]+)\)/);
      const curve = match ? match[1].split(',').map(Number) : [0.76, 0, 0.24, 1];
      const box = panel.getBoundingClientRect();
      const late = performance.now() - started;
      parts.forEach((part) => {
        const p = Math.min(1, Math.max(0, (part.getBoundingClientRect().top - box.top) / (box.height || 1)));
        const delay = Math.max(0, duration * timeAt(curve, p) - late - 40);
        part.style.setProperty('--kz-shutter-delay', `${Math.round(delay)}ms`);
      });
    };

    // Menu rolls to Close and back the same way: the old word goes up, the new one comes from below.
    // A click during the roll turns it back from where the words are
    const roll = () => {
      if (reduceMotion || words.length < 2) return;
      words.forEach((word, i) => {
        const coming = i === Number(open);
        const from = rolls.has(word) ? getComputedStyle(word).translate : coming ? '0 115%' : '0 0';
        rolls.get(word)?.cancel();
        const run = word.animate(
          { translate: [from, coming ? '0 0' : '0 -115%'] },
          { duration: 500, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' },
        );
        rolls.set(word, run);
        run.finished.then(() => rolls.get(word) === run && rolls.delete(word), () => {});
      });
    };

    // While it is open the page stays where it is
    const hold = () => {
      held = new AbortController();
      const s = held.signal;
      const at = [scrollX, scrollY];
      let last = 0;
      document.addEventListener('wheel', (event) => {
        if (!scrollsInside(panel, 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(panel, event.target, touch.clientX, touch.clientY, dy)) event.preventDefault();
      }, { passive: false, 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 });
      window.addEventListener('resize', place, { signal: s });
    };
    const release = () => {
      held?.abort();
      held = null;
    };

    panel.addEventListener('beforetoggle', (event) => {
      open = event.newState === 'open';
      toggle.setAttribute('aria-expanded', String(open));
      words.forEach((word, i) => (i === Number(open) ? word.removeAttribute('aria-hidden') : word.setAttribute('aria-hidden', 'true')));
      roll();
      if (open) {
        started = performance.now();
        place();
        hold();
      } else {
        panel.classList.remove('is-open');
        release();
      }
    }, { signal });

    panel.addEventListener('toggle', (event) => {
      if (event.newState !== 'open' || !open) return;
      time();
      panel.classList.add('is-open');
    }, { signal });

    // Tab past the last link, or a link followed: the shutter rolls back up
    panel.addEventListener('focusout', (event) => {
      const next = event.relatedTarget;
      if (open && next && !panel.contains(next) && next !== toggle) panel.hidePopover();
    }, { signal });
    panel.addEventListener('click', (event) => {
      if (open && event.target.closest('a[href]')) panel.hidePopover();
    }, { signal });

    signal.addEventListener('abort', () => {
      rolls.forEach((run) => run.cancel());
      release();
      if (open) panel.hidePopover();
    });
  }

  // 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).
