@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  --cream: #FAF7F2;
  --warm: #F0E8DA;
  --terra: #C8603A;
  --terra-light: #E8896A;
  --terra-dark: #9A4228;
  --forest: #2D5016;
  --forest-light: #4A7C25;
  --ink: #1A1208;
  --muted: #7A6E62;
  --border: #E0D8CE;
  --white: #FFFFFF;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(26,18,8,0.08);
  --shadow-md: 0 4px 16px rgba(26,18,8,0.10);
  --shadow-lg: 0 8px 32px rgba(26,18,8,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  line-height: 1.25;
}

/* ─── HERO ─────────────────────────────────────────── */
.hero {
  background: var(--ink);
  color: var(--white);
  padding: 80px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(ellipse at center,
    rgba(200,96,58,0.22) 0%,
    rgba(45,80,22,0.10) 45%,
    transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--terra-light);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: 20px;
  position: relative;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.72);
  max-width: 560px;
  margin: 0 auto 36px;
  font-weight: 300;
}

/* ─── PROGRESS BAR ──────────────────────────────────── */
.progress-wrap {
  background: var(--warm);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 720px;
  margin: 0 auto 10px;
}

.progress-step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.progress-step-label span { color: var(--terra); font-weight: 600; }

.progress-bar-track {
  max-width: 720px;
  margin: 0 auto;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--terra);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ─── LAYOUT ────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-wrap {
  padding: 48px 24px;
  min-height: calc(100vh - 72px);
  display: none;
}

.section-wrap.active { display: block; }

.phase-header {
  text-align: center;
  margin-bottom: 40px;
}

.phase-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--terra);
  background: rgba(200,96,58,0.10);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.phase-header h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  margin-bottom: 12px;
}

.phase-header p {
  color: var(--muted);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto;
}

/* ─── CARD ──────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

/* ─── SLIDER DISCRET ────────────────────────────────── */
.slider-item {
  margin-bottom: 28px;
}

.slider-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
}

.slider-label .q-num {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--terra);
  flex-shrink: 0;
  margin-top: -2px;
}

.discrete-slider {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.discrete-point {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.discrete-point:hover {
  border-color: var(--terra-light);
  color: var(--terra);
}

.discrete-point.selected {
  border-color: var(--terra);
  background: var(--terra);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(200,96,58,0.30);
}

.slider-anchors {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* ─── TRICAM RANKING ────────────────────────────────── */
.tricam-question {
  margin-bottom: 32px;
}

.tricam-question h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--ink);
}

.tricam-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tricam-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s ease;
}

.tricam-option:hover { border-color: var(--terra-light); background: var(--warm); }

.tricam-option.ranked {
  border-color: var(--terra);
  background: rgba(200,96,58,0.06);
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--white);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.option-text { font-size: 14px; color: var(--ink); }

.tricam-instruction {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* ─── RADAR CHART ───────────────────────────────────── */
.radar-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

#radarCanvas {
  max-width: 280px;
  max-height: 280px;
}

/* ─── CHIPS ─────────────────────────────────────────── */
.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.chip:hover { border-color: var(--terra-light); color: var(--terra); }

.chip.selected {
  border-color: var(--terra);
  background: var(--terra);
  color: var(--white);
}

.chip.selected:hover { background: var(--terra-dark); border-color: var(--terra-dark); }

.chips-limit {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

/* ─── INPUT TEXTE ───────────────────────────────────── */
.field-group { margin-bottom: 24px; }

.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.field-group input[type="text"],
.field-group input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease;
}

.field-group input[type="text"]:focus,
.field-group input[type="email"]:focus { border-color: var(--terra); }

.field-group textarea,
.field-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.18s ease;
}

.field-group textarea:focus,
.field-group select:focus { border-color: var(--terra); }

.field-group select { min-height: unset; cursor: pointer; }

/* ─── BOUTON CTA ─────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background: var(--terra);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(200,96,58,0.30);
  margin-top: 32px;
}

.btn-primary:hover {
  background: var(--terra-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200,96,58,0.38);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--terra);
  border: 1.5px solid var(--terra);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-secondary:hover {
  background: rgba(200,96,58,0.08);
}

/* ─── BADGE ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-terra { background: rgba(200,96,58,0.14); color: var(--terra-dark); }
.badge-forest { background: rgba(45,80,22,0.14); color: var(--forest); }
.badge-ink { background: rgba(26,18,8,0.10); color: var(--ink); }

/* ─── INTELLIGENCE QUESTION ──────────────────────────── */
.mi-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mi-option {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  background: var(--white);
  transition: all 0.18s ease;
  text-align: center;
}

.mi-option:hover { border-color: var(--terra-light); background: var(--warm); }
.mi-option.selected { border-color: var(--terra); background: rgba(200,96,58,0.08); color: var(--terra); font-weight: 500; }

/* ─── RÉSULTATS ─────────────────────────────────────── */
#results-section {
  display: none;
  min-height: 100vh;
}

#results-section.active { display: block; }

.results-portrait {
  background: var(--ink);
  color: var(--white);
  padding: 60px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.results-portrait::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%,
    rgba(200,96,58,0.20) 0%,
    rgba(45,80,22,0.10) 50%,
    transparent 80%);
  pointer-events: none;
}

.results-portrait h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 20px;
  position: relative;
}

.results-portrait p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.80);
  max-width: 560px;
  margin: 0 auto;
  font-weight: 300;
  line-height: 1.7;
  position: relative;
}

.results-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.results-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--warm);
}

/* Score ring */
.formation-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.formation-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.score-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--terra);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--terra);
  flex-shrink: 0;
}

.formation-meta h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.formation-why {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.formation-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; }
.detail-value { font-weight: 500; color: var(--ink); }

.debouches-list {
  list-style: none;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.debouches-list li {
  font-size: 13px;
  padding-left: 16px;
  position: relative;
  color: var(--ink);
}

.debouches-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--terra);
}

.conseil-box {
  background: var(--warm);
  border-left: 4px solid var(--terra);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px 24px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

.financement-box {
  background: rgba(45,80,22,0.07);
  border: 1px solid rgba(45,80,22,0.20);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 32px;
}

/* ─── LOADING ────────────────────────────────────────── */
#loading-section {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  text-align: center;
  padding: 48px 24px;
}

#loading-section.active { display: flex; }

.spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--ink);
}

.loading-sub {
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
}

/* ─── ERROR ──────────────────────────────────────────── */
.error-box {
  background: #FFF5F5;
  border: 1px solid #FED7D7;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  color: #9B2C2C;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

.error-box.visible { display: block; }

.error-box .btn-primary { margin-top: 0; }

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 56px 16px 48px; }
  .section-wrap { padding: 32px 16px; }
  .card { padding: 20px; }
  .mi-options { grid-template-columns: 1fr; }
  .formation-details { grid-template-columns: 1fr; }
  .results-body { padding: 32px 16px; }
}

/* ─── MODALE ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,18,8,0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── UTILITY ────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
