/* BE HOME — THE NEXT CHAPTER · Quiet Luxury, mobile-first, sans dépendance externe */

:root {
  --ivory: #f6f2ea;
  --paper: #fbf9f4;
  --white: #ffffff;
  --ink: #141312;
  --ink-soft: #4a4640;
  --muted: #6b655c;
  --bronze: #7a5b38;
  --bronze-soft: #b08d62;
  --mineral: #e5dccd;
  --line: #d8cebd;
  --danger: #8f2f22;
  --danger-bg: #f4e5e0;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --col: 680px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; }
/* Titres focalisés par programme à chaque écran (lecteurs d'écran) : pas d'encadré visuel */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
button, input, textarea { font: inherit; color: inherit; }

/* ───── Progression ───── */
.progress {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: 3px; background: rgba(20, 19, 18, 0.07);
}
.progress > span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--bronze), var(--bronze-soft));
  transform-origin: left center; transform: scaleX(0);
  transition: transform 0.7s var(--ease);
}

/* ───── En-tête ───── */
.top {
  max-width: var(--col); margin: 0 auto;
  padding: 22px 20px 6px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.brand {
  font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand::before { content: ""; width: 18px; height: 1px; background: var(--bronze); }
.meta { font-size: 12.5px; color: var(--muted); text-align: right; letter-spacing: 0.02em; }
.meta b { font-weight: 600; color: var(--ink-soft); }

/* ───── Zone principale ───── */
main {
  max-width: var(--col); margin: 0 auto;
  padding: 14px 20px 150px;
  outline: none;
}

.screen { animation: enter 0.55s var(--ease) both; }
.screen.back { animation-name: enterBack; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes enterBack { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 14px;
  font-size: 11.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--bronze); font-weight: 600;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--bronze); }

.title {
  margin: 0 0 12px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.7rem, 1.1rem + 2.6vw, 2.55rem);
  line-height: 1.16; letter-spacing: -0.012em;
  text-wrap: balance;
  outline: none;
}
.help { margin: 0 0 26px; color: var(--muted); font-size: 15px; max-width: 56ch; }
.counter { display: inline-block; margin-left: 8px; color: var(--bronze); font-weight: 600; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

/* ───── Cartes de choix ───── */
.cards { display: grid; gap: 10px; }
.opt { display: grid; gap: 8px; }

.card {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.25s var(--ease), opacity 0.25s;
}
.card:hover { border-color: var(--ink-soft); }
.card:active { transform: scale(0.992); }
.card input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.card:has(input:focus-visible) { outline: 2px solid var(--bronze); outline-offset: 3px; }
.card:has(input:checked) { background: var(--white); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.card.is-disabled { opacity: 0.42; cursor: not-allowed; }
.card.is-disabled:hover { border-color: var(--line); }

.mark {
  flex: none; position: relative;
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink-soft); background: transparent;
  transition: background 0.25s, border-color 0.25s;
}
.mark.radio { border-radius: 50%; }
.mark.check { border-radius: 4px; }
.card:has(input:checked) .mark { background: var(--ink); border-color: var(--ink); }
.mark.radio::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: var(--ivory); transform: scale(0); transition: transform 0.25s var(--ease);
}
.mark.check::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
  border: solid var(--ivory); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform 0.25s var(--ease);
}
.card:has(input:checked) .mark.radio::after { transform: scale(1); }
.card:has(input:checked) .mark.check::after { transform: rotate(45deg) scale(1); }

.label { display: grid; gap: 2px; font-size: 16.5px; line-height: 1.35; }
.label small { color: var(--muted); font-size: 13.5px; }

/* Cartes visuelles (Q12) */
.cards.visual { grid-template-columns: 1fr 1fr; gap: 12px; }
.card.v { flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; min-height: 0; }
.card.v svg { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; background: var(--mineral); }
.card.v .label { padding: 12px 14px 14px; font-size: 15px; }
.card.v .mark { position: absolute; top: 10px; right: 10px; background: rgba(251, 249, 244, 0.9); }
.card.v:has(input:checked) .mark { background: var(--ink); }

/* Champ « Autre » et notes */
.other[hidden] { display: none; }
.other { animation: enter 0.35s var(--ease) both; }

.field { display: grid; gap: 8px; margin-top: 26px; }
.field > label { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.field.first { margin-top: 0; }

.input, .textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 16px; line-height: 1.5;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.textarea { min-height: 3.6em; resize: vertical; }
.textarea.big { min-height: 170px; }
.input::placeholder, .textarea::placeholder { color: #8a8378; }
.input:focus, .textarea:focus { outline: none; border-color: var(--ink); background: var(--white); box-shadow: 0 0 0 1px var(--ink); }

/* ───── Accueil ───── */
.hero { padding-top: 6vh; }
.hero .kicker {
  font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--bronze); font-weight: 600;
  display: flex; align-items: center; gap: 14px; margin-bottom: 22px;
}
.hero .kicker::before { content: ""; width: 40px; height: 1px; background: var(--bronze); }
.hero h1 {
  margin: 0 0 14px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.5rem, 1.4rem + 6.4vw, 4.6rem);
  line-height: 0.98; letter-spacing: -0.02em;
}
.hero h1 em { display: block; font-style: italic; color: var(--bronze); }
.hero .tagline { color: var(--muted); letter-spacing: 0.02em; margin: 0 0 40px; font-size: 15px; }
.hero .hook {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.35rem, 1rem + 1.7vw, 1.9rem); line-height: 1.3;
  margin: 0 0 18px; max-width: 28ch; text-wrap: balance;
}
.hero p.lead { color: var(--ink-soft); max-width: 54ch; margin: 0 0 32px; font-size: 16.5px; }
.hero .fine { color: var(--muted); font-size: 13.5px; margin-top: 26px; max-width: 54ch; }
.rule { width: 100%; height: 1px; background: var(--line); margin: 34px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 28px;
  border-radius: 4px; font-size: 15px; font-weight: 600; letter-spacing: 0.03em;
  transition: background 0.25s, color 0.25s, opacity 0.25s, transform 0.2s var(--ease), border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn.primary { background: var(--ink); color: var(--ivory); }
.btn.primary:hover:not(:disabled) { background: #2a2825; }
.btn.primary:disabled { opacity: 0.32; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-soft); padding-inline: 14px; font-weight: 500; }
.btn.ghost:hover { color: var(--ink); }
.btn.outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn.outline:hover { background: var(--ink); color: var(--ivory); }
.btn .arrow { transition: transform 0.25s var(--ease); }
.btn:hover:not(:disabled) .arrow { transform: translateX(3px); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── Barre de navigation ───── */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  padding: 26px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ivory) 62%, rgba(246, 242, 234, 0));
  pointer-events: none;
}
.nav[hidden] { display: none; }
.nav-inner {
  max-width: calc(var(--col) - 40px); margin: 0 auto;
  display: flex; align-items: center; gap: 6px;
  pointer-events: auto;
}
.nav .spacer { flex: 1; }

/* ───── Fin : confidentialité, erreurs ───── */
.privacy {
  margin-top: 30px; padding: 16px 18px;
  border-left: 2px solid var(--bronze);
  background: rgba(229, 220, 205, 0.45);
  color: var(--ink-soft); font-size: 14px; line-height: 1.55;
}
.privacy strong { color: var(--ink); font-weight: 600; }

.alert {
  margin-top: 26px; padding: 16px 18px;
  border-left: 3px solid var(--danger); background: var(--danger-bg);
  color: #4d1a12; font-size: 15px;
}
.alert p { margin: 0 0 12px; }
.alert .actions { gap: 8px; }
.alert .btn { min-height: 46px; padding: 10px 20px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: var(--ivory);
  padding: 10px 18px; border-radius: 4px; font-size: 14px; z-index: 40;
  animation: enter 0.3s var(--ease) both;
}

/* ───── Confirmation ───── */
.done { padding-top: 7vh; }
.done .seal { width: 76px; height: 76px; margin-bottom: 26px; }
.done .seal circle { stroke: var(--bronze); stroke-width: 1.5; fill: none; stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw 1s var(--ease) 0.1s forwards; }
.done .seal path { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 50; stroke-dashoffset: 50; animation: draw 0.7s var(--ease) 0.7s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.1rem, 1.3rem + 4vw, 3.4rem); line-height: 1.05; margin: 0 0 18px; letter-spacing: -0.015em;
}
.done p { color: var(--ink-soft); max-width: 52ch; font-size: 17px; margin: 0 0 14px; }
.done p.fine { font-size: 14px; color: var(--muted); margin-top: 28px; }

/* ───── Écrans larges ───── */
@media (min-width: 760px) {
  .top { padding-top: 34px; }
  main { padding-top: 30px; }
  .card { padding: 18px 22px; }
  .cards.visual { gap: 16px; }
  .nav { padding-inline: 20px; }
}

@media (max-width: 380px) {
  .cards.visual { gap: 8px; }
  .card.v .label { padding: 10px 11px 12px; font-size: 14px; }
  .btn { padding-inline: 20px; }
}

/* ───── Mouvement réduit ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .done .seal circle, .done .seal path { stroke-dashoffset: 0; }
}

noscript .ns { max-width: var(--col); margin: 40px auto; padding: 0 20px; font-family: var(--serif); font-size: 1.2rem; }
