/* The opening angle: a protractor in hairlines on warm paper. One electric blue, kept for the square of the right
   angle. Everything is set in Anybody, a variable sans whose width goes from 50 to 150: the number uses all of it. */
:root {
  --paper: #f3f0e8;               /* the page */
  --ink: #141414;                 /* the arms, the number */
  --grey: #8a857b;                /* the small texts and the scale numbers */
  --tick: rgba(20, 20, 20, 0.26); /* the ticks outside the angle */
  --tick-in: rgba(20, 20, 20, 0.78); /* the ticks inside the angle */
  --rule: rgba(20, 20, 20, 0.16); /* the base line and the scale */
  --accent: #2f3dff;              /* the square of the right angle */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

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

.stage {
  --pad: clamp(16px, 5vw, 72px);
  display: grid;
  grid-template-rows: auto 1fr auto auto 1fr auto;
  justify-items: center;
  min-height: 100svh;
  padding: clamp(18px, 3.4vw, 40px) var(--pad) clamp(16px, 2.6vw, 30px);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ---------------------------------------------------------------- the top line */
.top {
  justify-self: stretch;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 14px;
  font-stretch: 100%;
}

.top__name {
  font-size: 16px;
  font-weight: 640;
  font-stretch: 128%;
  letter-spacing: 0.01em;
}

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

/* ---------------------------------------------------------------- the protractor */
.dial {
  grid-row: 3;
  position: relative;
  width: min(100%, 780px, calc((100svh - 360px) * 640 / 322));
  min-width: min(300px, 100%);
  aspect-ratio: 640 / 322;
  outline: none;
  cursor: grab;
}

.dial.is-held {
  cursor: grabbing;
}

.dial__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.base,
.scale {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ticks {
  fill: none;
  stroke: var(--tick);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ticks--in {
  stroke: var(--tick-in);
}

.mark {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.arm {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: butt;
  vector-effect: non-scaling-stroke;
}

.grip {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: butt;
  vector-effect: non-scaling-stroke;
}

.pivot {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.dial:focus-visible .scale {
  stroke: var(--ink);
}

/* the scale numbers round the rim */
.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.label {
  position: absolute;
  font-size: 11px;
  line-height: 1;
  font-stretch: 90%;
  color: var(--grey);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: color 0.35s ease;
}

.label.is-in {
  color: var(--ink);
}

/* ---------------------------------------------------------------- the reading */
.read {
  grid-row: 4;
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-top: clamp(4px, 1.4svh, 16px);
}

.num {
  font-size: clamp(64px, min(15vw, 15svh), 156px);
  line-height: 1;
  font-weight: 560;
  font-stretch: 60%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  padding: 0.04em 0 0.02em;
  overflow: hidden;
}

.num__in {
  display: inline-block;
}

.num__deg {
  display: inline-block;
  margin-left: 0.02em;
  font-weight: 300;
}

.name {
  display: grid;
  justify-items: center;
  height: 1.4em;
  overflow: hidden;
  font-size: 13px;
  font-stretch: 118%;
  font-weight: 520;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
}

.name__line {
  grid-area: 1 / 1;
  align-self: center;
  white-space: pre;
}

.ch {
  display: inline-block;
}

.hint {
  grid-row: 6;
  align-self: end;
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--grey);
}

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

  .label {
    font-size: 9px;
  }

  .name {
    font-size: 12px;
  }
}
