kitbash Sign in Connect agent
Components

Line-screen archive

A four-column hairline grid with serif column heads; portraits drawn as tinted line screens, interfaces drawn, pictures and objects shown plain. On phones one column at a time behind a dot pager.

Part of the style

Line Screen Folio

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --night: #251a1a;
  --night-raised: #2c2121;
  --night-warm: #342929;
  --ivory: #fbf4ee;
  --ivory-soft: rgba(251, 244, 238, 0.62);
  --ivory-faint: rgba(251, 244, 238, 0.32);
  --rule: rgba(251, 244, 238, 0.16);
  --paper: #f7f0ea;
  --paper-shade: #e6dfd9;
  --ink: #2e2222;
  --ink-soft: #6e6262;
  --screen-ice: #fef7f1;
  --black: #070202;
  --rule-faint: rgba(251, 244, 238, 0.06);
  --night-panel: #211717;
  --silver: #c9c1ba;
  --screen-blue: #87645e;
  --folder-deep: #c0afac;
  --screen-steel: #958c8a;
  --screen-night: #1c1716;
  --folder-light: #f9efed;
  --screen-sepia: #a07b75;
  --copper: #be7266;
}
</style>

<section class="archive" aria-label="Studio archive">
  <div class="archive__pager" role="tablist" aria-label="Archive columns">
    <button class="archive__dot is-active" type="button" role="tab" aria-selected="true" aria-label="Sitters" data-column="0"></button>
    <button class="archive__dot" type="button" role="tab" aria-selected="false" aria-label="Ledgers" data-column="1"></button>
    <button class="archive__dot" type="button" role="tab" aria-selected="false" aria-label="Pictures" data-column="2"></button>
    <button class="archive__dot" type="button" role="tab" aria-selected="false" aria-label="Objects" data-column="3"></button>
  </div>

  <div class="archive__grid">
    <div class="archive__column is-active" role="tabpanel">
      <h3 class="archive__head">Sitters</h3>
      <figure class="archive__cell">
        <div class="archive__screen archive__screen--sepia">
          <img class="archive__source" src="assets/sitter-grey.jpg" alt="Portrait of a grey-haired man in a dark coat, redrawn as vertical lines" width="653" height="800">
          <canvas class="archive__canvas" aria-hidden="true"></canvas>
        </div>
      </figure>
      <figure class="archive__cell">
        <div class="archive__screen archive__screen--blue">
          <img class="archive__source" src="assets/sitter-artist.jpg" alt="Portrait of a young man in a wide hat, redrawn as blue lines" width="634" height="800">
          <canvas class="archive__canvas" aria-hidden="true"></canvas>
        </div>
      </figure>
      <figure class="archive__cell">
        <div class="archive__screen archive__screen--ice">
          <img class="archive__source" src="assets/sitter-cameron.jpg" alt="Portrait of a woman with long hair, redrawn as pale blue lines" width="634" height="800">
          <canvas class="archive__canvas" aria-hidden="true"></canvas>
        </div>
      </figure>
    </div>

    <div class="archive__column" role="tabpanel">
      <h3 class="archive__head">Ledgers</h3>
      <figure class="archive__cell">
        <div class="archive__ask">
          <span class="archive__ask-hint">Ask the ledger anything</span>
          <span class="archive__ask-row">
            <span class="archive__ask-chip">+ Voyages</span>
            <span class="archive__ask-chip archive__ask-chip--end">Draft</span>
            <span class="archive__ask-send" aria-hidden="true">↑</span>
          </span>
        </div>
      </figure>
      <figure class="archive__cell">
        <div class="archive__chart">
          <span class="archive__chart-title">Hull claims, North Sea, 1880–1910</span>
          <svg class="archive__chart-plot" viewBox="0 0 200 70" preserveAspectRatio="none" aria-hidden="true">
            <path class="archive__chart-grid" d="M0 17.5H200M0 35H200M0 52.5H200" />
            <path class="archive__chart-a" d="M0 44 L10 40 L18 47 L26 36 L34 42 L42 30 L50 38 L58 33 L66 45 L74 31 L82 36 L90 28 L98 40 L106 34 L114 24 L122 33 L130 26 L138 37 L146 21 L154 27 L162 18 L170 24 L178 14 L186 20 L200 11" />
            <path class="archive__chart-b" d="M0 50 L12 48 L22 52 L32 45 L42 49 L52 41 L62 46 L72 43 L82 47 L92 39 L102 44 L112 38 L122 42 L132 35 L142 40 L152 33 L162 36 L172 30 L182 34 L200 28" />
          </svg>
          <span class="archive__chart-row"><span>Peak year</span><span>1897</span></span>
          <span class="archive__chart-row"><span>Ships logged</span><span>4,112</span></span>
        </div>
      </figure>
      <figure class="archive__cell">
        <div class="archive__calling">
          <span class="archive__calling-house">Quillmere</span>
          <span class="archive__calling-sub">Marine underwriters since 1821</span>
          <span class="archive__calling-name">Ottilie Varga</span>
          <span class="archive__calling-mail">ottilie@quillmere.example</span>
        </div>
      </figure>
    </div>

    <div class="archive__column" role="tabpanel">
      <h3 class="archive__head">Pictures</h3>
      <figure class="archive__cell">
        <img class="archive__photo archive__photo--wide" src="assets/lighthouse-rocks.jpg" alt="Bathers on a rocky shore under a pale cliff" width="800" height="475" loading="lazy">
      </figure>
      <figure class="archive__cell">
        <img class="archive__photo" src="assets/moon-night.jpg" alt="A moon low over a dark wood, painted in browns" width="800" height="654" loading="lazy">
      </figure>
      <figure class="archive__cell">
        <img class="archive__photo archive__photo--object" src="assets/astrolabe.jpg" alt="A brass astrolabe hanging from its ring" width="584" height="800" loading="lazy">
      </figure>
    </div>

    <div class="archive__column" role="tabpanel">
      <h3 class="archive__head">Objects</h3>
      <figure class="archive__cell">
        <canvas class="archive__object" data-shape="ring" aria-label="A ribbed copper ring, turning slowly" role="img"></canvas>
      </figure>
      <figure class="archive__cell">
        <canvas class="archive__object" data-shape="stack" aria-label="Three ribbed silver columns" role="img"></canvas>
      </figure>
      <figure class="archive__cell">
        <canvas class="archive__object" data-shape="wave" aria-label="A folded band of copper plates" role="img"></canvas>
      </figure>
    </div>
  </div>
</section>

<style>
  .archive {
    padding: 0 var(--edge) var(--section-space);
    background: var(--night);
    color: var(--ivory);
  }
  .archive__pager { display: none; }
  .archive__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: var(--line) solid var(--rule);
    border-right: 0;
    background: var(--night-raised);
  }
  .archive__column {
    display: grid;
    grid-template-rows: auto;
    grid-auto-rows: clamp(190px, 17.5vw, 260px);
    border-right: var(--line) solid var(--rule);
  }
  .archive__head {
    margin: 0;
    padding: var(--space-m) var(--space-s);
    border-bottom: var(--line) solid var(--rule);
    font-family: var(--font-display);
    font-size: var(--text-l);
    font-weight: 400;
    letter-spacing: -0.02em;
    text-align: center;
  }
  .archive__cell {
    display: grid;
    place-items: center;
    min-width: 0;
    margin: 0;
    padding: clamp(0.6rem, 1.2vw, 1rem);
    overflow: hidden;
  }
  .archive__cell + .archive__cell { border-top: var(--line) solid var(--rule); }

  /* Line-screen portraits: the canvas reads the image and redraws it as vertical lines in the tile's ink. */
  .archive__screen {
    position: relative;
    height: 100%;
    aspect-ratio: 4 / 5;
    max-width: 100%;
    background: var(--night);
    color: var(--screen-sepia);
  }
  .archive__screen--blue { aspect-ratio: 16 / 10; width: 100%; height: auto; max-height: 100%; background: var(--screen-night); color: var(--screen-blue); }
  .archive__screen--ice { background: var(--screen-ice); color: var(--screen-steel); }
  .archive__source {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
  }
  .archive__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  .archive__screen.is-fallback .archive__source { opacity: 1; filter: grayscale(1) contrast(1.3); mix-blend-mode: luminosity; }

  /* Drawn interfaces */
  .archive__ask,
  .archive__chart {
    display: grid;
    width: min(100%, 300px);
    padding: var(--space-s);
    border: var(--line) solid var(--rule);
    border-radius: var(--radius-l);
    background: var(--night-panel);
    font-family: var(--font-sans);
    letter-spacing: var(--track-label);
    box-shadow: 0 14px 30px -12px var(--night);
  }
  .archive__ask { gap: var(--space-l); }
  .archive__ask-hint { color: var(--ivory-soft); font-size: 0.6875rem; }
  .archive__ask-row { display: flex; align-items: center; gap: var(--space-s); font-size: 0.625rem; color: var(--ivory-soft); }
  .archive__ask-chip--end { margin-left: auto; }
  .archive__ask-send {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--screen-blue);
    color: var(--ivory);
  }
  .archive__chart { gap: var(--space-xs); font-size: 0.5625rem; color: var(--ivory-soft); }
  .archive__chart-title { color: var(--ivory); font-size: 0.625rem; }
  .archive__chart-plot { width: 100%; height: 64px; }
  .archive__chart-plot path { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
  .archive__chart-grid { stroke: var(--rule); }
  .archive__chart-a { stroke: var(--screen-blue); }
  .archive__chart-b { stroke: var(--screen-sepia); }
  .archive__chart-row { display: flex; justify-content: space-between; border-top: var(--line) solid var(--rule); padding-top: 3px; }

  .archive__calling {
    display: grid;
    width: min(100%, 260px);
    aspect-ratio: 7 / 4;
    padding: var(--space-s);
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow-paper);
    font-family: var(--font-caps);
    line-height: 1.1;
  }
  .archive__calling-house { font-size: 0.8125rem; }
  .archive__calling-sub { font-size: 0.4375rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
  .archive__calling-name { align-self: center; justify-self: center; font-size: clamp(1rem, 1.6vw, 1.3rem); }
  .archive__calling-mail { justify-self: center; font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; }

  .archive__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.78) contrast(1.12) saturate(0.8);
    transition: filter var(--fade) var(--ease);
  }
  .archive__photo--object { object-fit: contain; background: var(--night); filter: brightness(0.72) contrast(1.3) grayscale(0.3); mix-blend-mode: luminosity; }
  .archive__cell:hover .archive__photo { filter: none; }
  .archive__object { width: 100%; height: 100%; background: var(--night); color: var(--copper); }
  .archive__object[data-shape="stack"] { color: var(--silver); }

  @media (max-width: 48rem) {
    .archive__pager {
      display: flex;
      justify-content: center;
      border: var(--line) solid var(--rule);
      border-bottom: 0;
      background: var(--night-raised);
    }
    .archive__dot {
      position: relative;
      width: 44px;
      height: 44px;
      padding: 0;
      border: 0;
      background: none;
      cursor: pointer;
    }
    .archive__dot::after {
      content: "";
      position: absolute;
      inset: 50% auto auto 50%;
      width: 7px;
      height: 7px;
      margin: -3.5px;
      border-radius: 50%;
      background: var(--ivory-faint);
      transition: background var(--quick) ease-out;
    }
    .archive__dot.is-active::after { background: var(--ivory); }
    .archive__dot:focus-visible { outline: var(--line) solid var(--ivory); outline-offset: -6px; }
    .archive__grid { grid-template-columns: minmax(0, 1fr); }
    .archive__column { display: none; grid-auto-rows: clamp(220px, 62vw, 300px); }
    .archive__column.is-active { display: grid; }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');

    /* Read a picture into a small luminance map once; redraw it as vertical lines every frame. */
    function lineScreen(box) {
      const img = box.querySelector('.archive__source');
      const canvas = box.querySelector('.archive__canvas');
      const context = canvas.getContext('2d');
      const pitch = 3;
      let map = null;
      let cols = 0;
      let rows = 0;

      const sample = () => {
        const width = canvas.clientWidth;
        const height = canvas.clientHeight;
        if (!width || !height || !img.naturalWidth) return;
        cols = Math.ceil(width / pitch);
        rows = Math.ceil(height / 2);
        const probe = document.createElement('canvas');
        probe.width = cols;
        probe.height = rows;
        const pc = probe.getContext('2d');
        const scale = Math.max(cols / img.naturalWidth, rows / img.naturalHeight);
        const w = img.naturalWidth * scale;
        const h = img.naturalHeight * scale;
        pc.drawImage(img, (cols - w) / 2, (rows - h) / 2.6, w, h);
        try {
          const data = pc.getImageData(0, 0, cols, rows).data;
          map = new Float32Array(cols * rows);
          for (let i = 0; i < cols * rows; i++) {
            const lum = (data[i * 4] * 0.3 + data[i * 4 + 1] * 0.59 + data[i * 4 + 2] * 0.11) / 255;
            map[i] = Math.min(1, Math.max(0, (lum - 0.06) * 1.7));
          }
        } catch (error) {
          box.classList.add('is-fallback');
          map = null;
        }
      };

      const paint = (seconds) => {
        const width = canvas.clientWidth;
        const height = canvas.clientHeight;
        context.clearRect(0, 0, width, height);
        if (!map) return;
        const light = box.classList.contains('archive__screen--ice');
        context.fillStyle = getComputedStyle(box).color;
        for (let x = 0; x < cols; x++) {
          for (let y = 0; y < rows; y++) {
            let v = map[y * cols + x];
            if (light) v = 1 - v;
            const wave = 0.86 + Math.sin(seconds * 1.4 + y * 0.05 + x * 0.02) * 0.14;
            const w = v * pitch * 0.92 * wave;
            if (w < 0.25) continue;
            context.fillRect(x * pitch + (pitch - w) / 2, y * 2, w, 2);
          }
        }
      };
      return { canvas, context, img, sample, paint };
    }

    /* Ribbed metal objects drawn from many thin strokes. */
    function object(canvas) {
      const context = canvas.getContext('2d');
      const shape = canvas.dataset.shape;
      const paint = (seconds) => {
        const width = canvas.clientWidth;
        const height = canvas.clientHeight;
        const tone = getComputedStyle(canvas).color;
        context.clearRect(0, 0, width, height);
        context.strokeStyle = tone;
        context.lineWidth = 1;
        const cx = width / 2;
        const cy = height / 2;
        const s = Math.min(width, height);
        if (shape === 'ring') {
          for (let i = 0; i < 90; i++) {
            const a = (i / 90) * Math.PI * 2 + seconds * 0.15;
            const light = 0.25 + 0.75 * Math.max(0, Math.cos(a - 0.8));
            context.globalAlpha = light;
            context.beginPath();
            context.ellipse(cx + Math.cos(a) * s * 0.26, cy + Math.sin(a) * s * 0.18, s * 0.07, s * 0.16, a + Math.PI / 2, 0, Math.PI * 2);
            context.stroke();
          }
        } else if (shape === 'stack') {
          for (let c = 0; c < 3; c++) {
            const x0 = cx + (c - 1) * s * 0.3;
            for (let k = 0; k < 6; k++) {
              const y0 = cy - s * 0.4 + k * s * 0.15;
              const bulge = s * (0.09 + 0.03 * Math.sin(k * 1.3 + c + seconds * 0.6));
              for (let r = -8; r <= 8; r++) {
                const t = r / 8;
                context.globalAlpha = 0.2 + 0.8 * (1 - Math.abs(t + 0.35)) ** 2;
                context.beginPath();
                context.moveTo(x0 + t * bulge * 0.7, y0);
                context.quadraticCurveTo(x0 + t * bulge * 1.4, y0 + s * 0.075, x0 + t * bulge * 0.7, y0 + s * 0.15);
                context.stroke();
              }
            }
          }
        } else {
          for (let i = 0; i < 26; i++) {
            const y0 = cy + s * 0.05 + Math.sin(i * 0.45 + seconds * 0.5) * s * 0.1 - i * s * 0.012;
            const x0 = width * 0.06 + i * (width * 0.034);
            context.globalAlpha = 0.3 + 0.7 * Math.abs(Math.sin(i * 0.45 + seconds * 0.5));
            context.fillStyle = tone;
            context.beginPath();
            context.moveTo(x0, y0);
            context.lineTo(x0 + width * 0.06, y0 - s * 0.14);
            context.lineTo(x0 + width * 0.075, y0 - s * 0.1);
            context.lineTo(x0 + width * 0.015, y0 + s * 0.04);
            context.closePath();
            context.fill();
          }
        }
        context.globalAlpha = 1;
      };
      return { canvas, context, paint, sample() {} };
    }

    function run(root) {
      const pieces = [
        ...[...root.querySelectorAll('.archive__screen')].map(lineScreen),
        ...[...root.querySelectorAll('.archive__object')].map(object),
      ];
      let frame = 0;
      let visible = false;
      const fit = () => {
        const density = Math.min(2, devicePixelRatio || 1);
        for (const piece of pieces) {
          piece.canvas.width = piece.canvas.clientWidth * density;
          piece.canvas.height = piece.canvas.clientHeight * density;
          piece.context.setTransform(density, 0, 0, density, 0, 0);
          piece.sample();
          piece.paint(performance.now() / 1000);
        }
      };
      const tick = (now) => {
        for (const piece of pieces) piece.paint(now / 1000);
        frame = requestAnimationFrame(tick);
      };
      const resume = () => {
        cancelAnimationFrame(frame);
        if (visible && !still.matches) frame = requestAnimationFrame(tick);
      };
      for (const piece of pieces) {
        if (piece.img && !piece.img.complete) piece.img.addEventListener('load', fit, { once: true });
      }
      new ResizeObserver(fit).observe(root);
      new IntersectionObserver(([entry]) => { visible = entry.isIntersecting; resume(); }).observe(root);

      const dots = [...root.querySelectorAll('.archive__dot')];
      const columns = [...root.querySelectorAll('.archive__column')];
      dots.forEach((dot) => dot.addEventListener('click', () => {
        const index = Number(dot.dataset.column);
        dots.forEach((d, i) => { d.classList.toggle('is-active', i === index); d.setAttribute('aria-selected', String(i === index)); });
        columns.forEach((c, i) => c.classList.toggle('is-active', i === index));
        fit();
      }));
    }

    document.querySelectorAll('.archive').forEach(run);
  })();
</script>

Similar components

Colour wash showcase

Colour wash showcase

Spread

Spread

Featured tile rail

Featured tile rail

Night viewer

Night viewer

Bracketed Exhibits

Bracketed Exhibits

Loose project grid

Loose project grid

Latest work rail

Latest work rail

Spiral gallery

Spiral gallery