/* The repair quote card with the rolling total and the approved stamp. One card on white: the lines with their
   switches, the VAT, the total on reels and the approve strip that turns into a signature pad. GSAP moves the knobs,
   the reels, the pad and the stamp; the CSS holds the materials. Sizes follow the window height too, so the card
   fits the phone preview box. */
:root {
  --fondo: #ffffff;                  /* the page */
  --carta: #fcfcfb;                  /* the card */
  --carta-2: #f5f5f2;                /* the pad and the pressed rows */
  --inchiostro: #121417;             /* the words */
  --grigio: #6b7076;                 /* the small words */
  --tenue: #b3b7bb;                  /* a line that is switched off */
  --linea: rgba(18, 20, 23, 0.08);   /* thin rules and edges */
  --accento: #2f55e4;                /* the blue of the stamp ink and the switches */
  --accento-tenue: rgba(47, 85, 228, 0.1);
  --bottone: #15171a;                /* the approve button */
  --riga: clamp(31px, 8.6vh, 44px);  /* the height of a line */
  --font: 'Mona Sans Variable', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 28px) 12px;
  overflow: hidden;
}

.quote {
  position: relative;
  width: min(360px, 92vw);
  padding: clamp(11px, 2.8vh, 20px) clamp(13px, 4vw, 20px) clamp(11px, 2.6vh, 18px);
  border-radius: 22px;
  background: var(--carta);
  border: 1px solid rgba(18, 20, 23, 0.07);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 1px 2px rgba(18, 20, 23, 0.05),
    0 10px 22px -10px rgba(18, 20, 23, 0.16),
    0 36px 70px -30px rgba(18, 20, 23, 0.3);
  isolation: isolate;
}
/* fine grain over the card */
.quote::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: 5;
}
/* a soft light that follows the pointer */
.quote::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), rgba(47, 85, 228, 0.05), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
}
.quote.is-lit::before { opacity: 1; }
.quote__defs { position: absolute; width: 0; height: 0; }

/* ---------- head ---------- */
.quote__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: clamp(8px, 2vh, 14px);
  border-bottom: 1px solid var(--linea);
}
.quote__logo {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(180deg, #23262b, #111316);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 4px 10px -4px rgba(18, 20, 23, 0.5);
}
.quote__logo svg { width: 18px; height: 18px; fill: none; stroke: #f1f1ee; stroke-width: 1.6; stroke-linejoin: round; }
.quote__meta { display: grid; gap: 1px; min-width: 0; flex: 1; }
.quote__brand {
  font-size: 14px; font-weight: 640;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quote__sub { font-size: 11px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.quote__status { position: relative; flex: none; width: 104px; display: grid; justify-items: end; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px 0 7px;
  border-radius: 999px;
  font-size: 11px; font-weight: 560;
  color: #8a5a12;
  background: rgba(214, 150, 40, 0.11);
  box-shadow: inset 0 0 0 1px rgba(214, 150, 40, 0.22);
}
.chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

/* the stamp: double rule, wide letters, blue ink with an uneven print */
.stamp {
  position: absolute;
  right: 0; top: 50%;
  translate: 0 -50%;
  pointer-events: none;
}
.stamp__ink {
  display: grid; justify-items: center;
  padding: 2px 7px 2px;
  border: 2px solid var(--accento);
  outline: 1px solid var(--accento);
  outline-offset: 2px;
  border-radius: 6px;
  color: var(--accento);
  filter: url(#ink);
  opacity: 0;
}
.stamp__word {
  font-size: 12px; line-height: 1.05;
  font-weight: 800;
  font-variation-settings: 'wdth' 125;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stamp__date { font-size: 8px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; font-variant-numeric: tabular-nums; }

/* ---------- lines ---------- */
.lines { list-style: none; margin: clamp(4px, 1vh, 8px) 0 0; padding: 0; }
.line {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  column-gap: 12px;
  height: var(--riga);
  padding: 0 6px;
  margin: 0 -6px;
  border-radius: 10px;
  transition: background-color 0.25s;
}
.line.is-hover { background: rgba(18, 20, 23, 0.03); }
.line__text { display: grid; gap: 1px; min-width: 0; }
.line__name {
  font-size: 13.5px; font-weight: 560;
  font-variation-settings: 'wdth' 100;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.35s, font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.line__kind { font-size: 10.5px; color: var(--grigio); white-space: nowrap; transition: color 0.35s; }
.line__price {
  position: relative;
  font-size: 13.5px; font-weight: 560;
  font-variant-numeric: tabular-nums;
  transition: color 0.35s;
}
.line__strike {
  position: absolute; left: -2px; right: -2px; top: 52%;
  height: 1.2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.line.is-off .line__name { color: var(--tenue); font-variation-settings: 'wdth' 92; }
.line.is-off .line__kind, .line.is-off .line__price { color: var(--tenue); }

/* the switch */
.switch {
  position: relative;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: #dcdedf;
  box-shadow: inset 0 1px 2px rgba(18, 20, 23, 0.14), inset 0 0 0 1px rgba(18, 20, 23, 0.04);
  transition: background-color 0.3s;
}
.switch.is-on { background: var(--accento); box-shadow: inset 0 1px 2px rgba(10, 20, 80, 0.3); }
.switch:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.switch:disabled { cursor: default; }
.switch__knob {
  position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f1f1ef);
  box-shadow: 0 1px 1px rgba(18, 20, 23, 0.12), 0 2px 5px -1px rgba(18, 20, 23, 0.25);
}
.quote.is-locked .switch { opacity: 0.45; }

/* ---------- sums ---------- */
.sums {
  margin-top: clamp(4px, 1vh, 8px);
  padding-top: clamp(6px, 1.6vh, 12px);
  border-top: 1px dashed rgba(18, 20, 23, 0.16);
}
.sums__row {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--grigio);
  font-variant-numeric: tabular-nums;
}
.sums__total {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-top: clamp(2px, 0.8vh, 6px);
}
.sums__label { position: relative; font-size: 14px; font-weight: 640; padding-bottom: 3px; }
.delta {
  position: absolute; left: calc(100% + 8px); bottom: 3px;
  font-size: 11px; font-weight: 600;
  color: var(--accento);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0;
}

/* the reels: each digit is a strip of 0 to 9 seen through a window that fades at the top and bottom */
.reels {
  display: inline-flex;
  font-size: clamp(25px, 7.4vh, 32px);
  font-weight: 680;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.reel {
  position: relative;
  display: inline-block;
  height: 1.1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.reel__strip { display: flex; flex-direction: column; }
.reel__strip span { display: block; height: 1.1em; text-align: center; }
.reels__fix { display: inline-block; }
.reels__sep { display: inline-block; width: 0.3em; text-align: center; }

/* ---------- approve ---------- */
.approve {
  position: relative;
  margin-top: clamp(8px, 2.2vh, 14px);
  height: 44px;
}
.approve__btn {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: var(--bottone);
  color: #f6f6f3;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 8px 18px -8px rgba(18, 20, 23, 0.55);
  z-index: 2;
}
.approve__btn:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.approve__face { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; }
.approve__words {
  font-size: 14px; font-weight: 600;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.approve__btn.is-hover .approve__words { font-variation-settings: 'wdth' 114; }
@media (hover: hover) {
  .approve__btn:hover .approve__words { font-variation-settings: 'wdth' 114; }
}
.approve__icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.pad {
  position: absolute; inset: 0;
  border-radius: 14px;
  background: var(--carta-2);
  box-shadow: inset 0 0 0 1px rgba(18, 20, 23, 0.08), inset 0 2px 6px rgba(18, 20, 23, 0.05);
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}
.pad.is-signed { cursor: default; }
.pad__hint {
  position: absolute; left: 30px; bottom: 30%;
  font-size: 11.5px; color: var(--grigio);
  pointer-events: none;
}
.pad__x { position: absolute; left: 12px; bottom: calc(30% + 2px); width: 10px; height: 10px; color: var(--grigio); }
.pad__x svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.pad__line {
  position: absolute; left: 10px; right: 10px; bottom: 26%;
  height: 1px;
  background: rgba(18, 20, 23, 0.18);
  transform-origin: 0 50%;
}
.pad__ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pad__path { fill: none; stroke: #1b2a6b; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pad__path[data-preset] { stroke-dasharray: 1; stroke-dashoffset: 1; }
.pad__signed {
  position: absolute; right: 10px; bottom: 5px;
  font-size: 9.5px; color: var(--grigio);
  font-variant-numeric: tabular-nums;
  opacity: 0;
}
.pad__action {
  position: absolute; right: 6px; top: 5px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 560;
  color: var(--grigio);
  transition: background-color 0.2s, color 0.2s;
}
.pad__action.is-hover, .pad__action:focus-visible { background: rgba(18, 20, 23, 0.06); color: var(--inchiostro); outline: none; }
@media (hover: hover) {
  .pad__action:hover { background: rgba(18, 20, 23, 0.06); color: var(--inchiostro); }
}

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

@media (max-width: 380px) {
  .line { column-gap: 9px; }
  .line__name, .line__price { font-size: 12.5px; }
  .quote__sub { font-size: 10.5px; }
  .quote__head { gap: 8px; }
  .quote__brand { font-size: 13px; font-variation-settings: 'wdth' 92; }
  .quote__logo { width: 28px; height: 28px; border-radius: 9px; }
  .quote__status { width: 86px; }
  .chip { padding: 0 7px 0 6px; font-size: 10.5px; }
  .stamp__ink { padding: 2px 5px; }
  .stamp__word { font-size: 10.5px; }
  .stamp__date { font-size: 7px; }
}
