/* =========================================================================
   ESG Materiality Survey — Frontend
   Stile coerente con https://familyoffice.assoholding.it/
   Palette: navy (#1b2a4e) · oro (#b8863b) · crema (#f7f3ea)
   Type: EB Garamond (serif) per i titoli, sans di sistema per il testo
   ========================================================================= */

.esg-survey {
  --esg-ink: #1b2a4e;
  --esg-ink-soft: #2f4171;
  --esg-accent: #b8863b;
  --esg-accent-soft: #d4a85c;
  --esg-cream: #f7f3ea;
  --esg-cream-deep: #efe9da;
  --esg-success: #3e7a5f;
  --esg-danger: #a8443d;

  --esg-bg: #ffffff;
  --esg-text: #1a1a1a;
  --esg-text-soft: #555555;
  --esg-text-mute: #888888;
  --esg-border: #e0ddd3;
  --esg-border-strong: #c5c2b5;

  --esg-radius-sm: 6px;
  --esg-radius-md: 10px;
  --esg-radius-lg: 16px;

  --esg-font-sans:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --esg-font-serif:
    "EB Garamond", "Garamond", Georgia, "Times New Roman", serif;

  max-width: 760px;
  margin: 2rem auto;
  background: var(--esg-bg);
  padding: 2.25rem 2.5rem 2.5rem;
  border-radius: var(--esg-radius-lg);
  box-shadow: 0 2px 40px rgba(27, 42, 78, 0.08);
  font-family: var(--esg-font-sans);
  color: var(--esg-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.esg-survey *,
.esg-survey *::before,
.esg-survey *::after {
  box-sizing: border-box;
}

/* ----------------------------------------------------------------- Header */
.esg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 16px;
  border-top: 2px solid var(--esg-ink);
  border-bottom: 1px solid var(--esg-border);
  margin-bottom: 1.75rem;
}

.esg-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.esg-brand-mark {
  width: 30px;
  height: 30px;
  background: var(--esg-ink);
  color: var(--esg-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--esg-font-serif);
  font-size: 13px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 3px;
  text-transform: uppercase;
}

.esg-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.esg-brand-label {
  font-size: 12px;
  color: var(--esg-ink);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

.esg-brand-sub {
  font-size: 11px;
  color: var(--esg-text-mute);
  letter-spacing: 0.06em;
  font-style: italic;
}

.esg-meta-right strong {
  font-size: 11px;
  color: var(--esg-accent);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--esg-accent);
  border-radius: 999px;
  padding: 4px 12px;
}

/* --------------------------------------------------------------- Progress */
.esg-progress-wrap {
  margin-bottom: 2rem;
}

.esg-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--esg-text-mute);
  font-weight: 600;
  margin-bottom: 8px;
}

.esg-progress-pct {
  color: var(--esg-accent);
}

.esg-progress {
  height: 4px;
  background: var(--esg-cream-deep);
  border-radius: 999px;
  overflow: hidden;
}

.esg-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--esg-accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ------------------------------------------------------------------ Steps */
.esg-step {
  display: none;
  animation: esg-fade 0.35s ease;
}

.esg-step.is-active {
  display: block;
}

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

/* ----------------------------------------------------------------- Eyebrow */
.esg-eyebrow {
  display: inline-block;
  padding: 5px 12px;
  background: var(--esg-ink);
  color: var(--esg-cream);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 20px;
  border-radius: 2px;
}

.esg-eyebrow--cat {
  background: transparent;
  color: var(--esg-cat-color, var(--esg-accent));
  padding: 0;
  margin-bottom: 6px;
  letter-spacing: 0.14em;
}

/* -------------------------------------------------------------- Typography */
.esg-hero-title {
  font-family: var(--esg-font-serif);
  font-size: 36px;
  font-weight: 500;
  margin: 0 0 18px;
  line-height: 1.14;
  letter-spacing: -0.01em;
  color: var(--esg-ink);
}

.esg-hero-italic {
  font-style: italic;
  color: var(--esg-accent);
}

.esg-lede {
  font-size: 16px;
  color: var(--esg-text);
  margin: 0 0 1.75rem;
  line-height: 1.7;
  max-width: 620px;
}

/* -------------------------------------------------------------- Stat strip */
.esg-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.esg-stat {
  flex: 1;
  min-width: 120px;
  background: var(--esg-cream);
  border-radius: var(--esg-radius-md);
  padding: 18px 20px;
  border-left: 3px solid var(--esg-accent);
}

.esg-stat-num {
  display: block;
  font-family: var(--esg-font-serif);
  font-size: 30px;
  font-weight: 500;
  color: var(--esg-ink);
  line-height: 1;
}

.esg-stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--esg-text-mute);
  margin-top: 6px;
  font-weight: 600;
}

/* -------------------------------------------------------- Respondent cards */
.esg-choice-question {
  font-family: var(--esg-font-serif);
  font-size: 18px;
  color: var(--esg-ink);
  margin: 0 0 14px;
  font-weight: 500;
}

.esg-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 1.75rem;
}

.esg-choice-card {
  position: relative;
  cursor: pointer;
  display: block;
}

.esg-choice-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.esg-choice-inner {
  display: block;
  height: 100%;
  padding: 20px;
  background: var(--esg-bg);
  border: 1px solid var(--esg-border-strong);
  border-radius: var(--esg-radius-md);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.esg-choice-card:hover .esg-choice-inner {
  border-color: var(--esg-ink);
}

.esg-choice-card input:focus-visible + .esg-choice-inner {
  box-shadow: 0 0 0 3px rgba(27, 42, 78, 0.18);
}

.esg-choice-card input:checked + .esg-choice-inner {
  border-color: var(--esg-ink);
  background: var(--esg-cream);
  box-shadow: inset 0 0 0 1px var(--esg-ink);
}

.esg-choice-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--esg-ink);
  color: var(--esg-cream);
  font-family: var(--esg-font-serif);
  font-style: italic;
  font-weight: 600;
  border-radius: 3px;
  margin-bottom: 12px;
}

.esg-choice-title {
  display: block;
  font-family: var(--esg-font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--esg-ink);
  margin-bottom: 6px;
}

.esg-choice-desc {
  display: block;
  font-size: 13px;
  color: var(--esg-text-soft);
  line-height: 1.55;
}

.esg-locked-note {
  background: var(--esg-cream);
  border-left: 3px solid var(--esg-accent);
  border-radius: var(--esg-radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--esg-ink);
  margin-bottom: 1.75rem;
  font-weight: 500;
}

/* ---------------------------------------------------------------- Privacy */
.esg-privacy {
  font-size: 12.5px;
  color: var(--esg-text-mute);
  line-height: 1.55;
  margin: 0 0 1.5rem;
  padding-left: 16px;
  border-left: 2px solid var(--esg-border);
}

/* ------------------------------------------------------------ Section head */
.esg-section-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--esg-border);
}

.esg-section-badge {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--esg-cat-color, var(--esg-ink));
  color: #fff;
  font-family: var(--esg-font-serif);
  font-size: 26px;
  font-weight: 600;
  border-radius: var(--esg-radius-sm);
}

.esg-section-title {
  font-family: var(--esg-font-serif);
  font-size: 27px;
  font-weight: 500;
  color: var(--esg-ink);
  margin: 0 0 6px;
  line-height: 1.15;
}

.esg-section-desc {
  font-size: 14px;
  color: var(--esg-text-soft);
  margin: 0;
  line-height: 1.55;
}

/* ------------------------------------------------------------- Question list */
.esg-questions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.esg-q {
  padding: 22px 0;
  border-bottom: 1px solid var(--esg-border);
}

.esg-q:last-child {
  border-bottom: 0;
}

.esg-q.is-invalid .esg-q-num {
  background: var(--esg-danger);
  color: #fff;
  border-color: var(--esg-danger);
}

.esg-q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 16px;
}

.esg-q-num {
  flex: 0 0 auto;
  min-width: 30px;
  height: 26px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--esg-font-serif);
  font-size: 15px;
  font-style: italic;
  color: var(--esg-accent);
  border: 1px solid var(--esg-border);
  border-radius: 4px;
}

.esg-q-text {
  margin: 0;
  font-size: 16px;
  color: var(--esg-text);
  font-weight: 500;
  line-height: 1.45;
}

/* ------------------------------------------------------------- Scala 0–5 */
.esg-scale {
  display: flex;
  gap: 8px;
}

.esg-scale-opt {
  position: relative;
  flex: 1;
  cursor: pointer;
}

.esg-scale-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.esg-scale-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  background: var(--esg-bg);
  border: 1px solid var(--esg-border-strong);
  border-radius: 8px;
  font-family: var(--esg-font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--esg-ink-soft);
  transition: all 0.15s ease;
}

.esg-scale-opt:hover .esg-scale-btn {
  border-color: var(--esg-ink);
  background: var(--esg-cream);
}

.esg-scale-opt input:focus-visible + .esg-scale-btn {
  box-shadow: 0 0 0 3px rgba(27, 42, 78, 0.18);
}

.esg-scale-opt input:checked + .esg-scale-btn {
  background: var(--esg-ink);
  border-color: var(--esg-ink);
  color: var(--esg-cream);
}

.esg-scale-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--esg-text-mute);
  text-transform: uppercase;
  font-weight: 600;
}

/* ---------------------------------------------------------------- Actions */
.esg-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--esg-border);
}

.esg-actions--end {
  justify-content: flex-end;
  border-top: 0;
  padding-top: 0;
}

.esg-btn {
  font-family: var(--esg-font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 13px 28px;
  border-radius: var(--esg-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.esg-btn--primary {
  background: var(--esg-ink);
  color: var(--esg-cream);
  border-color: var(--esg-ink);
}

.esg-btn--primary:hover {
  background: var(--esg-ink-soft);
  border-color: var(--esg-ink-soft);
}

.esg-btn--primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.esg-btn--ghost {
  background: transparent;
  color: var(--esg-ink-soft);
  border-color: var(--esg-border-strong);
}

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

/* ------------------------------------------------------------ Form error */
.esg-form-error {
  margin: 1.25rem 0 0;
  padding: 12px 16px;
  background: rgba(168, 68, 61, 0.08);
  border-left: 3px solid var(--esg-danger);
  border-radius: var(--esg-radius-sm);
  color: var(--esg-danger);
  font-size: 14px;
  font-weight: 500;
}

/* -------------------------------------------------------------- Thank you */
.esg-thankyou {
  text-align: center;
  padding: 1rem 0 2rem;
  animation: esg-fade 0.4s ease;
}

.esg-thankyou-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--esg-success);
  color: #fff;
  font-size: 30px;
  border-radius: 50%;
}

.esg-thankyou .esg-hero-title {
  margin-bottom: 12px;
}

.esg-thankyou-msg {
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------- Responsive */
@media (max-width: 640px) {
  .esg-survey {
    padding: 1.5rem 1.25rem 1.75rem;
    margin: 1rem auto;
    border-radius: 12px;
  }

  .esg-hero-title {
    font-size: 28px;
  }
  .esg-section-title {
    font-size: 22px;
  }

  .esg-choice {
    grid-template-columns: 1fr;
  }

  .esg-scale {
    gap: 5px;
  }
  .esg-scale-btn {
    height: 42px;
    font-size: 16px;
  }

  .esg-section-head {
    grid-template-columns: 44px 1fr;
    gap: 14px;
  }
  .esg-section-badge {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .esg-actions {
    flex-direction: row;
  }
  .esg-btn {
    padding: 12px 18px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .esg-scale-btn {
    height: 38px;
    font-size: 14px;
  }
  .esg-scale-legend {
    font-size: 10px;
  }
}
