/* ==========================================================================
   DA Jules Thines — feuille de styles
   --------------------------------------------------------------------------
    1. Tokens (couleurs, typo, rayons, mouvement)
    2. Ambiances de section (.s-dark / .s-light)
    3. Base
    4. Fond animé du hero
    5. Navigation
    6. Boutons (magnétiques)
    7. Titres en cascade
    8. Hero
    9. Sections : label, titres, intro
   10. Réalisations : cartes projets inclinables
   11. Inclus : grille des avantages
   12. Offre : cartes Création / Suivi
   13. Contact + pied de page
   14. Apparition au défilement
   15. Focus clavier
   16. Responsive
   17. Animations réduites
   ========================================================================== */


/* 1. Tokens ================================================================ */
:root {
  /* Bleus — un seul bleu nuit pour tout le site : --navy-900 */
  --navy-950: #030820;
  --navy-900: #081236;   /* sections sombres ET base du dégradé du hero (fond.js colorBase) */
  --navy-850: #0d1a45;   /* surfaces sur fond sombre */
  --navy-800: #142456;   /* surfaces secondaires sur fond sombre */
  --pale:     #eef3fb;   /* sections claires */
  --pale-2:   #e0e9f7;   /* surfaces secondaires sur fond clair */
  --ink-dark: #0b1633;   /* texte sur fond clair */

  /* Accent bleu, tiré du dégradé du hero */
  --accent-on-dark:  #8fb4ff;  /* bleu ciel, sur fond sombre */
  --accent-on-light: #1f4fd6;  /* bleu roi, sur fond clair (5:1 sur --pale) */

  /* Fond du hero si WebGL est indisponible (même palette que fond.js) */
  --hero-fallback:
    radial-gradient(ellipse at 12% 22%, rgba(26, 63, 168, .55), transparent 55%),
    radial-gradient(ellipse at 88% 20%, rgba(58, 120, 224, .40), transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(10, 24, 70, .60), transparent 50%),
    radial-gradient(ellipse at 14% 82%, rgba(31, 79, 196, .45), transparent 55%),
    var(--navy-900);

  /* Typographie */
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Mise en page */
  --max: 1160px;
  --radius-card: 20px;
  --radius-plan: 22px;
  --radius-pill: 999px;

  /* Mouvement */
  --ease:     cubic-bezier(.2, .7, .2, 1);    /* transitions courantes */
  --ease-out: cubic-bezier(.16, 1, .3, 1);    /* entrées (titres, apparitions) */
  --spring:   cubic-bezier(.3, 1.6, .5, 1);   /* retour élastique des boutons */
  --title-duration: 1.15s;
  --title-stagger: 75ms;
}


/* 2. Ambiances de section ================================================== */
/* Chaque section porte .s-dark ou .s-light : les composants s'adaptent seuls. */
.s-dark {
  --bg: var(--navy-900);
  --surface: var(--navy-850);
  --surface-2: var(--navy-800);
  --ink: #eef3fb;
  --muted: rgba(214, 226, 255, 0.76);
  --faint: rgba(214, 226, 255, 0.6);
  --line: rgba(170, 195, 255, 0.14);
  --accent: var(--accent-on-dark);
  --cta-bg: #eef3fb;
  --cta-ink: var(--navy-900);
  --shadow: none;
  background: var(--bg);
  color: var(--ink);
}
.s-light {
  --bg: var(--pale);
  --surface: #ffffff;
  --surface-2: var(--pale-2);
  --ink: var(--ink-dark);
  --muted: #47536f;
  --faint: #5a6684;
  --line: rgba(11, 22, 51, 0.10);
  --accent: var(--accent-on-light);
  --cta-bg: var(--navy-900);
  --cta-ink: #eef3fb;
  --shadow: 0 1px 0 rgba(11, 22, 51, .03), 0 24px 48px -30px rgba(11, 22, 51, .30);
  background: var(--bg);
  color: var(--ink);
}


/* 3. Base ================================================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy-900);
  color: #eef3fb;
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }


/* 4. Fond animé du hero ==================================================== */
.has-fond { position: relative; isolation: isolate; overflow: hidden; }
.has-fond > canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; z-index: -1;
  pointer-events: none;
}
.hero.has-fond { background: var(--hero-fallback); }


/* 5. Navigation ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  color: #eef3fb;
  border-bottom: 1px solid transparent;
  transition: background-color .4s, border-color .4s;
}
.nav.scrolled {
  background: rgba(8, 18, 54, 0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-color: rgba(170, 195, 255, 0.12);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { font: 400 1.55rem/1 var(--serif); text-decoration: none; letter-spacing: -0.01em; }
.brand em { font-style: italic; color: var(--accent-on-dark); }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a:not(.btn) { text-decoration: none; font-size: .92rem; opacity: .75; transition: opacity .25s; }
.nav-links a:not(.btn):hover { opacity: 1; }
.nav .btn { --ink: #eef3fb; --line: rgba(214, 226, 255, .28); min-height: 44px; padding: 0 1.2rem; font-size: .88rem; }


/* 6. Boutons (magnétiques via motion.js) =================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 48px; padding: 0 1.5rem;
  border-radius: var(--radius-pill);
  font: 500 .95rem/1 var(--sans);
  text-decoration: none;
  transition: transform .6s var(--spring), background-color .3s, color .3s, border-color .3s, box-shadow .4s;
  will-change: transform;
}
.btn.magnet-on { transition: transform .18s var(--ease), background-color .3s, color .3s, border-color .3s, box-shadow .4s; }
.btn-label { display: inline-flex; align-items: center; gap: .6rem; transition: transform .6s var(--spring); pointer-events: none; }
.btn.magnet-on .btn-label { transition: transform .18s var(--ease); }
.btn-primary { background: var(--cta-bg); color: var(--cta-ink); }
.btn-primary.magnet-on { box-shadow: 0 14px 40px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.arrow { transition: transform .3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }


/* 7. Titres en cascade ===================================================== */
/* motion.js découpe chaque titre [data-split] en mots masqués. */
.split .word {
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
  padding: 0 .07em .16em;      /* évite de couper l'italique et les jambages */
  margin: 0 -.07em -.16em;
}
.split .word > span {
  display: inline-block;
  transform: translateY(118%) rotate(8deg);
  transform-origin: 0 100%;
  transition: transform var(--title-duration) var(--ease-out);
  transition-delay: calc(var(--i) * var(--title-stagger));
}
.split.in .word > span,
.reveal.in .split .word > span { transform: none; }


/* 8. Hero ================================================================== */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-content: center;
  text-align: center;
  padding: 7rem 1.25rem 5rem;
}
.eyebrow {
  margin: 0 0 1.8rem;
  font: 500 .75rem/1 var(--sans);
  letter-spacing: .32em; text-transform: uppercase;
  color: var(--faint);
}
.hero h1 {
  margin: 0 auto;
  max-width: 15ch;
  font: 400 clamp(3rem, 8.2vw, 7rem)/0.98 var(--serif);
  letter-spacing: -0.015em;
  text-shadow: 0 2px 30px rgba(3, 8, 32, .45);
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead {
  max-width: 36ch; margin: 1.8rem auto 0;
  font: 300 clamp(1.05rem, 1.7vw, 1.25rem)/1.6 var(--sans);
  color: var(--muted);
}
.hero .actions { margin-top: 2.6rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255, 255, 255, .05); }

/* séquence d'entrée : surtitre → titre (cascade) → accroche → boutons → indicateur */
.hero > .eyebrow, .hero > .lead, .hero > .actions {
  opacity: 0; transform: translateY(16px);
  animation: rise 1.2s var(--ease-out) forwards;
}
.hero > .eyebrow { animation-delay: .05s; }
.hero > .lead    { animation-delay: .75s; }
.hero > .actions { animation-delay: .9s; }
@keyframes rise { to { opacity: 1; transform: none; } }

.scroll-cue {
  position: absolute; left: 50%; bottom: 2rem;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
  font: 500 .68rem/1 var(--sans); letter-spacing: .3em; text-transform: uppercase;
  color: var(--faint); text-decoration: none;
  opacity: 0; animation: fade 1.2s 1.3s var(--ease) forwards;
}
@keyframes fade { to { opacity: 1; } }
.scroll-cue i {
  width: 1px; height: 42px;
  background: linear-gradient(to bottom, rgba(214, 226, 255, .7), transparent);
  transform-origin: top;
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }


/* 9. Sections : label, titres, intro ======================================= */
section.block { padding: clamp(4.5rem, 8vw, 6.5rem) 0; }
.label {
  display: flex; align-items: center; gap: .9rem;
  margin: 0;
  font: 500 .74rem/1 var(--sans);
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--faint);
}
.label b { color: var(--accent); font-weight: 500; }
.label::after { content: ""; flex: 0 0 48px; height: 1px; background: var(--line); }
h2 {
  margin: 1.3rem 0 0;
  font: 400 clamp(2.5rem, 6vw, 4.6rem)/1 var(--serif);
  letter-spacing: -0.012em;
}
h2 em { font-style: italic; color: var(--accent); }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }
.intro p { max-width: 38ch; margin: 0; color: var(--muted); }


/* 10. Réalisations : cartes projets inclinables ============================ */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin-top: 3rem; }
.projects > .reveal { display: flex; perspective: 1100px; } /* le wrapper porte l'apparition, la carte porte l'inclinaison */
.card {
  --rx: 0deg; --ry: 0deg; --lift: 0px; --mx: 50%; --my: 50%;
  flex: 1;
  position: relative;
  display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .8s var(--ease-out), box-shadow .6s var(--ease);
}
.card.tilting {
  --lift: -6px;
  transition: transform .15s linear, box-shadow .4s var(--ease);
  box-shadow: 0 1px 0 rgba(11, 22, 51, .03), 0 50px 80px -40px rgba(11, 22, 51, .45);
  background:
    radial-gradient(500px circle at var(--mx) var(--my), rgba(31, 79, 214, .07), transparent 45%),
    var(--surface);
}

/* aperçu du site (cadre navigateur / mobile) */
.preview {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background: var(--surface-2);
  display: grid; place-items: center;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform .8s var(--ease-out);
}
.card.tilting .preview { transform: translateZ(36px); transition: transform .3s var(--ease); }
.preview::after { /* reflet qui suit la souris */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255, 255, 255, .38), transparent 55%);
  opacity: 0;
  transition: opacity .5s var(--ease);
  pointer-events: none;
}
.card.tilting .preview::after { opacity: 1; }
.card-body, .card-foot { transform: translateZ(18px); }

.frame {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  transition: width .55s var(--ease), height .55s var(--ease), border-radius .55s var(--ease);
}
.preview.is-mobile .frame { width: 40%; height: 92%; border-radius: 18px; }
.bar { flex: 0 0 22px; display: flex; align-items: center; gap: 5px; padding: 0 10px; background: rgba(0, 0, 0, .14); }
.bar i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; }
.preview.is-mobile .bar { justify-content: center; }
.preview.is-mobile .bar i:not(:first-child) { display: none; }

/* aperçu réel : la démo dans une iframe rendue à taille d'écran puis réduite (voir apercus.js) */
.screen { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; }
.screen iframe {
  position: absolute; top: 0; left: 0;
  border: 0; transform-origin: 0 0;
  pointer-events: none;          /* l'aperçu ne capte pas la souris : l'inclinaison de la carte reste fluide */
}
.screen .loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 500 .7rem/1 var(--sans); letter-spacing: .24em; text-transform: uppercase;
  color: var(--faint); background: var(--surface-2);
  transition: opacity .5s var(--ease);
}
.screen.loaded .loading { opacity: 0; pointer-events: none; }

.card-body { padding: 0 .4rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.card h3 { margin: 0; font: 400 1.75rem/1.05 var(--serif); }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .2rem; }
.tags span { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); font-size: .76rem; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .3rem .4rem .2rem; margin-top: auto; }
.toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.toggle button {
  min-height: 34px; padding: 0 .85rem;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: 500 .78rem/1 var(--sans); cursor: pointer;
  transition: background-color .3s, color .3s;
}
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.open { font-size: .82rem; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.open:hover { color: var(--accent); }


/* 11. Inclus : grille des avantages ======================================== */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; margin-top: 3.2rem;
  border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden;
  background: var(--line);            /* les 1px d'écart dessinent les séparateurs */
}
.feature { padding: 2.2rem 2rem 2.4rem; background: var(--bg); transition: background-color .4s; }
.feature:hover { background: var(--surface); }
.feature svg { width: 26px; height: 26px; stroke: var(--accent); }
.feature h3 { margin: 1.3rem 0 .5rem; font: 400 1.5rem/1.1 var(--serif); }
.feature p { margin: 0; color: var(--muted); font-size: .94rem; }


/* 12. Offre : cartes Création / Suivi ====================================== */
.offer { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.4rem; margin-top: 3.2rem; align-items: stretch; }
.plan {
  padding: clamp(1.8rem, 4vw, 2.8rem);
  border-radius: var(--radius-plan);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1.4rem;
}
.plan.s-dark { border-color: transparent; box-shadow: 0 30px 60px -36px rgba(8, 18, 54, .7); } /* offre principale */
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.plan h3 { margin: 0; font: 400 2.3rem/1 var(--serif); }
.pill { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); font: 500 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.plan p { margin: 0; color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.checks li { display: flex; gap: .8rem; align-items: flex-start; }
.checks svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: .2rem; stroke: var(--accent); }
.plan .btn { align-self: flex-start; margin-top: auto; }


/* 13. Contact + pied de page =============================================== */
.contact { text-align: center; }
.contact .label { justify-content: center; }
.contact .label::before { content: ""; flex: 0 0 48px; height: 1px; background: var(--line); }
.contact h2 { font-size: clamp(2.8rem, 8vw, 6rem); }
.contact .btn { margin-top: 2.6rem; }

footer .foot {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.8rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--faint); font-size: .85rem;
}
footer a { color: var(--faint); text-decoration: none; }
footer a:hover { color: var(--ink); }


/* 14. Apparition au défilement (classe .in ajoutée par motion.js) ========== */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1.1s var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .1s; }
.reveal.d2 { transition-delay: .2s; }


/* 15. Focus clavier ======================================================== */
:focus-visible { outline: 2px solid var(--accent, var(--accent-on-dark)); outline-offset: 3px; border-radius: 6px; }
.btn:focus-visible { border-radius: var(--radius-pill); }


/* 16. Responsive =========================================================== */
@media (max-width: 960px) {
  .projects, .offer { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .nav-links .hide-sm { display: none; }
  .features { grid-template-columns: 1fr; }
  .scroll-cue { display: none; }
  .eyebrow { letter-spacing: .2em; }
}


/* 17. Animations réduites ================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero > *, .scroll-cue, .scroll-cue i { animation: none !important; opacity: 1 !important; }
  .hero > .eyebrow, .hero > .lead, .hero > .actions { transform: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .split .word > span { transform: none; transition: none; }
}
