:root {
  --fondo: #f4f4f2;
  --carta: #ffffff;
  --bordo: rgba(0, 0, 0, 0.07);
  --testo: #121212;
  --testo-2: #6d6d72;
  --testo-3: #a6a6ab;
  --pista: #ececee;
  --accento: #3b5bfd;
  /* the three page tones of the preview */
  --paper-bg: #fbfaf7; --paper-ink: #1d1c1a; --paper-soft: #8b8780;
  --sepia-bg: #f3e7d3; --sepia-ink: #3d2f20; --sepia-soft: #9a8468;
  --night-bg: #17181c; --night-ink: #e6e3dc; --night-soft: #85827c;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  width: min(352px, 100%);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(12px, 3.2vmin, 18px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 40px -18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.9vh, 12px);
}

.head { display: flex; align-items: center; gap: 10px; }
.mark { width: 32px; height: 32px; border-radius: 10px; background: #121212; display: grid; place-items: center; flex: none; }
.mark svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.head__text { flex: 1; min-width: 0; }
.head__title { font-size: 14px; font-weight: 620; letter-spacing: -0.01em; }
.head__meta { font-size: 12px; color: var(--testo-2); margin-top: 1px; }
.done { font-size: 12px; font-weight: 560; color: var(--testo-2); padding: 6px 10px; border-radius: 999px; background: #f2f2f3; transition: background .2s; }
@media (hover: hover) { .done:hover { background: #e9e9eb; } }

/* the article preview: it keeps one height, the text recomposes inside it and fades at the bottom */
.page {
  position: relative;
  height: clamp(118px, 27vh, 156px);
  border-radius: 14px;
  background: var(--paper-bg);
  color: var(--paper-ink);
  overflow: hidden;
  /* the clip also holds when a child is animating on its own layer */
  clip-path: inset(0 round 14px);
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.page__in { padding: 12px 14px 0; font-family: "Newsreader Variable", Georgia, serif; font-size: 17px; }
.page__kicker { font-family: "Mona Sans Variable", system-ui, sans-serif; font-size: 10.5px; letter-spacing: .02em; color: var(--paper-soft); }
.page__title { font-size: 1.32em; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; margin: 3px 0 5px; }
.page__body { font-size: 0.8em; line-height: 1.5; }
.page__fade { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(to bottom, transparent, var(--paper-bg) 62%); pointer-events: none; }
.page__measure {
  position: absolute; right: 8px; bottom: 7px;
  font-size: 10px; font-weight: 560; color: var(--paper-soft);
  background: var(--paper-bg); padding: 2px 7px; border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.ctl { display: flex; flex-direction: column; gap: 6px; }
.ctl__head { display: flex; justify-content: space-between; align-items: baseline; }
.ctl__label { font-size: 12px; font-weight: 600; color: var(--testo); }
.ctl__value { font-size: 12px; color: var(--testo-2); position: relative; overflow: hidden; height: 1.25em; display: inline-block; }
.roll { display: inline-block; }

.size { display: flex; align-items: center; gap: 10px; }
.size__a { color: var(--testo-2); font-weight: 560; line-height: 1; width: 14px; text-align: center; }
.size__a--s { font-size: 11px; }
.size__a--l { font-size: 18px; }
.slider { position: relative; flex: 1; height: 26px; touch-action: none; cursor: pointer; outline: none; }
.rail { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: var(--pista); overflow: hidden; }
.rail__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accento); border-radius: 4px; }
.notches { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
.notch { position: absolute; top: -5px; width: 2px; height: 10px; margin-left: -1px; border-radius: 2px; background: #d6d6da; }
.notch.is-past { background: rgba(255, 255, 255, 0.7); }
.knob {
  position: absolute; top: 50%; left: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.18);
}
.slider:focus-visible .knob { box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.3), 0 2px 6px rgba(0, 0, 0, 0.18); }

.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: #f2f2f3; }
.seg__pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.12); }
.seg__opt { position: relative; z-index: 1; height: 32px; font-size: 12.5px; font-weight: 560; color: var(--testo-2); display: flex; align-items: center; justify-content: center; gap: 6px; transition: color .25s; }
.seg__opt.is-on { color: var(--testo); }
.seg__aa { font-size: 14px; font-weight: 600; }
.seg__aa--serif { font-family: "Newsreader Variable", Georgia, serif; font-size: 15px; }

.tones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tone {
  position: relative; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: box-shadow .25s;
}
.tone[data-tone="paper"] { background: var(--paper-bg); color: var(--paper-ink); }
.tone[data-tone="sepia"] { background: var(--sepia-bg); color: var(--sepia-ink); }
.tone[data-tone="night"] { background: var(--night-bg); color: var(--night-ink); }
.tone__aa { font-family: "Newsreader Variable", Georgia, serif; font-size: 16px; font-weight: 600; }
.tone.is-on { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 2px #fff, 0 0 0 4px var(--accento); }
.tone__tick {
  position: absolute; right: 5px; top: 5px; width: 13px; height: 13px; padding: 2px;
  border-radius: 50%; background: var(--accento); fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transform: scale(.4);
}

.ghost {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px;
  pointer-events: none; z-index: 5; opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ghost path { fill: #121212; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

@media (min-width: 1000px) and (min-height: 700px) {
  .card { transform: scale(1.35); }
}
