kitbash Sign in Connect agent
Components

Profile

A detail page: title bar with a close cross, a strip naming the entry between its two neighbours with a violet flag on the current one, then a sticky picture that cross-fades through three views beside a violet and a grey block, facts in serif, a large grotesk story and a ruled table on a pale tray.

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: #e2e6e9;
  --ink: #1b2c3b;
  --idle: #bac1c7;
  --tray: #d7dce0;
  --plate: #929da5;
  --violet: #29a25c;
  --font-mark: "Fraunces", Georgia, serif;
  --font-caps: "Fraunces", Georgia, serif;
  --font-text: "Inter", "Helvetica Neue", Arial, sans-serif;
}
</style>

<article class="profile">
  <header class="profile__head">
    <p class="profile__title">Stone with a home address</p>
    <a class="profile__close" href="#" aria-label="Back to all quarries">
      <svg class="profile__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m2 2 20 20M22 2 2 22"/></svg>
    </a>
  </header>

  <nav class="profile__strip" aria-label="Quarries">
    <a class="profile__step" href="#" aria-label="Previous quarry">
      <svg class="profile__icon" viewBox="0 0 12 20" aria-hidden="true" focusable="false"><path d="M10 2 2 10l8 8"/></svg>
    </a>
    <a class="profile__cell" href="#">
      <span class="profile__cell-name">Pedreira do Corvo</span>
      <span class="profile__cell-line">The black schist of the north</span>
    </a>
    <a class="profile__cell is-current" href="#" aria-current="page">
      <span class="profile__cell-name">Scarth How</span>
      <span class="profile__cell-line">Slate split by hand since 1911</span>
    </a>
    <a class="profile__cell" href="#">
      <span class="profile__cell-name">Monte da Rola</span>
      <span class="profile__cell-line">Pink marble from a single pit</span>
    </a>
    <a class="profile__step" href="#" aria-label="Next quarry">
      <svg class="profile__icon" viewBox="0 0 12 20" aria-hidden="true" focusable="false"><path d="m2 2 8 8-8 8"/></svg>
    </a>
  </nav>

  <div class="profile__body">
    <figure class="profile__view">
      <canvas class="profile__picture is-shown" width="800" height="800" role="img" aria-label="A deep slate pit with many narrow benches, seen from the rim"
        data-scene='{"seed":31,"eye":0.7,"horizon":0.14,"site":[-0.05,1.45,0.6],"dig":-1.4,"cut":0.85,"haze":0.2}'></canvas>
      <canvas class="profile__picture" width="800" height="800" role="img" aria-label="The same fell from across the valley, the cutting a pale notch in dark woods"
        data-scene='{"seed":32,"eye":0.44,"horizon":0.46,"site":[0.12,1.9,0.45],"cut":0.42,"haze":0.3}'></canvas>
      <canvas class="profile__picture" width="800" height="800" role="img" aria-label="Stacked benches close up, lit from the right"
        data-scene='{"seed":33,"eye":0.5,"horizon":0.3,"site":[0,0.85,0.34],"cut":0.9,"sun":1}'></canvas>
      <span class="profile__band" aria-hidden="true"></span>
      <button class="profile__next" type="button" aria-label="Next picture">
        <svg class="profile__icon" viewBox="0 0 12 20" aria-hidden="true" focusable="false"><path d="m2 2 8 8-8 8"/></svg>
      </button>
    </figure>

    <div class="profile__text">
      <span class="profile__block" aria-hidden="true"></span>
      <span class="profile__block profile__block--idle" aria-hidden="true"></span>
      <div class="profile__columns">
        <dl class="profile__facts">
          <dt>Location:</dt>
          <dd>Scarth Fell, Cumbria</dd>
          <dt>Crew:</dt>
          <dd>Seven, two of them rivers</dd>
          <dd class="profile__map-row">
            <a class="profile__map" href="#">
              <svg class="profile__pin" viewBox="0 0 8 24" aria-hidden="true" focusable="false"><circle cx="4" cy="4" r="4"/><path d="M3.25 6h1.5v18h-1.5z"/></svg>
              View map
            </a>
          </dd>
        </dl>
        <div class="profile__story">
          <p>Nell Tarn runs the last hand-riven slate face on Scarth Fell, a pit her great-grandfather opened with a borrowed crowbar. Nothing here is blasted. The crew free each block with wire and wedges, lower it on a rope-worked incline and split it on the bank the same week, while the stone still carries its quarry sap.</p>
          <p>The beds dip steeply and change colour every few metres, from a wet-pavement grey to an olive green with rust veins. Nell sells them as she finds them and will not sort for uniformity, which is exactly why we wanted her on the list.</p>
        </div>
      </div>

      <div class="profile__tray">
        <h3 class="profile__tray-title">Stones</h3>
        <table class="profile__table">
          <tbody>
            <tr><th scope="row">Scarth Grey</th><td>Slate, riven</td><td>Top bed</td></tr>
            <tr><th scope="row">Scarth Olive</th><td>Slate, riven</td><td>Middle bed</td></tr>
            <tr><th scope="row">Tarn Rust</th><td>Slate, honed</td><td>Middle bed</td></tr>
            <tr><th scope="row">Incline Black</th><td>Slate, sawn</td><td>Floor of the pit</td></tr>
            <tr><th scope="row">Bank Seconds</th><td>Walling stone</td><td>Mixed</td></tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</article>

<style>
  .profile {
    background: var(--paper);
  }
  .profile__icon {
    display: block;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
  }

  .profile__head {
    position: relative;
    display: grid;
    place-items: center;
    min-height: calc(var(--bar) + 0.5rem);
    padding: var(--space-s) calc(var(--tap) + var(--gutter));
    border-bottom: var(--rule) solid var(--ink);
  }
  .profile__title {
    margin: 0;
    font-family: var(--font-caps);
    font-size: var(--caps-head);
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
  }
  .profile__close {
    position: absolute;
    top: 50%;
    right: calc(var(--gutter) / 2);
    display: grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    color: var(--ink);
    translate: 0 -50%;
    transition: rotate var(--time) var(--ease);
  }
  .profile__close:hover,
  .profile__close:focus-visible {
    rotate: 90deg;
    outline: none;
  }

  /* The strip names the quarry in hand between its two neighbours; a violet flag sits on the one in hand. */
  .profile__strip {
    display: grid;
    grid-template-columns: var(--tap) repeat(3, minmax(0, 1fr)) var(--tap);
    font-family: var(--font-caps);
    line-height: var(--leading-caps);
    text-align: center;
    text-transform: uppercase;
  }
  .profile__step,
  .profile__cell {
    position: relative;
    display: grid;
    place-content: center;
    min-height: 5.625rem;
    padding: var(--space-m) var(--space-s) var(--space-s);
    border-right: var(--rule) solid var(--ink);
    color: var(--ink);
    text-decoration: none;
  }
  .profile__step {
    padding: 0;
  }
  .profile__step:last-child {
    border-right: 0;
  }
  .profile__step:hover,
  .profile__step:focus-visible {
    background: var(--violet);
    outline: none;
  }
  .profile__cell::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: calc(var(--flag) / 2);
    background: var(--violet);
    opacity: 0;
    transition: opacity var(--time) var(--ease);
  }
  .profile__cell.is-current::before,
  .profile__cell:hover::before,
  .profile__cell:focus-visible::before {
    opacity: 1;
  }
  .profile__cell:focus-visible {
    outline: none;
  }
  .profile__cell-name {
    font-size: var(--caps-l);
    line-height: 1.05;
  }
  .profile__cell-line {
    margin-top: 0.25rem;
    font-size: var(--caps-xs);
  }

  .profile__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* The picture stays put while the text beside it scrolls. Pictures are stacked and cross-fade. */
  .profile__view {
    position: sticky;
    top: 0;
    display: grid;
    margin: 0;
    overflow: hidden;
    background: var(--plate);
    isolation: isolate;
  }
  .profile__picture {
    grid-area: 1 / 1;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--time-slow) var(--ease);
  }
  .profile__picture.is-painted.is-shown {
    opacity: 1;
  }
  .profile__band {
    position: absolute;
    inset: auto 0 0;
    height: calc(var(--band) / 2);
    background: var(--violet);
    mix-blend-mode: difference;
    pointer-events: none;
  }
  .profile__next {
    position: absolute;
    top: 50%;
    right: 0;
    display: grid;
    place-items: center;
    width: calc(var(--tap) + var(--space-s));
    height: calc(var(--tap) + var(--space-s));
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--paper);
    translate: 0 -50%;
    cursor: pointer;
    transition: translate var(--time) var(--ease);
  }
  .profile__next .profile__icon {
    height: 1.75rem;
    stroke-width: 1.75;
  }
  .profile__next:hover,
  .profile__next:focus-visible {
    translate: 0.25rem -50%;
    outline: none;
  }
  .profile__next:focus-visible {
    background: var(--violet);
    color: var(--ink);
  }

  /* Two empty colour blocks, each as tall as the two-part bar. The violet one sticks; the grey one scrolls away under it. */
  .profile__block {
    position: sticky;
    top: 0;
    z-index: 1;
    display: block;
    height: var(--bar);
    background: var(--violet);
  }
  .profile__block--idle {
    position: static;
    background: var(--idle);
  }

  .profile__columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr);
    gap: var(--gutter);
    padding: var(--space-m) var(--gutter) var(--space-xl);
  }
  .profile__facts {
    margin: 0;
    font-family: var(--font-caps);
    font-size: var(--text-note);
    line-height: 1.15;
  }
  .profile__facts dt {
    font-weight: 600;
  }
  .profile__facts dd {
    margin: 0 0 var(--space-s);
  }
  .profile__map {
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    min-height: var(--tap);
    color: var(--ink);
    text-decoration: underline transparent;
    text-underline-offset: 0.2em;
    transition: text-decoration-color var(--time) var(--ease);
  }
  .profile__map:hover,
  .profile__map:focus-visible {
    text-decoration-color: currentColor;
  }
  .profile__map:focus-visible {
    outline: var(--rule) solid var(--ink);
    outline-offset: 2px;
  }
  .profile__pin {
    height: 1.5rem;
    fill: currentColor;
  }
  .profile__story {
    font-size: var(--text-lead);
    line-height: 1.07;
    letter-spacing: -0.01em;
  }
  .profile__story p {
    margin: 0 0 var(--space-m);
    text-indent: var(--indent);
  }

  .profile__tray {
    padding: var(--space-m) 0 var(--space-l);
    background: var(--tray);
  }
  .profile__tray-title {
    margin: 0 0 var(--space-l);
    padding: 0 var(--gutter);
    font-size: var(--text-lead);
    font-weight: 400;
    letter-spacing: -0.01em;
  }
  .profile__table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-fine);
    text-align: left;
  }
  .profile__table th,
  .profile__table td {
    width: 33.33%;
    padding: var(--space-m) var(--gutter) var(--space-s);
    border-bottom: var(--rule) solid var(--ink);
    font-weight: 400;
    vertical-align: bottom;
  }

  @media (max-width: 64rem) {
    .profile__columns {
      grid-template-columns: 1fr;
    }
    .profile__facts {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 0 var(--space-s);
    }
    .profile__map-row {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 48rem) {
    .profile__strip {
      grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
    }
    .profile__cell:not(.is-current) {
      display: none;
    }
    .profile__body {
      grid-template-columns: 1fr;
    }
    .profile__view {
      position: relative;
    }
    .profile__picture {
      aspect-ratio: 4 / 3;
    }
    .profile__band {
      height: var(--band);
    }
    .profile__block {
      position: static;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .profile__close,
    .profile__cell::before,
    .profile__picture,
    .profile__next,
    .profile__map {
      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(".profile").forEach((root) => {
    const pictures = [...root.querySelectorAll(".profile__picture")];
    let shown = 0;

    root.querySelector(".profile__next").addEventListener("click", () => {
      pictures[shown].classList.remove("is-shown");
      shown = (shown + 1) % pictures.length;
      pictures[shown].classList.add("is-shown");
    });
    paintInTurn(pictures);
  });
})();
</script>

Similar components

Black statement

Black statement

Red flood studio

Red flood studio

Project chapter

Project chapter

Venue

Venue

Scroll-lit reading

Scroll-lit reading

Ruled columns

Ruled columns

Text columns with small figures

Text columns with small figures

Discipline shapes

Discipline shapes