/* ─────────────────────────────────────────────
   Studio — style.css
   Bureau : menu à gauche, nuage au centre.
   Mobile : « Menu » en haut à droite, le même menu en plein écran, sans volets.
   Une seule taille de texte par écran, sauf le logo. Titres en 500, le reste en 400.
   Noir = titre ou élément actif, gris = le reste.
   Bureau : logo, titres et textes sur le même bord gauche, toutes les lignes font 20 px.
───────────────────────────────────────────── */

:root {
  --tdg-header-height: 0px;
  --m: 24px;                 /* marge extérieure */
  --rail: 320px;             /* colonne de gauche */
  --gap: 32px;               /* entre la colonne et l'image ouverte */
  --col: 28px;               /* signes et nombres, tous les textes s'alignent après */
  --fs: 13px;
  --lh: 20px;
  --ink: #000;
  --grey: #767676;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);   /* départ vif, arrivée douce */
}

html, body { margin: 0; padding: 0; background: #fff; }

#tdg-wrap {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: visible;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  font: 400 var(--fs)/var(--lh) "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-feature-settings: "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  color: var(--ink);
}
#tdg-wrap a { color: inherit; text-decoration: none; }
#tdg-wrap button {
  margin: 0; padding: 0; border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#tdg-wrap a:focus-visible, #tdg-wrap button:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ── Nuage ── */
#tdg-canvas { cursor: grab; }
#tdg-canvas:active { cursor: grabbing; }
#tdg-wrap img { position: absolute; cursor: pointer; }
/* Image survolée : elle grossit légèrement et son projet s'affiche près du curseur */
@media (hover: hover) {
  :root:not(.tdg-open):not(.tdg-drag) #tdg-canvas img:hover { transform: scale(1.06); }
}
#tdg-tip {
  position: fixed;
  left: 0; top: 0;
  z-index: 100004;
  padding: 2px 8px;
  background: #fff;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#tdg-tip.visible { opacity: 1; }
.tdg-open #tdg-tip, .tdg-drag #tdg-tip { opacity: 0; }
/* Une image ouverte : les autres s'effacent */
.tdg-open #tdg-wrap img:not(.tdg-on) { opacity: 0 !important; pointer-events: none; }
.tdg-open #tdg-canvas { cursor: default; }
#tdg-wrap img.tdg-on { cursor: zoom-out; }

/* ── Logo : gras et très serré, toujours en haut à gauche ── */
#tdg-logo {
  position: fixed;
  top: var(--m); left: var(--m);
  margin: 0 0 0 -9px;        /* le « i » tombe pile sur la marge */
  padding: 0 8px;
  background: #fff;          /* reste lisible quand une image passe derrière */
  z-index: 100008;
  font-size: 22px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.05em;
  pointer-events: none;
}

/* ── Menu : About, Projects, Contact ── */
#tdg-menu {
  position: fixed;
  top: calc(var(--m) + 40px); bottom: var(--m); left: var(--m);
  width: var(--rail);
  z-index: 100003;
  overflow-y: auto;
  scrollbar-width: none;
  pointer-events: none;      /* on peut faire tourner le nuage derrière */
}
#tdg-menu::-webkit-scrollbar { display: none; }
#tdg-menu a, #tdg-menu button { pointer-events: auto; }
#tdg-links:empty, #tdg-contact:empty { display: none; }

/* Titre d'un volet : + fermé, − ouvert */
.tdg-acc h2 { margin: 0; font: inherit; }
#tdg-wrap .tdg-acc h2 button {
  display: block;
  position: relative;
  padding: 4px 0 4px var(--col);
  font-weight: 500;
  text-align: left;
}
.tdg-acc h2 i { position: absolute; left: 0; top: 50%; width: 9px; height: 1px; background: currentColor; }
.tdg-acc h2 i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  transform: rotate(90deg);
  transition: transform 0.4s var(--ease);
}
.tdg-acc.open h2 i::after { transform: none; }

/* Contenu d'un volet */
.tdg-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.4s var(--ease), visibility 0s linear 0.4s;
}
.tdg-acc.open .tdg-panel { grid-template-rows: 1fr; visibility: inherit; transition: grid-template-rows 0.4s var(--ease); }
.tdg-panel > div { min-height: 0; overflow: hidden; }
.tdg-panel > div::after { content: ""; display: block; height: var(--lh); }
.tdg-panel a:focus-visible { outline-offset: -1px !important; }
#tdg-tagline, #tdg-bottom, #tdg-links, #tdg-contact { padding-left: var(--col); color: var(--grey); }
#tdg-tagline { text-wrap: pretty; }
#tdg-wrap #tdg-bottom a { user-select: text; -webkit-user-select: text; }
#tdg-wrap .tdg-panel a { color: var(--grey); transition: color 0.2s ease; }
#tdg-wrap .tdg-panel a:hover, #tdg-wrap .tdg-panel a.mark, #tdg-wrap .tdg-panel a.active { color: var(--ink); }

/* Projets : nombre d'images puis nom */
#tdg-subnav { display: flex; flex-direction: column; align-items: flex-start; }
#tdg-wrap a.tdg-sub { display: grid; grid-template-columns: var(--col) auto; padding: 2px 0; white-space: nowrap; }
.tdg-sub-count { order: -1; }
.tdg-sub-count, .tdg-idx i, .tdg-idx b, #tdg-cap-num, #tdg-loader-percent { font-variant-numeric: tabular-nums; }

/* Bureau : fond blanc collé aux textes, lisibles quand une image passe derrière */
@media (min-width: 901px) {
  :root { --col: 24px; }
  #tdg-wrap { letter-spacing: -0.006em; }
  #tdg-logo { margin-left: -9px; padding-bottom: 8px; font-size: 18px; line-height: 20px; letter-spacing: -0.045em; }
  #tdg-menu { top: calc(var(--m) + 28px); left: calc(var(--m) - 8px); padding-left: 8px; }
  #tdg-wrap .tdg-acc h2 button { margin-left: -8px; padding: 0 25px 0 8px; background: #fff; }
  /* + et − après le titre : rien ne décale les textes du logo */
  .tdg-acc h2 i { left: auto; right: 8px; width: 7px; color: var(--grey); transition: color 0.2s ease; }
  .tdg-acc h2 button:hover i, .tdg-acc.open h2 i { color: var(--ink); }
  .tdg-panel { position: relative; width: fit-content; margin-left: -8px; padding: 0 8px; background: #fff; }
  /* volet ouvert : le blanc remonte derrière son titre, un seul bloc net */
  .tdg-panel::before { content: ""; position: absolute; bottom: 100%; left: 0; width: 100%; height: var(--lh); background: #fff; }
  .tdg-acc h2 { position: relative; z-index: 1; width: fit-content; }
  #tdg-tagline, #tdg-bottom, #tdg-links, #tdg-contact { padding-left: 0; }
  #tdg-wrap a.tdg-sub, #tdg-wrap a.tdg-idx { padding: 0; }
}

/* Plusieurs rubriques : index numéroté (caché s'il n'y en a qu'une) */
.tdg-single #tdg-footer { display: none; }
#tdg-footer { padding-bottom: var(--lh); }
#tdg-nav-footer { display: flex; flex-direction: column; }
#tdg-wrap a.tdg-idx { display: grid; grid-template-columns: var(--col) 1fr auto; padding: 2px 0; }
#tdg-wrap a.tdg-idx i, #tdg-wrap a.tdg-idx b { font-style: normal; font-weight: 400; }

/* Mobile seulement */
#tdg-toggle, #tdg-now { display: none; }

/* ── Barre de l'image ouverte ── */
#tdg-caption {
  position: fixed;
  left: calc(var(--m) + var(--rail) + var(--gap));
  right: var(--m);
  bottom: var(--m);
  height: var(--lh);
  z-index: 100002;
  display: flex;
  align-items: center;
  gap: 16px;
  visibility: hidden;
}
.tdg-open #tdg-caption { visibility: visible; }
#tdg-cap-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tdg-cap-num { color: var(--grey); white-space: nowrap; }
#tdg-cap-nav { display: flex; margin-left: auto; margin-right: -12px; }
/* Zone cliquable de 40 px autour de chaque signe */
#tdg-wrap #tdg-cap-nav button { width: 40px; height: 40px; font-size: 16px; line-height: 40px; transition: color 0.2s ease; }
/* Croix tracée, même épaisseur que les flèches */
#tdg-cap-nav button[data-close] { position: relative; }
#tdg-cap-nav button[data-close]::before, #tdg-cap-nav button[data-close]::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 15px; height: 1px;
  background: currentColor;
}
#tdg-cap-nav button[data-close]::before { transform: translate(-50%, -50%) rotate(45deg); }
#tdg-cap-nav button[data-close]::after { transform: translate(-50%, -50%) rotate(-45deg); }
#tdg-wrap #tdg-cap-nav button:hover { color: var(--grey); }
.tdg-one #tdg-cap-nav [data-step] { display: none; }

/* ── Mode d'emploi : au centre, seulement quand rien ne bouge ── */
#tdg-hint {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 100001;
  padding: 6px 12px;
  background: #fff;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#tdg-hint.visible { opacity: 1; }

/* ── Chargement ── */
#tdg-loader {
  position: fixed;
  top: var(--tdg-header-height, 0px); left: 0;
  width: 100%; height: calc(100% - var(--tdg-header-height, 0px));
  background: #fff;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
#tdg-loader-percent { min-width: 120px; }
#tdg-loader-bar-wrap { width: 120px; height: 1px; background: #e4e4e4; margin-top: 8px; }
#tdg-loader-bar { height: 1px; width: 0%; background: var(--ink); transition: width 0.15s ease; }

/* ── Rubrique vide ou page contact ── */
#tdg-static-page, #tdg-static-contact {
  top: var(--m) !important;
  left: calc(var(--m) + var(--rail) + var(--gap)) !important;
  transform: none !important;
  font: 400 var(--fs)/var(--lh) "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
  letter-spacing: 0 !important;
  text-align: left !important;
}
#tdg-static-page a, #tdg-static-contact a {
  font-size: var(--fs) !important;
  letter-spacing: 0 !important;
  margin-top: var(--lh) !important;
  opacity: 1 !important;
  color: var(--grey) !important;
}
#tdg-static-page br + br, #tdg-static-contact br + br { display: none; }

/* ── Mobile ── */
@media (max-width: 900px) {
  :root { --m: 16px; --col: 32px; --fs: 16px; --lh: 24px; }

  #tdg-logo { top: 16px; }   /* centré sur « Menu » */

  /* « Menu » / « Close », en face du logo */
  #tdg-wrap #tdg-toggle {
    display: block;
    position: fixed;
    top: 4px; right: 0;
    height: 48px;
    padding: 0 var(--m);
    font-weight: 500;
    background: linear-gradient(#fff, #fff) center / calc(100% - 16px) 24px no-repeat;
    z-index: 100008;
  }

  /* Projet choisi, sous le logo */
  #tdg-now {
    display: block;
    position: fixed;
    top: 48px; left: calc(var(--m) - 8px);
    padding: 0 8px;
    background: #fff;
    z-index: 100002;
    pointer-events: none;
  }
  .tdg-open #tdg-now { visibility: hidden; }   /* le nom est déjà sous l'image */

  /* Menu plein écran */
  #tdg-menu {
    inset: 0;
    width: auto;
    padding: 88px var(--m) calc(var(--m) + env(safe-area-inset-bottom, 0px));
    z-index: 100007;
    background: #fff;
    overflow-y: auto;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  }
  .tdg-menu-open #tdg-menu { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
  #tdg-menu { box-sizing: border-box; }
  /* Pas de volets : titres fixes, tout est aligné à gauche */
  #tdg-wrap .tdg-acc h2 button { padding: 0 0 4px; cursor: default; }
  .tdg-acc h2 i { display: none; }
  .tdg-panel { transition: none !important; }
  .tdg-panel > div::after { height: 32px; }
  #tdg-tagline, #tdg-bottom, #tdg-links, #tdg-contact { padding-left: 0; }
  #tdg-wrap a.tdg-sub, #tdg-wrap a.tdg-idx { padding: 10px 0; }
  #tdg-wrap #tdg-bottom a { display: inline-block; padding: 10px 0; }
  #tdg-tagline br { display: none; }   /* le texte coule sur la largeur de l'écran */

  #tdg-caption { left: var(--m); bottom: calc(4px + env(safe-area-inset-bottom, 0px)); height: 48px; gap: 10px; }
  #tdg-wrap #tdg-cap-nav button { width: 44px; height: 48px; line-height: 48px; }
  #tdg-cap-nav { margin-right: -14px; }

  #tdg-static-page, #tdg-static-contact { top: 72px !important; left: var(--m) !important; }
}

@media (prefers-reduced-motion: reduce) {
  #tdg-wrap * { transition-duration: 0.01s !important; }
}
