Back to the library

Lock-on demand

Variant: Standard

Four corner brackets close in on the one action that can't wait, such as a session about to expire or a confirmation that blocks everything else, while a light scrim dims the rest of the card. Use it for a rare, high-stakes cue, not for routine prompts. The brackets close in over 288ms with a strong ease-out so they land quickly and settle without bouncing. They let go in 192ms, and the release scales slightly outward so it reads as letting go rather than as the brackets reversing.

attentionfocussessionbracketsscrim

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Lock-on demand — Standard</title>
<style>
:root {
  /* Neutrals — fixed, never remixed. */
  --ivory: #faf9f5;
  --paper: #ffffff;
  --oat: #e3dacc;
  --slate: #141413;

  /* Knobs — the remix API. A knob exists iff declared here and used below. */
  --hue: 38.8;
  --lift: 0;
  --chroma: 1;
  --round: 1; /* include ONLY if at least one border-radius is wrapped below */
  --speed: 1;

  /* Accents — derived from the knobs with the family's offsets baked in,
     so one hue roll moves them together. Defaults reproduce the original hex
     (#d97757 / #b85c3e / #788c5d / #b04a3f). */
  --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
  --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
  --olive: oklch(calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3));
  --rust: oklch(calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3));

  /* Clock — every duration in the document runs off --t. */
  --cycle: 3.2s; /* the authored master loop */
  --t: calc(var(--cycle) / var(--speed));

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* include only if used */

  --_w: 2.5px;
  --_arm: 14px;
  --_gap: 7px;
  --_from: 1.22;
  --_scrim: 0.12;
}

* { box-sizing: border-box; margin: 0; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ivory);
  color: var(--slate);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.card {
  position: relative;
  width: min(340px, 88vw);
  padding: clamp(16px, 5vw, 22px);
  display: grid;
  gap: clamp(12px, 3.5vw, 16px);
  background: var(--paper);
  border: 1px solid var(--oat);
  border-radius: calc(16px * var(--round));
  overflow: hidden;
}

.head { display: flex; gap: 12px; align-items: flex-start; }

.icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--clay) 18%, var(--paper));
}
.icon svg { width: 18px; height: 18px; stroke: var(--clay-d); fill: none; stroke-width: 2; stroke-linecap: round; }

.title { font-weight: 650; font-size: clamp(14px, 4vw, 16px); line-height: 1.25; }
.sub { margin-top: 3px; font-size: clamp(12px, 3.4vw, 13.5px); line-height: 1.4; color: color-mix(in oklch, var(--slate) 62%, var(--paper)); }

.target { position: relative; }

.btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: calc(10px * var(--round));
  background: var(--slate);
  color: var(--ivory);
  font: 600 clamp(13px, 3.6vw, 14.5px)/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* The hole's spread shadow is the scrim; the card's overflow clips it. */
.hole {
  position: absolute;
  inset: 0;
  border-radius: calc(10px * var(--round));
  box-shadow: 0 0 0 600px var(--slate);
  opacity: 0;
  pointer-events: none;
  animation: scrim var(--t) var(--ease-out) infinite;
}

.lock {
  position: absolute;
  inset: calc(var(--_gap) * -1);
  transform-origin: 50% 50%;
  opacity: 0;
  pointer-events: none;
  animation: lock var(--t) var(--ease-out) infinite;
}
.lock i {
  position: absolute;
  width: var(--_arm);
  height: var(--_arm);
  border: 0 solid var(--rust);
}
.lock i:nth-child(1) { top: 0; left: 0; border-top-width: var(--_w); border-left-width: var(--_w); border-top-left-radius: calc(10px * var(--round) + var(--_gap)); }
.lock i:nth-child(2) { top: 0; right: 0; border-top-width: var(--_w); border-right-width: var(--_w); border-top-right-radius: calc(10px * var(--round) + var(--_gap)); }
.lock i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: var(--_w); border-left-width: var(--_w); border-bottom-left-radius: calc(10px * var(--round) + var(--_gap)); }
.lock i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: var(--_w); border-right-width: var(--_w); border-bottom-right-radius: calc(10px * var(--round) + var(--_gap)); }

/* 9% of 3.2s = 288ms in; 6% = 192ms out, so the release is quicker than the grip. */
@keyframes lock {
  0%, 10% { opacity: 0; transform: scale(var(--_from)); }
  19%, 70% { opacity: 1; transform: scale(1); }
  76%, 100% { opacity: 0; transform: scale(1.04); }
}
@keyframes scrim {
  0%, 10% { opacity: 0; }
  19%, 70% { opacity: var(--_scrim); }
  76%, 100% { opacity: 0; }
}
@keyframes lock-calm {
  0%, 10% { opacity: 0; }
  24%, 66% { opacity: 0.75; }
  80%, 100% { opacity: 0; }
}

@media (max-width: 380px) {
  .card { padding: 16px; gap: 12px; }
  .head { gap: 10px; }
  .icon { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .lock { transform: none; animation: lock-calm calc(var(--t) * 2) var(--ease-out) infinite; }
  .hole { animation-duration: calc(var(--t) * 2); }
}
</style>
</head>
<body>
  <div class="card" role="alertdialog" aria-labelledby="t" aria-describedby="d">
    <div class="head">
      <span class="icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span>
      <div>
        <p class="title" id="t">Session expiring</p>
        <p class="sub" id="d">Confirm within 2:00 or unsaved edits are discarded.</p>
      </div>
    </div>
    <div class="target">
      <button class="btn" type="button">Stay signed in</button>
      <span class="hole" aria-hidden="true"></span>
      <span class="lock" aria-hidden="true"><i></i><i></i><i></i><i></i></span>
    </div>
  </div>
</body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.