/* Rooms to measure: the rooms of a small made-up hotel, Halden, on warm paper. Five names in Archivo (a variable
   sans, weight 100 to 900 and width 62 to 125), narrow at rest; one thin vermilion dimension line that measures the
   room under the pointer. The script moves the line and the axes. */
:root {
  --paper: #f3f0e8;               /* the page */
  --ink: #141414;                 /* the names */
  --grey: #a39d92;                /* the names not chosen and the small texts */
  --accent: #e2432a;              /* the dimension line and its reading */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo Variable', 'Archivo', '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);
}

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

.top__name {
  font-variation-settings: 'wght' 640, 'wdth' 112;
}

.top__note {
  color: var(--grey);
  font-variation-settings: 'wght' 420, 'wdth' 100;
}

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

/* ---------------------------------------------------------------- the rooms */
.rooms {
  --fs: clamp(34px, min(6.6vw, 7.4vh), 84px);
  --row: calc(var(--fs) * 1.08 + 26px);
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(100%, 1080px);
  margin: 0;
  padding: 0;
  list-style: none;
  touch-action: pan-y;
}

.room {
  position: relative;
  height: var(--row);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

/* the mask lets the name rise into place when the page opens */
.room__mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.room__name {
  display: inline-block;
  font-size: var(--fs);
  line-height: 1.02;
  white-space: nowrap;
  letter-spacing: -0.01em;
  font-variation-settings: 'wght' 300, 'wdth' 80;
  user-select: none;
  -webkit-user-select: none;
}

.room:focus-visible {
  outline: none;
}

.room:focus-visible .room__name {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}

/* ---------------------------------------------------------------- the dimension line: one for all the rooms */
.quota {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 13px;
  pointer-events: none;
  will-change: transform;
}

.quota__line {
  position: absolute;
  top: 6px;
  left: 0;
  width: 100px;
  height: 1px;
  background: var(--accent);
  transform-origin: 0 50%;
}

.quota__tick {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 13px;
  background: var(--accent);
  transform-origin: 50% 50%;
}

.quota__read {
  position: absolute;
  top: -1px;
  left: 0;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wght' 520, 'wdth' 100;
}

@media (max-width: 640px) {
  .rooms {
    --fs: clamp(32px, 10.4vw, 46px);
    --row: calc(var(--fs) * 1.08 + 24px);
  }

  .top {
    font-size: 13px;
  }

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