:root {
  --carta: #f7f4ee;          /* the warm paper of the page */
  --inchiostro: #1a1815;     /* the text and the pill */
  --testo-2: #5f5a52;        /* the body text */
  --testo-3: #a39d93;        /* the meta and the hairline */
  --linea: #e4ded3;
  --accento: #b5452a;        /* the one accent: rust, the kicker, the rolling minutes, the rule */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vh, 40px) 20px;
}

/* ---- the article ---- */
.post {
  width: min(540px, 100%);
}
.kicker {
  font-size: clamp(10px, 1.6vh, 12px);
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accento);
}
.title {
  margin-top: clamp(6px, 1.4vh, 12px);
  font-family: "Newsreader Variable", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 460;
  font-size: clamp(19px, min(5.6vw, 5vh), 40px);
  line-height: 1.08;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: clamp(10px, 2vh, 18px);
  font-size: clamp(11px, 1.8vh, 13px);
  color: var(--testo-3);
}
.avatar {
  display: grid;
  place-items: center;
  width: clamp(20px, 3.4vh, 26px);
  height: clamp(20px, 3.4vh, 26px);
  border-radius: 50%;
  background: #ece6db;
  color: var(--testo-2);
  font-size: clamp(8px, 1.3vh, 10px);
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(26, 24, 21, .06);
}
.meta__who { color: var(--inchiostro); font-weight: 500; }
.meta__sep { width: 1px; height: 12px; background: var(--linea); }
.meta__time { display: inline-flex; align-items: baseline; gap: 4px; }
.meta__unit { white-space: nowrap; }

/* the minutes roll like a counter: one digit sits in a window as tall as a line */
.roll {
  position: relative;
  display: inline-block;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  color: var(--accento);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.roll__cifra { display: block; }
.roll__cifra + .roll__cifra { position: absolute; left: 0; top: 0; }

.rule {
  display: block;
  height: 1px;
  margin: clamp(12px, 2.4vh, 22px) 0 clamp(10px, 2vh, 18px);
  background: var(--linea);
  position: relative;
  overflow: hidden;
}
.rule::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accento);
  transform-origin: 0 50%;
  transform: scaleX(var(--letto, .18));
  transition: transform 1.1s cubic-bezier(.645, .045, .355, 1);
}

/* ---- the body: clamped to a few lines, the height is set by the script ---- */
.body {
  position: relative;
  overflow: hidden;
}
.body__inner p {
  font-family: "Newsreader Variable", Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(13px, min(3.9vw, 2.9vh), 18px);
  line-height: 1.5;
  color: var(--testo-2);
}
.body__inner p + p { margin-top: .6em; }
.body__inner p:first-child::first-letter { color: var(--inchiostro); }
.parola { display: inline-block; white-space: pre; will-change: transform, opacity, filter; }

.fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2.4em;
  background: linear-gradient(to bottom, rgba(247, 244, 238, 0), var(--carta) 88%);
  pointer-events: none;
  font-size: clamp(13px, min(3.9vw, 2.9vh), 18px);
}

/* ---- the pill ---- */
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: clamp(36px, 6vh, 42px);
  margin-top: clamp(12px, 2.4vh, 20px);
  padding: 0 14px 0 18px;
  color: var(--carta);
  font-size: clamp(12px, 1.9vh, 14px);
  font-weight: 500;
  border-radius: 999px;
  outline: none;
}
.pill__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--inchiostro);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 6px 16px -8px rgba(26, 24, 21, .55), 0 1px 2px rgba(26, 24, 21, .2);
  transition: background .3s;
}
.pill:focus-visible .pill__bg { box-shadow: 0 0 0 3px var(--carta), 0 0 0 5px var(--accento); }
.pill__labels {
  position: relative;
  display: block;
  height: 1.3em;
  line-height: 1.3em;
  overflow: hidden;
  text-align: left;
}
.pill__label { display: block; width: max-content; white-space: nowrap; }
.pill__label[data-label="less"] { position: absolute; left: 0; top: 0; }
.pill__arrow {
  position: relative;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .pill:hover .pill__bg { background: #2d2a25; }
}

/* on a computer the column and the type grow, still bounded by the height */
@media (min-width: 900px) and (min-height: 620px) {
  .post { width: min(660px, 100%); margin-inline: auto; }
  .kicker { font-size: clamp(12px, 1.6vh, 14px); }
  .title { font-size: clamp(36px, min(4.4vw, 6.4vh), 58px); }
  .meta { font-size: clamp(13px, 1.9vh, 16px); }
  .avatar { width: 30px; height: 30px; font-size: 11px; }
  .body__inner p, .fade { font-size: clamp(18px, min(2vw, 2.8vh), 21px); }
  .pill { height: clamp(42px, 6vh, 50px); font-size: clamp(14px, 2vh, 16px); padding: 0 18px 0 22px; }
  .pill__arrow { width: 18px; height: 18px; }
}
