/* ==========================================================================
   EMcilBalance — corporate site stylesheet
   Theme: red + white (clean / corporate)
   Bilingual: French (LTR, default) + Arabic (RTL)
   No frameworks — hand-written, mobile-first.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --red: #c8102e;
  --red-dark: #9b0c23;
  --red-soft: #fdecef;
  --ink: #1a1a1a;
  --slate: #4a4f57;
  --muted: #6b727c;
  --line: #e7e9ed;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --white: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow: 0 10px 25px rgba(16, 24, 40, .08), 0 4px 10px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 50px rgba(16, 24, 40, .14);

  --maxw: 1180px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --font-latin: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-arabic: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font: var(--font-latin);

  --header-h: 72px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
}
:lang(ar), [dir="rtl"] body, [dir="rtl"] { --font: var(--font-arabic); }
[dir="rtl"] body { font-family: var(--font-arabic); }

img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; color: var(--ink); }
p { margin: 0 0 1rem; color: var(--slate); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section--alt { background: var(--bg-alt); }
.section--dark {
  background: #161a20 url("../img/bg-geometric.jpg") center/cover no-repeat;
  background-blend-mode: multiply;
  color: #fff;
}
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark p { color: #d4d7dd; }

.section-head { max-width: 720px; margin-bottom: 2.6rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: .7rem;
}
.section--dark .eyebrow { color: #ff6b80; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }
.lead { font-size: 1.12rem; color: var(--slate); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.5rem;
  font: inherit; font-weight: 600;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 8px 18px rgba(200, 16, 46, .28); }
.btn--primary:hover { background: var(--red-dark); box-shadow: 0 12px 24px rgba(200, 16, 46, .34); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.btn--outline { background: transparent; color: var(--red); border-color: var(--red); }
.btn--outline:hover { background: var(--red); color: #fff; }
.btn--lg { padding: 1rem 1.9rem; font-size: 1.05rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 1.2rem;
  min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.18rem; letter-spacing: -.01em; }
.brand .logo-mark { width: 38px; height: 38px; flex: 0 0 auto; }
.brand b { color: var(--red); }
.brand small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }

.main-nav { margin-inline-start: auto; }
.main-nav ul { display: flex; align-items: center; gap: .35rem; }
.main-nav a {
  display: block; padding: .55rem .9rem; border-radius: 999px;
  font-weight: 600; font-size: .96rem; color: var(--slate);
  transition: color .15s ease, background .15s ease;
}
.main-nav a:hover { color: var(--red); }
.main-nav a.active { color: var(--red); background: var(--red-soft); }

.header-actions { display: flex; align-items: center; gap: .6rem; }

/* language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  font: inherit; font-weight: 700; font-size: .82rem;
  padding: .4rem .8rem; border: 0; background: #fff; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-switch button[aria-pressed="true"] { background: var(--red); color: #fff; }

/* hamburger */
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line);
  background: #fff; border-radius: 10px; cursor: pointer; padding: 0;
  align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 20px; height: 2px; background: var(--ink); position: relative; transition: .25s;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; color: #fff;
  background: linear-gradient(rgba(20, 10, 12, .62), rgba(120, 8, 23, .72)),
              url("../img/pont-bascule.jpg") center/cover no-repeat;
}
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.35)); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; padding: clamp(3.5rem, 9vw, 7rem) 0; max-width: 760px; }
.hero h1 { color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.hero .lead { color: #f1e6e8; font-size: 1.2rem; max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 2.4rem; margin-top: 3rem; }
.hero-stats .num { font-size: 2rem; font-weight: 800; color: #fff; }
.hero-stats .lbl { font-size: .9rem; color: #e9d7da; }

.page-hero { background: var(--ink); color: #fff; position: relative; }
.page-hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(20,12,14,.78), rgba(110,8,22,.78)), url("../img/bg-geometric.jpg") center/cover;
  opacity: 1;
}
.page-hero .container { position: relative; z-index: 1; padding-block: clamp(2.6rem, 6vw, 4.5rem); }
.page-hero h1 { color: #fff; }
.page-hero p { color: #e7d9db; max-width: 640px; margin-bottom: 0; }
.breadcrumb { font-size: .85rem; color: #e6b8c0; margin-bottom: .8rem; }
.breadcrumb a:hover { color: #fff; }

/* ---------- Grid + cards ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #dfe2e8; }
.card .card-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-alt); }
.card .card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card .card-body { padding: 1.4rem 1.5rem 1.6rem; flex: 1; }
.card h3 { margin-bottom: .5rem; }
.card p { font-size: .96rem; margin-bottom: .9rem; }
.card-list { display: grid; gap: .4rem; }
.card-list li { position: relative; padding-inline-start: 1.4rem; font-size: .92rem; color: var(--slate); }
.card-list li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .55em;
  width: 8px; height: 8px; border-radius: 2px; background: var(--red); transform: rotate(45deg);
}

/* icon tile */
.icon-tile { width: 54px; height: 54px; border-radius: 14px; background: var(--red-soft); color: var(--red);
  display: grid; place-items: center; margin-bottom: 1rem; }
.section--dark .icon-tile { background: rgba(255, 107, 128, .15); color: #ff8095; }
.icon-tile svg { width: 28px; height: 28px; }

.feature { padding: 1.6rem; }
.feature h3 { font-size: 1.08rem; }
.feature p { font-size: .95rem; margin-bottom: 0; }

/* ---------- Split / media rows ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.split img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }
.split .checklist { display: grid; gap: .7rem; margin: 1.2rem 0; }
.checklist li { position: relative; padding-inline-start: 2rem; color: var(--slate); }
.checklist li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .15em;
  width: 22px; height: 22px; border-radius: 50%; background: var(--red-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 14px;
}

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.gallery figure { margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); position: relative; background: var(--bg-alt); }
.gallery img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; transition: transform .4s ease; }
.gallery figure:hover img { transform: scale(1.06); }
.gallery figcaption {
  position: absolute; inset-inline: 0; bottom: 0; padding: 1.4rem 1rem .8rem;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-size: .9rem; font-weight: 600;
}

/* ---------- CTA band ---------- */
.cta-band { background: var(--red); color: #fff; border-radius: var(--radius); padding: clamp(2rem, 5vw, 3.2rem); text-align: center; box-shadow: var(--shadow); }
.cta-band h2 { color: #fff; }
.cta-band p { color: #ffe2e7; max-width: 560px; margin-inline: auto; }
.cta-band .btn--primary { background: #fff; color: var(--red); box-shadow: none; }
.cta-band .btn--primary:hover { background: #fff2f4; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.info-list { display: grid; gap: 1.2rem; margin-top: 1.4rem; }
.info-item { display: flex; gap: 1rem; align-items: flex-start; }
.info-item .icon-tile { width: 46px; height: 46px; margin: 0; flex: 0 0 auto; }
.info-item .icon-tile svg { width: 22px; height: 22px; }
.info-item h3 { font-size: 1rem; margin-bottom: .15rem; }
.info-item p { margin: 0; font-size: .96rem; }
.placeholder { color: var(--red); font-weight: 600; }

form.contact-form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; padding: .8rem .9rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); outline: none; }
.field textarea { min-height: 130px; resize: vertical; }
.map-embed { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); margin-top: 1.6rem; aspect-ratio: 16/7; background: var(--bg-alt); display: grid; place-items: center; text-align: center; color: var(--muted); padding: 1rem; }

/* ---------- Partners ---------- */
.partners { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2.5rem; }
.partners img { height: 72px; width: auto; opacity: .9; filter: saturate(1); }
.partners figcaption { font-size: .8rem; color: var(--muted); text-align: center; margin-top: .4rem; }

/* ---------- Footer ---------- */
.site-footer { background: #12151a; color: #c5cad3; padding-top: clamp(2.5rem, 6vw, 4rem); }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 2rem; }
.site-footer a { color: #c5cad3; transition: color .15s; }
.site-footer a:hover { color: #fff; }
.site-footer .brand { color: #fff; margin-bottom: 1rem; }
.site-footer .brand small { color: #8b93a0; }
.footer-links li { margin-bottom: .55rem; }
.footer-contact li { display: flex; gap: .6rem; margin-bottom: .7rem; font-size: .92rem; }
.footer-contact svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--red); margin-top: .2rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 2.5rem; padding: 1.3rem 0; font-size: .85rem; color: #8b93a0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- RTL adjustments ---------- */
[dir="rtl"] .main-nav { margin-inline-start: auto; }
[dir="rtl"] .hero, [dir="rtl"] .page-hero { text-align: right; }
[dir="rtl"] .gallery figcaption,
[dir="rtl"] .card-body { text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; margin: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); transform: translateY(-130%); transition: transform .28s ease;
    max-height: calc(100vh - var(--header-h)); overflow: auto;
  }
  .nav-open .main-nav { transform: translateY(0); }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: .6rem var(--gutter) 1.2rem; }
  .main-nav a { padding: .9rem .6rem; border-radius: 10px; }
  .header-inner { justify-content: space-between; }
  .header-actions { margin-inline-start: auto; }
  .split, .contact-grid, .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .split .split-media { order: -1; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.4rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand small { display: none; }
}
