/* Welcome dialog (« Fenêtre de bienvenue »): templates/welcome.php, opened by welcome.js with showModal().
 * Every screen size. The shapes are the exit dialog's (28 px card, uppercase display title, 54 px button with a
 * raised edge, 44 px round close, underlined end button); the colours are the theme tokens, so the card follows the
 * page scheme (dark by default, light with the visitor) and the world (lime for Particuliers, the Professionnels
 * accent of html[data-gp-world="b2b"]). The second value of each var() only serves without the theme: dark, lime.
 * Contrast on the card (dark #121418 / light #f6f5f1): text 16.8 / 17.1, second text 12.0 / 10.1, note 8.1 / 6.6,
 * accent text lime 15.6 / olive 6.2, Pro cream 18.0 / Pro olive 7.4, error 6.6 / 6.0; button label #0a0b0d on lime 17.0, on
 * the Pro cream 19.2 (on the light card the cream button takes an olive rim, --gw-rim). Field border 3:1 or more. Focus
 * ring: the accent text colour, 2 px.
 * Motion (prefers-reduced-motion: no-preference only; transform and opacity only): the card rises .5 s and the lines
 * enter in sequence (--i, 55 ms apart). Reduced motion: none of it; the dialog opens and closes at once. */

.gp-welcome {
	--gw-card: var(--bg, #0a0b0d);
	--gw-ink: var(--ink, #f4f4f0);
	--gw-ink-2: var(--ink-2, #cfd1d6);
	--gw-muted: var(--muted, #a9acb3);
	--gw-line: var(--line, rgba(255, 255, 255, .13));
	--gw-field-line: var(--field-line, rgba(255, 255, 255, .4));
	--gw-field: var(--surface-1, rgba(255, 255, 255, .04));
	--gw-chip: var(--surface-2, rgba(255, 255, 255, .08));
	--gw-hover: var(--hover, rgba(255, 255, 255, .1));
	--gw-fill: var(--accent, #d4ff3a);
	--gw-on-fill: var(--on-accent, #0a0b0d);
	--gw-edge: var(--accent-edge, #9fc41f);
	--gw-rim: var(--accent-rim, transparent); /* Pro cream on the light card only */
	--gw-accent-ink: var(--accent-ink, #d4ff3a);
	--gw-danger: var(--danger, #ff6b5e);
	--gw-radius: 28px;
	--gw-radius-s: var(--field-radius, 12px);
	--gw-ease-out: var(--ease-out, cubic-bezier(.16, 1, .3, 1));
	--gw-ease-in-out: var(--ease-in-out, cubic-bezier(.76, 0, .24, 1));
	--gw-display: var(--font-display, "League Spartan", "Arial Narrow", Arial, sans-serif);
	--gw-body: var(--font-body, "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
	box-sizing: border-box;
	width: min(480px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	margin: auto;
	padding: 0;
	overflow: auto;
	overscroll-behavior: contain;
	border: 1px solid var(--gw-line);
	border-radius: var(--gw-radius);
	background: var(--gw-card);
	color: var(--gw-ink);
	font-family: var(--gw-body);
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: normal;
	text-align: left;
	box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .12);
}
/* A raised card on the dark page (the theme's second surface); on light paper the page colour itself. The theme
   sets color-scheme with its tokens, so light-dark() follows the same switch (visitor setting or header button). */
@supports (color: light-dark(#000, #fff)) {
	.gp-welcome { --gw-card: light-dark(var(--bg, #121418), var(--bg-2, #121418)); }
}
.gp-welcome *, .gp-welcome *::before, .gp-welcome *::after { box-sizing: border-box; }
.gp-welcome::backdrop { background: rgba(5, 6, 8, .6); backdrop-filter: blur(6px) saturate(.9); -webkit-backdrop-filter: blur(6px) saturate(.9); }
.gp-welcome:focus, .gp-welcome:focus-visible { outline: none; } /* the dialog itself takes focus on open (autofocus); controls keep their ring */
.gp-welcome ::selection { background: var(--gw-fill); color: var(--gw-on-fill); }
.gp-welcome :focus-visible { outline: 2px solid var(--gw-accent-ink); outline-offset: 2px; border-radius: 4px; }
.gp-welcome [hidden] { display: none !important; }

/* Close ×, 44 × 44, top right */
.gp-welcome__x { position: absolute; top: 12px; right: 12px; z-index: 2; margin: 0; }
.gp-welcome__close { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--gw-chip); color: var(--gw-ink); cursor: pointer; }
.gp-welcome__close:hover { background: var(--gw-hover); }
.gp-welcome__close:focus-visible { outline-offset: 2px; border-radius: 50%; }
.gp-welcome__close svg { display: block; }

/* Body */
.gp-welcome__body { position: relative; padding: 36px 36px 22px; }
.gp-welcome__eyebrow { margin: 0 52px 10px 0; color: var(--gw-accent-ink); font-family: var(--gw-body); font-size: .78rem; font-weight: 700; letter-spacing: .14em; line-height: 1.3; text-transform: uppercase; }
.gp-welcome__title { margin: 0 44px 12px 0; color: var(--gw-ink); font-family: var(--gw-display); font-size: clamp(1.6rem, 1.1rem + 1.1vw, 2.15rem); font-weight: 800; line-height: .98; letter-spacing: -.01em; text-transform: uppercase; text-wrap: balance; overflow-wrap: break-word; }
.gp-welcome__text { margin: 0; max-width: 46ch; color: var(--gw-ink-2); font-size: 1.02rem; line-height: 1.5; text-wrap: pretty; }

/* Sign-up form. It also carries .gp-news (newsletter.php binds it), whose theme rules (site.css: two-column grid,
   56 px field) are set again here with one more class. */
.gp-welcome .gp-welcome__form { display: block; margin: 20px 0 0; }
.gp-welcome .gp-welcome__fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.gp-welcome .gp-welcome__fields > * { min-width: 0; }
.gp-welcome .gp-welcome__code { margin: 0 0 4px; color: var(--gw-ink); font-size: .94rem; line-height: 1.45; }
.gp-welcome .gp-welcome__label { margin: 0; color: var(--gw-ink); font-size: .94rem; font-weight: 600; line-height: 1.3; }
.gp-welcome .gp-welcome__form .gp-welcome__input { display: block; width: 100%; min-width: 0; height: 50px; min-height: 50px; margin: 0; padding: 0 14px; border: 1.5px solid var(--gw-field-line); border-radius: var(--gw-radius-s); background: var(--gw-field); color: var(--gw-ink); font: inherit; font-size: 1rem; }
.gp-welcome .gp-welcome__form .gp-welcome__input:focus-visible { outline: 2px solid var(--gw-accent-ink); outline-offset: 1px; border-radius: var(--gw-radius-s); }
.gp-welcome .gp-welcome__form .gp-welcome__input[aria-invalid="true"] { border-color: var(--gw-danger); border-width: 2px; }
.gp-welcome__btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; margin: 0 0 4px; padding: .85em 1.3em .8em; border: 0; border-radius: 16px; background: var(--gw-fill); color: var(--gw-on-fill); font-family: var(--gw-display); font-size: 1rem; font-weight: 800; line-height: 1.1; letter-spacing: .03em; text-align: center; text-transform: uppercase; cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--gw-rim), 0 4px 0 var(--gw-edge); }
.gp-welcome__btn:focus-visible { outline-offset: 3px; border-radius: 16px; }
.gp-welcome__btn:disabled { opacity: .55; cursor: not-allowed; }
.gp-welcome .gp-welcome__form[aria-busy="true"] .gp-welcome__submit { cursor: progress; }
.gp-welcome .gp-welcome__note { margin: 0; color: var(--gw-muted); font-size: .82rem; line-height: 1.5; }
.gp-welcome .gp-welcome__note a { display: inline-block; margin-block: -13px; padding-block: 13px; color: var(--gw-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; } /* a 44 px tall target that does not move the line */
.gp-welcome .gp-welcome__status { margin: 0; color: var(--gw-ink); font-size: .96rem; font-weight: 600; line-height: 1.45; }
.gp-welcome .gp-welcome__status:empty { display: block; } /* stays in the accessibility tree, so the first message is announced (the theme hides it) */
.gp-welcome .gp-welcome__status:not(:empty) { margin-top: 12px; }
.gp-welcome .gp-welcome__form.is-done .gp-welcome__status { margin-top: 0; }
.gp-welcome .gp-welcome__status.is-ok { color: var(--gw-accent-ink); }
.gp-welcome .gp-welcome__status.is-error { color: var(--gw-danger); }

/* End button: « Non merci », then « Fermer » after a sign-up */
.gp-welcome__end { display: flex; justify-content: center; margin: 10px 0 0; }
.gp-welcome__endbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--gw-ink); font-family: var(--gw-body); font-size: .94rem; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; cursor: pointer; }
.gp-welcome__endbtn:hover { background: var(--gw-hover); }

/* Phones: tighter padding; the card still leaves 16 px on each side and scrolls inside when the keyboard is up. */
@media (max-width: 479px) {
	.gp-welcome { --gw-radius: 22px; }
	.gp-welcome__body { padding: 28px 22px 16px; }
	.gp-welcome__x { top: 8px; right: 8px; }
}

/* One greeting per page view: once this dialog has opened, the welcome avatar (site.js) stays away until the next
   page (welcome.js sets the class; the avatar's own script only knows the exit dialog). */
html.gp-welcome-shown [data-gp-avatar] { display: none !important; }

/* Motion: only when the visitor has not asked for less. Transform and opacity only. */
@media (prefers-reduced-motion: no-preference) {
	.gp-welcome { transition: opacity .22s var(--gw-ease-in-out), transform .22s var(--gw-ease-in-out), overlay .22s allow-discrete, display .22s allow-discrete; }
	.gp-welcome:not([open]) { opacity: 0; transform: translateY(10px) scale(.98); }
	.gp-welcome[open] { opacity: 1; transform: none; transition-duration: .5s; transition-timing-function: var(--gw-ease-out); }
	@starting-style {
		.gp-welcome[open] { opacity: 0; transform: translateY(24px) scale(.96); }
	}
	.gp-welcome::backdrop { opacity: 0; transition: opacity .35s ease, overlay .35s allow-discrete, display .35s allow-discrete; }
	.gp-welcome[open]::backdrop { opacity: 1; }
	@starting-style {
		.gp-welcome[open]::backdrop { opacity: 0; }
	}
	.gp-welcome[open] .gp-welcome__body > * { animation: gpw-rise .6s var(--gw-ease-out) both; animation-delay: calc(.12s + var(--i, 0) * 55ms); }
	.gp-welcome__close svg { transition: transform .3s var(--gw-ease-out); }
	.gp-welcome__close:hover svg { transform: rotate(90deg); }
	.gp-welcome__btn { transition: transform .2s var(--gw-ease-out), box-shadow .2s var(--gw-ease-out); }
	.gp-welcome__btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--gw-rim), 0 6px 0 var(--gw-edge); }
	.gp-welcome__btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 1.5px var(--gw-rim), 0 1px 0 var(--gw-edge); }
	@keyframes gpw-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* Windows high contrast: keep the card edge and the control shapes. */
@media (forced-colors: active) {
	.gp-welcome { border: 2px solid CanvasText; }
	.gp-welcome__btn, .gp-welcome__close { border: 2px solid ButtonText; }
}
