/* =========================================================
   THE JOURNEY (journey.html, and the home page below the intro)
   Uses the site's own pieces from css/style.css: headings, pills, paper, prints.
   ========================================================= */
.journey { --jr-text: rgba(255, 255, 255, 0.84); --jr-pad: clamp(16px, 4vw, 52px); position: relative; z-index: 2; }
:where(.journey, .jr-hero) p { margin: 0; }   /* the first screen is also shown on its own, in the home doorway */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the first screen: "The problem" ----------
   Exactly one screen tall: on the home page it is what you see through the container's doorway */
.jr-hero { position: relative; height: 100vh; height: 100svh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: var(--nav-h) 16px 0; }
/* "THE PROBLEM": small spaced capitals, bold and a little brighter so it reads easily above the big heading */
.jr-label { font-size: 15px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.86); }
.jr-hero .jr-label { margin-bottom: 22px; }
.jr-hero-title { font-family: var(--f-display); font-weight: 400; margin: 0; max-width: 8.6em;
  font-size: clamp(46px, min(8vw, 12svh), 104px); line-height: .98; letter-spacing: -0.03em; }
.jr-lead { max-width: 560px; margin: 22px auto 0; color: var(--soft); font-size: 19px; }

/* ---------- text ---------- */
.jr-text { color: var(--jr-text); }
.jr-text > p + p, .jr-text > ul + p, .jr-text > p + ul { margin-top: 22px; }
.jr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.jr-list li { position: relative; padding-left: 26px; }
.jr-list li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.journey strong { color: #fff; font-weight: 600; }
/* achievements: bold white with a green marker stripe underneath (class="hl") */
.journey .hl { color: #fff; font-weight: 600; background: linear-gradient(transparent 60%, rgba(76, 161, 84, .55) 60%, rgba(76, 161, 84, .55) 92%, transparent 92%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.jr-close { font-family: var(--f-display); font-size: clamp(21px, 2vw, 25px); line-height: 1.45; color: #fff; letter-spacing: -0.005em; }
.jr-text > .jr-close { margin-top: 30px; }
.jr-sub { font-family: var(--f-display); font-weight: 400; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.05;
  letter-spacing: -0.02em; color: #fff; margin: 0 0 28px; }
.jr-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 6.4vw, 84px); line-height: 1;
  letter-spacing: -0.03em; text-align: center; margin: 0; color: #fff; }

/* chapter titles: the italic green number, then the title, both in the heading font */
.chapter-tag { display: flex; align-items: baseline; gap: 14px; margin: 0 0 26px; line-height: 1.1;
  font-family: var(--f-display); font-size: clamp(28px, 2.6vw, 38px); font-weight: 400; letter-spacing: -0.015em; color: #fff; }
.chapter-tag span { font-style: italic; font-weight: 300; font-size: 1.4em; letter-spacing: 0; color: var(--green); }

/* ---------- rows: text on one side, photos on the other (swapping sides each chapter) ---------- */
.jr-row, .jr-ch { position: relative; z-index: 1; max-width: 1360px; margin: 0 auto; padding: 0 var(--jr-pad);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(40px, 6vw, 110px); align-items: center; }
.jr-text { max-width: 36em; }
.jr-ch:nth-of-type(even) { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.jr-ch:nth-of-type(even) .jr-media { order: -1; }
.jr-media { position: relative; }

/* ---------- the problem ---------- */
.jr-problem { padding-top: clamp(40px, 6vw, 80px); }
.jr-figures { position: relative; z-index: 1; max-width: 1200px; margin: clamp(100px, 12vw, 170px) auto 0; padding: 0 var(--jr-pad);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 64px); }
.jr-fig { border-top: 1px solid var(--line); padding-top: 26px; color: var(--jr-text); }
.jr-num { font-family: var(--f-display); font-weight: 300; font-size: clamp(50px, 6vw, 86px); line-height: 1; letter-spacing: -0.035em;
  color: #fff; margin-bottom: 18px !important; white-space: nowrap; font-variant-numeric: lining-nums; }
.jr-src { display: inline-block; margin-top: 14px; font-size: 13px; line-height: 1.4; color: rgba(255,255,255,.58);
  text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); text-underline-offset: 3px; transition: color .25s ease; }
.jr-src:hover { color: var(--green); text-decoration-color: currentColor; }
.jr-question { position: relative; z-index: 1; max-width: 1040px; margin: clamp(120px, 15vw, 220px) auto 0; padding: 0 16px; text-align: center;
  font-family: var(--f-display); font-size: clamp(30px, 4.4vw, 60px); line-height: 1.14; letter-spacing: -0.02em; color: #fff; }
.jr-question em { font-style: italic; white-space: nowrap; color: var(--green); }

/* ---------- the journey ---------- */
.jr-chapters { position: relative; margin-top: clamp(140px, 17vw, 250px); }
.jr-chapters > .jr-title { position: relative; z-index: 1; margin-bottom: clamp(80px, 10vw, 140px); }
.jr-ch + .jr-ch { margin-top: clamp(120px, 14vw, 210px); }
/* the playscape: one big pile across the whole width, closing the chapters */
.jr-wide { position: relative; z-index: 1; max-width: 1200px; margin: clamp(120px, 14vw, 210px) auto 0; padding: 0 var(--jr-pad); }
.jr-wide .print { --r: 0.6deg; }
.js .jr-wide .stack > .print:nth-child(2) { transform: translate(1.4%, -3.5%) rotate(1.6deg); }
.js .jr-wide .stack > .print:nth-child(3) { transform: translate(-1.4%, -5.5%) rotate(-1.6deg); }
.journey .jr-wide .print figcaption { font-size: clamp(24px, 2.4vw, 32px); padding-top: 14px; }

/* the dashed route between the chapters (drawn by js/journey.js). Never the browser's scroll anchor: it is redrawn
   when the page changes size, and Safari then nudged the scroll position by a few pixels */
.jr-path { overflow-anchor: none; position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.jr-path .route { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 7 10; opacity: .8; }
.jr-path .stop { fill: var(--green); }

/* prints: the Gallery's, with a handwritten caption on the paper under the photo */
.journey .print { --r: -1deg; }
.jr-ch:nth-of-type(even) .print { --r: 1deg; }
.journey .print figcaption { padding: 12px 6px 2px; text-align: center; font-family: var(--f-hand); font-weight: 500;
  font-size: clamp(22px, 2vw, 27px); line-height: 1.1; color: #4A4436; }
/* the handwriting font (75 KB) is only fetched once the page has loaded (js/journey.js adds .has-hand): the
   captions are far below the first screen, and fetching it early slowed the page's first paint on phones */
.js .journey:not(.has-hand) .print figcaption { font-family: cursive; }
/* a photo still to come: a blank print (no text) until its file is there */
.print[data-ph].is-missing img { aspect-ratio: 3 / 2; object-fit: cover; }
.print[data-ph]:not(.is-ready) figcaption { visibility: hidden; }

/* ---------- piles of prints (several photos): the front one moves to the back every 3 seconds ---------- */
.stack { position: relative; display: grid; gap: 48px; }   /* without JavaScript: one under the other */
.js .stack { gap: 0; }
.js .stack > .print { grid-area: 1 / 1; align-self: center; }
.js .stack > .print:nth-child(1) { z-index: 3; }
.js .stack > .print:nth-child(2) { z-index: 2; transform: translate(3.5%, -5%) rotate(3deg); }
.js .stack > .print:nth-child(3) { z-index: 1; transform: translate(-3%, -8%) rotate(-3.5deg); }
.js .stack > .print:nth-child(n+4) { visibility: hidden; }
/* a portrait photo in a pile (class="print tall"): narrower, so the pile keeps its height */
.stack > .print.tall { width: 40%; justify-self: center; }
@media (max-width: 900px) { .stack > .print.tall { width: 56%; } }
.stack-ui { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 26px; }
.stack-ui[hidden] { display: none; }   /* fewer than two photos in the pile so far */
.stack-ui button { position: relative; width: 38px; height: 38px; padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--pill); border: 1px solid var(--line); color: #fff; transition: background .25s ease; }
.stack-ui button:hover { background: var(--green-dark); }
.stack-ui button:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.stack-ui svg { display: block; }
.stack-ui .ring { position: absolute; inset: -1px; width: 38px; height: 38px; transform: rotate(-90deg); pointer-events: none; }
.stack-ui .ring circle { fill: none; stroke: var(--green); stroke-width: 2; }
.stack-count { margin-right: 8px; font-size: 12px; font-weight: 600; letter-spacing: .2em; color: var(--soft); font-variant-numeric: tabular-nums; }

/* ---------- what comes next ---------- */
.jr-next { position: relative; z-index: 1; max-width: 1200px; margin: clamp(150px, 17vw, 250px) auto 0; padding: 0 var(--jr-pad); text-align: center; }
.jr-next .jr-lead { max-width: 640px; }
.jr-plans { list-style: none; margin: clamp(60px, 7vw, 96px) 0 0; padding: 0; text-align: left;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.jr-plans li { border-top: 1px solid var(--line); padding-top: 24px; color: var(--jr-text); }
.jr-plans strong { display: block; margin-bottom: 10px; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(24px, 2.4vw, 30px); line-height: 1.15; letter-spacing: -0.01em; }
.jr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 20px; margin-top: clamp(64px, 8vw, 100px); }

/* rising text (js/journey.js), only while JavaScript runs */
.js [data-rise] { opacity: 0; transform: translateY(32px); }

/* ---------- tablets and phones: one column, each chapter's photos above its text ---------- */
@media (max-width: 900px) {
  .jr-row, .jr-ch, .jr-ch:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); gap: 44px; max-width: 720px; }
  .jr-media { order: -1; }
  .jr-figures, .jr-plans { grid-template-columns: minmax(0, 1fr); }
  .jr-figures { max-width: 640px; gap: 40px; }
  .js .stack > .print:nth-child(2) { transform: translate(1.4%, -3.5%) rotate(1.6deg); }
  .js .stack > .print:nth-child(3) { transform: translate(-1.4%, -5.5%) rotate(-1.6deg); }
}
@media (max-width: 760px) {
  .journey .print, .jr-ch:nth-of-type(even) .print { --r: 0deg; }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-rise] { opacity: 1; transform: none; }
}
