/* =========================================================
   MESC - Moroccan Engineering Studies and Consulting
   Feuille de style principale (responsive mobile / tablette / PC)
   ========================================================= */

:root {
  --navy: #0b1f3a;
  --navy-2: #12315c;
  --blue: #1d5fd1;
  --accent: #f5a524;
  --accent-dark: #d98b0c;
  --text: #2b3545;
  --muted: #64748b;
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --border: #e3e9f2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(11, 31, 58, .08);
  --shadow-lg: 0 20px 50px rgba(11, 31, 58, .16);
  --header-h: 76px;
  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
}

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

a { color: var(--blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--navy);
  line-height: 1.25;
  margin: 0 0 .6em;
}

.container { max-width: 1200px; padding-left: 20px; padding-right: 20px; }

/* ---------- Boutons ---------- */
.btn-main, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.6rem;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .2s, background .2s, color .2s, box-shadow .2s;
}
.btn-main { background: var(--accent); color: var(--navy); box-shadow: 0 8px 20px rgba(245, 165, 36, .35); }
.btn-main:hover { background: var(--accent-dark); color: #fff; transform: translateY(-2px); }
.btn-ghost { border-color: rgba(255, 255, 255, .7); color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--navy); }
.btn-block { width: 100%; }
.btn-main[disabled] { opacity: .6; cursor: wait; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: background .3s, box-shadow .3s, height .3s;
}
.site-header.scrolled,
body.nav-open .site-header {
  background: rgba(11, 31, 58, .96);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.brand-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 1px;
  line-height: 1;
  display: flex;
  flex-direction: column;
}
.brand-text small { font-size: .62rem; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; opacity: .75; margin-top: 3px; }

.navmenu ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .25rem; }
.navmenu a {
  display: block;
  padding: .5rem .9rem;
  color: rgba(255, 255, 255, .85);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: .95rem;
  border-radius: 999px;
  position: relative;
}
.navmenu a:hover, .navmenu a.active { color: #fff; }
.navmenu a.active:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: .9rem; right: .9rem; bottom: .2rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.navmenu a.nav-cta { background: var(--accent); color: var(--navy); margin-left: .5rem; padding: .5rem 1.2rem; }
.navmenu a.nav-cta:hover { background: #fff; }

.mobile-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 0;
  background: transparent;
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.mobile-nav-toggle span { display: block; height: 3px; width: 100%; background: #fff; border-radius: 3px; transition: transform .3s, opacity .3s; }
body.nav-open .mobile-nav-toggle span:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
body.nav-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .mobile-nav-toggle span:nth-child(3) { transform: translateY(-9.5px) rotate(-45deg); }

@media (max-width: 1099px) {
  .mobile-nav-toggle { display: flex; }
  /* Le flou crée un nouveau repère pour position:fixed et couperait le menu */
  .site-header.scrolled,
  body.nav-open .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--navy); }
  .navmenu {
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    z-index: 999;
    background: rgba(11, 31, 58, .98);
    padding: 1.5rem 20px;
    transform: translateX(100%);
    transition: transform .35s ease;
    overflow-y: auto;
  }
  body.nav-open .navmenu { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  .navmenu ul { flex-direction: column; align-items: stretch; gap: .35rem; }
  .navmenu a { font-size: 1.1rem; padding: .9rem 1.1rem; border-radius: 12px; }
  .navmenu a:hover, .navmenu a.active { background: rgba(255, 255, 255, .08); }
  .navmenu a.active:not(.nav-cta)::after { display: none; }
  .navmenu a.nav-cta { margin: .75rem 0 0; text-align: center; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  color: #fff;
  overflow: hidden;
  background: var(--navy);
}
.hero .carousel, .hero .carousel-inner, .hero .carousel-item { position: absolute; inset: 0; height: 100%; }
.hero .carousel-item img { width: 100%; height: 100%; object-fit: cover; }
.hero .carousel-item.active img { animation: kenburns 9s ease-out both; }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(11, 31, 58, .92) 0%, rgba(11, 31, 58, .72) 45%, rgba(11, 31, 58, .25) 100%);
  z-index: 1;
}
.hero-content { position: relative; z-index: 2; padding-top: calc(var(--header-h) + 2rem); padding-bottom: 10rem; }
.hero-text { max-width: 680px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  font-size: .85rem; font-weight: 600; letter-spacing: .5px;
  margin-bottom: 1.25rem;
}
.eyebrow i { color: var(--accent); }
.hero h1 { color: #fff; font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; margin-bottom: 1rem; }
.text-gradient {
  background: linear-gradient(90deg, var(--accent), #ffd27a, #6aa8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead { font-size: clamp(1rem, 2.2vw, 1.2rem); color: rgba(255, 255, 255, .88); margin-bottom: 2rem; }
.hero .lead strong { color: #fff; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.hero-controls {
  position: absolute; z-index: 3;
  left: 0; right: 0; bottom: 5.5rem; /* au-dessus du bloc des chiffres */
  margin: 0 auto;
  display: flex; gap: .75rem; justify-content: flex-end;
}
.hero-controls button {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85);
  background: rgba(11, 31, 58, .55);
  color: #fff; font-size: 1.3rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.hero-controls button:hover { background: var(--accent); color: var(--navy); border-color: var(--accent); }

@media (max-width: 575px) {
  .hero-actions a { flex: 1 1 100%; }
  .hero-controls { justify-content: center; bottom: 4rem; }
  .hero-content { padding-bottom: 9rem; }
}

/* ---------- Stats ---------- */
.stats { position: relative; z-index: 5; margin-top: -3.5rem; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.stat { display: flex; align-items: center; gap: 1rem; padding: 1.75rem 2rem; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat > i {
  flex-shrink: 0;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: rgba(29, 95, 209, .1);
  color: var(--blue);
  font-size: 1.6rem;
}
.stat span, .stat b { font-family: var(--font-head); font-weight: 800; font-size: 2.2rem; color: var(--navy); line-height: 1; }
.stat b { color: var(--accent); }
.stat p { margin: .3rem 0 0; color: var(--muted); font-weight: 600; font-size: .92rem; }

@media (max-width: 767px) {
  .stats { margin-top: -2.5rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat { padding: 1.1rem 1.4rem; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--border); }
  .stat span, .stat b { font-size: 1.8rem; }
}

/* ---------- Sections ---------- */
.section { padding: 90px 0; }
.section-alt { background: var(--bg-alt); }
#Services { padding-top: 80px; }

.section-title { text-align: center; max-width: 720px; margin: 0 auto 3rem; }
.kicker {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: .5rem;
}
.section-title h2, .why-intro h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; position: relative; }
.section-title p { color: var(--muted); font-size: 1.05rem; margin: 0; }

@media (max-width: 767px) {
  .section { padding: 64px 0; }
  .section-title { margin-bottom: 2rem; }
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}
@media (max-width: 380px) { .services-grid { grid-template-columns: 1fr; } }

.service-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .3s, box-shadow .3s;
}
.service-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.service-img { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-alt); }
.service-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.service-card:hover .service-img img { transform: scale(1.07); }
.service-icon {
  position: absolute;
  left: 1rem; bottom: 1rem;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: var(--navy);
  font-size: 1.4rem;
  box-shadow: 0 8px 18px rgba(245, 165, 36, .4);
}
.service-body { padding: 1.5rem 1.5rem 1.6rem; flex: 1; }
.service-body h3 { font-size: 1.15rem; font-weight: 700; }
.service-body ul { list-style: none; margin: 0; padding: 0; }
.service-body li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: .45rem;
  font-size: .94rem;
  color: var(--text);
}
.service-body li::before {
  content: "";
  position: absolute;
  left: 0; top: .6em;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

.service-cta {
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-2) 100%);
  color: rgba(255, 255, 255, .85);
  padding: 2.5rem 2rem;
  justify-content: center;
  border: 0;
}
.service-cta > i { font-size: 2.5rem; color: var(--accent); margin-bottom: 1rem; }
.service-cta h3 { color: #fff; font-size: 1.5rem; }
.service-cta p { margin-bottom: 1.5rem; }
.service-cta .btn-main { align-self: flex-start; }

/* ---------- Organisation ---------- */
.org-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 2rem;
}
.org-tab {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .92rem;
  text-align: left;
  cursor: pointer;
  transition: all .25s;
}
.org-tab i { font-size: 1.3rem; color: var(--blue); transition: color .25s; }
.org-tab:hover { border-color: var(--blue); }
.org-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: var(--shadow); }
.org-tab.active i { color: var(--accent); }

.org-content { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.org-pane { display: grid; grid-template-columns: 1.1fr 1fr; align-items: stretch; }
.org-text { padding: 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.org-text h3 { font-size: 1.4rem; font-weight: 800; }
.org-img { min-height: 320px; }
.org-img img { width: 100%; height: 100%; object-fit: cover; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { position: relative; padding-left: 2.1rem; margin-bottom: 1rem; }
.check-list li::before {
  content: "\F26E";
  font-family: "bootstrap-icons";
  position: absolute;
  left: 0; top: 0;
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(245, 165, 36, .18);
  color: var(--accent-dark);
  font-size: 1rem;
}

@media (max-width: 991px) {
  .org-tabs { grid-template-columns: repeat(2, 1fr); }
  .org-pane { grid-template-columns: 1fr; }
  .org-img { order: -1; min-height: 0; aspect-ratio: 16 / 9; }
  .org-text { padding: 1.75rem; }
}
@media (max-width: 420px) {
  .org-tab { flex-direction: column; text-align: center; font-size: .82rem; padding: .85rem .5rem; gap: .3rem; }
}

/* ---------- Projets ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.project {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
}
.project img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.project-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 3rem 1.25rem 1.1rem;
  background: linear-gradient(to top, rgba(11, 31, 58, .92), rgba(11, 31, 58, 0));
  color: #fff;
}
.project-info span { font-size: .75rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
.project-info h4 { color: #fff; font-size: 1.05rem; margin: .2rem 2.5rem 0 0; }
.project-info i {
  position: absolute;
  right: 1.1rem; bottom: 1.1rem;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--navy);
  opacity: 0;
  transform: scale(.6);
  transition: all .3s;
}
.project:hover img { transform: scale(1.08); }
.project:hover .project-info i { opacity: 1; transform: scale(1); }
@media (hover: none) { .project-info i { opacity: 1; transform: none; } }

@media (max-width: 991px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .projects-grid { grid-template-columns: 1fr; } }

/* ---------- Pourquoi Nous ---------- */
.section-dark {
  background:
    radial-gradient(circle at 10% 20%, rgba(29, 95, 209, .35), transparent 45%),
    linear-gradient(145deg, var(--navy) 0%, #081629 100%);
  color: rgba(255, 255, 255, .8);
}
.why-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; align-items: start; }
.why-intro { position: sticky; top: calc(var(--header-h) + 2rem); }
.why-intro h2 { color: #fff; }
.why-intro .kicker { color: var(--accent); }
.why-intro p { font-size: 1.05rem; margin-bottom: 1.75rem; }

.why-list details {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  border-radius: 14px;
  margin-bottom: .9rem;
  transition: background .25s, border-color .25s;
}
.why-list details[open] { background: rgba(255, 255, 255, .08); border-color: rgba(245, 165, 36, .5); }
.why-list summary {
  list-style: none;
  cursor: pointer;
  padding: 1.15rem 3.25rem 1.15rem 1.25rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.08rem;
  color: #fff;
  position: relative;
  display: flex; align-items: center; gap: 1rem;
}
.why-list summary::-webkit-details-marker { display: none; }
.why-list summary::after {
  content: "\F282";
  font-family: "bootstrap-icons";
  position: absolute;
  right: 1.25rem; top: 50%;
  transform: translateY(-50%);
  transition: transform .3s;
  color: var(--accent);
}
.why-list details[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.why-list .num { font-weight: 800; color: var(--accent); font-size: .95rem; }
.why-list details p { padding: 0 1.25rem 1.25rem 3.35rem; margin: 0; }
.why-list strong { color: #fff; }

@media (max-width: 991px) {
  .why-grid { grid-template-columns: 1fr; gap: 2rem; }
  .why-intro { position: static; text-align: center; }
  .why-list details p { padding-left: 1.25rem; }
}

/* ---------- Clients ---------- */
.client-logo {
  height: 110px;
  display: grid; place-items: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.client-logo img {
  max-height: 70px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: .7;
  transition: all .3s;
}
.client-logo:hover img { filter: none; opacity: 1; }
.clients .swiper { padding-bottom: 3rem; }
.clients .swiper-pagination-bullet { background: var(--navy); opacity: .25; }
.clients .swiper-pagination-bullet-active { background: var(--accent); opacity: 1; }

/* ---------- Footer / Contact ---------- */
.site-footer { background: #081629; color: rgba(255, 255, 255, .7); padding-top: 70px; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 1.3fr; gap: 2.5rem; padding-bottom: 50px; }
.footer-help { color: rgba(255, 255, 255, .85); }
.footer-help strong { color: var(--accent); }
.footer-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1rem !important; }
.footer-contact li { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: 1rem; }
.footer-contact li > i {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: var(--accent);
  font-size: 1.1rem;
  margin: 0 !important;
}
.footer-contact strong { display: block; color: #fff; font-family: var(--font-head); font-weight: 600; font-size: .9rem; }
.footer-contact span { word-break: break-word; }
.map-wrap { border-radius: 14px; overflow: hidden; line-height: 0; border: 1px solid rgba(255, 255, 255, .1); }
.map-wrap iframe { width: 100%; height: 240px; border: 0; }

@media (max-width: 991px) and (min-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:last-child { grid-column: 1 / -1; }
}
.site-footer .brand { margin-bottom: 1rem; }
.site-footer h4 { color: #fff; font-size: 1.05rem; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .55rem; }
.site-footer li i { color: var(--accent); margin-right: .4rem; }
.site-footer a { color: rgba(255, 255, 255, .75); }
.site-footer a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); text-align: center; padding: 1.25rem 20px; }
.footer-bottom p { margin: 0; font-size: .88rem; }

@media (max-width: 767px) { .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; } }

/* ---------- Bouton retour en haut ---------- */
.scroll-top {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--navy);
  font-size: 1.8rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all .3s;
}
.scroll-top.active { opacity: 1; visibility: visible; transform: none; }
.scroll-top:hover { background: var(--navy); color: #fff; }

/* ---------- Accessibilité ---------- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
