:root {
  --carta: #f6f3ee;          /* warm white paper */
  --carta-2: #efebe4;        /* the panel */
  --inchiostro: #17150f;     /* ink */
  --grigio: #8b867c;         /* small labels */
  --filo: rgba(23, 21, 15, .14); /* hairlines */
  --accento: #d9542c;        /* the one accent: vermilion */
  --sans: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono Variable", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono {
  font-family: var(--mono);
  font-size: clamp(9px, .55vw + 4px, 11.5px);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grigio);
}

.prova {
  height: 100vh;
  display: flex; flex-direction: column;
  padding: clamp(14px, 3.4vh, 40px) clamp(14px, 4vw, 64px);
  gap: clamp(10px, 3vh, 34px);
}

/* ---- header ---- */
.testa { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-bottom: clamp(8px, 1.6vh, 16px); border-bottom: 1px solid var(--filo); }
.testa__marchio { display: flex; flex-direction: column; gap: .3em; }
.testa__nome { font-weight: 640; font-stretch: 104%; font-size: clamp(18px, 2.2vw + 4px, 34px); letter-spacing: -.02em; line-height: 1; }
.testa__nota { white-space: nowrap; }

/* ---- the bench: the sample and its controls, the glyph panel ---- */
.banco {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 28vw, 380px);
  gap: clamp(16px, 4vw, 64px);
  align-items: center;
}
.colonna { display: flex; flex-direction: column; gap: clamp(12px, 3.2vh, 34px); min-width: 0; }

.campione-box { position: relative; }
.campione {
  font-variation-settings: "wght" 420, "wdth" 100;
  font-size: 72px;              /* set by the script: Size times the stage scale */
  line-height: 1.04;
  letter-spacing: -.015em;
  outline: none;
  caret-color: var(--accento);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 1.04em;
  cursor: text;
}
.campione .l { display: inline; font-variation-settings: inherit; transition: color .25s; }
.campione .l.is-qui { color: var(--accento); }
.campione::selection, .campione .l::selection { background: rgba(217, 84, 44, .18); }

/* ---- style pills, with one ink pill sliding under the chosen one ---- */
.stili { position: relative; display: flex; flex-wrap: wrap; gap: 4px; align-self: flex-start; padding: 3px; border: 1px solid var(--filo); border-radius: 999px; }
.stili__fondo { position: absolute; left: 0; top: 0; height: 0; width: 0; border-radius: 999px; background: var(--inchiostro); box-shadow: 0 6px 16px -8px rgba(23, 21, 15, .55); pointer-events: none; }
.stile {
  position: relative; z-index: 1;
  font: 500 clamp(11px, .6vw + 6px, 14px)/1 var(--sans);
  font-stretch: 100%;
  color: var(--inchiostro);
  background: none; border: 0; border-radius: 999px;
  padding: .62em 1.05em;
  cursor: pointer;
  transition: color .3s, font-stretch .35s;
}
.stile.is-on { color: var(--carta); }
.stile:focus-visible { outline: 1.5px solid var(--accento); outline-offset: 2px; }
@media (hover: hover) {
  .stile:not(.is-on):hover { font-stretch: 112%; }
}

/* ---- hairline sliders ---- */
.cursori { display: flex; flex-direction: column; gap: clamp(6px, 1.6vh, 14px); max-width: 560px; }
.cursore { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 3.4em; align-items: center; gap: 14px; }
.cursore__nome { color: var(--inchiostro); }
.cursore__pista { position: relative; height: 22px; }
.cursore__pista::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--filo); }
.cursore__pieno { position: absolute; left: 0; top: 50%; height: 1px; width: 0; background: var(--inchiostro); transform: translateY(-.5px); }
.cursore__manico { position: absolute; top: 50%; left: 0; width: 3px; height: 14px; margin: -7px 0 0 -1.5px; border-radius: 2px; background: var(--accento); box-shadow: 0 2px 6px -2px rgba(217, 84, 44, .7); }
.cursore input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.cursore:focus-within .cursore__manico { outline: 1.5px solid var(--accento); outline-offset: 3px; }
.cursore__valore { position: relative; height: 1.3em; overflow: hidden; text-align: right; color: var(--inchiostro); font-variant-numeric: tabular-nums; }
.cursore__valore .riga { position: absolute; right: 0; top: 0; line-height: 1.3em; }

/* ---- the glyph panel ---- */
.glifo {
  position: relative;
  background: var(--carta-2);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(23, 21, 15, .06), 0 1px 0 rgba(255, 255, 255, .7), 0 24px 44px -30px rgba(23, 21, 15, .45);
  aspect-ratio: 4 / 5;
  max-height: min(64vh, 520px);
  width: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.glifo__tela { flex: 1; width: 100%; min-height: 0; display: block; }
.glifo__lettera { fill: var(--inchiostro); font-family: var(--sans); }
.glifo__linea { stroke: rgba(23, 21, 15, .22); stroke-width: 1; shape-rendering: crispEdges; }
.glifo__linea.is-base { stroke: var(--accento); stroke-opacity: .9; }
.glifo__guancia { stroke: rgba(23, 21, 15, .28); stroke-width: 1; stroke-dasharray: 2 3; shape-rendering: crispEdges; }
.glifo__etichetta { font-family: var(--mono); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; fill: var(--grigio); }
.glifo__dati { display: flex; justify-content: space-between; gap: .8em; padding: 10px 14px 12px; border-top: 1px solid var(--filo); }
.glifo__nome { color: var(--inchiostro); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: .02em; }
.glifo__largo { white-space: nowrap; }

/* ---- phone: the panel goes under, everything smaller ---- */
@media (max-width: 640px) {
  .prova { padding: 12px 14px; gap: 10px; }
  .testa { padding-bottom: 8px; }
  .testa__nota { display: none; }
  .banco { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: stretch; gap: 10px; }
  .colonna { gap: 9px; }
  .stile { padding: .55em .7em; font-size: 10.5px; }
  .cursori { gap: 2px; }
  .cursore { grid-template-columns: 4.4em minmax(0, 1fr) 2.6em; gap: 8px; }
  .cursore__pista { height: 18px; }
  .glifo { aspect-ratio: auto; max-height: none; height: 100%; min-height: 0; flex-direction: row; }
  .glifo__tela { flex: 1; height: 100%; }
  .glifo__dati { flex-direction: column; justify-content: center; border-top: 0; border-left: 1px solid var(--filo); padding: 8px 10px; width: 42%; }
  .glifo__nome { white-space: normal; }
}
@media (max-height: 430px) and (min-width: 641px) {
  .prova { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .colonna { gap: 8px; }
}
/* a tall phone: the panel stays a panel, the letter above and its name below, never stretched to the bottom */
@media (max-width: 640px) and (min-height: 600px) {
  .banco { grid-template-rows: auto auto; align-content: start; gap: 18px; }
  .colonna { gap: 14px; }
  .glifo { flex-direction: column; height: min(40vh, 340px); }
  .glifo__dati { flex-direction: row; justify-content: space-between; width: auto; border-left: 0; border-top: 1px solid var(--filo); padding: 10px 14px 12px; }
  .glifo__nome { white-space: nowrap; }
}
