/* ============================================================
   UniLangue — site vitrine. Concept : « du jour à la nuit étoilée ».
   La page s'ouvre en plein jour (thème institut, papier crème) et
   DESCEND dans la nuit (thème céleste, noir rétro-futuriste de l'app)
   à mesure qu'on scrolle — les étoiles s'allument, le ciel tombe.
   La transition des tokens est pilotée par anime.js (js/site.js).

   Aucune dépendance externe : polices self-hostées (China-safe), anime.js
   vendorisé. Les couleurs viennent des VRAIS tokens de l'app (tokens.css) :
   institut (jour) et céleste (nuit).
   ============================================================ */

/* ---------------- Polices self-hostées ---------------- */
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ChakraPetch-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ChakraPetch-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Spectral-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Spectral-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-weight: 500;
  font-style: italic;
  font-display: swap;
  src: url('../fonts/Spectral-500i.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 100 700; /* fichier variable : couvre 400/500/600 */
  font-display: swap;
  src: url('../fonts/IBMPlexSans.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-500.woff2') format('woff2');
}

/* ---------------- Tokens (JOUR par défaut — institut) ----------------
   js/site.js interpole ces variables vers les valeurs NUIT (céleste) au
   scroll. Les Han glyphs retombent sur la pile système CJK (comme l'app). */
:root {
  --bg: #f6f4ef;
  --bg-2: #efebe1;
  --ink: #1b2333;
  --ink-soft: #454e63;
  --ink-mute: #8a8f9c;
  --accent: #2e4374; /* navy jour → cyan nuit */
  --accent-2: #9a7b3e; /* or jour → rose nuit */
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #fcfbf7;
  --line: rgba(27, 35, 51, 0.12);
  --line-2: rgba(27, 35, 51, 0.22);
  --star: #2e4374;
  --shadow: 0 24px 60px -30px rgba(27, 35, 51, 0.35);
  --glow: none;

  --font-disp: 'Chakra Petch', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-serif: 'Spectral', 'Songti SC', 'STSong', Georgia, serif;
  --font-sans: 'IBM Plex Sans', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --maxw: 1200px;
  --pad: clamp(20px, 5vw, 72px);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Transition douce des couleurs héritées quand le thème bascule d'un cran. */
  transition: background-color 0.25s linear, color 0.25s linear;
}

/* ---------------- Constellation (fond fixe, plein écran) ---------------- */
#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* teinte de fond qui suit --bg (nuit = presque noir) */
  background:
    radial-gradient(120% 90% at 78% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    radial-gradient(90% 80% at 8% 108%, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 55%);
}

/* Tout le contenu passe AU-DESSUS du ciel. */
.page {
  position: relative;
  z-index: 1;
}

/* ---------------- Barre de navigation sticky ---------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  transition: background-color 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.solid {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.nav-brand :is(svg, img) {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.nav-brand b {
  color: var(--accent);
}
.nav-links {
  display: flex;
  gap: 28px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-mute);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-side {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
}
.nav-side button {
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--ink-mute);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, background-color 0.15s;
}
.nav-side button.on {
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* Barre de progression de lecture. */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 31;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}


/* Ancres de nav : ne pas masquer le haut de section sous la barre fixe. */
[id] {
  scroll-margin-top: 84px;
}

/* ---------------- Conteneurs ---------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow .num {
  color: var(--accent-2);
  margin-right: 12px;
}

/* Titres éditoriaux (serif Spectral). */
h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ---------------- Hero ---------------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px 0 80px;
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--pad); /* même rail éditorial que .wrap */
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  max-width: 16ch;
  margin: 22px 0 0;
}
.hero h1 .accent {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  margin-top: 26px;
  max-width: 46ch;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--ink-soft);
}
.hero-cta {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s, filter 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: var(--glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.btn-ghost {
  border-color: var(--line-2);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-scroll {
  margin-top: 64px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hero-scroll i {
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--accent), transparent);
  display: inline-block;
  animation: fall 1.8s ease-in-out infinite;
}
@keyframes fall {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); transform-origin: bottom; opacity: 0; }
}

/* ---------------- Sections ---------------- */
section {
  position: relative;
  padding: clamp(80px, 12vh, 160px) 0;
}
.section-head {
  max-width: 52ch;
}
.section-head h2 {
  font-size: clamp(1.9rem, 4.4vw, 3.2rem);
  margin: 18px 0 0;
}
.section-head p {
  margin-top: 20px;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

/* Révélation au scroll (anime.js pose .in). */
.reveal {
  opacity: 0;
  transform: translateY(28px);
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- Vitrine « carte logique » (colonne sticky) ---------------- */
.showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.showcase-sticky {
  position: sticky;
  top: 96px;
}
.frame {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.frame img {
  display: block;
  width: 100%;
  height: auto;
}
.frame-cap {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.showcase-steps {
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 12vh, 130px);
  padding: 40px 0;
}
.showcase-step h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.showcase-step p {
  color: var(--ink-soft);
}
.showcase-step .tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 10px;
}

/* ---------------- Grille de fonctionnalités ---------------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 56px;
}
.feature {
  padding: 30px 28px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s;
}
.feature:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.feature-ic {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  margin-bottom: 18px;
}
.feature-ic svg {
  width: 22px;
  height: 22px;
}
.feature h3 {
  font-size: 1.2rem;
  font-family: var(--font-serif);
}
.feature p {
  margin-top: 10px;
  font-size: 0.94rem;
  color: var(--ink-soft);
}

/* ---------------- Le parcours (6 étapes) ---------------- */
.journey {
  margin-top: 56px;
  display: grid;
  gap: 2px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.step {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 20px;
  padding: 26px clamp(20px, 4vw, 40px);
  background: var(--panel);
  align-items: baseline;
}
.step-n {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent);
}
.step h3 {
  font-size: 1.15rem;
  font-family: var(--font-serif);
}
.step p {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

/* ---------------- Les 4 épreuves ---------------- */
.exams {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.exam {
  padding: 24px 22px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exam .glyph {
  color: var(--accent);
  font-size: 0.95rem;
}
.exam .label {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--ink);
}
.exam .pts {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.exam-note {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

/* ---------------- Confiance ---------------- */
.trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-top: 48px;
}
.trust-item h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.trust-item p {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

/* ---------------- CTA final ---------------- */
.cta {
  text-align: center;
  padding: clamp(100px, 16vh, 200px) 0;
}
.cta h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  max-width: 18ch;
  margin: 0 auto;
}
.cta p {
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.cta .badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.cta .badge b {
  color: var(--accent);
}

/* ---------------- Footer ---------------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 40px var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.foot a {
  color: var(--ink-soft);
  text-decoration: none;
}
.foot a:hover {
  color: var(--accent);
}

/* ---------------- i18n : masquer la langue INACTIVE ----------------
   On ne masque que la langue non active (jamais de force-show) : la langue
   active garde le display de son composant. !important pour battre toute
   règle de display plus spécifique (ex. .showcase-step .tag). */
html[lang='zh'] [data-fr] {
  display: none !important;
}
html[lang='fr'] [data-zh] {
  display: none !important;
}


/* ---------------- Focus clavier visible (a11y) ---------------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-side button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
  .nav-side button {
    min-height: 44px;
    padding: 8px 13px;
    font-size: 0.72rem;
  }
  .nav-brand {
    min-height: 44px;
  }
  .showcase {
    grid-template-columns: 1fr;
  }
  .showcase-sticky {
    position: static;
  }
  .showcase-steps {
    gap: 40px;
    padding: 24px 0;
  }
  .exams {
    grid-template-columns: repeat(2, 1fr);
  }
  .step {
    grid-template-columns: 56px 1fr;
    gap: 14px;
  }
}
