/* =========================================================================
   CAFLO HOLDING — Feuille de style globale
   Étape 3 : design premium, mobile-first.
   Ordre : 1) Tokens  2) Reset/base  3) Utilitaires  4) Composants
   Les adaptations tablette/desktop sont dans responsive.css.
   ========================================================================= */

/* ============================ 1. TOKENS ================================= */
:root {
  /* Couleurs de marque (issues de l'affiche CAFLO) */
  --petrol:        #16242B;   /* fond corporate principal */
  --petrol-700:    #1E323B;   /* variante de fond sombre */
  --petrol-600:    #274049;   /* bordures/États sur fond sombre */
  --mint:          #6FBF9A;   /* accent principal */
  --mint-deep:     #4EA37E;   /* survol des éléments d'action */
  --white:         #FFFFFF;
  --mist:          #F4F7F6;   /* fond clair des sections */
  --slate:         #5A6B70;   /* texte secondaire sur fond clair */
  --ink:           #1B2A30;   /* texte principal sur fond clair */
  --line:          #E4EBE9;   /* filets clairs */

  /* Typographies */
  --font-display: "Poppins", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;

  /* Échelle typographique fluide */
  --fs-hero:    clamp(2.4rem, 6vw, 4.25rem);
  --fs-h1:      clamp(1.9rem, 4.2vw, 2.9rem);
  --fs-h2:      clamp(1.5rem, 3.2vw, 2.25rem);
  --fs-h3:      1.25rem;
  --fs-lead:    clamp(1.05rem, 1.6vw, 1.2rem);
  --fs-body:    1rem;
  --fs-small:   0.875rem;

  /* Espacements */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --section-y: clamp(3.5rem, 8vw, 6.5rem);

  /* Rayons, ombres, transitions */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 4px 14px rgba(22, 36, 43, 0.06);
  --shadow-md: 0 14px 40px rgba(22, 36, 43, 0.10);
  --shadow-lg: 0 24px 60px rgba(22, 36, 43, 0.16);
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:       0.35s;

  --container: 1200px;
}

/* ============================ 2. RESET / BASE =========================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* Décalage des ancres pour ne pas passer sous le header collant */
[id] { scroll-margin-top: 90px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  color: var(--ink);
  font-weight: 600;
}

p  { margin: 0 0 var(--space-4); }
a  { color: var(--mint-deep); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--mint); }
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

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

/* Lien d'évitement (accessibilité) */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--mint);
  color: var(--petrol);
  padding: var(--space-3) var(--space-5);
  font-weight: 600;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ============================ 3. UTILITAIRES =========================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.section { padding-block: var(--section-y); }
.section--alt { background: var(--mist); }

.section__title {
  font-size: var(--fs-h2);
  position: relative;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
}
/* Signature : filet menthe court sous chaque titre de section */
.section__title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 56px; height: 4px;
  background: var(--mint);
  border-radius: var(--radius-pill);
}
.section__lead {
  font-size: var(--fs-lead);
  color: var(--slate);
  max-width: 65ch;
}

/* Grilles de cartes */
.cards { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }

/* ============================ 4. COMPOSANTS ============================ */

/* --- Boutons --- */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn--primary { background: var(--mint); color: var(--petrol); }
.btn--primary:hover {
  background: var(--mint-deep);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(78, 163, 126, 0.35);
}
.btn--ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.5); }
.btn--ghost:hover { background: var(--white); color: var(--petrol); transform: translateY(-2px); }

/* --- Header / Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--petrol);
  border-bottom: 1px solid var(--petrol-600);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: 72px;
}
.header__logo-img { height: 40px; width: auto; }

.nav__toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nav__bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--white);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
/* Burger -> croix quand le menu est ouvert (piloté par aria-expanded en JS) */
.nav__toggle[aria-expanded="true"] .nav__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__bar:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] .nav__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Liste : panneau déroulant sur mobile */
.nav__list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--petrol);
  border-bottom: 1px solid var(--petrol-600);
  padding: var(--space-4) var(--space-5) var(--space-6);
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--dur) var(--ease),
              opacity var(--dur) var(--ease),
              visibility var(--dur) var(--ease);
}
.nav__toggle[aria-expanded="true"] ~ .nav__list {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.nav__link {
  display: inline-block;
  color: var(--white);
  font-weight: 500;
  padding: var(--space-2) 0;
  position: relative;
}
.nav__link:hover { color: var(--mint); }
.nav__link--active { color: var(--mint); }
.nav__link--cta {
  color: var(--petrol);
  background: var(--mint);
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
}
.nav__link--cta:hover { background: var(--mint-deep); color: var(--white); }

/* --- Hero --- */
.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 120% at 85% -10%, var(--petrol-700), var(--petrol) 60%);
  color: var(--white);
  padding-block: clamp(3.5rem, 9vw, 7rem);
}
/* Formes organiques rappelant l'affiche */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.18;
  pointer-events: none;
}
.hero::before { width: 320px; height: 320px; background: var(--mint); top: -90px; right: -60px; }
.hero::after  { width: 220px; height: 220px; background: var(--mint-deep); bottom: -80px; left: -40px; opacity: 0.14; }

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--space-6);
  align-items: center;
}
.hero__eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--mint);
  font-size: var(--fs-small);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.hero__title {
  font-size: var(--fs-hero);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.hero__subtitle {
  font-size: var(--fs-lead);
  color: rgba(255,255,255,0.82);
  max-width: 48ch;
  margin-bottom: var(--space-6);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.hero__media {
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 260px;
  background:
    linear-gradient(160deg, rgba(111,191,154,0.22), rgba(30,50,59,0.4)),
    var(--petrol-700);
  box-shadow: var(--shadow-lg);
}
.hero__image { width: 100%; height: 100%; object-fit: cover; }
/* Animation d'entrée (CSS pur) */
.hero__content > * { animation: rise 0.7s var(--ease) both; }
.hero__content > *:nth-child(2) { animation-delay: 0.08s; }
.hero__content > *:nth-child(3) { animation-delay: 0.16s; }
.hero__content > *:nth-child(4) { animation-delay: 0.24s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Page header (pages internes) --- */
.page-header {
  background: var(--petrol);
  color: var(--white);
  padding-block: clamp(2.75rem, 7vw, 4.5rem);
}
.page-header__title { color: var(--white); font-size: var(--fs-h1); margin-bottom: var(--space-3); }
.page-header__subtitle { color: rgba(255,255,255,0.78); font-size: var(--fs-lead); margin: 0; }

/* --- Cartes (base commune) --- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.card__title { font-size: var(--fs-h3); margin-bottom: var(--space-3); }
.card__text  { color: var(--slate); margin-bottom: var(--space-4); }
.card__link  {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--mint-deep);
}
.card__link::after { content: " \2192"; transition: margin-left var(--dur) var(--ease); }
.card__link:hover::after { margin-left: 4px; }

/* Domaines : liseré menthe qui se révèle au survol */
.domaine-card { position: relative; overflow: hidden; }
.domaine-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--mint);
  transform: scaleY(0); transform-origin: top;
  transition: transform var(--dur) var(--ease);
}
.domaine-card:hover::before { transform: scaleY(1); }

/* --- Valeurs --- */
.values__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.value {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-5);
  text-align: center;
}
.section--alt .value { background: var(--white); }

/* --- Chiffres --- */
.stats { background: var(--petrol); color: var(--white); }
.stats .section__title { color: var(--white); }
.stats__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  text-align: center;
}
.stat__number {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--mint);
  line-height: 1;
}
.stat__label { color: rgba(255,255,255,0.75); font-size: var(--fs-small); }

/* --- Galerie --- */
.gallery__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.gallery__item {
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(160deg, var(--petrol-700), var(--mint-deep));
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }

/* --- Catalogue (Logistique / Immobilier) --- */
.catalogue__loading,
.catalogue__empty { color: var(--slate); text-align: center; padding: var(--space-6); }
.catalogue__grid:empty { display: none; }

/* Fiche produit (générée en JS aux étapes 7-8, style prêt ici) */
.item-card { padding: 0; overflow: hidden; }
.item-card__media { aspect-ratio: 16 / 10; background: var(--mist); }
.item-card__media img { width: 100%; height: 100%; object-fit: cover; }
.item-card__body { padding: var(--space-5); }
.item-card__price { font-family: var(--font-display); font-weight: 700; color: var(--mint-deep); }
.badge {
  display: inline-block;
  font-size: var(--fs-small);
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(111,191,154,0.15);
  color: var(--mint-deep);
}
.badge--out { background: rgba(90,107,112,0.12); color: var(--slate); }
.item-card__sub { color: var(--slate); font-size: var(--fs-small); margin: 0 0 var(--space-2); }
.item-card__meta { color: var(--mint-deep); font-size: var(--fs-small); font-weight: 500; margin: 0 0 var(--space-2); }

/* Fiche détails affichée dans la modale (Logistique / Immobilier) */
.detail__image { width: 100%; border-radius: var(--radius-sm); margin-bottom: var(--space-4); }
.detail__price { font-size: 1.4rem; margin-bottom: var(--space-4); }
.detail__list { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.detail__list li { color: var(--ink); }
.detail__desc { color: var(--slate); }

/* --- CTA band --- */
.cta-band { background: var(--mint); color: var(--petrol); }
.cta-band__inner {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--space-5);
}
.cta-band__title { color: var(--petrol); margin: 0; font-size: var(--fs-h2); }
.cta-band .btn--primary { background: var(--petrol); color: var(--white); }
.cta-band .btn--primary:hover { background: var(--petrol-700); box-shadow: 0 10px 24px rgba(22,36,43,0.3); }

/* --- Contact --- */
.contact__grid { display: grid; gap: var(--space-7); }
.contact__list { display: grid; gap: var(--space-4); margin-bottom: var(--space-6); }
.contact__item { display: grid; gap: 2px; padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.contact__label { font-size: var(--fs-small); color: var(--slate); text-transform: uppercase; letter-spacing: 0.04em; }
.contact__value { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
a.contact__value:hover { color: var(--mint-deep); }
.contact__subtitle { font-size: var(--fs-h3); margin-bottom: var(--space-3); }
.contact__socials { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.contact__socials a {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 500;
  color: var(--ink);
}
.contact__socials a:hover { border-color: var(--mint); color: var(--mint-deep); }
.contact__map-embed {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--mist);
  border: 1px solid var(--line);
  overflow: hidden;
}
.contact__map-embed iframe { width: 100%; height: 100%; border: 0; }

/* --- Modale (détails / admin) --- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: var(--space-5); }
.modal[hidden] { display: none; }
.modal__overlay { position: absolute; inset: 0; background: rgba(22,36,43,0.6); }
.modal__content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  max-width: 640px; width: 100%;
  max-height: 88vh; overflow: auto;
  padding: var(--space-7);
  box-shadow: var(--shadow-lg);
  animation: rise 0.3s var(--ease) both;
}
.modal__close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: var(--mist); color: var(--ink);
  font-size: 1.4rem; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.modal__close:hover { background: var(--line); }

/* --- Footer --- */
.site-footer { background: var(--petrol); color: rgba(255,255,255,0.8); padding-top: var(--section-y); }
.footer__grid { display: grid; gap: var(--space-6); }
.footer__logo { height: 40px; margin-bottom: var(--space-4); }
.footer__tagline { color: var(--mint); font-family: var(--font-display); font-weight: 500; margin-bottom: var(--space-3); }
.footer__about { font-size: var(--fs-small); line-height: 1.7; }
.footer__title { color: var(--white); font-size: 1.05rem; margin-bottom: var(--space-4); }
.footer__links a,
.footer__contact-list a,
.footer__socials a { color: rgba(255,255,255,0.8); }
.footer__links li,
.footer__contact-list li { margin-bottom: var(--space-2); }
.footer__links a:hover,
.footer__contact-list a:hover,
.footer__socials a:hover { color: var(--mint); }
.footer__socials { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-4); }
.footer__bottom {
  margin-top: var(--section-y);
  border-top: 1px solid var(--petrol-600);
  padding-block: var(--space-5);
  font-size: var(--fs-small);
}
.footer__bottom p { margin: 0; }
.footer__credit a { color: var(--mint); font-weight: 500; }
.footer__credit a:hover { color: var(--white); }

/* --- Utilitaire d'apparition au défilement ---
   L'état masqué n'est appliqué que si JavaScript est actif (classe .js sur
   <html>). Sans JS, le contenu reste visible : rien n'est perdu. */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

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