/* Home della piattaforma: presentazione con il carosello dei mestieri. */
:root {
  --fondo: #eef2f6;
  --fondo-alto: #f8fafc;
  --inchiostro: #0f1b2d;
  --grigio: #5c6779;
  --grigio-chiaro: #8a94a4;
  --linea: #d8dfe8;
  --blu: #2f5bea;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --carta-l: clamp(140px, min(15vw, 18vh), 240px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(120% 70% at 50% 0%, var(--fondo-alto) 0%, var(--fondo) 62%) fixed, var(--fondo);
  color: var(--inchiostro);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blu); outline-offset: 3px; border-radius: 6px; }
.salta { position: absolute; left: -9999px; top: 8px; z-index: 50; background: #fff; padding: 8px 14px; border-radius: 8px; }
.salta:focus { left: 16px; }

.cornice {
  margin: 12px;
  border: 1px solid rgba(15, 27, 45, .07);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 40%);
  overflow: hidden;
}

/* Testata */
.testata {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 3.4vw, 44px);
}
.marchio { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.testo-corto { display: none; }
.marchio-segno { width: 24px; height: 24px; color: var(--inchiostro); }
.marchio-punto { width: 6px; height: 6px; border-radius: 50%; background: var(--blu); margin-left: 2px; }
.testata-nav { display: flex; gap: clamp(14px, 2.6vw, 40px); }
.testata-nav a { text-decoration: none; color: #2c3647; font-size: .98rem; padding: 6px 2px; }
.testata-nav a:hover { color: var(--inchiostro); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.testata-azioni { justify-self: end; display: flex; align-items: center; gap: 18px; }
.testata-accedi { text-decoration: none; font-size: .98rem; color: #2c3647; }
.testata-accedi:hover { color: var(--inchiostro); }
.pillola {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; border-radius: 999px;
  background: var(--inchiostro); color: #fff; text-decoration: none;
  font-weight: 600; font-size: .95rem; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 18px -8px rgba(15, 27, 45, .6);
  transition: transform .15s ease, background-color .15s ease;
}
.pillola:hover { background: #1c2b44; }
.pillola:active { transform: scale(.98); }
.pillola-grande { min-height: 52px; padding: 0 30px; font-size: 1rem; }

/* Eroe */
.eroe { padding: clamp(14px, 2.6vh, 30px) 0 20px; }
.eroe-testo { text-align: center; padding: 0 16px; }
.occhiello {
  display: inline-flex; align-items: center; gap: 14px;
  margin: 0 0 14px; color: var(--grigio); font-size: .92rem; letter-spacing: .01em;
}
.occhiello::before, .occhiello::after { content: ""; width: 36px; height: 1px; background: var(--linea); }
/* Banner in alto: chat come su WhatsApp tra il titolare e i candidati */
.chat-banner {
  margin: 0 clamp(12px, 2vw, 24px);
  border-radius: 18px;
  background:
    radial-gradient(circle at 1px 1px, rgba(15, 27, 45, .05) 1px, transparent 0) 0 0 / 14px 14px,
    #e9eef3;
  border: 1px solid rgba(15, 27, 45, .06);
}
.chat-dentro {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 28px;
  max-width: 1080px; margin: 0 auto; padding: 12px clamp(14px, 3vw, 32px);
}
.chat-scena { position: relative; min-height: 140px; }
@media (max-width: 860px) { .chat-scena { min-height: 200px; } }
.chat-conv {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 12px;
  opacity: 0; transition: opacity .5s ease;
}
.chat-conv.attiva { opacity: 1; }
.bolla {
  position: relative; padding: 8px 12px 18px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.4; color: #111b21;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.bolla-chi { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 650; }
.bolla-ora { position: absolute; right: 9px; bottom: 4px; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: #667781; }
.bolla-ora svg { width: 15px; height: 10px; fill: none; stroke: #53bdeb; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bolla-titolare { background: #d9fdd3; border-top-right-radius: 3px; }
.bolla-titolare .bolla-chi { color: #1f7a45; }
.bolla-candidato { background: #fff; border-top-left-radius: 3px; }
.bolla-candidato .bolla-chi { color: var(--blu); }
.bolla-scrive {
  grid-column: 2; grid-row: 1; display: none; align-self: start; width: max-content;
  background: #fff; border-top-left-radius: 3px; padding-bottom: 10px;
}
.bolla-scrive .bolla-chi { color: #667781; font-weight: 500; font-style: italic; }
.bolla-scrive i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #8696a0; animation: puntino 1.2s infinite; }
.bolla-scrive i:nth-of-type(2) { animation-delay: .15s; }
.bolla-scrive i:nth-of-type(3) { animation-delay: .3s; }
@keyframes puntino { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.bolla-candidato { grid-column: 2; grid-row: 1; margin-top: 14px; }
.bolla-scrive { margin-top: 14px; }
.chat-morale {
  margin: 0; max-width: 15em;
  font-family: var(--serif); font-size: clamp(1.15rem, 1.8vw, 1.5rem); line-height: 1.15; letter-spacing: -.01em; color: #3a4557;
  transition: opacity .5s ease, transform .5s ease;
}
.chat-morale strong { display: block; font-weight: 400; color: var(--inchiostro); }
/* Con il JS le parti arrivano una alla volta: messaggio, "sta scrivendo", risposta, morale. */
.chat-banner.animata .chat-conv .bolla { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.chat-banner.animata .chat-conv.fase-1 .bolla-titolare,
.chat-banner.animata .chat-conv.fase-3 .bolla-titolare,
.chat-banner.animata .chat-conv.fase-3 .bolla-candidato { opacity: 1; transform: none; }
.chat-banner.animata .chat-conv.fase-2 .bolla-titolare { opacity: 1; transform: none; }
.chat-banner.animata .chat-conv.fase-2 .bolla-scrive { display: block; opacity: 1; transform: none; }
.chat-banner.animata .chat-morale { opacity: 0; transform: translateY(4px); }
.chat-banner.animata.con-morale .chat-morale { opacity: 1; transform: none; }

/* Domande che si alternano: il problema, in grande */
.domande {
  position: relative;
  max-width: 15em; height: 2.05em; margin: 0 auto;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2rem, min(4.6vw, 6.4vh), 3.8rem);
  line-height: 1.02; letter-spacing: -.026em;
}
.domanda {
  position: absolute; inset: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  text-wrap: balance;
  opacity: 0; transform: translateY(.32em);
  transition: opacity .55s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
}
.domanda.attuale { opacity: 1; transform: none; }
.domanda.uscita { opacity: 0; transform: translateY(-.32em); }
.solo-lettori { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* La risposta */
h1 {
  margin: 16px auto 0;
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  line-height: 1.2; letter-spacing: -.015em;
  color: var(--blu);
}
.eroe-sotto { max-width: 48em; margin: 10px auto 0; color: var(--grigio); font-size: 1.05rem; text-wrap: pretty; }

/* Carosello: senza JS è una fila che si scorre di lato */
.carosello { position: relative; margin-top: clamp(12px, 2.5vh, 32px); outline: none; }
.carosello:focus-visible .carosello-pista { outline: 2px solid var(--blu); outline-offset: 10px; border-radius: 24px; }
.carosello-pista {
  list-style: none; margin: 0; padding: 12px 16px 24px;
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
}
.carta {
  position: relative; flex: none;
  width: var(--carta-l); aspect-ratio: 3 / 4;
  border-radius: 16px; overflow: hidden;
  background: #c9d3e1;
  scroll-snap-align: center;
  box-shadow: 0 1px 1px rgba(15, 27, 45, .08), 0 24px 40px -22px rgba(15, 27, 45, .55);
}
.carta img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(1.06);
  transition: filter .7s ease;
  user-select: none; -webkit-user-drag: none;
}
/* Le carte ferme hanno lo stesso tono freddo; quella al centro torna a colori. */
.carta::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: #3d66f0; mix-blend-mode: color; opacity: .62;
  transition: opacity .7s ease;
}
.carta::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(15, 27, 45, 0) 55%, rgba(15, 27, 45, .62) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  border-radius: inherit;
}
.carta.attiva img { filter: none; }
.carta.attiva::before { opacity: 0; }
.carta-nome {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  color: #fff; font-family: var(--serif); font-size: clamp(1rem, 1.25vw, 1.2rem);
  text-shadow: 0 1px 10px rgba(15, 27, 45, .45);
}
.carosello-luce { display: none; }

.carosello.pronto {
  height: calc(var(--carta-l) * 4 / 3 + 44px);
  perspective: 1500px;
  perspective-origin: 50% 40%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.carosello.pronto.trascina { cursor: grabbing; }
.carosello.pronto .carosello-pista {
  position: absolute; inset: 0; padding: 0; overflow: visible;
  display: block; transform-style: preserve-3d;
}
.carosello.pronto .carta {
  position: absolute; left: 50%; top: 16px;
  margin-left: calc(var(--carta-l) / -2);
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.carosello.pronto .carosello-luce {
  display: block; position: absolute; left: 50%; top: 50%;
  width: min(900px, 90vw); height: calc(var(--carta-l) * 1.9);
  transform: translate(-50%, -48%);
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 72%),
    radial-gradient(50% 8% at 50% 92%, rgba(15, 27, 45, .16), rgba(15, 27, 45, 0) 100%);
  pointer-events: none;
}

/* Comandi sotto il carosello */
.comandi {
  display: grid;
  grid-template-columns: 1fr minmax(0, 46rem) 1fr;
  grid-template-areas: "aiuto aiuto aiuto" "contatore scheda frecce" ". puntini .";
  align-items: end;
  gap: 6px 16px;
  padding: 0 clamp(16px, 3.4vw, 44px) clamp(24px, 4vh, 40px);
}
.comandi-aiuto { grid-area: aiuto; margin: 0 0 4px; text-align: center; color: var(--grigio-chiaro); font-size: .86rem; letter-spacing: .02em; }
.contatore { grid-area: contatore; margin: 0; font-family: var(--serif); color: var(--grigio-chiaro); font-variant-numeric: lining-nums tabular-nums; }
.contatore strong { font-weight: 400; font-size: clamp(2.2rem, 3.6vw, 3rem); color: var(--inchiostro); letter-spacing: -.02em; margin-right: 6px; }
.scheda-mestiere { grid-area: scheda; text-align: center; min-height: 6.1em; }
.scheda-mestiere h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 2.6vw, 2.3rem); line-height: 1.1; letter-spacing: -.015em; }
.esempio { margin: 0 auto; max-width: 42em; color: #3a4557; font-size: .98rem; text-wrap: pretty; }
.esempio-tipo {
  display: inline-block; vertical-align: 1px; margin-right: 6px; padding: 2px 9px;
  border-radius: 999px; background: #fff; border: 1px solid var(--linea);
  color: var(--blu); font-size: .78rem; font-weight: 600;
}
.scheda-mestiere.cambia h2, .scheda-mestiere.cambia .esempio { animation: entra .42s cubic-bezier(.2, .7, .2, 1); }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.puntini { grid-area: puntini; display: flex; justify-content: center; gap: 4px; padding-top: 4px; }
.puntini button {
  width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.puntini button::before {
  content: ""; width: 7px; height: 7px; border-radius: 999px; background: #c6ceda;
  transition: width .3s ease, background-color .3s ease;
}
.puntini button:hover::before { background: #9aa6b8; }
.puntini button[aria-current="true"]::before { width: 18px; background: var(--blu); }

.frecce { grid-area: frecce; justify-self: end; display: flex; gap: 12px; }
.frecce button {
  width: 54px; height: 54px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid rgba(15, 27, 45, .08); background: #fff; color: var(--inchiostro);
  box-shadow: 0 10px 24px -14px rgba(15, 27, 45, .45);
  transition: transform .15s ease, box-shadow .15s ease;
}
.frecce button:hover { box-shadow: 0 14px 28px -14px rgba(15, 27, 45, .6); }
.frecce button:active { transform: scale(.95); }
.frecce svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Fascia di scritte che scorrono */
.fascia {
  position: relative;
  border-block: 1px solid rgba(15, 27, 45, .08);
  background: rgba(255, 255, 255, .55);
  overflow: hidden;
}
.fascia-binario {
  display: flex; width: max-content;
  animation: scorri 48s linear infinite;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 88%, transparent 96%);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 88%, transparent 96%);
}
.fascia:hover .fascia-binario, .fascia.ferma .fascia-binario { animation-play-state: paused; }
.fascia-giro { display: flex; list-style: none; margin: 0; padding: 0; }
.fascia-giro li {
  display: flex; align-items: center; white-space: nowrap;
  padding: 20px 0; font-family: var(--serif); font-size: clamp(1.1rem, 1.6vw, 1.4rem); color: #3a4557;
}
.fascia-giro li::after {
  content: ""; flex: none; width: 9px; height: 9px; margin: 0 28px;
  border: 1.5px solid var(--blu); border-radius: 50%;
}
@keyframes scorri { to { transform: translateX(-50%); } }
.fascia-pausa {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid rgba(15, 27, 45, .1); background: #fff; color: var(--inchiostro);
}
.fascia-pausa svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fascia-pausa .icona-play { display: none; fill: currentColor; stroke: none; }
.fascia.ferma .icona-pausa { display: none; }
.fascia.ferma .icona-play { display: block; }

/* Sezioni sotto */
.trucchi { margin: clamp(56px, 9vw, 104px) clamp(12px, 2vw, 24px) 0; border-radius: 22px; background: var(--inchiostro); color: #fff; }
.trucchi-interno { max-width: 1080px; margin: 0 auto; padding: clamp(40px, 6vw, 72px) clamp(20px, 4vw, 40px); }
.trucchi h2 { margin: 0 0 16px; max-width: 22em; font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
.trucchi-sotto { margin: 0 0 36px; max-width: 40em; color: #c3ccda; font-size: 1.05rem; }
.trucchi-lista { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); }
.trucchi-lista > div { padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .16); }
.trucchi-lista dt { margin: 0 0 8px; font-weight: 650; font-size: 1.05rem; }
.trucchi-lista dt::before { content: ""; display: block; width: 9px; height: 9px; margin-bottom: 14px; border: 1.5px solid #7d9bff; border-radius: 50%; }
.trucchi-lista dd { margin: 0; color: #c3ccda; }
.blocco { max-width: 1080px; margin: 0 auto; padding: clamp(56px, 9vw, 104px) clamp(16px, 4vw, 40px) 0; }
.blocco > h2, .invito h2 {
  margin: 0 0 32px; font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.08; letter-spacing: -.02em; text-wrap: balance;
}
.passi { list-style: none; counter-reset: passo; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); }
.passi li { counter-increment: passo; padding-top: 18px; border-top: 1px solid var(--linea); }
.passi li::before { content: counter(passo); display: block; margin-bottom: 12px; font-family: var(--serif); font-size: 1.6rem; color: var(--blu); line-height: 1; }
.passi h3, .regole dt { margin: 0 0 8px; font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; }
.passi p, .regole dd { margin: 0; color: var(--grigio); max-width: 34em; }
.regole { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.regole > div { background: rgba(255, 255, 255, .7); border: 1px solid rgba(15, 27, 45, .06); border-radius: 18px; padding: 22px 22px 24px; }

.invito { max-width: 860px; margin: 0 auto; padding: clamp(72px, 10vw, 120px) 16px clamp(64px, 9vw, 104px); text-align: center; }
.invito h2 { margin-bottom: 14px; }
.invito p { margin: 0 auto 28px; max-width: 32em; color: var(--grigio); }

.piede {
  display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center;
  padding: 22px clamp(16px, 3.4vw, 44px);
  border-top: 1px solid rgba(15, 27, 45, .07);
  color: var(--grigio); font-size: .88rem;
}
.piede a { text-decoration: none; }
.piede a:hover { text-decoration: underline; }
.piede-foto { margin-left: auto; color: var(--grigio-chiaro); }

/* Tablet e telefono */
@media (max-width: 860px) {
  .testata { grid-template-columns: 1fr auto; }
  .testata-nav { display: none; }
  .testata-accedi { display: none; }
  .passi, .regole, .trucchi-lista { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --carta-l: min(54vw, 250px); }
  .cornice { margin: 0; border: 0; border-radius: 0; }
  .testata { padding: 14px 16px; }
  .pillola { min-height: 40px; padding: 0 16px; font-size: .9rem; }
  .pillola-grande { min-height: 50px; padding: 0 26px; font-size: 1rem; }
  .eroe { padding-top: 22px; }
  .occhiello { font-size: .85rem; gap: 10px; }
  .occhiello::before, .occhiello::after { width: 18px; }
  .eroe-sotto { font-size: 1rem; margin-top: 10px; }
  .domande { height: 3.15em; font-size: clamp(1.65rem, 7.4vw, 2.2rem); max-width: 12em; }
  .chat-banner { margin: 0 12px; }
  .chat-dentro { grid-template-columns: 1fr; padding: 12px; }
  .chat-scena { min-height: 262px; }
  .chat-conv { grid-template-columns: 1fr; gap: 8px; }
  .bolla-titolare { margin-left: 14%; }
  .bolla-candidato, .bolla-scrive { grid-column: 1; grid-row: 2; margin: 0 14% 0 0; }
  .chat-morale { max-width: none; font-size: 1.15rem; }
  .chat-morale strong { display: inline; margin-left: .3em; }
  h1 { margin-top: 10px; }
  .fascia-giro li { padding: 15px 0; }
  .fascia-giro li::after { margin: 0 20px; }
  .fascia-binario { animation-duration: 36s; }
  .carosello.pronto { height: calc(var(--carta-l) * 4 / 3 + 72px); }
  .carosello.pronto .carta { top: 24px; }
  .comandi {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "aiuto aiuto aiuto" "scheda scheda scheda" "contatore . frecce";
    align-items: center;
  }
  .comandi-aiuto { margin-bottom: 8px; }
  .scheda-mestiere { min-height: 8.6em; }
  .contatore strong { font-size: 1.7rem; }
  .puntini { display: none; }
  .frecce { gap: 8px; }
  .frecce button { width: 44px; height: 44px; }
  .piede-foto { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .domanda { transition: opacity .3s ease; transform: none !important; }
  .bolla-scrive i { animation: none; }
  .fascia-binario { animation: none; width: auto; -webkit-mask-image: none; mask-image: none; }
  .fascia-giro { flex-wrap: wrap; justify-content: center; padding: 8px 16px; }
  .fascia-giro[aria-hidden] { display: none; }
  .fascia-giro li { padding: 10px 0; white-space: normal; }
  .fascia-pausa { display: none; }
  .carta img, .carta::before, .puntini button::before { transition: none; }
  .scheda-mestiere.cambia h2, .scheda-mestiere.cambia .esempio { animation: none; }
}

@media (max-width: 420px) {
  .testo-lungo { display: none; }
  .testo-corto { display: inline; }
}
