/* =====================================================================
   FORMULAIRE DE CONTACT — partagé par la page contact et la modale
   « Commencer » (header, toutes les pages).
   États posés par js/contact.js : .is-error (champ), .is-sending,
   .is-sent (carte). Sans JS : le formulaire s'envoie nativement.
   ===================================================================== */
.ct-page,
.cm {
  --moss: #5f8f4e;
  --moss-deep: #2f5a35;
  --sap: #9dbd72;
  --err: #b0473b;
  --line: rgba(17, 18, 24, 0.16);
  --soft: rgba(17, 18, 24, 0.58);
  --accent: linear-gradient(110deg, var(--moss-deep), var(--moss) 45%, var(--electric));
}
.cm em {
  font-style: normal;
  background-image: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ct-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* =====================================================================
   FORMULAIRE
   ===================================================================== */
.ct-card {
  position: relative;
  padding: clamp(28px, 4vw, 64px);
  border-radius: var(--r-l);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 1px 0 rgba(17, 18, 24, 0.04),
    0 40px 80px -48px rgba(27, 50, 143, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ct-form-k {
  margin-bottom: clamp(28px, 3vw, 44px);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--soft);
}
.ct-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(26px, 2.6vw, 40px) clamp(24px, 2.6vw, 40px);
}
.ct-field {
  position: relative;
  display: grid;
  align-content: start;
}
.ct-field--full {
  grid-column: 1 / -1;
}
.ct-field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
  transition: color 0.3s;
}
.ct-opt {
  text-transform: none;
  letter-spacing: 0.04em;
  color: rgba(17, 18, 24, 0.38);
}
.ct-field input,
.ct-field textarea {
  width: 100%;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 clamp(17px, 1.3vw, 20px) / 1.5 var(--font);
  letter-spacing: -0.01em;
  outline: none;
  appearance: none;
  transition: border-color 0.3s;
}
.ct-field textarea {
  min-height: 120px;
  resize: none;
  overflow: hidden;
}
/* Grille du champ : libellé / saisie / erreur.
   Le trait de focus partage la ligne de la saisie et se pose dessous. */
.ct-field > label {
  grid-row: 1;
}
.ct-field > :is(input, textarea) {
  grid-row: 2;
  grid-column: 1;
}
.ct-field > .ct-err {
  grid-row: 3;
}
.ct-field::after {
  content: "";
  grid-row: 2;
  grid-column: 1;
  align-self: end;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
  pointer-events: none;
}
.ct-field:hover :is(input, textarea) {
  border-color: rgba(17, 18, 24, 0.32);
}
.ct-field:focus-within::after {
  transform: none;
}
.ct-field:focus-within label {
  color: var(--moss-deep);
}
.ct-field :is(input, textarea):focus-visible {
  outline: none;
}

/* erreurs */
.ct-err {
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  color: var(--err);
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.35s,
    transform 0.35s var(--ease),
    max-height 0.35s var(--ease),
    margin 0.35s var(--ease);
}
.ct-field.is-error .ct-err {
  max-height: 4em;
  margin-top: 10px;
  opacity: 1;
  transform: none;
}
.ct-field.is-error label {
  color: var(--err);
}
.ct-field.is-error :is(input, textarea) {
  border-color: var(--err);
}
.ct-field.is-error::after {
  background: var(--err);
}

/* envoi */
.ct-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-top: clamp(36px, 3.6vw, 56px);
}
.ct-note {
  font-size: 15px;
  color: var(--soft);
}
.ct-send {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  height: 60px;
  padding: 0 8px 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 600 13px var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.ct-send:hover i,
.ct-send:focus-visible i {
  transform: translateX(3px);
}
.ct-form.is-sending .ct-send {
  cursor: progress;
}
.ct-form.is-sending .ct-send i {
  animation: ctPulse 1.1s ease-in-out infinite;
}
@keyframes ctPulse {
  50% {
    opacity: 0.45;
    transform: scale(0.88);
  }
}
.ct-status:empty {
  display: none;
}
.ct-status {
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
  background: rgba(176, 71, 59, 0.07);
  border: 1px solid rgba(176, 71, 59, 0.22);
  color: #7d2f26;
}
.ct-status a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* confirmation */
.ct-done {
  display: grid;
  justify-items: start;
  padding: clamp(12px, 3vw, 48px) 0;
}
.ct-done[hidden],
.ct-form[hidden] {
  display: none;
}
.ct-done-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--moss-deep);
  color: #fff;
}
.ct-done-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
}
.ct-done-title {
  max-width: none;
  margin-top: clamp(28px, 3vw, 40px);
  font-size: clamp(36px, 4.6vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  outline: none;
}
.ct-done-text {
  max-width: 40ch;
  margin-top: 20px;
  font-size: clamp(17px, 1.3vw, 20px);
  font-weight: 300;
  color: rgba(17, 18, 24, 0.75);
}
.ct-again {
  margin-top: 36px;
  padding: 0 0 4px;
  border: 0;
  background: linear-gradient(var(--moss), var(--moss)) left bottom / 100% 1.5px
    no-repeat;
  color: var(--ink);
  font: 600 15px var(--font);
  cursor: pointer;
  transition: background-size 0.5s var(--ease);
}
.ct-again:hover,
.ct-again:focus-visible {
  background-size: 30% 1.5px;
}
/* bouton d'envoi : fond qui glisse, pastille ronde */
.ct-send::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--moss-deep);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease);
}
.ct-send:hover::before,
.ct-send:focus-visible::before {
  transform: none;
  transform-origin: left;
}
.ct-send i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--moss);
  transition: transform 0.5s var(--ease);
}
.ct-send svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: no-preference) {
  .ct-done:not([hidden]) {
    animation: ctIn 0.9s var(--ease) both;
  }
  .ct-done:not([hidden]) .ct-done-mark svg {
    animation: ctDraw 0.8s var(--ease) 0.25s both;
  }
}
@keyframes ctIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}
@keyframes ctDraw {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@media (max-width: 640px) {
  .ct-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .ct-submit {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .ct-send {
    justify-content: space-between;
  }
  .ct-note {
    text-align: center;
  }
}

/* =====================================================================
   MODALE « COMMENCER » — fenêtre centrée, ne couvre pas tout l'écran
   ===================================================================== */
html:has(.cm[open]) {
  overflow: hidden;
}
.cm {
  width: min(780px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.cm::backdrop {
  background: rgba(17, 18, 24, 0.36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cm .ct-card.cm-card {
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(28px, 4vw, 52px);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: #f7f8fd;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    0 1px 0 rgba(17, 18, 24, 0.04),
    0 50px 120px -40px rgba(17, 18, 24, 0.5);
}
.cm-head {
  padding-right: 56px;
  margin-bottom: clamp(28px, 3vw, 40px);
}
.cm-k {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--moss-deep);
}
.cm-title {
  max-width: none;
  margin-top: 14px;
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1;
  letter-spacing: -0.045em;
}
.cm-sub {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--soft);
}
.cm-sub a {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(var(--moss), var(--moss)) left bottom / 100% 1.5px
    no-repeat;
  transition: background-size 0.5s var(--ease);
}
.cm-sub a:hover,
.cm-sub a:focus-visible {
  background-size: 30% 1.5px;
}
.cm-close {
  position: absolute;
  top: clamp(18px, 2.4vw, 28px);
  right: clamp(18px, 2.4vw, 28px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  transition:
    background 0.3s,
    color 0.3s,
    border-color 0.3s,
    transform 0.5s var(--ease);
}
.cm-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.cm-close:hover,
.cm-close:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  transform: rotate(90deg);
}
/* la modale est plus compacte que la page */
.cm .ct-fields {
  gap: 26px 32px;
}
.cm .ct-field textarea {
  min-height: 96px;
}
.cm .ct-submit {
  margin-top: 36px;
}
.cm .ct-done {
  padding: 8px 0;
}
.cm .ct-done-title {
  font-size: clamp(32px, 4vw, 52px);
}

/* ouverture / fermeture */
@media (prefers-reduced-motion: no-preference) {
  .cm[open] {
    animation: cmIn 0.6s var(--ease);
  }
  .cm[open]::backdrop {
    animation: cmFade 0.4s ease;
  }
  .cm.is-closing {
    animation: cmOut 0.28s var(--ease) forwards;
  }
  .cm.is-closing::backdrop {
    animation: cmFade 0.28s ease reverse forwards;
  }
}
@keyframes cmIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
}
@keyframes cmOut {
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
@keyframes cmFade {
  from {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .cm {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
  }
  .cm .ct-card.cm-card {
    max-height: calc(100dvh - 20px);
    padding: 26px 20px 28px;
    border-radius: 24px;
  }
  .cm-head {
    padding-right: 48px;
  }
  .cm .ct-fields {
    gap: 22px;
  }
}
