/* =========================================================================
   IMPULSION — Design system
   « Un papier de recherche designé par Apple »
   Clair · rigoureux · raffiné · accent teal (science ↔ environnement)
   ========================================================================= */

:root {
  /* Palette */
  --paper:        #FBFAF7;
  --paper-2:      #F4F2EC;
  --ink:          #15181C;
  --ink-soft:     #565C64;
  --ink-faint:    #8A9097;
  --line:         #E5E1D8;
  --line-strong:  #D6D1C5;
  --accent:       #0B5E5A;   /* teal profond */
  --accent-deep:  #084945;
  --accent-soft:  #E3EFEC;
  --accent-bright:#13A594;
  --white:        #FFFFFF;

  /* Type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Espace / rythme */
  --container: 1140px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 10vw, 8rem);
  --radius: 14px;
  --radius-sm: 9px;

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Effets */
  --shadow-sm: 0 1px 2px rgba(21,24,28,.04), 0 2px 8px rgba(21,24,28,.04);
  --shadow-md: 0 4px 14px rgba(21,24,28,.06), 0 14px 40px rgba(21,24,28,.07);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
.nowrap { white-space: nowrap; }

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- Brand mark ---------- */
.brand-mark {
  display: inline-flex; align-items: center;
  color: var(--accent); flex: 0 0 auto;
}
.brand-mark svg { height: 19px; width: auto; display: block; overflow: visible; }
.brand-mark path { stroke-dasharray: 1; stroke-dashoffset: 0; }
/* Respiration d'amplitude — le « paquet d'onde » vibre doucement */
@media (prefers-reduced-motion: no-preference) {
  .brand-mark svg {
    transform-origin: center;
    animation: markPulse 3.4s var(--ease) infinite;
  }
  /* Au survol de la marque : l'impulsion se redessine */
  .nav-brand:hover .brand-mark path,
  .footer-brand:hover .brand-mark path {
    animation: markDraw .75s var(--ease);
  }
}
@keyframes markPulse {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(1.12); }
}
@keyframes markDraw {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32rem;
  letter-spacing: -.01em;
}

/* ---------- Nav ---------- */
.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.navbar.scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
}
.nav-container {
  max-width: var(--container);
  margin-inline: auto;
  padding: .95rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: .6rem; }

.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  font-size: .95rem; font-weight: 500;
  color: var(--ink-soft);
  padding: .5rem .85rem; border-radius: 100px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--paper-2); }
.nav-cta {
  color: var(--paper); background: var(--ink);
  margin-left: .4rem;
}
.nav-cta:hover { color: var(--paper); background: var(--accent); }

/* ---- Sélecteur de langue ---- */
.lang-switch {
  display: flex; align-items: center; gap: .15rem;
  margin-left: .5rem; padding-left: .65rem;
  border-left: 1px solid var(--line);
  font-size: .82rem; font-weight: 600; letter-spacing: .03em;
}
.lang-switch a, .lang-switch span {
  padding: .2rem .35rem; border-radius: 7px;
  text-transform: uppercase;
}
.lang-switch a {
  color: var(--ink-soft);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang-switch a:hover { color: var(--ink); background: var(--paper-2); }
.lang-switch [aria-current="true"] { color: var(--accent); cursor: default; }
.lang-switch .lang-sep { color: var(--line); padding: 0; }

.nav-toggle {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer;
  padding: 8px; border-radius: 8px;
}
.nav-toggle span {
  width: 24px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); font-size: .98rem; font-weight: 600;
  padding: .85rem 1.5rem; border-radius: 100px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease), background .2s var(--ease),
              border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-2px); }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding-top: clamp(8rem, 18vh, 12rem);
  padding-bottom: var(--section-y);
}
.hero-grid {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 72%);
  opacity: .55;
}
.hero-inner { position: relative; z-index: 1; max-width: 880px; }
.hero-eyebrow {
  font-size: .82rem; font-weight: 600; letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 1.6rem;
}
.hero-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.6rem, 6.4vw, 4.6rem);
  line-height: 1.04; letter-spacing: -.022em;
  text-wrap: balance;
}
.hero-title .accent { color: var(--accent); font-style: italic; font-weight: 400; }
.hero-rule {
  width: 56px; height: 3px; border-radius: 3px;
  background: var(--accent); margin: 2rem 0 1.6rem;
}
.hero-lead {
  font-size: clamp(1.18rem, 2.4vw, 1.5rem);
  color: var(--ink); font-weight: 500; max-width: 38ch;
}
.hero-skills {
  font-size: 1.02rem; color: var(--ink-soft); margin-top: .55rem;
  letter-spacing: .01em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: 2.4rem; }
.hero-trust {
  display: flex; align-items: center; gap: .6rem;
  font-size: .92rem; color: var(--ink-soft); margin-top: 2.6rem;
}
.hero-trust .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent-soft) 50%, transparent); }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-y); }
.section-alt { background: var(--paper-2); }
.section-head { max-width: 640px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-label {
  display: inline-block;
  font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}
.section-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.1; letter-spacing: -.02em;
}
.section-sub {
  margin-top: 1.1rem; font-size: 1.1rem; color: var(--ink-soft); max-width: 54ch;
}

/* ---------- Approche ---------- */
.approach-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(3, 1fr);
  position: relative;            /* repère pour la bande signal */
}
.approach-card {
  position: relative; z-index: 1;   /* au-dessus de la bande */
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.approach-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.approach-num {
  font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; color: var(--accent); font-weight: 500;
}
.approach-card h3 {
  font-family: var(--serif); font-weight: 600; font-size: 1.4rem;
  margin: .7rem 0 .7rem; letter-spacing: -.01em;
}
.approach-card p { color: var(--ink-soft); font-size: 1rem; }

/* ---------- Signal en fond de l'approche (paquet d'onde ambiant, flouté) ----------
   La bande est calée sur la rangée de cartes (.approach-grid). Les crêtes débordent
   un peu en haut/bas des cartes, et le tracé déborde de l'écran à gauche/droite. */
#approche { position: relative; overflow: hidden; }
#approche > .container { position: relative; z-index: 1; }
.signal-bg {
  position: absolute; inset: 0; z-index: 0;       /* couvre la grille des cartes */
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; overflow: visible;        /* laisse crêtes + bleed déborder */
}
.signal-bg canvas {
  width: 160vw;        /* déborde toujours de l'écran à gauche et à droite */
  height: 210%;        /* rectangle de fond plus haut (signal compensé côté JS, taille inchangée) */
  max-width: none; display: block;
  opacity: .3;
  filter: blur(5px);
  /* fond doux sur les ~14 % extrêmes → pas de trait haut/bas révélé au kick ; crêtes (~18/82 %) visibles */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
}
@media (max-width: 900px) {
  .signal-bg { display: none; }                   /* cartes empilées → on retire la bande */
}

/* ---------- Réalisations ---------- */
.work-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(2, 1fr);
}
.work-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.9rem;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.work-card.feature {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, var(--white), var(--accent-soft) 320%);
  border-color: var(--accent-soft);
}
.work-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.work-status {
  font-size: .76rem; font-weight: 600; letter-spacing: .03em;
  padding: .28rem .7rem; border-radius: 100px;
  background: var(--paper-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.work-status.status-live {
  background: var(--accent); color: var(--white); border-color: var(--accent);
}
.work-client { font-size: .86rem; color: var(--ink-faint); font-weight: 500; }
.work-card h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.45rem; letter-spacing: -.01em; margin-bottom: .6rem;
}
.work-card.feature h3 { font-size: 1.8rem; }
.work-card p { color: var(--ink-soft); font-size: 1rem; }
.work-card p a {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color .2s var(--ease);
}
.work-card p a:hover { text-decoration-color: var(--accent); }
.work-tags {
  display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.3rem;
}
.work-tags li {
  font-size: .8rem; font-weight: 500; color: var(--accent-deep);
  padding: .3rem .7rem; border-radius: 7px;
  background: var(--accent-soft);
}

/* ---------- À propos ---------- */
.about-layout {
  display: grid; gap: clamp(2rem, 6vw, 4.5rem);
  grid-template-columns: 1.05fr .95fr; align-items: center;
}
.section-title em { font-style: italic; color: var(--accent); font-weight: 500; }
.profile-bio { margin-top: 1.2rem; color: var(--ink-soft); font-size: 1.12rem; max-width: 50ch; }
.profile-bio strong { color: var(--ink); font-weight: 600; }

/* Flux « du besoin au livrable » — une méthode, pas un CV */
.about-flow {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.7rem, 4vw, 2.5rem);
  box-shadow: var(--shadow-sm);
}
.flow { position: relative; padding-left: 1.85rem; }
.flow::before {
  content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(var(--accent), var(--accent-soft));
}
.flow li { position: relative; padding-bottom: 1.7rem; }
.flow li:last-child { padding-bottom: 0; }
.flow-dot {
  position: absolute; left: -1.85rem; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--accent);
}
.flow li:last-child .flow-dot {
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
.flow-step { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.18rem; letter-spacing: -.01em; }
.flow-note { display: block; font-size: .92rem; color: var(--ink-soft); }

/* Section CTA */
.section-cta { margin-top: clamp(2rem, 4vw, 3rem); text-align: center; }

/* Liens GitHub avec logo */
.gh-link { display: inline-flex; align-items: center; gap: .4rem; }
.gh-icon { flex: 0 0 auto; vertical-align: middle; }

/* ---------- Contact ---------- */
.contact-layout {
  display: grid; gap: clamp(2.5rem, 6vw, 5rem);
  grid-template-columns: 1fr 1fr; align-items: start;
}
.contact-points { margin-top: 2rem; display: flex; flex-direction: column; gap: 1.3rem; }
.contact-points li { display: flex; flex-direction: column; gap: .2rem; }
.cp-label {
  font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
}
.contact-points a { color: var(--accent); font-weight: 500; }
.contact-points a:hover { color: var(--accent-deep); text-decoration: underline; }

/* Contact card (email reveal) */
.contact-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.6rem, 4vw, 2.4rem);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 1.2rem;
}
.contact-card-invite { font-size: 1.08rem; color: var(--ink-soft); }
.contact-card-note { font-size: .88rem; color: var(--ink-faint); font-style: italic; }
.email-reveal-btn { justify-content: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 2.6rem; }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem;
}
.footer-brand { display: flex; align-items: center; gap: .55rem; }
.footer-tag { color: var(--ink-soft); font-size: .92rem; }
.footer-meta {
  margin-left: auto; display: flex; align-items: center; gap: 1.4rem;
  font-size: .92rem;
}
.footer-meta a { color: var(--accent); font-weight: 500; }
.footer-meta a:hover { text-decoration: underline; }
.footer-copy { color: var(--ink-faint); }

/* ---------- Animations NON bloquantes ----------
   Principe : aucune animation ne masque ni ne retarde l'affichage du contenu.
   Tout est lisible immédiatement (et sans JS). Les animations sont purement
   décoratives : entrée du hero au chargement + fonds ambiants. */

/* .reveal ne masque jamais le contenu (lisible sans JS). L'IntersectionObserver
   ajoute .in à l'entrée dans le viewport — crochet d'amélioration progressive
   disponible, sans effet visuel par défaut. */

/* Entrée du hero au chargement de page (au-dessus de la ligne de flottaison,
   donc jamais un frein pour qui scrolle vers le bas). */
@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * { animation: heroRise .7s var(--ease) both; }
  .hero-inner > *:nth-child(1) { animation-delay: .04s; }
  .hero-inner > *:nth-child(2) { animation-delay: .12s; }
  .hero-inner > *:nth-child(3) { animation-delay: .18s; }
  .hero-inner > *:nth-child(4) { animation-delay: .24s; }
  .hero-inner > *:nth-child(5) { animation-delay: .30s; }
  .hero-inner > *:nth-child(6) { animation-delay: .36s; }
  .hero-inner > *:nth-child(7) { animation-delay: .42s; }
}
@keyframes heroRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Sparks ambiants du hero (canvas) */
.hero-sparks {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }

/* Fond ambiant des sections alternées : halo teal qui dérive lentement */
.section-alt { position: relative; overflow: hidden; }
.section-alt > .container { position: relative; z-index: 1; }
@media (prefers-reduced-motion: no-preference) {
  .section-alt::before {
    content: ""; position: absolute; z-index: 0;
    width: 60vmax; height: 60vmax; top: -20vmax; right: -10vmax;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%);
    animation: drift 22s ease-in-out infinite alternate;
    will-change: transform;
  }
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-8vmax, 6vmax) scale(1.12); }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .approach-grid { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .about-layout, .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: .25rem;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 1rem var(--gutter) 1.4rem;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .3s var(--ease), opacity .3s var(--ease);
  }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-link { padding: .8rem 1rem; border-radius: var(--radius-sm); }
  .nav-cta { text-align: center; margin-left: 0; margin-top: .35rem; }
  .lang-switch {
    justify-content: center; margin-left: 0; padding-left: 0; margin-top: .5rem;
    padding-top: .6rem; border-left: 0; border-top: 1px solid var(--line);
  }
  .footer-meta { margin-left: 0; width: 100%; flex-wrap: wrap; }
}
