/* ==========================================================================
   Dahu Theme - Bloc texte (dahu/text)
   Sur-titre, titre, sous-titre, texte et liens — tout est facultatif.
   ========================================================================== */

.text-block {
  --text-block-space: clamp(2.5rem, 5vw, 4rem);
  --text-block-max: var(--content-max);
  --text-block-eyebrow: var(--color-secondary);
  --text-block-title: var(--color-text);
  --text-block-body: var(--color-text);
  padding-block: var(--text-block-space);
}

/* --- Espacement vertical --------------------------------------------- */
.text-block--space-none {
  --text-block-space: 0rem;
}

.text-block--space-sm {
  --text-block-space: clamp(1.5rem, 3vw, 2.25rem);
}

.text-block--space-lg {
  --text-block-space: var(--section-space-y);
}

/* --- Fonds ------------------------------------------------------------ */
.text-block--bg-cream {
  background-color: var(--color-bg);
}

.text-block--bg-sand {
  background-color: var(--color-warm-sand);
}

.text-block--bg-white {
  background-color: var(--color-white);
}

.text-block--bg-dark {
  --text-block-eyebrow: var(--color-secondary-light);
  --text-block-title: var(--color-white);
  --text-block-body: var(--color-white);
  background-color: var(--color-primary);
}

/* --- Container -------------------------------------------------------- */
.text-block__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  max-width: var(--text-block-max);
  min-width: 0;
}

.text-block--width-narrow {
  --text-block-max: 46rem;
}

.text-block--width-wide {
  --text-block-max: none;
}

/* Pleine largeur : on neutralise aussi le plafond du container. */
.text-block--width-full {
  --text-block-max: none;
}

.text-block--width-full .text-block__container {
  max-width: none;
}

/* --- Alignement ------------------------------------------------------- */
.text-block--align-left .text-block__inner {
  text-align: left;
}

.text-block--align-center .text-block__inner {
  align-items: center;
  margin-inline: auto;
  text-align: center;
}

.text-block--align-right .text-block__inner {
  align-items: flex-end;
  margin-inline-start: auto;
  text-align: right;
}

/* --- Contenu ---------------------------------------------------------- */
.text-block__eyebrow.surtitle {
  margin: 0;
  color: var(--text-block-eyebrow);
}

.text-block__title.title,
.text-block__title.title.title {
  margin: 0;
  color: var(--text-block-title);
  font-size: var(--type-home-title);
  line-height: var(--leading-display);
  text-wrap: balance;
}

.text-block__subtitle.subtitle {
  margin: 0;
  max-width: 46rem;
  color: var(--text-block-body);
  font-size: var(--type-section-subtitle);
  font-weight: 400;
  letter-spacing: 0;
  line-height: var(--leading-heading);
  text-wrap: balance;
}

.text-block__text {
  max-width: 46rem;
  color: var(--text-block-body);
  font-size: var(--type-body-lg);
  line-height: var(--leading-body);
}

.text-block--width-full .text-block__text,
.text-block--width-full .text-block__subtitle.subtitle,
.text-block--width-wide .text-block__text,
.text-block--width-wide .text-block__subtitle.subtitle {
  max-width: none;
}

.text-block__text p {
  margin: 0 0 1rem;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.text-block__text p:last-child {
  margin-bottom: 0;
}

.text-block__text a {
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-block--bg-dark .text-block__text a {
  color: var(--color-secondary-light);
}

.text-block__text a:hover,
.text-block__text a:focus-visible {
  text-decoration-thickness: 2px;
}

/* --- Liens ------------------------------------------------------------ */
.text-block__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
}

.text-block--align-center .text-block__actions {
  justify-content: center;
}

.text-block--align-right .text-block__actions {
  justify-content: flex-end;
}

.text-block__action.link {
  margin-top: 0;
}

.text-block__action svg {
  flex: none;
  transition: transform var(--transition-base);
}

.text-block__action:hover svg,
.text-block__action:focus-visible svg {
  transform: translateX(3px);
}

/* Sur fond sombre, les variantes claires prennent le relais. */
.text-block--bg-dark .text-block__action.btn--primary {
  background-color: var(--color-white);
  border-color: var(--color-white);
  color: var(--color-primary);
}

.text-block--bg-dark .text-block__action.btn--primary:hover {
  background-color: var(--color-secondary-light);
  border-color: var(--color-secondary-light);
}

.text-block--bg-dark .text-block__action.btn--outline {
  background-color: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}

.text-block--bg-dark .text-block__action.btn--outline:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
}

.text-block--bg-dark .text-block__action.link {
  color: var(--color-secondary-light);
}

@media (max-width: 767px) {
  .text-block--align-right .text-block__inner {
    align-items: flex-start;
    text-align: left;
  }

  .text-block--align-right .text-block__actions {
    justify-content: flex-start;
  }

  .text-block__actions .btn {
    white-space: normal;
  }
}

/* --- Image de fond ---------------------------------------------------- */
.text-block--has-image {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/*
 * Fond pleine largeur d'écran (automatique dès qu'une image est contribuée).
 * La section garde la largeur du contenu de la page : seules les couches
 * décoratives — image et voile — débordent jusqu'aux bords de l'écran. Le
 * texte reste donc aligné au pixel près sur le reste de la page, ce qu'un
 * width:100vw sur la section ne permet pas (100vw inclut la barre de
 * défilement, d'où un décalage d'une demi-barre). Le débordement est absorbé
 * par le overflow-x: clip posé sur html/body dans variables.css.
 */
.text-block--bleed {
  overflow: visible;
}

.text-block--bleed > .text-block__bg,
.text-block--bleed > .text-block__overlay {
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
}

.text-block__bg,
.text-block__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.text-block__bg {
  z-index: 0;
  background-color: var(--color-primary);
}

.text-block__bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.96) contrast(1.02);
}

.text-block--focal-top .text-block__bg-image {
  object-position: center top;
}

.text-block--focal-bottom .text-block__bg-image {
  object-position: center bottom;
}

.text-block__overlay {
  z-index: 1;
}

.text-block--has-image .text-block__container {
  position: relative;
  z-index: 2;
}

/* Texte clair (défaut) : voile sombre, dégradé pour garder du relief. */
.text-block--image-text-light {
  --text-block-eyebrow: var(--color-secondary-light);
  --text-block-title: var(--color-white);
  --text-block-body: var(--color-white);
}

.text-block--image-text-light.text-block--overlay-light .text-block__overlay {
  background: linear-gradient(180deg, rgba(22, 33, 31, 0.18) 0%, rgba(22, 33, 31, 0.32) 100%);
}

.text-block--image-text-light.text-block--overlay-medium .text-block__overlay {
  background: linear-gradient(180deg, rgba(22, 33, 31, 0.38) 0%, rgba(22, 33, 31, 0.54) 100%);
}

.text-block--image-text-light.text-block--overlay-strong .text-block__overlay {
  background: linear-gradient(180deg, rgba(22, 33, 31, 0.58) 0%, rgba(22, 33, 31, 0.74) 100%);
}

/* Texte sombre : voile clair, pour une photo lumineuse. */
.text-block--image-text-dark {
  --text-block-eyebrow: var(--color-secondary);
  --text-block-title: var(--color-text);
  --text-block-body: var(--color-text);
}

.text-block--image-text-dark.text-block--overlay-light .text-block__overlay {
  background: rgba(251, 250, 246, 0.42);
}

.text-block--image-text-dark.text-block--overlay-medium .text-block__overlay {
  background: rgba(251, 250, 246, 0.66);
}

.text-block--image-text-dark.text-block--overlay-strong .text-block__overlay {
  background: rgba(251, 250, 246, 0.82);
}

/* Sur image, les liens reprennent les déclinaisons du fond sombre. */
.text-block--image-text-light .text-block__text a {
  color: var(--color-secondary-light);
}

.text-block--image-text-light .text-block__action.btn--primary {
  background-color: var(--color-white);
  border-color: var(--color-white);
  color: var(--color-primary);
}

.text-block--image-text-light .text-block__action.btn--primary:hover {
  background-color: var(--color-secondary-light);
  border-color: var(--color-secondary-light);
}

.text-block--image-text-light .text-block__action.btn--outline {
  background-color: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}

.text-block--image-text-light .text-block__action.btn--outline:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
}

.text-block--image-text-light .text-block__action.link {
  color: var(--color-secondary-light);
}

/* --- Hauteur minimale ------------------------------------------------- */

/*
 * Plancher commun avec le bloc texte + image (`.about-story__media-card`).
 * Les deux blocs se suivent sur une même page et doivent s'aligner : d'où la
 * même expression, et non un 624px figé — cette hauteur n'est atteinte qu'au
 * plafond du clamp, et un nombre en dur aurait désaligné les deux blocs à
 * toutes les autres largeurs. Toute valeur choisie dans « Hauteur minimale »
 * reprend la main, les règles ci-dessous venant après.
 */
.text-block {
  display: flex;
  align-items: center;
  min-height: clamp(29rem, 47vw, 39rem);
}

.text-block > .text-block__container {
  width: 100%;
}

.text-block--min-sm,
.text-block--min-md,
.text-block--min-lg {
  display: flex;
  align-items: center;
}

.text-block--min-sm .text-block__container,
.text-block--min-md .text-block__container,
.text-block--min-lg .text-block__container {
  width: 100%;
}

.text-block--min-sm {
  min-height: clamp(16rem, 34vw, 22rem);
}

.text-block--min-md {
  min-height: clamp(22rem, 46vw, 32rem);
}

.text-block--min-lg {
  min-height: clamp(28rem, 62vw, 44rem);
}

/* Les mêmes paliers que le bloc texte + image, pour rester aligné en dessous
   du bureau. */
@media (max-width: 980px) {
  .text-block {
    min-height: clamp(22rem, 68vw, 34rem);
  }
}

@media (max-width: 767px) {
  .text-block--min-lg {
    min-height: min(32rem, 80vh);
  }
}

@media (max-width: 640px) {
  .text-block {
    min-height: min(30rem, 118vw);
  }
}

/* Sur image, en mobile, le texte touchait presque le haut et le bas du bloc :
   on rend de l'air à l'espacement par défaut. Les espacements choisis
   explicitement (aucun, petit, grand) ne sont pas touchés. */
@media (max-width: 767px) {
  .text-block--has-image.text-block--space-md {
    --text-block-space: clamp(4.5rem, 18vw, 6rem);
  }
}
