/* Gravipack comparator, front (package C3b): the « Comparer » card control, the tray (lists) and the table on
   /comparer/. Loaded on shop, category and search lists and on /comparer/ only (modules/compare.php).
   Z-order: tray 830, under the assist (840) and the cookie banner (950). Motion: transform and opacity only. */

/* ---------- Card control: 1000 px and wider, with JS (the tray needs it) ---------- */
.gp-compare-pick { display: none; }
@media (min-width: 1000px) {
	html.gp-js .gp-compare-pick { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; padding-inline: 4px 10px; border-radius: 10px; font-size: .92rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
}
.gp-compare-pick:hover { color: var(--ink); }
.gp-compare-pick__input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent-ink); cursor: inherit; }
.gp-compare-pick__input:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.gp-compare-pick:has(.gp-compare-pick__input:checked) { color: var(--ink); }
/* At the limit: the unticked boxes read as unavailable but stay focusable, so the tray's message can explain why. */
.gp-compare-pick.is-full { color: var(--muted); cursor: not-allowed; }
.gp-compare-pick.is-full .gp-compare-pick__input { opacity: .55; }

/* ---------- Tray: fixed at the bottom, above the cookie banner's room; the assist goes above it ---------- */
.gp-compare-tray { display: none; }
@media (min-width: 1000px) {
	.gp-compare-tray:not([hidden]) {
		/* A dark surface in every scheme: its own dark tokens, the world's accent on dark. */
		color-scheme: dark;
		--ink: #f4f4f0; --ink-2: #cfd1d6; --muted: #a9acb3; --line: rgba(255, 255, 255, .16); --field-line: rgba(255, 255, 255, .4);
		--accent-ink: var(--w-ink-dark, #d4ff3a); --accent-edge: var(--w-edge-dark); --accent-rim: transparent; --surface-2: rgba(255, 255, 255, .08); --hover: rgba(255, 255, 255, .1);
		position: fixed; inset: auto 0 var(--gp-consent-h, 0px); z-index: 830;
		display: block; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
		background: rgba(var(--chrome-rgb, 10, 11, 13), .96); color: var(--ink); border-top: 1px solid var(--line);
		box-shadow: 0 -10px 30px rgba(0, 0, 0, .22);
	}
	.gp-compare-tray__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; max-width: calc(var(--max, 1560px) - 2 * var(--gutter)); margin-inline: auto; }
	.gp-compare-tray__list { display: flex; flex: 1 1 auto; gap: 10px; min-width: 0; margin: 0; padding: 0; list-style: none; }
	.gp-compare-tray__item { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 250px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .04); }
	.gp-compare-tray__thumb { flex: none; width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: var(--tile, #e9e7e2); }
	.gp-compare-tray__name { min-width: 0; font-size: .9rem; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.gp-compare-tray__remove { flex: none; min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: .84rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
	.gp-compare-tray__remove:hover { background: var(--hover); color: var(--ink); }
	.gp-compare-tray__count { flex: none; margin: 0; font-size: .92rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
	.gp-compare-tray__actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-left: auto; padding-right: var(--assist-room, 0px); } /* clear of the WhatsApp column, whatever its height */
	.gp-compare-tray__go { min-height: 48px; padding-inline: 1.3em; }
	.gp-compare-tray__go[aria-disabled="true"] { --btn-bg: var(--surface-2); --btn-fg: var(--ink-2); --btn-edge: var(--field-line); cursor: not-allowed; }
	.gp-compare-tray__go[aria-disabled="true"]:hover, .gp-compare-tray__go[aria-disabled="true"]:active { translate: none; box-shadow: 0 4px 0 var(--btn-edge); }
	.gp-compare-tray__help { margin: 0; font-size: .86rem; color: var(--muted); }
	.gp-compare-tray__help[hidden], .gp-compare-tray__msg[hidden] { display: none; }
	.gp-compare-tray__clear { min-height: 44px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: .9rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
	.gp-compare-tray__clear:hover { background: var(--hover); color: var(--ink); }
	.gp-compare-tray__msg { flex: 1 0 100%; margin: 0; font-size: .9rem; font-weight: 600; color: var(--accent-ink); }
	.gp-compare-tray :focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

	/* The assist (WhatsApp, avatar) rises above the tray, and above the banner's room under it. */
	body.gp-has-tray .gp-assist { bottom: calc(var(--gp-consent-h, 0px) + var(--gp-compare-tray-h, 88px) + 16px); }
	/* Focus and in-page links stop above the tray, the banner's room and the assist (WCAG 2.4.11). */
	html:has(body.gp-has-tray) { scroll-padding-bottom: calc(var(--gp-consent-h, 0px) + var(--gp-compare-tray-h, 88px) + var(--assist-room, 0px)); }
	/* The page's end stays reachable above the tray. */
	body.gp-has-tray .gp-footer__legal { padding-bottom: calc(26px + var(--gp-compare-tray-h, 88px) + var(--assist-room, 0px)); }
}
@media (min-width: 1000px) and (prefers-reduced-motion: no-preference) {
	.gp-compare-tray:not([hidden]) { animation: gp-compare-tray-in .32s var(--ease-out, cubic-bezier(.16, 1, .3, 1)) both; }
	@keyframes gp-compare-tray-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
}

/* ---------- Page « Comparer les modèles » (paper view) ---------- */
.gp-compare { padding-block: var(--space-sheet, clamp(30px, 4vw, 56px)) var(--space-section, clamp(70px, 9vw, 130px)); } /* a band's padding under the title band, the section room before the footer (theme main.css) */
.gp-compare__app { display: grid; gap: 22px; }
.gp-compare__app > * { margin: 0; }
.gp-compare__intro { max-width: 72ch; color: var(--ink-2); }
.gp-compare__off { margin: 0; color: var(--ink-2); }
.gp-compare__notice { max-width: 72ch; padding: 14px 18px; border: 1px solid var(--field-line); border-radius: var(--radius-s, 12px); background: var(--surface-1); font-weight: 600; }
.gp-compare__empty { display: grid; gap: 10px; padding-top: 6px; }
.gp-compare__empty > * { margin: 0; }
.gp-compare__empty p { max-width: 60ch; color: var(--ink-2); }

/* Picker: labelled selects and an explicit submit (works without JS). */
.gp-compare__picker fieldset { display: grid; gap: 14px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-s, 12px); background: var(--surface-1); }
.gp-compare__picker legend { float: left; width: 100%; margin: 0 0 2px; padding: 0; font-weight: 700; }
.gp-compare__picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; clear: both; }
.gp-compare__pick { display: grid; gap: 6px; margin: 0; }
.gp-compare__pick label { font-size: .92rem; font-weight: 600; }
.gp-compare__pick select { width: 100%; min-height: var(--field-h, 50px); padding: 11px 40px 11px 14px; border: 1.5px solid var(--field-line); border-radius: var(--field-radius, 12px); background: #fff var(--select-arrow) no-repeat right 14px center; color: var(--paper-ink, #121316); font: inherit; appearance: none; -webkit-appearance: none; cursor: pointer; }
.gp-compare__pick select:has(option[value=""]:checked) { color: var(--paper-muted, #575a61); }
.gp-compare__pick select option { color: var(--paper-ink, #121316); }
.gp-compare__pick select:focus-visible { outline: 2px solid var(--paper-ink, #121316); outline-offset: 1px; }
.gp-compare__submit { justify-self: start; min-height: 50px; }

/* Differences toggle (JS only: the template prints it hidden). */
.gp-compare__diff[hidden] { display: none; }
.gp-compare__diff label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.gp-compare__diff input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent-ink); }
.gp-compare__more, .gp-compare__legend { color: var(--ink-2); }
.gp-compare__legend { font-size: .9rem; }
.gp-compare__narrow-note { display: none; }

/* Table: display table (never inside .gp-prose), a caption, th scope=col, scope=rowgroup and scope=row. */
.gp-compare__scroll { position: relative; }
.gp-compare__table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.gp-compare__table th, .gp-compare__table td { padding: 12px 14px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.gp-compare__table thead > tr > * { position: sticky; top: var(--header-total, var(--header-h, 76px)); z-index: 2; background: var(--paper, #f4f3ee); box-shadow: inset 0 -1px 0 var(--line); }
.gp-compare__corner { width: 22%; }
.gp-compare__bag > :is(img, a, span) { display: block; }
.gp-compare__thumb { width: 96px; height: 96px; margin-bottom: 10px; border-radius: 10px; object-fit: contain; background: var(--tile, #e9e7e2); }
.gp-compare__name { font-family: var(--font-display); font-size: clamp(1rem, .9rem + .4vw, 1.25rem); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; text-transform: uppercase; color: inherit; text-decoration: none; text-wrap: balance; }
.gp-compare__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.gp-compare__price { margin-top: 6px; font-weight: 700; }
.gp-compare__bag > .gp-compare__remove { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: -10px; font-size: .86rem; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.gp-compare__remove:hover { color: var(--ink); }
.gp-compare__group-row th { padding-top: 26px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; border-bottom: 2px solid var(--ink); }
.gp-compare__group[hidden], .gp-compare__row[hidden] { display: none; }
.gp-compare__row > * { border-bottom: 1px solid var(--line); }
.gp-compare__row:nth-child(even of .gp-compare__row:not([hidden])) > * { background: var(--surface-2); } /* stripes stay even with rows hidden */
.gp-compare__row th[scope="row"] { font-weight: 500; color: var(--ink-2); }
.gp-compare__row--diff th[scope="row"] { font-weight: 700; color: var(--ink); }
.gp-compare__row--diff th[scope="row"]::before { content: ""; display: inline-block; width: 14px; height: 2px; margin: 0 8px 0 0; vertical-align: .32em; background: var(--accent-ink); } /* decorative: the bold label says it too */

/* The header row follows the site header: slid away below 768 px, only the world row stays (main.css). */
body:has(#gp-header.is-hidden) .gp-compare__table thead > tr > * { top: 0; }
@media (max-width: 767px) and (min-height: 481px) {
	body:has(#gp-header.is-hidden) .gp-compare__table thead > tr > * { top: var(--world-row, 0px); }
}
/* Short screens: a stuck header row would take most of the screen. */
@media (max-height: 560px) { .gp-compare__table thead > tr > * { position: static; } }

/* Below 900 px: 2 bags at a time, a wider label column, smaller thumbnails; scrolling stays inside the table box. */
@media (max-width: 899.98px) {
	.gp-compare__col--3, .gp-compare__col--4, .gp-compare__pick--3, .gp-compare__pick--4 { display: none; }
	.gp-compare__narrow-note { display: block; max-width: 60ch; color: var(--ink-2); }
	/* The group rows span every bag (colspan n + 1), so columns 3 and 4 still exist: the two shown take all the width. */
	.gp-compare__corner { width: 30%; }
	.gp-compare__table thead .gp-compare__col--1, .gp-compare__table thead .gp-compare__col--2 { width: 35%; }
	.gp-compare__table th, .gp-compare__table td { padding: 10px 8px; font-size: .94rem; }
	.gp-compare__thumb { width: 56px; height: 56px; margin-bottom: 8px; }
	/* The two choices one under the other: side by side, a 150 px select cut « Choisir un sac » and every bag's name. */
	.gp-compare__picks { grid-template-columns: minmax(0, 1fr); }
	.gp-compare__pick select { text-overflow: ellipsis; }
	/* Wider than its box (very long words, big text): scrolls inside, never the page. Without JS, always a scroll box. */
	.gp-compare__scroll.is-scroll, html:not(.gp-js) .gp-compare__scroll { overflow-x: auto; overscroll-behavior-x: contain; }
	.gp-compare__scroll.is-scroll:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
}

@media print {
	.gp-compare__picker, .gp-compare__diff, .gp-compare__remove, .gp-compare-tray { display: none !important; }
	.gp-compare__table thead > tr > * { position: static; }
	.gp-compare__col--3, .gp-compare__col--4 { display: table-cell; }
}
