/* UI kit — surface styles. Page-level layout + section rhythm.
   Component visuals stay inline so each .jsx is self-contained. */

@import "colors_and_type.css";

* { box-sizing: border-box; }

/* =====================================================================
   Filmic grain (#6) — subtle paper-like texture over the whole page.
   Fixed overlay, very low opacity, never intercepts pointer events.
   ===================================================================== */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("assets/grain.png");
  background-repeat: repeat;
  background-size: 128px 128px;
  opacity: 0.075;
  pointer-events: none;
  z-index: 9998;
  mix-blend-mode: multiply;
}

/* =====================================================================
   FrontierViz — animated efficient frontier (hero signature)
   Base = visible end-state. Hidden start-state + animation applied
   ONLY under no-preference, so reduced-motion / no-JS shows final.
   ===================================================================== */
.fv-pt, .fv-opt, .fv-opt-ring { transform-box: fill-box; transform-origin: center; }
.fv-curve { stroke-dasharray: 100; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .fv--armed .fv-curve    { stroke-dashoffset: 100; }
  .fv--armed .fv-pt       { opacity: 0; transform: scale(0.3); }
  .fv--armed .fv-opt,
  .fv--armed .fv-opt-ring { opacity: 0; }
  .fv--armed .fv-drop     { opacity: 0; }

  .fv--in .fv-curve { animation: fvDraw 1.7s cubic-bezier(0.65,0,0.35,1) 0.35s forwards; }
  .fv--in .fv-pt    { animation: fvPt 0.62s cubic-bezier(0.22,1,0.36,1) both; }
  .fv--in .fv-drop  { animation: fvDrop 0.6s ease 2.1s forwards; }
  .fv--in .fv-opt      { animation: fvOpt 0.5s cubic-bezier(0.34,1.56,0.64,1) 2.0s forwards; }
  .fv--in .fv-opt-ring { animation: fvOptRing 0.5s ease 2.05s forwards, fvPulse 2.8s ease-in-out 2.6s infinite; }
}
@keyframes fvDraw { to { stroke-dashoffset: 0; } }
@keyframes fvPt   { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes fvDrop { from { opacity: 0; } to { opacity: 0.55; } }
@keyframes fvOpt  { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }
@keyframes fvOptRing { from { opacity: 0; } to { opacity: 0.5; } }
@keyframes fvPulse { 0%,100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.5); opacity: 0; } }

/* --- Custom cursor accent (#5) — dot + lagging ring --- */
.cur-none, .cur-none a, .cur-none button, .cur-none input, .cur-none select, .cur-none textarea, .cur-none label { cursor: none !important; }
.cur-ring {
  position: fixed; top: 0; left: 0;
  width: 30px; height: 30px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, opacity 0.3s ease;
}
.cur-ring--active {
  width: 54px; height: 54px;
  background: rgba(255,255,255,0.22);
}
.cur-dot {
  position: fixed; top: 0; left: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  transition: opacity 0.3s ease;
}
.cur-dot--active { transform: scale(1.6); }
@media (pointer: coarse) { .cur-ring, .cur-dot { display: none; } }
@media (prefers-reduced-motion: reduce) { .cur-ring, .cur-dot { display: none; } }

/* --- Global scroll-reveal (#1) --- */
@media (prefers-reduced-motion: no-preference) {
  .r-reveal { opacity: 0; transform: translateY(22px); }
  .r-in {
    opacity: 1; transform: none;
    transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
    will-change: opacity, transform;
  }
  /* filets qui se tracent (#7) */
  .draw-x { transform: scaleX(0); transform-origin: left center; }
  .draw-x.r-in {
    transform: scaleX(1);
    transition: transform 0.9s cubic-bezier(0.65,0,0.35,1);
  }
}

/* --- Organic "blob" mark — animated metaball accent on CTA --- */
.fe-blob { transform-box: fill-box; transform-origin: center; }
.fe-blob--a { animation: feBlobA 2.6s ease-in-out infinite; }
.fe-blob--b { animation: feBlobB 3.2s ease-in-out infinite; }
.fe-blob--c { animation: feBlobC 2.15s ease-in-out infinite; }
.fe-blob--core { animation: feBlobCore 3.4s ease-in-out infinite; }
@keyframes feBlobCore { 0%,100% { transform: scale(1); }       50% { transform: scale(1.12); } }
@keyframes feBlobA    { 0%,100% { transform: translate(0,0) scale(1); }     50% { transform: translate(6px,-7px) scale(1.2); } }
@keyframes feBlobB    { 0%,100% { transform: translate(0,0) scale(1); }     50% { transform: translate(-8px,6px) scale(1.18); } }
@keyframes feBlobC    { 0%,100% { transform: translate(0,0) scale(1); }     50% { transform: translate(6px,8px) scale(1.16); } }

/* Hero blob — high-resolution coordinate space (210u) so the gooey filter
   stays crisp at large display size. Own keyframes (translate ×5.25). */
.fe-bh { transform-box: fill-box; transform-origin: center; }
.fe-bh--a { animation: feBhA 2.6s ease-in-out infinite; }
.fe-bh--b { animation: feBhB 3.2s ease-in-out infinite; }
.fe-bh--c { animation: feBhC 2.15s ease-in-out infinite; }
.fe-bh--core { animation: feBhCore 3.4s ease-in-out infinite; }
@keyframes feBhCore { 0%,100% { transform: scale(1); }       50% { transform: scale(1.12); } }
@keyframes feBhA    { 0%,100% { transform: translate(0,0) scale(1); }   50% { transform: translate(31.5px,-37px) scale(1.2); } }
@keyframes feBhB    { 0%,100% { transform: translate(0,0) scale(1); }   50% { transform: translate(-42px,31.5px) scale(1.18); } }
@keyframes feBhC    { 0%,100% { transform: translate(0,0) scale(1); }   50% { transform: translate(31.5px,42px) scale(1.16); } }
@media (prefers-reduced-motion: reduce) {
  .fe-blob--a, .fe-blob--b, .fe-blob--c, .fe-blob--core,
  .fe-bh--a, .fe-bh--b, .fe-bh--c, .fe-bh--core { animation: none; }
}

html, body { margin: 0; padding: 0; background: var(--bg-1); color: var(--fg-1); }
body { font-family: var(--font-body); font-size: var(--p-size); line-height: var(--p-line); }

/* Section primitive */
.fe-section {
  padding: 96px 64px;
}
.fe-section-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}
.fe-section--ink { background: var(--ink-1000); color: var(--bone-100); }
.fe-section--ink .fe-eyebrow { color: var(--ink-400); }
.fe-section--bone-alt { background: var(--bone-200); }
.fe-section--paper { background: var(--paper); }

/* Section divider — gold filet aligned left */
.fe-section-marker {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 56px;
}
.fe-section-marker__num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--gold-500);
}
.fe-section-marker__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.fe-section-marker__rule {
  flex: 1;
  height: 1px;
  background: var(--border-1);
}
.fe-section--ink .fe-section-marker__rule { background: rgba(245,242,234,0.12); }
.fe-section--ink .fe-section-marker__label { color: var(--ink-400); }

/* Tabular nums everywhere by default for mono */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Body paragraphs are justified for an editorial / institutional feel.
   Headings, mono blocks (data, eyebrows, disclosures) stay flush-left.
   --------------------------------------------------------------------- */
.fe-section p[style*="--font-body"],
section[id] p[style*="--font-body"] {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
/* Restore left-align for tiny meta paragraphs that shouldn't be justified */
.fe-section p[style*="font-size: 12"],
.fe-section p[style*="fontSize: 12"] {
  text-align: left;
  hyphens: manual;
}

/* Anchored sections so header nav can scrollTo */
section[id] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* Smooth, but discreet */
html { scroll-behavior: smooth; }
@media (max-width: 900px) {
  .fe-section { padding: 64px 24px; }
  .fe-section-marker { margin-bottom: 36px; }
}

/* =====================================================================
   PRINCIPE — calculation columns
   ===================================================================== */
.fe-calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(245,242,234,0.16);
  margin-top: 64px;
}
.fe-calc__col { padding: 36px; }
.fe-calc__col + .fe-calc__col { border-left: 1px solid rgba(245,242,234,0.16); }
.fe-calc__col--gold { background: rgba(176,141,87,0.05); }
.fe-calc__head { margin-bottom: 22px; }
.fe-calc__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid rgba(245,242,234,0.09);
}
.fe-calc__row:first-of-type { border-top: 0; }
.fe-calc__desc { font-family: var(--font-body); font-size: 13.5px; line-height: 1.45; color: var(--ink-300); }
.fe-calc__formula { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--ink-400); margin-top: 5px; letter-spacing: -0.01em; }
.fe-calc__val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--bone-100);
  white-space: nowrap;
  text-align: right;
}
.fe-calc__row--total { border-top: 1px solid rgba(245,242,234,0.16); margin-top: 6px; }
.fe-calc__row--total .fe-calc__desc { color: var(--bone-100); font-weight: 500; }
.fe-calc__row--total .fe-calc__val { font-size: 22px; }
.fe-calc__col--gold .fe-calc__row--total .fe-calc__val { color: var(--gold-300); font-weight: 500; }
.fe-calc__val--franchise { color: var(--gold-300); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }

/* =====================================================================
   RESPONSIVE / MOBILE
   Component visuals are inline styles; stylesheet !important overrides
   them on small screens. Collapse multi-column grids, scale display
   type, and reflow the comparison table into stacked cards.
   ===================================================================== */
@media (max-width: 820px) {

  /* --- Section rhythm --- */
  .fe-section { padding: 56px 20px !important; }
  .fe-section-marker { margin-bottom: 32px !important; }

  /* --- Collapse content grids to a single column --- */
  section[id] [style*="grid-template-columns"],
  footer [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  /* keep the hero credibility strip 2-up (overrides the collapse above) */
  #top [style*="repeat(2, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; gap: 24px 20px !important; }
  /* no single word (long titles, emails) may exceed the column */
  section h1, section h2, section h3 { overflow-wrap: anywhere; }
  section [style*="font-mono"], footer [style*="font-mono"] { overflow-wrap: anywhere; }

  /* --- Display headings scale down --- */
  section[id] h1 { font-size: clamp(34px, 9vw, 56px) !important; line-height: 1.06 !important; }
  section[id] h2 { font-size: clamp(28px, 7.5vw, 44px) !important; line-height: 1.08 !important; }
  section[id] h3 { font-size: clamp(20px, 5.5vw, 28px) !important; }

  /* --- Giant mono KPI numbers --- */
  section[id] [style*="font-size: 144px"],
  section[id] [style*="font-size: 120px"],
  section[id] [style*="font-size: 96px"] {
    font-size: clamp(56px, 16vw, 92px) !important;
  }
  section[id] [style*="font-size: 56px"] {
    font-size: clamp(40px, 11vw, 56px) !important;
  }

  /* Body copy: drop justification on narrow screens (rivers of space) */
  section[id] p[style*="--font-body"] { text-align: left !important; }

  /* --- Comparison table → stacked cards --- */
  .fe-calc { grid-template-columns: 1fr !important; }
  .fe-calc__col { padding: 28px 22px !important; }
  .fe-calc__col + .fe-calc__col { border-left: 0 !important; border-top: 1px solid rgba(245,242,234,0.16) !important; }

  .fe-cmp__head { display: none !important; }
  .fe-cmp__row {
    display: block !important;
    padding: 22px 20px !important;
  }
  .fe-cmp__label { margin-bottom: 6px !important; }
  .fe-cmp__cell {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: baseline !important;
    column-gap: 16px !important;
    text-align: right !important;
    padding: 13px 0 !important;
    border-top: 1px solid rgba(245,242,234,0.10) !important;
    font-size: 17px !important;
  }
  .fe-cmp__cell::before {
    content: attr(data-label);
    grid-column: 1;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-400);
    font-weight: 500;
    text-align: left;
    align-self: center;
  }
  .fe-cmp__v { grid-column: 2; text-align: right; white-space: nowrap; }
  .fe-cmp__note {
    grid-column: 1 / -1 !important;
    text-align: right !important;
    margin-top: 2px !important;
  }
}

@media (max-width: 480px) {
  .fe-section { padding: 48px 16px !important; }
  section[id] h1 { font-size: clamp(30px, 9vw, 40px) !important; }
}

/* Honoraires — keep the zero-strip 3-up; left-align rates when stacked */
@media (max-width: 820px) {
  #honoraires [style*="text-align: right"] { text-align: left !important; }
  #honoraires [style*="repeat(3, 1fr)"] { grid-template-columns: repeat(3, 1fr) !important; gap: 14px !important; }
}

/* Mur de logos partenaires (#mission) — colonnes responsive 5 / 3 / 2.
   Sélecteur id-scopé pour passer devant la règle globale qui force 1 colonne. */
@media (max-width: 820px) {
  #mission .exp-partners { grid-template-columns: repeat(3, 1fr) !important; gap: 0 !important; }
  #mission .exp-partner-cell { padding: 22px 16px !important; min-height: 104px !important; }
}
@media (max-width: 520px) {
  #mission .exp-partners { grid-template-columns: repeat(2, 1fr) !important; }
}
