/* The tape range of Gripwell, a made-up tape maker: one stage as tall as the window, the colour of the tape as the
   ground, the big word on top, the flat roll in the middle and the line, the numbers and the buttons at the bottom.
   The curtain (the next colour with the curved belly edge) comes down behind everything; a copy of it, clipped to the
   line under the roll, carries the new line so that it stays still while the edge uncovers it. */
:root {
  /* the six tapes: ground, big word, small words, button face, button ink, the tape itself and its darker edge */
  --cloth-bg: #24408f;      --cloth-word: #f3c6a5;      --cloth-ink: #f5efe4;      --cloth-face: #f5efe4;      --cloth-face-ink: #1d3375;      --cloth-tape: #a9b0ba;      --cloth-edge: #7c8591;
  --masking-bg: #e8ad45;    --masking-word: #7a380a;    --masking-ink: #2c1a08;    --masking-face: #2c1a08;    --masking-face-ink: #f6e7c4;    --masking-tape: #f3e4c0;    --masking-edge: #d6bf93;
  --opp-bg: #94d6c9;        --opp-word: #0d5a50;        --opp-ink: #0d2a26;        --opp-face: #0d2a26;        --opp-face-ink: #dff3ee;        --opp-tape: #e2b065;        --opp-edge: #b98840;
  --double-bg: #f0897f;     --double-word: #87182a;     --double-ink: #2c0d10;     --double-face: #fff4ec;     --double-face-ink: #87182a;     --double-tape: #fbf6ee;     --double-edge: #e3d9cb;
  --stationery-bg: #c4b2f0; --stationery-word: #482895; --stationery-ink: #1d1240; --stationery-face: #1d1240; --stationery-face-ink: #efe8ff; --stationery-tape: #f6dc62; --stationery-edge: #d9be45;
  --lownoise-bg: #eee8da;   --lownoise-word: #1f1f1b;   --lownoise-ink: #1f1f1b;   --lownoise-face: #1f1f1b;   --lownoise-face-ink: #eee8da;   --lownoise-tape: #b3c1a1;   --lownoise-edge: #90a07f;
  --core: #c9a46e;          /* the cardboard core */
  --core-dark: #a7834f;     /* its inner edge */
  --liner: #d8443f;         /* the red liner of the double-sided tape */
  --curve: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1456 150.5' preserveAspectRatio='none'%3E%3Cpath d='M1456 0C801.9 272 212.833 113.333 0 0Z'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { touch-action: manipulation; }

html,
body {
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--cloth-bg);
}

.palco {
  --bg: var(--cloth-bg);
  --ink: var(--cloth-ink);
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: clamp(12px, 3.2vh, 34px) clamp(14px, 3.4vw, 44px);
  gap: clamp(2px, 1.2vh, 14px);
  background: var(--bg);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.palco.trascina { cursor: grabbing; }

/* the curtain: the next colour, as tall as the stage plus the curve, with the belly edge cut by a mask */
.tenda,
.sotto__tenda {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(100% + 12vw);
  transform: translateY(-110%);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--arc, 0px) + 1px) no-repeat, var(--curve) bottom / 100% var(--arc, 0px) no-repeat;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--arc, 0px) + 1px) no-repeat, var(--curve) bottom / 100% var(--arc, 0px) no-repeat;
  pointer-events: none;
  visibility: hidden;
}

.tenda { z-index: 0; }

.testa,
.titolo,
.scena,
.piede { position: relative; z-index: 1; }

/* the header */
.testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
}

.marchio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.marchio__segno { width: clamp(16px, 2.4vh, 22px); height: auto; }

.marchio__nome {
  font-size: clamp(14px, 2.3vh, 19px);
  font-weight: 720;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.02em;
}

.testa__frase {
  margin: 0;
  font-size: clamp(11px, 1.6vh, 13px);
  font-weight: 520;
  letter-spacing: 0.01em;
  opacity: 0.72;
}

/* the big word */
.titolo {
  text-align: center;
  color: var(--ink);
}

.titolo__sopra {
  margin: 0 0 clamp(0px, 0.6vh, 6px);
  font-size: clamp(11px, 1.8vh, 15px);
  font-weight: 560;
  letter-spacing: 0.02em;
  opacity: 0.8;
}

.titolo__riga {
  margin: 0 auto;
  display: grid;
  justify-items: center;
  width: max-content;
  max-width: 100%;
  padding: 0 0.06em;
  overflow: hidden;
  font-size: min(14vw, 15.5vh);
  line-height: 0.96;
  font-weight: 820;
  font-variation-settings: 'wdth' 108;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.parola {
  grid-area: 1 / 1;
  display: flex;
  white-space: nowrap;
}

.lettera {
  display: inline-block;
  color: var(--colore);
  will-change: transform;
}

/* the roll */
.scena { min-height: 0; }

.rotolo {
  position: absolute;
  inset: 0;
  margin: auto;
  height: min(100%, 82vw);
  aspect-ratio: 1;
  width: auto;
  will-change: transform;
}

.rotolo svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* the bottom: the line, the numbers, the buttons */
.piede {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: clamp(10px, 2.4vw, 34px);
}

.sotto {
  position: relative;
  overflow: hidden;
  height: calc(clamp(12px, 1.9vh, 15px) * 1.3 + clamp(11px, 1.75vh, 14px) * 1.38 * 2 + 6px);
  max-width: 36em;
}

.sotto__testo { color: var(--ink); }

.sotto__testo--copia {
  position: absolute;
  left: var(--x, 0px);
  top: var(--y, 0px);
  width: var(--w, 100%);
}

.sotto__nome {
  display: block;
  margin-bottom: 6px;
  font-size: clamp(12px, 1.9vh, 15px);
  line-height: 1.3;
  font-weight: 700;
  font-variation-settings: 'wdth' 106;
}

.sotto__frase {
  display: block;
  font-size: clamp(11px, 1.75vh, 14px);
  line-height: 1.38;
  font-weight: 450;
  opacity: 0.82;
  max-width: 34em;
}

.dati {
  display: flex;
  gap: clamp(14px, 2.4vw, 30px);
  margin: 0;
  color: var(--ink);
}

.dato dt {
  font-size: clamp(10px, 1.5vh, 12px);
  font-weight: 560;
  letter-spacing: 0.02em;
  opacity: 0.7;
  margin-bottom: 2px;
}

.dato dd {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: clamp(18px, 3.4vh, 30px);
  font-weight: 700;
  font-variation-settings: 'wdth' 104;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.unita {
  font-size: 0.5em;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0;
}

.cifre { display: inline-flex; }

.cifra {
  display: inline-block;
  height: 1.1em;
  line-height: 1.1em;
  overflow: hidden;
}

.cifra__nastro {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.cifra__nastro span { height: 1.1em; }

/* the buttons */
.comandi {
  --face: var(--cloth-face);
  --face-ink: var(--cloth-face-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tondo,
.esplora {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  color: var(--face-ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.tondo__faccia,
.esplora__faccia {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--face);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 1px 1px rgba(0, 0, 0, 0.12),
    0 8px 18px -8px rgba(0, 0, 0, 0.45);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.tondo__faccia {
  width: clamp(36px, 6vh, 48px);
  height: clamp(36px, 6vh, 48px);
  border-radius: 50%;
}

.tondo svg,
.esplora svg {
  width: 42%;
  height: 42%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.esplora__faccia {
  height: clamp(36px, 6vh, 48px);
  padding: 0 clamp(14px, 2vh, 20px) 0 clamp(16px, 2.3vh, 22px);
  gap: 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.esplora__scritta {
  font-size: clamp(12px, 1.9vh, 15px);
  font-weight: 640;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.esplora svg { width: clamp(13px, 2vh, 16px); height: auto; }

@media (hover: hover) {
  .tondo[data-prima]:hover svg { transform: translateX(-2px); }
  .tondo[data-dopo]:hover svg { transform: translateX(2px); }
  .esplora:hover .esplora__scritta { font-variation-settings: 'wdth' 118; }
  .esplora:hover svg { transform: translate(1.5px, -1.5px); }
}

.tondo:focus-visible,
.esplora:focus-visible { outline: none; }

.tondo:focus-visible .tondo__faccia,
.esplora:focus-visible .esplora__faccia { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--face); }

/* the grain over everything */
.grana {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grana, 0.07);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the phone: the line on its own row, the numbers and the buttons under it */
@media (max-width: 640px) {
  .piede {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: clamp(6px, 1.6vh, 14px);
  }
  .sotto { grid-column: 1 / -1; }
  .esplora { display: none; }
  .testa__frase { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tondo svg,
  .esplora svg,
  .esplora__scritta { transition: none; }
}
