/* ================================================================
   STEFELEC — Bootstrap 5 Theme
   Reproduction pixel-perfect de www.stefelec.be
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --sf-page-bg:       #fefee3;   /* Fond jaune très pâle - hors wrapper */
  --sf-sidebar-bg:    #ffffcc;   /* Sidebar gauche — même jaune        */
  --sf-content-bg:    #ffffff;   /* Zone de contenu blanche            */
  --sf-nav-link:      #fb6867;   /* Liens nav — rouge-orangé           */
  --sf-nav-active:    #0099cc;   /* Lien actif — cyan                  */
  --sf-nav-hover:     #fb6867;
  --sf-cat-title:     #fb6867;   /* Titres catégories réalisations      */
  --sf-footer-bg:     #1c1c1c;   /* Footer noir                        */
  --sf-footer-text:   #cccccc;
  --sf-footer-link:   #cccccc;
  --sf-btn-bg:        #33aacc;   /* Bouton Envoyer — cyan              */
  --sf-btn-hover:     #1188aa;
  --sf-text:          #222222;
  --sf-link:          #0066cc;
  --sf-border:        #dddddd;
  --sf-quote-border:  #eecc44;   /* Bordure gauche blockquote — jaune  */
  --sf-sidebar-w:     15%;
  --sf-container-max: 1280px;
  --sf-banner-h:      198px;
}

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

html, body {
  background: #fefee3;
  font-family: 'Open Sans', sans-serif !important;
  font-size: 14px;
  color: var(--sf-text);
  line-height: 1.6;
}

a { color: var(--sf-link); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin-bottom: 1.9rem; }
ul { padding-left: 1.5rem; margin-bottom: .9rem; }
li { margin-bottom: .2rem; }
h1, h2, h3 { color: var(--sf-text); }

/* ── Wrapper principal centré ───────────────────────────────── */
.sf-wrapper {
  max-width: var(--sf-container-max);
  margin: 0 auto;
  background: var(--sf-content-bg);
  box-shadow: 0 0 8px rgba(0,0,0,.15);
  /* La sidebar est jaune, donc le fond du wrapper peut rester blanc
     — la sidebar aura son propre fond */
}

/* ================================================================
   COMPOSANT 1 — BANNIÈRE AVEC TEXTE EN OVERLAP
   ================================================================
   Image de fond + titre du site (gauche, petit) + titre de page
   (droite, grand, bas). C'est LE composant "image avec texte en
   overlap" demandé.

   OpenCMS : <cms:include element="banner"/>
   Variables à passer : page-title, banner-image (url)
   ================================================================ */

.sf-banner {
  position: relative;
  width: 100%;
  height: var(--sf-banner-h);
  overflow: hidden;
  background-color: #333;
}

/* Image de fond chargée via JS avec referrerpolicy no-referrer
   pour contourner la protection hotlink.
   Mettre l URL dans data-src="..." sur le div .sf-banner__bg  */
.sf-banner__bg {
  position: absolute;
  inset: 0;
  background-color: #2a3a4a;
  background-size: cover;
  background-position: center 30%;
}

/* Dégradé sombre sur la gauche pour lisibilité du sous-titre */
.sf-banner__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(0,0,0,.55) 0%,
    rgba(0,0,0,.3)  40%,
    rgba(0,0,0,.05) 70%,
    transparent     100%
  );
}

/* Texte du site — petit, haut gauche */
.sf-banner__site-title {
  position: absolute;
  top: 18px;
  left: 16px;
  color: #ffffff;
  font-size: 24px;
  font-weight: normal;
  text-shadow: 1px 1px 3px rgba(0,0,0,.7);
  z-index: 2;
  max-width: 80%;
  line-height: 1.3;
}

/* Titre de page — grand, bas droite (OVERLAP sur l'image) */
.sf-banner__page-title {
  position: absolute;
  bottom: 18px;
  right: 24px;
  color: #ffffff;
  font-size: 3.5rem;
  font-weight: normal;
  text-shadow: 1px 2px 6px rgba(0,0,0,.5);
  z-index: 2;
  line-height: 1;
}

/* Variante : titre de page au centre-bas (accueil) */
.sf-banner__page-title--center {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

/* ================================================================
   COMPOSANT 2 — LAYOUT SIDEBAR + CONTENU
   ================================================================ */

.sf-layout {
  display: flex;
  align-items: stretch;
  min-height: 400px;
}

/* ── Sidebar gauche ─────────────────────────────────────────── */
.sf-sidebar {
  width: var(--sf-sidebar-w);
  min-width: var(--sf-sidebar-w);
  background: var(--sf-sidebar-bg);
  padding: 18px 24px 24px;
  border-right: 1px solid #e8e8b0;
}

/* Indicateur "Stefelec" en haut de la sidebar */
.sf-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 0;
}
.sf-sidebar__brand-bar {
  width: 4px;
  height: 18px;
  background: #0099cc;
  border-radius: 1px;
  flex-shrink: 0;
}
.sf-sidebar__brand-name {
  font-size: 13px;
  font-weight: normal;
  color: #333;
}

/* Navigation verticale */
.sf-sidebar__nav {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.sf-sidebar__nav li {
  margin-bottom: 12px;
}
.sf-sidebar__nav li a {
  display: block;
  padding: 5px 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--sf-nav-link);
  text-decoration: none;
  transition: color .15s;
}
.sf-sidebar__nav li a:hover {
  color: var(--sf-nav-hover);
  text-decoration: underline;
}
.sf-sidebar__nav li a.active {
  color: var(--sf-nav-active);
  text-decoration: none;
}

/* Logo Stefelec dans la sidebar */
.sf-sidebar__logo {
  display: block;
  margin-top: 8px;
}
.sf-sidebar__logo img {
  max-width: 120px;
  height: auto;
  display: block;
}

/* ── Zone de contenu ────────────────────────────────────────── */
.sf-content {
  flex: 1;
  background: var(--sf-content-bg);
  padding: 22px 26px 32px;
  min-width: 0;
}

/* Titre h1 page (dans le contenu, ex : "Présentation") */
.sf-content h1 {
  font-size: 22px;
  font-weight: bold;
  color: var(--sf-text);
  margin-bottom: 14px;
}

/* ================================================================
   COMPOSANT 3 — GALERIE DE RÉALISATIONS
   ================================================================ */

/* Titre de catégorie (rouge-orangé, comme sur le site) */
.sf-gallery-cat-title {
  color: var(--sf-cat-title);
  font-size: 14px;
  font-weight: bold;
  margin: 22px 0 10px;
  padding: 0;
}

/* Grille d'images — flex-wrap, hauteur fixe */
.sf-gallery-row {
  display: grid;                                    /* flex → grid          */
  grid-template-columns: repeat(var(--sf-cols, 4), 1fr); /* nb colonnes via variable */
  gap: 6px;                                         /* 5px → 6px            */
  margin-bottom: 14px;                              /* 10px → 14px          */
}

/* Les 4 variantes data-cols="2|3|4|5" fixent la variable CSS */
.sf-gallery-row[data-cols="2"] { --sf-cols: 2; }
.sf-gallery-row[data-cols="3"] { --sf-cols: 3; }
.sf-gallery-row[data-cols="4"] { --sf-cols: 4; }
.sf-gallery-row[data-cols="5"] { --sf-cols: 5; }

.sf-gallery-row figure {
  margin: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid #ddd;
  background: #f0f0f0;
  aspect-ratio: 4/3;         /* NOUVEAU — ratio fixe pour aligner les cellules */
}
.sf-gallery-row figure img {
  display: block;
  width: 100%;               /* auto → 100%  (occupe toute la cellule grid)  */
  height: 100%;              /* 150px fixe → 100% (s'adapte au ratio)        */
  object-fit: cover;
  transition: opacity .2s;
  /* max-width: 300px supprimé — inutile avec grid 1fr */
}
.sf-gallery-row figure:hover img {
  opacity: .85;
}

/* Intro texte réalisations */
.sf-gallery-intro {
  font-size: 13px;
  margin-bottom: 6px;
}

/* Lightbox */
.sf-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.sf-lightbox.open { display: flex; }
.sf-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  border: 2px solid #555;
}
.sf-lightbox__close {
  position: absolute;
  top: .8rem;
  right: 1.2rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: .75;
}
.sf-lightbox__close:hover { opacity: 1; }

/* ================================================================
   COMPOSANT 4 — TÉMOIGNAGES
   ================================================================ */

.sf-testimonial {
  border-left: 5px solid var(--sf-quote-border);
  padding: 10px 14px;
  margin-bottom: 22px;
  background: #fff;
}
.sf-testimonial p {
  font-style: italic;
  font-size: 13px;
  color: #222;
  margin-bottom: .4rem;
}
.sf-testimonial .sf-testimonial__author {
  font-style: italic;
  color: var(--sf-cat-title);
  font-size: 12.5px;
  margin-top: 6px;
  display: block;
}
.sf-testimonial .sf-testimonial__author::before {
  content: '— ';
}

/* ================================================================
   COMPOSANT 5 — CONTACT
   ================================================================ */

.sf-contact-heading {
  color: var(--sf-cat-title);
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
}
.sf-contact-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}
.sf-contact-cols .sf-contact-col {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  line-height: 1.9;
}

.sf-contact-hr {
  border: none;
  border-top: 1px solid var(--sf-border);
  margin: 14px 0 18px;
}

/* Formulaire contact */
.sf-form-row {
  margin-bottom: 12px;
}
.sf-form-row label {
  display: block;
  font-size: 13px;
  color: #333;
  margin-bottom: 4px;
}
.sf-form-row input[type="text"],
.sf-form-row input[type="email"],
.sf-form-row textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  border: 1px solid #aaa;
  border-radius: 2px;
  background: #fff;
  color: #222;
  outline: none;
  transition: border-color .2s;
}
.sf-form-row input:focus,
.sf-form-row textarea:focus {
  border-color: #0099cc;
}
.sf-form-row textarea {
  height: 140px;
  resize: vertical;
}
.sf-btn-envoyer {
  display: inline-block;
  background: var(--sf-btn-bg);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  font-family: Arial, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 7px 18px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background .2s;
}
.sf-btn-envoyer:hover { background: var(--sf-btn-hover); }

/* ================================================================
   COMPOSANT 6 — FOOTER
   ================================================================ */

.sf-footer {
  background: var(--sf-footer-bg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.sf-footer__copy {
  color: var(--sf-footer-text);
  font-size: 12px;
}
.sf-footer__copy a {
  color: var(--sf-footer-link);
  text-decoration: underline;
}
.sf-footer__nav {
  display: flex;
  align-items: center;
  gap: 0;
}
.sf-footer__nav a {
  color: var(--sf-footer-link);
  font-size: 12px;
  text-decoration: none;
  padding: 0 6px;
  transition: color .15s;
}
.sf-footer__nav a:hover { color: #fff; text-decoration: underline; }
.sf-footer__nav .sf-footer__sep {
  color: #666;
  font-size: 12px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 700px) {
  .sf-layout {
    flex-direction: column;
  }
  .sf-sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e8e8b0;
    padding: 12px 16px;
  }
  .sf-sidebar__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
    margin-bottom: 10px;
  }
  .sf-sidebar__logo { display: none; }
  .sf-banner__page-title { font-size: 1.6rem; }
  .sf-footer {
    flex-direction: column;
    text-align: center;
  }
  .sf-footer__nav { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 480px) {
  :root { --sf-banner-h: 110px; }
  .sf-content { padding: 14px 14px 24px; }
}
@media (max-width: 600px) {
  .sf-gallery-row { --sf-cols: 2 !important; }
}
@media (max-width: 360px) {
  .sf-gallery-row { --sf-cols: 1 !important; }
}