/* career: his working life on one time axis. One row per job with a bar; a playhead crosses them with the scroll.
   .gantt is the runway (as tall as the scroll that plays the years); .gantt__stage is the card that holds the
   chart and, where it fits the window, stays pinned while the runway passes.
   --n calendar years on the axis (one cell each), --o5 years from its start to the first round year (the stronger
   grid lines), --rows the number of jobs; --a --w place a bar or a country's stretch, --x a tick; --k is how much
   of a bar or of a stretch is filled; --ca --cw are the span cast by the marked job.
   The playhead is moved by career.js with transforms on its own few elements (.gantt__head, .stint__ph,
   .stint__past): it is not a custom property, which would restyle the whole chart on every frame.
   Text never dims: a job is marked by fill, border, glow and scale. */
.gantt{--info:clamp(280px,40%,460px);--gap:16px;--res:28px;--px:clamp(10px,1.2vw,16px);--in:8px;--bh:26px;--row:clamp(124px,19vh,176px);
  /* the year grid every track shares: a hairline per year, a stronger one every five */
  --grid:linear-gradient(90deg,rgba(182,222,200,.34) 1px,transparent 1px) calc(100%*var(--o5)/(var(--n) - 5)) 0/calc(500%/var(--n)) 100%,linear-gradient(90deg,rgba(182,222,200,.13) 1px,transparent 1px) 0 0/calc(100%/var(--n)) 100%}
.gantt__stage{border-radius:26px;padding:0 var(--in) var(--in)}

/* the head: the year being played on the left; on the right the countries, the years and the ticks. The handle of
   the playhead rides on its lower edge. It is a slider. Not pinned, it stays in sight on its own under the nav. */
.gantt__axis{position:sticky;top:60px;z-index:3;display:grid;grid-template-columns:var(--info) minmax(0,1fr);column-gap:var(--gap);align-items:end;margin:0 calc(var(--in)*-1);padding:18px calc(var(--in) + var(--px) + 1px) 0;background:#09120e;border-bottom:1px solid rgba(182,222,200,.28);border-radius:25px 25px 0 0}
.gantt__now{display:flex;align-items:baseline;gap:14px;padding-bottom:10px}
.gantt__year{font-family:var(--mono);font-size:clamp(1.8rem,2.8vw,2.5rem);font-weight:300;letter-spacing:-.03em;line-height:1;color:var(--em);font-variant-numeric:tabular-nums}
.gantt__roles{font-size:1rem;font-weight:500;color:#fff}
.gantt__scale{position:relative;height:64px;margin-right:var(--res);cursor:ew-resize;touch-action:pan-y;border-radius:8px 8px 0 0;transition:background .3s}
.gantt__scale:hover,.gantt__scale:focus-visible{background:linear-gradient(rgba(16,201,139,0),rgba(16,201,139,.14))}
.gantt__scale:focus-visible{outline-offset:-3px}
.gantt__scale::before{content:"";position:absolute;left:var(--ca,0);bottom:-2px;width:var(--cw,0);min-width:2px;height:3px;border-radius:2px;background:var(--mint);opacity:0;transition:opacity .25s}
.gantt--cast .gantt__scale::before{opacity:1}
.gantt__eras{position:absolute;left:0;right:0;top:14px;height:6px}
/* a country's stretch is a track that fills with the playhead; its flag rides the tip of the fill and never
   leaves the stretch (at the start it sits on its left edge, at the end on its right one) */
.era{position:absolute;left:var(--a);width:var(--w);top:0;height:6px;border-radius:3px;background:rgba(182,222,200,.22);box-shadow:inset 0 0 0 1px rgba(182,222,200,.3)}
.era__fill{position:absolute;inset:0;border-radius:inherit;background:linear-gradient(90deg,var(--em),var(--mint));transform-origin:left;transform:scaleX(var(--k,0))}
.era .flag{position:absolute;z-index:1;left:calc(var(--k,0)*100%);top:50%;font-size:1.05rem;transform:translate(calc(var(--k,0)*-100%),-50%);transition:filter .3s}
.era.live .flag{filter:drop-shadow(0 0 7px rgba(16,201,139,.9))}
.gantt__tick{position:absolute;left:var(--x);bottom:0;width:1px;height:5px;background:rgba(182,222,200,.5)}
.gantt__tick b{display:none;font-style:normal;position:absolute;left:0;bottom:13px;transform:translateX(-50%);font-family:var(--mono);font-size:.7rem;font-weight:500;letter-spacing:.04em;line-height:1;color:var(--mint);white-space:nowrap}
.gantt__tick.lab{height:9px;background:var(--mint)}
.gantt__tick.lab b{display:block}
.gantt__tick:nth-last-child(2) b{transform:translateX(4px);color:var(--em)}
.gantt__head{position:absolute;z-index:1;left:-8px;bottom:-9px;width:16px;height:16px;border-radius:4px;background:var(--em);border:2px solid #eafff6;box-shadow:0 0 18px var(--em);transform:rotate(45deg)}

.gantt__rows{position:relative;list-style:none;margin:0;padding:0}
.stint{scroll-margin:180px 0 12px;min-height:var(--row);position:relative;display:grid;grid-template-columns:var(--info) minmax(0,1fr);column-gap:var(--gap);padding:0 var(--px);border:1px solid transparent;border-radius:0;cursor:default;transition:background-color .4s,border-color .3s,box-shadow .4s}
.stint+.stint::before{content:"";position:absolute;left:var(--px);right:var(--px);top:-1px;height:1px;background:rgba(182,222,200,.14)}
.stint__info{display:grid;grid-template-columns:auto minmax(0,1fr);gap:0 18px;align-items:center;padding:14px 0}
.stint__ic{display:grid;place-items:center;width:58px;height:58px;border-radius:17px;background:var(--bg);border:1px solid var(--em);color:var(--mint);font-size:1.7rem;transition:background .4s,color .4s,border-color .4s,box-shadow .4s,transform .5s var(--ease)}
.stint__txt{display:grid;gap:7px}
.stint h3{font-size:clamp(1.2rem,1.9vw,1.5rem);font-weight:500;letter-spacing:-.02em;line-height:1.15}
.stint p{display:flex;align-items:flex-start;gap:.65em;margin:0;font-size:1.02rem;line-height:1.35}
.stint p .flag{font-size:1.2em;margin-top:-.02em;transform-origin:left center;transition:transform .45s var(--ease)}
.stint p span{transition:transform .45s var(--ease)}

/* the track: the year grid, the light on the years already played (.stint__past), the cast span (::before), the
   period, the bar under it and the playhead (.stint__ph). The line on its right is now. An empty bar is hatched;
   it fills with the playhead. */
.stint__track{position:relative;margin:-1px var(--res) -1px 0;min-height:calc(var(--bh) + 34px);border-right:1px solid var(--em);background:var(--grid)}
.stint__past{position:absolute;inset:0;transform-origin:left;transform:scaleX(0);background:linear-gradient(90deg,rgba(16,201,139,.02),rgba(16,201,139,.13))}
.stint__track::before{content:"";position:absolute;top:0;bottom:0;left:var(--ca,0);width:var(--cw,0);min-width:1px;background:rgba(182,222,200,.13);box-shadow:inset 1px 0 0 var(--mint),inset -1px 0 0 var(--mint);opacity:0;transition:opacity .25s}
.gantt--cast .stint__track::before{opacity:1}
.stint__ph{position:absolute;z-index:2;top:0;bottom:0;left:-1px;width:2px;background:var(--em);box-shadow:0 0 10px rgba(16,201,139,.7)}
.stint__span{position:absolute;z-index:1;left:min(var(--a),calc(100% - 9.6em));bottom:calc(50% + var(--bh)/2 - 1px);font-family:var(--mono);font-size:.8rem;font-weight:500;letter-spacing:.05em;line-height:1;color:var(--mint);white-space:nowrap;transition:bottom .35s var(--ease),color .3s}
.stint__bar{position:absolute;z-index:1;left:var(--a);top:calc(50% + 8px);width:max(var(--w),8px);height:var(--bh);transform:translateY(-50%);border-radius:8px;border:1px solid rgba(182,222,200,.6);background:repeating-linear-gradient(135deg,rgba(182,222,200,.22) 0 2px,transparent 2px 7px);overflow:hidden;transition:height .35s var(--ease),border-color .3s,box-shadow .4s}
.stint__bar i{position:absolute;inset:-1px;border-radius:inherit;background:linear-gradient(rgba(255,255,255,.3),rgba(255,255,255,0) 46%),linear-gradient(90deg,#0b8f66,var(--em));transform:translateX(calc((var(--k,0) - 1)*100%))}
.stint.full .stint__bar{border-color:var(--em)}

/* a job that is still going has no end cap: the bar runs past the now line, light flows along it and its tip beats */
.stint--open .stint__bar{border-right:0;border-radius:8px 0 0 8px}
.stint--open.full .stint__bar i{background:repeating-linear-gradient(115deg,rgba(255,255,255,.2) 0 10px,transparent 10px 20px) 0 0/44px 100%,linear-gradient(rgba(255,255,255,.3),rgba(255,255,255,0) 46%),linear-gradient(90deg,var(--em),var(--pos));animation:stint-flow 1.8s linear infinite}
@keyframes stint-flow{to{background-position:44px 0,0 0,0 0}}
.stint__live{position:absolute;z-index:1;left:100%;top:calc(50% + 8px);width:var(--res);height:var(--bh);transform:translateY(-50%);background:linear-gradient(90deg,var(--em),rgba(16,201,139,0));opacity:0;transition:opacity .5s,height .35s var(--ease)}
.stint__live::before,.stint__live::after{content:"";position:absolute;left:-5px;top:50%;width:10px;height:10px;margin-top:-5px;border-radius:50%;background:#eafff6}
.stint.full .stint__live{opacity:1}
.stint.full .stint__live::before{animation:stint-beat 2.2s var(--ease) infinite}
@keyframes stint-beat{from{transform:scale(1);opacity:.85}70%,to{transform:scale(3.4);opacity:0}}

/* held in the year being played */
.stint.on{box-shadow:inset 3px 0 0 var(--em)}
.stint.on .stint__ic{background:var(--em);border-color:var(--em);color:var(--ink);box-shadow:0 0 18px rgba(16,201,139,.6)}
.stint.on .stint__bar{border-color:var(--em);box-shadow:0 0 16px rgba(16,201,139,.7)}
.stint.on .stint__bar i{box-shadow:inset -3px 0 0 #eafff6}
.stint.on .stint__span{color:#fff}

/* the current role is the destination of the chart */
.stint--now{box-shadow:inset 3px 0 0 var(--pos)}
.stint--now.on{box-shadow:inset 3px 0 0 var(--em)}
.stint--now .stint__ic{background:var(--pos);border-color:var(--pos);color:var(--ink)}
.stint--now .stint__bar i{background:linear-gradient(rgba(255,255,255,.3),rgba(255,255,255,0) 46%),linear-gradient(90deg,var(--em),var(--pos))}

/* marked by pointer, keyboard or tap */
.stint.hot{background-color:rgba(16,201,139,.16);border-color:var(--em);box-shadow:0 0 0 1px var(--em),0 16px 40px -20px rgba(16,201,139,.9)}
.stint.hot .stint__ic{background:var(--mint);border-color:var(--mint);color:var(--ink);transform:scale(1.1) rotate(-6deg)}
.stint.hot .stint__bar{border-color:var(--mint);box-shadow:0 0 20px rgba(16,201,139,.8)}
.stint.hot .stint__bar i{background:linear-gradient(rgba(255,255,255,.3),rgba(255,255,255,0) 46%),linear-gradient(90deg,var(--em),var(--mint))}
.stint.hot .stint__span{color:#fff}
.stint.hot .flag{transform:scale(1.25)}
.stint.hot p span{transform:translateX(.4em)}
/* a real crest (shared emblem()) keeps its own colours and has nothing behind it, whatever the state of the row */
.stint .stint__ic:has(.crest){width:78px;height:86px;padding:0;border:0;border-radius:0;background:none;box-shadow:none}

/* PINNED (the same query as PIN in career.js): the card stays in the window, 72px from its top, with every job in
   sight, while the runway plays the years at 110px each. --rh is the height one job gets. */
@media (min-width:721px) and (min-height:580px){
  .gantt{--stage:calc(100vh - 84px);--rh:calc((var(--stage) - 96px)/var(--rows));--bh:clamp(16px,calc(var(--rh)*.3),28px);height:calc(var(--stage) + var(--n)*110px)}
  .gantt__stage{position:sticky;top:72px;height:var(--stage);display:grid;grid-template-rows:auto minmax(0,1fr)}
  .gantt__axis{position:relative;top:auto;padding-top:12px}
  .gantt__scale{height:58px}
  .gantt__eras{top:10px}
  .gantt__rows{min-height:0;display:grid;grid-template-rows:repeat(var(--rows),minmax(0,1fr))}
  .stint{min-height:0}
  .stint__info{padding:0;gap:0 clamp(10px,1.2vw,18px)}
  .stint__ic{width:clamp(34px,calc(var(--rh)*.66),58px);height:clamp(34px,calc(var(--rh)*.66),58px);border-radius:14px;font-size:clamp(1.1rem,calc(var(--rh)*.3),1.7rem)}
  .stint .stint__ic:has(.crest){width:clamp(38px,calc(var(--rh)*.76),78px);height:clamp(42px,calc(var(--rh)*.84),86px)}
  .stint__txt{gap:clamp(1px,calc(var(--rh)*.04),7px)}
  .stint h3{font-size:clamp(.98rem,calc(var(--rh)*.29),1.5rem);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .stint p{font-size:clamp(.78rem,calc(var(--rh)*.21),1.02rem);line-height:1.22}
  .stint p .flag{font-size:1.1em}
  .stint .now{margin-left:.6em;padding:.2em .55em;font-size:clamp(.5rem,calc(var(--rh)*.13),.6rem);vertical-align:.2em}
  .stint__track{min-height:0}
  .stint__span{font-size:clamp(.66rem,calc(var(--rh)*.16),.8rem)}
  .stint__bar,.stint__live{top:calc(50% + clamp(5px,calc(var(--rh)*.1),8px))}
}

/* narrow screens: a vertical timeline; each job keeps its emblem and carries its own strip of the same axis */
@media (max-width:720px){
  .gantt{--res:24px;--px:10px;--in:4px;--bh:18px}
  .gantt__stage{border-radius:22px}
  .gantt__axis{grid-template-columns:minmax(0,1fr);top:66px;padding-top:14px;border-radius:21px 21px 0 0}
  .gantt__now{padding-bottom:0}
  .gantt__year{font-size:1.6rem}
  .gantt__eras + .gantt__tick b{transform:none}
  .era .flag{font-size:.86rem}
  .stint{scroll-margin-top:150px;min-height:0;grid-template-columns:minmax(0,1fr);padding-bottom:18px}
  .stint__info{align-items:start;padding:14px 0 6px}
  .stint .stint__ic:has(.crest){width:60px;height:66px}
  .stint__track{margin:0 var(--res) 0 0;min-height:60px;border-bottom:1px solid rgba(182,222,200,.28)}
}
