/* ============================================================
   TAKEAWAY — Footer Contact Form
   CF7 form HTML structure (nth-child 1-based):
   p:nth-child(1) → your-name
   p:nth-child(2) → your-email
   p:nth-child(3) → your-message
   p:nth-child(4) → your-privacy
   p:nth-child(5) → submit
   p:nth-child(6) → honeypot (hidden)
   ============================================================ */

/* ── Wrapper collassato ── */
.footer-form-wrap {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  width: min(405px, 80vw);
  transition:
    max-height 0.6s cubic-bezier(0.76, 0, 0.24, 1),
    opacity 0.35s ease;
}

.footer-form-wrap.is-open {
  max-height: 700px;
  opacity: 1;
  pointer-events: auto;
  transition:
    max-height 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease 0.08s;
}

/* ── Container ── */
.footer-form {
  padding-top: 0;
  width: 100%;
}

/* ────────────────────────────────────────────────────────────
   CF7 RESET
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7 { margin: 0; padding: 0; }

.footer-form .wpcf7 form > p {
  margin: 0;
  padding: 0;
}

.footer-form .wpcf7 .wpcf7-form-control-wrap {
  display: block;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: none !important;
}

/* ────────────────────────────────────────────────────────────
   CAMPI — input + textarea
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7 input[type="text"],
.footer-form .wpcf7 input[type="email"],
.footer-form .wpcf7 textarea {
  width: 100%;
  background: transparent !important;
  background-color: transparent !important;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  font-family: var(--font);
  font-size: var(--text-body-md);
  font-weight: var(--fw-regular);
  letter-spacing: var(--ls-body);
  color: var(--c-text);
  padding: 10px 0;
  line-height: var(--lh-body-md);
  resize: none;
  display: block;
  transition: border-color 0.3s ease;
}

/* Focus — linea bianca piena */
.footer-form .wpcf7 input[type="text"]:focus,
.footer-form .wpcf7 input[type="email"]:focus,
.footer-form .wpcf7 textarea:focus {
  border-color: rgba(255,255,255,0.8);
  outline: none;
  box-shadow: none;
}

/* Autofill */
.footer-form .wpcf7 input:-webkit-autofill,
.footer-form .wpcf7 input:-webkit-autofill:hover,
.footer-form .wpcf7 input:-webkit-autofill:focus,
.footer-form .wpcf7 input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #000 inset !important;
  box-shadow: 0 0 0 1000px #000 inset !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
}

/* Placeholder — uppercase, stessa gerarchia delle label */
.footer-form .wpcf7 input::placeholder,
.footer-form .wpcf7 textarea::placeholder {
  font-family: var(--font);
  font-size: var(--text-body-sm);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  opacity: 1;
}

/* Textarea */
.footer-form .wpcf7 textarea {
  height: 80px !important;
  min-height: 80px;
  max-height: 80px;
  overflow-y: auto;
}

/* ────────────────────────────────────────────────────────────
   SPACING TRA CAMPI
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7 form > p:nth-child(1),
.footer-form .wpcf7 form > p:nth-child(2),
.footer-form .wpcf7 form > p:nth-child(3) {
  display: block;
}



/* Spazio extra prima di Message */
.footer-form .wpcf7 form > p:nth-child(3) {
  padding-top: 8px;
}

/* ────────────────────────────────────────────────────────────
   ACCEPTANCE — privacy
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7 form > p:nth-child(4),
.footer-form .wpcf7 form > p:nth-child(6) {
  padding-top: 28px;
}

.footer-form .wpcf7 .wpcf7-acceptance { display: block; }

.footer-form .wpcf7 .wpcf7-list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}

.footer-form .wpcf7 .wpcf7-list-item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
}

.footer-form .wpcf7 .wpcf7-list-item input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 12px;
  height: 12px;
  min-width: 12px;
  cursor: pointer;
  margin: 3px 0 0 0;
  flex-shrink: 0;
  accent-color: #fff;
  opacity: 0.5;
}

.footer-form .wpcf7 .wpcf7-list-item-label {
  font-family: var(--font);
  font-size: var(--text-body-sm);
  font-weight: var(--fw-regular);
  color: rgba(255,255,255,0.35);
  letter-spacing: var(--ls-body);
  line-height: var(--lh-body-sm);
}

.footer-form .wpcf7 .wpcf7-list-item-label a {
  color: rgba(255,255,255,0.35);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.2s;
}
.footer-form .wpcf7 .wpcf7-list-item-label a:hover { color: #fff; }

/* ────────────────────────────────────────────────────────────
   SUBMIT
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7 form > p:nth-child(5),
.footer-form .wpcf7 form > p:nth-child(7) {
  padding-top: 24px;
}

.footer-form .wpcf7-submit {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--text-body-md);
  font-weight: var(--fw-regular);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
  position: relative;
}

/* Linea sotto submit — stessa animazione del "Get in touch" */
.footer-form .wpcf7-submit::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: #fff;
  transform: scaleX(1);
  transition: opacity 0.2s;
}

.footer-form .wpcf7-submit:hover { opacity: 0.5; }
.footer-form .wpcf7-submit:disabled { opacity: 0.25; cursor: default; }
.footer-form .wpcf7-spinner { display: none !important; }

/* ── Stato invio in corso ── */
.footer-form .wpcf7-submit.is-sending {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.footer-form .wpcf7-submit.is-sending::after {
  animation: submit-line-pulse 1.2s ease-in-out infinite;
}

@keyframes submit-line-pulse {
  0%, 100% { opacity: 0.2; transform: scaleX(0.3); transform-origin: left; }
  50%       { opacity: 0.8; transform: scaleX(1);   transform-origin: left; }
}

/* ────────────────────────────────────────────────────────────
   VALIDATION + RESPONSE
   ──────────────────────────────────────────────────────────── */

.footer-form .wpcf7-not-valid-tip {
  font-family: var(--font);
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
  color: rgba(255,255,255,0.4);
  letter-spacing: var(--ls-body);
  display: block;
  padding: 6px 0 0;
}

.footer-form .wpcf7-not-valid input,
.footer-form .wpcf7-not-valid textarea {
  border-color: rgba(255,255,255,0.5) !important;
}

.footer-form .wpcf7-response-output {
  font-family: var(--font);
  font-size: var(--text-body-sm);
  color: rgba(255,255,255,0.4);
  letter-spacing: var(--ls-body);
  line-height: var(--lh-body-sm);
  padding: 20px 0 0;
  margin: 0 !important;
  border: none !important;
}

.footer-form .wpcf7 .wpcf7-hidden,
.footer-form .wpcf7 [style*="display:none"],
.footer-form .wpcf7 .hidden-fields-container {
  display: none !important;
}

/* ────────────────────────────────────────────────────────────
   MOBILE
   ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .footer-form-wrap {
    width: calc(100% - 96px);
  }

  .footer-form {
    padding: 24px 0 48px 0;
    width: 100%;
    box-sizing: border-box;
  }

  .footer-form .wpcf7 .wpcf7-turnstile,
  .footer-form .wpcf7 .cf-turnstile {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .footer-form .wpcf7-not-valid-tip { text-align: left; }
  .footer-form .wpcf7 .wpcf7-list-item { justify-content: flex-start; }

  .footer-form .wpcf7 form > p:nth-child(5),
  .footer-form .wpcf7 form > p:nth-child(7) { text-align: left; }
}
