/* Path Drawing, in full: Minard's bands draw themselves. The map is the lithograph at full strength; over each
   band lies a veil of the paper's colour, blended with lighten so it lifts only ink, masked by an SVG mask that
   holds the veil (the band's own outline, traced from the scan) and its pens (black strokes, pathLength 1). Each
   route's progress is a registered number on the run's view timeline, its keyframes written into the page's head
   from the tracings and Minard's dates; each pen turns its route's progress into its own dashoffset. */

@property --t{syntax:'<number>';inherits:true;initial-value:0}

.march{position:relative;width:100vw;margin-inline:calc(50% - 50vw);border:0;border-radius:0;background:#231D16;color:#EDE4D3}
.run{height:calc(100svh - var(--bar) + 460svh);view-timeline:--march block;view-timeline-inset:var(--bar) 0px}
.frame{position:sticky;top:var(--bar);height:calc(100svh - var(--bar));box-sizing:border-box;overflow:clip;
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;justify-items:center;align-items:center;
  gap:clamp(8px,1.6vh,16px);
  padding:clamp(12px,2.6vh,28px) clamp(12px,2.4vw,40px) clamp(12px,2.2vh,22px);
  animation:progress linear both;animation-timeline:--march;animation-range:contain 0% contain 100%}   /* and each route's */
@keyframes progress{from{--t:0}to{--t:1}}

/* the map: the sheet, placed so the crop fills the figure */
.map{position:relative;margin:0;overflow:clip;aspect-ratio:var(--ar);
  width:min(100%,calc((100svh - var(--bar) - 150px) * var(--ar)));
  box-shadow:0 30px 80px -40px rgb(0 0 0 / .9),0 0 0 1px rgb(255 255 255 / .06)}
.map img{position:absolute;left:calc(var(--ix) * 100%);top:calc(var(--iy) * 100%);width:calc(var(--iw) * 100%);
  height:calc(var(--ih) * 100%);max-width:none}
/* each band's veil: the paper's colour, lifting only ink, a little of the band left showing through */
.veil{position:absolute;inset:0;background:var(--veil);mix-blend-mode:lighten;opacity:.9}
.masks{position:absolute}
/* a pen takes the veil away: its dash runs from its stretch's start (--a) to its end (--b) of the route's progress */
.pen{stroke-dasharray:1;stroke-dashoffset:calc(1 - clamp(0, (var(--p) - var(--a)) / (var(--b) - var(--a)), 1))}

/* the ledger: where the pens are, as Minard wrote it */
.ledger{display:grid;grid-template-columns:1fr auto 1fr;align-items:baseline;gap:clamp(14px,3vw,48px);
  width:min(100%,calc((100svh - var(--bar) - 150px) * 2.14))}
.ledger .phase,.ledger ol{display:grid;margin:0;padding:0;list-style:none}
.ledger .phase span,.ledger li{grid-area:1/1;
  opacity:calc(clamp(0, (var(--t) - var(--from)) * 999, 1) * clamp(0, (var(--to) - var(--t)) * 999, 1))}
.phase{font:10px/1.4 var(--mono);letter-spacing:.16em;text-transform:uppercase;color:#A89C8A}
.men{justify-items:center;text-align:center}
.men b{font-family:var(--sans);font-weight:400;font-size:clamp(30px,3.6vw,54px);line-height:1;letter-spacing:-.03em;   /* figures in Switzer: Melodrama's zero is slashed */
  font-variant-numeric:tabular-nums}
.men span,.cold span{display:block;margin-top:4px;font:10px/1.2 var(--mono);letter-spacing:.14em;text-transform:uppercase;color:#A89C8A}
.cold{justify-items:end;text-align:right}
.cold b{font-family:var(--sans);font-weight:400;font-size:clamp(22px,2.4vw,36px);line-height:1;letter-spacing:-.02em}

@media (max-width:760px){
  .run{height:calc(100svh - var(--bar) + 620svh)}
  .frame{padding:10px 0 14px;justify-items:stretch}
  /* on a phone the map is too wide to show whole: it is shown as tall as it can be and follows the pens */
  .map{width:auto;height:60svh;justify-self:start;
    translate:clamp(calc(100vw - 60svh * var(--ar)), calc(50vw - var(--fx) * 60svh * var(--ar)), 0px) 0}
  .ledger{grid-template-columns:minmax(0,1fr) minmax(0,1fr);padding-inline:18px;width:auto}
  .phase{grid-column:1/-1}
  .men{justify-items:start;text-align:left}
}
