kitbash Sign in Connect agent
Components

Pink voice card

A neon pink box with a halftone portrait in an ink frame and a hand-drawn oval Watch button tilted across it, a giant name, a place with a badge, a narrow job line, a story and an underlined link.

Part of the style

Backroom Tunnel

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --metal: #ad91bf;
  --backstage: #020204;
  --spot: #bfa2d1;
  --neon: #9a7673;
  --echo: #a06e58;
}
</style>

<section class="voices" aria-label="Voices">
  <div class="voices__box">
    <h2 class="voices__label">Voices</h2>

    <div class="voices__media">
      <canvas class="voices__picture" role="img" aria-label="Halftone portrait in pink dots: a printer under two bare bulbs, holding up a fresh sheet, drying prints on a line behind"></canvas>
      <a class="voices__watch" href="#">
        <svg class="voices__oval" viewBox="0 0 147 51" preserveAspectRatio="none" aria-hidden="true">
          <path d="M19 10.2C41 3.4 97.5 0.4 127.6 6.6c17.6 3.6 20 12.6 15.8 20.4-6.2 11.4-38.4 20.6-76.4 20.2C30.4 46.8 3.4 40.4 3 26.8 2.7 15.6 22.8 7.4 52.6 4.1"></path>
        </svg>
        <span class="voices__watch-word">Watch</span>
      </a>
    </div>

    <div class="voices__story">
      <h3 class="voices__name">Margo</h3>
      <div class="voices__place">
        <p class="voices__venue">Two Rivers Riso</p>
        <span class="voices__badge">Lowtown</span>
      </div>
      <p class="voices__role">Head printer and shop owner, eleven years on the same green drum</p>
      <div class="voices__text">
        <p>Margo started by folding other people's zines for free at the back of a record fair. Then somebody showed her how to load a master, and she stayed until closing. A stint in hotel laundry taught her how to keep machines alive on no budget; the drum taught her patience.</p>
        <p>Today she runs a two-room shop, trains three apprentices a year and still clears the paper jams herself.</p>
        <p>Filmed by Odile Marsh<br>Drawn by Saltwater Studio</p>
      </div>
      <a class="voices__more" href="#">All voices</a>
    </div>
  </div>
</section>

<style>
  .voices {
    padding: var(--edge);
    background: var(--metal);
  }
  .voices__box {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: var(--space-4);
    border-radius: var(--radius-main);
    background: var(--neon);
    color: var(--backstage);
  }
  @media (min-width: 768px) {
    .voices__box {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto 1fr;
    }
  }
  .voices__label {
    grid-column: 1 / -1;
    margin: 0 0 calc(var(--space-8) - 20px);
    font: 400 var(--t-c1)/1.1 var(--font-label);
    font-stretch: calc(var(--label-width) * 1%);
    text-transform: uppercase;
  }

  .voices__media {
    position: relative;
    align-self: start;
    aspect-ratio: 1;
    overflow: hidden;
    border: var(--outline) solid var(--backstage);
    border-radius: var(--radius-main);
    background: var(--backstage);
  }
  .voices__picture {
    width: 100%;
    height: 100%;
    color: var(--neon);
  }

  .voices__watch {
    position: absolute;
    left: 31%;
    top: 63%;
    display: grid;
    place-items: center;
    min-width: 147px;
    min-height: 51px;
    padding: 14px 22px 12px;
    color: var(--metal);
    text-decoration: none;
    rotate: -10deg;
    transition: color var(--time) var(--ease);
  }
  .voices__oval {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    fill: transparent;
    stroke: var(--metal);
    stroke-width: var(--outline);
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    transition: fill var(--time) var(--ease), stroke var(--time) var(--ease);
  }
  .voices__oval path { vector-effect: non-scaling-stroke; }
  .voices__watch-word {
    position: relative;
    font: 800 var(--t-h4)/0.9 var(--font-poster);
    letter-spacing: -0.025em;
    text-transform: uppercase;
  }
  .voices__watch:hover,
  .voices__watch:focus-visible { color: var(--neon); }
  .voices__watch:hover .voices__oval,
  .voices__watch:focus-visible .voices__oval { fill: var(--backstage); stroke: var(--backstage); }
  .voices__watch:focus-visible { outline: none; }
  .voices__watch:focus-visible .voices__watch-word { text-decoration: underline 2px; text-underline-offset: 4px; }

  .voices__story {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .voices__name {
    margin: -0.06em 0 0;
    font: 800 var(--t-display)/0.95 var(--font-poster);
    letter-spacing: -0.026em;
    text-transform: uppercase;
  }
  .voices__place {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
    margin-top: 16px;
  }
  .voices__venue {
    margin: 0;
    font: 800 var(--t-h3)/0.95 var(--font-poster);
    letter-spacing: -0.039em;
    text-transform: uppercase;
  }
  .voices__badge {
    padding: 5px 5px 4px;
    border-radius: var(--radius-small);
    background: var(--backstage);
    color: var(--neon);
    font: 400 var(--t-c1)/1.1 var(--font-label);
    font-stretch: calc(var(--label-width) * 1%);
    text-transform: uppercase;
    white-space: nowrap;
  }
  .voices__role {
    max-width: 30ch;
    margin: var(--space-7) 0 0;
    font: 400 var(--t-large)/0.99 var(--font-label);
    font-stretch: calc(var(--label-width) * 1%);
    letter-spacing: -0.014em;
    text-transform: uppercase;
    text-wrap: balance;
  }
  .voices__text {
    max-width: 52ch;
    margin: var(--space-7) 0 var(--space-7);
  }
  .voices__text p { margin: 0 0 1.2em; }
  .voices__text p:last-child { margin-bottom: 0; }

  .voices__more {
    position: relative;
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    min-height: var(--tap);
    margin-top: auto;
    padding: 1px 0 var(--space-1);
    color: var(--backstage);
    font: 400 var(--t-c1)/1.1 var(--font-label);
    font-stretch: calc(var(--label-width) * 1%);
    text-decoration: none;
    text-transform: uppercase;
  }
  .voices__more::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--outline);
    background: var(--backstage);
    transition: background-color var(--time) var(--ease);
  }
  .voices__more:hover::after,
  .voices__more:focus-visible::after { background: var(--metal); }
  .voices__more:focus-visible { outline: none; }

  @media (max-width: 767.98px) {
    .voices__role { max-width: none; }
  }
</style>

<script>
(() => {
  const clamp = (value) => Math.min(1, Math.max(0, value));
  const glow = (x, y, cx, cy, spread) => Math.exp(-((x - cx) ** 2 + (y - cy) ** 2) / spread);
  const inEllipse = (x, y, cx, cy, rx, ry) => ((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2;
  const grain = (x, y) => {
    const n = Math.sin(x * 12.9898 + y * 78.233) * 43758.5453;
    return n - Math.floor(n);
  };

  function light(x, y) {
    let value = 0.05;
    value += 0.55 * glow(x, y, 0.27, 0.1, 0.03) + 0.45 * glow(x, y, 0.76, 0.06, 0.025);
    value += 0.95 * glow(x, y, 0.27, 0.1, 0.0012) + 0.95 * glow(x, y, 0.76, 0.06, 0.001);
    if (Math.abs(x - 0.27) < 0.004 && y < 0.08) value = 0.6;
    if (Math.abs(x - 0.76) < 0.004 && y < 0.04) value = 0.6;

    if (Math.abs(y - (0.2 + (x - 0.5) ** 2 * 0.2)) < 0.004) value = Math.max(value, 0.55);
    for (const [left, right, top] of [[0.04, 0.17, 0.21], [0.2, 0.33, 0.215], [0.62, 0.74, 0.21], [0.78, 0.94, 0.215]]) {
      if (x > left && x < right && y > top && y < top + 0.17) {
        const stripe = Math.floor((y - top) / 0.03) % 2 ? 0.48 : 0.62;
        value = Math.max(value, stripe - (x - left) * 0.6);
      }
    }

    const body = inEllipse(x, y, 0.46, 1.04, 0.37, 0.37);
    if (body < 1) value = 0.06 + 0.5 * clamp(0.62 - x) * clamp(1.2 - body) + 0.2 * glow(x, y, 0.3, 0.72, 0.02);
    if (body > 0.9 && body < 1 && x < 0.4) value = 0.8;

    const neck = Math.abs(x - 0.455) < 0.05 && y > 0.52 && y < 0.7;
    if (neck) value = 0.12 + 0.55 * clamp((0.47 - x) * 8);

    const hair = inEllipse(x, y, 0.47, 0.47, 0.15, 0.2);
    if (hair < 1) value = hair > 0.84 && (x < 0.43 || y < 0.33) ? 0.72 - clamp(x - 0.43) * 3 : 0.05;

    const face = inEllipse(x, y, 0.445, 0.47, 0.095, 0.135);
    if (face < 1 && y > 0.37) {
      const nx = (x - 0.445) / 0.095;
      const ny = (y - 0.47) / 0.135;
      value = 0.1 + 0.85 * clamp(-nx * 0.8 - ny * 0.25 + Math.sqrt(clamp(1 - face)) * 0.55);
      if (Math.abs(ny + 0.05) < 0.1) value *= 0.72;
    }

    const sheet = x > 0.56 && x < 0.88 && y > 0.6 && y < 0.97 + (x - 0.56) * 0.1;
    if (sheet) {
      value = 0.96 - (y - 0.6) * 0.3 - (x - 0.56) * 0.4;
      if (inEllipse(x, y, 0.72, 0.72, 0.075, 0.075) < 1) value = 0.06;
      for (const top of [0.82, 0.86]) {
        if (y > top && y < top + 0.018 && x > 0.6 && x < (top > 0.84 ? 0.76 : 0.84)) value = 0.08;
      }
    }
    const hand = inEllipse(x, y, 0.575, 0.8, 0.042, 0.058);
    if (hand < 1) value = 0.45 + 0.4 * clamp(1 - hand);

    return clamp(value + (grain(x * 997, y * 991) - 0.5) * 0.08);
  }

  function halftone(canvas) {
    const context = canvas.getContext('2d');
    const density = Math.min(2, devicePixelRatio || 1);
    const size = canvas.clientWidth;
    if (!size) return;
    canvas.width = Math.round(size * density);
    canvas.height = Math.round(canvas.clientHeight * density);
    context.setTransform(density, 0, 0, density, 0, 0);
    context.clearRect(0, 0, size, canvas.clientHeight);
    context.fillStyle = getComputedStyle(canvas).color;

    const cell = Math.max(4.2, size / 120);
    const reach = size * 1.5;
    const cos = Math.SQRT1_2;
    for (let u = -reach; u < reach; u += cell) {
      for (let v = -reach; v < reach; v += cell) {
        const x = (u * cos - v * cos) + size / 2;
        const y = (u * cos + v * cos) + canvas.clientHeight / 2;
        if (x < -cell || y < -cell || x > size + cell || y > canvas.clientHeight + cell) continue;
        const radius = cell * 0.64 * Math.pow(light(x / size, y / canvas.clientHeight), 0.8);
        if (radius < 0.35) continue;
        context.beginPath();
        context.arc(x, y, radius, 0, Math.PI * 2);
        context.fill();
      }
    }
  }

  document.querySelectorAll('.voices').forEach((root) => {
    const canvas = root.querySelector('.voices__picture');
    let pending = 0;
    let width = 0;
    new ResizeObserver(() => {
      if (canvas.clientWidth === width) return;
      width = canvas.clientWidth;
      cancelAnimationFrame(pending);
      pending = requestAnimationFrame(() => halftone(canvas));
    }).observe(canvas);
  });
})();
</script>

Similar components

Press quote

Press quote

Timed reviews

Timed reviews

Slab quote

Slab quote

Quote rails

Quote rails

Lineup tiles

Lineup tiles

Ruled hero

Ruled hero

Hello block

Hello block

Author

Author