/* Voeux TotalEnergies 2027
   Les cotes (N * var(--u)) sont en px sur la maquette desktop 1920x1080 */

/* Gotham Rounded, subset latin */
@font-face {
  font-family: "Gotham Rounded";
  src: url("assets/fonts/gotham-rounded-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Gotham Rounded";
  src: url("assets/fonts/gotham-rounded-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --red: #ff0000;
  --ink: #374649;
  --white: #fff;

  --font-text: "Gotham Rounded", "Arial Rounded MT Bold", Arial, sans-serif;

  /* 1px maquette */
  --u: min(100vw / 1920, 100svh / 1080);
  /* boutons : 14px mini */
  --u-btn: max(var(--u), 14px / 20);
  --u-logo: max(var(--u), 0.52px);
  --u-icon: max(var(--u), 0.5px);

  /* ratio mis à jour en JS avec la taille réelle de l'image */
  --bg-ratio: 3;
  --focus-x: 0.6667;
  --focus-y: 0.5;
  --title-left: 63.61%;
  --title-top: 39.31%;
  --title-width: 5.97%;

  /* la maquette est décalée de 5px vers la gauche */
  --axis-shift: -5;

  /* anim d'entrée */
  --fade-duration: 900ms;
  --fade-shapes: 200ms;
  --fade-title: 700ms;
  --fade-icons: 800ms;
  --fade-icons-step: 100ms;
  --fade-icons-duration: 250ms;
  --fade-logo: 1600ms;
  --fade-cta: 1600ms;
}

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-text);
}

/* ---------- Layout ---------- */

.card {
  position: relative;
  min-height: 100svh;
  display: grid;
  /* bandeau / espace / pictos / espace / logo + CTA / espace */
  grid-template-rows:
    auto
    minmax(calc(43 * var(--u) / 2), 43fr)
    auto
    minmax(calc(77 * var(--u) / 2), 77fr)
    auto
    minmax(max(calc(94 * var(--u) / 2), 48px), 94fr);
  overflow-x: clip;
}

.hero { grid-row: 1; }
.energies { grid-row: 3; }
.bottom { grid-row: 5; }

/* ---------- Bandeau ---------- */

.hero {
  position: relative;
  overflow: hidden;
  container-type: size;
  aspect-ratio: var(--bg-ratio);
}

/* garde le ratio de l'image, recadrage autour du point focal (mobile) */
.hero__stage {
  --stage-w: max(100cqw, 100cqh * var(--bg-ratio));
  --stage-h: max(100cqh, 100cqw / var(--bg-ratio));
  position: absolute;
  width: var(--stage-w);
  height: var(--stage-h);
  left: clamp(100cqw - var(--stage-w), 50cqw - var(--stage-w) * var(--focus-x), 0px);
  top: clamp(100cqh - var(--stage-h), 50cqh - var(--stage-h) * var(--focus-y), 0px);
}

.hero__bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__title {
  position: absolute;
  left: var(--title-left);
  top: var(--title-top);
  width: var(--title-width);
  margin: 0;
}

.hero__title img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Pictos ---------- */

.energies {
  display: flex;
  justify-content: center;
  gap: calc(24 * var(--u-icon));
  margin: 0;
  padding: 0;
  list-style: none;
  translate: calc(var(--axis-shift) * var(--u)) 0;
}

.energies img {
  display: block;
  width: calc(58 * var(--u-icon));
  height: calc(58 * var(--u-icon));
}

/* ---------- Logo + CTA ---------- */

.bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
}

.logo {
  grid-column: 1;
  justify-self: start;
  display: block;
  width: calc(213 * var(--u-logo));
  height: auto;
  margin-left: calc(95 * var(--u));
}

.cta {
  grid-column: 2;
  display: flex;
  align-items: flex-end;
  gap: calc(90 * var(--u));
  /* hauteur de l'infobulle de la maquette */
  padding-top: calc(94 * var(--u));
  margin-bottom: calc(5 * var(--u));
  translate: calc(var(--axis-shift) * var(--u)) 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(246 * var(--u-btn));
  height: calc(68 * var(--u-btn));
  padding: 0 0 calc(2 * var(--u-btn));
  border: 0;
  border-radius: 999px;
  /* inset plutôt que border (1.5px arrondi à 1px sinon) */
  box-shadow: inset 0 0 0 max(1px, 1.5 * var(--u-btn)) var(--red);
  background: var(--white);
  color: var(--red);
  font: 500 calc(20 * var(--u-btn)) / 1 var(--font-text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

/* hover souris uniquement */
@media (hover: hover) {
  .btn:hover {
    background: var(--red);
    color: var(--white);
  }
}

.btn:focus-visible {
  background: var(--red);
  color: var(--white);
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* FR/EN : même marge à droite que le logo à gauche */
.lang-box {
  position: relative;
  grid-column: 3;
  justify-self: end;
  margin: 0 calc(95 * var(--u) + 213 * var(--u-logo) / 2) calc(5 * var(--u) + 68 * var(--u-btn) / 2) 0;
  translate: 50% 50%;
}

.lang {
  display: flex;
  align-items: center;
  gap: calc(2 * var(--u-btn));
  color: var(--ink);
  font: 500 calc(17 * var(--u-btn)) / 1 var(--font-text);
}

.lang a {
  padding: 0.5em 0.35em;
  color: inherit;
  text-decoration: none;
}

.lang a:hover,
.lang a[aria-current] {
  color: var(--red);
}

.lang a[aria-current] {
  font-weight: 700;
}

.lang a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* Cookies · CGU : sous FR/EN, ferré à droite */
.legal {
  position: absolute;
  top: calc(100% + max(calc(22 * var(--u)), 10px));
  right: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  font: 500 max(calc(13 * var(--u)), 11px) / 1 var(--font-text);
  white-space: nowrap;
}

.legal a {
  padding: 0.5em 0.35em;
  color: inherit;
  text-decoration: none;
}

.legal a:hover {
  color: var(--red);
}

.legal a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* ---------- Vidéo ---------- */

.video {
  width: min(92vw, (92svh - 96px) * 16 / 9);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.video::backdrop {
  background: rgb(0 0 0 / 0.88);
}

.video__player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: contain;
}

.video__close {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font: 300 40px / 1 var(--font-text);
  cursor: pointer;
}

.video__close:focus-visible {
  outline: 2px solid var(--white);
}

/* ---------- Modale envoi des voeux ---------- */

.send {
  --title-ink: #1d2a2d;
  --muted: #5f6d70;
  --soft: #8a9699;
  --outlook: #0f6cbd;
  --ok: #13804b;
  width: min(1080px, 100vw - 32px);
  max-width: none;
  max-height: min(100dvh - 32px, 900px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 60px rgb(20 30 35 / 0.18);
  overflow: auto;
  overscroll-behavior: contain;
}

.send::backdrop {
  background: rgb(20 30 35 / 0.35);
  backdrop-filter: blur(2px);
}

.send__inner {
  --pad: clamp(20px, 4.5vw, 64px);
  position: relative;
  padding: clamp(28px, 4.5vw, 56px) var(--pad) 0;
}

.send__close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.send__close:hover { background: #f3f5f6; color: var(--ink); }
.send__close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.send svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send__close svg { width: 18px; height: 18px; stroke-width: 1.8; }

.send__head {
  margin-bottom: clamp(28px, 4vw, 52px);
  padding-right: 48px;
}

.send__eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font: 500 clamp(18px, 1.7vw, 22px) / 1 var(--font-text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.send__title {
  margin: 0;
  color: var(--title-ink);
  font: 500 clamp(22px, 2.1vw, 28px) / 1.25 var(--font-text);
}

.send__title:focus { outline: none; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px clamp(20px, 3vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.step--download { --tone: #ff5a1f; }
.step--open { --tone: #1a73ff; }
.step--write { --tone: #16b364; }
.step--send { --tone: #f5a300; }

.step__visual {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 236px);
  place-content: center;
  justify-items: center;
  gap: 8px;
  aspect-ratio: 1;
  margin-bottom: 20px;
  padding: 12px;
  border-radius: 14px;
  background: #f6f7f8;
  overflow: hidden;
}

.step__title {
  /* chiffre centré sur les lignes réelles du titre */
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  color: var(--title-ink);
  font: 500 16px / 1.35 var(--font-text);
}

.step__num {
  min-width: 0.7em;
  margin-top: -2px;
  color: var(--red);
  font: 700 30px / 1 var(--font-text);
}

.step__text {
  margin: 0;
  color: var(--muted);
  font: 500 14px / 1.6 var(--font-text);
}

/* illustrations */
.mock {
  position: relative;
  width: min(236px, 100%);
  padding: 12px;
  border: 1px solid #eceff1;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 4px 16px rgb(55 70 73 / 0.07);
  color: var(--ink);
  font: 500 11px / 1.45 var(--font-text);
  text-align: left;
}

.mock p { margin: 0; }

.mock .mock__head {
  margin-bottom: 8px;
  color: var(--title-ink);
  font-size: 11.5px;
}

.mock__filename {
  display: block;
  overflow: hidden;
  color: var(--title-ink);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* zone à cliquer */
.is-target {
  position: relative;
  box-shadow: 0 0 0 1.5px var(--red), 0 0 0 5px rgb(255 0 0 / 0.08);
}

.send .cursor {
  position: absolute;
  right: -12px;
  bottom: -14px;
  width: 18px;
  height: 18px;
  fill: var(--title-ink);
  stroke: var(--white);
  stroke-width: 1.5;
}

/* étape 1 */
.mock__alert {
  padding: 7px 8px;
  border-radius: 7px;
  background: #fdf6f1;
}

.send .mock__shield {
  float: left;
  width: 14px;
  height: 14px;
  margin: 1px 6px 0 0;
  stroke: #d9731a;
  stroke-width: 1.8;
}

.mock__buttons {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.mock__btn {
  padding: 4px 9px;
  border: 1px solid #e1e5e7;
  border-radius: 6px;
  background: var(--white);
  font-size: 10.5px;
}

.mock__btn.is-target {
  border-color: transparent;
  color: var(--title-ink);
}

.step__ok {
  position: relative;
  z-index: 1;
  order: -1;
  margin-bottom: -20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px 5px 5px;
  border-radius: 999px;
  background: #e9f6ee;
  color: var(--ok);
  font: 500 14px / 1 var(--font-text);
  box-shadow: 0 0 0 3px #f6f7f8;
}

.send .step__ok svg {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: var(--ok);
  stroke: var(--white);
  stroke-width: 3;
}

/* étape 2 */
.mock__file {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mock__doc {
  flex: none;
  display: grid;
  place-items: end center;
  width: 24px;
  height: 32px;
  padding-bottom: 5px;
  border-radius: 4px 10px 4px 4px;
  background: #eef2f6;
  color: var(--outlook);
  font: 500 7.5px / 1 var(--font-text);
}

.mock__filetext {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.mock__filetext .mock__filename { font-size: 10px; }

.mock__link {
  justify-self: start;
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--outlook);
}

.send .mock__arrow { width: 18px; height: 18px; stroke: #b3bdc0; stroke-width: 2; }

.mock__app {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid #d9e6f3;
  border-radius: 999px;
  background: var(--white);
  color: var(--outlook);
  font: 500 12px / 1 var(--font-text);
}

.mock__app svg { width: 16px; height: 16px; stroke-width: 1.8; }

/* étape 3 */
.mock .mock__field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #f0f2f3;
}

.mock__label { color: var(--soft); }
.mock__value { color: var(--title-ink); }
.mock__typing { min-height: 2.9em; }

.mock__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--tone);
}

.mock__thumb {
  position: relative;
  margin: 8px 0 6px;
  aspect-ratio: var(--bg-ratio);
  border-radius: 5px;
  overflow: hidden;
}

.mock__thumb img {
  display: block;
  width: 100%;
  height: 100%;
}

.mock__thumb img + img {
  position: absolute;
  left: var(--title-left);
  top: var(--title-top);
  width: var(--title-width);
  height: auto;
}

.step__pen {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  color: var(--tone);
  box-shadow: 0 4px 12px rgb(55 70 73 / 0.12);
}

.step__pen svg { width: 15px; height: 15px; stroke-width: 1.8; }

/* étape 4 */
.mock__chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3fb;
  color: #2a5aa8;
  font-size: 10.5px;
}

.mock__send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 7px;
  background: var(--outlook);
  color: var(--white);
  font-size: 11px;
}

.mock__send svg:not(.cursor) { width: 13px; height: 13px; stroke-width: 1.8; }

/* note + bouton */
.send__note {
  display: flex;
  align-items: center;
  margin: clamp(36px, 4.5vw, 56px) 0 0;
  gap: 14px;
  padding: 14px 18px;
  border: 1.5px solid var(--red);
  border-radius: 12px;
  color: var(--muted);
  font: 500 13px / 1.55 var(--font-text);
}

.send__note svg { flex: none; width: 30px; height: 30px; stroke: var(--ok); stroke-width: 1.7; }

.send__foot {
  position: sticky;
  bottom: 0;
  /* bouton centré, mention dessous */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 calc(-1 * var(--pad));
  padding: 28px var(--pad) clamp(24px, 3.5vw, 44px);
  background: linear-gradient(rgb(255 255 255 / 0), var(--white) 20px);
}

.btn--solid {
  gap: 10px;
  width: auto;
  height: auto;
  padding: 14px 26px;
  box-shadow: none;
  background: var(--red);
  color: var(--white);
  font-size: 15px;
  font-weight: 500;
}

.btn--solid svg { width: 17px; height: 17px; stroke-width: 2; }

@media (hover: hover) {
  .btn--solid:hover { background: #d10000; }
}

.send__hint {
  margin: 0;
  text-align: center;
  color: var(--ink);
  font: 500 12.5px / 1.4 var(--font-text);
}

/* titres sur 2 lignes pour aligner les textes */
@media (min-width: 561px) {
  .step__title { min-height: 2.7em; }
}

/* tablette et petits écrans : tout le mode d'emploi visible sans défiler */
@media (min-width: 561px) and (max-width: 1100px), (min-width: 561px) and (max-height: 900px) {
  .send { max-height: calc(100dvh - 32px); }
  .send__inner { padding-top: 32px; }
  .send__head { margin-bottom: 20px; }
  .step__visual { margin-bottom: 14px; }
  .step__title { margin-bottom: 6px; }
  .send__note { margin-top: 24px; }
  .send__foot { padding-top: 20px; padding-bottom: 24px; }
}

@media (min-width: 561px) and (max-width: 1100px) and (orientation: landscape) {
  .steps { gap: 24px; }
  .step__visual { aspect-ratio: 1; }
  .mock, .step__ok { zoom: 0.84; }
}

/* portable : écran bas, tout le mode d'emploi tient sans défiler */
@media (min-width: 900px) and (max-height: 820px) and (orientation: landscape) {
  .send { max-height: calc(100dvh - 16px); }
  .send__inner { padding-top: 22px; }
  .send__close { top: 10px; right: 10px; }
  .send__head { margin-bottom: 16px; }
  .send__title { font-size: 22px; }
  .step__visual { aspect-ratio: 3 / 2; margin-bottom: 10px; padding: 8px; }
  .mock, .step__ok { zoom: 0.7; }
  .step__title { margin-bottom: 4px; font-size: 15px; }
  .step__num { font-size: 26px; }
  .step__text { font-size: 13px; line-height: 1.45; }
  .send__note { margin-top: 16px; padding: 8px 14px; font-size: 12.5px; }
  .send__note svg { width: 24px; height: 24px; }
  .send__foot { gap: 6px; padding-top: 14px; padding-bottom: 16px; }
  .btn--solid { padding: 11px 22px; }
}

@media (min-width: 900px) and (max-height: 600px) and (orientation: landscape) {
  .send__head { margin-bottom: 12px; }
  .send__note { margin-top: 10px; }
  .send__foot { padding-top: 10px; padding-bottom: 12px; }
}

@media (min-width: 561px) and (orientation: portrait) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 24px; }
  .step__visual { aspect-ratio: 16 / 9; }
  .mock, .step__ok { zoom: 0.88; }
}

@media (max-width: 560px) {
  .send {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .steps { grid-template-columns: 1fr; gap: 36px; }
  .step__visual { aspect-ratio: 16 / 10; margin-bottom: 16px; }
  .send__note { align-items: flex-start; }
}

@media (prefers-reduced-motion: no-preference) {
  .send[open] { animation: send-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .send[open]::backdrop { animation: fade-in 0.35s ease-out; }
  .mock__caret { animation: caret 1s steps(1) infinite; }
}

@keyframes send-in {
  from { opacity: 0; transform: translateY(12px); }
}

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

/* ---------- Portrait ---------- */

@media (orientation: portrait) {
  :root {
    --p: clamp(0.85px, 100vw / 390, 1.2px);
    --u-btn: calc(0.74 * var(--p));
    --axis-shift: 0;
  }

  .card {
    grid-template-rows:
      auto
      minmax(calc(16 * var(--p)), 1fr)
      auto
      minmax(calc(20 * var(--p)), 1fr)
      auto
      minmax(calc(48 * var(--p)), 1fr);
  }

  /* 2 cases de la mosaïque autour du 2027 */
  .hero {
    aspect-ratio: 1;
  }

  .energies {
    gap: calc(17 * var(--p));
  }

  .energies img {
    width: calc(26 * var(--p));
    height: calc(26 * var(--p));
  }

  /* CTA empilés, logo à gauche et FR/EN à droite en pied */
  .bottom {
    grid-template-columns: 1fr auto;
    row-gap: calc(48 * var(--p));
    padding: 0 calc(28 * var(--p)) calc(20 * var(--p));
  }

  .cta {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: column;
    align-items: center;
    gap: calc(22 * var(--p));
    margin: 0;
    padding-top: 0;
  }

  .logo {
    grid-column: 1;
    grid-row: 2;
    width: calc(123 * var(--p));
    margin: 0;
  }

  .lang-box {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    translate: none;
  }

  .legal {
    top: calc(100% + 14 * var(--p));
    font-size: calc(12 * var(--p));
  }
}

/* tablette : 4 cases */
@media (orientation: portrait) and (min-width: 600px) {
  .hero {
    aspect-ratio: 2;
  }
}

/* ---------- Anim d'entrée ---------- */

@keyframes fade-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__title,
  .hero__bg,
  .energies li,
  .logo,
  .cta,
  .lang,
  .legal {
    animation: fade-in var(--fade-duration) ease-out both;
  }

  .hero__title { animation-delay: var(--fade-title); }
  .hero__bg { animation-delay: var(--fade-shapes); }
  .energies li {
    animation-duration: var(--fade-icons-duration);
    animation-delay: calc(var(--fade-icons) + var(--i, 0) * var(--fade-icons-step));
  }
  .logo { animation-delay: var(--fade-logo); }
  .cta,
  .lang,
  .legal { animation-delay: var(--fade-cta); }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
