/* The Twitter monitor page: a poster. A radar with a giant "< 1 s", then two small diagrams and a few words,
   all on the centre line. */
.post[data-accent="monitor"] {
  text-align: center;

  & .project-meta { justify-content: center; }
  & .lede { max-width: 30rem; margin-inline: auto; text-wrap: balance; }
  & .prose { margin-top: 2.25rem; }
  & .prose > p { max-width: 30rem; margin-inline: auto; text-wrap: balance; }

  /* The radar: the beam, the rings and the figure share one grid cell. The beam is a CSS conic gradient, so
     its turn runs on the compositor. Its period (6 s) and the blips' delays below are one clock: a blip
     lights when the beam's edge reaches its angle. */
  & .radar {
    position: relative;
    display: grid;
    max-width: 34rem;
    margin: 0 auto;
    overflow: clip;
  }
  & .radar > * { grid-area: 1 / 1; }
  & .radar .diagram { margin: 0; max-width: none; }
  & .beam {
    position: relative;
    place-self: center;
    width: 93.333%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(transparent 0 265deg, color-mix(in srgb, var(--accent) 30%, transparent));
    animation: monitor-sweep 6s linear infinite;
  }
  & .beam::after {
    content: "";
    position: absolute;
    top: 0;
    left: calc(50% - 0.75px);
    width: 1.5px;
    height: 50%;
    background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 25%, transparent));
  }
  & .ring { fill: none; stroke: var(--line); stroke-opacity: 0.5; vector-effect: non-scaling-stroke; }
  & .ring.edge { stroke: var(--accent-line); stroke-opacity: 1; }
  & .cross { fill: none; stroke: var(--line); stroke-opacity: 0.4; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; }
  & .ticks { fill: none; stroke: var(--line); stroke-width: 5; stroke-dasharray: 0.3 4.7; stroke-dashoffset: 0.15; }
  & .ticks.major { stroke: var(--gray-500); stroke-width: 10; stroke-dasharray: 0.6 29.4; stroke-dashoffset: 0.3; }
  & .blips .blip { fill: var(--accent-2); opacity: 0; }
  & .blips .ping { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; vector-effect: non-scaling-stroke; }
  & .blips circle { animation: monitor-blip 18s linear infinite; animation-delay: var(--d); }
  & .blips .ping { animation-name: monitor-ping; animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  /* Three turns of the beam per cycle: each blip lights on one of them, at its own angle. */
  & .blips g:nth-child(1) { --d: -17.6s; }
  & .blips g:nth-child(2) { --d: -10.867s; }
  & .blips g:nth-child(3) { --d: -4.133s; }
  & .blips g:nth-child(4) { --d: -15.5s; }
  & .blips g:nth-child(5) { --d: -8.7s; }
  & .blips g:nth-child(6) { --d: -13.9s; }
  & .blips g:nth-child(7) { --d: -1.133s; }
  & .blips g:nth-child(8) { --d: -6.467s; }

  & .radar h2 {
    place-self: center;
    margin: 0;
    font-size: min(11.5rem, 34vw - 1rem);
    line-height: 1;
    letter-spacing: -0.06em;
    color: var(--text);
    text-shadow: 0 0 0.1em var(--page), 0 0 0.03em var(--page);
  }
  & .radar h2::before { content: none; }
  & .big { display: inline-flex; align-items: baseline; }
  & .lt { margin-right: 0.07em; font-weight: 400; color: var(--accent); }
  & .secs { margin-left: 0.1em; font: 400 0.34em/1 var(--mono); letter-spacing: 0; color: var(--accent-2); }
  & .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  & .cap {
    grid-area: 2 / 1;
    margin: 1.25rem 0 0;
    font: 400 0.8125rem/1.5 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-500);
  }
  & .radar + p { margin-top: 2.5rem; font-size: 1.375rem; line-height: 1.45; color: var(--text); }

  /* The sections: a small mono label with a blip in front, a diagram, one line. */
  & .prose > h2 {
    margin: 6.5rem 0 1.75rem;
    font: 400 0.8125rem/1.5 var(--mono);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
  }
  & .prose > h2::before {
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.75rem;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: 0.1rem;
  }
  & .prose > .diagram { max-width: 28rem; margin: 0 auto 1.75rem; }
  & .diagram text { font-size: 13px; }
  & .diagram .label { fill: var(--gray-500); }
  & .diagram .label.lit { fill: var(--accent); }

  /* The live stream: dots ride every branch at one speed, so they line up on the shared trunk. */
  & .src-ring { fill: none; stroke: var(--accent-line); stroke-width: 1.5; }
  & .src-hand { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
  & .src, & .end { fill: var(--accent); }
  & .fade-from { stop-color: var(--gray-500); }
  & .fade-to { stop-color: var(--gray-500); stop-opacity: 0; }
  & .fan { fill: none; stroke: url(#monitor-fade); stroke-width: 1.5; opacity: 0.45; }
  & .fan.lit { stroke: var(--accent); opacity: 0.5; }
  & .flow { fill: none; stroke: url(#monitor-fade); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0.5 15.5; animation: monitor-flow 0.4s linear infinite; }
  & .flow.lit { stroke: var(--accent-2); }

  /* The delay: a bar from "made" to "reached me" that takes under a second to draw. */
  & .tick { fill: none; stroke: var(--gray-500); stroke-width: 1.5; }
  & .track { fill: none; stroke: var(--line); stroke-dasharray: 2 4; }
  & .delay { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 1 1; animation: monitor-bar 3.2s infinite; }
  & .start { fill: var(--gray-500); }
  & .runner { fill: var(--accent-2); transform: translateX(264px); animation: monitor-run 3.2s infinite; }

  & .coda {
    margin-top: 6.5rem;
    font: 400 0.8125rem/1.5 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-500);
  }
}
html[data-theme="light"] .post[data-accent="monitor"] .beam {
  background: conic-gradient(transparent 0 265deg, color-mix(in srgb, var(--accent) 20%, transparent));
}

@keyframes monitor-sweep { to { transform: rotate(1turn); } }
@keyframes monitor-blip {
  0%, 3% { opacity: 1; }
  16%, 100% { opacity: 0; }
}
@keyframes monitor-ping {
  0% { opacity: 0.9; transform: scale(1); }
  9%, 100% { opacity: 0; transform: scale(5); }
}
@keyframes monitor-flow { to { stroke-dashoffset: -16; } }
@keyframes monitor-bar {
  0% { stroke-dashoffset: 1; opacity: 1; animation-timing-function: cubic-bezier(0.3, 0.6, 0.3, 1); }
  28%, 82% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes monitor-run {
  0% { transform: translateX(0); opacity: 1; animation-timing-function: cubic-bezier(0.3, 0.6, 0.3, 1); }
  28%, 82% { transform: translateX(264px); opacity: 1; }
  100% { transform: translateX(264px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .post[data-accent="monitor"] {
    & .beam, & .blips circle, & .flow, & .delay, & .runner { animation: none; }
    & .beam { transform: rotate(60deg); }
    & .blips .blip { opacity: 0.8; }
  }
}
