/* ==========================================================================
   DISCIPLINE — /contact · « Écrire à la maison »
   Préfixe « ct- ». Complète service.css et main.css.
   SOMMAIRE
    1. Mise en page principale
    2. Formulaire (groupes, rangées, compteur, pot de miel)
    3. Récapitulatif d'erreurs & état de succès
    4. Mouvement : filet des champs, envoi, message préparé
   ========================================================================== */

/* ---------- 1. MISE EN PAGE PRINCIPALE ---------- */
.ct-main { padding-top: clamp(56px, 7vw, 104px); }
.ct-layout { align-items: start; row-gap: clamp(40px, 6vw, 72px); }
.ct-formhead { display: grid; gap: var(--space-3); margin-bottom: clamp(28px, 4vw, 48px); }
.ct-formhead .title-serif { font-size: clamp(1.8125rem, 3.1vw, 2.75rem); letter-spacing: var(--brut-track-l); }
.ct-formhead .title-serif em { color: var(--accent); }

/* ---------- 2. FORMULAIRE ---------- */
.ct-form { display: grid; gap: clamp(24px, 3vw, 36px); }
.ct-group { display: grid; gap: var(--space-5); padding: 0; margin: 0; }
.ct-row { display: grid; gap: var(--space-5); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .ct-row { grid-template-columns: 1fr; } }
.ct-optional { font-weight: 400; letter-spacing: 0.08em; text-transform: none; color: var(--fg-muted); }
.ct-optional.is-recommended { color: var(--accent); font-weight: 600; }
.ct-counter { text-align: right; font-variant-numeric: tabular-nums; margin-top: -2px; }
.ct-counter:not(.is-near) { display: none; }
.ct-counter.is-full { color: var(--danger); }
.ct-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ct-form .field > label span[aria-hidden] { color: var(--accent); }
.ct-form .field > label .ct-optional { text-transform: none; }
.ct-form .select:invalid { color: var(--fg-muted); }
.ct-form .field > label.checkbox { font: 400 0.9rem/1.55 var(--font-sans); letter-spacing: 0; text-transform: none; }
.ct-form .checkbox a { color: var(--accent); }
.field.is-invalid .checkbox__box { border-color: var(--danger); }
.ct-actions { display: grid; gap: var(--space-4); justify-items: start; }
.ct-form.is-sending { pointer-events: none; }
.ct-form.is-sending .btn { opacity: 0.7; }

/* ---------- 3. RÉCAPITULATIF D'ERREURS & SUCCÈS ---------- */
.ct-summary { padding: 18px 22px; border: 1px solid var(--danger); border-left-width: 3px; background: rgba(142, 47, 47, 0.06); font-size: 0.9rem; }
.ct-summary strong { display: block; margin-bottom: 6px; font: 600 0.7rem/1.3 var(--font-caps); letter-spacing: 0.12em; text-transform: uppercase; color: var(--danger); }
.ct-summary ul { list-style: none; padding: 0; display: grid; gap: 4px; }
.ct-summary a { text-decoration: underline; text-underline-offset: 3px; }

.ct-success { box-sizing: border-box; max-width: 100%; min-width: 0; scroll-margin-top: calc(var(--header-h, 76px) + 20px); overflow-wrap: anywhere; display: grid; justify-items: center; gap: clamp(14px, 2vw, 22px); text-align: center; padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 40px); border: 1px solid var(--rule); background: var(--bg-alt); position: relative; isolation: isolate; }
.ct-success:focus-visible { outline: none; }
.ct-success__art { position: relative; width: clamp(150px, 20vw, 200px); aspect-ratio: 1; display: grid; place-items: center; }
.ct-success__art [data-svg] { position: absolute; inset: 0; }
.ct-success .title-serif { font-size: clamp(1.625rem, 2.85vw, 2.375rem); letter-spacing: var(--brut-track-l); }
.ct-success .title-serif em { color: var(--accent); }
.ct-success .lead { max-width: 34rem; }
.ct-recap { display: grid; gap: 0; width: min(100%, 30rem); margin: 6px 0 10px; text-align: left; border-top: 1px solid var(--rule); }
.ct-recap div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 480px) { .ct-recap div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; } }
.ct-success .btn { max-width: 100%; white-space: normal; text-align: center; }
.ct-success .cluster { max-width: 100%; }
.ct-draft { box-sizing: border-box; width: min(100%, 36rem); margin: 4px 0 6px; padding: 18px 20px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 0.9rem/1.65 var(--font-sans); color: var(--fg); background: var(--marble); border: 1px solid var(--rule); max-height: 20rem; overflow: auto; }
.ct-draft:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.ct-preview { padding: 14px 18px; border: 1px solid var(--rule); border-left: 4px solid var(--decor); background: var(--bg-alt); font-size: 0.875rem; line-height: 1.6; color: var(--fg-muted); max-width: 40rem; }
.ct-preview strong { margin-right: 0.6em; font: 600 0.7rem/1 var(--font-caps); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }

.ct-recap dt { font: 600 0.7rem/1.6 var(--font-caps); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); }
.ct-recap dd { margin: 0; text-align: right; font-weight: 400; overflow-wrap: anywhere; }

/* ---------- 4. MOUVEMENT ---------- */
/* Champs : le filet se pose sous le champ au focus (gauche -> droite) ; en erreur, il se pose en rouge */
.ct-control { position: relative; }
.ct-control > .input, .ct-control > .select, .ct-control > .textarea { display: block; }
.ct-control__line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent-line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); transform: scaleX(0); transform-origin: left center; transition: transform 640ms var(--ease-in-out), background-color 320ms var(--ease); pointer-events: none; }
.ct-control:focus-within .ct-control__line { transform: scaleX(1); }
.ct-form .input:focus, .ct-form .select:focus, .ct-form .textarea:focus { border-color: var(--fg); }
.field.is-invalid .ct-control__line { background: var(--danger); transform: scaleX(1); }
.ct-form .field > label { transition: color 420ms var(--ease); }
.ct-form .field:focus-within > label { color: var(--accent); }
.field.is-invalid .field__error { animation: fade-up 460ms var(--ease-out) both; }
.ct-summary:not([hidden]) { animation: fade-up 520ms var(--ease-out) both; }

/* Envoi : un filet doré parcourt le bouton le temps de la préparation */
.ct-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; background: var(--gold); transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.ct-form.is-sending .ct-progress { animation: ct-progress 700ms var(--ease-in-out) both; }
@keyframes ct-progress { to { transform: scaleX(1); } }

/* Message préparé : le laurier se bâtit (data-build), puis la coche se pose en son centre */
.ct-success__check { position: absolute; left: 34%; top: 27%; width: 32%; height: auto; fill: var(--decor); pointer-events: none; }
.ct-success.is-shown .ct-success__check { animation: ct-check 800ms var(--ease-in-out) 1000ms both; }
@keyframes ct-check { from { opacity: 0; clip-path: inset(0 100% 0 0); transform: scale(0.9); } 25% { opacity: 1; } to { opacity: 1; clip-path: inset(0 -1px 0 0); transform: none; } }
.ct-success.is-shown { animation: fade-up 640ms var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  .ct-success.is-shown .ct-success__check, .ct-success.is-shown, .ct-progress { animation: none !important; }
  .ct-form.is-sending .ct-progress { transform: scaleX(1); }
}
html.no-reveal .ct-success__check { animation: none !important; }
