# Dimension Lines

> A hero dimensioned like a technical drawing: arrowed lines measure its real margins, columns, title and height, and recompute on resize. They open one by one on entry.

Backgrounds & textures · background, svg, blueprint, dimensions, measure, technical drawing, hero · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-25
Demo: https://kodza.dev/components/dimension-lines/

## Files

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

- [`kodza-dimension-lines.css`](https://kodza.dev/registry/dimension-lines/kodza-dimension-lines.css) · 13.2 KB
- [`kodza-dimension-lines.js`](https://kodza.dev/registry/dimension-lines/kodza-dimension-lines.js) · 16.1 KB
- [`kodza-dimension-lines.html`](https://kodza.dev/registry/dimension-lines/kodza-dimension-lines.html) · 1.1 KB · the markup, to adapt and paste into your page

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

```bash
curl -fsSL --create-dirs -o kodza/kodza-dimension-lines.css https://kodza.dev/registry/dimension-lines/kodza-dimension-lines.css
curl -fsSL --create-dirs -o kodza/kodza-dimension-lines.js https://kodza.dev/registry/dimension-lines/kodza-dimension-lines.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: `[data-kodza-dimension-lines]`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-dimension-lines-bg: #f2f2f0` — the paper
  - `--kz-dimension-lines-ink: #0a0a0a` — the lines, the text, the button
  - `--kz-dimension-lines-muted: rgba(10, 10, 10, 0.62)`
  - `--kz-dimension-lines-lines: 0.4` — opacity of the dimension lines and arrows, 0 to 1
  - `--kz-dimension-lines-guides: 0.09` — opacity of the construction lines
  - `--kz-dimension-lines-values: 0.62` — opacity of the values
  - `--kz-dimension-lines-height: 600px`
  - `--kz-dimension-lines-width: 1152px` — the text column
  - `--kz-dimension-lines-side: clamp(20px, 5vw, 64px)`
- Attributes:
  - `data-kodza-dimension-lines`
- 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-dimension-lines {
    --kz-dimension-lines-bg: #0a0a0a;
    --kz-dimension-lines-ink: #f2f2f0;
    --kz-dimension-lines-muted: rgba(242, 242, 240, 0.62);
    --kz-dimension-lines-lines: 0.34;
    --kz-dimension-lines-guides: 0.08;
  }
}
```

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

## Use it

### Plain HTML page

- CSS: `kodza/kodza-dimension-lines.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-dimension-lines.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-dimension-lines.js`, loaded with `<script src="kodza/kodza-dimension-lines.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-dimension-lines.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-dimension-lines.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.

### 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-dimension-lines', $uri . 'kodza-dimension-lines.css', [], filemtime($dir . 'kodza-dimension-lines.css'));
    wp_enqueue_script('kodza-dimension-lines', $uri . 'kodza-dimension-lines.js', [], filemtime($dir . 'kodza-dimension-lines.js'), true);
  });
  ```
  Scoped to `kodza-` classes, the CSS never touches the theme. One copy of the JS, whatever the number of blocks.
- No access to the theme files? The CSS can also go, as it is, in **Appearance → Customize → Additional CSS** (classic theme) or **Styles → Additional CSS** in the Site Editor (block theme).
- Theme with AJAX page transitions: fire `kodza:init` on the new content after each swap (and `kodza:destroy` on the old one).
- Performance plugin (WP Rocket, LiteSpeed Cache, Perfmatters…) with **Delay JavaScript execution** turned on: add `kodza` to the scripts it must not delay. Otherwise the component waits for the visitor's first scroll, tap or mouse move, and that first click can be lost.
- Colours: it takes the colour of the text around it (or keeps its own monochrome): nothing to point at the theme.
- WordPress turns straight quotes and `--` into typographic ones in the text of a Custom HTML block (not inside `<code>` or `<pre>`).
- Put it in a full-width Group. Your own text goes inside __content (title in __title, the rest in __side): the dimensions measure whatever is there. Set --kz-dimension-lines-bg and --kz-dimension-lines-ink to your theme's colours.

#### 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-dimension-lines.css` and `assets/kodza-dimension-lines.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-dimension-lines.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-dimension-lines.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/`): `DimensionLines.tsx` (below), the CSS block under Code saved as `dimension-lines.css` and the JS block as `dimension-lines.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { DimensionLines } from '@/components/kodza/DimensionLines';` then `<DimensionLines />`. Props: `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-dimension-lines-bg': … }}`), `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 './dimension-lines.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 — Dimension Lines, for React. From https://kodza.dev/components/dimension-lines/
// 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: dimension-lines.css and dimension-lines.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 './dimension-lines.css';

export type DimensionLinesProps = Omit<ComponentPropsWithoutRef<'section'>, "children" | "vars"> & {
  /** Settings, as CSS variables on the root */
  vars?: {
    /** the paper — default: #f2f2f0 */
    "--kz-dimension-lines-bg"?: string | number;
    /** the lines, the text, the button — default: #0a0a0a */
    "--kz-dimension-lines-ink"?: string | number;
    /** default: rgba(10, 10, 10, 0.62) */
    "--kz-dimension-lines-muted"?: string | number;
    /** opacity of the dimension lines and arrows, 0 to 1 — default: 0.4 */
    "--kz-dimension-lines-lines"?: string | number;
    /** opacity of the construction lines — default: 0.09 */
    "--kz-dimension-lines-guides"?: string | number;
    /** opacity of the values — default: 0.62 */
    "--kz-dimension-lines-values"?: string | number;
    /** default: 600px */
    "--kz-dimension-lines-height"?: string | number;
    /** the text column — default: 1152px */
    "--kz-dimension-lines-width"?: string | number;
    /** default: clamp(20px, 5vw, 64px) */
    "--kz-dimension-lines-side"?: string | number;
  };
  className?: string;
};

export function DimensionLines({ vars, className, style, ...rest }: DimensionLinesProps) {
  const ref = useRef<ComponentRef<'section'>>(null);
  const classes = ["kodza-dimension-lines", 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('./dimension-lines.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 data-kodza-dimension-lines="" key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <div className="kodza-dimension-lines__content">
        <p className="kodza-dimension-lines__note">Sheet A-01 · scale 1:1 · units px</p>
        <p className="kodza-dimension-lines__eyebrow">{"Atelier Brun · interfaces & design systems · Nantes"}</p>
        <div className="kodza-dimension-lines__grid">
          <h1 className="kodza-dimension-lines__title">
            <span className="kodza-dimension-lines__line">Off by one?</span>
            {' '}
            <span className="kodza-dimension-lines__line">Not here.</span>
          </h1>
          <div className="kodza-dimension-lines__side">
            <p className="kodza-dimension-lines__lead">A two-person studio for product teams who spot a 1 px shift before their first coffee. Grids, specs and handoff files your developers never have to guess at.</p>
            <p className="kodza-dimension-lines__actions">
              <a className="kodza-dimension-lines__button" href="#">See the work</a>
              {' '}
              <a className="kodza-dimension-lines__button kodza-dimension-lines__button--ghost" href="#">How we measure</a>
            </p>
          </div>
        </div>
      </div>
    </section>
  );
}
```

## Code

```html
<section class="kodza-dimension-lines" data-kodza-dimension-lines>
  <div class="kodza-dimension-lines__content">
    <p class="kodza-dimension-lines__note">Sheet A-01 · scale 1:1 · units px</p>
    <p class="kodza-dimension-lines__eyebrow">Atelier Brun · interfaces &amp; design systems · Nantes</p>
    <div class="kodza-dimension-lines__grid">
      <h1 class="kodza-dimension-lines__title">
        <span class="kodza-dimension-lines__line">Off by one?</span>
        <span class="kodza-dimension-lines__line">Not here.</span>
      </h1>
      <div class="kodza-dimension-lines__side">
        <p class="kodza-dimension-lines__lead">A two-person studio for product teams who spot a 1 px shift before their first coffee. Grids, specs and handoff files your developers never have to guess at.</p>
        <p class="kodza-dimension-lines__actions">
          <a class="kodza-dimension-lines__button" href="#">See the work</a>
          <a class="kodza-dimension-lines__button kodza-dimension-lines__button--ghost" href="#">How we measure</a>
        </p>
      </div>
    </div>
  </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 — Dimension Lines
   A hero dimensioned like a drawing sheet: construction lines on the edges of the real content,
   a chain of dimensions that adds up the margins and the columns, the title's width and height,
   the section's height, every value read from the page. Drawn by the script on one SVG behind
   the text; without it, the hero stays as is. Tuned with the --kz-dimension-lines-* variables. */
.kodza-dimension-lines {
  --kz-dimension-lines-bg: #f2f2f0;             /* the paper */
  --kz-dimension-lines-ink: #0a0a0a;            /* the lines, the text, the button */
  --kz-dimension-lines-muted: rgba(10, 10, 10, 0.62);
  --kz-dimension-lines-lines: 0.4;              /* opacity of the dimension lines and arrows, 0 to 1 */
  --kz-dimension-lines-guides: 0.09;            /* opacity of the construction lines */
  --kz-dimension-lines-values: 0.62;            /* opacity of the values */
  --kz-dimension-lines-height: 600px;
  --kz-dimension-lines-width: 1152px;           /* the text column */
  --kz-dimension-lines-side: clamp(20px, 5vw, 64px);

  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: var(--kz-dimension-lines-height);
  padding: 120px var(--kz-dimension-lines-side) 72px;
  overflow: hidden;
  background: var(--kz-dimension-lines-bg);
  color: var(--kz-dimension-lines-ink);
}

/* The drawing: lines in one SVG, values in mono over it, all made by the script */
.kodza-dimension-lines__sheet {
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--kz-dimension-lines-ink);
  pointer-events: none;
}

.kodza-dimension-lines__sheet.is-waiting {
  visibility: hidden;
}

.kodza-dimension-lines__drawing {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  overflow: visible;
}

.kodza-dimension-lines__guide,
.kodza-dimension-lines__dim {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.kodza-dimension-lines__guide {
  stroke-dasharray: 1;
}

.kodza-dimension-lines__guide {
  stroke-opacity: var(--kz-dimension-lines-guides);
}

.kodza-dimension-lines__dim {
  stroke-opacity: var(--kz-dimension-lines-lines);
}

.kodza-dimension-lines__arrow {
  fill: currentColor;
  fill-opacity: var(--kz-dimension-lines-lines);
}

/* Under a value a line would cross: the paper again */
.kodza-dimension-lines__knock {
  fill: var(--kz-dimension-lines-bg);
}

.kodza-dimension-lines__value {
  position: absolute;
  overflow: hidden;
  transform: translate(-50%, -50%);
  opacity: var(--kz-dimension-lines-values);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 14px;
  letter-spacing: 0;
  white-space: nowrap;
}

.kodza-dimension-lines__value--up {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.kodza-dimension-lines__digits {
  display: block;
}

.kodza-dimension-lines__content {
  width: 100%;
  max-width: var(--kz-dimension-lines-width);
  margin: 0 auto;
}

/* The sheet's title block in the corner, on the content's right edge */
.kodza-dimension-lines__note {
  position: absolute;
  top: 40px;
  right: max(var(--kz-dimension-lines-side), calc((100% - var(--kz-dimension-lines-width)) / 2));
  margin: 0;
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.kodza-dimension-lines__eyebrow {
  margin: 0 0 20px;
  color: var(--kz-dimension-lines-muted);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  text-wrap: balance;
}

.kodza-dimension-lines__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: end;
  gap: 28px 64px;
}

.kodza-dimension-lines__title {
  margin: 0;
  font-size: clamp(44px, 6.6vw, 92px);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.kodza-dimension-lines__line {
  display: block;
}

.kodza-dimension-lines__lead {
  max-width: 30em;
  margin: 0 0 24px;
  color: var(--kz-dimension-lines-muted);
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.5;
  text-wrap: pretty;
}

.kodza-dimension-lines__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.kodza-dimension-lines__button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--kz-dimension-lines-ink);
  color: var(--kz-dimension-lines-bg);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.18s ease;
}

.kodza-dimension-lines__button:hover {
  opacity: 0.86;
}

.kodza-dimension-lines__button--ghost {
  background: var(--kz-dimension-lines-bg);
  color: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}

.kodza-dimension-lines__button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .kodza-dimension-lines {
    padding: 96px var(--kz-dimension-lines-side) 56px;
  }

  .kodza-dimension-lines__note {
    top: 28px;
  }

  .kodza-dimension-lines__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kodza-dimension-lines__button {
    transition: none;
  }
}

/* kodza-guard 225d444e00ae — 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-dimension-lines__button):not(#_) {
  outline: revert;
  box-shadow: revert;
  outline-offset: revert;
}

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

.kodza-dimension-lines__sheet:not(#_),
.kodza-dimension-lines__guide:not(#_),
.kodza-dimension-lines__dim:not(#_),
.kodza-dimension-lines__arrow:not(#_),
.kodza-dimension-lines__knock:not(#_),
.kodza-dimension-lines__value:not(#_),
.kodza-dimension-lines__digits:not(#_),
.kodza-dimension-lines__content:not(#_),
.kodza-dimension-lines__grid:not(#_),
.kodza-dimension-lines__line:not(#_),
.kodza-dimension-lines__side:not(#_) {
  box-sizing: revert;
}

.kodza-dimension-lines__drawing:not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  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-dimension-lines__note:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: 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;
  color: 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;
}

.kodza-dimension-lines__eyebrow:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-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;
}

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

.kodza-dimension-lines__lead:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-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;
}

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

.kodza-dimension-lines__button:not(#_) {
  border: revert;
  margin: revert;
  list-style: revert;
  float: revert;
  position: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: 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;
}

.kodza-dimension-lines__note:not(#_):where(:not([hidden])),
.kodza-dimension-lines__eyebrow:not(#_):where(:not([hidden])),
.kodza-dimension-lines__title:not(#_):where(:not([hidden])),
.kodza-dimension-lines__lead:not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-dimension-lines__note:not(#_):where([hidden]),
.kodza-dimension-lines__eyebrow:not(#_):where([hidden]),
.kodza-dimension-lines__title:not(#_):where([hidden]),
.kodza-dimension-lines__lead:not(#_):where([hidden]) {
  display: none;
}

/* 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-dimension-lines__drawing:not(#_) {
  position: absolute;
  display: block;
}

.kodza-dimension-lines__note:not(#_) {
  position: absolute;
  margin: 0;
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.kodza-dimension-lines__eyebrow:not(#_) {
  margin: 0 0 20px;
  color: var(--kz-dimension-lines-muted);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.kodza-dimension-lines__title:not(#_) {
  margin: 0;
  font-size: clamp(44px, 6.6vw, 92px);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.kodza-dimension-lines__lead:not(#_) {
  max-width: 30em;
  margin: 0 0 24px;
  color: var(--kz-dimension-lines-muted);
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.5;
}

.kodza-dimension-lines__actions:not(#_) {
  display: flex;
  margin: 0;
}

.kodza-dimension-lines__button:not(#_) {
  box-sizing: border-box;
  display: inline-flex;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--kz-dimension-lines-ink);
  color: var(--kz-dimension-lines-bg);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: opacity 0.18s ease;
}

.kodza-dimension-lines__button--ghost:not(#_) {
  background: var(--kz-dimension-lines-bg);
  color: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}

.kodza-dimension-lines__button:focus-visible:not(#_) {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-dimension-lines__button:not(#_) {
    transition: none;
  }
}
```

```js
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Dimension Lines
// Dimensions the hero like a drawing sheet, from its real layout: construction lines on the
// column edges, a chain of dimensions under the text (margins, columns, gap), the width of the
// title's longest line above it, the title's height and the section's in the side margins. Every
// value is measured, and measured again when the section reflows. The first time it is seen, the
// dimensions open one after another from their middle, their arrows pushing out.
(() => {
  const SELECTOR = '[data-kodza-dimension-lines]';
  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
  const SVG = 'http://www.w3.org/2000/svg';
  const ARROW = 7;      // arrowhead length, in px
  const SPREAD = 2.5;   // arrowhead half-width
  const LIFT = 9;       // a value sits this far off its line
  const GAP = 8;        // between a feature and its extension line
  const MARGIN = 44;    // a side margin narrower than this gets no vertical dimension
  const TOP = 72;       // the title's width is dimensioned only if its line fits this far down
  const OPEN = 560;     // ms for a dimension to open
  const STEP = 110;     // ms between two dimensions
  const DRAW = 'cubic-bezier(0.65, 0, 0.35, 1)';
  const ARRIVE = 'cubic-bezier(0.22, 1, 0.36, 1)';

  const format = (v) => String(Math.round(v)).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
  const crisp = (v) => Math.round(v - 0.5) + 0.5; // a 1 px line on one row of pixels, not across two

  // 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 sheet = document.createElement('div');
    sheet.className = 'kodza-dimension-lines__sheet';
    sheet.setAttribute('aria-hidden', 'true');
    const svg = document.createElementNS(SVG, 'svg');
    svg.setAttribute('class', 'kodza-dimension-lines__drawing');
    sheet.append(svg);
    root.prepend(sheet);

    const part = (name) => root.querySelector(`.kodza-dimension-lines__${name}`);
    const pen = document.createElement('canvas').getContext('2d');
    let entered = reduceMotion;
    let drawn = '';
    let animations = [];
    let guides = [];
    let dims = [];
    if (!entered) sheet.classList.add('is-waiting'); // nothing shows before it is drawn in

    // The layout, in the root's own pixels: a parent scaled by transform must not change a value
    const measure = () => {
      const box = root.getBoundingClientRect();
      const k = box.width / root.offsetWidth || 1;
      const rect = (el) => {
        if (!el) return null;
        const r = el.getBoundingClientRect();
        return { left: (r.left - box.left) / k, top: (r.top - box.top) / k, right: (r.right - box.left) / k, bottom: (r.bottom - box.top) / k };
      };
      // Each letter of a block of text, with its box on screen
      const letters = (el) => {
        const found = [];
        if (!el) return found;
        const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
        for (let node = walker.nextNode(); node; node = walker.nextNode()) {
          for (let i = 0; i < node.data.length; i += 1) {
            if (!node.data[i].trim()) continue;
            const range = document.createRange();
            range.setStart(node, i);
            range.setEnd(node, i + 1);
            const r = range.getBoundingClientRect();
            if (r.width) found.push({ node, char: node.data[i], r });
          }
        }
        return found;
      };
      // The title's ink, not its box: the box is as wide as its column, the longest line is not,
      // and a letter's box is wider than the letter itself (side bearings, letter spacing). The
      // first and last letters are measured in a canvas, in the title's font
      const ink = (el) => {
        const all = letters(el);
        if (!all.length) return null;
        const first = all.reduce((a, b) => (b.r.left < a.r.left ? b : a));
        const last = all.reduce((a, b) => (b.r.right > a.r.right ? b : a));
        const shape = (l) => {
          const css = getComputedStyle(l.node.parentElement);
          pen.font = `${css.fontStyle} ${css.fontWeight} ${css.fontSize} ${css.fontFamily}`;
          return pen.measureText(l.char);
        };
        const left = first.r.left - shape(first).actualBoundingBoxLeft * k;
        const right = last.r.left + shape(last).actualBoundingBoxRight * k;
        return right > left ? { left: (left - box.left) / k, right: (right - box.left) / k } : null;
      };
      // The lines of a block of text, where a construction line must not run through them
      const lines = (el) => {
        const rows = [];
        letters(el).forEach(({ r }) => {
          const row = rows.find((o) => r.top < o.bottom && r.bottom > o.top);
          if (row) {
            row.left = Math.min(row.left, r.left);
            row.right = Math.max(row.right, r.right);
          } else rows.push({ left: r.left, top: r.top, right: r.right, bottom: r.bottom });
        });
        return rows.map((o) => ({ left: (o.left - box.left) / k, top: (o.top - box.top) / k, right: (o.right - box.left) / k, bottom: (o.bottom - box.top) / k }));
      };
      const title = part('title');
      return {
        width: root.offsetWidth,
        height: root.offsetHeight,
        content: rect(part('content')),
        title: rect(title),
        side: rect(part('side')),
        ink: ink(title),
        eyebrow: lines(part('eyebrow')),
      };
    };

    const add = (cls, d, extra) => {
      const el = document.createElementNS(SVG, 'path');
      el.setAttribute('class', `kodza-dimension-lines__${cls}`);
      el.setAttribute('d', d);
      if (extra) Object.entries(extra).forEach(([name, value]) => el.setAttribute(name, value));
      svg.append(el);
      return el;
    };

    // A construction or extension line, drawn in from its first point at the entrance
    const guide = (cls, x1, y1, x2, y2) => {
      guides.push(add(cls, `M${x1} ${y1}L${x2} ${y2}`, { pathLength: 1 }));
    };

    // A dimension from a to b, along x (at height `at`) or along y (at `at` across): the line,
    // an arrow at each end when there is room for them, and the value off the line
    const dimension = (axis, a, b, at) => {
      const length = b - a;
      if (length < 4) return;
      const mid = (a + b) / 2;
      const across = crisp(at);
      const line = axis === 'x' ? add('dim', `M${a} ${across}H${b}`) : add('dim', `M${across} ${a}V${b}`);
      const arrows = [];
      if (length >= ARROW * 2 + 4) {
        const head = (tip, dir) => (axis === 'x'
          ? `M${tip} ${across}l${dir * ARROW} ${-SPREAD}v${SPREAD * 2}z`
          : `M${across} ${tip}l${-SPREAD} ${dir * ARROW}h${SPREAD * 2}z`);
        arrows.push([add('arrow', head(a, 1)), mid - a], [add('arrow', head(b, -1)), mid - b]);
      }
      const value = document.createElement('span');
      value.className = `kodza-dimension-lines__value${axis === 'y' ? ' kodza-dimension-lines__value--up' : ''}`;
      value.style.left = `${axis === 'x' ? mid : across - LIFT}px`;
      value.style.top = `${axis === 'x' ? across - LIFT : mid}px`;
      const digits = document.createElement('span');
      digits.className = 'kodza-dimension-lines__digits';
      digits.textContent = format(length);
      value.append(digits);
      sheet.append(value);
      dims.push({ axis, mid, across, line, arrows, digits });
      return value;
    };

    const draw = (m) => {
      animations.forEach((a) => a.cancel());
      animations = [];
      guides = [];
      dims = [];
      svg.replaceChildren();
      sheet.querySelectorAll('.kodza-dimension-lines__value').forEach((el) => el.remove());
      const { width: w, height: h, content, title, side, ink, eyebrow } = m;
      svg.setAttribute('width', w);
      svg.setAttribute('height', h);
      svg.setAttribute('viewBox', `0 0 ${w} ${h}`);
      if (!content) return;

      // The column edges: one construction line each, the whole height of the sheet
      const columns = Boolean(title && side && side.left >= title.right - 1);
      const breaks = [content.left, ...(columns ? [title.right, side.left] : []), content.right];
      breaks.forEach((x) => guide('guide', crisp(x), 0, crisp(x), h));

      const left = title && content.left >= MARGIN ? content.left / 2 : null;
      const right = w - content.right >= MARGIN ? content.right + (w - content.right) / 2 : null;
      if (title) { // the title's top and bottom, out to its height in the margin
        const from = left === null ? 0 : left - GAP;
        guide('guide', from, crisp(title.top), title.right, crisp(title.top));
        guide('guide', from, crisp(title.bottom), title.right, crisp(title.bottom));
      }

      // Above the text: the width of the title's longest line, read from the glyphs
      const top = content.top - 36;
      const inked = ink && title && top >= TOP;
      if (inked) {
        guide('dim', crisp(ink.left), top - 6, crisp(ink.left), top + GAP);
        guide('dim', crisp(ink.right), top - 6, crisp(ink.right), top + GAP);
        // Down to the title, broken around a line of text it would cross, as on a drawing
        let from = top + GAP;
        eyebrow.filter((o) => ink.right > o.left - GAP && ink.right < o.right + GAP && o.bottom > from)
          .sort((a, b) => a.top - b.top)
          .forEach((o) => {
            if (o.top - GAP / 2 > from + 2) guide('guide', crisp(ink.right), from, crisp(ink.right), o.top - GAP / 2);
            from = o.bottom + GAP / 2;
          });
        if (title.top > from + 2) guide('guide', crisp(ink.right), from, crisp(ink.right), title.top);
      }

      // Under the text: margins, columns and gap, end to end, from one edge of the section to the other
      const chain = (content.bottom + h) / 2;
      breaks.forEach((x) => guide('dim', crisp(x), content.bottom + GAP, crisp(x), chain + 6));

      if (inked) dimension('x', ink.left, ink.right, top);
      let margin = null;
      [0, ...breaks, w].reduce((a, b) => {
        margin = dimension('x', a, b, chain);
        return b;
      });
      if (left !== null) dimension('y', title.top, title.bottom, left);
      if (right !== null) {
        dimension('y', 0, h, right);
        // The section's height runs through the right margin's value: the paper again under the
        // value, so the line breaks around the text, as on a drawing
        if (margin) {
          const half = margin.offsetWidth / 2 + 3;
          add('knock', `M${right - half} ${chain - LIFT - 10}H${right + half}V${chain - 2}H${right - half}z`);
        }
      }
    };

    // The first time it is seen: the construction lines draw in, then each dimension opens from
    // its middle, its arrows riding the ends of the line, and its value rises out of a mask
    const play = () => {
      guides.forEach((el, i) => {
        animations.push(el.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], {
          duration: 900, delay: i * 40, easing: DRAW, fill: 'backwards',
        }));
      });
      dims.forEach((d, i) => {
        const timing = { duration: OPEN, delay: 280 + i * STEP, easing: DRAW, fill: 'backwards' };
        const axis = d.axis.toUpperCase();
        d.line.style.transformOrigin = d.axis === 'x' ? `${d.mid}px ${d.across}px` : `${d.across}px ${d.mid}px`;
        animations.push(d.line.animate([{ transform: `scale${axis}(0)` }, { transform: `scale${axis}(1)` }], timing));
        d.arrows.forEach(([el, shift]) => {
          animations.push(el.animate([{ transform: `translate${axis}(${shift}px)` }, { transform: 'none' }], timing));
        });
        animations.push(d.digits.animate([{ transform: 'translateY(110%)' }, { transform: 'none' }], {
          duration: 420, delay: timing.delay + OPEN * 0.55, easing: ARRIVE, fill: 'backwards',
        }));
      });
    };

    // Measured again whenever the layout moves (a resize, the web font coming in, new text);
    // redrawn only if a value actually changed
    const refresh = () => {
      if (signal.aborted) return;
      const m = measure();
      if (!m.width || !m.height) return;
      const key = JSON.stringify(m, (name, value) => (typeof value === 'number' ? Math.round(value) : value));
      if (key === drawn) return;
      drawn = key;
      draw(m);
    };

    let frame = 0;
    const soon = () => {
      cancelAnimationFrame(frame);
      frame = requestAnimationFrame(refresh);
    };
    const ro = new ResizeObserver(soon);
    ro.observe(root);
    const content = part('content');
    if (content) ro.observe(content);
    const fonts = document.fonts?.ready || Promise.resolve();
    fonts.then(soon);

    const io = new IntersectionObserver((entries) => {
      if (entered || !entries[entries.length - 1].isIntersecting) return;
      entered = true;
      io.disconnect();
      // Played once the web font is in, so the values it opens on are the ones that stay
      fonts.then(() => {
        if (signal.aborted) return;
        cancelAnimationFrame(frame);
        refresh();
        sheet.classList.remove('is-waiting');
        play();
      });
    }, { threshold: 0.25 });
    if (!entered) io.observe(root);

    refresh();

    signal.addEventListener('abort', () => {
      cancelAnimationFrame(frame);
      animations.forEach((a) => a.cancel());
      io.disconnect();
      ro.disconnect();
      sheet.remove();
    });
  }

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