/* One side at a time: a thin outline on a warm white page, a faint guide circle behind it and the name of the
   shape beside it, in a variable typeface that widens as the shape gets rounder. */
:root {
  --page: #f3f0e8;          /* the page */
  --ink: #141414;           /* the outline and the name */
  --muted: #8f8a80;         /* the number of sides */
  --guide: #cdc6b8;         /* the guide circle and the centre mark */
  --accent: #2346ff;        /* the corner being born, the closed circle */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Archivo Variable', 'Archivo', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* phone and narrow frames: the shape on top, the name centred under it */
.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-content: center;
  justify-items: center;
  gap: clamp(14px, 3.5svh, 30px);
  padding: 32px 16px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- the shape */
.figure {
  display: block;
  width: min(78vw, 52svh, 420px);
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
  color: var(--ink);
}

.guide circle,
.guide path {
  fill: none;
  stroke: var(--guide);
}

.guide circle {
  stroke-dasharray: 1.4 3.2;
}

.shape__line {
  fill: none;
  stroke: currentColor;
  stroke-linejoin: miter;
  stroke-linecap: butt;
}

.shape__tick {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: butt;
}

/* ---------------------------------------------------------------- the name */
.caption {
  display: grid;
  justify-items: center;
  gap: 0.2em;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.name {
  position: relative;
  margin: 0;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(34px, 10.5vw, 64px);
  line-height: 1;
  font-weight: 340;
  font-variation-settings: 'wdth' 70;
  letter-spacing: -0.01em;
  /* the letters drop into a window: cut above and below, free to the sides */
  padding: 0.12em 0 0.26em;
  clip-path: inset(0 -100vw);
}

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

.spec {
  margin: 0;
  overflow: hidden;
  padding: 0.1em 0 0.2em;
  font-size: clamp(12px, 3.4vw, 15px);
  line-height: 1.2;
  font-weight: 420;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.spec__text {
  display: inline-block;
  white-space: nowrap;
}

/* wide frames: the shape on the left, the name beside it, left aligned in a column as wide as the longest name */
@media (min-width: 640px) and (min-aspect-ratio: 1/1) {
  .stage {
    grid-template-columns: auto var(--name-w, 6.4em);
    align-items: center;
    gap: clamp(8px, 2vw, 32px);
  }

  .figure {
    width: min(40vw, 62svh, 440px);
  }

  .caption {
    justify-self: stretch;
    justify-items: start;
  }

  .name {
    text-align: left;
    font-size: clamp(40px, 5.6vw, 84px);
  }

  .spec {
    font-size: clamp(13px, 1.25vw, 16px);
    padding-left: 0.2em;
  }
}
