/* Letters that swap places: a minimal type piece. Warm paper, one word in a variable serif (Fraunces: weight,
   optical size and softness), a hairline under it and a vermilion hairline behind every letter that travels. */
:root {
  --paper: #f4f1ea;    /* the page */
  --ink: #1d1b17;      /* the letters */
  --trail: #d4462a;    /* the hairline each letter leaves behind, the only accent */
  --rule: #d6d0c4;     /* the line the word stands on */
  --muted: #9a9385;    /* the other words of the list and the notes */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ the notes */
.top {
  position: absolute;
  left: max(20px, 4vw);
  right: max(20px, 4vw);
  top: max(20px, 4vh);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  font-variation-settings: 'opsz' 12, 'wght' 420;
  color: var(--muted);
  opacity: 0;
}

.top__brand {
  color: var(--ink);
  font-variation-settings: 'opsz' 12, 'wght' 600;
}

/* ------------------------------------------------------------------ the word */
.word {
  position: absolute;
  inset: 0;
  margin: 0;
  font-size: var(--size, 160px);
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
}

.l {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  white-space: pre;
  will-change: transform;
}

.meter {
  position: absolute;
  left: 0;
  top: 0;
  font-size: var(--size, 160px);
  line-height: 1;
  white-space: pre;
  visibility: hidden;
  pointer-events: none;
}

.meter span {
  display: inline;
}

.rule {
  position: absolute;
  left: 0;
  top: 0;
  height: 1px;
  background: var(--rule);
  transform: scaleX(0);
}

.trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.trails path {
  fill: none;
  stroke: var(--trail);
  stroke-width: 1.25;
  stroke-linecap: round;
}

/* ------------------------------------------------------------------ the list of anagrams */
.list {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(22px, 5vh);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  opacity: 0;
}

.list button {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 10px;
  font: inherit;
  font-size: 15px;
  font-variation-settings: 'opsz' 14, 'wght' 340;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.3s, font-variation-settings 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.list button[aria-current='true'] {
  color: var(--ink);
  font-variation-settings: 'opsz' 14, 'wght' 640;
}

@media (hover: hover) {
  .list button:hover {
    color: var(--ink);
  }
}

.list button:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .list button {
    transition: none;
  }
}
