/*
 * FAQ at the end of the Prestations page: intro on the left, accordion on the right,
 * then a chocolate card with palm leaves inviting to write (same frame as the Contact panel).
 */
.faq {
  --faq-line: rgb(45 22 6 / 14%);
  --faq-radius: clamp(18px, 1.8vw, 26px);
  --faq-number: 2.75rem;
  --faq-gap: 16px;

  padding: clamp(64px, 7vw, 110px) clamp(16px, 4.2vw, 60px) clamp(72px, 8vw, 120px);
  background:
    radial-gradient(40% 28% at 12% 34%, rgb(239 210 204 / 45%), transparent),
    radial-gradient(36% 26% at 92% 62%, rgb(54 60 28 / 7%), transparent),
    var(--color-cream);
  color: var(--color-brown);
  scroll-margin-top: var(--header-height);
}

.faq__inner {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
  max-width: 1200px;
  margin-inline: auto;
}

.faq__intro {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

.faq__eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgb(45 22 6 / 70%);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.faq__eyebrow::after {
  content: "";
  width: 40px;
  height: 1px;
  background-color: var(--color-olive);
}

.faq__title {
  margin-top: 18px;
  font-size: clamp(2.5rem, 4.2vw, 3.75rem);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}

.faq__title-initial {
  font-family: var(--font-script);
  font-size: 1.06em;
}

.faq__subtitle {
  max-width: 30ch;
  margin-top: 18px;
  color: rgb(45 22 6 / 80%);
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  font-weight: 300;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Accordion */
.faq__list {
  border-top: 1px solid var(--faq-line);
}

.faq-item {
  border-bottom: 1px solid var(--faq-line);
}

.faq-item__toggle {
  display: grid;
  grid-template-columns: var(--faq-number) minmax(0, 1fr) auto;
  gap: var(--faq-gap);
  align-items: center;
  width: 100%;
  padding: 26px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.faq-item__toggle:focus-visible {
  outline: 2px solid var(--color-olive);
  outline-offset: 2px;
}

.faq-item__number {
  color: var(--color-olive);
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-style: italic;
  line-height: 1;
}

.faq-item__question {
  font-size: clamp(1.0625rem, 1.45vw, 1.25rem);
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
  transition: color var(--duration-fast) var(--ease-out);
}

.faq-item__toggle:hover .faq-item__question {
  color: var(--color-olive);
}

/* "+" made of two bars; the vertical one lies down to form "−" once open. */
.faq-item__icon {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(54 60 28 / 40%);
  border-radius: 50%;
  transition:
    background-color 300ms var(--ease-out),
    border-color 300ms var(--ease-out);
}

.faq-item__icon::before,
.faq-item__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background-color: var(--color-olive);
  translate: -50% -50%;
  transition:
    rotate 300ms var(--ease-out),
    background-color 300ms var(--ease-out);
}

.faq-item__icon::after {
  rotate: 90deg;
}

.faq-item__toggle:hover .faq-item__icon {
  border-color: var(--color-olive);
}

.faq-item.is-open .faq-item__icon {
  border-color: var(--color-olive);
  background-color: var(--color-olive);
}

.faq-item.is-open .faq-item__icon::before,
.faq-item.is-open .faq-item__icon::after {
  background-color: var(--color-cream);
}

.faq-item.is-open .faq-item__icon::after {
  rotate: 0deg;
}

/* Answers are collapsed only once the accordion controller is connected. */
.faq-item__panel {
  display: grid;
  grid-template-rows: 1fr;
}

.faq__list.is-ready .faq-item__panel {
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 450ms var(--ease-out),
    visibility 0s linear 450ms;
}

.faq__list.is-ready .faq-item.is-open .faq-item__panel {
  grid-template-rows: 1fr;
  visibility: visible;
  transition:
    grid-template-rows 450ms var(--ease-out),
    visibility 0s;
}

.faq-item__answer {
  min-height: 0;
  overflow: hidden;
}

.faq-item__answer p {
  max-width: 62ch;
  padding: 0 calc(40px + var(--faq-gap)) 28px calc(var(--faq-number) + var(--faq-gap) + 4px);
  color: rgb(45 22 6 / 82%);
  font-size: 1rem;
  line-height: 1.7;
  text-wrap: pretty;
  transition: opacity 450ms var(--ease-out);
}

.faq__list.is-ready .faq-item:not(.is-open) .faq-item__answer p {
  opacity: 0;
}

/* "Tu as encore une question ?" */
.faq-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-width: 1200px;
  margin: clamp(56px, 6vw, 96px) auto 0;
  padding: clamp(44px, 5vw, 72px) clamp(24px, 4vw, 56px);
  border-radius: var(--faq-radius);
  background-color: var(--color-brown-warm);
  box-shadow: 0 24px 48px rgb(45 22 6 / 22%);
  color: var(--color-cream);
  text-align: center;
}

.faq-cta__leaf {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  filter: saturate(0.7);
}

.faq-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    100deg,
    rgb(55 27 8 / 96%) 0%,
    rgb(55 27 8 / 88%) 55%,
    rgb(55 27 8 / 66%) 100%
  );
}

.faq-cta::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgb(248 245 239 / 18%);
  border-radius: calc(var(--faq-radius) - 6px);
  pointer-events: none;
}

.faq-cta__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
}

.faq-cta__title em {
  color: var(--color-powder);
  font-style: italic;
}

.faq-cta__text {
  max-width: 46ch;
  margin: 14px auto 0;
  color: rgb(248 245 239 / 85%);
  font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
  font-weight: 300;
  line-height: 1.65;
  text-wrap: pretty;
}

.faq-cta__button {
  --btn-bg: var(--color-cream);
  --btn-color: var(--color-brown);
  --btn-border: var(--color-cream);
  --btn-hover-mix: var(--color-powder);
  --btn-focus: var(--color-cream);

  position: relative;
  margin-top: 28px;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 700;
}

@media (max-width: 899.98px) {
  .faq__inner {
    grid-template-columns: minmax(0, 1fr);
    max-width: 680px;
  }

  .faq__intro {
    position: static;
  }
}

@media (max-width: 559.98px) {
  .faq {
    --faq-number: 2rem;
    --faq-gap: 12px;
  }

  .faq-item__toggle {
    padding-block: 22px;
  }

  .faq-item__icon {
    width: 36px;
    height: 36px;
  }

  .faq-item__answer p {
    padding-right: 0;
  }
}

/* Reveal: hidden only once JS is ready and motion is allowed, see reveal_controller.js. */
.faq [data-reveal-target="item"] {
  transition:
    opacity 800ms var(--ease-out) var(--reveal-delay, 0ms),
    translate 800ms var(--ease-out) var(--reveal-delay, 0ms);
}

.faq__title {
  --reveal-delay: 100ms;
}

.faq__subtitle {
  --reveal-delay: 200ms;
}

.faq__list {
  --reveal-delay: 250ms;
}

@media (prefers-reduced-motion: no-preference) {
  .faq.is-reveal-ready [data-reveal-target="item"]:not(.is-revealed) {
    opacity: 0;
    translate: 0 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq__list.is-ready .faq-item__panel,
  .faq__list.is-ready .faq-item.is-open .faq-item__panel,
  .faq-item__answer p,
  .faq-item__icon,
  .faq-item__icon::before,
  .faq-item__icon::after {
    transition: none;
  }
}
