/* ============================================================
   1. CHARTE
   ============================================================ */
:root {
  --color-bg: #f3f3ef;
  --color-text: #111;
  --color-accent: #5fe0b5;
  --color-frame-fill: #fff;
  --color-frame-border: #4a4a4a;
  --color-links: #4a4a4a;

  --font-main: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Taille du texte courant. Tout le reste est en em, donc proportionnel. */
  --base-size: min(1.05vw, 1.85vh);
  /* Facteur de réduction appliqué par fitPage() si le contenu dépasse l'écran */
  --fit: 1;

  --column-intro: 19.5em;
  --column-offer: 51.5em;
  --column-gap: 3.5em;

  --frame-ratio: 3.4;              /* largeur / hauteur du cadre blanc */
  --frame-stroke-width: 2px;

  --rotator-scale: 1.2;            /* taille du texte animé, relative au texte courant */
  --rotator-measure: 7.5em;        /* largeur max du texte animé (provoque les retours à la ligne) */
  --fade-duration: 650ms;          /* lue aussi par script.js */

  --link-underline-height: .35em;
  --link-underline-gap: .05em;     /* espace entre le bas du lien et le trait */
  /* Trait effilé sous les liens du bas, utilisé comme masque */
  --brush-stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5.5C30 1.5 70 1.5 99 3.5C70 6.5 30 7.5 1 5.5Z'/%3E%3C/svg%3E");

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ============================================================
   2. BASE : sur grand écran, tout tient sans défiler (le mobile défile, voir section 6)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: max(2.5vh, 12px) 16px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

p { margin: 0 0 .65em; }

.accent-bar {
  position: fixed;
  inset: 0 0 auto;
  height: max(3px, .5vh);
  background: var(--color-accent);
}

/* ============================================================
   3. MISE EN PAGE : 2 colonnes + pied de page à droite
   ============================================================ */
.page {
  font-size: calc(var(--base-size) * var(--fit));
  line-height: 1.38;
  display: grid;
  grid-template-columns: var(--column-intro) var(--column-offer);
  grid-template-areas:
    "intro offer"
    ".     links";
  column-gap: var(--column-gap);
  row-gap: 1.6em;
  align-items: start;
}

/* --- Colonne gauche --- */
.intro { grid-area: intro; }

.intro__title {
  margin: 0 0 .55em;
  font-size: 1.7em;
  line-height: 1.15;
  letter-spacing: -.01em;
}

/* --- Colonne droite --- */
.offer { grid-area: offer; }

.offer__lead { margin: 0; }

.headline {
  margin: 0;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.015em;
}

.headline--xl { font-size: 4.6em; margin: .02em 0 .12em -.03em; }
.headline--lg { font-size: 3.2em; margin: .12em 0 .2em; }

.headline__amp { font-weight: 400; }
.bracket--accent { color: var(--color-accent); }

/* Lignes qui ne doivent jamais passer à la ligne : fitPage() réduit le texte si besoin */
.single-line { white-space: nowrap; }

/* Éléments propres au mobile, masqués ici et affichés en section 6 */
.mobile-break,
.divider { display: none; }

/* ============================================================
   4. PIED DE PAGE : liens soulignés au pinceau
   ============================================================ */
.links {
  grid-area: links;
  justify-self: end;
  color: var(--color-links);
}

.links__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links__list li { white-space: nowrap; }
.links__list li + li::before { content: "|"; margin: 0 .3em; }

.links a {
  position: relative;
  display: inline-block;
  color: inherit;
  text-decoration: none;
  transition: transform .25s var(--ease);
  line-height: 14px;
}

.links a:is(:hover, :focus-visible) { transform: translateY(-.2em); }

.links a::after {
  content: "";
  position: absolute;
  top: calc(100% + var(--link-underline-gap));
  left: 6%;
  right: 0;
  height: var(--link-underline-height);
  background: var(--color-accent);
  -webkit-mask: var(--brush-stroke) center / 100% 100% no-repeat;
  mask: var(--brush-stroke) center / 100% 100% no-repeat;
}

/* ============================================================
   5. CADRE BLANC ET TEXTE ANIMÉ
   ============================================================ */
.frame {
  position: relative;
  width: 97%;
  aspect-ratio: var(--frame-ratio);
  margin: .9em 0;               /* même espace au-dessus (sous le titre) et en dessous */
  background: var(--color-frame-fill);
}

/* Bordure feutre : SVG étiré au cadre, épaisseur du trait constante */
.frame__border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: var(--color-frame-border);
  stroke-width: var(--frame-stroke-width);
  stroke-linecap: round;
}

.frame__border path { vector-effect: non-scaling-stroke; }

.rotator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1em;
  font-size: calc(var(--rotator-scale) * 1em);
  font-style: italic;
  line-height: 1.15;
  text-align: center;
}

.rotator__text {
  max-width: var(--rotator-measure);
  transition: opacity var(--fade-duration) var(--ease);
}

/* Sortie : la phrase entière s'efface en fondu */
.rotator.is-out .rotator__text { opacity: 0; }

.rotator__caret {
  display: inline-block;
  width: .07em;
  height: 1em;
  margin-left: .06em;
  vertical-align: -.12em;
  background: currentColor;
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink { 50% { opacity: 0; } }

/* ============================================================
   6. ÉCRANS VERTICAUX (téléphones) : une colonne, la page défile
   fitPage() ne réduit alors le texte que pour faire tenir les .single-line
   ============================================================ */
@media (max-aspect-ratio: 4/5) {
  :root {
    --base-size: 18px;
    --frame-ratio: 2.2;
    --block-gap: 11px;
  }

  body {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding: 40px 16px 56px;
  }

  .page {
    display: flex;
    flex-direction: column;
    gap: 2em;
    align-items: stretch;  /* chaque bloc prend la largeur de la page, même avec une ligne insécable */
    width: min(100%, 34em);
    margin: 0 auto;
  }

  /* Titre calé sur la largeur de « Depuis plus de 10 ans… » (≈ 22,9 em) */
  .headline--xl { font-size: 2.35em; }
  .headline--lg { font-size: 2.5em; }
  .mobile-break { display: inline; }  /* « [raison d’être] / & [prospective] » */

  /* Même respiration verticale entre paragraphes, autour du cadre et du second titre
     (les marges verticales voisines fusionnent, l'écart reste donc constant) */
  p,
  .frame,
  .headline--lg { margin-block: var(--block-gap); }

  .frame { width: 100%; }

  /* Séparateur entre l'intro et l'offre : un « _ » menthe, comme un curseur */
  .divider {
    display: block;
    width: 1.2em;
    height: .22em;
    background: var(--color-accent);
  }

  /* Liens empilés : plus faciles à toucher, plus de séparateurs « | » */
  .links { align-self: center; }
  .links__list { flex-direction: column; align-items: center; gap: 1em; }
  .links__list li + li::before { content: none; }
}
