/* The guided journey: what every screen of /parcours shares (docs/decisions/2026-11-17-guided-journey.md).
   Loaded after app.css by src/app/journey/frame.ts on every journey page. It never redefines a token; a
   track's own stylesheet (journey-needs.css, journey-selection.css, …) adds the rest after it.

   THE SHARED CLASSES (use them; do not restyle them in a track's sheet)

   The thread (rendered by frame.ts, `thread()`; a page never writes it): the row under the app's top bar
     .jt              the row: back link, the five steps, where one is inside the step, the cars left
     .jt-left         the count of cars left; `[data-jt-left]` holds the number, for a script to change it

   A screen:
     .j-screen        the column of a journey screen: centred, phone gutters, room at the bottom for .j-go
     .j-screen.is-wide   the same with room for two cars side by side (a duel, a selection on a wide screen)
     .j-kicker        a small line above the title (a small label, soft): "Question 2 sur 6", "Votre voiture de départ"
     .j-title         a screen's title, in the voice (large, its stress by weight): "Quel est votre budget ?"
     .j-lede          one plain sentence under the title
     .j-fine          small print: facts, where figures come from

   Large options (step 1, the doors of the home):
     ul.j-options > li > a.j-option          one choice, a link, 64 px high at least
       .j-option-text > b + small            its label and its plain line
       .j-option-n                           what it leaves, on the right ("41 voitures")
       .j-option.is-none (a <span>, not a link, aria-disabled) an option that leaves no car
       .j-option.is-on                       the answer already given (a check, no yellow)

   The main button at the bottom:
     .j-go            a bar that sticks to the bottom of the screen on a phone, holding one .btn (ink)
     .j-go .btn       full width on a phone; `.j-go-also` a quiet second action beside it

   The car card of the journey:
     .j-card          a card: .j-card-pic (a carfig at the card's scale), .j-card-make (t-label), .j-card-name,
                      .j-card-price, .j-card-why (the reason, in the voice). `.is-this` gives it the yellow edge
                      of "this one" (one card per screen at most).

   The chips of what was said:
     .j-said          a row of chip links (`.chip.chip-link`): tapping one reopens its question

   A small fact: the app's one facts row and signed chip (src/app/ui/facts.ts, `.facts` and `.gaps` in app.css;
   docs/decisions/2026-11-19-one-small-fact.md). A page here only places them (.jd-chips, .js-gaps, .jc-facts).

   With room: `--j-frame` is the one measure of the thread and of the screens that use the width; `.j-go.is-sticky`
   keeps a screen's main act in reach on a laptop too; `.jt-plain` is the row of the end seen from outside. */

/* ── The thread: the row under the top bar ───────────────────────────────────────────────────────────────

   One row of 44 px, the app's bar above it, that stays in view with the bar while the journey is read (app.css,
   `.trail.stays`: `--bar-h` counts it). A phone: ‹ spanning the row; on its upper half the step one is in and where one
   is inside it ("Vos besoins · Question 2 sur 6"), the cars left at its end; on its lower half the five steps as
   segments, each one done a link back. With room each step is named over its segment, and where one is inside the step
   and the cars left close the row. Its ‹ stands on the gutter, under the wordmark, as a car's row's does (zoom.css). */
.jt { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 22px 22px; align-items: center; column-gap: 4px; height: 44px; padding-right: var(--pad); }
.jt-back { grid-column: 1; grid-row: 1 / 3; margin-left: calc(var(--pad) - 14px); color: var(--ink); }
.jt-back .ic { width: 20px; height: 20px; }
.jt-where { grid-column: 2; grid-row: 1; align-self: end; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 0.8125rem/1.2 var(--body); color: var(--soft); }
.jt-where b { font-weight: 650; color: var(--ink); }
.jt-left { grid-column: 3; grid-row: 1; align-self: end; display: flex; align-items: baseline; gap: 4px; white-space: nowrap; font: 500 0.75rem/1 var(--body); color: var(--soft); }
.jt-left b { font: 800 1.0625rem/1 var(--display); letter-spacing: -0.025em; color: var(--ink); }
.jt-left b.is-falling { animation: jt-fall var(--settle) var(--ease); }
@keyframes jt-fall { from { translate: 0 -40%; opacity: 0; } }
/* Where one is inside the step: on a phone the line above says it to the eye; this is kept for a screen reader. */
.jt-within { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The five steps: segments on a phone, named with room. */
.jt-steps { grid-column: 2 / 4; grid-row: 2; align-self: stretch; min-width: 0; }
.jt-steps ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; height: 100%; }
.jt-step a, .jt-step > span { position: relative; display: flex; align-items: center; height: 100%; min-width: 0; text-decoration: none; color: var(--soft); }
/* A done step is a link back: its target is its segment's column, the height of the half row and the line above it. */
.jt-step a::after { content: ""; position: absolute; inset: -6px 0 0; }
.jt-seg { display: block; flex: none; width: 100%; height: 4px; border-radius: 2px; background: var(--line); transition: background-color var(--calm); }
.jt-step.is-done .jt-seg { background: var(--ink); }
.jt-step.is-now .jt-seg { background: linear-gradient(90deg, var(--ink) var(--p, 50%), color-mix(in srgb, var(--ink) 30%, var(--line)) var(--p, 50%)); }
.jt-name { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 0.75rem/1.2 var(--body); }
.jt-step.is-now .jt-name { color: var(--ink); }
@media (hover: hover) {
  .jt-step.is-done a:hover .jt-name { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
  .jt-back:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
}

/* Seen from outside the journey: its plain way back where the thread would be ("‹ Mon garage"). */
.jt-plain { display: flex; }
.jt-out { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: calc(var(--pad) - 14px); padding: 0 12px 0 12px; border-radius: var(--r-pill); font: 600 0.875rem/1 var(--body); color: var(--ink); text-decoration: none; }
.jt-out .ic { width: 20px; height: 20px; margin-left: -2px; }
@media (hover: hover) { .jt-out:hover span { text-decoration: underline; text-underline-offset: 0.2em; } }

/* The frame of the journey with room: the thread and the screens that use the width (a question, the selection, a
   duel, the end) share one measure, so that their left edges meet: the row's ‹ and its count stand on the frame's
   gutters, as the screens' words do. */
.app { --j-frame: 1012px; }
@media (min-width: 1180px) { .app { --j-frame: 1272px; } }

@media (min-width: 760px) {
  .jt { grid-template-columns: auto minmax(0, 1fr) auto auto; column-gap: 0; max-width: var(--j-frame); margin: 0 auto; }
  .jt-where { display: none; }
  .jt-steps { grid-column: 2; grid-row: 1 / 3; padding-left: 8px; }
  .jt-steps ol { gap: 10px; }
  .jt-step a, .jt-step > span { flex-direction: column; align-items: stretch; justify-content: center; gap: 7px; }
  .jt-step a::after { inset: 0; }
  .jt-name { display: block; }
  .jt-within { position: static; grid-column: 3; grid-row: 1 / 3; width: auto; height: auto; margin: 0 0 0 28px; overflow: visible; clip-path: none; font: 600 0.71875rem/1.2 var(--label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); font-variant-numeric: tabular-nums; }
  .jt-left { grid-column: 4; grid-row: 1 / 3; align-self: center; margin-left: 20px; font-size: 0.8125rem; }
  .jt-left b { font-size: 1.25rem; }
}

/* The row keeps its place from one screen to the next with the bar (app.css): only the page under it changes. */
@media (prefers-reduced-motion: no-preference) {
  .jt-seg { view-transition-name: none; }
  .j-screen { view-transition-name: j-screen; }
  ::view-transition-old(j-screen) { animation: j-out 0.2s var(--ease) both; }
  ::view-transition-new(j-screen) { animation: j-in 0.32s var(--ease) both; }
  /* Going back plays it the other way. */
  :root[data-j-back]::view-transition-old(j-screen) { animation-name: j-out-back; }
  :root[data-j-back]::view-transition-new(j-screen) { animation-name: j-in-back; }
}
@keyframes j-out { to { opacity: 0; translate: -24px 0; } }
@keyframes j-in { from { opacity: 0; translate: 32px 0; } }
@keyframes j-out-back { to { opacity: 0; translate: 24px 0; } }
@keyframes j-in-back { from { opacity: 0; translate: -32px 0; } }

/* ── A screen ────────────────────────────────────────────────────────────────────────────────────────── */

.app.is-page > .main:has(> .j-screen) { padding-bottom: 0; }
.j-screen { width: 100%; max-width: 640px; margin: 0 auto; padding: 22px var(--pad) calc(28px + env(safe-area-inset-bottom, 0px)); }
.j-screen.is-wide { max-width: 1040px; }
.j-kicker { margin-bottom: 10px; font: 600 0.71875rem/1.2 var(--label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); font-variant-numeric: tabular-nums; }
.j-title { font: 400 clamp(1.8125rem, 7.9vw, 2.75rem)/1.02 var(--voice); letter-spacing: -0.005em; text-wrap: balance; }
.j-title em { font-style: normal; font-weight: 600; }
.j-lede { margin-top: 12px; max-width: 34em; font: 400 1.0625rem/1.45 var(--body); color: var(--soft); text-wrap: pretty; }
.j-fine { font: 400 0.8125rem/1.5 var(--body); color: var(--soft); text-wrap: pretty; }
.j-fine b { font-weight: 600; color: var(--ink); }

/* ── Large options ───────────────────────────────────────────────────────────────────────────────────── */

.j-options { display: grid; gap: 10px; margin-top: 24px; }
.j-option {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px;
  min-height: 68px; padding: 14px 16px 14px 18px; border: 1.5px solid var(--line); border-radius: var(--r-l);
  background: var(--card); text-decoration: none; color: var(--ink); box-shadow: var(--lift-1);
  transition: border-color var(--quick), scale var(--quick), background-color var(--quick);
}
a.j-option:active { scale: 0.985; border-color: var(--ink); }
.j-option-text { display: grid; gap: 3px; min-width: 0; }
.j-option-text b { font: 700 1.1875rem/1.2 var(--display); letter-spacing: -0.015em; }
.j-option-text small { font: 400 0.875rem/1.35 var(--body); color: var(--soft); }
.j-option-n { display: grid; justify-items: end; gap: 2px; white-space: nowrap; font: 500 0.75rem/1 var(--body); color: var(--soft); }
.j-option-n b { font: 750 1.125rem/1 var(--display); letter-spacing: -0.017em; color: var(--ink); font-variant-numeric: tabular-nums; }
.j-option.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), var(--lift-1); }
.j-option.is-none { background: none; box-shadow: none; border-style: dashed; color: var(--soft); cursor: not-allowed; }
.j-option.is-none .j-option-text b, .j-option.is-none .j-option-n b { color: var(--soft); }
@media (hover: hover) {
  a.j-option:hover { border-color: var(--ink); }
}

/* ── The main button at the bottom ───────────────────────────────────────────────────────────────────── */

/* The main button sticks to the bottom of a phone: an anchor (a card just added, the question of a sixth) and
   whatever the keyboard reaches land between the bar and its row above (`--bar-h`) and it, never under them. This
   sheet is read by journey pages only. The row's own controls stay in view with it (app.css, `.trail.stays`). */
html { scroll-padding: calc(var(--bar-h) + 12px) 0 108px; }
@media (min-width: 760px) { html { scroll-padding: calc(var(--bar-h) + 12px) 0 16px; } }

.j-go {
  position: sticky; z-index: 5; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  margin: 28px calc(var(--pad) * -1) 0; padding: 14px var(--pad) calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--paper) 72%, color-mix(in srgb, var(--paper) 0%, transparent));
}
.j-go .btn { flex: 1 1 100%; min-height: 56px; border-radius: 30px; font-size: 1.0625rem; text-wrap: balance; line-height: 1.15; }
/* It stays in view at the foot of a phone, inside the room the page keeps there: the keyboard coming to it leaves the
   page where it is (as the thread's controls, above). */
@media (max-width: 759px) { .j-go :is(a, button) { scroll-margin: 108px 0 -108px; } }
.j-go-also { font: 550 0.9375rem/1.2 var(--body); color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; min-height: 44px; display: inline-flex; align-items: center; }
@media (min-width: 760px) {
  .j-go { position: static; justify-content: flex-start; margin: 32px 0 0; padding: 0; background: none; }
  .j-go .btn { flex: 0 1 auto; min-width: 280px; }
  /* `.is-sticky`: a screen whose main act must stay in reach while it is read (the selection): it keeps to the
     bottom of the window, centred, on a laptop too. */
  .j-go.is-sticky { position: sticky; justify-content: center; margin: 28px 0 0; padding: 18px 0 22px; background: linear-gradient(to top, var(--paper) 64%, color-mix(in srgb, var(--paper) 0%, transparent)); }
  .j-go.is-sticky .btn { min-width: 340px; box-shadow: var(--lift-2); }
}

/* ── The car card of the journey ─────────────────────────────────────────────────────────────────────── */

.j-card { position: relative; display: grid; gap: 4px; padding: 18px 18px 16px; border: 1.5px solid var(--line); border-radius: var(--r-l); background: var(--card); box-shadow: var(--lift-1); }
.j-card.is-this { border-color: var(--paint-edge); box-shadow: inset 0 0 0 2px var(--paint), var(--lift-1); }
.j-card-pic { --mm: 0.05px; display: grid; place-items: end center; min-height: 90px; margin-bottom: 12px; }
.j-card-make { font: 600 0.71875rem/1.2 var(--label); letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); font-variant-numeric: tabular-nums; }
.j-card-name { font: 750 1.5rem/1.1 var(--display); letter-spacing: -0.021em; }
.j-card-price { font-variant-numeric: tabular-nums; }
.j-card-why { margin-top: 8px; font: 400 1.0625rem/1.26 var(--voice); text-wrap: pretty; letter-spacing: -0.005em; }

/* ── What was said ───────────────────────────────────────────────────────────────────────────────────── */

.j-said { margin-top: 18px; row-gap: 0; }
.j-said .chip span { height: 32px; padding: 0 12px; font-size: 0.8125rem; background: var(--card); }
