kitbash Sign in Connect agent
Components

Stockist list

A page split in half: a painted picture with its violet band stays put on the left while a ruled list scrolls on the right, with countries as large serif headings and firms with a contact, phone and email under each. Stacks on phones.

Part of the style

Violet Difference

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

Preview

Code
<style>
/* Goes after the pack's base.css */
@import url("https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..700&family=Fraunces:ital,opsz,wght@1,9..144,400..600&display=swap");
:root {
  --paper: #ececed;
  --ink: #5c4225;
  --idle: #cbcbd4;
  --tray: #e3e3e6;
  --plate: #abaaba;
  --violet: #cbaa88;
  --font-mark: "Fraunces", Georgia, serif;
  --font-caps: "Fraunces", Georgia, serif;
  --font-text: "Inter", "Helvetica Neue", Arial, sans-serif;
}
</style>

<section class="stockists" aria-label="Stockists">
  <figure class="stockists__view">
    <span class="stockists__frame">
      <canvas class="stockists__picture" width="960" height="640" role="img" aria-label="Black and white view from the air over a wide stone pit, woods and fields around it, ranges in haze"
        data-scene='{"seed":43,"eye":0.74,"horizon":0.2,"site":[0.12,1.7,0.55],"dig":-1.1,"cut":0.72,"haze":0.22,"blocks":[[-0.42,1.3,0.05,0.03,0.03,0],[-0.35,1.33,0.012,0.012,0.07,1]]}'></canvas>
      <span class="stockists__band" aria-hidden="true"></span>
    </span>
  </figure>

  <div class="stockists__list">
    <section class="stockists__region">
      <h3 class="stockists__place">Belgium</h3>
      <div class="stockists__firm">
        <p class="stockists__name">Steenhuis Verbeke</p>
        <p class="stockists__contact">
          <span>Ilse Verbeke</span>
          <a class="stockists__reach" href="#">T: 055 501 042</a>
          <a class="stockists__reach" href="#">ilse@steenhuis.example</a>
        </p>
      </div>
    </section>
    <section class="stockists__region">
      <h3 class="stockists__place">Denmark</h3>
      <div class="stockists__firm">
        <p class="stockists__name">Brøndum Sten</p>
        <p class="stockists__contact">
          <span>Mads Brøndum</span>
          <a class="stockists__reach" href="#">T: 86 55 01 17</a>
          <a class="stockists__reach" href="#">mads@brondumsten.example</a>
        </p>
      </div>
    </section>
    <section class="stockists__region">
      <h3 class="stockists__place">Germany</h3>
      <div class="stockists__firm">
        <p class="stockists__name">Lindner &amp; Töchter</p>
        <p class="stockists__contact">
          <span>Hanne Lindner</span>
          <a class="stockists__reach" href="#">T: 0341 555 0164</a>
          <a class="stockists__reach" href="#">werkhof@lindner-toechter.example</a>
        </p>
      </div>
      <div class="stockists__firm">
        <p class="stockists__name">Hafenstein</p>
        <p class="stockists__contact">
          <span>Jonas Abel</span>
          <a class="stockists__reach" href="#">T: 040 555 0138</a>
          <a class="stockists__reach" href="#">jonas@hafenstein.example</a>
        </p>
      </div>
    </section>
    <section class="stockists__region">
      <h3 class="stockists__place">Japan</h3>
      <div class="stockists__firm">
        <p class="stockists__name">Ishimoto Yard</p>
        <p class="stockists__contact">
          <span>Aya Ishimoto</span>
          <a class="stockists__reach" href="#">T: 075 555 0109</a>
          <a class="stockists__reach" href="#">aya@ishimoto-yard.example</a>
        </p>
      </div>
    </section>
    <section class="stockists__region">
      <h3 class="stockists__place">Netherlands</h3>
      <div class="stockists__firm">
        <p class="stockists__name">De Zaagloods</p>
        <p class="stockists__contact">
          <span>Pim Hoekstra</span>
          <a class="stockists__reach" href="#">T: 010 555 0173</a>
          <a class="stockists__reach" href="#">pim@zaagloods.example</a>
        </p>
      </div>
    </section>
    <section class="stockists__region">
      <h3 class="stockists__place">United Kingdom</h3>
      <div class="stockists__firm">
        <p class="stockists__name">Marrow &amp; Flint</p>
        <p class="stockists__contact">
          <span>Dele Marrow</span>
          <a class="stockists__reach" href="#">T: 0117 496 0152</a>
          <a class="stockists__reach" href="#">dele@marrowflint.example</a>
        </p>
      </div>
    </section>
  </div>
</section>

<style>
  .stockists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    border-top: var(--rule) solid var(--ink);
    background: var(--paper);
    font-family: var(--font-caps);
    line-height: var(--leading-caps);
  }

  /* The picture stays put while the list scrolls past it. */
  .stockists__view {
    position: sticky;
    top: 0;
    margin: 0;
  }
  .stockists__frame {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--plate);
    isolation: isolate;
  }
  .stockists__picture {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--time-slow) var(--ease);
  }
  .stockists__picture.is-painted {
    opacity: 1;
  }
  .stockists__band {
    position: absolute;
    inset: auto 0 0;
    height: calc(var(--band) / 2);
    background: var(--violet);
    mix-blend-mode: difference;
    pointer-events: none;
  }

  .stockists__list {
    border-left: var(--rule) solid var(--ink);
  }
  .stockists__region:first-child .stockists__place {
    padding-top: var(--space-xl);
  }
  .stockists__place {
    margin: 0;
    padding: var(--space-s) var(--gutter) 0;
    border-bottom: var(--rule) solid var(--ink);
    font-size: var(--caps-xl);
    font-weight: 400;
    text-transform: uppercase;
  }
  .stockists__firm {
    padding: var(--space-m) var(--gutter) var(--space-l);
    border-bottom: var(--rule) solid var(--ink);
  }
  .stockists__name {
    margin: 0;
    font-size: var(--caps-m);
    text-transform: uppercase;
  }
  .stockists__contact {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    align-items: center;
    column-gap: var(--gutter);
    margin: 0;
    font-size: var(--text-note);
  }
  .stockists__reach {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--ink);
    text-decoration: underline transparent;
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
    transition: text-decoration-color var(--time) var(--ease);
  }
  .stockists__reach:hover,
  .stockists__reach:focus-visible {
    text-decoration-color: currentColor;
  }
  .stockists__reach:focus-visible {
    outline: var(--rule) solid var(--ink);
    outline-offset: 2px;
  }

  @media (max-width: 64rem) {
    .stockists__contact {
      grid-template-columns: 1fr 1fr;
    }
    .stockists__reach:last-child {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 48rem) {
    .stockists {
      grid-template-columns: 1fr;
    }
    .stockists__view {
      position: static;
    }
    .stockists__band {
      height: var(--band);
    }
    .stockists__list {
      border-left: 0;
    }
    .stockists__region:first-child .stockists__place {
      padding-top: var(--space-l);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .stockists__picture,
    .stockists__reach {
      transition-duration: 0s;
    }
  }
</style>

<script>
(() => {
  /* Paints one grey landscape into a canvas: ground seen from the air, drawn column by column from near to far,
     with haze, a hill or pit cut into stone benches, and film grain. The same block sits in every part that shows a picture. */
  function paintPlate(canvas, scene) {
    const W = canvas.width, H = canvas.height;
    const context = canvas.getContext("2d");
    const image = context.createImageData(W, H);
    const s = { seed: 1, eye: 0.62, horizon: 0.3, haze: 0.25, site: [0.25, 1.5, 0.42], dig: 1, cut: 0.5, sea: -1, sun: -1, blocks: [], ...scene };

    let state = Math.imul(s.seed, 2654435761) >>> 0;
    const random = () => (state = (Math.imul(state ^ (state >>> 15), 2246822507) + 0x9e3779b9) >>> 0) / 4294967296;
    const lattice = new Uint8Array(512);
    for (let i = 0; i < 256; i++) lattice[i] = i;
    for (let i = 255; i > 0; i--) { const j = (random() * (i + 1)) | 0, kept = lattice[i]; lattice[i] = lattice[j]; lattice[j] = kept; }
    lattice.copyWithin(256, 0, 256);
    const noise = (x, y) => {
      const xi = Math.floor(x), yi = Math.floor(y);
      let fx = x - xi, fy = y - yi;
      fx *= fx * (3 - 2 * fx); fy *= fy * (3 - 2 * fy);
      const a = lattice[xi & 255], b = lattice[(xi + 1) & 255], lo = yi & 255, hi = (yi + 1) & 255;
      const n00 = lattice[a + lo], n01 = lattice[a + hi], n10 = lattice[b + lo], n11 = lattice[b + hi];
      return (n00 + (n10 - n00) * fx + (n01 - n00) * fy + (n00 - n10 - n01 + n11) * fx * fy) / 255;
    };
    const layered = (x, y, finest) => {
      let sum = 0, gain = 0.5, scale = 1;
      for (let i = 0; i < 9 && 1 / scale > finest; i++) { sum += gain * noise(x * scale + i * 17.3, y * scale - i * 9.1); gain *= 0.5; scale *= 2.03; }
      return sum;
    };
    const ramp = (lo, hi, v) => { const t = Math.min(1, Math.max(0, (v - lo) / (hi - lo))); return t * t * (3 - 2 * t); };

    /* Height and surface tone of the ground at one point. `cell` is the size of one sample there, so far ground gets less detail. */
    const spot = { height: 0, tone: 0, flat: 0 };
    const ground = (x, y, cell) => {
      const dx = x - s.site[0], dy = y - s.site[1];
      const mound = Math.exp(-(dx * dx + dy * dy) / (s.site[2] * s.site[2]));
      const range = ramp(3, 8.5, y);
      let height = layered(x * 1.1, y * 1.1, cell * 2.2) * 0.36 + s.dig * mound * 0.26 - 0.12 + range * s.eye * (0.35 + 1.5 * noise(x * 0.55 + 3, y * 0.3));
      const farmed = ramp(0.5, 0.62, noise(x * 1.7 + 40, y * 1.7 + 11)) * (1 - ramp(0.2, 0.5, mound)) * (1 - ramp(0, 0.3, range));
      height = height * (1 - 0.72 * farmed) + 0.03 * farmed;
      if (cell < 0.03) height += (1 - farmed) * 0.014 * noise(x * 60, y * 60);
      let tone = 0.1 + 0.14 * noise(x * 3.1, y * 3.1) + (cell < 0.012 ? 0.2 * (noise(x * 150, y * 150) - 0.5) : 0);
      if (farmed > 0.02) {
        const turn = Math.floor(noise(x * 2.3 + 7, y * 2.3) * 5) * 1.3;
        const furrow = cell < 0.006 ? 0.14 * Math.sin((x * Math.cos(turn) + y * Math.sin(turn)) * 190) : 0;
        tone += (0.4 + 0.22 * noise(x * 2.3 + 7, y * 2.3 + 60) + furrow - tone) * ramp(0.02, 0.5, farmed);
      }
      const track = Math.abs(noise(x * 0.9 + 80, y * 0.9 + 5) - 0.5);
      if (track < 0.006 + cell * 0.4) tone += (0.7 - tone) * 0.8 * (1 - ramp(1.8, 3.2, y));
      const worked = ramp(1 - s.cut, 1.12 - s.cut, mound + 0.25 * noise(x * 4, y * 4));
      if (worked > 0) {
        const bench = 0.03, level = height / bench, tread = Math.floor(level) + ramp(0.72, 1, level - Math.floor(level));
        height += (tread * bench - height) * worked;
        tone += (0.78 + 0.2 * noise(x * 30, y * 6) - tone) * worked;
      }
      spot.flat = 0;
      if (height < s.sea) { height = s.sea; tone = 0.6 + 0.2 * noise(x * 9, y * 40); spot.flat = 1; }
      for (const [left, front, wide, deep, tall, pale] of s.blocks) {
        const u = (x - left) / wide, v = (y - front) / deep;
        if (u > 0 && u < 1 && v > 0 && v < 1) { height += tall; tone = pale || v < 0.45 ? 1 : 0.25; spot.flat = 1; }
      }
      spot.height = height; spot.tone = tone;
    };

    const focal = H * 1.25, horizon = H * s.horizon, spread = 1.15 * W / H * 0.5625, depths = 460, reach = 9;
    const nearest = Math.max(0.1, (s.eye - 0.4) * focal / (H - horizon));
    const depth = Float32Array.from({ length: depths }, (_, k) => nearest * Math.pow(reach / nearest, k / (depths - 1)));
    const heights = new Float32Array(depths * W), tones = new Float32Array(depths * W), flats = new Uint8Array(depths * W);
    for (let k = 0; k < depths; k++) {
      const cell = depth[k] * spread / W;
      for (let c = 0; c < W; c++) {
        ground((c / W - 0.5) * depth[k] * spread, depth[k], cell);
        heights[k * W + c] = spot.height; tones[k * W + c] = spot.tone; flats[k * W + c] = spot.flat;
      }
    }

    const grey = new Float32Array(W * H), mist = 0.86;
    for (let c = 0; c < W; c++) {
      let floor = H, below = -1;
      for (let k = 1; k < depths - 1 && floor > 0; k++) {
        const i = k * W + c;
        const row = Math.max(0, Math.floor(horizon + (s.eye - heights[i]) * focal / depth[k]));
        if (row >= floor) continue;
        const slopeAcross = (heights[i + (c < W - 1)] - heights[i - (c > 0)]) / (2 * depth[k] * spread / W);
        const slopeAway = (heights[i + W] - heights[i - W]) / (depth[k + 1] - depth[k - 1]);
        const facing = (0.5 + s.sun * 0.8 * slopeAcross - 0.55 * slopeAway) / Math.sqrt(1 + slopeAcross * slopeAcross + slopeAway * slopeAway);
        const lit = tones[i] * (flats[i] ? 1 : 0.3 + 1.25 * Math.max(0, facing));
        const value = lit + (mist - 0.07 - lit) * (1 - Math.exp(-Math.pow(depth[k] * s.haze, 1.25)));
        for (let r = floor - 1; r >= row; r--) grey[r * W + c] = below < 0 ? value : below + (value - below) * (floor - r) / (floor - row);
        floor = row; below = value;
      }
      for (let r = 0; r < floor; r++) {
        const up = Math.max(0, 1 - r / (horizon + H * 0.14));
        const cloud = layered(c / W * 2.6 * spread + 9, up * 7 + s.seed, 0.01) - 0.5;
        grey[r * W + c] = mist - 0.3 * up + 0.36 * cloud * ramp(0.03, 0.45, up);
      }
    }
    for (let i = 0; i < W * H; i++) {
      const corner = Math.hypot((i % W) / W - 0.5, ((i / W) | 0) / H - 0.5);
      let v = Math.min(1, Math.max(0, grey[i] * 1.12 - 0.05));
      v = (0.75 * v * v * (3 - 2 * v) + 0.25 * v) * (1 - 0.5 * corner * corner * corner) + (random() - 0.5) * 0.075;
      image.data[i * 4] = image.data[i * 4 + 1] = image.data[i * 4 + 2] = 255 * v;
      image.data[i * 4 + 3] = 255;
    }
    context.putImageData(image, 0, 0);
    canvas.classList.add("is-painted");
  }

  /* Pictures are painted one per task, so a page full of them never blocks for long. */
  function paintInTurn(canvases) {
    const waiting = [...canvases];
    const next = () => {
      const canvas = waiting.shift();
      if (!canvas) return;
      paintPlate(canvas, JSON.parse(canvas.dataset.scene || "{}"));
      setTimeout(next, 0);
    };
    next();
  }

  document.querySelectorAll(".stockists").forEach((root) => paintInTurn(root.querySelectorAll(".stockists__picture")));
})();
</script>

Similar components

Numbered log rows

Numbered log rows

Ruled lists

Ruled lists

What we do

What we do

Dotted name roster

Dotted name roster

Ringed services

Ringed services

Event list

Event list

News

News

Project index

Project index