/* =====================================================================
   KAGNARD — global.css
   Reset, typographie de base, boutons, conteneurs, utilitaires.
   Dépend de variables.css (chargé avant).
   ===================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-texte);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--noir);
  background: var(--blanc);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

ul,
ol {
  list-style: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* Lien d'évitement (accessibilité) */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--noir);
  color: var(--blanc);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 2000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Typographie ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-titre);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--noir);
}

/* Les très gros titres (display/h1) resserrent l'interlignage et le
   tracking pour un rendu display plus assumé, sans toucher aux h2/h3
   (dont l'espacement reste optimisé pour la lisibilité en paragraphe court). */
h1 {
  font-size: var(--fs-h1);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { color: var(--gris-texte); }

strong { color: var(--noir); }

/* Texte tertiaire (légendes, méta-infos) — jamais du texte porteur de sens */
.text-muted { color: var(--texte-muted); }

/* ---------- Conteneurs & sections ---------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}
.container--narrow {
  width: min(100% - 2.5rem, var(--container-narrow));
  margin-inline: auto;
}

.section {
  padding-block: var(--space-section);
  position: relative;
}

.section__head {
  max-width: 760px;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}
.section__head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-titre);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange-fonce);
  margin-bottom: 1.1rem;
}
.eyebrow::before {
  content: "";
  width: 34px;
  height: 4px;
  background: var(--noir); /* barre noire du logo = signature */
  border-radius: 2px;
  flex-shrink: 0;
}
.eyebrow--center {
  justify-content: center;
}
/* Variante claire pour usage sur fonds sombres (.section--dark) */
.eyebrow--light,
.section--dark .eyebrow {
  color: var(--accent-sur-encre);
}
.eyebrow--light::before,
.section--dark .eyebrow::before {
  background: var(--texte-sur-encre);
}

.lead {
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  line-height: 1.55;
  color: var(--gris-texte);
  max-width: 60ch;
}
.section--dark .lead { color: var(--texte-sur-encre-muted); }

/* Soulignement signature (barre noire du logo) sous mots-clés */
.mark {
  position: relative;
  white-space: nowrap;
}
.mark::after {
  content: "";
  position: absolute;
  left: -0.08em;
  right: -0.08em;
  bottom: 0.04em;
  height: 0.34em;
  background: var(--orange);
  opacity: 0.4;
  z-index: -1;
  border-radius: 3px;
  transform-origin: left center;
}
.mark--bleu::after { background: var(--bleu); }
/* Variante lisible sur fond sombre (.section--dark) */
.mark--light { color: var(--blanc); }
.mark--light::after { background: var(--accent-sur-encre); opacity: 0.55; }

/* Barre noire séparateur de section (signature logo) */
.divider-bar {
  width: 64px;
  height: 6px;
  background: var(--noir);
  border-radius: 3px;
  margin: 0 0 1.5rem;
}
.divider-bar--center { margin-inline: auto; }
.divider-bar--light { background: var(--texte-sur-encre); }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--orange);
  --btn-fg: var(--blanc);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.7rem;
  font-family: var(--font-titre);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: -0.005em;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease);
  will-change: transform;
}
/* Reflet "shine" qui traverse au hover — décoratif, transform-only */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.35) 48%,
    transparent 66%
  );
  transform: translateX(-120%);
  pointer-events: none;
}
.btn:hover::before {
  transition: transform 0.7s var(--ease-out);
  transform: translateX(120%);
}
.btn > * { position: relative; z-index: 2; }
.btn:hover {
  transform: translateY(-3px);
}
.btn:active {
  transform: translateY(-1px);
  transition-duration: 0.12s;
}
.btn:focus-visible {
  outline: 3px solid var(--noir);
  outline-offset: 3px;
}

.btn--orange {
  --btn-bg: var(--orange);
  box-shadow: var(--shadow-orange);
}
.btn--orange:hover {
  /* Plus profond au hover (jamais plus clair) = plus premium + reste lisible */
  --btn-bg: var(--orange-deep);
  box-shadow: var(--shadow-orange-lg);
}

.btn--dark {
  --btn-bg: var(--noir);
  --btn-fg: var(--blanc);
  box-shadow: var(--shadow-1);
}
.btn--dark:hover { --btn-bg: #1E1E1E; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--noir);
  border: 2px solid currentColor;
}
.btn--ghost:hover {
  --btn-bg: var(--noir);
  --btn-fg: var(--blanc);
}
/* Variante lisible sur fonds sombres (.section--dark, .banned, bloc bleu) */
.btn--ghost-light {
  --btn-bg: transparent;
  --btn-fg: var(--blanc);
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.btn--ghost-light:hover {
  --btn-bg: var(--blanc);
  --btn-fg: var(--noir);
  border-color: var(--blanc);
}

.btn--light {
  --btn-bg: var(--blanc);
  --btn-fg: var(--noir);
  box-shadow: var(--shadow-1);
}
.btn--light:hover { box-shadow: var(--shadow-2); }

.btn--lg {
  padding: 1.15rem 2.2rem;
  font-size: 1.08rem;
}

.btn--block {
  width: 100%;
}

/* ---------- Téléphone visible en héros (toutes pages) ----------
   Canal de conversion clé, surtout pendant les pics de chaleur (besoin
   immédiat) : toujours affiché à côté des CTA du hero, pas seulement
   dans le header. Réutilisé tel quel sur index/solutions/produits/
   thématiques/calculateur via cette seule classe partagée. */
.hero-phone-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.2rem;
  padding: 0.55rem 1.4rem 0.55rem 0.55rem;
  background: var(--blanc);
  border: 1.5px solid var(--gris-bord);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    border-color 0.25s var(--ease);
}
.hero-phone-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--orange);
}
.hero-phone-link__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--blanc);
  flex-shrink: 0;
}
.hero-phone-link__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.15;
  text-align: left;
}
.hero-phone-link__label {
  font-family: var(--font-titre);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--orange-fonce);
}
.hero-phone-link__number {
  font-family: var(--font-titre);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--noir);
}
.section--dark .hero-phone-link {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}
.section--dark .hero-phone-link__number { color: var(--texte-sur-encre); }

/* ---------- Cartes verre ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
}
/* Élévation renforcée au hover (les cartes qui l'utilisent ajoutent déjà
   leur propre translateY ; ici on muscle juste l'ombre en cohérence). */
.glass:hover {
  box-shadow: var(--shadow-2);
  border-color: rgba(255, 255, 255, 0.9);
}
/* Carte mise en avant (badge "recommandé") — hiérarchie visuelle premium */
.glass--featured {
  border-color: var(--orange);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--orange-soft);
}
.glass--featured:hover { box-shadow: var(--shadow-3), 0 0 0 1px var(--orange-soft); }

/* ---------- Sections sombres "encre" — profondeur premium ----------
   Réutilisable sur n'importe quelle section (comparatif, blocs de rupture).
   Fournit ses propres couleurs de texte/accent lisibles sur fond sombre. */
.section--dark {
  position: relative;
  background: linear-gradient(165deg, var(--encre) 0%, var(--encre-2) 100%);
  color: var(--texte-sur-encre);
  isolation: isolate;
}
.section--dark::before {
  /* Grain très léger + halo discret pour casser le plat du dégradé sombre */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--noise),
    radial-gradient(circle at 85% 0%, rgba(242, 100, 25, 0.16), transparent 55%),
    radial-gradient(circle at 8% 100%, rgba(77, 163, 255, 0.14), transparent 50%);
  background-size: 180px 180px, auto, auto;
  opacity: 0.5;
  mix-blend-mode: overlay;
  pointer-events: none;
}
/* Filigrane du pictogramme de marque — discret, dans un coin, jamais sur le
   texte. Purement décoratif (aucun impact DOM/perf/lisibilité). */
.section--dark::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: var(--brand-mark);
  background-repeat: no-repeat;
  background-position: 104% 120%;
  background-size: 380px 380px;
  opacity: 0.045;
  pointer-events: none;
}
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--texte-sur-encre); }
.section--dark p { color: var(--texte-sur-encre-muted); }
.section--dark strong { color: var(--texte-sur-encre); }

/* Grain lumineux ultra-léger réutilisable sur cartes/fonds clairs
   (distinct de .grain, qui gère l'effet "rayon de soleil" des héros). */
.has-grain { position: relative; isolation: isolate; }
.has-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--noise);
  background-size: 180px 180px;
  opacity: 0.035;
  mix-blend-mode: overlay;
  pointer-events: none;
  border-radius: inherit;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.99);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  will-change: transform, opacity;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* Délais en cascade pour les grilles */
.reveal[data-delay="1"] { transition-delay: 0.09s; }
.reveal[data-delay="2"] { transition-delay: 0.18s; }
.reveal[data-delay="3"] { transition-delay: 0.27s; }
.reveal[data-delay="4"] { transition-delay: 0.36s; }

/* ---------- Utilitaires ---------- */
.text-center { text-align: center; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.no-scroll { overflow: hidden; }

/* Grain lumineux réutilisable (rayons de soleil) */
/* Le grain établit un contexte d'empilement pour que l'effet lumineux
   reste DERRIÈRE le contenu (titres lisibles). */
.grain {
  position: relative;
  isolation: isolate;
}
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1; /* sous le contenu, au-dessus du fond de section uniquement */
  pointer-events: none;
  background-image: radial-gradient(
    circle at 50% 0%,
    rgba(255, 255, 255, 0.55),
    transparent 60%
  );
  mix-blend-mode: screen;
}

/* ---------- Bandeau cookies (RGPD) — global, chargé partout ---------- */
.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%) translateY(140%);
  z-index: 1000;
  width: min(960px, calc(100% - 2rem));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.4rem;
  padding: 1.1rem 1.3rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.cookie-banner.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.cookie-banner__text {
  flex: 1 1 340px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--gris-texte);
  margin: 0;
}
.cookie-banner__text a { color: var(--orange-fonce); text-decoration: underline; }
.cookie-banner__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.cookie-banner .btn { padding: 0.6rem 1.1rem; font-size: 0.9rem; }
@media (max-width: 560px) {
  .cookie-banner { bottom: 0; border-radius: var(--radius) var(--radius) 0 0; width: 100%; }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1 1 auto; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
