/* Legal reading layout (page-mentions-legales.php, page-conditions-generales-de-vente.php,
   page-politique-de-confidentialite.php, page-conditions-generales-de-vente-professionnels.php;
   template-parts/legal/reader.php; assets/js/legal.js).

   A paper page: the title band follows the page scheme (.gp-paper-top), the text sits on paper (light tokens in both
   schemes). The accent comes from the world tokens (lime for Particuliers, cream for Professionnels): --accent-ink for
   text and strokes on paper (6:1), --accent for fills. legal.js adds .is-live to .gp-lg, and .is-motion when motion is
   allowed: transitions and animations run only under .is-motion or under (prefers-reduced-motion: no-preference), and
   main.css stops every one of them under reduced motion. Only transform and opacity move.
   Without JavaScript the rail is a plain list of links and the phone « Sommaire » a native <details> in the flow;
   html.gp-js (set before the first paint) makes that bar sticky and its panel a drop-down. The page text is never
   restyled into something else: headings, lists and paragraphs keep their order and words. */

.gp-lg { --lg-card: #fff; --lg-measure: 72ch; --lg-p: 0; --lg-h: 0; }

/* ---------- Title band ---------- */
.gp-lg-hero { position: relative; overflow: hidden; isolation: isolate; padding: calc(var(--header-total) + clamp(22px, 3.2vw, 46px)) 0 var(--space-sheet); border-bottom: 1px solid var(--line); } /* the edge shows when the band is light, like the paper below */
.gp-lg-hero__inner { position: relative; z-index: 1; }
.gp-lg-hero__eyebrow { margin-bottom: .55rem; }
.gp-lg-hero__title { max-width: 14.4em; margin: 0; font-size: clamp(1.8rem, 1.2rem + 2.5vw, 3.55rem); line-height: .98; }
.gp-lg-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: clamp(14px, 1.7vw, 20px) 0 0; padding: 0; list-style: none; }
.gp-lg-meta__item { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-1); color: var(--ink-2); font-size: .86rem; font-weight: 600; line-height: 1.25; }
.gp-lg-meta__item--date { color: var(--ink); }
.gp-lg-meta__item .gp-i { width: 16px; height: 16px; color: var(--accent-ink); }
.gp-lg-hero__ghost { position: absolute; z-index: 0; right: calc(var(--gutter) + 4vw); bottom: clamp(4px, .8vw, 12px); margin: 0; font-family: var(--font-display); font-size: clamp(8rem, 13vw, 13.5rem); font-weight: 800; line-height: .82; color: transparent; -webkit-text-stroke: 1.5px color-mix(in srgb, var(--ink) 14%, transparent); translate: 0 calc(var(--lg-h) * 70px); rotate: calc(var(--lg-h) * -10deg); transform-origin: 50% 80%; pointer-events: none; user-select: none; }
@media (max-width: 899.98px) {
	.gp-lg-hero__ghost { display: none; } /* phones and tablets: the title takes the width */
}

/* Particuliers: the legal documents, as pills that scroll sideways on phones (same pattern as the Pro section nav). */
.gp-lg-docs { margin: 0 calc(var(--gutter) * -1) clamp(16px, 2.2vw, 26px); }
.gp-lg-docs__list { display: flex; gap: 8px; margin: 0; padding: 4px var(--gutter); list-style: none; overflow-x: auto; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.gp-lg-docs__list::-webkit-scrollbar { display: none; }
.gp-lg-docs__list li { flex: none; }
.gp-lg-docs__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .92rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.gp-lg-docs__link:hover { border-color: var(--accent-ink); }
.gp-lg-docs__link:focus-visible { outline-offset: -2px; } /* inside the scroller, so it is never clipped */
.gp-lg-docs__link[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-gp-world="b2b"] .gp-lg-docs__link[aria-current="page"] { border-color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent-rim); } /* G1 cue: filled against outlined; the cream alone is 1.06:1 on a light band, so a 2.5 px olive edge there (the cream itself on dark) */
.gp-lg-docs__link[aria-current="page"]:focus-visible { outline-color: var(--on-accent); outline-offset: -5px; }
@media (min-width: 1000px) {
	.gp-lg-docs { margin-inline: 0; }
	.gp-lg-docs__list { flex-wrap: wrap; overflow: visible; padding-inline: 0; }
}
.gp-lg .gp-pro-nav { margin-bottom: clamp(16px, 2.2vw, 26px); } /* Professionnels: the Espace Pro section nav (pro.css) */

/* ---------- Layout ---------- */
.gp-lg-body { padding-block: var(--space-sheet) var(--space-section); } /* a band's padding under the title band, the section room before the footer (main.css) */
.gp-lg-layout { position: relative; }
.gp-lg-doc { min-width: 0; max-width: var(--lg-measure); padding-block: 0; color: var(--ink-2); font-size: clamp(1rem, .97rem + .2vw, 1.09rem); line-height: 1.72; overflow-wrap: break-word; }

@media (min-width: 1024px) {
	.gp-lg-layout { display: grid; grid-template-columns: minmax(214px, 284px) minmax(0, var(--lg-measure)); column-gap: clamp(32px, 5vw, 96px); align-items: start; }
	.gp-lg--plain .gp-lg-layout { display: block; }
	.gp-lg-side { position: sticky; top: calc(var(--header-total) + 26px); display: grid; gap: 12px; max-height: calc(100vh - var(--header-total) - 44px); padding: 2px 4px 4px 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
	.gp-lg-bar { display: none; }
}
@media (max-width: 1023.98px) {
	.gp-lg-side, .gp-lg-progress { display: none; }
}

/* ---------- Contents list (shared by the rail and the phone panel) ---------- */
.gp-lg-toc__label { margin: 0 0 8px; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.gp-lg-toc__track { position: relative; }
.gp-lg-toc__list, .gp-lg-toc__sub { margin: 0; padding: 0; list-style: none; }
.gp-lg-toc__link { position: relative; display: grid; grid-template-columns: 2.1em minmax(0, 1fr); align-items: baseline; column-gap: 4px; min-height: 44px; padding: 11px 8px 11px 16px; border-radius: 0 10px 10px 0; color: var(--ink-2); font-size: .9rem; font-weight: 600; line-height: 1.3; text-decoration: none; text-wrap: pretty; }
.gp-lg-toc__link:hover { background: var(--surface-1); color: var(--ink); }
.gp-lg-toc__link:focus-visible { outline-offset: -2px; border-radius: 8px; }
.gp-lg-toc__n { color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.gp-lg-toc__link--sub { grid-template-columns: minmax(0, 1fr); padding-left: calc(16px + 2.1em + 4px); font-size: .85rem; font-weight: 500; }
.gp-lg-toc__link--sub .gp-lg-toc__t::before { content: "– "; content: "– " / ""; color: var(--muted); } /* decoration, not read out */
.gp-lg-toc__link.is-active { color: var(--ink); }
.gp-lg-toc__link.is-active .gp-lg-toc__n { color: var(--accent-ink); }
.gp-lg-toc__link.is-past .gp-lg-toc__n { color: var(--ink-2); }
.gp-lg-side .gp-lg-toc__list { border-left: 2px solid var(--line); }
.gp-lg-toc__glide { position: absolute; top: 0; left: 0; width: 2px; height: 1px; background: var(--accent-ink); opacity: 0; transform-origin: 0 0; transform: scaleY(0); pointer-events: none; }
.gp-lg.is-live .gp-lg-toc__glide { opacity: 1; }

.gp-lg-side__tools { display: flex; flex-wrap: wrap; gap: 0 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.gp-lg-tool { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 0 2px; border: 0; background: none; color: var(--ink); font: inherit; font-size: .88rem; font-weight: 700; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .3em; cursor: pointer; }
.gp-lg-tool:hover { text-decoration-color: var(--accent-ink); }
.gp-lg-tool .gp-i { width: 18px; height: 18px; color: var(--accent-ink); }
html:not(.gp-js) .gp-lg-print { display: none; } /* printing from the page needs the script; the browser's own print stays */

/* ---------- Phones and tablets: a sticky « Sommaire » that folds open ---------- */
@media (max-width: 1023.98px) {
	.gp-lg:not(.gp-lg--plain) .gp-lg-body { padding-top: 0; }
	.gp-lg-bar { position: relative; z-index: 30; display: flex; align-items: flex-start; gap: 6px; margin: 0 calc(-1 * var(--gutter)) clamp(18px, 3vw, 28px); padding: 6px var(--gutter); border-bottom: 1px solid var(--line); background: var(--paper); }
	html.gp-js .gp-lg-bar { position: sticky; top: var(--header-total); background: color-mix(in srgb, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
	.gp-lg-bar__nav { flex: 1; min-width: 0; }
	.gp-lg-bar__sum { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 8px 0 4px; border-radius: 12px; color: var(--ink); font-weight: 700; cursor: pointer; list-style: none; }
	.gp-lg-bar__sum::-webkit-details-marker { display: none; }
	.gp-lg-bar__sum::marker { content: ""; }
	.gp-lg-bar__sum:hover { background: var(--surface-1); }
	.gp-lg-bar__sum:focus-visible { outline-offset: 0; }
	.gp-lg-bar__icon { display: grid; flex: none; color: var(--accent-ink); }
	.gp-lg-bar__icon .gp-i, .gp-lg-bar__chev .gp-i { width: 20px; height: 20px; }
	.gp-lg-bar__label { flex: none; font-size: .95rem; }
	.gp-lg-bar__now { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-2); font-size: .88rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
	.gp-lg-bar__now:not(:empty)::before { content: "·"; content: "·" / ""; margin-right: 8px; color: var(--muted); }
	.gp-lg-bar__chev { display: grid; flex: none; margin-left: auto; }
	.gp-lg-bar__box[open] .gp-lg-bar__chev .gp-i { transform: rotate(180deg); }
	.gp-lg-bar__panel { padding: 4px 0 10px; }
	html.gp-js .gp-lg-bar__panel { position: absolute; top: calc(100% + 6px); right: var(--gutter); left: var(--gutter); max-height: min(70vh, calc(100vh - var(--header-total) - 96px)); padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 18px; background: var(--lg-card); box-shadow: 0 30px 60px -28px rgba(18, 19, 22, .5); }
	.gp-lg-bar__panel .gp-lg-toc__link { border-radius: 12px; }
	.gp-lg-bar__panel .gp-lg-toc__link.is-active { background: var(--surface-2); }
	.gp-lg-bar__top { display: grid; flex: none; place-items: center; width: 44px; height: 44px; margin-top: 2px; border-radius: 50%; background: var(--surface-2); color: var(--ink); }
	.gp-lg-bar__top:hover { background: var(--surface-3); }
	.gp-lg-bar__top .gp-i { width: 20px; height: 20px; }
	.gp-lg-bar__progress { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; overflow: hidden; }
	.gp-lg-bar__progress i { display: block; height: 100%; background: var(--accent-ink); transform: scaleX(var(--lg-p)); transform-origin: 0 50%; }
	html:not(.gp-js) .gp-lg-bar__progress { display: none; }
	html.gp-js .gp-lg-doc :is(h2, h3) { scroll-margin-top: 72px; } /* a section lands under the bar, not behind it */
}
@media (max-width: 767.98px) and (min-height: 481px) { /* phones: the bar follows the header when main.js slides it away (the world row stays) */
	html.gp-js body:has(#gp-header.is-hidden) .gp-lg-bar { transform: translateY(calc(-1 * var(--header-h))); }
}
@media (max-width: 1023.98px) and (max-height: 480px) { /* short screens: all of the header goes */
	html.gp-js body:has(#gp-header.is-hidden) .gp-lg-bar { transform: translateY(calc(-1 * var(--header-total))); }
}

/* Reading progress under the header (large screens; the phone bar carries its own). */
.gp-lg-progress { position: fixed; z-index: 899; top: var(--header-total); right: 0; left: 0; height: 3px; pointer-events: none; }
.gp-lg-progress i { display: block; height: 100%; background: var(--accent-ink); transform: scaleX(var(--lg-p)); transform-origin: 0 50%; }
@media (max-height: 480px) {
	body:has(#gp-header.is-hidden) .gp-lg-progress { transform: translateY(calc(-1 * var(--header-total))); }
}

/* ---------- The text ---------- */
.gp-lg-doc > :first-child { margin-top: 0; }
.gp-lg-doc :is(strong, b) { color: var(--ink); font-weight: 700; }
.gp-lg-doc a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-ink); text-decoration-thickness: 1.5px; text-underline-offset: .22em; }
.gp-lg-doc a:hover { text-decoration-thickness: 2.5px; }
.gp-lg-doc sup { font-size: .62em; line-height: 0; }
.gp-lg-doc p { text-wrap: pretty; }
.gp-lg-doc h2, .gp-lg-doc h3 { color: var(--ink); text-wrap: balance; }
.gp-lg-doc :is(h2, h3) strong { font-weight: inherit; }
.gp-lg-doc h2 { position: relative; margin: clamp(38px, 4.2vw, 58px) 0 14px; padding-top: clamp(18px, 1.9vw, 24px); border-top: 1px solid var(--line); font-size: clamp(1.3rem, 1.1rem + .75vw, 1.78rem); line-height: 1.14; letter-spacing: -.012em; }
.gp-lg-doc > h2:first-child { margin-top: 0; }
.gp-lg-doc h2::before { content: ""; position: absolute; top: -2px; left: 0; width: 44px; height: 3px; border-radius: 2px; background: var(--accent-ink); transform-origin: 0 50%; }
.gp-lg-doc h3 { margin: 30px 0 10px; font-size: clamp(1.12rem, 1.04rem + .3vw, 1.3rem); line-height: 1.2; }
/* Headings without their own number: the layout numbers them (CSS counters; nothing is added to the text). */
.gp-lg-doc--count { counter-reset: gp-lg; }
.gp-lg-doc--count > h2 { counter-increment: gp-lg; }
.gp-lg-doc--count > h2::after { content: counter(gp-lg, decimal-leading-zero); position: absolute; top: 10px; right: 0; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .1em; font-variant-numeric: tabular-nums; }

/* Opening lines before the first section: the first one is the page's tagline, the next ones its lead. */
.gp-lg-doc > p:first-child:has(+ p) { max-width: 34ch; margin-bottom: .45em; color: var(--ink); font-family: var(--font-display); font-size: clamp(1.25rem, 1.07rem + .62vw, 1.6rem); font-weight: 800; line-height: 1.16; letter-spacing: -.012em; text-wrap: balance; }
.gp-lg-doc > p:first-child:has(+ p) strong { font-weight: inherit; }
.gp-lg-doc > p:not(:first-child):not(h2 ~ p):not(h3 ~ p) { margin-top: 0; color: var(--ink); font-size: 1.07em; line-height: 1.65; }

/* A bold label on its own line opens a sub-point (« a. Modalité de livraison », the seller's name): a small heading.
   Not in a « label : value » list where three lines or more open on a bold label (« Raison sociale : … »). */
.gp-lg-doc p:has(> strong:first-child + br):not(:has(> strong:first-child + br + strong + br + strong)) { margin-top: 1.5em; }
.gp-lg-doc p:has(> strong:first-child + br):not(:has(> strong:first-child + br + strong + br + strong)) > strong:first-child { display: inline-block; margin-bottom: 3px; font-family: var(--font-display); font-size: 1.07em; font-weight: 700; letter-spacing: -.004em; line-height: 1.25; }

/* A regulated box (« encadré »: the legal-guarantee model of article D. 211-2, Code de la consommation): a framed block
   on the paper card, its paragraphs closer together; the frame is the ink colour, so it reads in both worlds. */
.gp-lg-doc .gp-legal-box { margin: 1.1em 0 1.6em; padding: clamp(18px, 2.4vw, 28px) clamp(18px, 2.6vw, 32px); border: 2px solid var(--ink); border-radius: 14px; background: var(--lg-card); color: var(--ink); font-size: .96em; line-height: 1.62; }
/* WordPress may wrap the Group's blocks in .wp-block-group__inner-container (classic themes): both shapes. */
.gp-lg-doc .gp-legal-box > :is(*, .wp-block-group__inner-container > *) { margin-block: 0; }
.gp-lg-doc .gp-legal-box > * + *, .gp-lg-doc .gp-legal-box > .wp-block-group__inner-container > * + * { margin-top: .75em; }

/* Lists */
.gp-lg-doc :is(ul, ol) { margin: .85em 0 1.1em; padding-left: 1.35em; }
.gp-lg-doc li { padding-left: .2em; }
.gp-lg-doc li + li { margin-top: .45em; }
.gp-lg-doc li::marker { color: var(--accent-ink); }
.gp-lg-doc ol > li::marker { font-family: var(--font-display); font-weight: 800; }

/* A sub-section (h3) reads as one block up to the next section, ruled on its left. */
.gp-lg-doc h3 ~ p:not(h3 ~ h2 ~ *) { margin-top: 0; padding: .45em 0 .45em clamp(14px, 1.6vw, 20px); border-left: 2px solid var(--line); }

/* ---------- Motion (none with reduced motion; main.css also stops it there) ---------- */
@media (prefers-reduced-motion: no-preference) {
	html.gp-js .gp-lg-hero__ghost { animation: gp-lg-ghost 1.4s var(--ease-out) .25s both; }
	.gp-lg.is-motion .gp-lg-toc__glide { transition: transform .55s var(--ease-out); }
	.gp-lg.is-motion .gp-lg-toc__link { transition: color .25s ease, background-color .25s ease; }
	.gp-lg.is-motion .gp-lg-toc__n { transition: color .25s ease; }
	.gp-lg.is-motion .gp-lg-tool .gp-i { transition: transform .35s var(--ease-out); }
	.gp-lg.is-motion .gp-lg-tool[data-lg-top]:hover .gp-i { transform: translateY(-3px); }
	.gp-lg.is-motion .gp-lg-bar { transition: transform var(--dur-header) var(--ease-out); }
	.gp-lg.is-motion .gp-lg-bar__chev .gp-i { transition: transform .35s var(--ease-out); }
	.gp-lg.is-motion .gp-lg-bar__box[open] .gp-lg-bar__panel { animation: gp-lg-drop .34s var(--ease-out) both; }
	.gp-lg.is-motion .gp-lg-bar__now.is-swap { animation: gp-lg-swap .42s var(--ease-out) both; }
	.gp-lg.is-motion .gp-lg-docs__link { transition: border-color .2s ease; }
	@supports (animation-timeline: view()) { /* each section's accent rule draws itself as it comes into view */
		.gp-lg.is-motion .gp-lg-doc h2::before { animation: gp-lg-rule linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
	}
}
@keyframes gp-lg-ghost { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes gp-lg-drop { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes gp-lg-swap { from { opacity: 0; transform: translateY(45%); } to { opacity: 1; transform: none; } }
@keyframes gp-lg-rule { from { opacity: .35; transform: scaleX(.12); } to { opacity: 1; transform: scaleX(1); } }

/* ---------- Print: the text only, black on white ---------- */
@media print {
	@page { margin: 16mm 15mm; }
	body > :not(main), .gp-pro-band, .gp-lg-side, .gp-lg-bar, .gp-lg-progress, .gp-lg-docs, .gp-lg .gp-pro-nav, .gp-lg-hero__ghost, .gp-lg-print, .gp-lg-meta__item:not(.gp-lg-meta__item--date) { display: none !important; }
	html, body, body.gp-paper-view, .gp-lg, .gp-lg-hero, .gp-lg-body { background: #fff !important; color: #000 !important; }
	.gp-lg-hero { padding: 0 0 5mm; border: 0; border-bottom: 1px solid #000; }
	.gp-lg-hero *, .gp-lg-doc * { color: #000 !important; }
	.gp-lg-hero__title { max-width: none; font-size: 22pt; }
	.gp-lg-meta__item { padding: 0; border: 0; background: none; font-size: 9pt; }
	.gp-lg [data-split] { visibility: visible !important; }
	.gp-lg .gp-wi { transform: none !important; }
	.gp-wrap { max-width: none; padding-inline: 0; }
	.gp-lg-body { padding: 6mm 0 0; }
	.gp-lg-layout { display: block !important; }
	.gp-lg-doc { max-width: none; font-size: 10.5pt; line-height: 1.5; }
	.gp-lg-doc h2 { margin-top: 7mm; padding-top: 3mm; border-top-color: #000; break-after: avoid; page-break-after: avoid; }
	.gp-lg-doc h3 { break-after: avoid; }
	.gp-lg-doc h2::before, .gp-lg-doc--count > h2::after { display: none; }
	.gp-lg-doc p, .gp-lg-doc li { orphans: 3; widows: 3; }
	.gp-lg-doc a { text-decoration-color: #000; }
	.gp-lg-doc li::marker { color: #000; }
	.gp-lg-doc h3 ~ p:not(h3 ~ h2 ~ *) { border-left-color: #000; }
}
