/* === Cooper Oldstyle URW — Light + Italic === */
@font-face{
  font-family: "Cooper Oldstyle URW";
  src: url("assets/fonts/CooperOldStyURW-Lig.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "Cooper Oldstyle URW";
  src: url("assets/fonts/CooperOldStyURW-Lig.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: "Cooper Oldstyle URW";
  src: url("assets/fonts/CooperOldStyURW-LigIta.woff") format("woff");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face{
  font-family: "Cooper Oldstyle URW";
  src: url("assets/fonts/CooperOldStyURW-LigIta.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* = Base = */
:root{
  --page-gutter: 16px;
  --header-h: 44px;      /* ajuste si besoin */
  --ribbon-dur: 360ms;
  --ribbon-pad-y: 10px;  /* padding vertical ruban ouvert */
}

body{
  font-family: "Cooper Oldstyle URW", serif;
  font-size: 12.4pt;
  line-height: 1.3;
  color: #222;
  background: #fff;
  margin: 0;
  overflow-x: auto;
}

/* = Header = */
.site-header{
  padding: 14px var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  border-bottom: 0;
  position: relative;
  overflow: visible;
  background: #fff;
}

body.about-open .site-header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 700;
}

.site-header h1{
  position: absolute;
  left: var(--page-gutter);
  top: 50%;
  transform: translateY(-50%);

  margin: 0;

  font-family: "Cooper Oldstyle URW", serif;
  font-style: italic;
  font-weight: 300;

  font-size: 12.4pt;   /* ← même que le body */
  line-height: 1.3;

  color: black;

  z-index: 50;
  pointer-events: none;
}

/* = Conteneur principal = */
.wrap{
  max-width: none;
  padding: 0 var(--page-gutter) 16px; /* top 0: colle la barre au header */
}

/* = Tableau index = */
.index-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border-top: 1px solid #e0e0e0; /* barre juste au-dessus des intitulés */
}
.index-table thead th{
  text-align: left;
  padding: calc(8px + 0.5mm) 8px; /* hauteur visuelle = lignes projets (+1mm) */
  font-weight: 700;
  white-space: nowrap;            /* évite le retour de "Date" */
}
.index-table tbody td{
  border-bottom: 1px solid #e2e2e2;
  padding: 10px 8px;
  vertical-align: baseline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.index-table thead th:last-child,
.index-table tbody td:last-child{
  text-align: right;
}
.index-table tbody tr:hover{
  background: #f7f7f7;
}

/* cache quand hidden */
.viewer[hidden]{ display:none; }

/* fond transparent, centré */
.viewer{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 1000;
}

/* scène : ancre du zoom + dimensions explicites (évite le “mini pixel”) */
.viewer-stage{
  position: relative;           /* référentiel pour les couches */
  width: 64vw;                  /* “petit” par défaut */
  height: 62vh;
  box-sizing: border-box;
  overflow: hidden;
  cursor: zoom-in;              /* zoom au clic */
  text-align: center;
  transition: width 280ms ease, height 280ms ease;  /* ← zoom doux */
  will-change: width, height;
}
.viewer-stage.is-large{
  cursor: zoom-out;
  width: 92vw;                  /* “grand” au zoom */
  height: 90vh;
}

/* taille par défaut de toutes les images (solo & multi) */
.viewer-stage img{
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;              /* rempli le cadre du stage */
  max-height: 100%;
  object-fit: contain;          /* pas de recadrage, ratio respecté */
  margin: 0 auto;
  transition: opacity 160ms ease;   /* on garde juste la fondu des couches */
}

/* zoom du paquet : (géré par la taille du stage) */

/* mode multi : superposition (les n premières visibles) */
.viewer-stage.multi img{
  position: absolute;
  inset: 0;
  margin: auto;
  pointer-events: auto;   /* clic reste sur la scène */
  opacity: 0;            /* cachées par défaut (révélées via .is-on) */
}
.viewer-stage.multi img.is-on{ opacity: 1; }

/* pas de bouton de fermeture visible */
.viewer .viewer-close{ display: none; }



/* = Scrollbar système cachée (page) = */
html{ scrollbar-width: none; }                 /* Firefox */
body::-webkit-scrollbar{ width: 0; height: 0;} /* WebKit */

/* = Scrollbar custom “tranche fluo” = */
.csb{
  position: fixed;
  right: 0; top: 0;
  width: 12px; height: 100vh;
  background: #fff;
  z-index: 900; /* sous viewer, au-dessus du contenu */
  user-select: none;
}
.csb__thumb{
  position: absolute;
  left: 2px; width: 8px; min-height: 28px;
  border-radius: 999px;
  cursor: grab;

  /* bandes longues irrégulières + micro-textures */
  background-image:
    linear-gradient(
      to bottom,
      #faff00 0px,   #faff00 6px,
      #ff0033 6px,   #ff0033 12px,
      #39ff14 12px,  #39ff14 16px,
      #faff00 16px,  #faff00 28px,
      #ff6a00 28px,  #ff6a00 34px,
      #00ffd0 34px,  #00ffd0 38px,
      #faff00 38px,  #faff00 54px,
      #ff00e5 54px,  #ff00e5 58px,
      #39ff14 58px,  #39ff14 64px,
      #faff00 64px,  #faff00 78px,
      #ff0033 78px,  #ff0033 87px,
      #faff00 87px,  #faff00 102px,
      #00ffd0 102px, #00ffd0 107px,
      #ff6a00 107px, #ff6a00 114px,
      #faff00 114px, #faff00 132px,
      #39ff14 132px, #39ff14 138px,
      #ff00e5 138px, #ff00e5 142px,
      #faff00 142px, #faff00 162px
    ),
    linear-gradient(
      to bottom,
      #39ff14 0px,   #39ff14 5px,
      #faff00 5px,   #faff00 16px,
      #ff0033 16px,  #ff0033 23px,
      #00ffd0 23px,  #00ffd0 27px,
      #faff00 27px,  #faff00 39px,
      #ff6a00 39px,  #ff6a00 45px,
      #faff00 45px,  #faff00 60px,
      #ff00e5 60px,  #ff00e5 64px,
      #39ff14 64px,  #39ff14 72px,
      #faff00 72px,  #faff00 88px,
      #ff0033 88px,  #ff0033 96px,
      #faff00 96px,  #faff00 114px
    ),
    repeating-linear-gradient(176deg, rgba(0,0,0,.06) 0 2px, rgba(0,0,0,0) 2px 7px),
    repeating-linear-gradient(188deg, rgba(255,255,255,.12) 0 1px, rgba(255,255,255,0) 1px 5px);
  background-size: 100% 162px, 100% 114px, 100% auto, 100% auto;
  background-repeat: repeat-y, repeat-y, repeat, repeat;
  background-position: 0 0, 0 -37px, 0 0, 0 0;
  filter: saturate(1.25) brightness(1.03);
}
.csb__thumb:active{ cursor: grabbing; }
@media (hover:hover){
  .csb__thumb:hover{ filter: saturate(1.35) brightness(1.05); }
}

/* = Ruban “À propos” (fixe, sous header) = */
.about-ribbon{
  position: fixed;
  left: 0;
  right: 0;
  top: 0; /* sera placé par le JS */
  max-height: calc(100vh - 80px);
  z-index: 600;
  background: #fff;
  border: 0;
  box-shadow: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--ribbon-pad-y);
  padding-bottom: calc(var(--ribbon-pad-y) + 2px);
  pointer-events: auto;
  overscroll-behavior: contain;
}

.about-ribbon[hidden]{
  display: none;
}

.about-ribbon__inner{
  max-width: none;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

.about-ribbon__title{
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  margin: 8px 0 4px;
  font-size: 12pt;
  font-weight: normal;
  letter-spacing: .02em;
}
.about-ribbon p{
  margin: 4px 0;
  line-height: 1.25;
  font-size: 12.4pt;
}
.about-ribbon ul{
  list-style: none;
  margin: 4px 0 6px;
  padding-left: 0;
}
.about-ribbon li{
  margin: 2px 0;
  line-height: 1.25;
}

/* = Bouton “À propos” (header) = */
.about-link{
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  padding: 2px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.about-link:hover{ border-color: currentColor; }
.about-link:focus-visible{
  outline: 2px solid #fa0000;
  outline-offset: 2px;
}

/* === 1) Barre noire sous les intitulés du tableau === */
.index-table thead th{
  border-bottom: 2px solid #000; /* rétablit la barre noire */
}

/* === Viewer — appliquer les mêmes règles aux <video> qu’aux <img> === */

/* taille par défaut (petite), centrée */
.viewer-stage video{
  display: block;
  width: auto;
  height: auto;
  max-width: 64vw;         /* idem img */
  max-height: 62vh;        /* idem img */
  margin: 0 auto;
  object-fit: contain;     /* pas de recadrage */
  transition: max-width 280ms ease, max-height 280ms ease, opacity 160ms ease;
  will-change: max-width, max-height;
}

/* état “grand” quand le stage est zoomé */
.viewer-stage.is-large video{
  max-width: 92vw;         /* idem img */
  max-height: 90vh;        /* idem img */
}

/* mode multi : superposition comme pour les PNG */
.viewer-stage.multi video{
  position: absolute;
  inset: 0;
  margin: auto;
  pointer-events: auto;     /* clic sur la vidéo OK */
  opacity: 0;               /* révélée via .is-on */
  transition: opacity 160ms ease;
}
.viewer-stage.multi video.is-on{
  opacity: 1;
}

.project-cell{
  white-space: normal; /* permet les retours à la ligne */
}

.project-desc{
  margin-top: 2px;
  font-size: 0.95em;
  line-height: 1.05;
  opacity: 0.8;
}

.project-credits{
  margin-top: 2px;
  font-size: 0.9em;
  line-height: 1.2;
  opacity: 0.6;
}

img, video{
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.viewer-stage{
  user-select: none;
}

.project-desc{
  display: block;
  white-space: normal;
}

.project-credits{
  white-space: normal;
  display: block;
}

.viewer-stage video.is-collex{
  border-radius: 10px;
}

.viewer-stage video.is-collex{
  border-radius: 10px;

  clip-path: inset(1px round 10px);
  -webkit-clip-path: inset(1px round 10px);
}

a[href^="mailto:"]{
  color: black;
  text-decoration: none;
}

a[href^="mailto:"]:hover{
  text-decoration: underline;
}

.site-header h1{
  display: block;
}

/* ===== MOBILE ONLY ===== */
@media (hover: none) and (pointer: coarse){

  /* pas de scrollbar custom sur mobile */
  .csb{
    display: none;
  }

  html{
    scrollbar-width: auto;
  }

  body{
    overflow-x: hidden;
  }

  body::-webkit-scrollbar{
    width: auto;
    height: auto;
  }

  /* Header simple et stable */
  .site-header{
    position: relative;
    padding: 10px var(--page-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  body.about-open .site-header{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 700;
    background: #fff;
  }

  .site-header h1{
    position: static;
    transform: none;
    margin: 0;
    display: block;
    font-size: clamp(12.4pt, 4vw, 17pt);
    line-height: 1.1;
    pointer-events: auto;
    white-space: nowrap;
  }

  .about-link{
    position: relative;
    z-index: 60;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: clamp(12.4pt, 4vw, 17pt);
    line-height: 1.1;
  }

  /* À propos = panneau mobile */
  .about-ribbon{
    position: fixed;
    left: 0;
    right: 0;
    top: 0; /* recalé par le JS existant */
    bottom: 0;
    max-height: none;
    height: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    z-index: 600;
    padding-top: var(--ribbon-pad-y);
    padding-bottom: 20px;
  }

  body.about-open{
    overflow: hidden;
  }

  .about-ribbon__inner{
    padding: 0 var(--page-gutter) 24px;
  }

  .about-ribbon p,
  .about-ribbon li{
    font-size: clamp(11.2pt, 2.7vw, 13.4pt);
    line-height: 1.24;
  }

  .about-ribbon__title{
    margin-top: 12px;
  }

  /* la page */
  .wrap{
    padding: 0 var(--page-gutter) 20px;
  }

  /* on transforme le tableau en fiches */
  .index-table,
  .index-table tbody,
  .index-table tr,
  .index-table td{
    display: block;
    width: 100%;
  }

  .index-table{
    border-top: 1px solid #000;
  }

  .index-table colgroup,
  .index-table thead{
    display: none;
  }

  .index-table tbody tr{
  position: relative;
  border-top: 0;
  border-bottom: none;
  padding: 10px 0 12px;
  margin: 0;
  background: transparent;
}

.index-table tbody tr::after{
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-image:
    linear-gradient(
      to right,
      #faff00 0px,   #faff00 6px,
      #ff0033 6px,   #ff0033 12px,
      #39ff14 12px,  #39ff14 16px,
      #faff00 16px,  #faff00 28px,
      #ff6a00 28px,  #ff6a00 34px,
      #00ffd0 34px,  #00ffd0 38px,
      #faff00 38px,  #faff00 54px,
      #ff00e5 54px,  #ff00e5 58px,
      #39ff14 58px,  #39ff14 64px,
      #faff00 64px,  #faff00 78px,
      #ff0033 78px,  #ff0033 87px,
      #faff00 87px,  #faff00 102px,
      #00ffd0 102px, #00ffd0 107px,
      #ff6a00 107px, #ff6a00 114px,
      #faff00 114px, #faff00 132px,
      #39ff14 132px, #39ff14 138px,
      #ff00e5 138px, #ff00e5 142px,
      #faff00 142px, #faff00 162px
    ),
    linear-gradient(
      to right,
      #39ff14 0px,   #39ff14 5px,
      #faff00 5px,   #faff00 16px,
      #ff0033 16px,  #ff0033 23px,
      #00ffd0 23px,  #00ffd0 27px,
      #faff00 27px,  #faff00 39px,
      #ff6a00 39px,  #ff6a00 45px,
      #faff00 45px,  #faff00 60px,
      #ff00e5 60px,  #ff00e5 64px,
      #39ff14 64px,  #39ff14 72px,
      #faff00 72px,  #faff00 88px,
      #ff0033 88px,  #ff0033 96px,
      #faff00 96px,  #faff00 114px
    );
  background-size: 162px 100%, 114px 100%;
  background-repeat: repeat-x, repeat-x;
  background-position: 0 0, -37px 0;
  filter: saturate(1.25) brightness(1.03);
}

  .index-table tbody tr:hover{
    background: transparent;
  }

  .index-table tbody td{
    border: 0;
    padding: 0;
    margin: 0 0 6px 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: left !important;
    vertical-align: top;
  }

  .index-table tbody td:last-child{
    margin-bottom: 0;
  }

  /* labels générés en JS */
  .index-table tbody td::before{
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: clamp(0.78em, 2.7vw, 0.98em);
    line-height: 1.08;
    opacity: 0.5;
  }

  /* ligne numéro */
  .index-table tbody td:first-child{
    margin-bottom: 8px;
    font-size: clamp(0.88em, 2.6vw, 1em);
    opacity: 0.75;
  }

  /* la cellule projet reste le bloc principal */
  .project-cell::before{
    display: none;
  }

  .project-cell{
    margin-bottom: 8px;
  }

  .project-cell > em{
    display: block;
  }

  .project-desc{
    margin-top: 4px;
    font-size: 0.95em;
    line-height: 1.12;
  }

  .project-credits{
    margin-top: 4px;
    font-size: 0.88em;
    line-height: 1.16;
  }

  /* on masque le viewer desktop sur mobile */
  .viewer{
    display: none !important;
  }

  /* galerie mobile dépliée */
  .mobile-gallery{
    margin-top: 10px;
    display: grid;
    gap: 10px;
    overflow-anchor: none;
  }

  .mobile-media{
    width: 100%;
    background: #fff;
  }

  .mobile-media img,
  .mobile-media video{
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    margin: 0;
    background: #fff;
  }

  .mobile-media.is-collex{
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
  }

  .mobile-media.is-collex video{
    clip-path: inset(1px round 0 0 10px 10px);
  }

  /* état ouvert */
  .index-table tbody tr.is-open{
    padding-bottom: 14px;
  }
}

@media (orientation: landscape) and (hover: none) and (pointer: coarse){

  .mobile-gallery{
    gap: 12px;
    justify-items: center;
  }

  .mobile-media{
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #fff;
    height: auto;
  }

  .mobile-media img,
  .mobile-media video{
    display: block;
    width: min(58vw, 420px);
    max-width: min(58vw, 420px);
    height: auto;
    max-height: none;
    object-fit: contain;
    margin: 0 auto;
    background: #fff;
    border-radius: 0; /* pas d'arrondi par défaut */
  }

  .mobile-media.is-collex{
    overflow: hidden;
  }

  .mobile-media.is-collex video{
    display: block;
    border-radius: 0 0 10px 10px; /* seulement en bas */
    clip-path: inset(1px round 0 0 10px 10px);
  }
}