/* Famille Doucet : une colonne calme, couleurs nuit et aube du logo, lisible par toute la famille */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Thème sombre (par défaut) */
:root {
  color-scheme: dark light;

  --bg: #012742;
  --surface: #0a3456;
  --ink: #f2f5f8;
  --muted: #b4c7d9;
  --accent: #f3c969;
  --on-accent: #012742;
  --link-hover: #f3c969;
  --focus: #f3c969;
  --field-bg: #f2f5f8;
  --field-ink: #012742;
  --field-border: #f2f5f8;
  --error: #ffb4a8;
  --success: #a8e6b8;
  --etoile: #f3c969;
  --bg-aube: #1d3557;

  --step-small: clamp(0.9375rem, 0.92rem + 0.1vw, 1rem);
  --step-body: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
  --step-lead: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  --step-head: clamp(2.5rem, 1.2rem + 4.4vw, 5rem);
  --step-nom: clamp(2.75rem, 1rem + 7vw, 6.875rem);

  --margin: clamp(20px, 3vw, 32px);
  --column: 42rem;
  --column-large: 60rem;
  --button-width: 16rem;
}

/* Thème clair, suivi automatiquement depuis le réglage de l'appareil */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fa;
    --surface: #e3ebf2;
    --ink: #012742;
    --muted: #3a5670;
    --accent: #f3c969;
    --on-accent: #012742;
    --link-hover: #7a4a00;
    --focus: #0b5cad;
    --field-bg: #ffffff;
    --field-ink: #012742;
    --field-border: #5f7a92;
    --error: #b3261e;
    --success: #1d6b33;
    --etoile: #a86d00;
    --bg-aube: #fbf2e4;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: var(--step-body);
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
p,
ul,
ol {
  margin: 0;
}

p,
li {
  text-wrap: pretty;
  overflow-wrap: break-word;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-underline-offset: 3px;
  transition: color 180ms ease-out;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Lien d'évitement : invisible jusqu'au premier Tab */
.evitement {
  position: absolute;
  top: 8px;
  left: var(--margin);
  z-index: 10;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  transform: translateY(-200%);
}

.evitement:focus {
  transform: none;
}

/* Texte lu par les lecteurs d'écran seulement */
.lecteur {
  position: absolute;
  width: 1px;
  height: 1px; /* taste-skill-ignore : texte masqué, pas un filet */
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main:focus {
  outline: none;
}

/* Barre du haut : nom à gauche, contact à droite, mêmes marges */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--margin);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  text-decoration: none;
}

.wordmark img {
  border-radius: 8px;
}

.bar-link {
  font-weight: 700;
}

/* Colonne */

.column {
  max-width: calc(var(--column) + 2 * var(--margin));
  margin: 0 auto;
  padding: 0 var(--margin);
}

.column-large {
  max-width: calc(var(--column-large) + 2 * var(--margin));
}

.intro {
  padding-top: clamp(48px, 10vh, 112px);
}

h1 {
  font-size: var(--step-head);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro p {
  margin-top: 20px;
  font-size: var(--step-lead);
  line-height: 1.4;
  max-width: 36ch;
}

.intro h1 + p {
  margin-top: 28px;
}

/* Horizon pleine largeur : ses couleurs suivent le moment de la journée (data-moment posé par custom.js) */

:root {
  --ciel-1: #0f3556;
  --ciel-2: #5a6f8c;
  --ciel-3: #e8a961;
  --ciel-4: #f3c969;
  --colline: #2b3f5c;
  --colline-avant: #132a43;
  --fenetre: #f3c969;
  --etoiles: 0.8;
  --lune: 0;
  --soleil: 0;
}

:root[data-moment="nuit"] {
  --ciel-1: #020c1a;
  --ciel-2: #0a2440;
  --ciel-3: #12324f;
  --ciel-4: #1a3d5e;
  --colline: #0b2035;
  --colline-avant: #04111f;
  --etoiles: 1;
  --lune: 1;
}

:root[data-moment="jour"] {
  --ciel-1: #3b7fc4;
  --ciel-2: #7fb3e3;
  --ciel-3: #cfe6f7;
  --ciel-4: #eaf4fb;
  --colline: #5d8a64;
  --colline-avant: #33603f;
  --fenetre: #24452e;
  --etoiles: 0;
  --soleil: 1;
}

:root[data-moment="crepuscule"] {
  --ciel-1: #0f2a48;
  --ciel-2: #3f4f72;
  --ciel-3: #d0703c;
  --ciel-4: #e9a24a;
  --colline: #2a2f4a;
  --colline-avant: #141a2e;
  --etoiles: 0.5;
}

.horizon {
  width: 100%;
  height: clamp(150px, 22vw, 320px);
  margin-top: 64px;
}

.horizon .ciel-1 { stop-color: var(--ciel-1); }
.horizon .ciel-2 { stop-color: var(--ciel-2); }
.horizon .ciel-3 { stop-color: var(--ciel-3); }
.horizon .ciel-4 { stop-color: var(--ciel-4); }
.horizon .etoiles { fill: #cfe0f2; opacity: var(--etoiles); }
.horizon .lune { fill: #f6efd9; opacity: var(--lune); }
.horizon .soleil { fill: #fff3c4; opacity: var(--soleil); }
.horizon .colline { fill: var(--colline); }
.horizon .colline-avant { fill: var(--colline-avant); }
.horizon .fenetre { fill: var(--fenetre); }

/* Quelques étoiles scintillent à l'arrivée, moins de 5 s (au-delà il faudrait un bouton pause) */
.horizon .scintille {
  animation: scintille 2.4s ease-in-out 2 alternate;
}

@keyframes scintille {
  to {
    opacity: 0.15;
  }
}

h2 {
  font-size: var(--step-lead);
  font-weight: 700;
}

/* Services : lignes à deux extrémités, sans cadre ni filet */

.services {
  padding-top: 112px;
}

.group {
  margin-top: 40px;
  font-size: var(--step-body);
  font-weight: 400;
  color: var(--muted);
}

.etapes {
  margin-top: 12px;
  padding-left: 1.4em;
  max-width: 46ch;
}

.etapes li + li {
  margin-top: 4px;
}

.rows {
  list-style: none;
  padding: 0;
}

.row {
  display: grid;
  grid-template-columns: 32px 1fr var(--button-width);
  gap: 12px 32px;
  align-items: start;
  padding: 20px 0;
}

/* Pictogramme en constellation : traits discrets, étoiles dorées */
.pictogramme {
  width: 32px;
  height: 32px;
  color: var(--muted);
  opacity: 0.85;
}

.row h4 {
  font-size: var(--step-body);
  font-weight: 700;
}

.tech {
  margin-left: 6px;
  font-weight: 400;
  color: var(--muted);
}

.row-text p {
  margin-top: 4px;
  color: var(--muted);
  max-width: 46ch;
}

.row-text p a {
  color: var(--ink);
  white-space: nowrap;
}

.row-text p a:hover {
  color: var(--link-hover);
}

/* Tous les boutons d'accès ont la même largeur, quelle que soit la longueur du domaine */
.open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: var(--button-width);
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid transparent; /* visible en contraste élevé, où les fonds disparaissent */
  background: var(--ink);
  color: var(--bg);
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 180ms ease-out, transform 140ms ease-out;
}

.open svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.open:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.open:active,
button:active {
  transform: scale(0.97);
}

/* Contact */

.contact {
  padding-top: 144px;
}

.contact > p {
  margin-top: 12px;
  color: var(--muted);
}

.succes,
.resume-erreurs {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--surface);
  font-weight: 700;
}

.contact > .succes {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--success);
}

.maison-envoi {
  width: 64px;
  height: 48px;
  flex: none;
  color: var(--ink);
}

/* La fenêtre de la maison s'allume une fois le message parti */
.maison-envoi .fenetre-envoi {
  fill: var(--etoile);
  animation: allumage 700ms cubic-bezier(0.23, 1, 0.32, 1) 300ms both;
}

@keyframes allumage {
  from {
    fill: var(--ink);
  }
}

.resume-erreurs {
  color: var(--error);
}

.resume-erreurs ul {
  margin-top: 8px;
  padding-left: 1.2em;
  font-weight: 400;
}

.resume-erreurs a {
  color: inherit;
  font-weight: 700;
}

.contact-form {
  margin-top: 24px;
  padding: 32px;
  background: var(--surface);
}

.contact-form > .aide {
  margin: 0 0 20px;
}

.field {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  color: var(--field-ink);
  background: var(--field-bg);
  border: 2px solid var(--field-border);
  border-radius: 0;
}

[aria-invalid="true"] {
  border-color: var(--error);
}

/* Grandit avec le message (hauteur fixe de 5 lignes si le navigateur ne sait pas faire) */
textarea {
  resize: vertical;
  field-sizing: content;
  min-height: calc(5lh + 24px);
  max-height: 20lh;
}

#captcha {
  width: 6em;
}

.aide {
  margin-top: 6px;
  font-size: var(--step-small);
  color: var(--muted);
}

.erreur {
  margin-top: 6px;
  font-size: var(--step-small);
  font-weight: 700;
  color: var(--error);
}

/* Champ piège anti-robot, hors écran mais présent dans le formulaire */
.piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px; /* taste-skill-ignore : champ masqué, pas un filet */
  overflow: hidden;
}

button {
  min-height: 48px;
  padding: 12px 24px;
  font: inherit;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 180ms ease-out, transform 140ms ease-out;
}

button:hover {
  background: var(--ink);
  color: var(--bg);
}

button:disabled {
  cursor: progress;
  background: var(--accent);
  color: var(--on-accent);
  opacity: 0.75;
  transform: none;
}

.foot {
  max-width: calc(var(--column-large) + 2 * var(--margin));
  margin: 0 auto;
  padding: 120px var(--margin) 40px;
  font-size: var(--step-small);
  color: var(--muted);
}

.foot p + p {
  margin-top: 12px;
}

.foot-nom {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.5vw, 32px);
  font-size: var(--step-nom);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.foot-nom img {
  width: clamp(56px, 8vw, 112px);
  height: auto;
  border-radius: 18%;
}

/* Arrivée sur la page : titre, textes, bandeau puis services montent en cascade */

@keyframes arrivee {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes arrivee-bandeau {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

.intro > *,
.services {
  animation: arrivee 600ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

.horizon {
  animation: arrivee-bandeau 900ms cubic-bezier(0.23, 1, 0.32, 1) 210ms both;
}

.intro > :nth-child(2) { animation-delay: 70ms; }
.intro > :nth-child(3) { animation-delay: 140ms; }
.services { animation-delay: 320ms; }

/* Au défilement, la nuit passe : le fond s'éclaircit vers l'aube jusqu'au contact */
@supports (animation-timeline: scroll()) {
  body {
    animation: nuit-vers-aube linear both;
    animation-timeline: scroll(root);
  }
}

@keyframes nuit-vers-aube {
  from {
    background-color: var(--bg);
  }
  to {
    background-color: var(--bg-aube);
  }
}

/* Téléphone : le bouton passe sous le texte, pleine largeur, identique pour tous */

@media (max-width: 40em) {
  .row {
    grid-template-columns: 32px 1fr;
    column-gap: 16px;
  }

  .open {
    grid-column: 2;
    width: 100%;
  }

  .horizon {
    margin-top: 48px;
  }

  .services {
    padding-top: 80px;
  }

  .contact {
    padding-top: 104px;
  }

  .contact-form {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* Les changements de couleur restent doux, seul le mouvement est retiré */
  .open,
  button {
    transition-property: background-color;
  }

  .open:active,
  button:active {
    transform: none;
  }

  /* Mouvement réduit : simple fondu, sans déplacement */
  .intro > *,
  .horizon,
  .services {
    animation-name: fondu;
    animation-duration: 300ms;
  }

  .horizon .scintille,
  body {
    animation: none;
  }

  .maison-envoi .fenetre-envoi {
    animation-duration: 1ms;
  }
}

@keyframes fondu {
  from {
    opacity: 0;
  }
}

/* Page 404 */

.introuvable {
  padding-top: clamp(48px, 12vh, 140px);
  padding-bottom: 120px;
}

.introuvable img {
  border-radius: 18%;
}

.introuvable h1 {
  margin-top: 40px;
}

.introuvable p {
  margin: 20px 0 32px;
  font-size: var(--step-lead);
  max-width: 34ch;
}

/* Formulaire et textes du contact gardent une largeur de lecture dans la colonne large */
.contact > p,
.contact > .succes,
.contact > .resume-erreurs,
.contact-form {
  max-width: var(--column);
}
