/* ============================================================================
   UCE — Base : reset, typographie, primitives de mise en page, boutons,
   système d'apparition au scroll.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* overflow-x: clip empêche le défilement horizontal sans casser le sticky */
@supports (overflow: clip) {
  body { overflow-x: clip; }
}

img,
svg,
video,
iframe {
  display: block;
  max-width: 100%;
}

img { height: auto; }

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 450;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
  font-optical-sizing: auto;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); line-height: 1.2; letter-spacing: -0.01em; }

p { text-wrap: pretty; }

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10001;
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-s);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur-s) var(--ease);
}

.skip-link:focus { transform: none; }

/* ---------- Primitives ---------- */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--space-2xl);
}

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

/* En-tête de section : un repère discret (nom de section, en casse normale,
   précédé d'une arête de pyramide) puis le titre. */
.section-head {
  display: grid;
  gap: var(--space-m);
  max-width: 50rem;
  margin-bottom: var(--space-xl);
}

.section-head--split {
  max-width: none;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: var(--space-l) var(--space-xl);
}

.section-head--split > .section-head__title { grid-column: 1; }
.section-head--split > :not(.section-head__title) { grid-column: 2; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--brand);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.kicker::before {
  content: "";
  width: 12px;
  height: 10px;
  flex-shrink: 0;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.section-head__lead,
.lead {
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 38rem;
}

@media (max-width: 860px) {
  .section-head--split { grid-template-columns: 1fr; }
  .section-head--split > :not(.section-head__title) { grid-column: 1; }
}

/* ---------- Boutons ---------- */

.btn {
  --btn-bg: var(--brand);
  --btn-ink: var(--brand-ink);
  --btn-line: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 50px;
  padding: 0.8rem 1.5rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
  letter-spacing: 0.005em;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
  transition: transform var(--dur-m) var(--ease), box-shadow var(--dur-m) var(--ease),
    background-color var(--dur-m) var(--ease), border-color var(--dur-m) var(--ease), color var(--dur-m) var(--ease);
}

/* Remplissage qui monte depuis la base au survol */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand-hi);
  transform: translateY(101%);
  transition: transform 460ms var(--ease);
}

.btn:hover::before { transform: translateY(0); }

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -14px rgba(14, 63, 156, 0.6);
}

.btn:active { transform: translateY(0) scale(0.98); }

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform var(--dur-m) var(--ease);
}

.btn:hover svg { transform: translateX(3px); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
}

.btn--ghost::before { background: var(--brand-soft); }

.btn--ghost:hover {
  border-color: var(--brand);
  box-shadow: none;
}

.btn--light {
  --btn-bg: #FFFFFF;
  --btn-ink: var(--uce-navy);
}

.btn--light::before { background: var(--uce-ice); }

.btn--small {
  min-height: 42px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
}

.btn[disabled],
.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.85;
  transform: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand);
  font-weight: 600;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur-m) var(--ease);
}

.text-link:hover { background-size: 100% 1px; }

/* ---------- Apparition au scroll ----------
   Ne s'applique que si le JS est actif (classe .js posée dans le <head>) :
   sans JS, tout reste visible. */

.js .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.js .reveal--left { transform: translate3d(-28px, 0, 0); }
.js .reveal--scale { transform: scale(0.96); }
.js .reveal--fade { transform: none; }

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

/* Filets qui se tracent de gauche à droite */
.js .reveal-line {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1100ms var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

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

/* Transition de thème : activée quelques centaines de ms seulement, pendant
   la bascule, pour ne pas alourdir les transitions ordinaires. */
.theme-anim,
.theme-anim *,
.theme-anim *::before,
.theme-anim *::after {
  transition: background-color 450ms var(--ease), border-color 450ms var(--ease),
    color 450ms var(--ease), fill 450ms var(--ease), stroke 450ms var(--ease) !important;
}

/* Transition de langue : le contenu s'estompe, change, revient. */
[data-i18n-scope] {
  transition: opacity 220ms var(--ease), filter 220ms var(--ease);
}

.lang-switching [data-i18n-scope] {
  opacity: 0;
  filter: blur(3px);
}

body.is-loading { overflow: hidden; }

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }

  .js .reveal,
  .js .reveal-line {
    opacity: 1;
    transform: none;
  }
}
