/* =============================================================================
   DRAWN JOURNEY PATH (4 Oct 2026)
   Markup: src/_includes/rd/journey.njk   Behaviour: /js/rd-journey.js (data-rd-journey)
   A hand-drawn green line, like the homepage's drawn underline, links round mint stops. The line is
   measured from the real stop positions in rd-journey.js, so these rules only place the stops.
   --jp-mode tells the script which path to draw: row, snake (two rows) or column (760px and below).
   ============================================================================= */

.rd.rd-jp { --jp-mode: row; --jp-mark: 64px; }
.rd.rd-jp--snake { --jp-mode: snake; }

.rd .rd-jp__track { position: relative; }
.rd .rd-jp__svg { position: absolute; left: 0; top: 0; z-index: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

/* The line: green ink over a soft mint highlighter, both with round ends */
.rd .rd-jp__path { fill: none; stroke: var(--rd-green); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.rd .rd-jp__under { fill: none; stroke: var(--rd-mint); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; opacity: .8; transform: translate(1px, 3px); }
.rd .rd-jp__loopline { fill: none; stroke: var(--rd-green); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: .01 8.5; }
.rd .rd-jp__loopmask { fill: none; stroke: #fff; stroke-width: 14; stroke-linecap: round; }
.rd .rd-jp__loophead { fill: none; stroke: var(--rd-green); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Stops: one row on wide screens, each stop a little higher or lower than the last ---------- */
.rd .rd-jp__list { position: relative; z-index: 1; display: flex; align-items: flex-start; }
.rd.rd-jp--loop .rd-jp__list { padding-top: 64px; }
.rd .rd-jp__stop { position: relative; flex: 1 1 0; min-width: 0; margin-top: var(--y, 0px); }
.rd .rd-jp__stop.is-open { z-index: 4; }
.rd .rd-jp__stop:nth-child(7n+1) { --y: 4px; }
.rd .rd-jp__stop:nth-child(7n+2) { --y: 42px; }
.rd .rd-jp__stop:nth-child(7n+3) { --y: 0px; }
.rd .rd-jp__stop:nth-child(7n+4) { --y: 30px; }
.rd .rd-jp__stop:nth-child(7n+5) { --y: 10px; }
.rd .rd-jp__stop:nth-child(7n+6) { --y: 40px; }
.rd .rd-jp__stop:nth-child(7n+7) { --y: 2px; }

.rd .rd-jp__anchor { position: relative; }
.rd .rd-jp__btn {
  position: relative; display: flex; flex-direction: column; align-items: center; width: 100%;
  padding: 0 6px 4px; border-radius: 14px; text-align: center; color: inherit; -webkit-tap-highlight-color: transparent;
}
.rd button.rd-jp__btn { cursor: pointer; }
.rd .rd-jp__btn:focus-visible { outline: none; }

/* The round stop: a mint circle with a number or a line icon. Its ring takes the section colour, so the
   line seems to stop just short of it. */
.rd .rd-jp__mark {
  position: relative; display: grid; place-items: center; flex: none;
  width: var(--jp-mark); height: var(--jp-mark); border-radius: 50%;
  background: var(--rd-mint); border: 3px solid var(--rd-bg); box-shadow: 0 6px 18px rgba(3, 23, 79, .12);
  color: var(--rd-navy); font-size: 22px; font-weight: 700; line-height: 1;
  transition: background-color .2s, color .2s, box-shadow .2s, translate .25s var(--rd-ease);
}
.rd .rd-jp__mark--icon { color: var(--rd-green-dark); }
.rd .rd-jp__mark .rd-icon { width: 26px; height: 26px; }
@media (hover: hover) {
  .rd button.rd-jp__btn:hover .rd-jp__mark { translate: 0 -3px; background: var(--rd-mint-hover); box-shadow: 0 12px 26px rgba(3, 23, 79, .16); }
}
/* Open beats hover: the open stop turns solid green */
.rd .rd-jp__stop.is-open .rd-jp__btn .rd-jp__mark { background: var(--rd-green); color: #fff; }
.rd .rd-jp__btn:focus-visible .rd-jp__mark { box-shadow: 0 0 0 3px var(--rd-bg), 0 0 0 5.5px var(--rd-green), 0 10px 22px rgba(3, 23, 79, .14); }

.rd .rd-jp__txt { display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: 15.5rem; margin-top: 14px; }
.rd .rd-jp__kicker { font-size: 12.5px; font-weight: 700; line-height: 1.3; color: var(--rd-green); }
.rd .rd-jp__title { font-size: 17px; font-weight: 700; line-height: 1.25; color: var(--rd-navy); text-wrap: balance; }
.rd .rd-jp__line { font-size: 14.5px; line-height: 1.45; color: var(--rd-muted); text-wrap: balance; }
.rd .rd-jp__btn:focus-visible .rd-jp__title { text-decoration: underline; text-decoration-color: var(--rd-green); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.rd .rd-jp__chev { display: none; }

/* Milestones: an outcome on the way, a small ticked green waypoint with no card */
.rd .rd-jp__stop--mile { display: flex; flex-direction: column; align-items: center; flex-grow: .72; padding-top: calc((var(--jp-mark) - 26px) / 2); text-align: center; }
.rd .rd-jp__mark--mile { --jp-mark: 26px; background: var(--rd-green); color: #fff; box-shadow: 0 3px 10px rgba(21, 128, 61, .25); }
.rd .rd-jp__mark--mile .rd-icon { width: 14px; height: 14px; }
.rd .rd-jp__stop--mile .rd-jp__txt { margin-top: 12px; padding: 0 6px; }
.rd .rd-jp__stop--mile .rd-jp__title { font-size: 15.5px; color: var(--rd-green-dark); }

/* Side notes: a small aside hung under a stop by a short dotted line */
.rd .rd-jp__aside { position: relative; display: flex; align-items: flex-start; justify-content: center; gap: 8px; max-width: 15.5rem; margin: 8px auto 0; padding: 18px 6px 0; font-size: 13.5px; line-height: 1.45; color: var(--rd-muted); text-align: left; }
.rd .rd-jp__aside::before { content: ""; position: absolute; top: 2px; left: 50%; height: 11px; border-left: 2px dotted var(--rd-green); opacity: .75; }
.rd .rd-jp__aside b { font-weight: 700; color: var(--rd-navy); }
.rd .rd-jp__aside-ic { display: grid; place-items: center; flex: none; width: 26px; height: 26px; margin-top: -3px; border-radius: 50%; background: var(--rd-mint-soft); border: 1px solid var(--rd-mint-line); color: var(--rd-green); }

/* ---------- The card: lifts under its stop on wide screens ---------- */
.rd .rd-jp__card {
  display: none; position: absolute; z-index: 3; top: calc(100% + 14px); left: 50%;
  width: min(330px, calc(100vw - 32px)); translate: calc(-50% + var(--shift, 0px)) 0;
  padding: 16px 18px 18px; border: 1px solid var(--rd-line); border-radius: 16px; background: #fff;
  box-shadow: 0 2px 6px rgba(3, 23, 79, .06), 0 22px 48px rgba(3, 23, 79, .15);
  font-size: 14.5px; line-height: 1.55; color: var(--rd-body); text-align: left;
}
.rd .rd-jp__card::before { content: ""; position: absolute; top: -7px; left: calc(50% - var(--shift, 0px)); width: 12px; height: 12px; background: #fff; border-left: 1px solid var(--rd-line); border-top: 1px solid var(--rd-line); border-top-left-radius: 3px; transform: translateX(-50%) rotate(45deg); }
.rd .rd-jp__card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 16px; }
.rd .rd-jp__card--wide { width: min(440px, calc(100vw - 32px)); }
.rd .rd-jp__stop.is-open .rd-jp__card, .rd .rd-jp__loop.is-open .rd-jp__card { display: block; opacity: 1; transform: none; transition: opacity .18s ease, transform .24s var(--rd-ease); }
@starting-style {
  .rd .rd-jp__stop.is-open .rd-jp__card, .rd .rd-jp__loop.is-open .rd-jp__card { opacity: 0; transform: translateY(8px); }
}
.rd .rd-jp__sum { color: var(--rd-body); }
.rd .rd-jp__pts { display: grid; gap: 6px; margin-top: 10px; }
.rd .rd-jp__pts li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--rd-navy); }
.rd .rd-jp__pts .rd-icon { margin-top: 2px; color: var(--rd-green); }
.rd .rd-jp__body { margin-top: 10px; }
.rd .rd-jp__body a:where(:not([class])) { color: var(--rd-navy); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.rd .rd-jp__more { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rd-line-strong); }
.rd .rd-jp__more-t { margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--rd-navy); }
.rd .rd-jp__more .rd-peeklist + .rd-peeklist { margin-top: 10px; }
.rd .rd-jp__more .rd-peeklist__t { margin-bottom: 6px; font-size: 13.5px; line-height: 1.4; }
.rd .rd-jp__more .rd-peeklist ul { gap: 5px; }
.rd .rd-jp__more .rd-peeklist li { gap: 8px; font-size: 14px; line-height: 1.4; }
.rd .rd-jp__more--cols .rd-peeklist ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
.rd .rd-jp__card .rd-peekfig { margin-top: 12px; }
.rd .rd-jp__card .rd-peekfig img { max-height: 170px; }

/* ---------- A loop: a soft dotted line back to an earlier stop, with a short label on top ---------- */
.rd .rd-jp__loop { position: absolute; z-index: 3; left: var(--lx, 50%); top: var(--ly, 24px); translate: -50% -50%; }
.rd .rd-jp__loop.is-open { z-index: 5; }
.rd .rd-jp__loopbtn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 10px; border-radius: 999px;
  background: var(--rd-mint); color: var(--rd-green-dark); box-shadow: 0 0 0 5px var(--rd-bg);
  font-size: 13.5px; font-weight: 700; line-height: 1.2; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
@media (hover: hover) { .rd button.rd-jp__loopbtn:hover { background: var(--rd-mint-hover); } }
.rd .rd-jp__loop.is-open .rd-jp__loopbtn.rd-jp__loopbtn { background: var(--rd-green); color: #fff; }

/* One quiet hint under the path */
.rd .rd-jp__hint { margin-top: 22px; font-size: 13.5px; line-height: 1.4; color: var(--rd-muted); text-align: center; }
.rd .rd-jp__hint-hover { display: none; }
@media (min-width: 761px) and (hover: hover) and (pointer: fine) {
  .rd .rd-jp__hint-tap { display: none; }
  .rd .rd-jp__hint-hover { display: inline; }
}

/* ---------- Seven stops: two rows joined by a curve on the right. The second row runs back right to
   left, between the stops above, and the right padding leaves room for the turn. ---------- */
@media (min-width: 761px) {
  .rd.rd-jp--snake .rd-jp__list { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); row-gap: 52px; padding-right: clamp(40px, 7%, 96px); }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(1) { grid-area: 1 / 1 / 2 / 3; --y: 4px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(2) { grid-area: 1 / 3 / 2 / 5; --y: 36px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(3) { grid-area: 1 / 5 / 2 / 7; --y: 2px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(4) { grid-area: 1 / 7 / 2 / 9; --y: 26px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(5) { grid-area: 2 / 6 / 3 / 8; --y: 18px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(6) { grid-area: 2 / 4 / 3 / 6; --y: 0px; }
  .rd.rd-jp--snake .rd-jp__stop:nth-child(7) { grid-area: 2 / 2 / 3 / 4; --y: 28px; }
  .rd.rd-jp--snake .rd-jp__title { font-size: 16.5px; }
}
@media (min-width: 761px) and (max-width: 1020px) {
  .rd.rd-jp { --jp-mark: 56px; }
  .rd .rd-jp__btn { padding-left: 3px; padding-right: 3px; }
  .rd .rd-jp__title { font-size: 16px; }
  .rd .rd-jp__line { font-size: 14px; }
}

/* ---------- 760px and below: a vertical path with the line on the left, cards open inline ---------- */
@media (max-width: 760px) {
  .rd.rd-jp, .rd.rd-jp--snake { --jp-mode: column; --jp-mark: 50px; }
  .rd .rd-jp__list { display: block; padding: 0 0 0 4px; }
  .rd.rd-jp--loop .rd-jp__list { padding: 0 0 0 30px; }
  .rd .rd-jp__stop { margin: 0; padding: 0 0 26px; }
  .rd .rd-jp__stop:last-child { padding-bottom: 0; }
  .rd .rd-jp__btn { flex-direction: row; align-items: flex-start; gap: 14px; padding: 0; border-radius: 12px; text-align: left; }
  .rd .rd-jp__mark { font-size: 19px; }
  .rd .rd-jp__mark .rd-icon { width: 22px; height: 22px; }
  .rd .rd-jp__txt { flex: 1 1 auto; align-items: flex-start; min-width: 0; max-width: none; margin: 0; padding-top: 3px; }
  .rd .rd-jp__title { font-size: 16.5px; text-wrap: pretty; }
  .rd .rd-jp__line { font-size: 14.5px; text-wrap: pretty; }
  .rd .rd-jp__chev { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 4px; vertical-align: -4px; color: var(--rd-green); transition: rotate .2s var(--rd-ease); }
  .rd .rd-jp__stop.is-open .rd-jp__chev { rotate: 180deg; }
  .rd .rd-jp__card, .rd .rd-jp__card--wide { position: static; width: auto; margin: 12px 0 0 64px; translate: none; box-shadow: 0 1px 2px rgba(3, 23, 79, .05), 0 8px 22px rgba(3, 23, 79, .08); }
  .rd .rd-jp__card::before, .rd .rd-jp__card::after { display: none; }
  .rd .rd-jp__more--cols .rd-peeklist ul { grid-template-columns: minmax(0, 1fr); }
  .rd .rd-jp__aside { justify-content: flex-start; max-width: none; margin: 10px 0 0 64px; padding: 0; }
  .rd .rd-jp__aside::before { display: none; }
  .rd .rd-jp__stop--mile { flex-direction: row; align-items: center; gap: 14px; padding-top: 0; text-align: left; }
  .rd .rd-jp__stop--mile .rd-jp__mark { margin: 0 12px; }
  .rd .rd-jp__stop--mile .rd-jp__txt { margin: 0; padding: 0; }
  .rd .rd-jp__loop { position: static; translate: none; margin: 0 0 0 68px; padding-top: 24px; }
  .rd.rd-jp--loop .rd-jp__loop { margin-left: 94px; }
}

/* ---------- Motion: the line draws once and the stops settle in behind it ----------
   is-armed: waiting to draw. is-drawing: the line and the stops are on their way. is-drawn: still.
   Until the script arms a block, its stops wait hidden, and a short safety animation shows them
   anyway after 3 seconds in case the script never runs. */
@media (prefers-reduced-motion: no-preference) {
  .rd-js .rd.rd-jp:not(.is-drawn) .rd-jp__mark { opacity: 0; scale: .5; animation: rdJpShow .01s linear 3s forwards; }
  .rd-js .rd.rd-jp:not(.is-drawn) :is(.rd-jp__txt, .rd-jp__aside) { opacity: 0; translate: 0 8px; animation: rdJpShow .01s linear 3s forwards; }
  .rd-js .rd.rd-jp:not(.is-drawn) .rd-jp__loopbtn { opacity: 0; scale: .8; animation: rdJpShow .01s linear 3s forwards; }
  .rd-js .rd.rd-jp:not(.is-drawn) .rd-jp__loophead { opacity: 0; }
  .rd.rd-jp.is-armed :is(.rd-jp__mark, .rd-jp__txt, .rd-jp__aside, .rd-jp__loopbtn) { animation: none; }
  .rd.rd-jp.is-armed :is(.rd-jp__path, .rd-jp__under, .rd-jp__loopmask) { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
  .rd.rd-jp.is-armed :is(.rd-jp__path, .rd-jp__under) { opacity: 0; }

  .rd.rd-jp.is-drawing .rd-jp__path { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset var(--jp-dur, 1600ms) linear, opacity .01s; }
  .rd.rd-jp.is-drawing .rd-jp__under { opacity: .85; stroke-dashoffset: 0; transition: stroke-dashoffset var(--jp-dur, 1600ms) linear .14s, opacity .01s .14s; }
  .rd.rd-jp.is-drawing .rd-jp__mark {
    opacity: 1; scale: 1;
    transition: opacity .3s ease var(--d, 0ms), scale .55s cubic-bezier(.34, 1.56, .64, 1) var(--d, 0ms),
      background-color .2s, color .2s, box-shadow .2s, translate .25s var(--rd-ease);
  }
  .rd.rd-jp.is-drawing :is(.rd-jp__txt, .rd-jp__aside) { opacity: 1; translate: 0 0; transition: opacity .45s ease calc(var(--d, 0ms) + 120ms), translate .45s var(--rd-ease) calc(var(--d, 0ms) + 120ms); }
  .rd.rd-jp.is-drawing .rd-jp__aside { transition-delay: calc(var(--d, 0ms) + 320ms); }
  .rd.rd-jp.is-drawing .rd-jp__loopmask { stroke-dashoffset: 0; transition: stroke-dashoffset .8s ease-in-out var(--jp-loopd, 1600ms); }
  .rd.rd-jp.is-drawing .rd-jp__loophead { opacity: 1; transition: opacity .25s ease calc(var(--jp-loopd, 1600ms) + .7s); }
  .rd.rd-jp.is-drawing .rd-jp__loopbtn {
    opacity: 1; scale: 1;
    transition: opacity .3s ease calc(var(--jp-loopd, 1600ms) + .3s), scale .45s cubic-bezier(.34, 1.56, .64, 1) calc(var(--jp-loopd, 1600ms) + .3s), background-color .2s, color .2s;
  }
}
@keyframes rdJpShow { to { opacity: 1; scale: 1; translate: 0 0; } }

/* ---------- Without JavaScript: every card sits open under its stop ---------- */
html:not(.rd-js) .rd .rd-jp__card { display: block; position: static; width: auto; margin-top: 12px; translate: none; box-shadow: none; }
html:not(.rd-js) .rd .rd-jp__card::before, html:not(.rd-js) .rd .rd-jp__card::after { display: none; }
html:not(.rd-js) .rd .rd-jp__loop { position: static; translate: none; margin-top: 24px; }
html:not(.rd-js) .rd .rd-jp__hint { display: none; }

@media print {
  .rd.rd-jp :is(.rd-jp__mark, .rd-jp__txt, .rd-jp__aside, .rd-jp__loopbtn) { opacity: 1 !important; scale: 1 !important; translate: 0 0 !important; animation: none !important; }
}
