/* =========================================================
   VARIABLES / RESET
   ========================================================= */
:root {
  --fg:#111;
  --bg:#fff;
  --muted:#666;
  --accent:#0a7;

  /* sérum de vérité pour les hauteurs dynamiques */
  --sticky-total-height: 220px;
  --toc-height: 220px;
}

* {
  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);
}

a {
  color:inherit;
  text-decoration:none;
}

/* conteneur classique */
.wrap {
  max-width:1000px;
  margin:auto;
  padding:24px;
  position:relative;
  z-index:1;
}

/* pousse tout le reste SOUS le header fixe */
.page-offset {
  padding-top: var(--sticky-total-height);
}

.small {
  color:var(--muted);
  font-size:.9rem;
}

h1,h2 {
  line-height:1.2;
  margin:.2em 0 .4em;
}

.btn {
  display:inline-block;
  padding:.6em .9em;
  border:1px solid var(--accent);
  border-radius:10px;
  color:var(--accent);
}

/* =========================================================
   HEADER FIXE GLOBAL (NAV + SOMMAIRE)
   ========================================================= */

.portfolio-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  z-index: 10000;
  background: var(--bg);

  border-bottom: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 12px 24px rgba(0,0,0,0.05);

  isolation: isolate;
}

/* NAV SUPERIEURE */
.portfolio-topnav {
  background:#fff;
  border-bottom:1px solid rgba(0,0,0,0.06);
  min-height:55px;
  line-height:1;
  padding:0;
}

.portfolio-topnav-inner {
  max-width:1000px;
  margin:0 auto;
  padding:0 24px;
  height:px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.portfolio-left {
  display:flex;
  align-items:center;
  min-width:0;
}

.portfolio-logo {
  height:40px;
  max-width:220px;
  object-fit:contain;
  display:block;
  background:transparent;
  border:none;
  box-shadow:none;
  padding:0;
  line-height:1;
}

.portfolio-right {
  display:flex;
  flex-wrap:wrap;
  gap:1rem;
  align-items:center;
}

.portfolio-link {
  font-size:.9rem;
  font-weight:500;
  color:var(--accent);
  text-decoration:none;
  line-height:1.2;
  padding:0;
  display:inline-block;
  transition:color .15s ease, text-shadow .15s ease;
}

.portfolio-link:hover,
.portfolio-link:focus-visible {
  color:#055;
  text-shadow:0 0 6px rgba(0,170,119,0.25);
  outline:none;
}

/* SOMMAIRE SOUS LA NAV */
.toc-top {
  background:#86F092; /* Vert Cactus Mobile */
  padding:0 0 4px;
  border-bottom:3px solid #008C5A;
}

/*.toc-top h2 {
/*  margin:.1rem 0 .15rem;
/*  font-size:1.05rem;
/*  line-height:1.3;
/*  font-weight:600;
/*  color:var(--fg);
/*}

/* on masque le h2 du sommaire */
.toc-top h2 {
  display:none;
}

/* liste sommaire */
.toc-strip {
  display:grid;
  grid-auto-flow:column;
  grid-template-rows:repeat(2,130px);
  grid-auto-columns:220px;
  gap:16px 20px;
  padding:0;
  margin:0;
  list-style:none;
  overflow-x:auto;
  scrollbar-width:thin;
}

.toc-strip li {
  display:contents;
}

/* carte sommaire */
.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:#fff; /* fond blanc */
  padding:10px;
  box-shadow:0 0 0 rgba(0,0,0,0.05);
  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;
}

.toc-logos {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
}

.toc-logo.project,
.toc-logo.client{
  padding:2px;
  height:54px !important;
  max-width:120px !important;
  object-fit:contain;
  display:block;
}

.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;
}

@media (max-width:520px){
  .toc-card { width:200px; }
  .toc-strip { grid-auto-columns:200px; }
}

/* =========================================================
   PROJET
   ========================================================= */

.project {
  border:1px solid #e8e8e8;
  border-radius:14px;
  padding:16px;
  margin:16px 0;
  background:#fff;

  scroll-margin-top: calc(var(--toc-height) + 12px);
}

.project.highlighted {
  box-shadow:0 0 0 3px rgba(0,170,119,.3);
  transition:box-shadow .2s ease;
}

/* header du projet */
.row-head {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  border:1px solid #e8e8e8;
  border-radius:10px;
  background:#fff;
  padding:0;
  margin-bottom:12px;
  gap:0;
  transition:
    box-shadow .18s ease,
    transform .18s ease,
    background-color .18s ease,
    border-color .18s ease;
}

.row-head:hover {
  background-color:#fafafa;
  border-color:#dcdcdc;
  box-shadow:0 8px 24px rgba(0,0,0,.06);
  transform:translateY(-2px);
}

.head-block {
  display:flex;
  align-items:center;
  padding:8px 12px;
  gap:8px;
  font-size:14px;
  line-height:1.3;
}

.head-block + .head-block {
  border-left:1px solid #ddd;
}

.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;
}

.logo.project-header {
  height:50px;
  max-width:140px;
  object-fit:contain;
  display:inline-block;
  vertical-align:middle;
  background:transparent;
  border:none;
  padding:0;
}

.proj-title {
  font-size:1.25rem;
  font-weight:600;
  margin:0;
  line-height:1.3;
  color:var(--fg);
  white-space:nowrap;
}

.head-platforms {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}

.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;
}

@media (max-width:600px){
  .row-head { justify-content:flex-start; }
  .proj-title { font-size:1.1rem; }
}

/* apparition séquentielle */
.fade-seq {
  opacity:0;
  transform:translateY(4px);
  transition:opacity .3s ease, transform .3s ease;
}
.fade-play {
  opacity:1 !important;
  transform:none;
}


/* Harmonisation avec le markup généré dans cactus-mobile.html */

/* En-tête projet (logos + textes) */
.project-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* Conteneur logos dans le header */
.project-logos {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Style générique des logos projet/client dans les fiches */
.project-logo {
  max-height: 48px;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

/* Affiner le logo client vs projet si besoin */
.project-logo.client-logo {
  max-height: 40px;
}

.project-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-client {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.project-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

.project-year {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* Grille médias générée par le JS actuel */
.project-medias {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.project-media-item {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 4px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.project-media-item img.media-thumb,
.project-media-item video.media-thumb {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.project-media-item figcaption {
  margin-top: 4px;
  font-size: 0.78rem;
  color: #555;
  text-align: center;
}



/* =========================================================
   SECTIONS TEXTE
   ========================================================= */

.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;
}

.section[open] {
  border-color:#e6f6f1;
  background:#f9fffd;
}

.section-head {
  display:flex;
  align-items:center;
  gap:8px;
  min-height:24px;
}

.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;
}

.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 DANS LE PROJET
   ========================================================= */

.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;
}

.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;
  }
}

.media-item.media-video .media-video-tag {
  width:100%;
  height:auto;
  max-height:200px;
  display:block;
  background:#000;
  cursor:pointer;
}

.media-item figcaption {
  display:none;
}

.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
   ========================================================= */

.lightbox.hidden {
  display:none;
}

.lightbox {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.8);
  z-index:99999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.lightbox-content {
  position:relative;
  max-width:90vw;
  max-height:90vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.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;
}

.hidden-media {
  display:none;
}

.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;
}

/* Flèches navigation lightbox */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  display: none; /* sera mis en flex en JS si >1 média */
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  z-index: 5;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: #f5f5f5;
}

@media (max-width: 600px) {
  .lightbox-prev,
  .lightbox-next {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}


/* Offset anchor landing exactly below header+TOC */
:root { --tocOffset: 160px; } /* default fallback; JS sets real value */
.project, .project-section, section[id^="project-"] {
  scroll-margin-top: var(--tocOffset);
}



/* === TOC Carousel — authoritative block v4 === */
:root { --tocOffset: 160px; }
html { scroll-padding-top: var(--tocOffset); }

.toc-carousel{ display:grid !important; grid-template-columns:auto 1fr auto !important; align-items:center; column-gap:8px; padding:8px 0; }
.toc-viewport{ position:relative; width:100% !important; min-width:0 !important; overflow-x:auto !important; overflow-y:hidden !important; z-index:1; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.toc-strip{ display:flex !important; flex-wrap:nowrap !important; align-items:stretch; gap:8px; padding:6px 6px 6px; margin:0; list-style:none; width:max-content !important; }
.toc-strip > li{ flex:0 0 auto !important; }

.toc-arrow{ display:none !important; align-items:center; justify-content:center; appearance:none; border:0; width:36px; height:36px; border-radius:999px; background:#fff; box-shadow:0 2px 10px rgba(0,0,0,.12); color:#008C5A; font-size:20px; cursor:pointer; transition:transform .12s ease, opacity .12s ease; z-index:3; }
.toc-arrow:hover{ transform:translateY(-1px); }
.toc-arrow[disabled]{ opacity:.35; cursor:default; }
.toc-carousel.has-overflow .toc-arrow{ display:flex !important; }

.toc-edge{ position:absolute; top:0; bottom:0; width:36px; pointer-events:none; opacity:0; transition:opacity .15s; z-index:2; }
.toc-edge.left{ left:0; background:linear-gradient(to right, rgba(134,240,146,1), rgba(134,240,146,0)); }
.toc-edge.right{ right:0; background:linear-gradient(to left, rgba(134,240,146,1), rgba(134,240,146,0)); }

#toc-strip > li > .toc-card{ box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:space-between; gap:6px; width:120px !important; height:120px !important; flex:none !important; scroll-snap-align:start; border:1px solid #e9e9e9; border-radius:12px; background:#fff; padding:8px; 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; }
.toc-logo.project{ padding:2px; height:54px !important; max-width:120px !important; object-fit:contain; display:block; }
.toc-title{ font-size:.9rem; text-align:center; max-width:110px; line-height:1.2; white-space:normal; overflow:visible; word-break:normal; hyphens:auto; margin:0; }

.project, .project-section, section[id^="project-"]{ scroll-margin-top: var(--tocOffset); }

:root {
  --tocOffset: 130px; /* ajuste selon la nouvelle hauteur du TOC */
}


