/* Form del portale — UX unica (contatti, newsletter, tour, collaborazioni).
   Mobile first; palette amaranto + oro come il resto del sito. */
.wrc-form-card, .wrc-form {
  --amaranto: #6a0631; --gold: #f5c518; --gold-dark: #c9a200;
  --off: #f7f4f0; --dark: #1a1008; --muted: #6b6560;
  --radius: 18px; --shadow: 0 8px 32px rgba(0,0,0,.14);
}
.wrc-form-card *, .wrc-form-card *::before, .wrc-form-card *::after { box-sizing: border-box; }
.wrc-form { display: flex; flex-direction: column; gap: 22px; margin: 0; }
.wrc-field { display: flex; flex-direction: column; gap: 6px; }
.wrc-field select { appearance: auto; }
.wrc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.wrc-check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.wrc-form-msg { margin: 0; min-height: 1.2em; font-weight: 600; }
.wrc-form-section[hidden] { display: none; }

/* informativa privacy breve (art. 13 GDPR) */
.wrc-privacy-note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--off); color: var(--muted); font-size: .82rem; line-height: 1.55; }
.wrc-privacy-note a { color: var(--amaranto); font-weight: 700; }

/* ── CARD FORM ── */
.wrc-form-card { padding: 22px 18px; border-radius: var(--radius); background: #fff; border-top: 4px solid var(--gold); box-shadow: var(--shadow); }
.wrc-form-card__title { margin: 0 0 4px; font: 800 1.25rem/1.3 'Raleway', Georgia, sans-serif; color: var(--amaranto); }
.wrc-form-card__hint { margin: 0 0 20px; color: var(--muted); font-size: .88rem; }
.wrc-req { color: var(--amaranto); font-weight: 800; }

.wrc-form { gap: 22px; }
.wrc-form-group { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 0 0 22px; border: 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.wrc-form-group > legend {
    display: flex; align-items: center; gap: 10px;
    padding: 0; margin-bottom: 14px;
    font: 800 1.02rem/1.3 'Raleway', Georgia, sans-serif;
    color: var(--dark);
    float: left; width: 100%;   /* legend e contenuto restano nel flusso del flex */
}
.wrc-form-group > legend + * { clear: both; }
.wrc-form-step { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--amaranto); color: #fff; font-size: .8rem; font-weight: 800; }
.wrc-form-row { display: grid; gap: 14px; grid-template-columns: 1fr; }
.wrc-form-row--3 { grid-template-columns: 1fr; }
.wrc-form-row--3 > :last-child { grid-column: 1 / -1; }

.wrc-form .wrc-field { gap: 6px; font-size: .9rem; font-weight: 700; color: var(--dark); }
.wrc-form .wrc-field input,
.wrc-form .wrc-field select,
.wrc-form .wrc-field textarea {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 16px;                 /* evita lo zoom su iOS */
    border: 1.5px solid rgba(106,6,49,.22);
    border-radius: 12px;
    background: var(--off);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.wrc-form .wrc-field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.wrc-form .wrc-field input::placeholder,
.wrc-form .wrc-field textarea::placeholder { color: #9a948e; }
.wrc-form .wrc-field input:focus,
.wrc-form .wrc-field select:focus,
.wrc-form .wrc-field textarea:focus { outline: none; border-color: var(--amaranto); background: #fff; box-shadow: 0 0 0 3px rgba(245,197,24,.5); }
.wrc-form .wrc-field input:user-invalid,
.wrc-form .wrc-field select:user-invalid,
.wrc-form .wrc-field textarea:user-invalid { border-color: #9f1239; background: #fff5f7; }

/* tipi di esperienza come chip selezionabili */
.wrc-chips { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; }
.wrc-chips > legend { width: 100%; margin-bottom: 8px; font-size: .9rem; font-weight: 700; color: var(--dark); }
.wrc-chips > legend small { font-weight: 400; color: var(--muted); }
.wrc-chip { position: relative; display: inline-flex; }
.wrc-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.wrc-chip span {
    display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
    border: 1.5px solid rgba(106,6,49,.25); border-radius: 999px;
    background: #fff; color: var(--dark); font-size: .9rem; font-weight: 600;
    transition: all .2s;
}
.wrc-chip:hover span { border-color: var(--amaranto); }
.wrc-chip input:checked + span { background: var(--amaranto); border-color: var(--amaranto); color: #fff; }
.wrc-chip input:checked + span::before { content: '\2713'; margin-right: 6px; color: var(--gold); font-weight: 800; }
.wrc-chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrc-consent { font-size: .88rem; color: var(--muted); align-items: flex-start; }
.wrc-consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--amaranto); }
.wrc-consent a { color: var(--amaranto); font-weight: 700; }

.wrc-form-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 52px; padding: 14px 28px;
    border: 0; border-radius: 999px;
    background: var(--gold); color: var(--amaranto);
    font: 800 1rem 'Mulish', Georgia, sans-serif; letter-spacing: .02em;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245,197,24,.4);
    transition: background .2s, transform .2s, box-shadow .2s;
}
.wrc-form-btn:hover { background: var(--gold-dark); transform: translateY(-2px); }
.wrc-form-btn:focus-visible { outline: 3px solid var(--amaranto); outline-offset: 3px; }
.wrc-form-btn:disabled { opacity: .65; cursor: wait; transform: none; }

.wrc-form .wrc-form-msg:not(:empty) { padding: 12px 16px; border-radius: 12px; font-size: .95rem; }
.wrc-form .wrc-form-msg.is-ok { background: #ecfdf3; border: 1px solid #86d9a8; color: #14532d; }
.wrc-form .wrc-form-msg.is-error { background: #fff1f3; border: 1px solid #f3a6b6; color: #9f1239; }


@media (min-width: 640px) {
    .wrc-form-card { padding: 30px 28px; }
    .wrc-form-row { grid-template-columns: 1fr 1fr; }
    .wrc-form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
    .wrc-form-row--3 > :last-child { grid-column: auto; }
    .wrc-form-btn { width: auto; align-self: flex-start; min-width: 260px; }
}

/* ── Miglioramenti UX ── */
.wrc-form-card { animation: wrcFormIn .45s ease both; }
@keyframes wrcFormIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* select con freccia propria */
.wrc-form .wrc-field select {
    appearance: none; -webkit-appearance: none;
    padding-right: 40px;
    background: var(--off) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236a0631' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 12px;
}
.wrc-form .wrc-field select:focus { background-color: #fff; }
.wrc-form .wrc-field input:hover,
.wrc-form .wrc-field select:hover,
.wrc-form .wrc-field textarea:hover { border-color: rgba(106, 6, 49, .45); }

/* errori inline */
.wrc-field-error { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: #9f1239; font-size: .82rem; font-weight: 600; line-height: 1.35; animation: wrcFormIn .2s ease both; }
.wrc-field-error::before { content: "!"; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #9f1239; color: #fff; font-size: .7rem; font-weight: 800; }
.wrc-form .has-error > input,
.wrc-form .has-error > select,
.wrc-form .has-error > textarea { border-color: #9f1239; background-color: #fff5f7; }
.wrc-form .wrc-chips.has-error { padding: 10px; border-radius: 12px; outline: 1.5px solid #f3a6b6; background: #fff5f7; }
.wrc-consent.has-error { flex-wrap: wrap; padding: 10px; border-radius: 12px; background: #fff5f7; }
.wrc-consent .wrc-field-error { flex-basis: 100%; }

/* contatore caratteri */
.wrc-counter { align-self: flex-end; color: var(--muted); font-size: .75rem; font-weight: 400; font-variant-numeric: tabular-nums; }

/* consenso: area più comoda da toccare */
.wrc-consent { padding: 12px 14px; border: 1.5px solid rgba(106, 6, 49, .15); border-radius: 12px; cursor: pointer; transition: border-color .2s, background .2s; }
.wrc-consent:hover { border-color: rgba(106, 6, 49, .4); }
.wrc-consent input { width: 22px; height: 22px; cursor: pointer; }

/* pulsante: stato di invio */
.wrc-form-btn.is-loading { position: relative; padding-left: 52px; }
.wrc-form-btn.is-loading::before { content: ""; position: absolute; left: 24px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border: 2.5px solid rgba(106, 6, 49, .3); border-top-color: #6a0631; border-radius: 50%; animation: wrcSpin .7s linear infinite; }
@keyframes wrcSpin { to { transform: rotate(360deg); } }

/* esito: pannello di ringraziamento al posto del form */
.wrc-form-success { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 12px; text-align: center; animation: wrcFormIn .35s ease both; }
.wrc-form-success svg { width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: #ecfdf3; color: #14532d; }
.wrc-form-success strong { font: 800 1.35rem/1.3 'Raleway', Georgia, sans-serif; color: var(--amaranto); }
.wrc-form-success p { margin: 0; max-width: 34ch; color: var(--muted); line-height: 1.6; }

@media (max-width: 479px) {
    .wrc-form-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .wrc-form-card, .wrc-field-error, .wrc-form-success, .wrc-form-btn.is-loading::before { animation: none; }
}
.wrc-form[hidden] { display: none; }
