/* Stile del modulo RSVP, condiviso da v2 e v3.
   Si adatta con le variabili che la versione definisce su :root (o su un contenitore):
   --rs-ink  --rs-soft  --rs-label  --rs-accent  --rs-line  --rs-hair  --rs-err  --rs-on-bg  --rs-on-ink
   --rs-serif  --rs-sans  --rs-ease  --rs-chip-on  --rs-seg-bg  --rs-thumb */
.rsvp__form, .fold__in { --g: clamp(22px, 3vw, 30px); display: grid; }
.rsvp__form > * + *, .fold__in > * + * { margin-top: var(--g); }
.rsvp__form[hidden], .done[hidden] { display: none !important; }

.field { position: relative; display: grid; gap: 4px; }
.field label, .rsvp__label {
  font: 500 .64rem/1.4 var(--rs-sans); letter-spacing: .3em; text-transform: uppercase; color: var(--rs-label);
}
.field label i, .rsvp__label i { text-transform: none; letter-spacing: .02em; font: italic 400 .98rem/1 var(--rs-serif); color: var(--rs-soft); }
.field input, .field textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rs-line); border-radius: 0;
  padding: 12px 0 11px; font: 300 1.15rem/1.5 var(--rs-sans); color: var(--rs-ink); outline: none; resize: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--rs-soft); opacity: .6; }
.field__line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rs-accent);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .7s var(--rs-ease);
}
.field:focus-within .field__line { transform: scaleX(1); }
.field.is-bad input { border-bottom-color: var(--rs-err); }
.field__err { font-size: .86rem; line-height: 1.4; color: var(--rs-err); }
.field__err:empty { display: none; }

.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rs-hair); border-radius: 999px; padding: 4px; margin: 0; background: var(--rs-seg-bg); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  position: relative; z-index: 1; text-align: center; padding: 16px 8px; border-radius: 999px; cursor: pointer;
  font: 500 .68rem/1.2 var(--rs-sans); letter-spacing: .2em; text-transform: uppercase; color: var(--rs-soft);
  transition: color .5s var(--rs-ease);
}
.seg input:checked + label { color: var(--rs-on-thumb, var(--rs-ink)); }
.seg input:focus-visible + label { outline: 1.5px solid var(--rs-accent); outline-offset: 2px; }
.seg__thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: var(--rs-thumb); box-shadow: 0 10px 22px -14px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .7s var(--rs-ease);
}
#att-no:checked ~ .seg__thumb { transform: translateX(100%); }

.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .8s var(--rs-ease), opacity .6s var(--rs-ease), margin-top .8s var(--rs-ease); }
.fold__in { overflow: hidden; min-height: 0; padding: 2px; margin: -2px; }
.fold.is-closed { grid-template-rows: 0fr; opacity: 0; margin-top: 0; }

.rsvp__row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.rsvp__row--col { flex-direction: column; align-items: flex-start; gap: 14px; }
.step { display: inline-flex; align-items: center; gap: 6px; }
.step__btn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: transparent; color: var(--rs-ink); border: 1px solid var(--rs-line);
  transition: background .5s var(--rs-ease), transform .5s var(--rs-ease);
}
.step__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; }
.step__btn:hover { background: var(--rs-seg-bg); }
.step__btn:active { transform: scale(.94); }
.step__btn:disabled { opacity: .35; pointer-events: none; }
.step__val { min-width: 54px; text-align: center; font: 300 2.2rem/1 var(--rs-serif); color: var(--rs-ink); font-variant-numeric: lining-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--rs-line);
  font: 400 .84rem/1 var(--rs-sans); letter-spacing: .06em; color: var(--rs-soft);
  transition: background .5s var(--rs-ease), border-color .5s var(--rs-ease), color .5s var(--rs-ease), transform .5s var(--rs-ease);
}
.chip:hover span { border-color: var(--rs-accent); }
.chip input:checked + span { background: var(--rs-chip-on); border-color: transparent; color: var(--rs-on-ink); }
.chip input:focus-visible + span { outline: 1.5px solid var(--rs-accent); outline-offset: 3px; }
.chip:active span { transform: scale(.97); }

.rsvp__form > .btn { justify-self: start; margin-top: calc(var(--g) + 4px); }
.rsvp__form > .rsvp__fine { font-size: .84rem; color: var(--rs-soft); margin-top: 14px; }

.done { display: grid; justify-items: center; text-align: center; gap: 18px; }
.done__check { width: 76px; height: 76px; fill: none; stroke: var(--rs-accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.done__check circle { stroke-dasharray: 176; stroke-dashoffset: 176; animation: rsDraw 1.2s var(--rs-ease) forwards; }
.done__check path { stroke-dasharray: 44; stroke-dashoffset: 44; animation: rsDraw .9s .5s var(--rs-ease) forwards; }
@keyframes rsDraw { to { stroke-dashoffset: 0; } }
.done__title { font: 300 clamp(2.3rem, 4vw, 3.2rem)/1.1 var(--rs-serif); color: var(--rs-ink); }
.done__txt { max-width: 28em; color: var(--rs-soft); }
.done__actions { display: grid; justify-items: center; gap: 16px; margin-top: 8px; }
.link {
  background: none; border: 0; padding: 8px 2px; color: var(--rs-label); cursor: pointer;
  font: 500 .68rem/1 var(--rs-sans); letter-spacing: .24em; text-transform: uppercase;
  border-bottom: 1px solid var(--rs-line);
}

@media (max-width: 560px) {
  .seg label { font-size: .6rem; letter-spacing: .12em; padding: 15px 4px; }
  .rsvp__form > .btn { justify-self: stretch; justify-content: space-between; }
}
