/* ============================================================
   Memoroots — styles.css
   Mobile-first, palette terreuse, mode sombre automatique.
   ============================================================ */

/* ---------- Variables : palette claire par défaut ---------- */
:root {
  /* Fonds */
  --bg: #faf6ef;            /* crème */
  --bg-alt: #f2ecdf;        /* crème plus soutenu (sections alternées) */
  --surface: #fffdf8;       /* cartes */

  /* Textes */
  --ink: #33302a;           /* brun-noir doux */
  --ink-soft: #5c564b;      /* texte secondaire */

  /* Couleurs de la marque */
  --green-deep: #2f4a3c;    /* vert profond */
  --green-deep-2: #24392e;  /* vert profond assombri (dégradés, survols) */
  --sage: #7c9082;          /* sauge */
  --bark: #6b4f3a;          /* brun bois */
  --accent: #a85a2f;        /* terracotta (contraste AA sur crème) */
  --accent-soft: #c4703f;   /* terracotta clair (survols, décors) */
  --accent-on-dark: #eec19b; /* terracotta sable, lisible sur vert profond (AA) */

  --border: #e3dbc9;
  --shadow: 0 10px 30px rgba(51, 48, 42, 0.08);

  /* Sections sombres (vision) : texte crème sur vert profond */
  --on-dark: #f5efe3;
  --on-dark-soft: #d9d2c0;

  --radius: 18px;
  --header-h: 4.25rem;

  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Nunito", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Mode sombre automatique ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #20241f;
    --bg-alt: #262b24;
    --surface: #2b312a;

    --ink: #ece5d6;
    --ink-soft: #b6afa0;

    --green-deep: #22332a;
    --green-deep-2: #1b2921;
    --sage: #8ba392;
    --bark: #b08a6c;
    --accent: #d98a57;      /* terracotta éclairci pour rester lisible */
    --accent-soft: #e29d6e;

    --border: #3a4038;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

    --on-dark: #f5efe3;
    --on-dark-soft: #cfc8b6;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.75em;
  color: var(--ink);
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
}

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

img, svg {
  max-width: 100%;
}

/* Les ancres tiennent compte du header sticky */
section[id] {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

/* Focus clavier bien visible partout */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Utilitaires de mise en page ---------- */
.container {
  width: min(100% - 2.5rem, 68rem);
  margin-inline: auto;
}

.container.narrow {
  width: min(100% - 2.5rem, 44rem);
}

.section {
  padding-block: clamp(4rem, 10vw, 7rem);
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-head {
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.section-title {
  font-size: clamp(1.75rem, 4.5vw, 2.6rem);
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.125rem;
  color: var(--ink-soft);
}

.flourish {
  display: block;
  width: 7rem;
  margin: 0 auto 2rem;
  color: var(--sage);
}

/* ---------- Lien d'évitement ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--green-deep);
  color: var(--on-dark);
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Ombre discrète une fois la page défilée (classe posée par script.js) */
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 18px rgba(51, 48, 42, 0.06);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  min-height: var(--header-h);
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--green-deep);
}

@media (prefers-color-scheme: dark) {
  .brand { color: var(--sage); }
}

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
}

/* Navigation : passe sous le logo sur mobile, en ligne sur desktop */
.site-nav {
  display: flex;
  gap: 1.4rem;
  order: 3;
  width: 100%;
  justify-content: center;
  padding-bottom: 0.35rem;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.site-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (min-width: 48rem) {
  .site-nav {
    order: 0;
    width: auto;
    padding-bottom: 0;
  }
}

/* ---------- Sélecteur de langue ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-sep {
  color: var(--border);
}

.lang-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.lang-btn:hover {
  color: var(--accent);
}

/* Langue active */
.lang-btn[aria-pressed="true"] {
  background-color: var(--green-deep);
  color: var(--on-dark);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding-block: clamp(4.5rem, 12vw, 8.5rem) clamp(9rem, 24vw, 15rem);
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, color-mix(in srgb, var(--sage) 22%, transparent), transparent 70%),
    var(--bg);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 46rem;
}

.hero-title {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 600;
  margin-bottom: 0.5em;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 38rem;
  margin-inline: auto;
}

.hero-actions {
  margin-top: 2.25rem;
}

.hero-note {
  margin-top: 1.1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* Arbre décoratif ancré en bas du hero.
   Le haut de l'arbre s'estompe (mask) pour ne pas gêner le CTA. */
.hero-tree {
  position: absolute;
  bottom: -4%;
  left: 50%;
  transform: translateX(-50%);
  width: min(34rem, 92vw);
  height: auto;
  color: var(--sage);
  opacity: 0.35;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 50%, transparent 82%);
  mask-image: linear-gradient(to top, #000 50%, transparent 82%);
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  padding: 0.95rem 2.2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.btn-primary {
  background-color: var(--green-deep);
  color: var(--on-dark);
  box-shadow: 0 6px 20px rgba(47, 74, 60, 0.3);
}

.btn-primary:hover {
  background-color: var(--green-deep-2);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(47, 74, 60, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    background-color: var(--accent);
    color: #221a12;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
  .btn-primary:hover {
    background-color: var(--accent-soft);
  }
}

/* ============================================================
   FONCTIONNALITÉS — cartes
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 40rem) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 64rem) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.1rem;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--sage) 22%, transparent);
  color: var(--green-deep);
}

@media (prefers-color-scheme: dark) {
  .card-icon { color: var(--sage); }
}

.card-icon svg {
  width: 1.8rem;
  height: 1.8rem;
}

.card-title {
  font-size: 1.2rem;
  margin-bottom: 0.4em;
}

.card-text {
  font-size: 0.96rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ============================================================
   ÉTAPES
   ============================================================ */
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  counter-reset: step;
}

@media (min-width: 48rem) {
  .steps-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }

  /* Ligne pointillée reliant les étapes sur desktop */
  .step {
    position: relative;
  }

  .step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.6rem;
    left: calc(50% + 2.6rem);
    width: calc(100% - 5.2rem);
    border-top: 2px dashed var(--border);
  }
}

.step {
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background-color: var(--bark);
  color: var(--on-dark);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.step-title {
  font-size: 1.25rem;
  margin-bottom: 0.35em;
}

.step-text {
  color: var(--ink-soft);
  font-size: 0.98rem;
  max-width: 20rem;
  margin-inline: auto;
}

/* En sombre, --bark s'éclaircit : chiffre foncé pour garder le contraste */
@media (prefers-color-scheme: dark) {
  .step-number { color: #221a12; }
}

/* ============================================================
   VISION — section sombre émotionnelle
   ============================================================ */
.vision {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--green-deep) 0%, var(--green-deep-2) 100%);
  text-align: center;
}

.vision .eyebrow {
  color: var(--accent-on-dark);
}

.vision .section-title {
  color: var(--on-dark);
}

.vision .lead {
  color: var(--on-dark-soft);
}

.vision-inner {
  position: relative;
  z-index: 1;
}

/* Racines en filigrane qui descendent du haut de la section */
.vision-roots {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(44rem, 110vw);
  color: var(--on-dark);
  opacity: 0.08;
  pointer-events: none;
}

.vision-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.8vw, 1.5rem);
  color: var(--on-dark);
  margin: 2rem 0 0.5rem;
}

.vision-soon {
  margin-top: 2.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-on-dark);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background-color: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding-top: 2.75rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

@media (min-width: 48rem) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-brand .brand-name {
  font-size: 1.25rem;
}

.footer-baseline {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.25s ease;
}

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

.footer-bottom {
  margin-top: 2rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.footer-bottom p {
  margin: 0;
}

/* ============================================================
   ANIMATIONS AU SCROLL
   Les éléments .reveal apparaissent en fondu + translation
   quand ils entrent dans le viewport (IntersectionObserver).
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* Léger décalage en cascade pour les cartes et les étapes */
.card-grid .reveal:nth-child(2),
.steps-list .reveal:nth-child(2) { transition-delay: 0.1s; }
.card-grid .reveal:nth-child(3),
.steps-list .reveal:nth-child(3) { transition-delay: 0.2s; }
.card-grid .reveal:nth-child(4) { transition-delay: 0.3s; }

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

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

  .btn,
  .card,
  .site-nav a,
  .lang-btn {
    transition: none;
  }

  .btn-primary:hover,
  .card:hover {
    transform: none;
  }
}
