/* ─────────────────────────────────────────────────────────────────────────────
   Iscrizione E · Stile Apple (?stile=apple)
   The same page, door and gold reworked with the apple-design and motion skills:
   - nothing moves on its own: no floating card, breathing light, dust, shimmer or nudging arrows
   - the card is turned by hand with springs (fisica.js); «Girala» under it does the same
   - the name is struck in gold once, when confirmed, never at every key
   - fields grouped like iOS Settings, consents as switches, body type at 17 px, margins at 20 px
   - what the user starts lasts under 300 ms; hover colours change at once; presses scale to .98
   Classic E is untouched: every rule below is scoped to [data-stile="apple"], except the
   neutral defaults that keep the new markup invisible in the classic style.
   ───────────────────────────────────────────────────────────────────────────── */

/* classic style: the new pieces stay out of the way */
.gruppo-e { display: contents; }
.gruppo-e__nota, .gira-e, .retro-doni { display: none; }
.voce label span::before { content: '· '; }
/* the second switch in the prototype bar sits right after the first */
.pbar__seg--stile { margin-left: 0; }
/* on a phone the two switches fit one line: the way home keeps only its arrow */
@media (max-width: 520px) {
  .pbar:has(.pbar__seg--stile) .pbar__home { width: 1.3em; overflow: hidden; white-space: nowrap; }
  .pbar:has(.pbar__seg--stile) .pbar__seg--stile { margin-left: 0; }
}

.e[data-stile="apple"] {
  --entra: cubic-bezier(.23, 1, .32, 1);      /* enter and exit */
  --muove: cubic-bezier(.77, 0, .175, 1);     /* movement on screen */
}
.e[data-stile="apple"][data-tema="notte"] {
  --gruppo: rgba(255, 244, 222, .07); --gruppo-bordo: rgba(255, 236, 200, .15); --riga: rgba(255, 236, 200, .1);
  --anello: rgba(226, 198, 142, .78); --spento: rgba(243, 234, 219, .2); --vetro: rgba(30, 21, 13, .46);
}
.e[data-stile="apple"][data-tema="giorno"] {
  --gruppo: rgba(255, 252, 246, .62); --gruppo-bordo: rgba(59, 46, 31, .13); --riga: rgba(59, 46, 31, .1);
  --anello: rgba(138, 106, 54, .72); --spento: rgba(59, 46, 31, .18); --vetro: rgba(255, 252, 246, .6);
}

/* ── nothing loops ── */
.e[data-stile="apple"] .raggi { animation: none; }
.e[data-stile="apple"] .polvere { display: none; }
.e[data-stile="apple"] .soglia h1 em, .e[data-stile="apple"] .oro-testo { animation: none; background-position: 30% 0; }
.e[data-stile="apple"] .arcata__scorri span { animation: none; }

/* ── page-load: one staged entrance, 100 ms apart, then stillness ── */
.e[data-stile="apple"] .entra { animation-duration: 600ms; animation-timing-function: var(--entra); animation-delay: calc(var(--i, 0) * 100ms + 80ms); }
.e[data-stile="apple"] .arco.entra { animation: apri-arco 700ms var(--entra) both 150ms; }
.e[data-stile="apple"] .galleggia, .e[data-stile="apple"] .galleggia.entra { animation: arriva-carta 700ms var(--entra) both 300ms; }

/* ── type and margins on Apple's scale: 20 px margins, 17 px body, tracking by size ── */
.e[data-stile="apple"] .soglia { padding: 20px 20px 0; }
.e[data-stile="apple"] .soglia h1 { line-height: .96; letter-spacing: -.028em; }
.e[data-stile="apple"] .soglia__sotto { margin-top: 14px; max-width: 30ch; font-size: 17px; line-height: 1.41; letter-spacing: -.01em; }
.e[data-stile="apple"] .e-form { padding: 10px 20px 0; }
.e[data-stile="apple"] .fatto { padding: 4px 20px 0; }
.e[data-stile="apple"] .fatto__testo { font-size: 17px; line-height: 1.41; letter-spacing: -.01em; }

/* ── the card: still, turned by hand ── */
.e[data-stile="apple"] .scena { margin: 18px -20px 0; height: calc(var(--ah) + 58px); }
.e[data-stile="apple"][data-tema="notte"][data-nicchia="foto"] .scena { height: calc(var(--aw) * 1.27 + 44px); }
.e[data-stile="apple"] .tilt { transform: none; transition: none; }
.e[data-stile="apple"] .carta { transform: translateY(var(--ty, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: scale 140ms var(--entra); }
.e[data-stile="apple"] .galleggia { cursor: grab; touch-action: pan-y; -webkit-touch-callout: none; }
.e[data-stile="apple"] .galleggia.presa { cursor: grabbing; }
/* pressed: answers on pointer-down, before any movement */
.e[data-stile="apple"] .galleggia.presa .carta { scale: .98; }
/* the contact shadow narrows as the card turns edge-on; the glare follows the angle */
.e[data-stile="apple"] .ombra-carta { animation: none; transform: scaleX(var(--ombra, 1)); }
.e[data-stile="apple"] .faccia::after { animation: none; transform: translateX(calc(var(--luce, -46) * 1%)); }

/* back, before joining: the gifts; once joined: the QR */
.e[data-stile="apple"] .retro-doni { display: flex; flex-direction: column; height: 100%; padding: 10px 14px 8px; background: var(--p-bg); color: var(--p-fg); }
.e[data-stile="apple"]:not(.iscritta) .pass-retro, .e[data-stile="apple"].iscritta .retro-doni { display: none; }
.retro-doni__testa { display: flex; align-items: center; justify-content: space-between; }
.retro-doni__testa img { height: 28px; width: auto; }
.retro-doni__testa span { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--p-lb); }
.retro-doni__lista { list-style: none; margin: auto 0 0; padding: 0; }
.retro-doni__lista li { display: grid; grid-template-columns: 52px 1fr; align-items: baseline; gap: 8px; padding: 5px 0;
  border-top: .5px solid color-mix(in srgb, var(--p-fg) 16%, transparent); font-size: 13px; line-height: 1.25; }
.retro-doni__lista b { font-weight: 300; font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--p-lb); white-space: nowrap; }
.retro-doni__lista em { font-style: normal; color: var(--p-lb); }

/* the button twin of the gesture, on a chip of glass under the sill */
.e[data-stile="apple"] .gira-e { position: absolute; left: 50%; bottom: 2px; z-index: 2; translate: -50% 0; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px 0 13px; border: 1px solid var(--gruppo-bordo); border-radius: 999px;
  background: var(--vetro); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  color: var(--testo); font: 500 13px/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: scale 140ms var(--entra); animation: sale 500ms var(--entra) both 900ms; }
.e[data-stile="apple"] .gira-e:active { scale: .97; }
.e[data-stile="apple"] .gira-e svg { width: 16px; height: 16px; color: var(--oro-piccolo); }
.e[data-stile="apple"] .gira-e:focus-visible { outline: 2px solid var(--anello); outline-offset: 3px; }

/* ── the form, grouped like iOS Settings ── */
.e[data-stile="apple"] .stella { display: none; }
.e[data-stile="apple"] .voce__campo::after { display: none; }
.e[data-stile="apple"] .voce label { font-size: 13px; font-weight: 600; letter-spacing: .01em; text-transform: none; color: var(--testo-muto); }
.e[data-stile="apple"] .voce label span { font-weight: 400; letter-spacing: 0; }

/* the name: one rounded field in the house italic */
.e[data-stile="apple"] .voce--nome { margin: 0 0 26px; }
.e[data-stile="apple"] .voce--nome label { margin: 0 0 8px 4px; }
.e[data-stile="apple"] .voce--nome input { height: 60px; margin: 0; padding: 0 18px; border: 1px solid var(--gruppo-bordo); border-radius: 14px; background: var(--gruppo); font-size: 28px; }
.e[data-stile="apple"] .voce--nome input:focus { border-color: var(--anello); box-shadow: 0 0 0 4px color-mix(in srgb, var(--anello) 22%, transparent); }
.e[data-stile="apple"] .voce--nome input[aria-invalid="true"] { border-color: var(--errore); }
.e[data-stile="apple"] .voce--nome .voce__aiuto, .e[data-stile="apple"] .voce--nome .voce__err { margin-left: 4px; font-size: 13px; }

/* email and phone: one inset group, the label on the left of each row */
.e[data-stile="apple"] .gruppo-e { display: block; overflow: hidden; border: 1px solid var(--gruppo-bordo); border-radius: 14px; background: var(--gruppo); }
.e[data-stile="apple"] .gruppo-e .voce { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; column-gap: 8px; margin: 0; padding: 0 16px; }
.e[data-stile="apple"] .gruppo-e .voce + .voce { border-top: 1px solid var(--riga); }
.e[data-stile="apple"] .gruppo-e .voce:focus-within { box-shadow: inset 0 0 0 1.5px var(--anello); }
.e[data-stile="apple"] .gruppo-e .voce label { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -.01em; color: var(--testo); }
.e[data-stile="apple"] .gruppo-e .voce label span { display: block; margin-top: 1px; font-size: 12px; color: var(--testo-muto); }
.e[data-stile="apple"] .voce label span::before { content: none; }
.e[data-stile="apple"] .gruppo-e .voce input { height: 54px; margin: 0; border: 0; font-size: 17px; letter-spacing: -.01em; }
.e[data-stile="apple"] .gruppo-e .voce:has(input[aria-invalid="true"]) label { color: var(--errore); }
.e[data-stile="apple"] .gruppo-e .voce__aiuto { display: none; }
.e[data-stile="apple"] .gruppo-e .voce__err { grid-column: 1 / -1; margin: -6px 0 12px; }
.e[data-stile="apple"] .gruppo-e__nota { display: block; margin: 8px 4px 0; font-size: 13px; line-height: 1.45; color: var(--testo-muto); }

/* the two consents: rows of switches in a second group */
.e[data-stile="apple"] .consensi { margin: 26px 0 0; overflow: hidden; border: 1px solid var(--gruppo-bordo); border-radius: 14px; background: var(--gruppo); }
.e[data-stile="apple"] .consenso-e { grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 0; padding: 13px 14px 13px 16px; }
.e[data-stile="apple"] .consenso-e ~ .consenso-e { border-top: 1px solid var(--riga); }
.e[data-stile="apple"] .consenso-e label { order: -1; font-size: 15px; line-height: 1.4; color: var(--testo); }
.e[data-stile="apple"] .consenso-e + .voce__err { margin: -4px 16px 12px; }
.e[data-stile="apple"] .consenso-e input { position: relative; display: block; width: 51px; height: 31px; margin: 0; border: 0; border-radius: 999px;
  background: var(--spento); transition: background-color 180ms var(--entra); }
.e[data-stile="apple"] .consenso-e input::after { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border: 0; border-radius: 50%;
  background: #FBF6EC; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); opacity: 1; transform: none; transition: translate 220ms var(--entra); }
.e[data-stile="apple"] .consenso-e input:checked { background: #C9A96A; }
.e[data-stile="apple"] .consenso-e input:checked::after { translate: 20px 0; transform: none; }
.e[data-stile="apple"] .consenso-e input[aria-invalid="true"] { box-shadow: 0 0 0 1.5px var(--errore); }
.e[data-stile="apple"] .consenso-e input:focus-visible { outline: 2px solid var(--anello); outline-offset: 2px; }
.e[data-stile="apple"] .eta-e { margin: 10px 4px 0; }

/* the gold button: still the brand's; presses scale, hover changes at once */
.e[data-stile="apple"] .cta-oro { min-height: 56px; border-radius: 14px; transition: scale 140ms var(--entra); }
.e[data-stile="apple"] .cta-oro:active { transform: none; scale: .98; }
.e[data-stile="apple"] .cta-oro__freccia { transition: transform 150ms var(--entra); }
.e[data-stile="apple"] .msg-e { font-size: 13px; }

/* ── success: arrives right after the card starts turning, 80 ms apart ── */
.e[data-stile="apple"] .fatto > * { animation-duration: 420ms; animation-timing-function: var(--entra); }
.e[data-stile="apple"] .fatto > :nth-child(1) { animation-delay: .3s; }
.e[data-stile="apple"] .fatto > :nth-child(2) { animation-delay: .38s; }
.e[data-stile="apple"] .fatto > :nth-child(3) { animation-delay: .46s; }
.e[data-stile="apple"] .fatto > :nth-child(4) { animation-delay: .54s; }
.e[data-stile="apple"] .wbtn { border-radius: 12px; transition: scale 140ms var(--entra); }
.e[data-stile="apple"] .wbtn:active { scale: .98; }
.e[data-stile="apple"] .codice-e { border-radius: 14px; border-color: var(--gruppo-bordo); background: var(--gruppo); }
.e[data-stile="apple"] .codice-e button { min-height: 40px; transition: scale 140ms var(--entra); }
.e[data-stile="apple"] .codice-e button:active { scale: .97; }

/* ── the path of gifts: shorter reveals, the slider fill glued to the finger ── */
.e[data-stile="apple"] .percorso { padding-left: 20px; padding-right: 20px; }
.e[data-stile="apple"] .tappa { transition-duration: .5s; transition-delay: calc(var(--i) * 70ms + 100ms); }
.e[data-stile="apple"] .tappe::before { transition-duration: .9s; }
.e[data-stile="apple"] .liv2-e { transition-duration: .5s; transition-delay: .5s; }
.e[data-stile="apple"] .arcata > li { transition-duration: .5s; transition-delay: calc(var(--i) * 60ms + 100ms); }
.e[data-stile="apple"] .prova { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; border-top: 0; border-bottom: 0;
  box-shadow: 0 14px 24px -20px rgba(0, 0, 0, .8); }
.e[data-stile="apple"] .cammino::after { transition: none; }
.e[data-stile="apple"] .passo { transition-duration: .18s; }
.e[data-stile="apple"] .passo__nodo svg { transition-duration: .18s; }

@media (prefers-reduced-transparency: reduce) {
  .e[data-stile="apple"] .gira-e, .e[data-stile="apple"] .prova { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--fondo-piatto); }
}
@media (prefers-contrast: more) {
  .e[data-stile="apple"] { --gruppo-bordo: color-mix(in srgb, var(--testo) 55%, transparent); --riga: color-mix(in srgb, var(--testo) 35%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .e[data-stile="apple"] .gira-e, .e[data-stile="apple"] .entra, .e[data-stile="apple"] .fatto > * { animation-name: appare; }
  .e[data-stile="apple"] .galleggia, .e[data-stile="apple"] .galleggia.entra { animation: appare 300ms both; }
}
@keyframes appare { from { opacity: 0; } }
