/* Sleeper Agent: the draft war room. Pitch-black chalkboard grid, the name in
   the app's Barlow Condensed, and the icon's "z z" asleep at the end of it. */
@font-face {
  font-family: 'SA Barlow';
  src: url('/fonts/signoffs/sleeper-agent-barlow-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'SA Plex';
  src: url('/fonts/signoffs/sleeper-agent-plex-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

[data-signoff='sleeper-agent'] {
  --sa-pitch: #0a0e0c;
  --sa-line: rgb(54 68 58 / 0.42);
  --sa-chalk: #e8ece6;
  --sa-lime: #b3ff4a;
  --sa-mid: #3ecf8e;
  --sa-glow: rgb(179 255 74 / 0.16);
  --sa-ground: var(--sa-pitch);
  --sa-ink: var(--sa-chalk);
  --sa-z: var(--sa-lime);
  --sa-z2: var(--sa-mid);
  --sa-picked: var(--sa-lime);
}
/* In light mode the board is printed rather than lit: graph paper in the
   page's own white, pitch ink, and the greens deepened so they read on paper.
   A dark board on a white page would fade through grey. */
:root:not(.dark) [data-signoff='sleeper-agent'] {
  --sa-line: rgb(10 14 12 / 0.075);
  --sa-glow: rgb(179 255 74 / 0.32);
  --sa-ground: transparent;
  --sa-ink: var(--sa-pitch);
  --sa-z: #1f9d63;
  --sa-z2: #3ecf8e;
  --sa-picked: #17985c;
}

[data-signoff='sleeper-agent'] .sa-scene {
  background:
    radial-gradient(60% 90% at 82% 110%, var(--sa-glow), transparent 70%),
    linear-gradient(var(--sa-line) 1px, transparent 1px) 0 100% / 100% 36px,
    linear-gradient(90deg, var(--sa-line) 1px, transparent 1px) 50% 0 / 36px
      100%,
    var(--sa-ground);
  /* Eased, so the board's top edge never shows as a line. */
  -webkit-mask-image: linear-gradient(
    transparent,
    rgb(0 0 0 / 0.03) 14%,
    rgb(0 0 0 / 0.12) 26%,
    rgb(0 0 0 / 0.3) 38%,
    rgb(0 0 0 / 0.56) 50%,
    rgb(0 0 0 / 0.8) 62%,
    rgb(0 0 0 / 0.94) 74%,
    #000 86%
  );
  mask-image: linear-gradient(
    transparent,
    rgb(0 0 0 / 0.03) 14%,
    rgb(0 0 0 / 0.12) 26%,
    rgb(0 0 0 / 0.3) 38%,
    rgb(0 0 0 / 0.56) 50%,
    rgb(0 0 0 / 0.8) 62%,
    rgb(0 0 0 / 0.94) 74%,
    #000 86%
  );
}

[data-signoff='sleeper-agent'] .sa-name {
  --b-font: 'SA Barlow', 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --b-weight: 800;
  --b-fit: 0.15;
  --b-crop: 9%;
  --b-tracking: -0.005em;
  --b-ink: var(--sa-ink);
  --b-ink-dark: var(--sa-ink);
  text-transform: uppercase;
}
[data-signoff='sleeper-agent'] .sa-agent {
  transition: color 0.35s ease;
}
[data-signoff='sleeper-agent'] .sa-name[data-phase='picked'] .sa-agent {
  color: var(--sa-picked);
  text-shadow: 0 0 0.25em var(--sa-glow);
}

/* The "z z" sits on the cap line of the last letter and is the one thing in
   the band that takes a click. */
[data-signoff='sleeper-agent'] .sa-zz {
  align-self: flex-start;
  position: relative;
  height: 0.5em;
  min-width: 0.6em;
  margin: -0.18em 0 0 0.06em;
  padding: 0;
  border: 0;
  background: none;
  font:
    600 0.2em / 1 'SA Plex',
    'IBM Plex Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0;
  text-transform: none;
  color: var(--sa-z);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
[data-signoff='sleeper-agent'] .sa-zz::after {
  content: '';
  position: absolute;
  inset: -1em -0.5em -0.3em;
}
[data-signoff='sleeper-agent'] .sa-zz:focus-visible {
  outline: 2px solid var(--sa-z);
  outline-offset: 4px;
  border-radius: 4px;
}

/* After a pick the z z settle back in rather than snapping. */
[data-signoff='sleeper-agent'] .sa-z {
  position: absolute;
  inset: 0;
  animation: sa-doze 0.9s ease-out;
}
@keyframes sa-doze {
  from {
    opacity: 0;
    translate: 0 0.3em;
  }
}
[data-signoff='sleeper-agent'] .sa-z i {
  position: absolute;
  left: 0.1em;
  bottom: 0;
  font-style: normal;
  font-size: 1.3em;
  animation: sa-drift 3.6s ease-in-out infinite;
}
[data-signoff='sleeper-agent'] .sa-z i + i {
  left: 0.85em;
  bottom: 0.9em;
  font-size: 0.9em;
  color: var(--sa-z2);
  animation-delay: -1.8s;
}
[data-signoff='sleeper-agent'] .sa-zz:hover .sa-z i {
  animation-duration: 1.2s;
}
@keyframes sa-drift {
  0%,
  100% {
    translate: 0 0.08em;
    opacity: 0.55;
  }
  50% {
    translate: 0.06em -0.22em;
    opacity: 1;
  }
}

/* The clock and the pick borrow the watchlist chip from the app. They grow
   leftwards over the cap line, so a phone never clips them. */
[data-signoff='sleeper-agent'] .sa-chip {
  position: absolute;
  right: 0;
  bottom: 0.2em;
  padding: 0.28em 0.5em 0.24em;
  border: 1px solid var(--sa-z);
  border-radius: 0.22em;
  background: var(--sa-pitch);
  color: var(--sa-lime);
  font-size: 0.62em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: sa-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
[data-signoff='sleeper-agent'] .sa-chip-on {
  border-color: var(--sa-lime);
  background: var(--sa-lime);
  color: var(--sa-pitch);
}
@keyframes sa-pop {
  from {
    scale: 0.7;
    opacity: 0;
  }
}

@media (max-width: 640px) {
  [data-signoff='sleeper-agent'] .sa-scene {
    background-size:
      auto,
      100% 24px,
      24px 100%,
      auto;
  }
  [data-signoff='sleeper-agent'] {
    --b-height-m: 170px;
  }
  [data-signoff='sleeper-agent'] .sa-name {
    --b-fit: 0.152;
    --b-crop: 10%;
  }
  /* A phone has no room past the T, so the z z rise off its top instead of
     trailing it. */
  [data-signoff='sleeper-agent'] .sa-zz {
    font-size: 0.36em;
    translate: -1em -1.7em;
  }
}
