@font-face {
  font-family: 'HB Hand';
  src: url('../fonts/oooh-baby-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.home #section_4 .hb-copy p { text-align: justify; hyphens: auto; }
.home .hb-container .hb-story-quote { margin: 36px 0 0; }
.hb-story-quote blockquote { margin: 0; }
.hb-handwriting {
  color: var(--c-dark);
  font: 400 clamp(26px, 2.5vw, 34px)/1.4 'HB Hand', 'Segoe Script', cursive;
  letter-spacing: 0;
  text-wrap: pretty;
}
.hb-story-quote cite {
  display: block;
  margin-top: 22px;
  color: var(--c-text);
  font: normal 400 12px/1.5 var(--font-main);
  letter-spacing: .04em;
}
.hb-handwriting__word { display: inline-block; padding: 0 .14em; margin: 0 -.14em; }
.hb-handwriting.is-prepared .hb-handwriting__word {
  opacity: 0;
  clip-path: inset(-20% 100% -20% 0);
}
.hb-handwriting.is-writing .hb-handwriting__word {
  animation: hb-write-word var(--ink-duration, 380ms) ease-out var(--ink-delay, 0ms) both;
}
@keyframes hb-write-word {
  from { opacity: 0; clip-path: inset(-20% 100% -20% 0); }
  12% { opacity: 1; }
  to { opacity: 1; clip-path: inset(-20% -4% -20% -4%); }
}
.hb-story-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Les emplacements sont neutres jusqu'au choix des portraits. Une seule
   vignette de 160/320 px par case ; l'original reste dans data-full-src. */
.home .hb-team__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  aspect-ratio: 3 / 4;
}
.hb-team__tile {
  position: relative; display: block; min-width: 0; min-height: 0;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  overflow: hidden; background: #dedbd1; color: #6d7161;
  cursor: zoom-in; isolation: isolate;
}
.hb-team__tile:nth-child(even) { background: #e8e4dc; color: #888274; }
.hb-team__tile:nth-child(3n) { background: #d6dbd2; color: #798373; }
.hb-team__tile[data-name='Seb'] { background: #c7cdbd; color: #515c47; }
.hb-team__tile::after {
  content: '+'; position: absolute; right: 7px; top: 5px;
  font: 300 20px/1 sans-serif; opacity: 0; transform: translateY(3px);
  transition: opacity .2s, transform .2s; z-index: 2;
}
.hb-team__tile:hover::after, .hb-team__tile:focus-visible::after { opacity: 1; transform: none; }
.hb-team__tile:focus-visible { outline: 2px solid var(--c-dark); outline-offset: 3px; z-index: 3; }
.hb-team__silhouette { position: absolute; inset: 0; display: block; transition: transform .4s ease; }
.hb-team__silhouette::before {
  content: ''; position: absolute; width: 30%; aspect-ratio: 1; border-radius: 50%;
  top: 22%; left: 35%; background: currentColor; opacity: .16;
}
.hb-team__silhouette::after {
  content: ''; position: absolute; width: 65%; height: 42%; border-radius: 50% 50% 0 0;
  bottom: 0; left: 17.5%; background: currentColor; opacity: .12;
}
.hb-team__tile:hover .hb-team__silhouette { transform: scale(1.035); }
.hb-team__tile .hb-team__thumb {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease; pointer-events: none;
}
.hb-team__tile:hover .hb-team__thumb { transform: scale(1.04); }
.hb-team__name {
  position: absolute; bottom: 7px; left: 0; right: 0; z-index: 1;
  text-align: center; font: 400 10px/1.3 var(--font-main); letter-spacing: .06em;
}
.hb-team__tile[data-name='Seb'] .hb-team__name { font-size: 12px; font-weight: 500; }
.hb-team__tile.has-photo .hb-team__name { display: none; }
.hb-team__tile.has-photo::after { color: #fff; text-shadow: 0 1px 4px #000; }
.home .hb-container .hb-team__caption { margin-top: 14px; }

/* Dialogue dans la couche supérieure : indépendant du carrousel et de ses
   transformations. La petite image reste en place pendant le chargement. */
.hb-viewer {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  color: #f3f1eb; background: rgba(31, 33, 27, 0);
  transition: background .42s ease; overscroll-behavior: contain;
}
.hb-viewer::backdrop { background: transparent; }
.hb-viewer.is-open { background: rgba(31, 33, 27, .94); }
.hb-viewer__media {
  position: absolute; margin: 0; overflow: hidden;
  background: #dedbd1; color: #6d7161; transform-origin: top left;
}
.hb-viewer__media img {
  display: block; position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none; object-fit: contain;
}
.hb-viewer__media .hb-viewer__full { animation: hb-full-photo .25s ease both; }
@keyframes hb-full-photo { from { opacity: 0; } to { opacity: 1; } }
.hb-viewer__media .hb-team__name { bottom: 6%; font-size: 20px; }
.hb-viewer button {
  display: grid; place-items: center; width: 48px; height: 48px;
  padding: 0; border: 1px solid rgba(243,241,235,.28); border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
  font: 300 25px/1 sans-serif;
}
.hb-viewer button:hover { background: rgba(255,255,255,.09); }
.hb-viewer button:focus-visible { outline: 2px solid #f3f1eb; outline-offset: 4px; }
.hb-viewer button:disabled { opacity: .25; cursor: default; }
.hb-viewer__close { position: absolute; top: 20px; right: 24px; z-index: 3; }
.hb-viewer__footer {
  position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 24px; right: 24px;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  opacity: 0; transition: opacity .25s ease;
}
.hb-viewer.is-open .hb-viewer__footer { opacity: 1; }
.hb-viewer__caption { min-width: 180px; text-align: center; }
.hb-viewer__title { display: block; font: 400 15px/1.5 var(--font-main); }
.hb-viewer__status { min-height: 18px; margin: 3px 0 0; font: 400 11px/1.5 var(--font-main); opacity: .7; }
.hb-viewer__count { display: block; margin-top: 3px; font: 400 10px/1.5 var(--font-main); letter-spacing: .12em; opacity: .6; }
.hb-viewer button.hb-viewer__retry { width: auto; height: auto; margin: 5px auto 0; border: 0; border-radius: 0; font: 400 12px/1.4 var(--font-main); text-decoration: underline; }
.hb-viewer [hidden] { display: none !important; }

@media (max-width: 1000px) {
  .hb-handwriting { font-size: 27px; }
  .home .hb-team__grid { gap: 4px; }
}
@media (max-width: 700px) {
  .home #section_4 .hb-portrait-detail { display: flex; flex-direction: column; gap: 40px; }
  .home #section_4 .hb-detail-story { order: 0; padding: 0; }
  .home #section_4 .hb-team { order: 1; width: 100%; padding: 0; }
  .hb-handwriting { font-size: 30px; }
  .home .hb-container .hb-story-quote { margin-top: 32px; }
  .hb-viewer__footer { left: 12px; right: 12px; gap: 12px; }
  .hb-viewer__caption { min-width: 0; flex: 1; }
  .hb-viewer__close { top: 12px; right: 12px; }
  .hb-viewer button { width: 44px; height: 44px; flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce), print {
  .hb-handwriting.is-prepared .hb-handwriting__word { opacity: 1; clip-path: none; animation: none; }
  .hb-team__tile *, .hb-team__tile::after, .hb-viewer, .hb-viewer * { animation: none !important; transition: none !important; }
}
