/* ==========================================================================
   PAPER — journey ("Altavista to the world"), section #timeline
   Default layout  = a stack/grid of taped cards (phones, no-JS, reduced motion).
   Pinned layout   = one long paper strip sliding sideways (desktop + motion);
                     everything in it is sized in --u (1% of viewport height).
   ========================================================================== */
.jny { position: relative; padding-block: var(--pp-section); overflow-x: hidden; overflow-x: clip; }
.jny-track { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(44px, 6vw, 72px); width: 100%; max-width: calc(var(--pp-max) + var(--pp-gutter) * 2); margin-inline: auto; padding-inline: var(--pp-gutter); }

.jny-intro { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 12px; text-align: center; }
.jny-h { font-size: clamp(60px, 17.5vw, 190px); line-height: .86; }
.jny-h-to { display: block; margin: .3em 0 .42em; font-family: var(--pp-f-marker); color: var(--pp-ink); font-size: .3em; line-height: 1.25; text-transform: none; letter-spacing: 0; rotate: -3deg; }
.jny-sub { rotate: -2deg; margin-top: 6px; }
.jny-hint, .jny-paper, .jny-line, .jny-prog, .jny-fin-arrow, .jny-vline { display: none; }

/* ---- stops as taped cards ---- */
.jny-stops { display: grid; grid-template-columns: minmax(0, 1fr); gap: 46px; max-width: 520px; margin-inline: auto; }
.jny-stop { position: relative; background: var(--pp-paper-hi); box-shadow: var(--pp-shadow-2); padding: 26px 18px 22px; }
.jny-stop:nth-child(odd) { rotate: -1.2deg; }
.jny-stop:nth-child(even) { rotate: 1deg; }
.jny-stop:nth-child(3n) .jny-tape { rotate: 2.5deg; left: 46%; }
.jny-ph > .pp-tape { display: none; }

.jny-year { font-family: var(--pp-f-display); color: var(--pp-red); text-transform: uppercase; font-size: clamp(76px, 23vw, 112px); line-height: .84; letter-spacing: -.01em; white-space: nowrap; }
.jny-year small { display: inline-block; font-family: var(--pp-f-marker); color: var(--pp-ink); font-size: .25em; line-height: 1; text-transform: none; rotate: -8deg; margin-right: .3em; vertical-align: .9em; letter-spacing: 0; }
.jny-body { display: grid; grid-template-columns: 42% minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 14px; }
.jny-ph { position: relative; rotate: var(--r, 0deg); }
.jny-stop .pp-photo.jny-ph { padding: 6px 6px 8px; box-shadow: var(--pp-shadow-1); }
.jny-ph > img { aspect-ratio: 4 / 5; }
.jny-title { font-size: 17px; line-height: 1.12; }
.jny-desc { margin-top: 8px; font-size: 15px; line-height: 1.5; }
.jny-stamp { margin-top: 12px; font-size: 15px; }
.jny-stop:nth-child(even) .jny-stamp { rotate: 4deg; }

/* typographic "prints" for the two stops with no photo */
.jny-rx, .jny-mil { --w: calc((min(520px, 100vw - var(--pp-gutter) * 2) - 52px) * .0042); aspect-ratio: 4 / 5; display: flex; flex-direction: column; box-shadow: var(--pp-shadow-1); color: var(--pp-ink); }
/* 2016: the prescription label */
.jny-rx { background: var(--pp-paper); border: 2px solid var(--pp-ink); padding: calc(var(--w) * 7) calc(var(--w) * 8); }
.jny-rx-top { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: calc(var(--w) * 4); border-bottom: 2px dashed var(--pp-ink); }
.jny-rx-top b { font-family: var(--pp-f-display); font-weight: 400; color: var(--pp-red); font-size: calc(var(--w) * 30); line-height: .8; }
.jny-rx-top span { font-weight: 900; font-size: max(11px, calc(var(--w) * 9.5)); letter-spacing: .04em; }
.jny-rx-sig { margin-top: calc(var(--w) * 6); font-weight: 800; font-size: max(11px, calc(var(--w) * 8.4)); line-height: 1.3; text-transform: uppercase; }
.jny-rx-ref { margin-top: auto; font-weight: 800; font-size: max(11px, calc(var(--w) * 7.4)); letter-spacing: .14em; text-transform: uppercase; }
.jny-rx-ref b { color: var(--pp-red); font-weight: 900; }
/* Feb 2020: the first million */
.jny-mil { background: var(--pp-kraft) url(../../images/paper/kraft.webp); background-size: 200px; justify-content: center; align-items: center; text-align: center; padding: calc(var(--w) * 6); }
.jny-mil-n { font-family: var(--pp-f-display); color: var(--pp-red); font-size: calc(var(--w) * 22.5); line-height: 1; }
.jny-mil-l { font-family: var(--pp-f-display); text-transform: uppercase; font-size: calc(var(--w) * 38); line-height: .9; }
.jny-mil-s { margin-top: calc(var(--w) * 7); font-size: max(11px, calc(var(--w) * 9)); rotate: -5deg; }

/* ---- 2027 ---- */
.jny-fin { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding-top: 10px; }
.jny-fin-next { rotate: -4deg; margin-bottom: .5em; font-size: clamp(17px, 2vw, 24px); }
.jny-fin-year { font-family: var(--pp-f-display); color: var(--pp-red); font-size: clamp(130px, min(38vw, 62vh), 330px); line-height: .82; letter-spacing: -.01em; }
.jny-fin-aao { rotate: -4deg; margin-top: -.5em; padding: .1em .5em .06em; font-size: clamp(30px, 6.4vw, 70px); z-index: 1; }
.jny-fin-aao .pp-marker { display: block; white-space: nowrap; }
.jny-fin-soon { rotate: -4deg; margin-top: -.2em; font-size: clamp(18px, 2.6vw, 30px); z-index: 2; position: relative; }
.jny-fin-btn { margin-top: 30px; }

/* phones: the pen line runs down behind the cards and shows in the gaps (drawn on scroll by s-journey.js) */
@media (max-width: 899px) {
  .jny-strip { position: relative; }
  .jny-stops { position: relative; z-index: 1; gap: 58px; }
  .jny-vline { display: block; position: absolute; z-index: 0; left: 50%; top: -34px; bottom: -40px; width: 40px; margin-left: -20px; pointer-events: none; }
  .jny-vline svg { display: block; width: 100%; height: 100%; overflow: visible; }
  .jny-vline path { fill: none; stroke: var(--pp-ink); stroke-width: 1.8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  .jny-vline i { position: absolute; left: 50%; bottom: -1px; width: 13px; height: 13px; margin-left: -6.5px; border: solid var(--pp-ink); border-width: 0 2px 2px 0; border-radius: 1px; rotate: 45deg; }
  .jny-rx-ref { letter-spacing: .08em; }
  .jny-mil-s { line-height: 1.1; }
}

/* wide screens without the pinned scene: three cards per row */
@media (min-width: 900px) {
  .jny-stops { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 54px 40px; max-width: none; }
  .jny-year { font-size: clamp(76px, 8vw, 112px); }
  .jny-rx, .jny-mil { --w: calc(((min(100vw, 1352px) - var(--pp-gutter) * 2 - 80px) / 3 - 52px) * .0042); }
}

/* ==========================================================================
   The pinned strip. Same query as PIN_Q in s-journey.js.
   ========================================================================== */
@media (min-width: 900px) and (min-height: 600px) and (hover: hover) and (pointer: fine) {
  html.pp-motion .jny { --u: clamp(5.8px, 1svh, 10.5px); padding-block: 0; }
  html.pp-motion .jny-pin { position: relative; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: 34px; overflow: clip; }
  html.pp-motion .jny-track { display: flex; align-items: center; gap: 0; width: max-content; max-width: none; height: calc(var(--u) * 78); margin: 0; padding: 0 9vw 0 max(var(--pp-gutter), 7vw); will-change: transform; }

  html.pp-motion .jny-intro, html.pp-motion .jny-fin { grid-template-columns: none; }
  html.pp-motion .jny-intro { flex: none; justify-items: start; text-align: left; gap: calc(var(--u) * 1.6); margin-right: calc(var(--u) * 13); }
  html.pp-motion .jny-h { font-size: calc(var(--u) * 20); }
  html.pp-motion .jny-h-to { margin-left: .2em; }
  html.pp-motion .jny-sub { font-size: max(15px, calc(var(--u) * 2.1)); margin-top: 0; }
  html.pp-motion .jny-hint { display: inline-flex; align-items: center; gap: 12px; font-size: max(16px, calc(var(--u) * 2.3)); margin-top: calc(var(--u) * 1.5); }
  html.pp-motion .jny-hint svg { width: 64px; height: 22px; overflow: visible; }
  html.pp-motion .jny-hint path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

  /* the strip of paper */
  html.pp-motion .jny-strip { position: relative; flex: none; height: calc(var(--u) * 67); display: flex; align-items: center; padding-inline: calc(var(--u) * 6); }
  html.pp-motion .jny-paper { display: block; position: absolute; inset: 0; background: var(--pp-paper-hi) url(../../images/paper/paper.webp); background-size: 300px; box-shadow: var(--pp-shadow-2); rotate: -.35deg; }
  html.pp-motion .jny-line { display: block; position: absolute; z-index: 1; left: calc(var(--u) * 3); right: calc(var(--u) * 3); bottom: calc(var(--u) * 1.6); height: calc(var(--u) * 6.4); }
  html.pp-motion .jny-line svg { width: 100%; height: 100%; overflow: visible; }
  html.pp-motion .jny-line path { fill: none; stroke: var(--pp-ink); stroke-width: 1.7; stroke-linecap: round; vector-effect: non-scaling-stroke; }

  html.pp-motion .jny-stops { position: relative; z-index: 2; display: flex; gap: calc(var(--u) * 8); max-width: none; margin: 0; padding-bottom: calc(var(--u) * 6); }
  html.pp-motion .jny-stop { flex: none; width: calc(var(--u) * 60); background: none; box-shadow: none; padding: 0; rotate: none; }
  html.pp-motion .jny-stop:nth-child(odd) { translate: 0 calc(var(--u) * -2.4); }
  html.pp-motion .jny-stop:nth-child(even) { translate: 0 calc(var(--u) * 2.4); }
  html.pp-motion .jny-tape { display: none; }
  html.pp-motion .jny-ph > .pp-tape { display: block; width: calc(var(--u) * 12); height: calc(var(--u) * 3.3); top: calc(var(--u) * -1.7); }

  html.pp-motion .jny-year { font-size: calc(var(--u) * 21); line-height: .8; }
  html.pp-motion .jny-year--word { font-size: calc(var(--u) * 17.5); line-height: .96; }
  html.pp-motion .jny-body { grid-template-columns: calc(var(--u) * 27) minmax(0, 1fr); gap: calc(var(--u) * 3.6); margin-top: calc(var(--u) * -2.4); }
  html.pp-motion .jny-stop .pp-photo.jny-ph { padding: calc(var(--u) * 1.1) calc(var(--u) * 1.1) calc(var(--u) * 1.4); box-shadow: var(--pp-shadow-2); }
  html.pp-motion .jny-rx, html.pp-motion .jny-mil { --w: calc(var(--u) * .27); box-shadow: var(--pp-shadow-2); }
  html.pp-motion .jny-txt { padding-top: calc(var(--u) * 5.6); }
  html.pp-motion .jny-title { font-size: max(17px, calc(var(--u) * 2.7)); }
  html.pp-motion .jny-desc { font-size: max(14px, calc(var(--u) * 1.72)); margin-top: calc(var(--u) * 1.3); }
  html.pp-motion .jny-stamp { font-size: max(14px, calc(var(--u) * 2.1)); margin-top: calc(var(--u) * 2.2); }

  /* 2027 */
  html.pp-motion .jny-fin { flex: none; margin-left: calc(var(--u) * 22); padding: 0 2vw 0 0; }
  html.pp-motion .jny-fin-arrow { display: block; position: absolute; right: 100%; top: 34%; width: calc(var(--u) * 14); margin-right: calc(var(--u) * 3); overflow: visible; }
  html.pp-motion .jny-fin-arrow path { fill: none; stroke: var(--pp-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  html.pp-motion .jny-fin-next { font-size: max(17px, calc(var(--u) * 2.7)); }
  html.pp-motion .jny-fin-year { font-size: calc(var(--u) * 40); }
  html.pp-motion .jny-fin-aao { font-size: calc(var(--u) * 7.6); }
  html.pp-motion .jny-fin-soon { font-size: calc(var(--u) * 3.4); }
  html.pp-motion .jny-fin-btn { margin-top: calc(var(--u) * 3.4); }

  /* progress: where you are on the strip */
  html.pp-motion .jny-prog { display: block; position: absolute; left: 50%; bottom: max(14px, 2.4svh); translate: -50% 0; width: min(820px, 72vw); height: 36px; }
  html.pp-motion .jny-prog::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--pp-ink); opacity: .22; }
  html.pp-motion .jny-prog-fill { position: absolute; left: 0; right: 0; top: 7px; height: 6px; background: var(--pp-red); transform: scaleX(0); transform-origin: left; clip-path: var(--pp-brush-c); }
  html.pp-motion .jny-prog-m { position: absolute; top: 20px; translate: -50% 0; font-weight: 800; font-size: 11px; line-height: 1; letter-spacing: .14em; text-transform: uppercase; color: var(--pp-ink-faint); white-space: nowrap; transition: color .3s; }
  html.pp-motion .jny-prog-m::before { content: ''; position: absolute; left: 50%; top: -15px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--pp-paper); border: 2px solid var(--pp-ink-faint); transition: background .3s, border-color .3s, scale .4s var(--pp-ease-back); }
  html.pp-motion .jny-prog-m.is-past { color: var(--pp-ink); }
  html.pp-motion .jny-prog-m.is-past::before { background: var(--pp-red); border-color: var(--pp-red); }
  html.pp-motion .jny-prog-m.is-on { color: var(--pp-red); }
  html.pp-motion .jny-prog-m.is-on::before { background: var(--pp-red); border-color: var(--pp-red); scale: 1.7; }
}
