/* Notre histoire (page-notre-histoire.php, assets/js/histoire.js): the owner's chapters told along a spine.
   Tokens from main.css, so both colour schemes and both worlds work: --hl is the world's line colour (lime or cream on
   dark, their dark shade on light). The « Vision » band stays dark (gp-scheme-dark). The motion runs only once
   histoire.js adds .gp-hist-motion (JavaScript on, motion allowed): without it every part shows in its final state. */

.gp-hist { --hm: 30px; --rowpad: clamp(56px, 7vw, 112px); --hl: var(--accent-line); padding-top: calc(var(--header-total) + clamp(26px, 4.5vw, 64px)); overflow-x: clip; }
.gp-hist__head { padding-bottom: clamp(20px, 3vw, 40px); }
.gp-hist__story { padding-bottom: clamp(70px, 9vw, 130px); }

/* ---------- The spine: one hairline down the margin, drawn row by row so it meets each number; it fills as the
   story is read (--hist-cp, per row, from histoire.js). ---------- */
.gp-hist__row { position: relative; }
.gp-hist__row::before, .gp-hist__row::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px; pointer-events: none; }
.gp-hist__row::before { background: var(--line); }
.gp-hist__row::after { background: var(--hl); transform-origin: 50% 0; transform: scaleY(0); }
.gp-hist-motion .gp-hist__row { --hist-cp: 0; }
.gp-hist-motion [data-hist-p] { --hist-p: 0; }
.gp-hist-motion .gp-hist-loop { --hist-core: 0; }
.gp-hist-motion .gp-hist__row::after { transform: scaleY(var(--hist-cp, 0)); }

/* Chapter number and name on the spine (a margin note, not a label over the title). */
.gp-hist__mark { --nx: calc(-1 * var(--hm)); position: relative; display: flex; align-items: baseline; gap: .75rem; margin: 0 0 1.1rem; }
.gp-hist__mark::before { content: ""; position: absolute; top: .62rem; left: var(--nx); width: 12px; height: 12px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--field-line); transition: box-shadow .5s var(--ease-out); }
.gp-hist__no { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.01em; color: transparent; -webkit-text-stroke: 1.5px var(--muted); transition: color .6s var(--ease-out), -webkit-text-stroke-color .6s var(--ease-out); }
.gp-hist__label { color: var(--ink-2); font-size: .95rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; } /* a longer name breaks inside the margin column rather than run into the text */
.gp-hist:not(.gp-hist-motion) .gp-hist__mark::before, .gp-hist__row.is-on .gp-hist__mark::before { box-shadow: inset 0 0 0 6px var(--hl); }
.gp-hist:not(.gp-hist-motion) .gp-hist__no, .gp-hist__row.is-on .gp-hist__no { color: var(--hl); -webkit-text-stroke-color: var(--hl); }

/* ---------- Rows: one column on phones (the spine on the left), three from 1000 px: margin, text, picture. ---------- */
.gp-hist__ch { display: grid; grid-template-columns: var(--hm) minmax(0, 1fr); align-items: start; padding-top: var(--rowpad); }
.gp-hist__ch > * { grid-column: 2; }
.gp-hist__ch--hero { padding-top: 0; }
.gp-hist__vis { margin-top: clamp(28px, 6vw, 44px); }
.gp-hist__h1 { margin: 0 0 clamp(28px, 4vw, 52px); font-size: clamp(3rem, 1.3rem + 6.4vw, 6rem); line-height: .9; letter-spacing: -.035em; }
.gp-hist__h2 { margin: 0 0 1.1rem; font-size: clamp(1.75rem, 1.15rem + 2.3vw, 3.1rem); line-height: 1.02; letter-spacing: -.02em; }
.gp-hist__ch--hero .gp-hist__h2 { font-size: clamp(1.55rem, 1.1rem + 1.7vw, 2.5rem); }
.gp-hist__ch--statement .gp-hist__h2 { max-width: 12.6em; font-size: clamp(2.05rem, 1.15rem + 3.7vw, 4.5rem); line-height: .98; }
.gp-hist__body { max-width: 60ch; color: var(--ink-2); font-size: clamp(1.04rem, 1rem + .3vw, 1.2rem); line-height: 1.62; }
.gp-hist__body p { margin: 0; }
.gp-hist__body p + p { margin-top: .9em; }
.gp-hist__body .gp-hist__lead { color: var(--ink); font-size: clamp(1.14rem, 1.02rem + .5vw, 1.38rem); line-height: 1.45; }
.gp-hist__body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 2px; text-underline-offset: .22em; }
.gp-hist__text .gp-actions { margin: 1.6rem 0 0; }
.gp-hist__ch--statement .gp-hist__body { font-size: clamp(1.08rem, 1rem + .45vw, 1.28rem); }

@media (min-width: 1000px) {
	.gp-hist { --hm: clamp(160px, 11vw, 176px); } /* past its 30 px padding the margin column holds « L’entrepreneuriat » (about 120 px) */
	.gp-hist__ch { grid-template-columns: var(--hm) minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(32px, 4.4vw, 76px); }
	.gp-hist__ch > * { grid-row: 1; }
	.gp-hist__mark { --nx: 0px; grid-column: 1; flex-direction: column; align-items: flex-start; gap: .55rem; margin: 0; padding-left: 30px; }
	.gp-hist__mark::before { top: clamp(18px, 1.5vw, 24px); }
	.gp-hist__no { font-size: clamp(2.9rem, 1.4rem + 2.6vw, 4.4rem); }
	.gp-hist__text { grid-column: 2; padding-top: .35rem; }
	.gp-hist__vis { grid-column: 3; margin-top: 0; }
	.gp-hist__ch--flip .gp-hist__text { grid-column: 3; }
	.gp-hist__ch--flip .gp-hist__vis { grid-column: 2; }
	.gp-hist__ch--statement .gp-hist__text { grid-column: 2 / -1; }
	.gp-hist__ch--statement .gp-hist__body { margin-left: auto; max-width: 52ch; }
	/* Beside a taller picture, the number and the text stay in view while the picture scrolls by. */
	.gp-hist__ch:is(.gp-hist__ch--photo, .gp-hist__ch--card, .gp-hist__ch--loop, .gp-hist__ch--unite) :is(.gp-hist__mark, .gp-hist__text) { position: sticky; top: calc(var(--header-total) + 32px); }
	/* The opening: the title over the first chapter, the portrait beside both. */
	.gp-hist__ch--hero .gp-hist__h1 { grid-column: 2; grid-row: 1; align-self: end; }
	.gp-hist__ch--hero .gp-hist__mark, .gp-hist__ch--hero .gp-hist__text { grid-row: 2; }
	.gp-hist__ch--hero .gp-hist__vis { grid-row: 1 / span 2; align-self: center; }
}

/* ---------- Cards in perspective: the opening portrait (follows the mouse) and the press visual (swings in). ---------- */
.gp-hist__card { --hist-tx: 0deg; --hist-ty: 0deg; --hist-gx: 30%; --hist-gy: 20%; position: relative; width: min(100%, 440px); margin: 0; perspective: 1400px; }
.gp-hist__cardin { position: relative; display: block; overflow: hidden; border-radius: var(--radius); background: var(--bg-3); aspect-ratio: 3 / 4; box-shadow: 0 0 0 1px var(--line), 0 46px 80px -44px rgba(0, 0, 0, .7); transform: rotateX(var(--hist-ty)) rotateY(var(--hist-tx)); }
.gp-hist__cardin img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gp-hist__card--hero .gp-hist__cardin img { object-position: 50% 30%; }
.gp-hist__card--clip { width: min(100%, 400px); }
.gp-hist__card--clip .gp-hist__cardin { aspect-ratio: 848 / 1264; transform: rotate(-2deg); }
.gp-hist__card--hero .gp-hist__cardin::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at var(--hist-gx, 30%) var(--hist-gy, 20%), rgba(255, 255, 255, .26), transparent 58%); opacity: 0; mix-blend-mode: soft-light; pointer-events: none; transition: opacity .5s var(--ease-out); }
@media (min-width: 1000px) {
	.gp-hist__ch:not(.gp-hist__ch--flip) .gp-hist__card { justify-self: end; }
	.gp-hist-loop, .gp-hist-unite { justify-self: center; }
}
.gp-hist-motion .gp-hist__card--hero .gp-hist__cardin { opacity: 0; transform: translate3d(0, 40px, -120px) rotateX(10deg) rotateY(-24deg); transition: transform 1.4s var(--ease-out), opacity .9s var(--ease-out); }
.gp-hist-motion .gp-hist__card--hero.is-in .gp-hist__cardin { opacity: 1; transform: rotateX(var(--hist-ty)) rotateY(var(--hist-tx)); }
.gp-hist-motion .gp-hist__card--hero.is-tilting .gp-hist__cardin { transition: transform .5s var(--ease-out), opacity .9s var(--ease-out); }
.gp-hist-motion .gp-hist__card--hero.is-tilting .gp-hist__cardin::after { opacity: 1; }
.gp-hist-motion .gp-hist__card--clip .gp-hist__cardin { transform: translate3d(0, calc((1 - var(--hist-p, 0)) * 60px), 0) rotateY(calc((1 - var(--hist-p, 0)) * 26deg)) rotate(calc(-2deg - (1 - var(--hist-p, 0)) * 6deg)); }

/* ---------- A landscape photo opens up as it comes in. ---------- */
.gp-hist__photo { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--bg-3); aspect-ratio: 4 / 3; }
.gp-hist__photoin, .gp-hist__photoin picture { display: contents; }
.gp-hist__photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gp-hist-motion .gp-hist__photo { clip-path: inset(calc((1 - var(--hist-p, 0)) * 14%) calc((1 - var(--hist-p, 0)) * 9%) round var(--radius)); }
.gp-hist-motion .gp-hist__photo img { transform: scale(calc(1.2 - var(--hist-p, 0) * .2)); }

/* ---------- The loop: « observer, tester, améliorer, recommencer » goes round once as the chapter is read, and
   Gravipack® is born in the middle. Labels sit on the diagonals so long ones have room on a phone. ---------- */
.gp-hist-loop { position: relative; width: min(100%, 440px); aspect-ratio: 1; container-type: inline-size; }
.gp-hist-loop__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gp-hist-loop__track { fill: none; stroke: var(--line); stroke-width: 2; }
.gp-hist-loop__arc { fill: none; stroke: var(--hl); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.gp-hist-motion .gp-hist-loop__arc { stroke-dashoffset: calc(1 - var(--hist-p, 0)); }
.gp-hist-loop__runner { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--hl); box-shadow: 0 0 0 7px color-mix(in srgb, var(--hl) 22%, transparent); transform: rotate(calc(180deg / var(--hist-n) + var(--hist-p, 1) * 360deg)) translateY(-37.5cqi); }
.gp-hist-loop__steps { margin: 0; padding: 0; list-style: none; }
.gp-hist-loop__steps li { --hist-a: calc(180deg / var(--hist-n) + var(--hist-k) * 360deg / var(--hist-n)); position: absolute; top: 50%; left: 50%; max-width: 46cqi; padding: .55em .95em; border: 1px solid var(--hl); border-radius: 16px; background: var(--bg); color: var(--ink); font-family: var(--font-display); font-size: clamp(.74rem, 3.1cqi, .98rem); font-weight: 800; line-height: 1.08; letter-spacing: .02em; text-align: center; text-transform: uppercase; transform: translate(-50%, -50%) rotate(var(--hist-a)) translateY(-37.5cqi) rotate(calc(-1 * var(--hist-a))); transition: color .4s var(--ease-out), border-color .4s var(--ease-out); }
.gp-hist-motion .gp-hist-loop__steps li { border-color: var(--line); color: var(--muted); }
.gp-hist-motion .gp-hist-loop__steps li.is-lit { border-color: var(--hl); color: var(--ink); }
.gp-hist-loop__core { position: absolute; top: 50%; left: 50%; font-family: var(--font-display); font-size: clamp(1.25rem, 7.5cqi, 2.2rem); font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; white-space: nowrap; transform: translate(-50%, -50%); }
.gp-hist-motion .gp-hist-loop__core { opacity: calc(.18 + var(--hist-core, 0) * .82); transform: translate(-50%, -50%) scale(calc(.84 + var(--hist-core, 0) * .16)); }

/* ---------- Together: the team's skills drift in from all sides and gather into one group. ---------- */
.gp-hist-unite { position: relative; display: grid; place-items: center; width: min(100%, 460px); aspect-ratio: 1; container-type: inline-size; }
.gp-hist-unite__ring { position: absolute; inset: 5%; border: 2px solid var(--hl); border-radius: 50%; transition: border-color .6s var(--ease-out); }
.gp-hist-unite__ring::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--hl) 24%, transparent), transparent); }
.gp-hist-unite__list { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 74cqi; margin: 0; padding: 0; list-style: none; }
.gp-hist-unite__list li { padding: .72em 1.15em; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); color: var(--ink); font-family: var(--font-display); font-size: clamp(.78rem, 3.4cqi, 1.02rem); font-weight: 800; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.gp-hist-motion .gp-hist-unite__ring { border-color: var(--line); border-style: dashed; }
.gp-hist-motion .gp-hist-unite__ring::after { opacity: var(--hist-p, 0); }
.gp-hist-motion .gp-hist-unite.is-together .gp-hist-unite__ring { border-color: var(--hl); border-style: solid; }
.gp-hist-motion .gp-hist-unite__list li { opacity: calc(.35 + var(--hist-p, 0) * .65); transform: translate(calc(var(--hist-dx) * 1cqi * (1 - var(--hist-p, 0))), calc(var(--hist-dy) * 1cqi * (1 - var(--hist-p, 0)))) rotate(calc(var(--hist-r) * 1deg * (1 - var(--hist-p, 0)))); }

/* ---------- Statement: each word lights up as it is read. ---------- */
.gp-hist-w { transition: opacity .35s ease; }
.gp-hist-motion .gp-hist-w { opacity: .22; }
.gp-hist-motion .gp-hist-w.is-lit { opacity: 1; }

/* ---------- The « Vision » band, dark in both schemes (gp-scheme-dark; --hl is declared again so that its number and
   dot take the dark-surface line colour). Phones and tablets: the photograph sits above the words and fades into the
   band, so the text stands on the plain dark ground. From 1000 px it fills the band behind the words, under a shade of
   90 % or more as far as the text column reaches (4.5:1 or more over any pixel of the photograph), and shows through on
   the right. The band grows to its full size as it comes in. ---------- */
.gp-hist__ch--band { grid-template-columns: minmax(0, 1fr); }
.gp-hist__ch--band > * { grid-column: 1 / -1; }
.gp-hist__band { --hm: 30px; --hl: var(--accent-line); --bp: clamp(26px, 4.4vw, 70px); --bandpic: min(64vw, 380px); position: relative; z-index: 1; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; overflow: hidden; padding: calc(var(--bandpic) + 18px) var(--bp) var(--bp); border-radius: clamp(22px, 3vw, 36px); background: #0a0b0d; }
.gp-hist__band > :not(.gp-hist__bandimg) { grid-column: 1; }
.gp-hist__band .gp-hist__mark { --nx: 0px; padding-left: 26px; }
.gp-hist__bandimg { position: absolute; inset: 0 0 auto; z-index: -1; height: calc(var(--bandpic) + 18px); overflow: hidden; }
.gp-hist__bandimg picture { display: contents; }
.gp-hist__bandimg img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%; }
.gp-hist__bandimg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 11, 13, 0) 38%, #0a0b0d 100%); }
.gp-hist__band .gp-hist__text { max-width: 44rem; }
.gp-hist__band .gp-hist__h2 { font-size: clamp(1.9rem, 1.2rem + 3vw, 3.9rem); }
.gp-hist__band .gp-hist__body { color: #dcdde0; }
.gp-hist-motion .gp-hist__band { transform: scale(calc(.93 + var(--hist-p, 0) * .07)); }
.gp-hist-motion .gp-hist__bandimg img { transform: scale(calc(1.18 - var(--hist-p, 0) * .18)); }
@media (min-width: 1000px) {
	.gp-hist__band { --hm: clamp(120px, 11vw, 176px); --bgap: clamp(32px, 4.4vw, 76px); --tx: calc(var(--bp) + var(--hm) + var(--bgap) + 36rem); grid-template-columns: var(--hm) minmax(0, 1fr); column-gap: var(--bgap); align-items: start; align-content: end; min-height: clamp(460px, 52vw, 680px); padding: var(--bp); }
	.gp-hist__band .gp-hist__mark { grid-column: 1; }
	.gp-hist__band .gp-hist__text { grid-column: 2; max-width: 36rem; }
	.gp-hist__bandimg { inset: 0; height: auto; }
	.gp-hist__bandimg::after { background: linear-gradient(90deg, rgba(8, 9, 11, .93) 0, rgba(8, 9, 11, .9) var(--tx), rgba(8, 9, 11, .22) calc(var(--tx) + 24%)); }
}

/* ---------- The end of the spine, and the way on. ---------- */
.gp-hist__end { --endy: calc(var(--rowpad) + 26px); display: grid; grid-template-columns: var(--hm) minmax(0, 1fr); padding-top: var(--rowpad); }
.gp-hist__end::before, .gp-hist__end::after { bottom: auto; height: var(--endy); }
.gp-hist__end .gp-actions { grid-column: 2; margin: 0; }
.gp-hist__endnode { position: absolute; top: calc(var(--endy) - 8px); left: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--hl); box-shadow: 0 0 0 6px color-mix(in srgb, var(--hl) 22%, transparent); transition: transform .6s var(--ease-out); }
.gp-hist-motion .gp-hist__endnode { transform: scale(.45); }
.gp-hist-motion .gp-hist__end.is-on .gp-hist__endnode { transform: none; }
@media (min-width: 1000px) {
	.gp-hist__end { grid-template-columns: var(--hm) minmax(0, 1fr); column-gap: clamp(32px, 4.4vw, 76px); }
}
