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

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background-color: #f4f6f8;
  color: #2c3e50;
  line-height: 1.6;
}

/* === EN-TÊTE === */
header {
  background-color: #1f3a5f;
  color: white;
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

header h1 {
  font-size: 1.3em;
}

header .contact a {
  color: #ffd166;
  text-decoration: none;
}

/* === NAVIGATION PRINCIPALE === */
nav.main-nav {
  background-color: #2c5282;
  display: flex;
  justify-content: center;
  padding: 0;
}

nav.main-nav a {
  color: white;
  padding: 14px 28px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.3s;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  background-color: #1a365d;
  border-bottom: 3px solid #ffd166;
}

.site-fragment {
  width: 100%;
  border: 0;
  display: block;
}

.header-fragment {
  height: 68px;
}

.footer-fragment {
  height: 58px;
}

/* === CONTENU PRINCIPAL === */
main {
  max-width: 1100px;
  margin: 30px auto;
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

main.trace-page {
  max-width: 1360px;
  padding: 24px 20px;
}

h1.page-title {
  color: #1f3a5f;
  border-bottom: 3px solid #ffd166;
  padding-bottom: 10px;
  margin-bottom: 25px;
}

h2 {
  color: #2c5282;
  margin-top: 30px;
  margin-bottom: 15px;
}

h3 {
  color: #1f3a5f;
  margin-top: 20px;
}

p {
  margin-bottom: 15px;
  text-align: justify;
}

.home-section {
  background: #fbfdff;
  border: 1px solid #dbe7f3;
  border-left: 5px solid #2c5282;
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: 0 1px 6px rgba(31, 58, 95, 0.06);
}

.home-section h2 {
  margin-top: 0;
}

.home-section ul {
  margin: 0 0 15px 22px;
}

.home-image-placeholder {
  margin-top: 18px;
}

.image-placeholder {
  border: 2px dashed #9fb3c8;
  background: #f7fbff;
  color: #5b6570;
  border-radius: 10px;
  min-height: 140px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-style: italic;
}

.image-placeholder.large {
  min-height: 190px;
}

/* === SAVOIR-FAIRE EN COULEUR === */
.sf {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}
.sf-bleu   { background: #cce5ff; color: #004085; }
.sf-vert   { background: #d4edda; color: #155724; }
.sf-orange { background: #ffe5b4; color: #8a4b08; }
.sf-rouge  { background: #f8d7da; color: #721c24; }
.sf-violet { background: #e2d9f3; color: #4b2e83; }

.sfe {
  display: inline-block;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.sfe-11 { background: #fff1e6; color: #c2410c; }
.sfe-12 { background: #e0f2fe; color: #0369a1; }
.sfe-13 { background: #dcfce7; color: #166534; }
.sfe-14 { background: #f3e8ff; color: #7e22ce; }
.sfe-21 { background: #d1fae5; color: #047857; }
.sfe-22 { background: #cffafe; color: #0f766e; }
.sfe-23 { background: #fef3c7; color: #b45309; }
.sfe-24 { background: #fee2e2; color: #b91c1c; }
.sfe-25 { background: #ffe4e6; color: #be123c; }
.sfe-26 { background: #e0e7ff; color: #3730a3; }

/* === LIENS VERS AUTRES PAGES (page accueil) === */
.sf-link {
  font-weight: bold;
  color: #2c5282;
  text-decoration: underline;
}

/* === SOUS-NAVIGATION (entre sous-pages) === */
nav.sub-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

nav.sub-nav a,
nav.sub-nav button {
  padding: 8px 16px;
  background: #e2e8f0;
  color: #2c5282;
  text-decoration: none;
  border-radius: 5px;
  font-size: 0.9em;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
  font: inherit;
}

nav.sub-nav a:hover,
nav.sub-nav a.active,
nav.sub-nav button:hover,
nav.sub-nav button.active {
  background: #2c5282;
  color: white;
}

.subpage-display {
  margin-top: 20px;
}

.subpage-display {
  margin-top: 20px;
  position: relative;
}

.subpage-content {
  opacity: 0;
  transform: translateY(6px);
  max-height: 0;
  overflow: hidden;
  transition: opacity .28s ease, transform .28s ease, max-height .35s ease;
  will-change: opacity, transform, max-height;
  pointer-events: none;
}

.subpage-content.active {
  opacity: 1;
  transform: translateY(0);
  max-height: 2000px;
  pointer-events: auto;
}

.subpage-switch-hint {
  margin-top: -10px;
  margin-bottom: 18px;
  color: #5b6570;
  font-size: 0.95em;
}

/* === ZONE IMAGE / TRACE === */
.trace-zone {
  border: 2px dashed #b0b0b0;
  background: #fafafa;
  padding: 30px;
  text-align: center;
  margin: 20px 0;
  border-radius: 8px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-style: italic;
}

.trace-layout {
  display: grid;
  grid-template-columns: minmax(420px, 52%) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 14px 0;
}

.trace-media {
  min-width: 0;
}

.trace-content {
  min-width: 0;
}

.trace-content h3:first-child {
  margin-top: 0;
}

.trace-media .trace-zone {
  margin: 0;
}

.trace-media .trace-legend {
  margin-top: 8px;
  margin-bottom: 0;
}

.trace-media .trace-zone {
  padding: 14px;
  min-height: 0;
}

.trace-zone img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  border-radius: 5px;
  cursor: zoom-in;
}

.image-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.image-overlay.open {
  display: flex;
}

.image-overlay-content {
  max-width: min(95vw, 1500px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #fff;
}

.image-overlay-close {
  position: absolute;
  top: 18px;
  right: 22px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  cursor: pointer;
}

.image-overlay-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

body.overlay-open {
  overflow: hidden;
}

.trace-legend {
  text-align: center;
  font-style: italic;
  color: #555;
  margin-bottom: 20px;
  font-size: 0.95em;
}

/* === LISTE SAVOIR-FAIRE === */
.sf-list {
  background: #f0f4f8;
  padding: 15px 25px;
  border-left: 4px solid #2c5282;
  margin: 20px 0;
  list-style: none;
}

.sf-list li {
  padding: 5px 0;
}

/* === BLOC BILAN === */
.bilan-block {
  background: #fff8e7;
  border: 1px solid #ffd166;
  border-radius: 8px;
  padding: 20px 25px;
  margin: 20px 0;
}

.bilan-block h3 {
  color: #8a6d3b;
  margin-top: 0;
}

.niveau {
  display: inline-block;
  padding: 5px 12px;
  background: #2c5282;
  color: white;
  border-radius: 15px;
  font-weight: bold;
  margin: 5px 0;
}

/* === ILLUSTRATION ACCUEIL === */
.illu-accueil {
  border: 2px dashed #b0b0b0;
  background: #fafafa;
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-style: italic;
  margin: 20px 0;
  border-radius: 8px;
  padding: 12px;
}

.illu-accueil img {
  max-width: 100%;
  object-fit: contain;
  display: block;
}

footer {
  text-align: center;
  padding: 20px;
  color: #777;
  font-size: 0.9em;
}

@media (max-width: 800px) {
  .trace-layout {
    grid-template-columns: 1fr;
  }

  main.trace-page {
    padding: 20px 14px;
  }
}
