:root {
  --carta: #f4ece2;        /* the warm paper of the page */
  --faccia: #fffaf4;       /* the face of each card */
  --inchiostro: #1f1b17;   /* the ink of the type */
  --grigio: #8a7f74;       /* the quiet grey of roles and hints */
  --accento: #dd5a3c;      /* Pantile coral: card edge, arrow, active tick */
  --bordo: rgba(221, 90, 60, 0.55);
  --larga: min(430px, 66vw);
  --alta: min(268px, 46vh);
  --serif: "Fraunces Variable", Georgia, serif;
  --sans: "Instrument Sans Variable", system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* a faint grain and a soft light on the paper */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(255, 252, 247, 0.9), rgba(255, 252, 247, 0) 70%),
    radial-gradient(40% 40% at 80% 90%, rgba(221, 90, 60, 0.05), transparent 70%);
  pointer-events: none;
}

.scena {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3.4vh, 30px);
  padding: 4vh 4vw;
}

.testa { text-align: center; display: grid; gap: clamp(4px, 1vh, 8px); justify-items: center; }
.testa__marca {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: clamp(10px, 1.6vh, 12px); letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; font-variation-settings: "wdth" 110;
}
.testa__marca svg { width: 1.3em; height: 1.3em; color: var(--accento); }
.testa__titolo {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(17px, min(3vw, 4.4vh), 32px);
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-variation-settings: "opsz" 72, "SOFT" 50;
}
.testa__titolo em { font-style: italic; color: var(--accento); font-variation-settings: "opsz" 72, "SOFT" 100, "WONK" 1; }

.banco {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
}

/* the side ticks: a dash per card, the active one longer */
.tacche { display: grid; gap: 9px; width: 34px; }
.tacca {
  display: block; height: 2px; width: 14px; border-radius: 2px;
  background: var(--inchiostro); opacity: 0.35;
}

.mazzo {
  position: relative;
  width: var(--larga);
  height: var(--alta);
  outline: none;
  cursor: pointer;
  touch-action: pan-x;
}
@media (hover: hover) and (pointer: fine) { .mazzo { cursor: none; } }
.mazzo:focus-visible { box-shadow: 0 0 0 2px var(--carta), 0 0 0 4px var(--accento); border-radius: 18px; }
.mazzo__meta { position: absolute; left: 0; right: 0; height: 50%; z-index: 50; }
.mazzo__meta--su { top: 0; }
.mazzo__meta--giu { bottom: 0; }

.carta {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.carta__ombra {
  position: absolute;
  inset: 10% 7% -3% 7%;
  border-radius: 22px;
  background: rgba(60, 34, 18, 0.24);
  filter: blur(18px);
  opacity: 0.9;
}
.carta__faccia {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(6px, 1.4vh, 12px);
  padding: clamp(14px, 3.2vh, 26px) clamp(16px, 2.4vw, 28px);
  background: var(--faccia);
  border: 1px solid var(--bordo);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(60, 34, 18, 0.08),
    0 6px 14px -6px rgba(60, 34, 18, 0.16);
}
.carta__virgolette { width: clamp(18px, 3.4vh, 26px); height: auto; color: var(--accento); }
.carta__frase {
  font-family: var(--serif);
  font-size: clamp(13px, min(calc(1.4vw + 6px), calc(2.5vh + 4px)), 19px);
  line-height: 1.32;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 24, "SOFT" 30;
  align-self: center;
}
.carta__firma {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: clamp(6px, 1.4vh, 12px);
  border-top: 1px solid rgba(31, 27, 23, 0.1);
}
.carta__sigla {
  position: relative;
  width: clamp(24px, 4.6vh, 32px); height: clamp(24px, 4.6vh, 32px);
  border-radius: 50%;
  background: var(--inchiostro);
  color: var(--faccia);
}
.carta__sigla span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(9px, 1.5vh, 11px); font-weight: 600; letter-spacing: 0.04em; line-height: 1;
}
.carta__chi { display: grid; min-width: 0; line-height: 1.2; }
.carta__chi strong { font-size: clamp(11px, 1.8vh, 13.5px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carta__chi span { font-size: clamp(10px, 1.6vh, 12px); color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carta__logo {
  font-size: clamp(10px, 1.6vh, 12px); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600;
  color: var(--inchiostro); opacity: 0.55; font-variation-settings: "wdth" 80;
}
/* a soft sheen that slides with the tilt */
.carta__riflesso {
  position: absolute; inset: -40% -20%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  opacity: 0; pointer-events: none;
}

.piede {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  width: calc(var(--larga) + 34px + clamp(14px, 3vw, 34px));
}
.piede__chi { display: grid; line-height: 1.25; min-width: 0; }
.piede__finestra, .piede__lavoro { display: block; overflow: hidden; height: 1.25em; }
.piede__finestra { font-size: clamp(12px, 2vh, 15px); font-weight: 600; }
.piede__lavoro { font-size: clamp(10px, 1.6vh, 12px); color: var(--grigio); }
.piede__nomi, .piede__lavori { display: grid; }
.piede__nomi span, .piede__lavori span { height: 1.25em; white-space: nowrap; }
.piede__aiuto { display: grid; gap: 3px; justify-items: end; font-size: clamp(10px, 1.5vh, 11.5px); color: var(--grigio); }
.piede__aiuto span { display: inline-flex; align-items: center; gap: 5px; }
.piede__aiuto svg { width: 11px; height: 11px; }

/* the arrow that follows the pointer over the deck */
.freccia {
  position: fixed; left: 0; top: 0;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 100;
}
.freccia__tondo {
  position: absolute;
  left: -28px; top: -28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accento);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -8px rgba(160, 50, 25, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transform: scale(0);
}
.freccia__segno { width: 24px; height: 24px; display: block; }

@media (max-width: 560px) {
  :root { --larga: min(430px, 70vw); }
  .piede__aiuto { display: none; }
  .carta__logo { display: none; }
  .freccia__tondo { left: -22px; top: -22px; width: 44px; height: 44px; }
  .freccia__segno { width: 20px; height: 20px; }
}
