/* ==========================================================================
   Miss Patate Douce de la Drôme — page Mentions légales
   Page de texte : seul effet, un léger parallax des patates de l'en-tête. Sommaire collant à gauche (ancres + partie en cours).
   ========================================================================== */

html { scroll-behavior: smooth; }
.page-legal { --toc-top: calc(var(--header-h) + 1.5rem); }

/* ============ EN-TÊTE DE PAGE ============ */
/* deux colonnes : le texte (largeur de son contenu) puis la zone d'illustration, qui va jusqu'au bord droit de l'écran.
   L'illustration, agrandie, est centrée horizontalement entre le titre et le bord droit ; elle est posée en bas
   et passe en partie sous les buttes de la section suivante (peintes par-dessus). */
.lhero {
  --lh-edge: calc(clamp(34px, 5.6vw, 92px) * .8);                   /* sommet des buttes de la section suivante */
  --lh-head: calc(clamp(.75rem, 1.5vw, 1.25rem) * 2 + clamp(120px, 12vw, 184px) * .4375); /* bas réel du header (marges + logo 1200×525) */
  position: relative; overflow: hidden;
  padding-left: calc(max(0px, (100% - var(--maxw)) / 2) + var(--pad-x)); /* même marge gauche que .container */
  display: grid; grid-template-columns: max-content minmax(0, 1fr);
}
.lhero__speckles { position: absolute; inset: 0; pointer-events: none; }
.lhero__inner { position: relative; z-index: 1; padding: calc(var(--header-h) + clamp(3rem, 8vw, 7rem)) 0 clamp(7rem, 13vw, 12rem); }
.lhero__art { position: relative; display: grid; align-items: end; padding-top: var(--lh-head); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 650; font-size: .95rem; }
.crumbs li + li::before { content: ""; display: inline-block; width: .38em; height: .38em; margin-right: .6rem; border-radius: 50%; border: 1.5px solid currentColor; vertical-align: .12em; }
/* lien « Accueil » : graisse plus fine que la page en cours, sans soulignement, blanc au survol */
.crumbs a { font-weight: 400; text-decoration: none; transition: color .3s; }
.crumbs a:hover, .crumbs a:focus-visible { color: #fff; }
.lhero__script { margin-top: clamp(2rem, 5vw, 3.5rem); color: #fff; }
/* nom de marque relié au site (https://www.patate-douce-drome.fr) : sans soulignement, couleur au survol
   (texte violet -> rouge, texte rouge -> violet, texte clair du footer -> corail) */
.brand-link, .idcard .brand-link { color: inherit; text-decoration: none; transition: color .3s; }
.t-cream .brand-link:hover, .t-cream .brand-link:focus-visible { color: var(--red); }
.legal .prose strong .brand-link:hover, .legal .prose strong .brand-link:focus-visible { color: var(--plum); }
.t-plum .brand-link:hover, .t-plum .brand-link:focus-visible { color: var(--coral); }
.lhero__title { margin-top: .12em; max-width: 9ch; }
.lhero__meta { margin-top: clamp(1.25rem, 2.5vw, 2rem); font-weight: 650; font-stretch: 88%; font-size: clamp(1.05rem, 1.5vw, 1.35rem); }
.lhero__illu {
  --w: min(115%, 52rem);
  width: var(--w); max-width: none; margin-inline: calc((100% - var(--w)) / 2);
  /* --py : décalage de parallax posé par legal.js au scroll */
  transform: translateY(calc(9% + var(--py, 0px))) rotate(-9deg);
  will-change: transform;
  filter: drop-shadow(0 22px 30px rgba(42, 7, 21, .22));
  pointer-events: none;
}

/* ============ CONTENU ============ */
.legal { position: relative; padding-block: clamp(3.5rem, 7vw, 6.5rem) 0; }
.legal__grid { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 7rem); align-items: start; }

/* ---------- Sommaire ---------- */
.toc { position: sticky; top: var(--toc-top); transition: top .8s var(--ease-out); }
.toc__card {
  position: relative; padding: 1.4rem 1.1rem 1.1rem;
  border-radius: var(--radius); background: var(--paper);
  box-shadow: 0 0 0 1.5px var(--line), 0 26px 50px -34px rgba(42, 7, 21, .45);
}
.toc__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0 .55rem .9rem; }
.toc__head .script { font-size: clamp(1.9rem, 2.4vw, 2.4rem); color: var(--red); }
.toc__count { font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toc__list { position: relative; }
.toc__list li + li { border-top: 1px solid var(--line); }
.toc__link {
  position: relative; display: grid; grid-template-columns: 2.1rem minmax(0, 1fr) 1.1rem; align-items: center; gap: .5rem;
  padding: .85rem .75rem .85rem .6rem; border-radius: 1rem;
  font-weight: 650; font-size: .98rem; line-height: 1.2; text-decoration: none;
  transition: background-color .45s var(--ease-out), color .45s var(--ease-out);
}
.toc__num { font-weight: 800; font-stretch: 75%; font-size: 1.15rem; letter-spacing: .02em; color: var(--coral); font-variant-numeric: tabular-nums; transition: color .45s; }
.toc__short { display: none; }
.toc__arrow { width: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: translateX(-.5rem); transition: opacity .45s, transform .6s var(--ease-out); }
.toc__link:hover { background: rgba(250, 55, 74, .1); }
.toc__link:hover .toc__arrow { opacity: .6; transform: none; }
/* partie en cours : pastille prune comme le menu du haut */
.toc__link.is-active { background: var(--plum); color: var(--paper); }
.toc__link.is-active .toc__num { color: var(--coral); }
.toc__link.is-active .toc__arrow { opacity: 1; transform: none; }
.toc__list li:has(.is-active) + li, .toc__list li:has(+ li .is-active) { border-color: transparent; }
.toc__progress { height: 4px; margin: 1rem .55rem 0; border-radius: 4px; background: var(--line); overflow: hidden; }
.toc__progress span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--coral); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; }

/* ---------- Parties ---------- */
.legal__body { min-width: 0; padding-bottom: clamp(2rem, 5vw, 4rem); }
.part { scroll-margin-top: calc(var(--header-h) + 1.5rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.part + .part { padding-top: clamp(3rem, 6vw, 5rem); border-top: 1.5px solid var(--line); }
.part__title {
  display: flex; flex-direction: column; gap: .35rem;
  margin-bottom: clamp(1.4rem, 2.6vw, 2.2rem);
  font-weight: 800; font-stretch: 78%; font-size: clamp(2rem, 4vw, 3.6rem); line-height: .98; letter-spacing: -.008em;
  text-wrap: balance;
}
.part__num {
  font-weight: 800; font-stretch: 75%; font-size: clamp(3.4rem, 6vw, 5.6rem); line-height: .85; letter-spacing: -.01em;
  color: transparent; -webkit-text-stroke: 1.5px var(--coral);
}
.legal .prose { max-width: 44rem; }
.legal .prose strong { color: var(--red); }
.part .prose + .idcard { margin-top: 1.6rem; }

/* fiche d'identité : libellé / valeur, séparés par des filets */
.idcard { max-width: 52rem; }
.idcard__row { display: grid; grid-template-columns: minmax(11rem, 17rem) minmax(0, 1fr); gap: .35rem 2rem; padding-block: 1rem; border-top: 1px solid var(--line); }
.idcard dt { font-weight: 750; font-stretch: 88%; }
.idcard dd { margin: 0; overflow-wrap: anywhere; }
.idcard a { text-decoration: underline; text-decoration-color: var(--coral); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.idcard--text dd { color: var(--muted); }
.idcard dd p + p { margin-top: .75em; }
.idcard--text dt { color: var(--red); }

.legal__back { margin-top: 1rem; }
/* page 404 : bouton dans l'en-tête corail (mêmes couleurs que sur fond crème), pied de page collé à l'en-tête */
.lhero__back { margin-top: clamp(1.75rem, 3.5vw, 2.75rem); --fg: var(--plum); --bg: var(--cream); }
.page-404 .footer { margin-top: 0; }
.legal__back .btn__icon { transition: transform .7s var(--ease-out); }
.legal__back:hover .btn__icon { transform: translateX(-.2rem) scale(1.08); }

/* ============ Tablette / mobile : sommaire en barre de pastilles collante ============ */
@media (max-width: 1023px) {
  .legal__grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .toc { z-index: 150; top: .75rem; margin-inline: calc(var(--pad-x) * -1); padding-inline: var(--pad-x); }
  /* quand le header est visible, la barre se cale dessous */
  .is-header-shown .toc { top: calc(var(--header-h) + .5rem); }
  .toc__card { padding: .35rem; border-radius: 999px; box-shadow: 0 16px 34px -18px rgba(42, 7, 21, .5); }
  .toc__head, .toc__progress { display: none; }
  .toc__list { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-padding-inline: .35rem; }
  .toc__list::-webkit-scrollbar { display: none; }
  .toc__list li + li { border: 0; }
  .toc__link { display: flex; gap: .4rem; padding: .7rem 1rem; border-radius: 999px; font-size: .92rem; white-space: nowrap; }
  .toc__num { font-size: 1rem; }
  .toc__label, .toc__arrow { display: none; }
  .toc__short { display: inline; }
  .part { scroll-margin-top: calc(var(--header-h) + 5rem); }
  /* une seule colonne : l'illustration passe sous le texte, calée à droite */
  .lhero { grid-template-columns: minmax(0, 1fr); padding-inline: var(--pad-x); }
  .lhero__inner { padding: calc(var(--header-h) + clamp(3rem, 8vw, 7rem)) 0 0; }
  .lhero__art { justify-items: end; padding: 0; margin-top: -1rem; }
  .lhero__illu { --w: min(60vw, 26rem); margin-inline: 0 -6vw; }
}
@media (max-width: 767px) {
  .lhero__script { font-size: 1.7rem; }
  .lhero__title { font-size: clamp(3.3rem, 15vw, 6rem); }
  .lhero__art { margin-top: 0; }
  .lhero__illu { --w: 70vw; margin-inline: 0 -10vw; }
  .idcard__row { grid-template-columns: minmax(0, 1fr); gap: .15rem; padding-block: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
