/* ================================================
   TEST "CHE CAVALLO SEI NEL TUO BRANCO?"
   Si appoggia a style.css del sito (variabili, bottoni, sezioni).
   ================================================ */

.test-screen[hidden] { display: none !important; }
.test-screen { scroll-margin-top: var(--nav-h); }

.test-narrow { max-width: 760px; }

/* ---- Intestazione con i cavalli ----
   La foto (hdr-test.jpg) è un verticale ritagliato: sugli schermi larghi
   l'intestazione standard (38vh) mostrerebbe solo una striscia e taglierebbe
   i cavalli, quindi qui l'altezza segue la larghezza (30vw). La foto parte
   sotto la nav (opaca), così i cavalli restano al centro della parte visibile.
   Su mobile il titolo occuperebbe il centro: ritaglio dedicato (hdr-test-m.jpg)
   con i cavalli in alto e il titolo sopra prato/staccionata. */
.page-header.page-header-test { min-height: max(38vh, min(calc(var(--nav-h) + 30vw), 70vh)); }
.page-header-test .page-header-photo {
  top: var(--nav-h);
  background-image: url('../images/hdr-test.jpg?v=20261006');
  background-position: 43% 50%;
  opacity: 0.62;
}

/* I cavalli stanno a sinistra del centro: il titolo va a destra, sugli alberi. */
@media (min-width: 681px) {
  .page-header.page-header-test { justify-content: flex-end; text-align: right; }
}

@media (max-width: 680px) {
  .page-header.page-header-test { min-height: calc(var(--nav-h) + min(115vw, 70vh)); }
  .page-header-test .page-header-photo {
    background-image: url('../images/hdr-test-m.jpg?v=20261006');
    background-position: 50% 0;
  }
}

/* ---- Intro ---- */
.test-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2.5rem 0 2rem;
}

.test-facts li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.3rem 0.5rem;
  border: 1px solid rgba(184,137,58,0.25);
  border-radius: calc(var(--radius) * 1.5);
  background: var(--color-bg);
}

.test-fact-num {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--color-accent);
}

.test-fact-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-top: 0.3rem;
}

.test-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--color-text);
  border-left: 2px solid var(--color-accent2);
  padding: 0.2rem 0 0.2rem 1.2rem;
  margin-bottom: 2.5rem;
}

.test-note em { color: var(--color-accent); }

.test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.test-actions-center { justify-content: center; }

.test-btn-ghost {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid rgba(184,137,58,0.5);
}

.test-btn-ghost:hover {
  background: rgba(184,137,58,0.08);
  transform: translateY(-2px);
}

.test-btn-ghost[hidden] { display: none; }

/* ---- Domande ---- */
.test-quiz-section { min-height: calc(100vh - var(--nav-h)); }

.test-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  min-height: 1.6rem;
}

.test-counter {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.test-back {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  padding: 0.3rem 0;
  transition: color var(--transition);
}

.test-back:hover { color: var(--color-accent); }
.test-back[hidden] { display: none; }

.test-progress {
  height: 4px;
  border-radius: 4px;
  background: rgba(184,137,58,0.15);
  overflow: hidden;
  margin-bottom: 3rem;
}

.test-progress-bar {
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: 4px;
  transition: width 0.45s ease;
}

.test-question {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: 2rem;
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-option {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 1.05rem 1.3rem;
  background: var(--color-bg);
  border: 1px solid rgba(42,36,48,0.08);
  border-radius: calc(var(--radius) * 1.5);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
              transform var(--transition), box-shadow var(--transition);
}

.test-option:hover {
  border-color: rgba(184,137,58,0.55);
  background: #fbf8f2;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(169,120,31,0.10);
}

.test-option:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.test-option-dot {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 1.5px solid rgba(184,137,58,0.6);
  position: relative;
  transition: border-color var(--transition), background var(--transition);
}

.test-option.is-selected {
  border-color: var(--color-accent);
  background: #f8f0e0;
  box-shadow: 0 4px 18px rgba(169,120,31,0.16);
}

.test-option.is-selected .test-option-dot {
  border-color: var(--color-accent);
  background: var(--gradient);
}

.test-option.is-selected .test-option-dot::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--color-white);
}

/* Ingresso morbido di ogni nuova domanda */
.test-question-wrap.is-entering .test-question,
.test-question-wrap.is-entering .test-option {
  animation: testIn 0.45s ease both;
}

.test-question-wrap.is-entering .test-option:nth-child(1) { animation-delay: 0.04s; }
.test-question-wrap.is-entering .test-option:nth-child(2) { animation-delay: 0.08s; }
.test-question-wrap.is-entering .test-option:nth-child(3) { animation-delay: 0.12s; }
.test-question-wrap.is-entering .test-option:nth-child(4) { animation-delay: 0.16s; }
.test-question-wrap.is-entering .test-option:nth-child(5) { animation-delay: 0.20s; }
.test-question-wrap.is-entering .test-option:nth-child(6) { animation-delay: 0.24s; }

@keyframes testIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Risultato ---- */
.test-result-head {
  text-align: center;
  margin-bottom: 2.5rem;
}

.test-mono {
  width: 96px;
  height: 96px;
  margin: 0.5rem auto 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--color-white);
  background: var(--gradient);
  box-shadow: 0 0 0 6px rgba(212,169,78,0.15), 0 10px 30px rgba(169,120,31,0.3);
}

.test-result-name {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-text);
}

.test-result-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--color-accent);
  margin-top: 0.3rem;
}

.test-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.test-tags li {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
  padding: 0.35rem 0.9rem;
  border: 1px solid rgba(184,137,58,0.35);
  border-radius: 50px;
}

.test-result-text p {
  font-size: 1.08rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--color-text);
  margin-bottom: 1.1rem;
}

.test-result-text p:first-child {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.55;
}

.test-result-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-top: 2.2rem;
}

.test-box {
  padding: 1.6rem 1.6rem 1.4rem;
  border-radius: calc(var(--radius) * 1.5);
  background: var(--color-bg);
  border-top: 3px solid var(--color-accent2);
}

.test-box-evo { border-top-color: #6b6478; }

.test-box-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.6rem;
}

.test-box-evo .test-box-label { color: var(--color-muted); }

.test-box p {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--color-text);
}

/* Chiusura su foto */
.test-closing { padding: 7rem 5%; }

.test-closing-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.test-closing-text {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.8;
  color: rgba(255,255,255,0.78);
  margin: 0.5rem 0 1.8rem;
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
}

.test-closing-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  line-height: 1.45;
  color: var(--color-white);
}

/* Altri archetipi */
.test-others {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-other {
  background: var(--color-white);
  border: 1px solid rgba(42,36,48,0.07);
  border-radius: calc(var(--radius) * 1.5);
  transition: box-shadow var(--transition);
}

.test-other[open] { box-shadow: var(--shadow); }

.test-other summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  list-style: none;
}

.test-other summary::-webkit-details-marker { display: none; }

.test-other summary::after {
  content: '+';
  margin-left: auto;
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--color-accent);
  transition: transform var(--transition);
}

.test-other[open] summary::after { transform: rotate(45deg); }

.test-other-mono {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-accent);
  border: 1px solid rgba(184,137,58,0.45);
}

.test-other-names {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.test-other-names strong {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
}

.test-other-names em {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.test-other-body {
  padding: 0 1.2rem 1.2rem calc(1.2rem + 42px + 1rem);
  font-size: 0.97rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--color-muted);
}

.test-other-body p + p { margin-top: 0.6rem; }
.test-other-body b { font-weight: 600; color: var(--color-text); }

/* ================================================
   Versione con invio email: modulo, consensi, disclaimer
   ================================================ */
/* "Prima di iniziare": disclaimer del test, subito prima del pulsante */
.test-before {
  background: var(--color-bg);
  border-left: 3px solid var(--color-accent2);
  border-radius: 0 calc(var(--radius) * 1.5) calc(var(--radius) * 1.5) 0;
  padding: 1.5rem 1.6rem 1.3rem;
  margin: -0.5rem 0 2.2rem;
}
.test-before p {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}
.test-before strong { color: var(--color-text); font-weight: 600; }
.test-before .test-before-go {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--color-accent);
  margin: 1rem 0 0;
}

.test-mono-envelope svg { display: block; }

.test-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.test-field { display: flex; flex-direction: column; gap: 0.4rem; }
.test-field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text);
}
.test-field input {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(42,36,48,0.18);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.test-field input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(184,137,58,0.18);
}

.test-optional, .test-required {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-muted);
  font-size: 0.85em;
}

/* Honeypot: fuori schermo, non display:none (alcuni bot lo riconoscono) */
.test-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.test-check {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-text);
  cursor: pointer;
}
.test-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 0.2rem;
  accent-color: var(--color-accent);
  cursor: pointer;
}
.test-check a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.test-check strong { font-weight: 600; }
.test-check small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}
.test-check-news {
  background: #fbf6ec;
  border: 1px solid rgba(184,137,58,0.25);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.test-form-status {
  font-size: 0.92rem;
  color: #9b2c2c;
  background: #fdf0f0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.test-form-status[hidden] { display: none; }

.test-form-foot {
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--color-muted);
  text-align: center;
}
.test-form-foot a { color: var(--color-accent); text-decoration: underline; }

.test-sent-news {
  max-width: 560px;
  margin: 2rem auto 0;
  text-align: left;
  padding: 1.4rem 1.6rem;
  border-radius: calc(var(--radius) * 1.5);
  background: #f8f0e0;
  border-top: 3px solid var(--color-accent2);
}
.test-sent-news[hidden], .test-sent-news-already[hidden] { display: none; }
.test-sent-news p { font-size: 1rem; line-height: 1.7; color: var(--color-text); }
.test-sent-news-already { margin-top: 1.2rem; color: var(--color-muted); }

/* Disclaimer / pagine legali */
.test-legal { background: var(--color-bg); border-top: 1px solid rgba(42,36,48,0.06); padding-top: 4.5rem; padding-bottom: 4.5rem; }
.test-legal-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: 1.2rem;
}
.test-legal p {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--color-muted);
  margin-bottom: 0.9rem;
}
.test-legal strong { color: var(--color-text); font-weight: 600; }
.test-legal-small { font-size: 0.85rem !important; }

/* Informativa privacy */
.legal-doc h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 2.4rem 0 0.8rem;
}
.legal-doc h2:first-of-type { margin-top: 0; }
.legal-doc p, .legal-doc li {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--color-muted);
}
.legal-doc p { margin-bottom: 0.9rem; }
.legal-doc ul { list-style: disc; padding-left: 1.3rem; margin-bottom: 1rem; }
.legal-doc li { margin-bottom: 0.4rem; }
.legal-doc strong { color: var(--color-text); font-weight: 600; }
.legal-doc a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-doc table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.2rem; font-size: 0.9rem; }
.legal-doc th, .legal-doc td { text-align: left; vertical-align: top; padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(42,36,48,0.1); color: var(--color-muted); line-height: 1.6; }
.legal-doc th { color: var(--color-text); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.legal-todo { background: #fff3c4; color: #6b4e00; padding: 0 0.3em; border-radius: 3px; }
.legal-updated { font-size: 0.85rem; color: var(--color-muted); margin-bottom: 2rem; }

@media (max-width: 680px) {
  .legal-doc table, .legal-doc thead, .legal-doc tbody, .legal-doc tr, .legal-doc th, .legal-doc td { display: block; }
  .legal-doc thead { display: none; }
  .legal-doc tr { border-bottom: 1px solid rgba(42,36,48,0.12); padding: 0.6rem 0; }
  .legal-doc td { border: none; padding: 0.2rem 0; }
  .legal-doc td::before { content: attr(data-th) ": "; font-weight: 600; color: var(--color-text); }
}

/* ---- Responsive ---- */
@media (max-width: 680px) {
  .test-quiz-section { padding-top: 2.5rem; }
  .test-facts { gap: 0.6rem; }
  .test-fact-num { font-size: 1.8rem; }
  .test-fact-label { font-size: 0.6rem; letter-spacing: 0.12em; }
  .test-result-boxes { grid-template-columns: 1fr; }
  .test-option { padding: 0.95rem 1rem; font-size: 0.97rem; }
  .test-progress { margin-bottom: 2.2rem; }
  .test-other-body { padding-left: 1.2rem; }
  .test-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .test-question-wrap.is-entering .test-question,
  .test-question-wrap.is-entering .test-option { animation: none; }
  .test-progress-bar { transition: none; }
}
