# Hero Event

> An event hero that counts down to the start date in its markup, each digit dropping out of its window, then gives way to "Live now" at the start and to the replay link at the end.

Hero · hero, section, event, conference, countdown, launch, date · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-25
Demo: https://kodza.dev/components/hero-event/

## Files

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

- [`kodza-hero-event.css`](https://kodza.dev/registry/hero-event/kodza-hero-event.css) · 23.3 KB
- [`kodza-hero-event.js`](https://kodza.dev/registry/hero-event/kodza-hero-event.js) · 15.0 KB
- [`kodza-hero-event.html`](https://kodza.dev/registry/hero-event/kodza-hero-event.html) · 2.8 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-hero-event.css https://kodza.dev/registry/hero-event/kodza-hero-event.css
curl -fsSL --create-dirs -o kodza/kodza-hero-event.js https://kodza.dev/registry/hero-event/kodza-hero-event.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-hero-event`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-hero-event-ink: #0a0a0a`
  - `--kz-hero-event-paper: #f2f2f0`
  - `--kz-hero-event-dim: rgba(10, 10, 10, 0.62)`
  - `--kz-hero-event-faint: rgba(10, 10, 10, 0.6)`
  - `--kz-hero-event-soft: rgba(10, 10, 10, 0.07)`
  - `--kz-hero-event-line: rgba(10, 10, 10, 0.16)`
  - `--kz-hero-event-bg: transparent`
  - `--kz-hero-event-width: 1240px`
  - `--kz-hero-event-gap: clamp(32px, 5vw, 80px)`
  - `--kz-hero-event-pad-y: clamp(72px, 9vw, 140px)`
  - `--kz-hero-event-gutter: clamp(16px, 4vw, 40px)`
  - `--kz-hero-event-radius: 16px`
  - `--kz-hero-event-ratio: 4 / 5`
  - `--kz-hero-event-size: clamp(36px, 4.4vw, 60px)`
  - `--kz-hero-event-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace`
  - `--kz-hero-event-ease: cubic-bezier(0.22, 1, 0.36, 1)`
- Attributes:
  - `data-unit` (e.g. `days`, `hours`, `minutes`, `seconds`)
- Lifecycle: `kodza:init` / `kodza:destroy` on `document`, with `{ detail: { root } }` to target a container.

## 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-hero-event {
    --kz-hero-event-ink: #f2f2f0;
    --kz-hero-event-paper: #0a0a0a;
    --kz-hero-event-dim: rgba(242, 242, 240, 0.64);
    --kz-hero-event-faint: rgba(242, 242, 240, 0.5);
    --kz-hero-event-soft: rgba(242, 242, 240, 0.1);
    --kz-hero-event-line: rgba(242, 242, 240, 0.18);
  }
}
```

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

Its images have dark versions next to them (`kz-columns-1400.webp` → `kz-columns-dark-1400.webp`). To swap them on a dark page: `<picture><source media="(prefers-color-scheme: dark)" srcset="…-dark-….webp"><img …></picture>`.

## Use it

### Plain HTML page

- CSS: `kodza/kodza-hero-event.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-hero-event.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.
- JS: `kodza/kodza-hero-event.js`, loaded with `<script src="kodza/kodza-hero-event.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-hero-event.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-hero-event.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">`.
- Images: the artifact blocks every other host, `kodza.dev` included, without an error. Embed each one as a `data:` URI, with a command if you can run one (`curl -s <url> | base64`; the 1400 px files weigh 10 to 30 KB), never by typing base64 out. If you can't run commands, keep the `<img>` with its `width` and `height`, and tell the user the picture stays blank inside the artifact.
- 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.

### 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-hero-event', $uri . 'kodza-hero-event.css', [], filemtime($dir . 'kodza-hero-event.css'));
    wp_enqueue_script('kodza-hero-event', $uri . 'kodza-hero-event.js', [], filemtime($dir . 'kodza-hero-event.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>`).

#### 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.

### Shopify

- Files: `assets/kodza-hero-event.css` and `assets/kodza-hero-event.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-hero-event.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-hero-event.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`.

### React / Next.js

- Files, side by side (e.g. in `components/kodza/`): `HeroEvent.tsx` (below), the CSS block under Code saved as `hero-event.css` and the JS block as `hero-event.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { HeroEvent } from '@/components/kodza/HeroEvent';` then `<HeroEvent />`. Props: `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-hero-event-ink': … }}`), `className`, `style` and the other props of its `<section>` (`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 './hero-event.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.

```tsx
'use client';
// Kodza — Hero Event, for React. From https://kodza.dev/components/hero-event/
// 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: hero-event.css and hero-event.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.
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './hero-event.css';

export type HeroEventProps = Omit<ComponentPropsWithoutRef<'section'>, "children" | "vars"> & {
  /** Settings, as CSS variables on the root */
  vars?: {
    /** default: #0a0a0a */
    "--kz-hero-event-ink"?: string | number;
    /** default: #f2f2f0 */
    "--kz-hero-event-paper"?: string | number;
    /** default: rgba(10, 10, 10, 0.62) */
    "--kz-hero-event-dim"?: string | number;
    /** default: rgba(10, 10, 10, 0.6) */
    "--kz-hero-event-faint"?: string | number;
    /** default: rgba(10, 10, 10, 0.07) */
    "--kz-hero-event-soft"?: string | number;
    /** default: rgba(10, 10, 10, 0.16) */
    "--kz-hero-event-line"?: string | number;
    /** default: transparent */
    "--kz-hero-event-bg"?: string | number;
    /** default: 1240px */
    "--kz-hero-event-width"?: string | number;
    /** default: clamp(32px, 5vw, 80px) */
    "--kz-hero-event-gap"?: string | number;
    /** default: clamp(72px, 9vw, 140px) */
    "--kz-hero-event-pad-y"?: string | number;
    /** default: clamp(16px, 4vw, 40px) */
    "--kz-hero-event-gutter"?: string | number;
    /** default: 16px */
    "--kz-hero-event-radius"?: string | number;
    /** default: 4 / 5 */
    "--kz-hero-event-ratio"?: string | number;
    /** default: clamp(36px, 4.4vw, 60px) */
    "--kz-hero-event-size"?: string | number;
    /** default: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace */
    "--kz-hero-event-mono"?: string | number;
    /** default: cubic-bezier(0.22, 1, 0.36, 1) */
    "--kz-hero-event-ease"?: string | number;
  };
  className?: string;
};

export function HeroEvent({ vars, className, style, ...rest }: HeroEventProps) {
  const ref = useRef<ComponentRef<'section'>>(null);
  const classes = ["kodza-hero-event", 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('./hero-event.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 (
    <section key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <div className="kodza-hero-event__inner">
        <div className="kodza-hero-event__copy">
          <p className="kodza-hero-event__eyebrow">
            <span className="kodza-hero-event__rise"><time className="kodza-hero-event__start" dateTime="2026-11-19T09:30:00+00:00">19 Nov 2026, 09:30</time>–<time className="kodza-hero-event__end" dateTime="2026-11-19T18:00:00+00:00">18:00</time> · Lisbon</span>
          </p>
          <h1 className="kodza-hero-event__title">
            <span className="kodza-hero-event__line">
              <span className="kodza-hero-event__rise">Works on</span>
            </span>
            {' '}
            <span className="kodza-hero-event__line">
              <span className="kodza-hero-event__rise">my machine.</span>
            </span>
          </h1>
          <p className="kodza-hero-event__lead">Twelve talks on the bugs nobody tweets about. One room, no keynote about synergy.</p>
          <div className="kodza-hero-event__status">
            <div className="kodza-hero-event__state kodza-hero-event__state--count">
              <span className="kodza-hero-event__unit">
                <span className="kodza-hero-event__label">Days</span>
                <span className="kodza-hero-event__value" data-unit="days">00</span>
              </span>
              {' '}
              <span className="kodza-hero-event__unit">
                <span className="kodza-hero-event__label">Hours</span>
                <span className="kodza-hero-event__value" data-unit="hours">00</span>
              </span>
              {' '}
              <span className="kodza-hero-event__unit">
                <span className="kodza-hero-event__label">Minutes</span>
                <span className="kodza-hero-event__value" data-unit="minutes">00</span>
              </span>
              {' '}
              <span className="kodza-hero-event__unit">
                <span className="kodza-hero-event__label">Seconds</span>
                <span className="kodza-hero-event__value" data-unit="seconds">00</span>
              </span>
            </div>
            <p className="kodza-hero-event__state kodza-hero-event__state--live"><span className="kodza-hero-event__dot" aria-hidden="true" />Live now</p>
            <p className="kodza-hero-event__state kodza-hero-event__state--over">
              <a className="kodza-hero-event__replay" href="#">See the replay<svg className="kodza-hero-event__arrow" viewBox="0 0 16 16" aria-hidden="true"> <path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /> </svg></a>
            </p>
          </div>
          <div className="kodza-hero-event__actions">
            <a className="kodza-hero-event__button kodza-hero-event__button--ink kodza-hero-event__ticket" href="#">Get a ticket<svg className="kodza-hero-event__arrow" viewBox="0 0 16 16" aria-hidden="true"> <path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /> </svg></a>
            {' '}
            <a className="kodza-hero-event__button kodza-hero-event__button--soft" href="#">Schedule</a>
          </div>
        </div>
        <figure className="kodza-hero-event__media">
          <div className="kodza-hero-event__frame">
            <div className="kodza-hero-event__curtain">
              <div className="kodza-hero-event__hold">
                <img src="https://kodza.dev/media/kz-columns-1400.webp" alt="A row of concrete columns in a bare hall" width="1120" height="1400" />
              </div>
            </div>
          </div>
          <figcaption className="kodza-hero-event__caption">fig. 01 — the room, before the Wi-Fi gives up</figcaption>
        </figure>
      </div>
    </section>
  );
}
```

## Code

```html
<section class="kodza-hero-event">
  <div class="kodza-hero-event__inner">
    <div class="kodza-hero-event__copy">
      <p class="kodza-hero-event__eyebrow"><span class="kodza-hero-event__rise"><time class="kodza-hero-event__start" datetime="2026-11-19T09:30:00+00:00">19 Nov 2026, 09:30</time>–<time class="kodza-hero-event__end" datetime="2026-11-19T18:00:00+00:00">18:00</time> · Lisbon</span></p>
      <h1 class="kodza-hero-event__title"><span class="kodza-hero-event__line"><span class="kodza-hero-event__rise">Works on</span></span> <span class="kodza-hero-event__line"><span class="kodza-hero-event__rise">my machine.</span></span></h1>
      <p class="kodza-hero-event__lead">Twelve talks on the bugs nobody tweets about. One room, no keynote about synergy.</p>
      <div class="kodza-hero-event__status">
        <div class="kodza-hero-event__state kodza-hero-event__state--count">
          <span class="kodza-hero-event__unit"><span class="kodza-hero-event__label">Days</span><span class="kodza-hero-event__value" data-unit="days">00</span></span>
          <span class="kodza-hero-event__unit"><span class="kodza-hero-event__label">Hours</span><span class="kodza-hero-event__value" data-unit="hours">00</span></span>
          <span class="kodza-hero-event__unit"><span class="kodza-hero-event__label">Minutes</span><span class="kodza-hero-event__value" data-unit="minutes">00</span></span>
          <span class="kodza-hero-event__unit"><span class="kodza-hero-event__label">Seconds</span><span class="kodza-hero-event__value" data-unit="seconds">00</span></span>
        </div>
        <p class="kodza-hero-event__state kodza-hero-event__state--live"><span class="kodza-hero-event__dot" aria-hidden="true"></span>Live now</p>
        <p class="kodza-hero-event__state kodza-hero-event__state--over"><a class="kodza-hero-event__replay" href="#">See the replay<svg class="kodza-hero-event__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /></svg></a></p>
      </div>
      <div class="kodza-hero-event__actions">
        <a class="kodza-hero-event__button kodza-hero-event__button--ink kodza-hero-event__ticket" href="#">Get a ticket<svg class="kodza-hero-event__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /></svg></a>
        <a class="kodza-hero-event__button kodza-hero-event__button--soft" href="#">Schedule</a>
      </div>
    </div>
    <figure class="kodza-hero-event__media">
      <div class="kodza-hero-event__frame"><div class="kodza-hero-event__curtain"><div class="kodza-hero-event__hold"><img src="https://kodza.dev/media/kz-columns-1400.webp" alt="A row of concrete columns in a bare hall" width="1120" height="1400" /></div></div></div>
      <figcaption class="kodza-hero-event__caption">fig. 01 — the room, before the Wi-Fi gives up</figcaption>
    </figure>
  </div>
</section>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Hero Event
   An event hero: the date and place in mono above a tight headline, a live countdown under a
   hairline, a ticket button and a 4:5 picture of the venue. The dates come from the datetime of
   the two time elements, time zone included. Counting down, every digit that changes falls out
   of its window; at the start the count makes way for "Live now", and after the end for a link
   to the replay. On arrival the lines rise out of their masks while the picture opens from the
   top edge down, as in Hero Split. Everything is tuned with the --kz-hero-event-* variables. */
.kodza-hero-event {
  --kz-hero-event-ink: #0a0a0a;
  --kz-hero-event-paper: #f2f2f0;
  --kz-hero-event-dim: rgba(10, 10, 10, 0.62);
  --kz-hero-event-faint: rgba(10, 10, 10, 0.6);
  --kz-hero-event-soft: rgba(10, 10, 10, 0.07);
  --kz-hero-event-line: rgba(10, 10, 10, 0.16);
  --kz-hero-event-bg: transparent;
  --kz-hero-event-width: 1240px;
  --kz-hero-event-gap: clamp(32px, 5vw, 80px);
  --kz-hero-event-pad-y: clamp(72px, 9vw, 140px);
  --kz-hero-event-gutter: clamp(16px, 4vw, 40px);
  --kz-hero-event-radius: 16px;
  --kz-hero-event-ratio: 4 / 5;
  --kz-hero-event-size: clamp(36px, 4.4vw, 60px);
  --kz-hero-event-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --kz-hero-event-ease: cubic-bezier(0.22, 1, 0.36, 1);

  container: kodza-hero-event / inline-size;
  box-sizing: border-box;
  width: 100%;
  padding-block: var(--kz-hero-event-pad-y);
  padding-left: max(var(--kz-hero-event-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--kz-hero-event-gutter), env(safe-area-inset-right, 0px));
  background: var(--kz-hero-event-bg);
  color: var(--kz-hero-event-ink);
}

.kodza-hero-event__inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--kz-hero-event-gap);
  align-items: center;
  max-width: var(--kz-hero-event-width);
  margin: 0 auto;
}

.kodza-hero-event__copy {
  min-width: 0;
}

.kodza-hero-event__eyebrow {
  margin: 0 0 22px;
  overflow: hidden;
  font-family: var(--kz-hero-event-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--kz-hero-event-faint);
}

.kodza-hero-event__title {
  margin: 0 0 26px;
  font-size: clamp(40px, 6.2vw, 92px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--kz-hero-event-ink);
}

/* Each line is its own mask: the words rise from behind its bottom edge */
.kodza-hero-event__line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.kodza-hero-event__rise {
  display: block;
}

.kodza-hero-event__lead {
  max-width: 30ch;
  margin: 0 0 36px;
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.55;
  color: var(--kz-hero-event-dim);
  text-wrap: pretty;
}

/* The status: one cell under a hairline, where the count, "Live now" and the replay link take
   turns. It needs the script, so it waits for it; the date above says it all without. */
.kodza-hero-event__status {
  position: relative;
  display: none;
  max-width: 460px;
  margin: 0 0 36px;
  padding: 18px 0 0.08em;
  overflow: clip;
}

.kodza-hero-event.is-ready .kodza-hero-event__status {
  display: grid;
}

.kodza-hero-event__status::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1; /* the edge the states roll past, drawn over them */
  height: 1px;
  background: var(--kz-hero-event-line);
  transform-origin: left;
}

.kodza-hero-event__state {
  grid-area: 1 / 1;
  align-self: end;
  margin: 0;
  visibility: hidden;
}

.kodza-hero-event__state.is-current {
  visibility: visible;
}

.kodza-hero-event__state--count {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kodza-hero-event__unit {
  display: grid;
  justify-items: start;
  gap: 10px;
  min-width: 0;
}

.kodza-hero-event__label {
  font-family: var(--kz-hero-event-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kz-hero-event-faint);
}

.kodza-hero-event__value {
  display: inline-flex;
  font-size: var(--kz-hero-event-size);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* Each digit in its own window, where it falls */
.kodza-hero-event__digit {
  display: inline-grid;
  overflow: hidden;
  padding-block: 0.06em;
  margin-block: -0.06em;
}

.kodza-hero-event__digit > span {
  grid-area: 1 / 1;
}

.kodza-hero-event__state--live,
.kodza-hero-event__state--over {
  font-size: calc(var(--kz-hero-event-size) * 0.8);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.kodza-hero-event__state--live {
  display: flex;
  align-items: center;
  gap: 0.34em;
}

/* A filled dot that breathes: a soft ring leaves it, again and again */
.kodza-hero-event__dot {
  position: relative;
  flex: none;
  width: 0.3em;
  height: 0.3em;
  border-radius: 50%;
  background: currentColor;
}

.kodza-hero-event__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
}

.kodza-hero-event__state--live.is-current .kodza-hero-event__dot::after {
  animation: kodza-hero-event-breathe 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes kodza-hero-event-breathe {
  0% {
    opacity: 0.35;
    transform: scale(1);
  }

  70%,
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

.kodza-hero-event__replay {
  display: inline-flex;
  align-items: center;
  gap: 0.24em;
  border-radius: 6px;
  color: var(--kz-hero-event-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
  text-decoration-color: var(--kz-hero-event-line);
  transition: text-decoration-color 0.3s var(--kz-hero-event-ease);
}

.kodza-hero-event__replay .kodza-hero-event__arrow {
  width: 0.62em;
  height: 0.62em;
  stroke-width: 1.6;
}

.kodza-hero-event__replay:focus-visible {
  outline: 2px solid var(--kz-hero-event-ink);
  outline-offset: 4px;
}

.kodza-hero-event__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kodza-hero-event__button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.kodza-hero-event__button:focus-visible {
  outline: 2px solid var(--kz-hero-event-ink);
  outline-offset: 3px;
}

/* After the end, there is no ticket left to sell */
.kodza-hero-event.is-over .kodza-hero-event__ticket {
  display: none;
}

/* Solid: the arrow steps forward on hover */
.kodza-hero-event__button--ink {
  background: var(--kz-hero-event-ink);
  color: var(--kz-hero-event-paper);
}

.kodza-hero-event__arrow {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s var(--kz-hero-event-ease);
}

/* Soft: ink rises from the bottom edge on hover */
.kodza-hero-event__button--soft {
  background: var(--kz-hero-event-soft);
  color: var(--kz-hero-event-ink);
  transition: color 0.4s var(--kz-hero-event-ease);
}

.kodza-hero-event__button--soft::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--kz-hero-event-ink);
  transform: translateY(101%);
  transition: transform 0.4s var(--kz-hero-event-ease);
}

@media (hover: hover) {
  .kodza-hero-event__button--ink:hover .kodza-hero-event__arrow,
  .kodza-hero-event__replay:hover .kodza-hero-event__arrow {
    transform: translateX(4px);
  }

  .kodza-hero-event__replay:hover {
    text-decoration-color: currentColor;
  }

  .kodza-hero-event__button--soft:hover {
    color: var(--kz-hero-event-paper);
  }

  .kodza-hero-event__button--soft:hover::before {
    transform: none;
  }
}

.kodza-hero-event__media {
  min-width: 0;
  margin: 0;
}

/* The curtain: the middle layer slides down from above while the inner one slides up into
   place, so the picture is uncovered from the top edge down and never moves itself */
.kodza-hero-event__frame {
  max-width: 100%;
  aspect-ratio: var(--kz-hero-event-ratio);
  overflow: hidden;
  border-radius: var(--kz-hero-event-radius);
}

.kodza-hero-event__curtain,
.kodza-hero-event__hold {
  height: 100%;
}

.kodza-hero-event__curtain {
  overflow: hidden;
}

.kodza-hero-event__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kodza-hero-event__caption {
  margin-top: 12px;
  font-family: var(--kz-hero-event-mono);
  font-size: 12.5px;
  color: var(--kz-hero-event-faint);
}

.kodza-hero-event__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Waiting for its entrance: the script sets is-shown and plays the motion in the same frame */
@media (prefers-reduced-motion: no-preference) {
  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__rise {
    transform: translateY(105%);
  }

  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__curtain {
    transform: translateY(-100%);
  }

  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__hold {
    transform: translateY(100%);
  }

  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__status::before {
    transform: scaleX(0);
  }

  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__state {
    transform: translateY(110%);
  }

  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__lead,
  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__actions,
  .kodza-hero-event.is-ready:not(.is-shown) .kodza-hero-event__caption {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* One column: the picture goes under the words, wider than tall, and the buttons share the row */
@container kodza-hero-event (max-width: 700px) {
  .kodza-hero-event__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .kodza-hero-event__frame {
    aspect-ratio: 4 / 3;
  }

  .kodza-hero-event__button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kodza-hero-event *,
  .kodza-hero-event *::before,
  .kodza-hero-event *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .kodza-hero-event__state--live.is-current .kodza-hero-event__dot::after {
    animation: none;
  }
}

/* kodza-guard e1d00bd60af0 — 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-hero-event__eyebrow):not(#_),
:where(.kodza-hero-event__start):not(#_),
:where(.kodza-hero-event__end):not(#_),
:where(.kodza-hero-event__title):not(#_),
:where(.kodza-hero-event__lead):not(#_),
:where(.kodza-hero-event__media):not(#_),
:where(.kodza-hero-event__caption):not(#_),
:where(.kodza-hero-event__hold img:where(:not([class*="kodza-"]))):not(#_) {
  transition-duration: revert;
}

:where(.kodza-hero-event__state):not(#_) {
  font-size: revert;
  font-weight: revert;
  line-height: revert;
  letter-spacing: revert;
}

:where(.kodza-hero-event__replay):not(#_) {
  outline: revert;
  outline-offset: revert;
}

:where(.kodza-hero-event__button):not(#_) {
  outline: revert;
  transition: revert;
  outline-offset: revert;
}

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

.kodza-hero-event__inner:not(#_),
.kodza-hero-event__copy:not(#_),
.kodza-hero-event__rise:not(#_),
.kodza-hero-event__line:not(#_),
.kodza-hero-event__status:not(#_),
.kodza-hero-event__unit:not(#_),
.kodza-hero-event__label:not(#_),
.kodza-hero-event__value:not(#_),
.kodza-hero-event__digit:not(#_),
.kodza-hero-event__dot:not(#_),
.kodza-hero-event__sr:not(#_),
.kodza-hero-event__actions:not(#_),
.kodza-hero-event__frame:not(#_),
.kodza-hero-event__curtain:not(#_),
.kodza-hero-event__hold:not(#_),
.kodza-hero-event__digit span:where(:not([class*="kodza-"])):not(#_) {
  box-sizing: revert;
}

.kodza-hero-event__eyebrow: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;
  font-style: revert;
  line-height: 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;
  transition-delay: revert;
}

.kodza-hero-event__start:not(#_),
.kodza-hero-event__end:not(#_),
.kodza-hero-event__hold img: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;
  transition-property: revert;
  transition-timing-function: revert;
  transition-delay: revert;
}

.kodza-hero-event__title: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;
  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;
  transition-property: revert;
  transition-timing-function: revert;
  transition-delay: revert;
}

.kodza-hero-event__lead: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-height: revert;
  font-family: revert;
  font-weight: revert;
  font-style: 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;
  transition-delay: revert;
}

.kodza-hero-event__state: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-style: 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;
  transition-delay: revert;
}

.kodza-hero-event__replay: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;
  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-hero-event__arrow: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-hero-event__button:not(#_) {
  margin: revert;
  list-style: revert;
  float: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-style: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-hero-event__media: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;
  transition-delay: revert;
}

.kodza-hero-event__caption:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: 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;
  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;
  transition-delay: revert;
}

.kodza-hero-event__eyebrow:not(#_):where(:not([hidden])),
.kodza-hero-event__start:not(#_):where(:not([hidden])),
.kodza-hero-event__end:not(#_):where(:not([hidden])),
.kodza-hero-event__title:not(#_):where(:not([hidden])),
.kodza-hero-event__lead:not(#_):where(:not([hidden])),
.kodza-hero-event__arrow:not(#_):where(:not([hidden])),
.kodza-hero-event__media:not(#_):where(:not([hidden])),
.kodza-hero-event__caption:not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-hero-event__eyebrow:not(#_):where([hidden]),
.kodza-hero-event__start:not(#_):where([hidden]),
.kodza-hero-event__end:not(#_):where([hidden]),
.kodza-hero-event__title:not(#_):where([hidden]),
.kodza-hero-event__lead:not(#_):where([hidden]),
.kodza-hero-event__arrow:not(#_):where([hidden]),
.kodza-hero-event__media:not(#_):where([hidden]),
.kodza-hero-event__caption:not(#_):where([hidden]) {
  display: none;
}

.kodza-hero-event__status:not(#_)::before,
.kodza-hero-event__dot: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-hero-event__eyebrow:not(#_) {
  margin: 0 0 22px;
  font-family: var(--kz-hero-event-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--kz-hero-event-faint);
}

.kodza-hero-event__title:not(#_) {
  margin: 0 0 26px;
  font-size: clamp(40px, 6.2vw, 92px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--kz-hero-event-ink);
}

.kodza-hero-event__lead:not(#_) {
  max-width: 30ch;
  margin: 0 0 36px;
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.55;
  color: var(--kz-hero-event-dim);
}

.kodza-hero-event__state:where(p):not(#_) {
  margin: 0;
}

.kodza-hero-event__state--live:not(#_),
.kodza-hero-event__state--over:not(#_) {
  font-size: calc(var(--kz-hero-event-size) * 0.8);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.kodza-hero-event__state--live:not(#_) {
  display: flex;
}

.kodza-hero-event__replay:not(#_) {
  display: inline-flex;
  border-radius: 6px;
  color: var(--kz-hero-event-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
  text-decoration-color: var(--kz-hero-event-line);
  transition: text-decoration-color 0.3s var(--kz-hero-event-ease);
}

.kodza-hero-event__replay:focus-visible:not(#_) {
  outline: 2px solid var(--kz-hero-event-ink);
  outline-offset: 4px;
}

.kodza-hero-event__button:not(#_) {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}

.kodza-hero-event__button:focus-visible:not(#_) {
  outline: 2px solid var(--kz-hero-event-ink);
  outline-offset: 3px;
}

.kodza-hero-event.is-over .kodza-hero-event__ticket:not(#_) {
  display: none;
}

.kodza-hero-event__button--ink:not(#_) {
  background: var(--kz-hero-event-ink);
  color: var(--kz-hero-event-paper);
}

.kodza-hero-event__arrow:not(#_) {
  transition: transform 0.3s var(--kz-hero-event-ease);
}

.kodza-hero-event__button--soft:not(#_) {
  background: var(--kz-hero-event-soft);
  color: var(--kz-hero-event-ink);
  transition: color 0.4s var(--kz-hero-event-ease);
}

@media (hover: hover) {
  .kodza-hero-event__replay:hover:not(#_) {
    text-decoration-color: currentColor;
  }
}

@media (hover: hover) {
  .kodza-hero-event__button--soft:hover:not(#_) {
    color: var(--kz-hero-event-paper);
  }
}

.kodza-hero-event__media:not(#_) {
  margin: 0;
}

.kodza-hero-event__frame img:not(#_) {
  display: block;
}

.kodza-hero-event__caption:not(#_) {
  margin-top: 12px;
  font-family: var(--kz-hero-event-mono);
  font-size: 12.5px;
  color: var(--kz-hero-event-faint);
}

@media (prefers-reduced-motion: reduce) {
  .kodza-hero-event *:where(p, time, h1, a, svg, figure, img, figcaption):not(#_) {
    transition-duration: 0.01ms !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 — Hero Event
// Counts down to the datetime of __start, its time zone included: every digit that changes
// falls out of its window as the next one comes from above (the Countdown engine). At the
// start, 00 lands, then the count rises away under the hairline for "Live now"; after the end
// (__end), "Live now" makes way for the replay link and the ticket button folds away. Change a
// datetime and it follows. The entrance is Hero Split's, played once the section is in view, its
// picture decoded and the fonts in; "kodza:replay" plays it again.
(() => {
  const SELECTOR = '.kodza-hero-event';
  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
  const GLIDE = 'cubic-bezier(0.6, 0, 0.1, 1)'; // slow start, long settle
  const SOFT = 'cubic-bezier(0.25, 1, 0.5, 1)';
  const EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';
  const ROLL = 'cubic-bezier(0.65, 0, 0.35, 1)'; // the states take turns, no lurch at the start
  const SPAN = { days: 86400, hours: 3600, minutes: 60, seconds: 1 };

  const decoded = (root) => Promise.all([...root.querySelectorAll('img')].map((img) => img.decode().catch(() => {})));
  const when = (el) => new Date(el?.getAttribute('datetime') ?? '').getTime();

  // One instance, with its own state: two copies on a page never interfere. Everything it
  // starts is tied to `signal` (listeners get { signal }, observers and timers stop on its
  // 'abort' event), so kodza:destroy stops it all.
  function mount(root, signal) {
    const q = (s) => root.querySelector(s);
    const start = q('.kodza-hero-event__start');
    const end = q('.kodza-hero-event__end');
    const status = q('.kodza-hero-event__status');
    const ticket = q('.kodza-hero-event__ticket');
    const states = {
      count: q('.kodza-hero-event__state--count'),
      live: q('.kodza-hero-event__state--live'),
      over: q('.kodza-hero-event__state--over'),
    };
    const values = [...root.querySelectorAll('.kodza-hero-event__value')];
    const entrance = [];
    const motion = [];
    let state = '';
    let said = '';
    let timer = 0;

    const stop = (list) => {
      list.forEach((a) => a.cancel());
      list.length = 0;
    };
    const animate = (list, el, keyframes, options) => {
      if (!el) return null;
      const animation = el.animate(keyframes, { easing: GLIDE, fill: 'backwards', ...options });
      list.push(animation);
      return animation;
    };

    // Screen readers get the count as a sentence, refreshed once a minute, not every second
    states.count?.setAttribute('aria-hidden', 'true');
    const sr = Object.assign(document.createElement('span'), { className: 'kodza-hero-event__sr' });
    sr.setAttribute('role', 'timer');
    status?.append(sr);

    // A value is a row of digit windows; a digit that changes drops out, the new one comes from above.
    // Never more than two in a window: a digit still leaving goes at once, one still arriving
    // leaves from where it stands.
    const settle = (cell) => {
      const last = cell.lastElementChild;
      [...cell.children].forEach((el) => el !== last && el.remove());
      return last;
    };
    const show = (el, text, moving) => {
      const cells = [...el.children];
      if (cells.length !== text.length) {
        el.replaceChildren(...[...text].map((char) => {
          const cell = Object.assign(document.createElement('span'), { className: 'kodza-hero-event__digit' });
          cell.append(Object.assign(document.createElement('span'), { textContent: char }));
          return cell;
        }));
        return;
      }
      [...text].forEach((char, i) => {
        const cell = cells[i];
        const old = settle(cell);
        if (old.textContent === char) return;
        const next = Object.assign(document.createElement('span'), { textContent: char });
        cell.append(next);
        if (!moving || reduceMotion) return old.remove();
        const style = getComputedStyle(old);
        const y = new DOMMatrixReadOnly(style.transform).m42;
        const opacity = style.opacity;
        old.getAnimations().forEach((a) => a.cancel());
        const timing = { duration: 520, easing: EASE };
        old.animate([{ transform: `translateY(${y}px)`, opacity }, { transform: `translateY(${old.offsetHeight}px)`, opacity: 0 }], { ...timing, fill: 'forwards' }).finished.then(() => old.remove(), () => {});
        next.animate([{ transform: 'translateY(-100%)', opacity: 0 }, { transform: 'none', opacity: 1 }], timing);
      });
    };

    // The ticket button narrows to nothing, its gap with it, then leaves the row; it comes back
    // the same way. Both start from where it stands, if it was still on its way.
    const open = () => {
      const style = getComputedStyle(ticket);
      return { width: `${ticket.offsetWidth}px`, paddingLeft: style.paddingLeft, paddingRight: style.paddingRight, marginRight: style.marginRight, flexGrow: 0, flexShrink: 0, opacity: style.opacity };
    };
    const shut = () => {
      const gap = parseFloat(getComputedStyle(ticket.parentElement).columnGap) || 0;
      return { width: '0px', paddingLeft: '0px', paddingRight: '0px', marginRight: `${-gap}px`, flexGrow: 0, flexShrink: 0, opacity: 0 };
    };
    const fold = (from) => {
      if (!ticket) return root.classList.add('is-over');
      const folded = animate(motion, ticket, [from, shut()], { duration: 900, fill: 'forwards' });
      folded.finished.then(() => {
        root.classList.add('is-over');
        folded.cancel();
      }, () => {});
    };
    const unfold = (from) => {
      const to = open();
      if (from.width !== to.width) animate(motion, ticket, [from, to], { duration: 900 });
    };

    // One state at a time in the cell: the old one rises away under the hairline as the new one
    // comes up from below. A turn that comes before the last one has landed starts from where
    // everything stands: what was arriving goes back down, what was leaving comes back.
    const turn = (name, moving) => {
      if (name === state) return;
      const from = states[state];
      const to = states[name];
      const first = !state;
      const y = (el) => new DOMMatrixReadOnly(getComputedStyle(el).transform).m42;
      const going = new Map(motion.filter((a) => a.playState !== 'finished' && Object.values(states).includes(a.effect?.target)).map((a) => [a.effect.target, y(a.effect.target)]));
      const ticketFrom = ticket && (root.classList.contains('is-over') ? shut() : open());
      state = name;
      Object.values(states).forEach((el) => el?.classList.toggle('is-current', el === to));
      sr.hidden = name !== 'count';
      stop(motion);
      if (name !== 'over') root.classList.remove('is-over');
      if (first || !moving || reduceMotion) {
        if (name === 'over') root.classList.add('is-over');
        return;
      }
      // One strip, the height of the whole cell: the old state clears the hairline, the new one
      // starts below the bottom edge, both at the same speed
      const strip = { duration: 900, easing: ROLL };
      const height = status.clientHeight;
      if (from && !going.has(from)) going.set(from, 0);
      going.forEach((at, el) => {
        if (el === to) return;
        const away = at > 0 ? height : -height;
        animate(motion, el, [{ transform: `translateY(${at}px)`, visibility: 'visible' }, { transform: `translateY(${away}px)`, visibility: 'visible' }], strip);
      });
      animate(motion, to, [{ transform: `translateY(${going.get(to) ?? height}px)` }, { transform: 'none' }], strip);
      if (!ticket) return name === 'over' && fold();
      if (name === 'over') fold(ticketFrom);
      else unfold(ticketFrom);
    };

    const schedule = () => {
      if (state !== 'over') timer = setTimeout(tick, 1000 - (Date.now() % 1000) + 10);
    };
    const tick = (moving = true) => {
      clearTimeout(timer);
      const begins = when(start);
      if (Number.isNaN(begins)) return;
      let ends = when(end);
      if (Number.isNaN(ends) || ends < begins) ends = begins;
      let left = Math.max(0, Math.round((begins - Date.now()) / 1000));
      const parts = {};
      Object.entries(SPAN).forEach(([unit, span]) => {
        parts[unit] = Math.floor(left / span);
        left -= parts[unit] * span;
      });
      values.forEach((el) => show(el, String(parts[el.dataset.unit] ?? 0).padStart(2, '0'), moving && state === 'count'));
      if (begins > Date.now()) {
        turn('count', moving);
        const sentence = parts.days + parts.hours + parts.minutes
          ? `${parts.days} days, ${parts.hours} hours, ${parts.minutes} minutes left`
          : 'Less than a minute left';
        if (sentence !== said) sr.textContent = said = sentence;
        return schedule();
      }
      const next = Date.now() >= ends ? 'over' : 'live';
      // At zero, 00 lands first, then the next state takes over
      if (state === 'count' && moving && !reduceMotion) {
        timer = setTimeout(() => {
          turn(next, true);
          schedule();
        }, 900);
        return;
      }
      turn(next, moving);
      schedule();
    };

    tick(false);
    const observer = new MutationObserver(() => tick());
    [start, end].forEach((el) => el && observer.observe(el, { attributes: true, attributeFilter: ['datetime'] }));
    signal.addEventListener('abort', () => {
      observer.disconnect();
      clearTimeout(timer);
      stop(motion);
      stop(entrance);
      sr.remove();
    });

    if (reduceMotion) return root.classList.add('is-shown');

    const rise = (el, delay, duration) => animate(entrance, el, [{ transform: 'translateY(105%)' }, { transform: 'none' }], { duration, delay });
    const play = async () => {
      await decoded(root);
      if (signal.aborted) return;
      stop(entrance);
      // A state change or a digit still on its way lands at once: the entrance brings the current state in
      stop(motion);
      values.forEach((el) => [...el.children].forEach((cell) => settle(cell)?.getAnimations().forEach((a) => a.cancel())));
      root.classList.toggle('is-over', state === 'over');
      root.classList.add('is-shown');
      rise(q('.kodza-hero-event__eyebrow .kodza-hero-event__rise'), 0, 1000);
      root.querySelectorAll('.kodza-hero-event__line .kodza-hero-event__rise').forEach((line, i) => rise(line, 110 + i * 125, 1170));
      // The curtain: both layers on transforms, the picture settles from a slight zoom
      animate(entrance, q('.kodza-hero-event__curtain'), [{ transform: 'translateY(-100%)' }, { transform: 'none' }], { duration: 1350, delay: 200 });
      animate(entrance, q('.kodza-hero-event__hold'), [{ transform: 'translateY(100%)' }, { transform: 'none' }], { duration: 1350, delay: 200 });
      animate(entrance, q('.kodza-hero-event__frame img'), [{ transform: 'scale(1.2)' }, { transform: 'none' }], { duration: 2000, delay: 200, easing: SOFT });
      // The hairline draws from the left, then the count rises from under it, unit by unit
      animate(entrance, status, [{ transform: 'scaleX(0)' }, { transform: 'none' }], { duration: 1100, delay: 760, pseudoElement: '::before' });
      const rising = state === 'count' ? [...states.count.children] : [states[state]];
      rising.forEach((el, i) => animate(entrance, el, [{ transform: 'translateY(110%)' }, { transform: 'none' }], { duration: 1000, delay: 840 + i * 70 }));
      [q('.kodza-hero-event__lead'), q('.kodza-hero-event__actions')].forEach((el, i) => {
        animate(entrance, el, [{ opacity: 0, transform: 'translateY(20px)' }, { opacity: 1, transform: 'none' }], { duration: 900, delay: 700 + i * 110, easing: SOFT });
      });
      // The faint caption is fully there halfway up: never read half-faded
      animate(entrance, q('.kodza-hero-event__caption'), [{ opacity: 0, transform: 'translateY(20px)' }, { opacity: 1, offset: 0.5 }, { opacity: 1, transform: 'none' }], { duration: 900, delay: 920, easing: SOFT });
    };

    root.addEventListener('kodza:replay', play, { signal });
    const io = new IntersectionObserver((entries) => {
      if (!entries.some((entry) => entry.isIntersecting)) return;
      io.disconnect();
      play();
    }, { rootMargin: '0px 0px -15% 0px' });
    signal.addEventListener('abort', () => io.disconnect());
    Promise.all([document.fonts?.ready, decoded(root)]).then(() => {
      if (!signal.aborted) io.observe(root);
    });
  }

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