:root {
  --primary: #59457A;
  --secondary: #BFB5CE;
  --card-bg: #FFFFFF;
  --border-color: rgba(89, 69, 122, 0.12);
  --text-dark: #2C2C2C;
  --text-light: #5A5A5A;
  --hero-text-color: #2C2C2C;
  --accent-light: #F9F8FB;
  --shadow-soft: 0 4px 20px rgba(89, 69, 122, 0.08);
  --shadow-medium: 0 8px 30px rgba(89, 69, 122, 0.12);
  /* iOS safe areas (fallbacks included) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --header-offset: 150px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-dark);
  background-color: #ffffff;
  line-height: 1.8;
  font-size: 16px;
}

/* Header - Glassmorphism moderne et élégant avec meilleure lisibilité */
#header {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(89, 69, 122, 0.15);
  padding: 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 2px 20px rgba(89, 69, 122, 0.08);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

.logo {
  display: flex;
  align-items: center;
  line-height: 0;
  margin: 0;
  padding: 0;
}

.logo a {
  display: block;
  line-height: 0;
  margin: 0;
  padding: 0;
}

.logo img {
  height: 150px;
  width: auto;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 8px rgba(89, 69, 122, 0.15));
  display: block;
  margin: 0;
  padding: 0;
  vertical-align: top;
}

.logo img:hover {
  filter: drop-shadow(0 4px 12px rgba(89, 69, 122, 0.25));
}

.navbar ul {
  display: flex;
  list-style: none;
  gap: 45px;
}

.navbar a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 0;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.navbar a:hover,
.navbar a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  cursor: pointer;
}

.nav-toggle i {
  font-size: 1.6rem;
  line-height: 1;
  pointer-events: none;
}

body.nav-open {
  overflow: hidden;
}

body.nav-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 999;
}

/* Hero Section - Design moderne avec background subtil */
#hero-livre {
  background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.65)), url('../img/hero-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: calc(var(--header-offset) + 80px) clamp(16px, 4vw, 40px) clamp(80px, 12vh, 140px);
  min-height: 650px;
  border-bottom: none;
  position: relative;
}

#hero-livre::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(89, 69, 122, 0.2), transparent);
}

/* Zone de texte avec fond pour lisibilité */
#hero-livre .col-lg-6:first-child {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 45px;
  border-radius: 8px;
  border: 1px solid rgba(89, 69, 122, 0.12);
  box-shadow: 0 8px 32px rgba(89, 69, 122, 0.12);
}

/* Hero logo sizing */
.hero-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.hero-surtitle {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: 25px;
  color: var(--primary);
  font-weight: 500;
  font-style: italic;
}

.hero-title {
  font-size: 3.8rem;
  font-weight: 300;
  margin-bottom: 35px;
  line-height: 1.15;
  color: var(--text-dark);
  letter-spacing: -1.5px;
  max-width: 700px;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 45px;
  color: var(--text-dark);
  line-height: 1.8;
  font-weight: 300;
  max-width: 600px;
  opacity: 0.9;
}

.hero-cta-group {
  gap: 20px;
  display: flex;
  align-items: center;
}

.btn-get-started {
  display: inline-block;
  padding: 16px 40px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 15px rgba(89, 69, 122, 0.15);
}

.btn-primary-starter {
  background: var(--primary);
  color: white;
  border: 2px solid var(--primary);
}

.btn-primary-starter:hover {
  background: transparent;
  color: var(--primary);
  box-shadow: 0 6px 25px rgba(89, 69, 122, 0.25);
  transform: translateY(-2px);
}

.btn-ghost-starter {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-dark);
  border: 2px solid rgba(89, 69, 122, 0.2);
  backdrop-filter: blur(10px);
}

.btn-ghost-starter:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: white;
  box-shadow: 0 6px 25px rgba(89, 69, 122, 0.2);
}

.hero-note {
  font-size: 0.85rem;
  color: var(--text-dark);
  margin-top: 30px;
  font-style: italic;
  opacity: 0.8;
}

/* Sections - Design moderne et aéré avec backgrounds différenciés */
section {
  padding: clamp(70px, 8vw, 120px) clamp(16px, 4vw, 40px);
  background: white;
  scroll-margin-top: var(--header-offset);
}

.section-bg-light {
  background: linear-gradient(180deg, #F5F3F8 0%, #EDE9F2 100%);
}

.section-bg-white {
  background-color: #ffffff;
}

.section-bg-accent {
  background: linear-gradient(135deg, #F9F8FB 0%, #F0EDF5 100%);
}

.section-title {
  font-size: 2.4rem;
  font-weight: 300;
  color: var(--text-dark);
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 25px;
  letter-spacing: -0.8px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 70px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.section-title.text-center::after {
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

/* Service Cards - Design moderne et élégant */
.service-card {
  background: white;
  border-radius: 8px;
  padding: 45px 40px;
  box-shadow: var(--shadow-soft);
  transition: all 0.4s ease;
  height: 100%;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-medium);
  transform: translateY(-8px);
}

.service-card i {
  font-size: 2.8rem;
  color: var(--primary);
  margin-bottom: 28px;
  display: block;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.service-card:hover i {
  opacity: 1;
  transform: scale(1.1);
}

.service-card h3 {
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 22px;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.service-card ul {
  list-style: none;
  padding: 0;
}

.service-card ul li {
  padding: 14px 0;
  padding-left: 28px;
  position: relative;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-light);
  border-bottom: 1px solid rgba(89, 69, 122, 0.06);
}

.service-card ul li:last-child {
  border-bottom: none;
}

.service-card ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22px;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.7;
}

/* Contact Section */
#contact {
  background: white;
  border-top: 1px solid var(--border-color);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  margin-top: 60px;
}

.contact-info {
  background: white;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.contact-info h3 {
  color: var(--text-dark);
  font-size: 1.5rem;
  margin-bottom: 10px;
  font-weight: 300;
}

.contact-info h4 {
  color: var(--primary);
  font-size: 1rem;
  margin-bottom: 30px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.contact-info p {
  margin-bottom: 18px;
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.8;
}

.contact-info i {
  color: var(--primary);
  margin-right: 12px;
  font-size: 1.1rem;
}

.contact-map iframe {
  width: 100%;
  height: 450px;
  border-radius: 0;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

/* Étapes Section - Design moderne et fluide */
.etape-card {
  background: white;
  border-radius: 8px;
  padding: 40px 35px;
  box-shadow: var(--shadow-soft);
  transition: all 0.4s ease;
  height: 100%;
  display: flex;
  gap: 28px;
  align-items: start;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
}

.etape-card:hover {
  border-left-width: 5px;
  box-shadow: var(--shadow-medium);
  transform: translateX(5px);
}

.etape-icon {
  flex-shrink: 0;
  width: 65px;
  height: 65px;
  background: linear-gradient(135deg, rgba(89, 69, 122, 0.05), rgba(191, 181, 206, 0.1));
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.etape-card:hover .etape-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: var(--primary);
  transform: rotate(5deg);
}

.etape-icon i {
  font-size: 1.6rem;
  color: var(--primary);
  transition: color 0.3s ease;
}

.etape-card:hover .etape-icon i {
  color: white;
}

.etape-content h3 {
  font-size: 1.15rem;
  color: var(--text-dark);
  margin-bottom: 14px;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.etape-content p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.8;
  margin: 0;
}

/* Footer */
#footer {
  background: var(--primary);
  color: var(--text-light);
  padding: 30px 0;
  text-align: center;
}

#footer p {
  margin: 0;
}

/* Réalisations Section - Design moderne et sophistiqué */
.realisation-card-mini {
  background: white;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow-soft);
  transition: all 0.4s ease;
  overflow: hidden;
  height: 100%;
  border: 1px solid var(--border-color);
}

.realisation-card-mini:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-medium);
  transform: translateY(-8px);
}

.realisation-location-mini {
  background: linear-gradient(135deg, rgba(89, 69, 122, 0.03), rgba(191, 181, 206, 0.05));
  color: var(--text-dark);
  padding: 18px 20px;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.realisation-location-mini i {
  margin-right: 8px;
  color: var(--primary);
  font-size: 0.9rem;
}

.photo-wrapper-mini {
  position: relative;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;
}

.photo-wrapper-mini img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
  transition: all 0.4s ease;
  cursor: pointer;
}

.photo-wrapper-mini:hover img {
  transform: scale(1.02);
}

.photo-label {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--text-dark);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  z-index: 10;
  border: 1px solid;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.photo-label.avant {
  color: #a85858;
  border-color: #a85858;
}

.photo-label.apres {
  color: #5a8558;
  border-color: #5a8558;
}

.photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.photo-wrapper-mini:hover .photo-overlay {
  opacity: 1;
}

.photo-overlay i {
  font-size: 2.5rem;
  color: var(--primary);
}

.realisation-description-mini {
  padding: 22px 25px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  background: linear-gradient(180deg, white, rgba(89, 69, 122, 0.02));
}

.realisation-description-mini p {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .photo-wrapper-mini {
    padding: 20px;
  }
  
  .realisation-card-mini {
    margin-bottom: 25px;
  }
}

/* Footer - Sobre */
#footer {
  background: white;
  color: var(--text-light);
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

#footer p {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* Back to top button - Minimaliste */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: white;
  color: var(--primary);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  text-decoration: none;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  border: 1px solid var(--border-color);
}

.back-to-top:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
}

/* Responsive */
@media (max-width: 991px) {
  :root {
    /* Keep content from sliding under the fixed header on mobile */
    --header-offset: calc(80px + var(--safe-top));
  }

  #header {
    padding: calc(0px + var(--safe-top)) 0 0px;
    min-height: calc(80px + var(--safe-top));
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .header-container {
    position: relative;
    gap: 16px;
    padding: 0 calc(20px + var(--safe-right)) 0 calc(20px + var(--safe-left));
    max-width: 100%;
  }

  .nav-toggle {
    display: inline-flex;
    /* Keep it in the flex flow so header height never collapses */
    position: relative;
    margin-left: 12px;
    transform: none;
    z-index: 1002;
  }

  .logo {
    line-height: 0;
    margin: 0;
    padding: 0;
  }

  .logo a {
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
  }

  .logo img {
    height: 80px;
    margin: 0;
    padding: 0;
    vertical-align: top;
  }

  /* Mobile menu: fixed panel to avoid narrow/buggy widths */
  .navbar ul {
    display: none;
    position: fixed;
    top: 90px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: var(--shadow-soft);
    overflow: auto;
    z-index: 1001;
  }

  #navbar.nav-open ul {
    display: flex !important;
  }

  .navbar a {
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid rgba(89, 69, 122, 0.08);
    font-size: 1rem;
    letter-spacing: 0.4px;
    text-transform: none;
  }

  .navbar li:last-child a {
    border-bottom: none;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .section-title {
    font-size: 1.8rem;
  }
}

/* Very small screens: keep the logo, keep the toggle inside the viewport */
@media (max-width: 480px) {
  :root { --header-offset: calc(70px + var(--safe-top)); }

  .logo { 
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
  }
  
  .logo a {
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
  }
  
  .logo img { 
    height: 70px;
    margin: 0;
    padding: 0;
    vertical-align: top;
  }

  .header-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Landscape on phones/tablets: reduce clutter (hide logos + remove hero background) */
@media (max-width: 991px) and (orientation: landscape) {
  :root { --header-offset: calc(45px + var(--safe-top)); }

  #header {
    padding: calc(0px + var(--safe-top)) 0 0px;
    min-height: calc(45px + var(--safe-top));
  }

  /* Keep a small logo in landscape so the header doesn't look "empty" */
  #header .logo { 
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
  }
  
  #header .logo a {
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
  }
  
  #header .logo img { 
    height: 45px;
    margin: 0;
    padding: 0;
    vertical-align: top;
  }

  #hero-livre {
    background-image: none !important;
    background-color: #ffffff;
    padding: calc(var(--header-offset) + 16px) 16px 40px;
    min-height: auto;
  }

  #hero-livre .hero-visual { display: none; }
}

/* Mobile hero: remove background + hide big logo for vertical readability */
@media (max-width: 768px) {
  #hero-livre {
    background-image: none !important;
    background-color: #ffffff;
    padding: calc(var(--header-offset) + 24px) 16px 56px;
    min-height: auto;
  }

  /* Remove the heavy glass panel on small screens */
  #hero-livre .col-lg-6:first-child {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    box-shadow: none;
    padding: 18px 16px;
  }

  #hero-livre .row {
    text-align: center;
  }

  .hero-title,
  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
  }

  /* Hide the large hero logo/visual on mobile */
  #hero-livre .hero-visual {
    display: none;
  }
}
