kitbash Sign in Connect agent
Components

Red clock field

The signature first screen: red dot-grid field, a live analogue clock made of a blurred black glow with thin red and black hands, the hour, minute, month and day as huge wide numerals in the corners, a WORK link, a left side tab, a help note and round shuffle and sound buttons. Shuffle flips it to a red disc on black.

Part of the style

Red Hour

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=Archivo:ital,wdth,wght@0,62..125,400..900;1,62..125,400..900&display=swap");
:root {
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}
</style>

<section class="clock" aria-label="Morra studio, live clock">
  <div class="clock__field">
    <span class="clock__spot" aria-hidden="true"></span>
    <div class="clock__glow" aria-hidden="true"></div>
    <svg class="clock__face" viewBox="-100 -100 200 200" aria-hidden="true">
      <g class="clock__hand clock__hand--hour"><line x1="0" y1="8" x2="0" y2="-40"></line></g>
      <g class="clock__hand clock__hand--minute"><line x1="0" y1="10" x2="0" y2="-68"></line><circle cx="0" cy="-68" r="1.7"></circle></g>
      <g class="clock__hand clock__hand--second"><line x1="0" y1="18" x2="0" y2="-82"></line><circle cx="0" cy="-82" r="1.3"></circle><circle cx="0" cy="18" r="1.3"></circle></g>
      <circle class="clock__pin" cx="0" cy="0" r="2"></circle>
    </svg>

    <time class="clock__time" datetime="">
      <span class="clock__num clock__num--hour" data-clock="hour">10</span>
      <span class="clock__num clock__num--minute" data-clock="minute">20</span>
      <span class="clock__num clock__num--month" data-clock="month">NOV</span>
      <span class="clock__num clock__num--day" data-clock="day">18</span>
    </time>

    <a class="clock__work" href="#">Work</a>

    <a class="clock__tab" href="#" aria-label="Morra, shortlisted for a site of the day">
      <span class="clock__tab-mark">M.</span>
      <span class="clock__tab-word">Shortlist</span>
    </a>

    <button class="clock__help" type="button" aria-label="How the clock works" aria-expanded="false">
      <span class="clock__key clock__key--square">?</span>
    </button>
    <div class="clock__note" role="dialog" aria-label="How the clock works" hidden>
      <div class="clock__note-head">
        <button class="clock__note-close" type="button" aria-label="Close note"><span class="clock__note-x">&times;</span></button>
        <span class="clock__note-title">The hour room</span>
      </div>
      <p class="clock__note-text">This clock runs on your own time. Move across the dots, lean the glow, flip the room with the arrows. Press it again to come back.</p>
      <p class="clock__note-foot">Sound + type + time</p>
    </div>

    <div class="clock__keys">
      <button class="clock__btn clock__btn--flip" type="button" aria-label="Flip the room" aria-pressed="false">
        <span class="clock__key clock__key--square">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 10a7 7 0 0 1 12.5-3.5M19 14a7 7 0 0 1-12.5 3.5"></path><path d="M18 3v4h-4M6 21v-4h4"></path></svg>
        </span>
      </button>
      <button class="clock__btn clock__btn--sound" type="button" aria-label="Ticking sound" aria-pressed="false">
        <span class="clock__key clock__key--round">
          <span class="clock__bars" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span>
        </span>
      </button>
    </div>

    <span class="clock__down" aria-hidden="true">&darr;</span>
  </div>
</section>

<style>
  .clock {
    background: var(--signal);
  }
  .clock__field {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    height: clamp(560px, 75vw, 860px);
    background-color: var(--signal);
    background-image: radial-gradient(circle, var(--dot) calc(var(--dot-size) / 2), transparent calc(var(--dot-size) / 2 + 0.6px));
    background-size: var(--grid-step) var(--grid-step);
    background-position: center;
    color: var(--ink);
    transition: background-color var(--time) var(--ease);
  }

  /* The dot nearest the pointer grows. */
  .clock__spot {
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: var(--radius-round);
    background: var(--ink);
    opacity: 0;
    transition: opacity var(--quick) var(--ease), translate var(--quick) var(--ease);
  }
  .clock.is-pointing .clock__spot { opacity: 1; }

  .clock__glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(300px, 46vw, 640px);
    aspect-ratio: 1;
    translate: calc(-50% + var(--lean-x, 0px)) calc(-50% + var(--lean-y, 0px));
    border-radius: 50%;
    background: radial-gradient(circle, var(--ink) 0 34%, transparent 70%);
    filter: blur(6px);
    animation: clock-glow-in var(--intro) var(--ease) both;
    transition: translate var(--time) var(--ease), width var(--time) var(--ease), background var(--time) var(--ease), filter var(--time) var(--ease);
  }
  @keyframes clock-glow-in {
    from { opacity: 0.3; scale: 0.82; background: radial-gradient(circle, var(--signal-deep) 0 30%, transparent 70%); }
  }

  .clock__face {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(280px, 40vw, 560px);
    aspect-ratio: 1;
    translate: -50% -50%;
    overflow: visible;
    z-index: 1;
  }
  .clock__hand line {
    stroke-linecap: round;
  }
  .clock__hand--hour line { stroke: var(--signal); stroke-width: 0.9; }
  .clock__hand--minute line { stroke: var(--signal); stroke-width: 0.7; }
  .clock__hand--minute circle { fill: var(--signal); }
  .clock__hand--second line { stroke: var(--ink); stroke-width: 0.5; }
  .clock__hand--second circle { fill: var(--ink); }
  .clock__pin { fill: var(--signal); }

  .clock__num {
    position: absolute;
    z-index: 2;
    font-family: var(--font-display);
    font-stretch: 125%;
    font-weight: 900;
    font-size: var(--display-xl);
    line-height: 0.74;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    animation: clock-num-in var(--time-slow) var(--ease) both;
    animation-delay: 0.7s;
  }
  .clock__num--hour { left: var(--edge); top: var(--edge); }
  .clock__num--minute { right: var(--edge); top: var(--edge); }
  .clock__num--month { left: var(--edge); bottom: var(--edge); }
  .clock__num--day { right: var(--edge); bottom: var(--edge); }
  @keyframes clock-num-in {
    from { opacity: 0; translate: 0 -0.12em; }
  }

  .clock__work {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: calc(var(--edge) - 12px);
    translate: -50% 0;
    display: grid;
    place-items: center;
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0 var(--space-s);
    color: inherit;
    font-family: var(--font-display);
    font-stretch: 125%;
    font-weight: 900;
    font-size: var(--display-s);
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: -0.01em;
  }
  .clock__work::after {
    content: "";
    position: absolute;
    left: var(--space-s);
    right: var(--space-s);
    bottom: 10px;
    height: 2px;
    background: currentColor;
    scale: 0 1;
    transition: scale var(--quick) var(--ease);
  }
  .clock__work:hover::after,
  .clock__work:focus-visible::after { scale: 1 1; }

  .clock__tab {
    position: absolute;
    z-index: 3;
    left: 0;
    top: 50%;
    translate: 0 -50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-s);
    width: 48px;
    padding: var(--space-s) 0 var(--space-m);
    background: var(--ink);
    color: var(--text);
    text-decoration: none;
    transition: width var(--quick) var(--ease);
  }
  .clock__tab:hover,
  .clock__tab:focus-visible { width: 56px; }
  .clock__tab-mark {
    font-family: var(--font-display);
    font-stretch: 125%;
    font-weight: 900;
    font-size: 15px;
  }
  .clock__tab-word {
    writing-mode: vertical-rl;
    rotate: 180deg;
    font-size: var(--text-xs);
    font-weight: 500;
  }

  .clock__help,
  .clock__btn,
  .clock__note-close {
    display: grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }
  .clock__help {
    position: absolute;
    z-index: 3;
    left: 56px;
    top: 50%;
    translate: 0 -50%;
  }
  .clock__key {
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--signal);
    font: 500 13px/1 var(--font-mono);
    transition: scale var(--quick) var(--ease), background var(--time) var(--ease), color var(--time) var(--ease);
  }
  .clock__key--square { width: 26px; height: 26px; border-radius: var(--radius-s); }
  .clock__key--round { width: 38px; height: 38px; border-radius: var(--radius-round); }
  .clock__help:hover .clock__key,
  .clock__btn:hover .clock__key { scale: 1.12; }
  .clock__help:focus-visible .clock__key,
  .clock__btn:focus-visible .clock__key,
  .clock__note-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
  .clock__key svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .clock__keys {
    position: absolute;
    z-index: 3;
    right: calc(var(--edge) - 6px);
    top: 50%;
    translate: 0 -50%;
    display: grid;
    justify-items: center;
    gap: var(--space-s);
  }
  .clock__bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 14px;
  }
  .clock__bars i {
    width: 2px;
    height: 4px;
    border-radius: 1px;
    background: currentColor;
  }
  .clock__bars i:nth-child(2), .clock__bars i:nth-child(4) { height: 8px; }
  .clock__bars i:nth-child(3) { height: 12px; }
  .clock__btn--sound[aria-pressed="true"] .clock__bars i {
    animation: clock-bar 0.9s var(--ease) infinite alternate;
  }
  .clock__bars i:nth-child(2) { animation-delay: -0.2s !important; }
  .clock__bars i:nth-child(3) { animation-delay: -0.5s !important; }
  .clock__bars i:nth-child(4) { animation-delay: -0.1s !important; }
  @keyframes clock-bar {
    to { height: 14px; }
  }

  .clock__note {
    position: absolute;
    z-index: 4;
    left: 104px;
    top: 50%;
    translate: 0 -50%;
    width: min(260px, calc(100% - 120px));
    padding: var(--space-xs) var(--space-s) var(--space-s);
    border-radius: var(--radius-s);
    background: var(--ink);
    color: var(--signal);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.45;
    text-transform: uppercase;
    animation: clock-note-in var(--time) var(--ease);
  }
  .clock__note[hidden] { display: none; }
  @keyframes clock-note-in {
    from { opacity: 0; translate: -8px -50%; }
  }
  .clock__note-head {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-left: -10px;
    border-bottom: 1px solid var(--signal);
  }
  .clock__note-x {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--signal);
    color: var(--ink);
    font-size: 15px;
  }
  .clock__note-text { margin: var(--space-s) 0 var(--space-l); }
  .clock__note-foot { margin: 0; color: var(--signal); opacity: 0.7; }

  .clock__down {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 14px;
    translate: -50% 0;
    font-size: 15px;
  }

  /* Flipped: black room, red disc. Red numerals turn black where they cross the disc. */
  .clock.is-flipped .clock__field {
    background-color: var(--ink);
    background-image: radial-gradient(circle, var(--signal) calc(var(--dot-size) / 2), transparent calc(var(--dot-size) / 2 + 0.6px));
    color: var(--signal);
  }
  .clock.is-flipped .clock__glow {
    width: clamp(520px, 88vw, 1200px);
    background: radial-gradient(circle, var(--signal) 0 69%, transparent 70.5%);
    filter: none;
  }
  .clock.is-flipped .clock__num { color: var(--signal); mix-blend-mode: difference; }
  .clock.is-flipped .clock__hand line,
  .clock.is-flipped .clock__pin { stroke: var(--ink); }
  .clock.is-flipped .clock__hand circle,
  .clock.is-flipped .clock__pin { fill: var(--ink); }
  .clock.is-flipped .clock__spot { background: var(--signal); }
  .clock.is-flipped .clock__tab { box-shadow: inset -1px 0 0 var(--signal); }
  .clock.is-flipped .clock__key { box-shadow: 0 0 0 1px var(--signal); }

  @media (max-width: 600px) {
    .clock__field { height: clamp(560px, 160vw, 760px); }
    .clock__glow { width: min(86vw, 400px); }
    .clock__face { width: min(78vw, 340px); }
    .clock__work { top: calc(var(--edge) + 28px); }
    .clock__num--hour, .clock__num--minute { top: calc(var(--edge) + 28px); }
    .clock__keys { top: 30%; }
    .clock__down { display: none; }
    .clock__note { left: 56px; top: auto; bottom: 22%; translate: 0 0; width: calc(100% - 72px); }
    .clock.is-flipped .clock__glow { width: 150vw; }
  }

  @media (prefers-reduced-motion: reduce) {
    .clock__glow, .clock__num, .clock__note { animation: none; }
  }
</style>

<script>
(() => {
  const MONTHS = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
  const LEAN = 0.04;
  const calm = matchMedia('(prefers-reduced-motion: reduce)');

  const pad = (value) => String(value).padStart(2, '0');

  function handAngles(now) {
    const seconds = now.getSeconds() + (calm.matches ? 0 : now.getMilliseconds() / 1000);
    const minutes = now.getMinutes() + seconds / 60;
    const hours = (now.getHours() % 12) + minutes / 60;
    return { hour: hours * 30, minute: minutes * 6, second: seconds * 6 };
  }

  function playTick(audio) {
    const tone = audio.createOscillator();
    const volume = audio.createGain();
    tone.frequency.value = 1800;
    volume.gain.setValueAtTime(0.08, audio.currentTime);
    volume.gain.exponentialRampToValueAtTime(0.0001, audio.currentTime + 0.03);
    tone.connect(volume).connect(audio.destination);
    tone.start();
    tone.stop(audio.currentTime + 0.04);
  }

  function setUp(root) {
    const field = root.querySelector('.clock__field');
    const glow = root.querySelector('.clock__glow');
    const spot = root.querySelector('.clock__spot');
    const time = root.querySelector('.clock__time');
    const hands = {
      hour: root.querySelector('.clock__hand--hour'),
      minute: root.querySelector('.clock__hand--minute'),
      second: root.querySelector('.clock__hand--second'),
    };
    const numbers = Object.fromEntries([...root.querySelectorAll('[data-clock]')].map((el) => [el.dataset.clock, el]));
    const help = root.querySelector('.clock__help');
    const note = root.querySelector('.clock__note');
    const flip = root.querySelector('.clock__btn--flip');
    const sound = root.querySelector('.clock__btn--sound');
    let frame = 0;
    let lastSecond = -1;
    let audio = null;

    function writeNumerals(now) {
      numbers.hour.textContent = pad(now.getHours());
      numbers.minute.textContent = pad(now.getMinutes());
      numbers.month.textContent = MONTHS[now.getMonth()];
      numbers.day.textContent = pad(now.getDate());
      time.setAttribute('datetime', now.toISOString());
    }

    function draw() {
      const now = new Date();
      const angles = handAngles(now);
      for (const name in hands) hands[name].setAttribute('transform', `rotate(${angles[name]})`);
      if (now.getSeconds() !== lastSecond) {
        lastSecond = now.getSeconds();
        writeNumerals(now);
        if (audio) playTick(audio);
      }
    }

    function loop() {
      draw();
      frame = calm.matches ? setTimeout(loop, 1000) : requestAnimationFrame(loop);
    }
    function stop() {
      cancelAnimationFrame(frame);
      clearTimeout(frame);
    }

    new IntersectionObserver(([entry]) => {
      stop();
      if (entry.isIntersecting) loop();
    }).observe(root);
    draw();

    field.addEventListener('pointermove', (event) => {
      const box = field.getBoundingClientRect();
      const x = event.clientX - box.left;
      const y = event.clientY - box.top;
      const step = parseFloat(getComputedStyle(field).backgroundSize) || 80;
      const nearestX = box.width / 2 + Math.round((x - box.width / 2) / step) * step;
      const nearestY = box.height / 2 + Math.round((y - box.height / 2) / step) * step;
      spot.style.translate = `${nearestX}px ${nearestY}px`;
      root.classList.add('is-pointing');
      if (calm.matches) return;
      glow.style.setProperty('--lean-x', `${(x - box.width / 2) * LEAN}px`);
      glow.style.setProperty('--lean-y', `${(y - box.height / 2) * LEAN}px`);
    });
    field.addEventListener('pointerleave', () => {
      root.classList.remove('is-pointing');
      glow.style.setProperty('--lean-x', '0px');
      glow.style.setProperty('--lean-y', '0px');
    });

    function setNote(open) {
      note.hidden = !open;
      help.setAttribute('aria-expanded', String(open));
    }
    help.addEventListener('click', () => setNote(note.hidden));
    note.querySelector('.clock__note-close').addEventListener('click', () => setNote(false));
    root.addEventListener('keydown', (event) => {
      if (event.key === 'Escape') setNote(false);
    });

    flip.addEventListener('click', () => {
      const flipped = root.classList.toggle('is-flipped');
      flip.setAttribute('aria-pressed', String(flipped));
    });

    sound.addEventListener('click', () => {
      const on = sound.getAttribute('aria-pressed') !== 'true';
      sound.setAttribute('aria-pressed', String(on));
      audio = on ? new AudioContext() : (audio.close(), null);
    });
  }

  document.querySelectorAll('.clock').forEach(setUp);
})();
</script>

Similar components

Error screen

Error screen

HUD hero

HUD hero

Screensaver deck

Screensaver deck

Ruled hero

Ruled hero

Floating field hero

Floating field hero

Haze hero

Haze hero

Selection-box name

Selection-box name

Film reel

Film reel