@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Il sito è scuro fisso, non segue la preferenza del sistema: senza
     dirlo esplicitamente il browser non lo sa, e disegna gli elementi
     nativi (barre di scorrimento, ecc.) con la sua veste chiara di
     default — chiarissima e stonata sopra uno sfondo scuro. */
  color-scheme: dark;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #0b0b12;
  --panel: #15141f;
  --campo: #1a1926;
  --campo-hover: #1e1d2b;
  --gold: #eeb323;
  --gold-soft: rgba(238, 179, 35, 0.16);
  --ink: #f2eee6;
  --testo-scuro: #1a1406;
  --muted: #9c97aa;
  --muted-2: #6b667a;
  --bordo: rgba(255, 255, 255, 0.1);
  --bordo-forte: rgba(255, 255, 255, 0.16);
  --rosso: #e5484d;
}

* {
  box-sizing: border-box;
}

/* Garantisce che l'attributo HTML "hidden" vinca sempre, anche su elementi
   a cui sotto diamo un display diverso da "block" (flex, grid, ecc.) */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 48px 16px 64px;
  background:
    radial-gradient(60% 42% at 20% -6%, rgba(238, 179, 35, 0.13), transparent 62%),
    radial-gradient(50% 40% at 100% 105%, rgba(107, 84, 214, 0.13), transparent 65%),
    radial-gradient(90% 55% at 50% 0%, rgba(255, 255, 255, 0.035), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

.pagina-form {
  width: 100%;
  max-width: 640px;
}

/* ---------- Intestazione: logo + avanzamento ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.logo-form svg {
  height: 48px;
  width: auto;
  fill: var(--gold);
}

.steps {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted-2);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bordo);
}

.steps b {
  font-weight: 500;
}

.steps .on {
  color: var(--gold);
}

.steps .bar {
  width: 24px;
  height: 1px;
  background: var(--bordo-forte);
}

/* ---------- Titolo e intro (fuori dalla card, come nel form pubblico) ---------- */

.title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 24px;
  color: var(--ink);
}

.intro {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-line;
  margin: 0 0 40px;
}

.intro ul {
  margin: 0;
  padding-left: 20px;
}

.intro li {
  margin-bottom: 6px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

/* ---------- Card dei passi ---------- */

.card {
  width: 100%;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--bordo);
  border-radius: 16px;
  padding: 30px 32px;
}

@media (max-width: 480px) {
  .page {
    padding: 40px 40px 56px;
  }

  .card {
    padding: 32px 26px;
    border-radius: 14px;
  }

  /* Font almeno 16px sui campi: sotto quella soglia Safari su iOS zooma
     automaticamente all'apertura della tastiera. */
  .inp,
  .combo-btn,
  .opt {
    font-size: 16px;
  }

  /* Più aria tra un paragrafo e l'altro del testo introduttivo, senza
     toccare la spaziatura tra le righe DENTRO lo stesso paragrafo: i
     paragrafi sono separati da una riga vuota (due <br> di fila), quindi
     solo il secondo dei due prende lo spazio extra. */
  .intro br + br {
    display: block;
    margin-top: 10px;
  }

  /* Solo "candidature chiuse": più piccolo del resto, il contenuto è breve
     e su schermi stretti risultava sproporzionato rispetto al testo. */
  #stato-chiuso {
    padding: 32px 20px;
  }

  #stato-chiuso .icona-stato {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
  }

  #stato-chiuso .icona-stato svg {
    width: 21px;
    height: 21px;
  }

  #stato-chiuso h2 {
    font-size: 19px;
  }

  /* L'a-capo forzato dopo "Show" serve solo in versione desktop, dove il
     testo altrimenti resterebbe su un'unica riga lunga: su schermi stretti
     va già a capo da solo in modo naturale. */
  .a-capo-desktop {
    display: none;
  }
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 18px;
  margin-bottom: 20px;
}

/* Il "gap" della griglia basta già a spaziare Nome/Cognome da Età/Città:
   il margin-bottom dei singoli campi qui si sommerebbe al gap invece di
   sovrapporsi, raddoppiando lo spazio interno alla riga. */
.row .f {
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .row {
    grid-template-columns: minmax(0, 1fr);
  }
}

#pagina-1,
#pagina-2 {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#pagina-1.uscendo,
#pagina-2.uscendo {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.f {
  margin-bottom: 11px;
}

.lab {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #b7b2c4;
  margin-bottom: 7px;
}

/* ---------- Campi ---------- */

.inp,
.combo-btn {
  width: 100%;
  height: 46px;
  background: var(--campo);
  border: 1px solid var(--bordo-forte);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 0 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.inp::placeholder {
  color: var(--muted-2);
}

.inp:hover,
.combo-btn:hover {
  background: var(--campo-hover);
}

.inp:focus-visible,
.combo-btn:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

textarea.inp {
  height: auto;
  min-height: 120px;
  padding: 13px 14px;
  line-height: 1.6;
  resize: vertical;
}

.count {
  display: flex;
  justify-content: flex-end;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.count.over {
  color: var(--rosso);
}

/* Niente freccette di incremento/decremento sul campo età. */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Tendina categoria personalizzata ---------- */

.combo {
  position: relative;
}

.combo-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.combo-btn .ph {
  color: var(--muted-2);
}

.combo-btn .chev {
  flex-shrink: 0;
  transition: transform 0.18s ease;
  color: var(--muted);
}

.combo[data-open="true"] .chev {
  transform: rotate(180deg);
  color: var(--gold);
}

.combo[data-open="true"] .combo-btn {
  border-color: var(--gold);
}

.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #101017;
  border: 1px solid var(--bordo-forte);
  border-radius: 12px;
  padding: 5px;
  max-height: 264px;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.combo-list.visibile {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.opt:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.opt[aria-selected="true"] {
  background: var(--gold-soft);
  color: var(--gold);
}

.opt.cursor {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.opt[aria-selected="true"].cursor,
.opt[aria-selected="true"]:hover {
  background: var(--gold-soft);
  color: var(--gold);
}

.opt .tick {
  opacity: 0;
}

.opt[aria-selected="true"] .tick {
  opacity: 1;
}

@media (max-width: 480px) {
  .combo-list {
    max-height: 45vh;
  }

  .opt {
    padding: 14px 14px;
  }
}

/* ---------- Consenso privacy ---------- */

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  cursor: pointer;
}

.consent input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex-shrink: 0;
  border: 1px solid var(--bordo-forte);
  border-radius: 5px;
  background: var(--campo);
  cursor: pointer;
  position: relative;
}

.consent input:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.consent input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--testo-scuro);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.consent input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.consent a {
  color: rgba(238, 179, 35, 0.55);
  text-underline-offset: 3px;
}

/* ---------- Nota informativa ---------- */

.note {
  display: flex;
  gap: 12px;
  background: var(--gold-soft);
  border: 1px solid rgba(238, 179, 35, 0.28);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.note svg {
  flex-shrink: 0;
  color: var(--gold);
  margin-top: 2px;
}

.note b {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 3px;
}

/* ---------- Azioni e bottoni ---------- */

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 4px;
}

@media (max-width: 480px) {
  .actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
    width: 100%;
  }
}

.btn {
  height: 46px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  background: var(--gold);
  color: var(--testo-scuro);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(0.985);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(238, 179, 35, 0.3);
}

.btn.ghost {
  background: none;
  color: var(--muted);
  padding: 0 6px;
  font-weight: 400;
}

.btn.ghost:hover {
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.err {
  font-size: 12.5px;
  color: var(--rosso);
  margin-top: 8px;
  min-height: 1px;
}

.page.centrato {
  justify-content: center;
}

.done {
  text-align: center;
  padding: 50px 32px;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
}

.done.mostra {
  animation: doneComparsa 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes doneComparsa {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.icona-stato {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icona-stato::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: var(--gold-soft);
  opacity: 0;
}

.done.mostra .icona-stato::before {
  animation: aloneSuccesso 0.8s ease-out 0.15s forwards;
}

@keyframes aloneSuccesso {
  0% {
    opacity: 0.9;
    transform: scale(0.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

.icona-stato svg {
  opacity: 0;
  transform: scale(0.5);
}

.done.mostra .icona-stato svg {
  animation: iconaPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

@keyframes iconaPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.icona-stato svg path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

.done.mostra .icona-stato svg path {
  animation: iconaSpunta 0.35s ease-out 0.3s forwards;
}

@keyframes iconaSpunta {
  to {
    stroke-dashoffset: 0;
  }
}

.done h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  opacity: 0;
  transform: translateY(8px);
}

.done.mostra h2 {
  animation: testoSu 0.4s ease-out 0.32s forwards;
}

.done p {
  color: var(--muted);
  margin: 0;
  opacity: 0;
  transform: translateY(8px);
}

.done.mostra p {
  animation: testoSu 0.4s ease-out 0.4s forwards;
}

@keyframes testoSu {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .done,
  .done h2,
  .done p,
  .icona-stato svg {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .icona-stato::before {
    display: none;
  }

  .icona-stato svg path {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Informativa privacy: pagina standalone e overlay ---------- */

.logo-form {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.overlay-privacy {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.overlay-privacy.visibile {
  opacity: 1;
}

.riquadro-privacy {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}

.overlay-privacy.visibile .riquadro-privacy {
  transform: translateY(0) scale(1);
}

.riquadro-privacy-scroll {
  width: 100%;
  padding: 32px;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .riquadro-privacy-scroll {
    padding: 24px 20px;
  }
}

.btn-chiudi-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.btn-chiudi-overlay:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.testo-legale h1 {
  font-size: 1.4rem;
  margin: 20px 0 16px;
}

.testo-legale h2 {
  font-size: 1rem;
  color: var(--gold);
  margin: 24px 0 6px;
}

.testo-legale p {
  color: var(--ink);
  margin: 0 0 10px;
}

.testo-legale a {
  color: var(--gold);
}

.testo-legale ul {
  margin: 0 0 10px;
  padding-left: 20px;
  color: var(--ink);
}

.testo-legale li {
  margin-bottom: 4px;
}

.testo-soft {
  color: var(--muted);
}
