:root {
  --paper: #f3eee6;
  --board: #faf7f2;
  --ink: #26221e;
  --muted: #8a8279;
  --line: rgba(38, 34, 30, 0.12);
  --accent: #b5603a;
  --print: #fffdf9;
  --tape: rgba(236, 226, 205, 0.72);
  --shadow: rgba(52, 38, 26, 0.32);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow-x: clip; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  height: 100vh;
  overflow: clip;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.4vmin, 28px);
}

.board {
  position: relative;
  width: min(100%, 1000px, calc((100vh - 2 * clamp(10px, 2.4vmin, 28px)) * 1.5));
  height: min(100%, 680px);
  background: var(--board);
  border-radius: clamp(10px, 1.6vmin, 16px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 0 0 1px var(--line), 0 24px 60px -36px rgba(52, 38, 26, 0.35);
  padding: clamp(12px, 2.6vmin, 30px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vmin, 22px);
}

/* una grana leggera di carta */
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(38, 34, 30, 0.05) 0.6px, transparent 0.7px);
  background-size: 5px 5px;
}

.board__head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(9px, 1.5vmin, 12px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-variation-settings: "wdth" 110;
}

.kicker { color: var(--ink); font-weight: 600; }
.kicker__sep { color: var(--accent); font-weight: 400; margin: 0 0.3em; }

.tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2.4vmin, 26px);
  min-height: 0;
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.tile__shadow {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 4%;
  height: 22%;
  border-radius: 50%;
  background: var(--shadow);
  filter: blur(clamp(6px, 1.4vmin, 12px));
  opacity: 0;
}

.tile__drop {
  position: absolute;
  inset: 5% 4%;
  will-change: transform;
}

.tile__print {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--print);
  padding: clamp(3px, 0.6vmin, 6px);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(52, 38, 26, 0.18), 0 6px 14px -8px rgba(52, 38, 26, 0.4);
  overflow: hidden;
}

.tile__print img {
  position: absolute;
  inset: clamp(3px, 0.6vmin, 6px);
  display: block;
  width: calc(100% - 2 * clamp(3px, 0.6vmin, 6px));
  height: calc(100% - 2 * clamp(3px, 0.6vmin, 6px));
  object-fit: cover;
  border-radius: 1px;
}

/* il mirino dove si prende il colore: un quadratino col bordo sottile, mai un pallino */
.tile__probe {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(14px, 2.4vmin, 22px);
  height: clamp(14px, 2.4vmin, 22px);
  margin: calc(clamp(14px, 2.4vmin, 22px) / -2) 0 0 calc(clamp(14px, 2.4vmin, 22px) / -2);
  border: 1.5px solid var(--print);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(38, 34, 30, 0.35);
  opacity: 0;
  pointer-events: none;
}

.tape {
  position: absolute;
  top: -7%;
  width: 30%;
  height: 15%;
  max-height: 26px;
  min-height: 12px;
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(52, 38, 26, 0.12);
  /* i due capi strappati a dentini */
  clip-path: polygon(2% 0, 98% 0, 100% 14%, 97% 28%, 100% 43%, 97% 57%, 100% 72%, 97% 86%, 99% 100%, 1% 100%, 3% 86%, 0 72%, 3% 57%, 0 43%, 3% 28%, 0 14%);
  transform-origin: 0 50%;
}

.tape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 60%);
}

.tape--tl { left: -3%; }
.tape--tc { left: 35%; }
.tape--tr { right: -3%; }

.board__foot {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(10px, 2vmin, 24px);
  border-top: 1px solid var(--line);
  padding-top: clamp(8px, 1.8vmin, 18px);
}

.palette {
  list-style: none;
  display: flex;
  gap: clamp(6px, 1.4vmin, 14px);
}

.swatch {
  display: grid;
  gap: 3px;
  width: clamp(44px, 8vmin, 78px);
}

.swatch__chip {
  display: block;
  height: clamp(20px, 4.4vmin, 40px);
  border-radius: 4px;
  background: #ccc;
  box-shadow: 0 0 0 1px rgba(38, 34, 30, 0.08) inset, 0 4px 10px -6px rgba(52, 38, 26, 0.5);
  will-change: transform;
}

.swatch__name {
  font-size: clamp(8px, 1.3vmin, 11px);
  font-weight: 600;
  font-variation-settings: "wdth" 100;
}

.swatch__hex {
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: clamp(7px, 1.15vmin, 10px);
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.title { text-align: right; min-width: 0; }

.name {
  font-family: "Fraunces Variable", Georgia, serif;
  font-size: clamp(20px, 5.4vmin, 50px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 300;
  font-variation-settings: "SOFT" 100, "opsz" 72;
  white-space: nowrap;
}

.tone {
  margin-top: clamp(4px, 0.8vmin, 8px);
  display: flex;
  justify-content: flex-end;
  gap: 0.9em;
  font-size: clamp(9px, 1.5vmin, 12px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.tone__mask { display: inline-block; overflow: hidden; }
.tone__word { display: inline-block; }

/* il telefono: due colonne, la palette sopra il nome */
@media (max-width: 620px), (max-aspect-ratio: 1/1) {
  .board { width: min(100%, 520px); height: min(100%, 760px); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .board__foot { flex-direction: column; align-items: stretch; }
  .palette { justify-content: space-between; }
  .swatch { width: auto; flex: 1 1 0; min-width: 0; }
  .title { text-align: left; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .tone { margin-top: 0; }
}

@media (max-height: 460px) and (max-aspect-ratio: 1/1) {
  .swatch__name { display: none; }
  .board__head .meta { display: none; }
}

@media (hover: hover) {
  .tile { cursor: default; }
}
