/* The used car warranty card with the shield that fills. The card has two faces in one 3D flip: the front with the
   shield and the covered parts, the back with what is not covered. GSAP turns .warranty__flip; each face keeps its
   own CSS. Sizes follow the window height too, so the card fits the phone preview box. */
:root {
  --fondo: #ffffff;                 /* the page */
  --carta: #fcfcfb;                 /* the front of the card */
  --retro: #f6f6f4;                 /* the back of the card */
  --inchiostro: #111618;            /* the words */
  --grigio: #697075;                /* the small words */
  --tenue: #a9aeb1;                 /* words not ticked yet */
  --linea: rgba(17, 22, 24, 0.08);  /* thin rules and edges */
  --accento: #10875d;               /* the emerald of the cover */
  --accento-chiaro: #3cc58f;        /* the top of the liquid */
  --accento-tenue: rgba(16, 135, 93, 0.1);
  --riga: clamp(29px, 8.2vh, 42px); /* the height of a row */
  --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; }

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

.warranty {
  position: relative;
  width: min(372px, 92vw);
  perspective: 1300px;
}
.warranty__shadow {
  position: absolute;
  left: 8%; right: 8%; bottom: -6px; height: 40px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(17, 22, 24, 0.22), transparent);
  filter: blur(10px);
  pointer-events: none;
}
.warranty__flip {
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.face {
  position: relative;
  padding: clamp(11px, 2.6vh, 20px) clamp(12px, 3.6vw, 18px) clamp(10px, 2.2vh, 16px);
  border-radius: 22px;
  border: 1px solid rgba(17, 22, 24, 0.07);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 1px 2px rgba(17, 22, 24, 0.05),
    0 8px 20px -8px rgba(17, 22, 24, 0.14),
    0 32px 64px -28px rgba(17, 22, 24, 0.26);
}
/* a fine grain over both faces */
.face::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.35;
  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.09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.face--front {
  background:
    radial-gradient(110% 55% at 12% 0%, rgba(60, 197, 143, 0.09), transparent 62%),
    var(--carta);
}
.face--back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background:
    radial-gradient(110% 55% at 88% 0%, rgba(17, 22, 24, 0.04), transparent 62%),
    var(--retro);
  display: flex;
  flex-direction: column;
}

/* the light that follows the pointer, and the sheen that crosses the card when it is sealed */
.face__glow {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), rgba(60, 197, 143, 0.1), transparent 70%);
}
.warranty.is-lit .face__glow { opacity: 1; }
.face__sheen {
  position: absolute; top: -20%; bottom: -20%; left: 0;
  width: 46%;
  pointer-events: none;
  transform: translateX(-140%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(60, 197, 143, 0.07) 35%, rgba(255, 255, 255, 0.9) 50%, rgba(60, 197, 143, 0.07) 65%, transparent);
  z-index: 0;
}
.w-head, .w-list, .w-foot { z-index: 1; }
.w-list, .w-foot { position: relative; }

.w-head { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: clamp(6px, 1.8vh, 14px); }
.shield {
  position: relative;
  width: clamp(40px, 11.5vh, 54px);
  aspect-ratio: 64 / 72;
  flex: none;
  border-radius: 14px;
  filter: drop-shadow(0 6px 8px rgba(13, 110, 76, 0.16));
}
.shield svg, .badge svg { display: block; width: 100%; height: 100%; overflow: visible; }
.shield__base { fill: #eef6f2; }
.shield__liquid { fill: url(#shield-liquid); }
.shield__back { fill: #8fdcbc; opacity: 0.55; }
.shield__band { fill: url(#shield-band); }
.shield__gloss { fill: #fff; opacity: 0.16; }
.shield__rim { fill: none; stroke: url(#shield-rim); stroke-width: 1.6; }
.shield__tick { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 34; stroke-dashoffset: 34; }
.shield:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.shield:focus:not(:focus-visible) { outline: none; }

.w-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.w-eyebrow { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accento); font-weight: 600; }
.w-title { margin: 3px 0 2px; font-size: clamp(16px, 3.6vh, 20px); font-weight: 680; letter-spacing: -0.02em; font-stretch: 94%; }
.w-sub { font-size: 12px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.w-list { list-style: none; margin: 0; padding: 0; position: relative; }
.item {
  position: relative;
  height: var(--riga);
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px;
  margin: 0 -8px;
  border-radius: 11px;
  font-size: clamp(12.5px, 2.1vh, 13.5px);
  outline: none;
}
.item + .item::before {
  content: '';
  position: absolute; left: 36px; right: 8px; top: 0;
  height: 1px; background: var(--linea);
}
.item__name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--tenue); font-weight: 520; transition: color 0.35s; }
.item.is-on .item__name { color: var(--inchiostro); }
.item__right {
  height: 16px; overflow: hidden; flex: none;
  font-size: 11.5px; color: var(--grigio); text-align: right;
  opacity: 0; transform: translateX(6px);
  transition: opacity 0.35s, transform 0.5s cubic-bezier(.3, 1.5, .5, 1);
}
.item.is-on .item__right { opacity: 1; transform: none; }
.item__roll { display: flex; flex-direction: column; transition: transform 0.45s cubic-bezier(.3, 1.35, .5, 1); }
.item__roll span { height: 16px; line-height: 16px; }
.item__roll span:last-child { color: var(--accento); font-weight: 600; }
.item.is-hover .item__roll { transform: translateY(-16px); }
.item.is-hover { background: rgba(17, 22, 24, 0.03); }
@media (hover: hover) {
  .item:hover .item__roll { transform: translateY(-16px); }
  .item:hover { background: rgba(17, 22, 24, 0.03); }
}
.item:focus-visible { box-shadow: 0 0 0 2px var(--accento) inset; }

.check { width: 18px; height: 18px; flex: none; }
.check svg { display: block; width: 100%; height: 100%; overflow: visible; }
.check__ring { fill: none; stroke: rgba(17, 22, 24, 0.16); stroke-width: 1.3; stroke-dasharray: 2 2.4; }
.check__fill { fill: var(--accento); opacity: 0; }
.check__tick { fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12; stroke-dashoffset: 12; }

.w-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: clamp(6px, 1.6vh, 12px);
  padding-top: clamp(7px, 1.8vh, 12px);
  border-top: 1px solid var(--linea);
}
.w-foot--back { margin-top: auto; justify-content: flex-end; }
.w-cover { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 6px; row-gap: 5px; }
.w-cover__label { font-size: 11px; color: var(--grigio); font-weight: 520; }
.w-cover__pct { font-size: 15px; font-weight: 680; letter-spacing: -0.01em; min-width: 4.4ch; }
.w-cover__track { grid-column: 1 / -1; width: 84px; height: 3px; border-radius: 3px; background: rgba(17, 22, 24, 0.07); overflow: hidden; }
.w-cover__fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accento-chiaro), var(--accento)); transform-origin: 0 50%; transform: scaleX(0); }

.turn {
  position: relative;
  height: clamp(32px, 8vh, 38px);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--inchiostro);
  color: #fff;
  font-size: 12.5px; font-weight: 560;
  font-stretch: 100%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 6px 14px -6px rgba(17, 22, 24, 0.55);
  transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.3s, font-stretch 0.35s;
  white-space: nowrap;
}
.turn__face { display: inline-flex; align-items: center; gap: 7px; }
.turn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.5s cubic-bezier(.3, 1.4, .5, 1); }
.turn.is-hover, .turn:focus-visible { font-stretch: 106%; }
.turn.is-hover svg { transform: rotate(180deg); }
.turn.is-down { transform: scale(0.95); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 2px 6px -3px rgba(17, 22, 24, 0.6); }
.turn:active { transform: scale(0.95); }
@media (hover: hover) {
  .turn:hover { font-stretch: 106%; }
  .turn:hover svg { transform: rotate(180deg); }
  .turn--back:hover svg { transform: translateX(-2px); }
}
.turn--back { background: #fff; color: var(--inchiostro); border: 1px solid var(--linea); box-shadow: 0 1px 2px rgba(17, 22, 24, 0.06); }
.turn--back.is-hover svg { transform: translateX(-2px); }
.turn:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.turn:focus:not(:focus-visible) { outline: none; }

/* the back */
.badge { width: clamp(40px, 11.5vh, 54px); aspect-ratio: 64 / 72; flex: none; }
.badge__shape { fill: #fff; stroke: rgba(17, 22, 24, 0.14); stroke-width: 1.4; }
.badge__x { fill: none; stroke: var(--grigio); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 22; }
.face--back .w-eyebrow { color: var(--grigio); }
.item--out .item__name { color: var(--inchiostro); }
.cross {
  width: 18px; height: 18px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(17, 22, 24, 0.06);
}
.cross svg { width: 14px; height: 14px; fill: none; stroke: var(--grigio); stroke-width: 1.7; stroke-linecap: round; }
.cross--info { background: var(--accento-tenue); }
.cross--info svg { stroke: var(--accento); stroke-width: 2; }
.item__tag {
  font-size: 10.5px; font-weight: 560; color: var(--grigio);
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--linea); background: #fff;
}
.item__tag--good { color: var(--accento); background: var(--accento-tenue); border-color: transparent; }

.pointer {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #111618; 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;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 380px) {
  .w-foot { gap: 6px; }
  .turn { padding: 0 10px; font-size: 11.5px; letter-spacing: -0.005em; }
  .turn__face { gap: 5px; }
  .turn svg { width: 13px; height: 13px; }
  .w-cover { column-gap: 4px; }
  .w-cover__label { font-size: 10.5px; }
  .w-cover__pct { font-size: 14px; min-width: 4ch; }
  .w-cover__track { width: 60px; }
}
