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

/* Mosaïque du reportage : cadrages centrés sur les personnes, Sébastien au centre. */
.home .hb-team__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 5px;
  aspect-ratio: 1;
}
.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="Sébastien"] { 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; object-position: var(--photo-position, 50% 50%);
  transition: filter .25s ease; pointer-events: none;
}
.hb-team__tile:hover .hb-team__thumb { filter: brightness(1.06); }
.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="Sébastien"] .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; }

/* Parcellaire : neuf cases, le numéro et le cépage restent lisibles sur la photo. */
.home .hb-parcels .hb-team__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  aspect-ratio: 1;
}
.hb-parcels .hb-team__silhouette::before, .hb-parcels .hb-team__silhouette::after { content: none; }
.hb-parcels .hb-team__tile.has-photo::before {
  content: ''; position: absolute; inset: 45% 0 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(31, 33, 27, 0), rgba(31, 33, 27, .62));
}
.hb-parcels .hb-team__name,
.hb-parcels .hb-team__tile.has-photo .hb-team__name {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  left: 10px; right: 10px; bottom: 9px; z-index: 2;
  text-align: left; font-size: 11px; letter-spacing: .04em;
}
.hb-parcels .hb-team__tile.has-photo .hb-team__name { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.hb-parcel__number, .hb-parcel__variety { display: block; }
.hb-parcel__number { font: 400 26px/1 var(--font-serif); letter-spacing: 0; }
.hb-parcel__number::before { content: 'n° '; font-size: .5em; vertical-align: .55em; }
.hb-parcel__variety { font-weight: 500; }
.hb-viewer__media .hb-parcel__number { font-size: 52px; }

/* 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 (min-width: 701px) and (max-width: 1000px) {
  .home #section_4 .hb-portrait-detail { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .home #section_4 .hb-detail-story { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
  .home #section_4 .hb-story-quote { margin-top: 0; }
  .home #section_4 .hb-team { grid-column: 1; grid-row: 2; justify-self: center; width: min(540px, 100%); padding: 0; }
}
@media (max-width: 700px) {
  .home #section_4 .hb-portrait-detail { display: flex; flex-direction: column; gap: 32px; }
  .home #section_4 .hb-detail-story { display: contents; padding: 0; }
  .home #section_4 .hb-copy { text-align: left; }
  .home #section_4 .hb-copy p { text-align: left; hyphens: none; }
  .home #section_4 .hb-team { order: 1; width: 100%; padding: 0; }
  .home .hb-team__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    grid-auto-flow: dense;
    aspect-ratio: 3 / 4;
    gap: 3px;
  }
  .home .hb-team__tile {
    grid-column: var(--mobile-column) !important;
    grid-row: var(--mobile-row) !important;
  }
  .home .hb-parcels .hb-team__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); aspect-ratio: 1; }
  .hb-parcels .hb-team__name, .hb-parcels .hb-team__tile.has-photo .hb-team__name { left: 7px; right: 7px; bottom: 6px; font-size: 10px; }
  .hb-parcel__number { font-size: 21px; }
  .home .hb-team__tile--sebastien::after { opacity: 1; transform: none; }
  .home .hb-container .hb-team__caption { margin-top: 12px; max-width: 270px; }
  .hb-handwriting { font-size: clamp(28px, 7.4vw, 35px); line-height: 1.45; }
  .home .hb-container .hb-story-quote { order: 2; margin-top: 8px; padding-inline: 9px; }
  .hb-story-quote cite { margin-top: 18px; }
  .hb-viewer { height: 100dvh; }
  .hb-viewer.is-open { background: rgba(31, 33, 27, .985); }
  .hb-viewer__media { touch-action: pan-y pinch-zoom; }
  .hb-viewer__footer { left: 20px; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); gap: 14px; }
  .hb-viewer__caption { min-width: 0; flex: 1; }
  .hb-viewer__title { font-size: 13px; line-height: 1.4; }
  .hb-viewer__close { top: calc(16px + env(safe-area-inset-top)); right: 20px; }
  .hb-viewer button { width: 48px; height: 48px; 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; }
}

.home .hb-portrait.hb-team .hb-team__thumb { aspect-ratio: auto; }

/* Le reportage garde son cadrage entier, y compris sur téléphone. */
.home #section_4 .hb-history-scenes img { height: auto; aspect-ratio: auto; }
@media (max-width: 700px) {
  .home #section_4 .hb-history-scenes { display: flex; flex-direction: column; gap: 28px; }
  .home #section_4 .hb-history-scenes .hb-duo-small { width: 82%; padding-top: 0; }
  .home #section_4 .hb-history-scenes .hb-duo-large { width: 100%; }
}
