/* Glyphs that turn to look: the glyph set of a made-up type foundry, Quarry, on black. One glyph per thin frame, in
   Fraunces (a variable serif: weight 100 to 900, softness 0 to 100, optical size 9 to 144); one orange for the frame
   under the pointer and its name. The script sizes the grid and writes every frame's turn and every glyph's axes. */
:root {
  --night: #0d0d0c;                   /* the page */
  --ink: #efebe3;                     /* the glyphs */
  --grey: #77736b;                    /* the small texts */
  --frame: rgba(239, 235, 227, 0.16); /* the frames at rest */
  --accent: #ff6a2b;                  /* the frame under the pointer, its name and code */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100svh;
  background: var(--night);
  color: var(--ink);
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  --pad: clamp(16px, 5vw, 80px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100svh;
  padding: clamp(18px, 3.4vw, 40px) var(--pad) clamp(18px, 3vw, 36px);
}

/* ---------------------------------------------------------------- the top line and the hint */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 15px;
}

.top__name {
  font-variation-settings: 'wght' 600, 'SOFT' 100, 'opsz' 18;
}

.top__note {
  color: var(--grey);
  font-variation-settings: 'wght' 400, 'SOFT' 0, 'opsz' 14;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--grey);
  text-align: center;
  font-variation-settings: 'wght' 400, 'opsz' 12;
}

/* ---------------------------------------------------------------- the sheet */
.sheet {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  min-height: 0;
  touch-action: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 8), var(--cell, 120px));
  grid-auto-rows: var(--cell, 120px);
  gap: var(--gap, 8px);
}

/* the frame: turned by the script */
.cell {
  position: relative;
  will-change: transform;
}

/* the frame's look, on the child, so the script's transform does not wipe it */
.cell__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--frame);
  transition: border-color 0.25s ease;
}

.cell.is-on .cell__face {
  border-color: var(--accent);
}

.cell__glyph {
  font-size: calc(var(--cell, 120px) * 0.58);
  line-height: 1;
  font-variation-settings: 'wght' 300, 'SOFT' 0, 'opsz' 144;
  transform: translateY(-3%);
  user-select: none;
  -webkit-user-select: none;
}

/* the name and the code point of the glyph under the pointer */
.cell__name,
.cell__code {
  position: absolute;
  bottom: 7px;
  font-size: 10px;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  font-variation-settings: 'wght' 480, 'SOFT' 0, 'opsz' 9;
  letter-spacing: 0.02em;
  opacity: 0;
}

.cell__name {
  left: 8px;
}

.cell__code {
  right: 8px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .top {
    font-size: 14px;
  }

  .cell__name,
  .cell__code {
    bottom: 5px;
    font-size: 8px;
  }

  .cell__name {
    left: 5px;
  }

  .cell__code {
    right: 5px;
  }
}
