/*
 * globals.css — Styles globaux SAM
 *
 * Structure :
 *   1. Variables & Reset
 *   2. Typographie & Boutons       → réutilisables partout
 *   3. Layout utilitaires          → .container
 *   4. Header & Hero               → deviendra components/HeroSection.module.css
 *   5. Intro Section               → deviendra components/IntroSection.module.css
 *   6. Addresses / Carousel        → deviendra components/Carousel.module.css
 *   7. Card                        → deviendra components/Card.module.css
 *   8. Stats Section               → deviendra components/StatsSection.module.css
 *   9. Feature Split Section       → deviendra components/FeatureSection.module.css
 *  10. Responsive
 */

/* ─────────────────────────────────────────────
   1. VARIABLES & RESET
───────────────────────────────────────────── */
:root {
  --bg-color: #fcf8f6;
  --text-dark: #3e2723;
  --text-light: #ffffff;
  --primary-color: #8c5a46;
  --primary-hover: #6d4433;
  --card-bg: #f4ece8;
  --border-color: #d7c9c3;

  --font-title: "Playfair Display", serif;
  --font-text: "Lato", sans-serif;
  --font-script: "Alex Brush", cursive;
}

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

body {
  font-family: var(--font-text);
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}
ul {
  list-style: none;
}

/* ─────────────────────────────────────────────
   2. TYPOGRAPHIE & BOUTONS
───────────────────────────────────────────── */
h1,
h2,
h3 {
  font-family: var(--font-title);
  font-weight: 600;
}

.script-text {
  font-family: var(--font-script);
  font-size: 2rem;
  color: var(--primary-color);
}
.script-text--sm {
  font-size: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background-color: var(--primary-color);
  color: var(--text-light);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Bouton discret (fond clair, bordure) — ex: "Découvrir les opportunités" */
.btn-soft {
  background-color: var(--card-bg);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}
.btn-soft:hover {
  background-color: rgba(140, 90, 70, 0.1);
}

.btn-outline {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-dark);
}
.btn-outline:hover {
  background-color: rgba(140, 90, 70, 0.1);
}

/* Variante compacte — ex: bouton dans les cards */
.btn-outline--sm {
  padding: 6px 15px;
  font-size: 0.8rem;
}

/* ─────────────────────────────────────────────
   3. LAYOUT UTILITAIRES
───────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─────────────────────────────────────────────
   HEADER PAGES INTÉRIEURES (partagé)
   → deviendra components/SiteHeader.module.css
───────────────────────────────────────────── */
.site-header {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  display: block;
  top: 0;
  z-index: 100;
  padding: 0;
  width: 100%;
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  max-width: none;
  margin: 0;
}

.site-header nav > ul {
  display: flex;
  gap: 30px;
  font-size: 0.9rem;
  align-items: center;
}
.site-header nav a {
  color: var(--text-dark);
}
.site-header nav a:hover {
  opacity: 0.7;
}
.site-header nav a.active {
  color: var(--primary-color);
  font-weight: 700;
}
/* Nav — menu Administration (injecté par auth.js si rôle admin) */
.nav-admin-dropdown {
  position: relative;
}
.nav-admin-toggle {
  background: none;
  border: 1px dashed var(--border-color);
  border-radius: 20px;
  font-family: var(--font-text);
  font-size: 0.75rem;
  color: #a08a84;
  padding: 3px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.nav-admin-toggle:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.nav-admin-dropdown .nav-admin-submenu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-width: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 200;
  padding: 14px 0 6px;
  list-style: none;
}
/* ouverture gérée par auth.js (mouseenter/mouseleave) */
.nav-admin-submenu li a {
  display: block;
  padding: 9px 18px;
  font-size: 0.85rem;
  color: var(--text-dark);
  transition:
    background 0.15s,
    color 0.15s;
  opacity: 1;
}
.nav-admin-submenu li a:hover {
  background: var(--card-bg);
  color: var(--primary-color);
  opacity: 1;
}

/* Nav — zone connexion */
.nav-auth-link {
  font-size: 0.85rem;
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-dark);
  transition: all 0.2s;
}
.nav-auth-link:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  opacity: 1;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-user-logout {
  font-family: var(--font-text);
  font-size: 0.8rem;
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  opacity: 0.6;
  padding: 0;
}
.nav-user-logout:hover {
  opacity: 1;
  color: var(--primary-color);
}

/* Nav — menu À propos (dropdown CSS hover) */
.nav-apropos-dropdown {
  position: relative;
}
.nav-apropos-toggle {
  background: none;
  border: none;
  font-family: var(--font-text);
  font-size: 0.9rem;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  transition: opacity 0.2s;
}
.nav-apropos-toggle:hover {
  opacity: 0.7;
}
.nav-apropos-dropdown:hover .nav-apropos-submenu,
.nav-apropos-dropdown:focus-within .nav-apropos-submenu {
  display: block;
}
/* Pont invisible qui couvre le gap entre le bouton et le sous-menu */
.nav-apropos-dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: -10px;
  right: -10px;
  height: 14px;
}
.nav-apropos-dropdown .nav-apropos-submenu {
  display: none;
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-width: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 200;
  padding: 8px 0;
  list-style: none;
  gap: 0;
}
.nav-apropos-submenu li a {
  display: block;
  padding: 9px 18px;
  font-size: 0.85rem;
  color: var(--text-dark);
  transition:
    background 0.15s,
    color 0.15s;
  opacity: 1;
}
.nav-apropos-submenu li a:hover,
.nav-apropos-submenu li a.active {
  background: var(--card-bg);
  color: var(--primary-color);
  opacity: 1;
}

/* ─────────────────────────────────────────────
   4. HEADER & HERO
   → deviendra components/HeroSection.module.css
───────────────────────────────────────────── */
.hero-section {
  position: relative;
  min-height: 90vh;
  overflow: hidden;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
}

/* ── Ken Burns Slideshow ───────────────────────────── */
.hero-slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  will-change: transform, opacity;
}

.hero-slide.is-active {
  opacity: 1;
  animation: kenBurns 7s ease-out forwards;
}

@keyframes kenBurns {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.18);
  }
}

/* Overlay gradient brun sur les slides */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    rgba(62, 39, 35, 0.55),
    rgba(62, 39, 35, 0.2)
  );
  pointer-events: none;
}

/* Flash lumineux entre transitions — bloom cinématographique */
#hero-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

/* Header et contenu au-dessus de l'overlay */
.hero-section > .hero-content {
  position: relative;
  z-index: 2;
}
/* Header au-dessus de hero-content pour que le sous-menu admin soit cliquable */
.hero-section > header {
  position: relative;
  z-index: 4;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 10;
}

.logo {
  font-family: var(--font-text);
  font-size: 1.5rem;
  letter-spacing: 2px;
  font-weight: 300;
}

.logo-svg {
  height: 2.5rem;
  width: auto;
  display: block;
}

/* Logo SAM inline dans h1 et bandeaux décoratifs */
.sam-brand-img {
  height: 3.5rem;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

h1 .sam-brand-img {
  height: 3.5rem;
}

.hero-decoration .sam-brand-img {
  height: 1.4rem;
  vertical-align: middle;
}

.script-text--sm .sam-brand-img {
  height: 1.3rem;
  vertical-align: middle;
  position: relative;
  top: 1px;
}

nav > ul {
  display: flex;
  gap: 30px;
  font-size: 0.9rem;
  align-items: center;
}
nav a:hover {
  opacity: 0.8;
}

.hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
}
.hero-content h1 {
  font-size: 3.5rem;
  margin-bottom: 10px;
  font-weight: 400;
}
.hero-content .subtitle {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 2.5rem;
  margin-bottom: 30px;
  font-weight: 300;
}

.hero-decoration {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 15px;
}
/* Variante alignée à gauche — ex: section feature */
.hero-decoration--left {
  justify-content: flex-start;
}

.line {
  height: 1px;
  width: 60px;
  background-color: var(--text-light);
  opacity: 0.6;
}
/* Variante couleur primaire — ex: section feature */
.line--primary {
  background-color: var(--primary-color);
  opacity: 1;
}

.hero-decoration .script-text {
  color: var(--text-light);
  font-size: 1.8rem;
}
.hero-decoration--left .script-text {
  color: var(--text-dark);
}

/* ─────────────────────────────────────────────
   5. INTRO SECTION — autoplay animation (IntersectionObserver)
   → deviendra components/IntroSection.module.css
───────────────────────────────────────────── */

/* Section normale — animation déclenchée à l'entrée dans le viewport */
.intro-section {
  position: relative;
  height: 100vh;
}

.intro-section__inner {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  overflow: hidden;
}

/* Colonne gauche — mascotte animée (~38%) */
.intro-mascotte {
  flex: 0 0 38%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-mascotte img {
  max-height: 80vh;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Colonne droite — texte */
.intro-content {
  flex: 1;
  text-align: center;
  padding: 0 20px;
}

.intro-section h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
}
.intro-section p {
  max-width: 520px;
  margin: 0 auto;
  font-size: 1.1rem;
  color: #555;
}

.intro-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.intro-decoration {
  margin-top: 36px;
  justify-content: center;
}
.intro-decoration .script-text {
  color: var(--text-dark);
}

/* ─────────────────────────────────────────────
   6. ADDRESSES / CAROUSEL
   → deviendra components/Carousel.module.css
───────────────────────────────────────────── */
.addresses-section {
  padding: 40px 20px 80px;
  text-align: center;
}
.addresses-section h2 {
  font-size: 2.5rem;
  margin-bottom: 40px;
}

.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.carousel-viewport {
  overflow: hidden;
  flex: 1;
  cursor: grab;
  user-select: none;
}
.carousel-viewport.is-dragging {
  cursor: grabbing;
}

/* Empêche le drag natif des images pendant le glissement */
.carousel-track img {
  pointer-events: none;
}

.carousel-track {
  display: flex;
  gap: 30px;
  transition: transform 0.4s ease;
}

.carousel-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border: none;
  background: transparent;
  color: var(--primary-color);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s,
    opacity 0.2s;
}
.carousel-btn:hover {
  color: var(--primary-hover);
}
.carousel-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   7. CARD
   → deviendra components/Card.module.css
───────────────────────────────────────────── */
.card {
  background-color: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Wrapper relatif nécessaire pour le pseudo-élément overlay */
.card-img-wrapper {
  position: relative;
}
.card-img-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(140, 90, 70, 0.18);
  pointer-events: none;
}

.card-img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.card-content {
  padding: 25px;
}
.card-title {
  font-size: 1.5rem;
  margin-bottom: 5px;
}
.card-location {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 20px;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

/* ─────────────────────────────────────────────
   8. STATS SECTION
   → deviendra components/StatsSection.module.css
───────────────────────────────────────────── */
.stats-section {
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  gap: 80px;
  flex-wrap: wrap;
  text-align: center;
  margin-bottom: 40px;
}
.stat-item h3 {
  font-size: 2.5rem;
  font-family: var(--font-text);
  font-weight: 300;
  margin-bottom: 5px;
}
.stat-item p {
  font-size: 0.9rem;
  color: #666;
  text-transform: lowercase;
}

.action-container {
  text-align: center;
  margin-bottom: 80px;
}

/* ─────────────────────────────────────────────
   9. FEATURE SPLIT SECTION
   → deviendra components/FeatureSection.module.css
───────────────────────────────────────────── */
.feature-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto 80px;
  gap: 40px;
}

.feature-text {
  flex: 1;
  min-width: 300px;
  padding: 20px;
}
.feature-text h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
}
.feature-text p {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 30px;
}

.feature-img-container {
  flex: 1;
  min-width: 300px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  background-color: var(--bg-color);
}
.feature-img-container::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(140, 90, 70, 0.25);
  pointer-events: none;
  z-index: 1;
}
.feature-img-container img {
  width: 100%;
  display: block;
  position: relative; /* crée un contexte d'empilement sous le ::after */
  z-index: 0;
}

/* ─────────────────────────────────────────────
   10. ANIMATIONS (scroll)
───────────────────────────────────────────── */

/* Titres : fade + remontée */
.anim-title {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s ease-out,
    transform 0.7s ease-out;
}
.anim-title.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Section feature : entrée depuis les côtés */
.anim-from-left {
  opacity: 0;
  transform: translateX(-50px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
  will-change: transform;
}
.anim-from-right {
  opacity: 0;
  transform: translateX(50px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
  will-change: transform;
}
.anim-from-left.is-visible,
.anim-from-right.is-visible {
  opacity: 1;
  transform: translate(0);
}

@media (prefers-reduced-motion: reduce) {
  .anim-title,
  .anim-from-left,
  .anim-from-right {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Mobile : translateX → translateY pour éviter le débordement horizontal */
@media (max-width: 768px) {
  .anim-from-left {
    transform: translateY(24px);
  }
  .anim-from-right {
    transform: translateY(24px);
  }
}

/* ─────────────────────────────────────────────
   11. RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
    padding: 20px;
  }
  nav > ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }
  .hero-content h1 {
    font-size: 2.5rem;
  }
  .hero-content .subtitle {
    font-size: 1.8rem;
  }
  .stats-section {
    gap: 30px;
    flex-direction: column;
  }
  .feature-section {
    flex-direction: column;
    text-align: center;
  }
  .line {
    display: none;
  }

  /* Intro section mobile — mascotte au-dessus du texte */
  .intro-section {
    height: auto;
    min-height: 100vh;
  }
  .intro-section__inner {
    flex-direction: column;
    justify-content: center;
    padding: 20px;
  }
  .intro-mascotte {
    flex: 0 0 auto;
  }
  .intro-mascotte img {
    max-height: 42vh;
  }
  .intro-section h2 {
    font-size: 1.8rem;
  }
}
