/* The service columns: five narrow columns, one service each, the name standing upright in Archivo (a variable
   typeface with a width axis from 62 to 125 and a weight axis from 100 to 900). The column under the pointer widens
   on a spring, its name falls flat onto the one vermilion line and its description writes itself underneath. */
:root {
  --paper: #f3f0e8;               /* the page */
  --ink: #141414;                 /* the open name and the description */
  --grey: #8d887e;                /* the standing names and the hint */
  --rule: rgba(20, 20, 20, 0.16); /* the hairlines between the columns and the floor */
  --accent: #ff3d17;              /* the line under the open name, the only colour on the page */
}

* {
  box-sizing: border-box;
}

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

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

.stage {
  --pad: clamp(16px, 3.9vw, 56px);
  display: flex;
  flex-direction: column;
  height: 100svh;
  min-height: 460px;
  padding: clamp(18px, 3vw, 38px) var(--pad) clamp(16px, 2.6vw, 34px);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
}

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

.top__mask {
  display: block;
  overflow: hidden;
  padding: 0 1px 2px;
}

.top__item {
  display: block;
  font-variation-settings: 'wdth' 104, 'wght' 640;
}

.top__item--grey {
  color: var(--grey);
  font-variation-settings: 'wdth' 96, 'wght' 420;
  text-align: right;
}

.hint-touch {
  display: none;
}

@media (hover: none) {
  .hint-mouse {
    display: none;
  }

  .hint-touch {
    display: inline;
  }
}

/* ---------------------------------------------------------------- the columns */
.cols {
  --foot: 78px;     /* the room under the floor, for the description */
  --in: 24px;       /* the space inside each column (the script measures it) */
  --name: 96px;     /* the size of the names (the script measures it) */
  position: relative;
  flex: 1;
  min-height: 300px;
  margin-top: clamp(18px, 3vw, 34px);
  touch-action: pan-y;
}

/* the floor every name stands on */
.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--foot);
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

.col {
  position: absolute;
  top: 0;
  left: 0;
  width: 20%;
  height: 100%;
  overflow: hidden;
  outline: none;
  cursor: default;
}

.col:focus-visible {
  outline: 1px dashed var(--grey);
  outline-offset: -6px;
}

.col__rule {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
  transform-origin: 50% 0;
}

.col:first-of-type .col__rule {
  visibility: hidden;
}

/* the name: the script turns it about its bottom left corner, upright when the column is narrow, flat when open */
.col__name {
  position: absolute;
  left: var(--in);
  bottom: calc(var(--foot) + 0.06em);
  margin: 0;
  font-size: var(--name);
  font-weight: normal;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--grey);
  font-variation-settings: 'wdth' 72, 'wght' 320;
  transform-origin: 0 100%;
  opacity: 0;
  will-change: transform;
}

.col__desc {
  position: absolute;
  left: var(--in);
  top: calc(100% - var(--foot) + 16px);
  margin: 0;
  font-size: 16px;
  line-height: 1.42;
  font-variation-settings: 'wdth' 98, 'wght' 420;
}

.col__word {
  white-space: nowrap;
}

.col__char {
  opacity: 0;
}

.col__read {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* the one coloured line, under the open name */
.mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

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

  .cols {
    --foot: 92px;
  }

  .col__desc {
    top: calc(100% - var(--foot) + 12px);
    font-size: 13px;
    line-height: 1.38;
  }
}
