/* Accueil — carnet d’ingénierie (folio articles)
   Réf. cards projets (.rx-card-media) : aspect 5/6, rayon ~1.25rem, --fs-card-title */
.home-folio {
  --hf-orange: var(--color-secondary, #f1894e);
  --hf-ink: #f8fafc;
  --hf-muted: rgb(148 163 184);
  --hf-line: rgba(255, 255, 255, 0.12);
  --hf-radius: 1.25rem; /* = .rx-card-link */
  --hf-pad: clamp(1.15rem, 0.9rem + 0.8vw, 1.65rem);
  /* Encoche BR en px (même géométrie que réalisations) — appliquée via JS clip-path */
  --hf-btn-inset: 40px;
  --hf-btn-size: 2.75rem;
  /* Mobile : repli ; desktop écrase via container query sur le book */
  --hf-media-h: auto;
  --hf-title-lines: 3;
  --hf-clip: none;
  color: var(--hf-ink);
  background: transparent;
}

main section.home-folio.py-24,
main section.home-folio[class*="sm:py-"],
main section.home-folio[class*="2xl:py-"] {
  padding-block: clamp(4.5rem, 5.5vw, 7.5rem) !important;
}

.home-folio__inner {
  width: 100%;
  max-width: var(--vitrine-wide-max, 96rem);
  margin-inline: auto;
  background: transparent;
}

.home-folio__clip-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* En-tête */
.home-folio__header {
  display: grid;
  gap: 1.25rem 2rem;
  margin-bottom: clamp(1.75rem, 1.2rem + 1.2vw, 2.75rem);
}
@media (min-width: 900px) {
  .home-folio__header {
    grid-template-columns: minmax(0, 1.55fr) minmax(14rem, 0.85fr);
    align-items: end;
  }
}

.home-folio__eyebrow {
  margin: 0 0 0.65rem;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.8125rem, 0.76rem + 0.18vw, 0.9375rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(203 213 225);
}

.home-folio__title {
  margin: 0;
  max-width: 18ch;
  font-family: var(--font-title, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(2rem, 1.35rem + 2.1vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: #fff;
  text-wrap: balance;
}
.home-folio__title-accent {
  color: var(--hf-orange);
}

.home-folio__lead {
  margin: 0;
  max-width: 36ch;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.95rem, 0.88rem + 0.28vw, 1.125rem);
  line-height: 1.65;
  color: rgb(203 213 225);
  text-align: left;
  justify-self: start;
}
@media (min-width: 900px) {
  .home-folio__lead {
    justify-self: end;
    padding-bottom: 0.35rem;
  }
}

/* Folio */
.home-folio__book {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-radius: var(--hf-radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.42);
  overflow: hidden;
  transition: grid-template-columns 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  container-type: inline-size;
  container-name: home-folio-book;
}

@media (min-width: 1024px) {
  .home-folio__book {
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-items: stretch;
  }
  .home-folio__book[data-active="2"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.85fr) minmax(0, 1fr);
  }
  .home-folio__book[data-active="3"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.85fr);
  }
  /*
   * Hauteur média = aspect 5/6 d’une carte 1/3 (réf. .rx-projects-grid),
   * hauteur commune aux 3 chapitres — le chapitre actif s’élargit sans grandir.
   * (variables sur le book : 100cqw exige le conteneur)
   */
  .home-folio__book {
    --hf-media-h: calc((100cqw / 3 - 2 * var(--hf-pad)) * 6 / 5);
    /* Bouton ≈ 9.6% de la largeur de référence 1/3 (= 8% de la hauteur 5/6) */
    --hf-btn-size: max(2.75rem, calc(var(--hf-media-h) * 0.08));
  }
}

.home-folio__chapter {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 0.85rem 0;
  min-width: 0;
  padding: var(--hf-pad);
  background: transparent;
  align-content: start;
}

@media (min-width: 1024px) {
  .home-folio__chapter {
    grid-row: span 4;
  }
  @supports (grid-template-rows: subgrid) {
    .home-folio__chapter {
      grid-template-rows: subgrid;
      row-gap: 0.85rem;
    }
  }
  .home-folio__chapter:not(:first-child)::before {
    content: "";
    position: absolute;
    top: 1.15rem;
    bottom: 1.15rem;
    left: 0;
    width: 1px;
    background: var(--hf-line);
    pointer-events: none;
  }
}

.home-folio__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  min-width: 0;
  min-height: 1.5rem;
}

.home-folio__num {
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.875rem, 0.82rem + 0.16vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgb(203 213 225);
  font-variant-numeric: tabular-nums;
}

.home-folio__dash {
  display: inline-block;
  width: 1.15rem;
  height: 2px;
  border-radius: 999px;
  background: rgba(241, 137, 78, 0.55);
  flex-shrink: 0;
}
.home-folio__chapter.is-active .home-folio__dash {
  background: var(--hf-orange);
}

.home-folio__cat {
  margin: 0;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.8125rem, 0.76rem + 0.16vw, 0.9375rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(226 232 240);
}

.home-folio__status {
  margin-left: auto;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.8125rem, 0.76rem + 0.14vw, 0.9375rem);
  font-weight: 600;
  color: var(--hf-muted);
  white-space: nowrap;
}
.home-folio__status::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.9em;
  margin-right: 0.65rem;
  vertical-align: -0.1em;
  background: rgba(255, 255, 255, 0.22);
}
.home-folio__status--link {
  color: #67e8f9;
  text-decoration: none;
}
.home-folio__status--link:hover,
.home-folio__status--link:focus-visible {
  color: #ecfeff;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.home-folio__status--link:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

.home-folio h3.home-folio__chapter-title {
  margin: 0;
  /* Hauteur commune : titre le plus long en colonne étroite */
  min-height: calc(1.2 * 1.4rem * var(--hf-title-lines));
  font-family: var(--font-title, ui-sans-serif, system-ui, sans-serif);
  font-size: var(--fs-card-title, clamp(1.15rem, 1.55vw, 1.4rem));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: rgb(226 232 240);
  text-wrap: balance;
}
.home-folio__title-link {
  color: inherit;
  text-decoration: none;
}
.home-folio__title-link:hover,
.home-folio__title-link:focus-visible {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.home-folio__title-link:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 3px;
  border-radius: 0.2rem;
}
.home-folio__media-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.home-folio__media-link .home-folio__img {
  pointer-events: none;
}
.home-folio__chapter.is-active h3.home-folio__chapter-title {
  font-size: clamp(1.25rem, 1.15rem + 0.45vw, 1.65rem);
  color: #fff;
}
@media (min-width: 1600px) {
  .home-folio__chapter.is-active h3.home-folio__chapter-title {
    font-size: clamp(1.45rem, 0.95rem + 0.55vw, 2.35rem);
  }
}

/* Visuel + encoche (réf. réalisations) */
.home-folio__visual {
  position: relative;
  flex-shrink: 0;
  margin-top: 0;
  width: 100%;
  align-self: stretch;
}

.home-folio__media {
  position: relative;
  width: 100%;
  height: var(--hf-media-h);
  /* Mobile / tablette : proportion card sans hauteur desktop */
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: transparent;
  border: none;
  /* clip-path pixel (JS) = encoche non déformée */
  -webkit-clip-path: var(--hf-clip);
  clip-path: var(--hf-clip);
}

@media (min-width: 1024px) {
  .home-folio__media {
    aspect-ratio: auto; /* hauteur pilotée par --hf-media-h (5/6 d’1/3) */
  }
}

.home-folio__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  -webkit-clip-path: var(--hf-clip);
  clip-path: var(--hf-clip);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.home-folio__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* Cadrages individuels — sujets identifiables (fruit, personnes, écran) */
.home-folio__chapter:nth-child(1) .home-folio__img {
  object-position: center 58%;
}
.home-folio__chapter:nth-child(2) .home-folio__img {
  object-position: center 42%;
}
.home-folio__chapter:nth-child(3) .home-folio__img {
  object-position: center 40%;
}

.home-folio__preview {
  position: absolute;
  z-index: 3;
  /* Centre = 40px des bords (460/500 · 560/600), comme .rx-card-arrow */
  left: calc(100% - var(--hf-btn-inset));
  top: calc(100% - var(--hf-btn-inset));
  box-sizing: border-box;
  width: var(--hf-btn-size);
  height: var(--hf-btn-size);
  min-width: 2.75rem;
  min-height: 2.75rem;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 9999px;
  border: 1.5px solid rgba(226, 232, 240, 0.5);
  background: #0b1220;
  color: #e2e8f0;
  cursor: pointer;
  appearance: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.home-folio__preview:hover {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(30, 41, 59, 0.98);
}
.home-folio__preview:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 3px;
}
.home-folio__chapter.is-active .home-folio__preview {
  background: var(--hf-orange);
  border-color: var(--hf-orange);
  color: #0b1220;
}

.home-folio__preview-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.home-folio__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-height: 2rem;
  padding-top: 0.15rem;
}

.home-folio__preview-label {
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(0.9375rem, 0.88rem + 0.18vw, 1.0625rem);
  font-weight: 700;
  line-height: 1.35;
  color: rgb(226 232 240);
}
.home-folio__chapter.is-active .home-folio__preview-label {
  color: var(--hf-orange);
}

.home-folio__read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--hf-orange);
  font-weight: 700;
  font-size: var(--vitrine-cta-fs, 1rem);
  text-decoration: none;
  min-height: 2.75rem;
}
.home-folio__read:hover {
  color: #ffb07a;
}
.home-folio__read:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 3px;
  border-radius: 0.25rem;
}
.home-folio__read svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.15s ease;
}
.home-folio__read:hover svg {
  transform: translateX(2px);
}

.home-folio__cta-wrap {
  margin-top: clamp(1.5rem, 1.1rem + 1vw, 2.25rem);
  display: flex;
  justify-content: flex-end;
}

.home-folio__all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-sizing: border-box;
  min-height: var(--vitrine-cta-min-h, 3.5rem);
  padding: var(--vitrine-cta-pad-y, 1rem) var(--vitrine-cta-pad-x, 2rem);
  border-radius: var(--vitrine-cta-radius, 999px);
  border: 1px solid rgba(226, 232, 240, 0.45);
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: var(--vitrine-cta-fs, 1rem);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.home-folio__all:hover {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(255, 255, 255, 0.65);
}
.home-folio__all:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 3px;
}
.home-folio__all svg {
  width: 1.05rem;
  height: 1.05rem;
  transition: transform 0.15s ease;
}
.home-folio__all:hover svg {
  transform: translateX(3px);
}

@supports not (clip-path: path('M0 0H1V1H0Z')) {
  .home-folio__media {
    -webkit-clip-path: none;
    clip-path: none;
    border-radius: 1.15rem;
  }
  .home-folio__media::after {
    -webkit-clip-path: none;
    clip-path: none;
    border-radius: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-folio__book {
    transition: none;
  }
  .home-folio__preview,
  .home-folio__read svg,
  .home-folio__all svg {
    transition: none;
  }
}

/* Mobile / tablette : empilement */
@media (max-width: 1023px) {
  .home-folio__book {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none;
  }
  .home-folio__chapter {
    grid-row: auto;
    grid-template-rows: auto auto auto auto;
  }
  .home-folio__chapter:not(:first-child) {
    border-top: 1px solid var(--hf-line);
  }
  .home-folio__chapter:not(:first-child)::before {
    content: none;
  }
  .home-folio h3.home-folio__chapter-title {
    min-height: 0;
  }
  .home-folio__title {
    max-width: none;
  }
  .home-folio__lead {
    max-width: none;
    justify-self: start;
  }
  .home-folio__cta-wrap {
    justify-content: stretch;
  }
  .home-folio__all {
    width: 100%;
  }
}
