/* =========================================================
   BASE / RESET
   ========================================================= */
:root {
  --fg:#111;
  --bg:#fff;
  --muted:#666;
  --accent:#0a7;
}

* {
  box-sizing:border-box;
}

html,body {
  height:100%;
}

body {
  margin:0;
  font:16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color:var(--fg);
  background:var(--bg);
}

.wrap {
  max-width:1000px;
  margin:auto;
  padding:24px;
}

.small {
  color:var(--muted);
  font-size:.9rem;
}

h1,h2 {
  line-height:1.2;
  margin:.2em 0 .4em;
}

a {
  color:inherit;
  text-decoration:none;
}

.btn {
  display:inline-block;
  padding:.6em .9em;
  border:1px solid var(--accent);
  border-radius:10px;
  color:var(--accent);
}

/* =========================================================
   SOMMAIRE (TOC)
   ========================================================= */

/* Barre sticky en haut + grosse bordure en dessous */
.toc-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);

  padding: 12px 0 16px;
  border-bottom: 3px solid #eee;
}

.toc-top h2 {
  margin:.2rem 0 .6rem;
  font-size:1.05rem;
}

/* Grille du sommaire :
   - toujours 2 lignes visibles
   - défilement horizontal si trop de projets */
.toc-strip {
  display: grid;
  grid-auto-flow: column;             /* remplit la 1re ligne puis la 2e */
  grid-template-rows: repeat(2, 130px);  /* hauteur de chaque ligne du sommaire */
  grid-auto-columns: 220px;              /* largeur d'une carte projet */
  gap: 16px 20px;                        /* [lignes, colonnes] */
  padding: 0;
  margin: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.toc-strip li {
  display: contents;
}

/* Carte du sommaire (chaque projet dans le TOC) */
.toc-card {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;

  width:220px;
  height:130px;

  border:1px solid #e9e9e9;
  border-radius:12px;
  background:#F6FAF0; /* léger fond vert pâle */
  padding:10px;

  box-shadow:0 0 0 rgba(0,0,0,0);
  transition: box-shadow .15s ease,
              transform .15s ease,
              border-color .15s ease;
}

.toc-card:hover,
.toc-card:focus-visible {
  border-color:#dfecea;
  box-shadow:0 6px 16px rgba(0,0,0,.06);
  transform:translateY(-2px);
  outline:none;
}

/* Zone du logo dans la carte sommaire */
.toc-logos {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
}

/* Logo du projet dans le sommaire
   -> taille volontairement grande pour qu'on le reconnaisse */
.toc-logo.project {
  background:transparent;
  border:none;
  border-radius:6px;
  padding:4px 6px;

  height:70px;
  max-width:140px;

  object-fit:contain;
  display:block;
}

/* Titre du projet dans le sommaire */
.toc-title {
  font-size:.95rem;
  text-align:center;
  max-width:200px;
  line-height:1.2;

  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* =========================================================
   PROJET : CARTE GLOBALE
   ========================================================= */

.project {
  border:1px solid #e8e8e8;
  border-radius:14px;
  padding:16px;
  margin:16px 0;
  background:#fff;

  /* pour l'ancrage quand on clique depuis le sommaire */
  scroll-margin-top: calc(var(--toc-height, 160px) + 12px);
}

/* =========================================================
   HEADER DU PROJET (bandeau)
   - logo client | titre projet | logos plateformes
   ========================================================= */

.row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;     /* centré sur desktop */
  border:1px solid #e8e8e8;
  border-radius:10px;
  background:#fff;
  padding:0;
  margin-bottom:12px;
  gap:0;
}

/* chaque bloc du header (logo client / titre / plateformes) */
.head-block {
  display:flex;
  align-items:center;
  padding:8px 12px;
  gap:8px;
  font-size:14px;
  line-height:1.3;
}

/* séparation visuelle entre les blocs */
.head-block + .head-block {
  border-left:1px solid #ddd;
}

/* 1. Logo client */
.head-clientlogo .logo.client {
  width:auto;
  height:40px;
  object-fit:contain;
  display:inline-block;
  vertical-align:middle;
  background:transparent;
  border:none;
  border-radius:4px;
  padding:0;
}

/* 2. Titre du projet (un peu plus gros) */
.proj-title {
  font-size:1.25rem;
  font-weight:600;
  margin:0;
  line-height:1.3;
  color:var(--fg);
  white-space:nowrap;
}

/* 3. Plateformes */
.head-platforms {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}

/* Logos plateformes (Android, iOS, etc.) */
.platform-logo {
  width:auto;
  height:20px;
  max-width:60px;
  object-fit:contain;
  display:inline-block;
  vertical-align:middle;
  background:transparent;
  border:none;
  padding:0;
  border-radius:4px;
  opacity:.9;
}

/* Responsive : sur mobile, on repasse en alignement à gauche
   et on réduit un peu la taille du titre */
@media (max-width:600px){
  .row-head {
    justify-content:flex-start;
  }
  .proj-title {
    font-size:1.1rem;
  }
}

/* =========================================================
   SECTIONS TEXTE ("Cible", "Problématique", …) + PICTOS
   ========================================================= */

.section {
  border:1px solid #f0f0f0;
  border-radius:10px;
  background:#fff;
  padding:6px 10px;
  margin-bottom:10px;
}

.section > summary {
  list-style:none;
  cursor:pointer;
}
.section > summary::-webkit-details-marker {
  display:none;
}

/* état "ouvert" */
.section[open] {
  border-color:#e6f6f1;
  background:#f9fffd;
}

/* ligne titre + picto */
.section-head {
  display:flex;
  align-items:center;
  gap:8px;
  min-height:24px;
}

/* picto de la section (Cible, etc.) */
.section-icon {
  width:auto;
  height:60px;
  max-width:96px;
  object-fit:contain;
  flex-shrink:0;
  background:transparent;
  border:none;
  padding:0;
  border-radius:4px;
  opacity:1;
}

/* titre de la section */
.section-title {
  font-size:1rem;
  font-weight:600;
  margin:0;
  line-height:1.3;
  color:var(--fg);
}

.section-body {
  margin-top:8px;
  font-size:0.95rem;
  line-height:1.4;
  color:var(--fg);
}

/* =========================================================
   MÉDIAS DU PROJET
   - grille de vignettes images et vidéos
   ========================================================= */

.media-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:6px;
}
@media (min-width:980px){
  .media-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.media-item {
  border:1px solid #eee;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
  position:relative;
}

/* miniature image */
.media-item.media-image img {
  width:100%;
  height:160px;
  object-fit:cover;
  display:block;
  cursor:pointer;
}
@media (min-width:980px){
  .media-item.media-image img {
    height:180px;
  }
}

/* miniature vidéo */
.media-item.media-video .media-video-tag {
  width:100%;
  height:auto;
  max-height:200px;
  display:block;
  background:#000;
  cursor:pointer;   /* clic => plein écran */
}

/* on ne montre pas de label sous les médias */
.media-item figcaption {
  display:none;
}

/* placeholder texte si une image est manquante */
.img-missing {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:120px;
  min-height:28px;
  padding:4px 8px;
  border:1px dashed #e0b4b4;
  border-radius:6px;
  font-size:.85rem;
  color:#b04a4a;
  background:#fff7f7;
}

/* =========================================================
   LIGHTBOX (plein écran image / vidéo)
   ========================================================= */

/* conteneur global masqué par défaut */
.lightbox.hidden {
  display:none;
}
.lightbox {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.8);
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

/* contenu (media + bouton fermer) */
.lightbox-content {
  position:relative;
  max-width:90vw;
  max-height:90vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* media dans la lightbox (image OU vidéo) */
.lightbox-media {
  max-width:90vw;
  max-height:90vh;
  object-fit:contain;
  border-radius:8px;
  box-shadow:0 20px 40px rgba(0,0,0,.6);
  background:#000;
}

/* caché tant que non actif */
.hidden-media {
  display:none;
}

/* bouton X fermer */
.lightbox-close {
  position:absolute;
  top:-12px;
  right:-12px;

  background:#fff;
  border:0;
  border-radius:999px;

  width:32px;
  height:32px;
  line-height:32px;
  font-size:18px;
  font-weight:600;
  cursor:pointer;

  box-shadow:0 10px 20px rgba(0,0,0,.4);
  color:#111;
}
.lightbox-close:hover {
  background:#f5f5f5;
}

/* =========================================================
   RESPONSIVE SUPPLÉMENTAIRE
   ========================================================= */

/* si l'écran est petit, les cartes TOC deviennent un peu plus étroites */
@media (max-width:520px){
  .toc-card {
    width:200px;
  }
  .toc-strip {
    grid-auto-columns:200px;
  }
}
