kitbash Sign in Connect agent
Components

Masthead

The signature piece: a wordmark that fills the width, scattered into dust by an SVG displacement filter whose strength scales with the word, over a centred row of capital links. The word bleeds out on load and pulls sharp on hover or focus; the link row clears as one and stacks on phones.

Part of the style

Ink Bleed Serif

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --page: #251a1a;
  --ink: #fbf4ee;
  --paper: #100607;
  --paper-soft: rgba(16, 6, 7, 0.6);
}
</style>

<header class="masthead">
  <a class="masthead__wordmark" href="#" aria-label="Mild Steam, home">
    <svg class="masthead__type" viewBox="0 0 1200 236" aria-hidden="true" focusable="false">
      <defs>
        <!-- Heavy scatter for the wordmark. Its numbers are in viewBox units, so the bleed shrinks with the word. -->
        <filter class="masthead__ink" id="masthead-ink" filterUnits="userSpaceOnUse" x="-70" y="-60" width="1340" height="356" color-interpolation-filters="sRGB">
          <feTurbulence type="fractalNoise" baseFrequency="0.73" numOctaves="1" seed="11" />
          <feDisplacementMap in="SourceGraphic" scale="70" xChannelSelector="R" yChannelSelector="G" />
        </filter>
        <!-- Light scatter for text at reading size. -->
        <filter id="masthead-grain" x="-5%" y="-25%" width="110%" height="150%" color-interpolation-filters="sRGB">
          <feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="1" seed="3" />
          <feDisplacementMap in="SourceGraphic" scale="11" xChannelSelector="R" yChannelSelector="G" />
        </filter>
      </defs>
      <text class="masthead__letters" x="600" y="206" text-anchor="middle" textLength="1180" filter="url(#masthead-ink)">Mild Steam</text>
    </svg>
  </a>

  <nav class="masthead__nav" aria-label="Main">
    <ul class="masthead__list">
      <li><a class="masthead__link" href="#" aria-current="page">Logbook</a></li>
      <li><a class="masthead__link" href="#">Hours</a></li>
      <li><a class="masthead__link" href="#">The Baths</a></li>
      <li><a class="masthead__link" href="#">Sauna</a></li>
      <li><a class="masthead__link" href="#">House Rules</a></li>
      <li><a class="masthead__link" href="#">Visit</a></li>
    </ul>
  </nav>
</header>

<style>
  .masthead {
    padding: var(--space-l) var(--edge) var(--space-s);
    overflow-x: clip;
  }

  .masthead__wordmark {
    display: block;
    color: inherit;
  }
  .masthead__wordmark:focus-visible {
    outline: var(--rule) solid var(--ink);
    outline-offset: var(--space-s);
  }
  .masthead__type {
    display: block;
    width: 100%;
    overflow: visible;
  }
  .masthead__letters {
    fill: currentColor;
    font: 500 250px var(--font-text);
  }

  .masthead__nav {
    margin-top: var(--space-s);
    filter: url("#masthead-grain");
  }
  .masthead__nav:hover,
  .masthead__nav:focus-within {
    filter: none;
  }
  .masthead__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 clamp(1rem, 2.2vw, 2rem);
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .masthead__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: inherit;
    line-height: var(--leading-tight);
    text-transform: uppercase;
    text-decoration: underline var(--rule) transparent;
    text-underline-offset: var(--underline-offset);
  }
  .masthead__link:hover,
  .masthead__link:focus-visible,
  .masthead__link[aria-current="page"] {
    text-decoration-color: currentColor;
  }
  .masthead__link:focus-visible {
    outline: none;
  }

  @media (max-width: 44rem) {
    .masthead__list {
      flex-direction: column;
      align-items: center;
    }
  }
</style>

<script>
  (() => {
    const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)");
    const easeOut = (progress) => 1 - (1 - progress) ** 3;
    const tokenMs = (root, token) => parseFloat(getComputedStyle(root).getPropertyValue(token)) * 1000;

    const setUpWordmark = (root, index) => {
      const wordmark = root.querySelector(".masthead__wordmark");
      const letters = root.querySelector(".masthead__letters");
      const ink = root.querySelector(".masthead__ink");
      const displacement = ink.querySelector("feDisplacementMap");
      const restScatter = Number(displacement.getAttribute("scale"));
      let scatter = restScatter;
      let frame = 0;

      const setScatter = (value) => {
        scatter = value;
        displacement.setAttribute("scale", value.toFixed(1));
      };

      const scatterTo = (target, token) => {
        cancelAnimationFrame(frame);
        if (reducedMotion.matches) {
          setScatter(target);
          return;
        }
        const from = scatter;
        const duration = tokenMs(root, token);
        const startedAt = performance.now();
        const step = (now) => {
          const progress = Math.min(1, (now - startedAt) / duration);
          setScatter(from + (target - from) * easeOut(progress));
          if (progress < 1) frame = requestAnimationFrame(step);
        };
        frame = requestAnimationFrame(step);
      };

      const gather = () => scatterTo(0, "--time-wordmark");
      const bleed = () => scatterTo(restScatter, "--time-bleed");

      // Every instance mutates its own filter, so each one needs its own id.
      ink.id = `masthead-ink-${index}`;
      letters.setAttribute("filter", `url(#${ink.id})`);

      wordmark.addEventListener("pointerenter", gather);
      wordmark.addEventListener("pointerleave", bleed);
      wordmark.addEventListener("focus", gather);
      wordmark.addEventListener("blur", bleed);

      // First bleed: the word prints sharp, then soaks into the page once it is on screen.
      if (reducedMotion.matches) return;
      setScatter(0);
      const firstSight = new IntersectionObserver((entries) => {
        if (!entries.some((entry) => entry.isIntersecting)) return;
        firstSight.disconnect();
        bleed();
      });
      firstSight.observe(wordmark);
    };

    document.querySelectorAll(".masthead").forEach(setUpWordmark);
  })();
</script>

Similar components

Sky hero

Sky hero

Split hero

Split hero

Sticker headline hero

Sticker headline hero

Hero with device panel

Hero with device panel

Masthead

Masthead

Cover

Cover

Spring headline

Spring headline

3D hero scene

3D hero scene