/* Anatomy of a letter: a type specimen on warm paper. The word in Fraunces (a variable serif: optical size, weight
   and softness), the notes in Inter Tight, thin guide lines and one vermilion for the leader lines. */
:root {
  --paper: #f4f1ea;               /* the page */
  --ink: #141414;                 /* the word and the names of the parts */
  --grey: #a29c90;                /* the small texts and the definitions */
  --rest: #d3cdc1;                /* the letters that are not being pointed at */
  --rule: rgba(20, 20, 20, 0.13); /* the guide lines */
  --accent: #e0462a;              /* the leader lines and the guide that is pointed at */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter Tight Variable', 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  --pad: clamp(16px, 6vw, 96px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: clamp(18px, 3.4vw, 40px) var(--pad) clamp(18px, 3vw, 36px);
  user-select: none;
  -webkit-user-select: none;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 14px;
}

.top__name {
  font-weight: 620;
}

.top__note {
  color: var(--grey);
  font-weight: 420;
  text-align: right;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--grey);
  text-align: center;
}

/* ---------------------------------------------------------------- the sheet */
.sheet {
  --size: clamp(150px, min(31vw, 44vh), 440px);
  position: relative;
  align-self: center;
  justify-self: stretch;
  /* room above for the notes, the word, room below for the tails and the notes */
  padding: calc(var(--size) * 0.3) 0 calc(var(--size) * 0.5);
  touch-action: none;
}

.word {
  position: relative;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: var(--size);
  line-height: 1;
  font-variation-settings: 'opsz' 144, 'wght' 380, 'SOFT' 0, 'WONK' 0;
}

.letter {
  display: inline-block;
  will-change: transform;
}

.guides,
.notes,
.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.notes {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
}

.guide__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

.guide__name {
  position: absolute;
  right: 0;
  bottom: 5px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--grey);
  white-space: nowrap;
}

/* the leader lines and the crosshair on the part */
.lead {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* a note: the name of the part, and under it what it is */
.note {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  max-width: 300px;
  line-height: 1.3;
}

.note--up {
  display: flex;
  flex-direction: column-reverse;
}

.note__mask {
  display: block;
  overflow: hidden;
}

.note__name,
.note__what {
  display: block;
}

.note__name {
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.005em;
}

.note__what {
  text-wrap: balance;
  font-size: 13px;
  color: var(--grey);
  font-weight: 420;
}

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

  .sheet {
    --size: min(52vw, 32vh);
    padding: calc(var(--size) * 0.7) 0 calc(var(--size) * 0.85);
  }

  .note {
    max-width: 170px;
  }

  .note__name {
    font-size: 14px;
  }

  .note__what {
    font-size: 12px;
  }

  /* on a narrow screen the names of the guides stay hidden until their line is touched */
  .guide__name {
    font-size: 10px;
    opacity: 0;
  }
}
