/* The coding intro. Everything is prefixed st- so it can't clash with a host page. */

/* While the intro waits for fonts, hide the page so it never flashes. */
.intro-pending { background: var(--night); }
.intro-pending body > :not(.st-intro) { visibility: hidden; }

.intro-running,
.intro-locked { overflow: hidden; }

/* The real hand stays hidden until the end, so the snapping one never looks doubled. */
.intro-running .hero-mark { visibility: hidden; }

.st-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
}

.st-intro.is-revealing { pointer-events: none; }

/* The "editor": this is the layer the snap cuts a hole through. */
.st-sheet {
  position: absolute;
  inset: 0;
  background: var(--night);
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  --st-gutter: min(48px, calc(var(--edge) - 6px));
}

.st-gutter {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--st-gutter);
  padding-right: 8px;
  overflow: hidden;
  color: rgb(198 200 236 / .3);
  font-size: 11px;
  line-height: 24px;
  text-align: right;
  white-space: pre;
}

.st-line {
  position: absolute;
  right: 0;
  left: 0;
  height: 24px;
  background: rgb(255 255 255 / .05);
  transition: top .12s ease-out;
}

.st-line-number {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--st-gutter) - 8px);
  color: var(--snap);
  font-size: 11px;
  line-height: 24px;
  text-align: right;
}

/* Used when boxes must appear already finished, with nothing animating in. */
.is-instant .st-frame,
.is-instant .st-chip { transition: none; }

/* One box per element on the real page, at that element's real position. */
.st-box {
  position: absolute;
  opacity: 0;
}

.st-box.is-on { opacity: 1; }
.st-box.is-cleared { opacity: 0; transition: opacity .12s; }

.st-frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(198 200 236 / .5);
  border-radius: 3px;
  background: rgb(255 255 255 / .025);
  clip-path: inset(0 100% 100% 0);
  transition: clip-path .22s cubic-bezier(.2, .8, .2, 1), border-color .2s;
}

.st-box.is-on .st-frame { clip-path: inset(-1px); }
.st-box.is-active .st-frame { border-color: var(--snap); }

.st-box.is-image .st-frame {
  background:
    linear-gradient(to top right, transparent calc(50% - .5px), rgb(198 200 236 / .35) 50%, transparent calc(50% + .5px)),
    linear-gradient(to bottom right, transparent calc(50% - .5px), rgb(198 200 236 / .35) 50%, transparent calc(50% + .5px));
}

.st-chip {
  position: absolute;
  top: -1px;
  left: -1px;
  padding: 0 5px;
  border-radius: 3px 0 3px 0;
  background: rgb(198 200 236 / .9);
  color: var(--ink);
  font-size: 10px;
  font-weight: 500;
  line-height: 15px;
  transition: background .2s;
}

.st-box.is-active .st-chip { background: var(--snap); }

.st-code {
  position: absolute;
  inset: 17px 8px 2px;
  display: block;
  overflow: hidden;
  color: var(--white);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Small boxes drop the label and show one line of code. */
.st-box.is-small .st-chip { display: none; }
.st-box.is-small .st-code { inset: 50% 6px auto; transform: translateY(-50%); white-space: nowrap; }

.st-code-tag { color: var(--snap); }
.st-code-text { color: var(--white); }
.st-code-css { color: var(--lilac); }

.st-caret {
  display: inline-block;
  width: .55em;
  height: 1em;
  margin-left: 1px;
  background: var(--white);
  vertical-align: text-bottom;
}

/* Editor status bar, with the way out. */
.st-status {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 12px;
  background: var(--lift);
  color: var(--lilac);
  font-size: 11px;
}

.st-skip {
  padding: 2px 8px;
  border: 1px solid rgb(198 200 236 / .5);
  border-radius: 3px;
  background: none;
  color: var(--white);
  font: inherit;
  cursor: pointer;
}

.st-skip:hover { background: var(--white); color: var(--ink); }
.st-skip:focus-visible { outline: 2px solid var(--snap); outline-offset: 2px; }

/* The snap: the hand sits exactly on top of the real one on the page. */
.st-hand {
  position: absolute;
  opacity: 0;
  transform: scale(.72);
  transform-origin: 55% 62%;
  transition: opacity .14s, transform .24s cubic-bezier(.3, 1.6, .5, 1);
}

.st-hand.is-ready { opacity: 1; transform: none; }

.st-hand img {
  width: 100%;
  height: 100%;
  /* Cuts out the art's white rays. The yellow SVG rays replace them for the burst. */
  clip-path: polygon(0 22%, 68% 22%, 68% 0, 100% 0, 100% 100%, 0 100%);
  transform-origin: 55% 62%;
}

.st-hand svg {
  position: absolute;
  inset: 0;
  overflow: visible;
  opacity: 0;
  transform-origin: 43% 18%;
}

.st-hand.is-cocked img { transform: rotate(9deg) scale(.96); transition: transform .14s ease-out; }
.st-hand.is-snapped img { animation: st-snap .34s cubic-bezier(.2, .9, .3, 1) both; clip-path: none; }
.st-hand.is-snapped svg { animation: st-burst .42s ease-out both; }

@keyframes st-snap {
  0% { transform: rotate(9deg) scale(.96); }
  28% { transform: rotate(-8deg) scale(1.08); }
  100% { transform: none; }
}

@keyframes st-burst {
  0% { opacity: 0; transform: scale(.55); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Bright edge that rides on the outside of the reveal. */
.st-ring {
  position: absolute;
  border: 2px solid var(--snap);
  border-radius: 50%;
  box-shadow: 0 0 24px 2px rgb(255 209 102 / .45);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .st-gutter,
  .st-line-number { display: none; }
}
