/* Charte Comandflow : fond #110E17, accent butter #EFEDA3, DM Sans uniquement */

:root {
  --bg: #110E17;
  --bg-2: #0D0A12;
  --card: #15111D;
  --gold: #EFEDA3;
  --gold-dark: #BDBB7A;
  --light: #F5F0EB;
  --body: #D4CEC3;
  --muted: #A79F93;
  --heading: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --line-faint: rgba(239, 237, 163, 0.08);
  --line: rgba(239, 237, 163, 0.18);
  --line-strong: rgba(239, 237, 163, 0.34);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, #1B1624 0%, var(--bg) 58%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--body);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--gold); color: var(--bg); }

h1, h2, h3, h4 {
  font-family: var(--heading);
  font-style: normal;
  overflow-wrap: anywhere;
}

/* ---------- Structure ---------- */

.app {
  flex: 1;
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
}

.brand-line {
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin-bottom: 48px;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.screen.is-active { display: flex; }

.fade-in { animation: fadeUp 0.45s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Écran d’accueil ---------- */

.intro { text-align: center; }

.intro .kicker {
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.intro h1 {
  font-weight: 700;
  font-size: clamp(2.15rem, 7vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--light);
  margin-bottom: 20px;
}

.intro .lead {
  font-size: 1.1rem;
  color: var(--body);
  max-width: 34em;
  margin: 0 auto 36px;
}

.intro .note {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Boutons ---------- */

.btn-gold {
  display: inline-block;
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 0;
  padding: 18px 40px;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.btn-gold:hover { filter: brightness(1.1); transform: translateY(-1px); color: var(--bg); }
.btn-gold:active { transform: none; }
.btn-gold:focus-visible { outline: 2px solid var(--light); outline-offset: 3px; }

/* ---------- Écran question ---------- */

.quiz-head {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.progress {
  display: flex;
  gap: 4px;
  width: 100%;
}

.progress span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.3s ease;
}

.progress span.done { background: var(--gold); }
.progress span.current { background: rgba(239, 237, 163, 0.45); }

.q-counter {
  font-size: 0.76rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.q-phrase {
  font-weight: 600;
  font-size: clamp(1.55rem, 4.8vw, 2.15rem);
  line-height: 1.28;
  color: var(--light);
  min-height: 3.2em;
}

.tie-sub {
  margin-top: -12px;
  color: var(--body);
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
}

.answer {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 17px 20px;
  font-family: var(--font);
  font-size: 1.03rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--light);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.answer:hover {
  border-color: var(--gold);
  background: var(--line-faint);
}

.answer.selected {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
}

.answer:focus-visible { outline: 2px solid var(--light); outline-offset: 2px; }
.answer:disabled { cursor: default; }

.answer__key {
  flex: 0 0 auto;
  padding-top: 0.15em;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.answer.selected .answer__key { color: var(--bg); }

.answer__text { flex: 1; }

/* ---------- Écran de calcul ---------- */

.calc {
  align-items: center;
  text-align: center;
  gap: 20px;
}

.loader {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.loader span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.2s ease-in-out infinite;
}

.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.calc h2 {
  font-weight: 600;
  font-size: 1.9rem;
  text-transform: uppercase;
  color: var(--light);
}

.calc p { color: var(--muted); }

/* ---------- Écran résultats ---------- */

.results {
  justify-content: flex-start;
  padding-top: 8px;
}

.result-kicker {
  font-size: 0.76rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  margin-bottom: 18px;
}

.result-head__text {
  flex: 1;
  min-width: 0;
}

.result-profil {
  font-weight: 700;
  font-size: clamp(2.2rem, 7.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--light);
  margin-bottom: 14px;
}

.result-accroche {
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--light);
  max-width: 36em;
}

/* Carte de tarot */
.tarot-card {
  flex: 0 0 auto;
  width: 122px;
  min-height: 174px;
  padding: 16px 10px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(239, 237, 163, 0.09), transparent 58%),
    var(--card);
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 5px var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.tarot-card__num {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--gold);
}

.tarot-card__rule {
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

.tarot-card__name {
  font-family: var(--heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--light);
}

.result-carte {
  margin: 0 0 30px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.gold-separator {
  width: 64px;
  height: 2px;
  background: var(--gold);
  border: none;
  margin: 0 0 24px;
}

/* Blocs de résultat */
.result-block {
  margin: 30px 0;
}

.result-block h3 {
  margin-bottom: 12px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.result-block p {
  color: var(--body);
  margin-bottom: 14px;
  max-width: 42em;
}

.result-block p:last-child { margin-bottom: 0; }

.result-plan-block ol {
  margin: 0;
  padding-left: 1.25rem;
}

.result-plan-block li {
  color: var(--body);
  margin-bottom: 17px;
  padding-left: 3px;
  max-width: 44em;
}

.result-plan-block li:last-child { margin-bottom: 0; }

.result-plan-block li strong {
  color: var(--light);
  font-weight: 600;
}

#result-second p { margin-bottom: 0; }

/* ---------- Barres ---------- */

.bars-section { margin: 38px 0 8px; }

.bars-title {
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.bar-row { margin-bottom: 15px; }

.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 1rem;
}

.bar-label { font-size: 0.92rem; color: var(--muted); }
.bar-value { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.bar-row.is-dominant .bar-label { color: var(--light); font-weight: 600; }
.bar-row.is-dominant .bar-value { color: var(--gold); }

.bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--gold-dark);
  transition: width 0.7s ease;
}

.bar-row.is-dominant .bar-fill { background: var(--gold); }

.bars-note {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Note de fin ---------- */

.result-note {
  margin: 32px 0 0;
  padding: 18px 20px;
  border-left: 2px solid var(--gold);
  background: var(--bg-2);
  color: var(--body);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ---------- CTA final ---------- */

.results-cta {
  margin-top: 38px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.results-cta .btn-gold {
  width: 100%;
  text-align: center;
}

.cta-note {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 44em;
}

.link-secondary {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-size: 0.95rem;
}

.link-secondary:hover { color: var(--light); }

.btn-retake {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 8px;
  padding: 4px 0;
}

.btn-retake:hover { color: var(--light); }

/* ---------- Contenu SEO sous le quiz ---------- */

.seo-content {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 20px 32px;
  border-top: 1px solid var(--line);
}

.seo-content h2 {
  font-weight: 600;
  font-size: clamp(1.45rem, 4vw, 1.7rem);
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--light);
  margin: 34px 0 12px;
}

.seo-content h2:first-child { margin-top: 0; }

.seo-content h3 {
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--gold);
  margin: 22px 0 6px;
}

.seo-content p,
.seo-content li {
  color: var(--body);
  line-height: 1.7;
  margin-bottom: 10px;
}

.seo-content ol,
.seo-content ul {
  padding-left: 1.3rem;
  margin-bottom: 16px;
}

.seo-content li { margin-bottom: 8px; }

.seo-content a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.seo-content a:hover { color: var(--light); }

.seo-content .seo-cta { margin-top: 24px; }

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 24px 20px 32px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.footer a:hover { color: var(--gold); }

/* ---------- Mode debug ---------- */

#debug-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  background: var(--bg-2);
  border: 1px solid var(--gold-dark);
  border-radius: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 220px;
}

#debug-panel button {
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--body);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
}

#debug-panel button:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .app { padding-top: 24px; }

  .brand-line { margin-bottom: 36px; }

  .result-head {
    flex-direction: column;
    gap: 18px;
  }

  .tarot-card {
    width: 100%;
    min-height: 112px;
    flex-direction: row;
    gap: 16px;
    padding: 18px 16px;
  }

  .tarot-card__rule {
    width: 1px;
    height: 30px;
  }

  .result-profil { font-size: clamp(2rem, 11vw, 2.8rem); }

  .answer { padding: 15px 16px; font-size: 0.98rem; }

  .q-phrase { min-height: 0; }
}

@media (max-width: 380px) {
  .brand-line { letter-spacing: 0.24em; }

  .progress { gap: 3px; }

  .answer { gap: 10px; }
}

/* ---------- Accessibilité ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
