/* ==========================================================================
   Emeritus Technologies — design system
   ========================================================================== */

:root {
  --corail: #FF6F59;
  --bleu: #0055FF;
  --jaune: #FFD166;
  --violet: #4A154B;
  --clair: #F8F9FA;
  --beige: #F2E8DA;
  --sombre: #121212;

  --corail-rgb: 255, 111, 89;
  --bleu-rgb: 0, 85, 255;
  --jaune-rgb: 255, 209, 102;
  --violet-rgb: 74, 21, 75;

  --bg: var(--sombre);
  --bg-rgb: 18, 18, 18;
  --fg: var(--clair);
  --fg-muted: rgba(248, 249, 250, 0.68);
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.12);
  --accent: var(--corail);
  --accent-rgb: var(--corail-rgb);

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

  --wrap: 1180px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;
  --space-7: 140px;

  --radius: 18px;
  --radius-sm: 10px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: 0.6s;

  color-scheme: dark;
}

/* Sections marked data-theme="light" flip the body palette while in view */
body.theme-light {
  --bg: var(--clair);
  --bg-rgb: 248, 249, 250;
  --fg: #171519;
  --fg-muted: rgba(23, 21, 25, 0.64);
  --surface: rgba(18, 18, 18, 0.035);
  --border: rgba(18, 18, 18, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

img { max-width: 100%; display: block; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5vw + 1rem, 4.6rem); }
h2 { font-size: clamp(1.9rem, 3vw + 1rem, 3rem); }
h3 { font-size: clamp(1.25rem, 1vw + 1rem, 1.6rem); }

p { margin: 0 0 var(--space-2); color: var(--fg-muted); }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 30px -12px rgba(var(--accent-rgb), 0.65);
}
.btn-primary:hover { box-shadow: 0 16px 36px -12px rgba(var(--accent-rgb), 0.8); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: var(--space-2) 0;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), padding 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(var(--bg-rgb), 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--border);
  padding: 10px 0;
}
.site-header .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.logo-link { display: flex; align-items: center; }
.logo-swap { position: relative; display: inline-block; height: 34px; width: 71px; }
.logo-swap img {
  position: absolute;
  inset: 0;
  height: 34px;
  width: auto;
  transition: opacity 0.4s var(--ease);
}
.logo-swap-color { opacity: 0; }
body.theme-light .logo-swap-white { opacity: 0; }
body.theme-light .logo-swap-color { opacity: 1; }

.nav-links {
  display: none;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a {
  position: relative;
  padding: 4px 0;
  color: var(--fg-muted);
  transition: color 0.3s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-links a:hover,
.nav-links a.is-active { color: var(--fg); }
.nav-links a:hover::after,
.nav-links a.is-active::after { width: 100%; }

.nav-cta { display: none; }

.burger {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 10px;
  cursor: pointer;
}
.burger span {
  width: 22px;
  height: 2px;
  background: var(--fg);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.98);
  backdrop-filter: blur(10px);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: 1.6rem;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.mobile-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mobile-menu a { color: var(--fg); }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-cta { display: block; }
  .burger { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--space-6) + 60px) 0 var(--space-6);
  overflow: hidden;
}

.hero-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(55% 60% at 20% 22%, rgba(var(--corail-rgb), 0.32), transparent 62%),
    radial-gradient(45% 55% at 85% 15%, rgba(var(--corail-rgb), 0.22), transparent 60%),
    radial-gradient(60% 60% at 50% 100%, rgba(var(--corail-rgb), 0.3), transparent 65%),
    var(--sombre);
}
.hero-scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
.hero-scene.is-ready canvas { opacity: 1; }

.hero-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18,18,18,0.15) 0%, rgba(18,18,18,0.55) 78%, var(--sombre) 100%);
  pointer-events: none;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  transition: transform 0.2s linear;
  will-change: transform;
}
.hero-blob--a { width: 46vw; height: 46vw; background: var(--corail); top: -10%; left: -8%; }
.hero-blob--b { width: 34vw; height: 34vw; background: var(--corail); top: 10%; right: -6%; }
.hero-blob--c { width: 40vw; height: 40vw; background: var(--corail); bottom: -18%; left: 24%; }

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 780px;
  color: #fff;
}
.hero-content h1 { color: #fff; }
.hero-content h1 em { font-style: normal; color: var(--accent); }
.hero-content p.lead {
  font-size: clamp(1.05rem, .5vw + 1rem, 1.3rem);
  color: rgba(255,255,255,0.78);
  max-width: 56ch;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.hero-ctas .btn-ghost { border-color: rgba(255,255,255,0.28); color: #fff; }
.hero-ctas .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: var(--space-3);
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-cue span {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, rgba(255,255,255,0.7), transparent);
  animation: cue 2.2s var(--ease) infinite;
}
@keyframes cue {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ---------- Generic section rhythm ---------- */
section { position: relative; padding: var(--space-7) 0; scroll-margin-top: 84px; }
section[data-theme] + section[data-theme] { border-top: 1px solid var(--border); }
.section-head { max-width: 680px; margin: 0 0 var(--space-5); }
.section-head p { font-size: 1.05rem; }

/* Alterne blanc et beige sur les sections claires, plutôt qu'un blanc pur uniforme. */
#apropos { background: var(--beige); }
#expertises { background: var(--clair); }
#approche { background: var(--beige); }
#pourquoi { background: var(--clair); }
#contact { background: var(--beige); }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-stagger > * { transition-delay: calc(var(--i, 0) * 90ms); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Manifesto ---------- */
.manifesto {
  display: grid;
  gap: var(--space-5);
  align-items: start;
}
.manifesto .figure {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 5.5rem);
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.manifesto-lead { font-size: 1.2rem; color: var(--fg); }

@media (min-width: 900px) {
  .manifesto { grid-template-columns: 0.9fr 1.1fr; gap: var(--space-6); }
}

.manifesto-logo {
  display: flex;
  justify-content: center;
  margin-top: var(--space-6);
}
.manifesto-logo img { height: 120px; width: auto; }

/* ---------- Expertises ---------- */
.pillars {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  perspective: 1400px;
}
@media (min-width: 700px) { .pillars { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .pillars { grid-template-columns: repeat(3, 1fr); } }

.pillar {
  --accent: var(--bleu);
  --accent-rgb: var(--bleu-rgb);
  position: relative;
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transform-style: preserve-3d;
  transform: rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
  transition: transform 0.25s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease);
  cursor: default;
}
.pillar:hover,
.pillar:focus-within {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.06);
}
.pillar .num {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: var(--space-2);
}
.pillar h3 { margin-bottom: 10px; }
.pillar ul { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: 8px; }
.pillar li {
  font-size: 0.92rem;
  color: var(--fg-muted);
  padding-left: 20px;
  position: relative;
}
.pillar li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.pillar--gradient-cool { --accent: var(--bleu); --accent-rgb: var(--bleu-rgb); }
.pillar--gradient-cool .num { background: linear-gradient(120deg, var(--bleu), var(--violet)); color: #fff; border-color: transparent; }
.pillar--gradient-warm { --accent: var(--corail); --accent-rgb: var(--corail-rgb); }
.pillar--gradient-warm .num { background: linear-gradient(120deg, var(--corail), var(--jaune)); color: var(--sombre); border-color: transparent; }

/* ---------- Approche (timeline) ---------- */
.timeline {
  display: grid;
  gap: var(--space-4);
  counter-reset: step;
}
@media (min-width: 900px) { .timeline { grid-template-columns: repeat(4, 1fr); gap: var(--space-3); } }
.step { position: relative; padding-top: var(--space-4); }
.step .n {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.85;
  display: block;
  margin-bottom: var(--space-1);
}
.step h4 { margin-bottom: 8px; }
.step::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 44px; height: 2px;
  background: var(--accent);
}

/* ---------- Pourquoi ---------- */
.why-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 700px) { .why-grid { grid-template-columns: repeat(2, 1fr); } }
.why-item {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.why-item h4 { margin-bottom: 8px; }
.why-item p { margin: 0; font-size: 0.95rem; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 900px) { .contact-grid { grid-template-columns: 0.9fr 1.1fr; } }

.contact-info dl {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}
.contact-info dt {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.contact-info dd { margin: 0; color: var(--fg); }

.field { margin-bottom: var(--space-3); }
.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.98rem;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
}
.field textarea { resize: vertical; min-height: 130px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-note { font-size: 0.85rem; margin-top: var(--space-2); }
.form-status { margin-top: var(--space-2); font-size: 0.92rem; }
.form-status[data-state="ok"] { color: #3bd671; }
.form-status[data-state="error"] { color: var(--corail); }

/* ---------- Footer ---------- */
.site-footer {
  padding: var(--space-5) 0 var(--space-4);
  border-top: 1px solid var(--border);
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.footer-grid img { height: 44px; width: auto; margin-bottom: var(--space-2); }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: 0.9rem; }
.footer-nav a { color: var(--fg-muted); transition: color 0.3s var(--ease); }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--fg-muted);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
