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

:root {
  --bg: #faf7f2;
  --text: #2b2730;
  --muted: #6b6470;
  --placeholder: #e4ddd3;
  --accent: #7a5cc4;
  --radius: 12px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

h1,
h2 {
  line-height: 1.2;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Placeholders ---------- */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--placeholder);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Hero + animation 1 (flottement) ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 1.5rem 3rem;
  text-align: center;
}

.logo {
  width: 300px;
  height: 200px;
  max-width: 100%;
  margin-bottom: 1.5rem;
  animation: float 1s ease-in-out infinite alternate;
}

@keyframes float {
  from { transform: translateY(0); }
  to   { transform: translateY(-30px); }
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4rem);
}

/* ---------- Sections de présentation ---------- */
.feature {
  display: flex;
  align-items: center;
  gap: 3rem;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.feature--reverse .illustration {
  order: 2; /* image à droite du texte */
}

.illustration {
  flex-shrink: 0;
  width: 300px;
  height: 300px;
  max-width: 100%;
}

.feature__text h2 {
  margin-top: 0;
}

/* ---------- Animations 2 et 3 (apparition au scroll) ----------
   L'état caché ne s'applique que si html.js-reveal est présent
   (JS actif, IntersectionObserver disponible, mouvement non réduit). */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Galerie ---------- */
.gallery {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.gallery h2 {
  text-align: center;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.gallery__item {
  aspect-ratio: 1;
}

/* ---------- Newsletter ---------- */
.newsletter {
  padding-top: 4rem;
  padding-bottom: 5rem;
  text-align: center;
}

.newsletter__form {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Les blocs imbriqués exigés par Brevo n'interviennent pas dans la mise en page :
   le champ, le bouton et le message d'erreur restent des éléments flex du formulaire. */
.newsletter__form .sib-input,
.newsletter__form .form__entry {
  display: contents;
}

.newsletter__form .entry__field {
  flex: 1 1 260px;
  max-width: 360px;
}

.newsletter__form .input {
  width: 100%;
  padding: 0.8rem 1rem;
  font: inherit;
  border: 1px solid #cfc6ba;
  border-radius: var(--radius);
  background: #fff;
}

.newsletter__form .entry__error {
  order: 1; /* sous la rangée champ + bouton */
  flex-basis: 100%;
  font-size: 0.9rem;
  color: #9b2c2c;
}

.newsletter__form .entry__error:empty {
  display: none;
}

/* Champ anti-spam (pot de miel) de Brevo : jamais visible. */
.input--hidden {
  display: none !important;
}

/* Messages de Brevo : masqués par défaut, affichés par main.js. */
.sib-form-message-panel {
  display: none;
  max-width: 540px;
  margin: 0 auto 1.25rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
}

.sib-form-message-panel--success {
  color: #4a3487;
  background: #f1ecfb;
  border-color: var(--accent);
}

.sib-form-message-panel--error {
  color: #9b2c2c;
  background: #fdeeee;
  border-color: #e3a1a1;
}

.sib-form-message-panel--active {
  display: block;
}

.newsletter__form button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.newsletter__form button:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Icône de chargement pendant l'envoi (rotation : transform uniquement). */
.sib-loader-icon {
  width: 1em;
  height: 1em;
  animation: spin 0.8s linear infinite;
}

.sib-hide-loader-icon {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.newsletter__form input:focus-visible,
.newsletter__form button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Footer ---------- */
.footer {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid #e4ddd3;
}

.footer p {
  margin: 0.25rem 0;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .feature {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .feature--reverse .illustration {
    order: 0; /* sur mobile : image puis texte */
  }
}

@media (max-width: 520px) {
  .gallery__grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mouvement réduit : aucune animation ---------- */
@media (prefers-reduced-motion: reduce) {
  .logo,
  .sib-loader-icon {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
