/* Shared preventivo wizard — extracted from funnel-grandineticino (main.css + funnel.css) */
/* Keep in sync: kesi-site scripts/sync-funnel-form-from-funnel.sh + re-extract this file */

/* Title tokens (also used by form head) */
.type-card-title {
  margin: 0;
  font-size: var(--text-card);
  font-weight: var(--font-heavy);
  line-height: var(--leading-tight);
}

.type-subtitle {
  margin: 0.6rem 0 0;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-muted);
  line-height: var(--leading-normal);
}

/* Preventivo form base fields */
.prev-form { display: flex; flex-direction: column; gap: 1.25rem; }

.prev-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.prev-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.prev-radio input { accent-color: var(--color-orange); width: 16px; height: 16px; }

.prev-field { display: flex; flex-direction: column; gap: 0.35rem; }
.prev-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-black);
}
.prev-required { color: var(--color-orange); }

.prev-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  font: inherit;
  font-size: var(--text-base);
  color: var(--color-black);
  background: #fff;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}
.prev-input:focus { outline: none; border-color: var(--color-orange); }

.prev-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpolyline points='1,1 6,6 11,1' fill='none' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

.prev-select:invalid {
  color: var(--color-muted);
}

.prev-tel-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s ease;
}
.prev-tel-wrap:focus-within { border-color: var(--color-orange); }
.prev-tel-country {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border-input);
  background: var(--color-bg-subtle);
}
.prev-tel-country-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background-color: transparent;
  /* Vertical padding matches .prev-input so flag + dial code are not clipped */
  padding: 0.65rem 1.75rem 0.65rem 0.7rem;
  min-height: 2.75rem;
  height: 100%;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-black);
  cursor: pointer;
  line-height: 1.35;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}
.prev-tel-country-select:focus {
  outline: none;
}
.prev-tel-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.85rem;
  border-right: 1px solid var(--color-border-input);
  height: 100%;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-muted);
  user-select: none;
  line-height: 1.35;
}
.prev-input--tel {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.prev-input--tel:focus { border-color: transparent; }

.prev-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 2px dashed var(--color-border-input);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease;
}
.prev-upload:hover { border-color: var(--color-orange); }
.prev-upload svg { width: 28px; height: 28px; color: var(--color-muted); }
.prev-upload-text { font-size: 0.8rem; color: var(--color-muted); }
.prev-upload-text em { display: block; font-style: normal; }
.prev-upload-input { display: none; }

/* File preview grid */
.prev-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.prev-preview-grid[hidden] {
  display: none !important;
}

.funnel-form-panels .prev-preview-grid:not([hidden]) {
  width: 100%;
}
.prev-preview-item {
  position: relative;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.prev-preview-thumb {
  width: 90px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border-input);
  display: block;
}
.prev-preview-icon {
  width: 90px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-input);
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.04em;
}
.prev-preview-name {
  font-size: 0.65rem;
  color: var(--color-muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
  max-width: 90px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.prev-preview-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}
.prev-preview-del:hover { background: #e00; }

.prev-preview-size {
  font-size: 0.6rem;
  color: var(--color-muted);
  text-align: center;
}

/* Size bar */
.prev-size-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.prev-size-track {
  height: 4px;
  background: var(--color-bg-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.prev-size-fill {
  height: 100%;
  background: var(--color-orange);
  border-radius: 2px;
  transition: width 0.2s ease, background 0.2s ease;
}
.prev-size-bar--over .prev-size-fill { background: #e00; }
.prev-size-label {
  font-size: 0.72rem;
  color: var(--color-muted);
}
.prev-size-bar--over .prev-size-label { color: #c00; font-weight: 600; }
.prev-size-warning {
  font-size: 0.78rem;
  color: #c00;
  margin: 0.1rem 0 0;
  line-height: 1.4;
}

.prev-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border-input);
  border-radius: 8px;
  font: inherit;
  font-size: var(--text-base);
  color: var(--color-black);
  resize: vertical;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}
.prev-textarea:focus { outline: none; border-color: var(--color-orange); }

.prev-hint { font-size: var(--text-xs); color: var(--color-muted); margin: 0; }

.prev-field--check { margin-top: 0.25rem; }
.prev-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: var(--text-sm);
  color: var(--color-muted);
  cursor: pointer;
}
.prev-check-label input { accent-color: var(--color-orange); margin-top: 2px; flex-shrink: 0; }
.prev-check-label a { color: var(--color-black); text-decoration: underline; }

.prev-submit {
  width: 100%;
  padding: 1rem;
  background: var(--color-black);
  color: var(--color-white);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--font-bold);
  letter-spacing: 0.5px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-top: 0.5rem;
}
.prev-submit:hover { opacity: 0.85; }

/* ════════════════════════════════════════════════════════════════
   Hero entrance — subtle fade-up on page load
   ════════════════════════════════════════════════════════════════ */
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero .eyebrow      { animation: hero-fade-up 0.55s ease 0.05s both; }
.hero .hero-title   { animation: hero-fade-up 0.60s ease 0.18s both; }
.hero .hero-lead    { animation: hero-fade-up 0.55s ease 0.30s both; }
.hero .hero-actions { animation: hero-fade-up 0.55s ease 0.42s both; }

.page-hero .eyebrow  { animation: hero-fade-up 0.55s ease 0.05s both; }
.page-hero h1,
.page-hero .hero-title { animation: hero-fade-up 0.60s ease 0.18s both; }
.page-hero .lead,
.page-hero .hero-lead  { animation: hero-fade-up 0.55s ease 0.30s both; }
.funnel-hero .funnel-hero-bullets { animation: hero-fade-up 0.55s ease 0.38s both; }

/* Form card + multi-step wizard */
/* Form card */
.funnel-hero-form-wrap {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  color: var(--color-black);
}

/* Form card — altezza fissa, step area riempie lo spazio restante */
.funnel-hero-form-wrap--prominent {
  display: flex;
  flex-direction: column;
  min-height: 48rem;
  box-sizing: border-box;
}

.funnel-hero-form-wrap--prominent > .funnel-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.funnel-hero-form-wrap--prominent .funnel-form-head {
  flex-shrink: 0;
}

.funnel-hero-form-wrap--prominent .funnel-form-steps {
  flex-shrink: 0;
}

.funnel-hero-form-wrap--prominent .funnel-form-step-error {
  flex-shrink: 0;
}

.funnel-hero-form-wrap--prominent .funnel-form-panels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.funnel-hero-form-wrap--prominent .funnel-form-nav {
  flex-shrink: 0;
  margin-top: auto;
}

@media (min-width: 900px) {
  .funnel-hero-form-wrap--prominent {
    height: 56rem;
    min-height: 56rem;
  }
}

.funnel-form-section .funnel-hero-form-wrap--prominent {
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.funnel-form-head {
  text-align: center;
  margin-bottom: 1.75rem;
}

.funnel-form-logo {
  display: block;
  width: auto;
  height: 60px;
  margin: 0 auto 1.15rem;
}

.funnel-page .prev-field {
  margin-bottom: 1.35rem;
}

/* Form module: default site font (Cooper Hewitt) on every control */
.funnel-hero-form-wrap,
.funnel-form,
.prev-form {
  font-family: var(--font-sans);
  color: var(--color-black);
}

.funnel-hero-form-wrap :where(
  h1, h2, h3, h4, h5, h6,
  p, li, a, span, label, small, strong, em, b, i,
  button, input, textarea, select, option,
  .btn, .type-card-title, .type-subtitle,
  .funnel-form-step, .funnel-form-step-label,
  .prev-label, .prev-input, .prev-select, .prev-upload-text,
  .prev-hint, .prev-radio, .prev-check-label, .prev-tel-country-select,
  .prev-tel-prefix, .funnel-field-error, .prev-field-error
) {
  font-family: var(--font-sans);
}

.funnel-hero-form-wrap ::placeholder {
  font-family: var(--font-sans);
}

.funnel-hero-form-wrap .prev-input,
.funnel-hero-form-wrap .prev-select,
.funnel-hero-form-wrap textarea.prev-input,
.funnel-hero-form-wrap .prev-tel-country-select {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

.funnel-hero-form-wrap .prev-label {
  font-family: var(--font-sans);
  font-weight: var(--font-semibold);
}

/* Funnel page: force modular Cooper Hewitt on all text + CTA (match grandineticino) */
.funnel-page {
  font-family: var(--font-sans);
}

.funnel-page :where(
  h1, h2, h3, h4, h5, h6,
  p, li, a, span, label, small, strong, em, b, i,
  button, input, textarea, select, option,
  th, td, caption, dt, dd, blockquote, figcaption,
  .btn, .eyebrow, .hero-title, .hero-lead,
  .stat-value, .stat-label, .funnel-form-step-label,
  .prev-label, .prev-upload-text, .lang-code
) {
  font-family: var(--font-sans);
}

.funnel-page ::placeholder {
  font-family: var(--font-sans);
}

/* Form CTA — identico a funnel-grandineticino: Cooper Hewitt Heavy (800) */
.funnel-form-nav .btn,
.funnel-form-nav button.btn,
.funnel-form-nav a.btn {
  margin-top: 0;
  padding: 1.05rem 1.35rem;
  font-family: "Cooper Hewitt", var(--font-sans), sans-serif;
  font-size: var(--text-md);
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.funnel-form-nav .btn-primary {
  font-weight: 800;
}

.funnel-form-nav .btn-outline-dark {
  font-weight: 700;
}

/* Preload-critical: force Heavy face paint on CTA text */
.funnel-form-nav-next,
.funnel-form-nav-submit {
  font-family: "Cooper Hewitt", var(--font-sans), sans-serif;
  font-weight: 800;
}

.funnel-form-error {
  margin-bottom: 1rem;
}

/* Multi-step form wizard */
.funnel-form-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0 1.5rem;
  padding: 0;
}

.funnel-form-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.02em;
  cursor: default;
  pointer-events: none;
  user-select: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.funnel-form-step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  flex-shrink: 0;
  transition: width 0.25s ease, border-radius 0.25s ease, opacity 0.25s ease, background-color 0.25s ease;
}

.funnel-form-step.is-active {
  color: var(--color-black);
  background: var(--color-orange-subtle);
}

.funnel-form-step.is-active .funnel-form-step-dot {
  width: 18px;
  border-radius: 4px;
  opacity: 1;
  background: var(--color-orange);
}

.funnel-form-step.is-done {
  color: var(--color-black);
}

.funnel-form-step.is-done .funnel-form-step-dot {
  opacity: 1;
  background: var(--color-orange);
}

.funnel-form-step-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.25s ease;
}

.funnel-form-step.is-active .funnel-form-step-label {
  max-width: 5rem;
}

.funnel-form-step-error {
  margin: -0.75rem 0 1rem;
  min-height: 1.35rem;
  font-size: var(--text-sm);
  color: #c0392b;
  visibility: hidden;
}

.funnel-form-step-error.is-visible {
  visibility: visible;
}

.funnel-form-step.has-error .funnel-form-step-dot {
  background: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
}

.funnel-form-step.has-error .funnel-form-step-label {
  color: #c0392b;
}

.prev-input.is-invalid,
.prev-select.is-invalid,
.prev-textarea.is-invalid,
.prev-tel-wrap.is-invalid,
.prev-upload.is-invalid {
  border-color: #c0392b;
}

.prev-field--check.is-invalid .prev-check-label span {
  color: #c0392b;
}

.funnel-field-error {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
  color: #c0392b;
}

.prev-field-error {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
  color: #c0392b;
}

.funnel-form-panels {
  position: relative;
  min-height: 21rem;
}

.funnel-form-panel {
  width: 100%;
}

.funnel-form-nav-back[x-cloak],
.funnel-form-nav-submit[x-cloak] {
  display: none;
}

.funnel-form-nav {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  margin-top: 0.25rem;
  min-height: 3.15rem;
}

.funnel-form-nav-back.is-hidden,
.funnel-form-nav-next.is-hidden,
.funnel-form-nav-submit.is-hidden {
  display: none;
}

/* Layout only — visual style comes from .btn / .btn-primary / .btn-outline-dark */
.funnel-form-nav-back {
  flex: 0 0 auto;
}

.funnel-form-nav-next,
.funnel-form-nav-submit {
  flex: 1;
  width: auto;
  min-width: 0;
}

@media (max-width: 420px) {
  .funnel-form-step {
    padding: 0.35rem 0.45rem;
  }

  .funnel-form-step.is-active .funnel-form-step-label {
    max-width: 4.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .funnel-form-step,
  .funnel-form-step-dot,
  .funnel-form-step-label {
    transition: none;
  }
}

/* Estimator */

/* Hero form variants (from funnel.css) */
.funnel-hero-form-wrap--prominent {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
  border: 2px solid var(--color-orange);
}

.funnel-form-section {
  padding: 3rem 0 3.5rem;
}

/* Field spacing (funnel uses .funnel-page .prev-field) */
.funnel-form-section .prev-field,
.funnel-hero-form-wrap .prev-field {
  margin-bottom: 1.35rem;
}

