/*
 * UI components shared by every page — ported from src/components/ui/*.astro and
 * src/components/brand/Logo.astro (scoping removed; class names are BEM-namespaced).
 * Order: logo, icon, button, breadcrumbs, page hero, tile, CTA band, FAQ, WhatsApp button, call
 * picker (the last one has no Astro reference: partials/call-picker.php).
 */

/* — Logo ———————————————————————————————————————————————————— */
.logo {
  width: var(--logo-w, auto);
  height: auto;
}

/* — Icon ———————————————————————————————————————————————————— */
.icon {
  flex: none;
}

/* — Button: the pill (the only rounded shape of the system) and the text link ——— */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  letter-spacing: -0.006em;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur) var(--ease-soft),
    border-color var(--dur) var(--ease-soft),
    color var(--dur) var(--ease-soft);
}

/* Pills */
.btn--primary,
.btn--secondary {
  min-height: 2.75rem;
  padding: 0 1.375rem;
  border-radius: var(--radius-pill);
  font-size: 0.9375rem;
}

.btn--lg.btn--primary,
.btn--lg.btn--secondary {
  min-height: 3.125rem;
  padding: 0 1.75rem;
  font-size: 1.0625rem;
}

.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--btn-hover);
}

.btn--secondary {
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--btn-2-border);
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
  box-shadow: inset 0 0 0 1px var(--fg);
}

/* Text link + chevron */
.btn--link {
  min-height: 2.75rem;
  gap: 0.4em;
  font-size: clamp(1rem, 0.97rem + 0.12vw, 1.0625rem);
  color: var(--fg);
}

.btn--link:hover .btn__label,
.btn--link:focus-visible .btn__label {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
}

.btn__chev {
  width: 0.42em;
  height: auto;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-slow) var(--ease-out);
}

.btn--link:hover .btn__chev {
  transform: translateX(3px);
}

/* — Breadcrumbs ——————————————————————————————————————————————— */
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  font-size: var(--fs-xs);
  color: var(--fg-2);
}

.crumbs li + li::before {
  content: '/';
  margin-inline: 0.6rem;
  opacity: 0.5;
}

.crumbs a {
  display: inline-block;
  padding-block: 0.3rem;
  color: inherit;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.crumbs [aria-current] {
  color: var(--fg);
}

/* — Page hero: breadcrumb, centred eyebrow, title and lead; optional photograph ——— */
.phero {
  padding-block: 1rem clamp(3.5rem, 2.5rem + 4vw, 6rem);
  background: var(--paper);
}

.phero--image {
  padding-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
}

.phero__text {
  display: grid;
  gap: 1rem;
  padding-top: clamp(2rem, 1rem + 4vw, 4.5rem);
}

.phero--center .phero__text {
  justify-items: center;
  text-align: center;
}

.phero--start .phero__text {
  justify-items: start;
}

.phero__title {
  max-width: 16em;
  font-size: clamp(2.25rem, 1.35rem + 3vw, 4rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.phero__kicker {
  display: block;
  margin-bottom: 1rem;
}

.phero__main {
  display: block;
}

/* Two-tone title (page-hero's optional $tone): the second sentence in the secondary grey. */
.phero__title .tone {
  display: block;
  font-size: inherit;
  color: var(--fg-2);
}

.phero__lead {
  max-width: 44ch;
}

/* Content placed after the lead (actions, lists…). */
.phero__text > :last-child:not(p):not(h1) {
  margin-top: 0.75rem;
}

.phero__figure {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--stone-100);
}

.phero__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 47.99rem) {
  .phero__figure {
    aspect-ratio: 4 / 3;
  }

  .phero__figure--wide {
    aspect-ratio: 16 / 9;
  }
}

/* Only the hero's own text rises in; content placed after the lead appears at once. */
@media (prefers-reduced-motion: no-preference) {
  .phero__text > :is(.kicker, .phero__title, .phero__lead) {
    animation: phero-rise 1s var(--ease-out) both;
  }

  .phero__text > :is(.kicker, .phero__title, .phero__lead):nth-child(2) {
    animation-delay: 0.07s;
  }

  .phero__text > :is(.kicker, .phero__title, .phero__lead):nth-child(3) {
    animation-delay: 0.14s;
  }

  .phero__figure {
    animation: phero-fade 1.4s var(--ease-out) 0.25s both;
  }
}

@keyframes phero-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes phero-fade {
  from {
    opacity: 0;
  }
}

/* — Tile: image on top, text on a light panel, "En savoir plus ›" ————————— */
.tile {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  background: var(--stone-100);
  color: var(--ink);
  text-decoration: none;
}

.tile__media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--stone-150);
}

.tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.88);
  transition: transform var(--dur-image) var(--ease-out);
}

.tile:hover .tile__media img,
.tile:focus-visible .tile__media img {
  transform: scale(1.03);
}

.tile__body {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 1.25rem 1.25rem 1.5rem;
}

.tile__title {
  display: block;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.2;
}

.tile__text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--stone-600);
}

.tile__more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.tile__more svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-slow) var(--ease-out);
}

.tile:hover .tile__more {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.tile:hover .tile__more svg {
  transform: translateX(3px);
}

.tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* — CTA band ————————————————————————————————————————————————— */
.cta-band {
  background: var(--bg);
  color: var(--fg);
}

.cta-band__inner {
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.cta-band .lead {
  max-width: 44ch;
}

.cta-band__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.75rem;
  margin-top: 0.75rem;
}

/* — FAQ ————————————————————————————————————————————————————— */
.faq__grid {
  display: grid;
  gap: 2.5rem;
}

.faq__grid h2 {
  margin-top: 1.25rem;
}

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

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

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3rem;
  padding-block: 1.35rem;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-h4);
  font-weight: 500;
  letter-spacing: -0.008em;
  line-height: 1.35;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__icon {
  position: relative;
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
}

.faq__icon::before,
.faq__icon::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--dur) var(--ease-out);
}

.faq__icon::after {
  transform: rotate(90deg);
}

.faq__item[open] .faq__icon::after {
  transform: rotate(0deg);
}

.faq__answer {
  padding-bottom: 1.5rem;
  color: var(--fg-2);
  max-width: 64ch;
}

@media (prefers-reduced-motion: no-preference) {
  .faq__item[open] .faq__answer {
    animation: faq-open 420ms var(--ease-out);
  }
}

@keyframes faq-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@media (min-width: 64rem) {
  .faq__grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: clamp(4rem, 8vw, 9rem);
  }
}

/* — WhatsApp button ——————————————————————————————————————————
 * The familiar green round mark, bottom right. The green is a touch deeper than the app's
 * #25D366 so the white glyph keeps a 3:1 contrast. A label appears on hover/focus with a mouse. */
.wa {
  --wa-green: #1da851;
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 80; /* under the header (100) and its fly-out scrim (90) */
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  color: #fff;
  background: var(--wa-green);
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.14),
    0 8px 24px rgb(0 0 0 / 0.16);
  text-decoration: none;
  transition:
    background-color 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.wa .icon {
  stroke-width: 1.75;
}

.wa:hover {
  background: #179446;
}

.wa:active {
  transform: scale(0.96);
}

.wa:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Label to the left of the button, mouse and keyboard only. */
.wa__tip {
  position: absolute;
  right: calc(100% + 0.75rem);
  top: 50%;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
  background: var(--ink);
  opacity: 0;
  transform: translate(6px, -50%);
  pointer-events: none;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .wa:hover .wa__tip {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

.wa:focus-visible .wa__tip {
  opacity: 1;
  transform: translate(0, -50%);
}

@media (min-width: 64rem) {
  .wa {
    right: max(1.5rem, env(safe-area-inset-right));
    bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .wa {
    animation: wa-in 0.6s var(--ease-out) 0.8s both;
  }
}

@keyframes wa-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media print {
  .wa {
    display: none;
  }
}

/* — Call picker « Appeler un centre » (partials/call-picker.php, site.js) ———————————
 * A native modal <dialog>: a white sheet anchored to the bottom on phones (full width, clear of
 * the home indicator), a centred panel from 40rem, on a soft dim backdrop. One generous row per
 * centre between fine rules, the « Annuler » pill below. Sharp corners, like every panel. */
.call {
  --call-pad: var(--gutter);
  --call-from: translateY(100%);
  --call-from-opacity: 1;
  width: 100%;
  max-width: none;
  max-height: calc(100svh - 2.5rem);
  margin: auto 0 0;
  padding: 0;
  border: 0;
  background: var(--white);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 -24px 60px -30px rgb(0 0 0 / 0.3);
}

.call::backdrop {
  background: rgb(29 29 31 / 0.3);
}

.call__panel {
  padding: 1.75rem var(--call-pad) max(1.5rem, env(safe-area-inset-bottom));
}

.call__head {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
}

.call__title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* It takes the focus when the dialog opens, so that screen readers start at the title. */
.call__title:focus {
  outline: none;
}

.call__lead {
  font-size: var(--fs-small);
  color: var(--stone-600);
}

.call__list {
  margin-inline: calc(-1 * var(--call-pad));
  border-top: 1px solid var(--line);
}

.call__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'icon name num'
    'icon addr addr';
  align-items: center;
  gap: 0.15rem 1rem;
  padding: 1rem var(--call-pad);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease-soft);
}

.call__row:active {
  background: var(--paper);
}

.call__row:focus-visible {
  outline-offset: -2px;
}

.call__icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--stone-100);
  transition:
    background-color var(--dur-fast) var(--ease-soft),
    color var(--dur-fast) var(--ease-soft);
}

.call__row:focus-visible .call__icon {
  background: var(--ink);
  color: var(--white);
}

/* Hover only where a pointer hovers: a tap must not leave a row lit for the next opening. */
@media (hover: hover) {
  .call__row:hover {
    background: var(--paper);
  }

  .call__row:hover .call__icon {
    background: var(--ink);
    color: var(--white);
  }
}

.call__name {
  grid-area: name;
  font-size: var(--fs-h4);
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.25;
}

/* Proportional figures, like every phone number of the site (Mona Sans's tabular ones look
 * monospaced); the numbers sit right-aligned one above the other. */
.call__num {
  grid-area: num;
  font-variant-numeric: normal;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.004em;
  white-space: nowrap;
}

.call__addr {
  grid-area: addr;
  font-size: var(--fs-xs);
  line-height: 1.35;
  color: var(--stone-600);
}

/* A long street wraps before the postcode, never between the postcode and the locality. */
.call__place {
  white-space: nowrap;
}

.call__cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.125rem;
  margin-top: 1.5rem;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px var(--btn-2-border);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--dur-fast) var(--ease-soft);
}

.call__cancel:hover,
.call__cancel:focus-visible {
  box-shadow: inset 0 0 0 1px var(--ink);
}

@media (min-width: 40rem) {
  .call {
    --call-pad: 2rem;
    --call-from: translateY(0.75rem) scale(0.98);
    --call-from-opacity: 0;
    width: min(100% - 2rem, 26rem);
    max-height: calc(100svh - 2rem);
    margin: auto;
    box-shadow: 0 30px 80px -24px rgb(0 0 0 / 0.3);
  }

  .call__panel {
    padding-block: 2rem;
  }
}

/* The page behind does not scroll while the dialog is open (site.js sets the class). Where the
 * scrollbar takes room (Windows, macOS set to always show it), site.js measures the width it frees
 * (--call-gap) and the page and the WhatsApp button give it back: nothing shifts sideways.
 * (scrollbar-gutter: stable would not do: Chrome drops the gutter of a styled scrollbar.) */
html.call-open {
  overflow: hidden;
  padding-inline-end: var(--call-gap, 0px);
}

html.call-open .wa {
  margin-right: var(--call-gap, 0px);
}

/* Opening and closing: 200 ms while the backdrop fades. The sheet stays opaque and slides (it
 * rises easing out, and leaves easing in-out, so that it is seen going down); from 40rem the panel
 * settles and fades. Browsers without @starting-style or transition-behavior simply open and
 * close it. */
@media (prefers-reduced-motion: no-preference) {
  .call,
  .call::backdrop {
    --call-ease: var(--ease-in-out);
    transition:
      opacity var(--dur-fast) var(--call-ease),
      transform var(--dur-fast) var(--call-ease),
      overlay var(--dur-fast) allow-discrete,
      display var(--dur-fast) allow-discrete;
  }

  .call[open],
  .call[open]::backdrop {
    --call-ease: var(--ease-out);
  }

  .call:not([open])::backdrop {
    opacity: 0;
  }

  .call:not([open]) {
    opacity: var(--call-from-opacity);
    transform: var(--call-from);
    pointer-events: none;
  }

  @starting-style {
    .call[open]::backdrop {
      opacity: 0;
    }

    .call[open] {
      opacity: var(--call-from-opacity);
      transform: var(--call-from);
    }
  }
}

@media print {
  .call {
    display: none;
  }
}

/* — Cookie consent banner (partials/cookie-banner.php, js/consent.js) ———————————— */
.consent {
  position: fixed;
  z-index: 110; /* above the header (100) and the WhatsApp button */
  left: 1rem;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  max-width: 34rem;
  margin-inline: auto;
  padding: 1.25rem 1.25rem 1.125rem;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--stone-200), 0 12px 40px rgb(0 0 0 / 0.14);
}

.consent[hidden] {
  display: none;
}

.consent__title {
  margin: 0 0 0.375rem;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.consent__text {
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--stone-600);
}

.consent__text a {
  color: var(--ink);
}

.consent__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.consent__actions .btn {
  flex: 1 1 8rem;
  cursor: pointer;
  border: 0;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
}
