/* Build timeline (block "case_timeline", src/components/boons/CaseTimeline.astro): a dark board like the approach page's
   journey map, with lanes of striped pills placed by day. When it comes into view an orange line runs from day 1 to the
   last day and every pill fills in as the line passes it (assets/build-timeline/timeline.js). On a phone the board becomes
   a list (name left, bar right) so all days fit without scrolling sideways. Tokens only. */
@property --tl-so{syntax:"<length>";inherits:false;initial-value:0px;}
@keyframes tl-stripes{to{--tl-so:0.7563rem;}}
@keyframes tl-fill{from{clip-path:inset(0 100% 0 0);}to{clip-path:inset(0 0 0 0);}}
@keyframes tl-fade{from{opacity:0;}to{opacity:1;}}
@keyframes tl-sweep{0%{left:0;opacity:1;}96%{opacity:1;}100%{left:100%;opacity:0;}}

.editorial .tl{--T:3.6s;--lab:10.5rem;--row:1.5rem;box-sizing:border-box;padding:1.5rem 2rem 1.75rem;border-radius:var(--radius-media);background:var(--night);color:var(--white);}
.editorial .tl-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-bottom:0.75rem;}
.editorial .tl-eyebrow{font-size:var(--text-sm);line-height:1.3;text-transform:uppercase;color:var(--on-dark-soft);}
.editorial .tl-count{font-size:var(--text-sm);line-height:1;color:var(--on-dark-soft);white-space:nowrap;}
.editorial .tl-count b{display:inline-block;min-width:2ch;font-family:var(--serif);font-weight:400;font-size:2.5rem;line-height:1;letter-spacing:var(--sf-ls);text-align:right;color:var(--white);font-variant-numeric:tabular-nums;}

.editorial .tl-scroll{overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;}
.editorial .tl-board{position:relative;min-width:60rem;}
.editorial .tl-weeks,.editorial .tl-lane{display:grid;grid-template-columns:var(--lab) minmax(0,1fr);}
.editorial .tl-axis{position:relative;height:1.5rem;}
.editorial .tl-wk{position:absolute;left:calc(var(--s) / var(--days) * 100%);top:0;padding-left:0.375rem;font-size:var(--text-xs);line-height:1rem;white-space:nowrap;color:var(--on-dark-soft);}
.editorial .tl-wk i{font-style:normal;}
.editorial .tl-short{display:none;}
.editorial .tl-lane{border-top:1px solid var(--on-dark-line);}
.editorial .tl-lane:last-of-type{border-bottom:1px solid var(--on-dark-line);}
.editorial .tl-label{display:flex;flex-direction:column;gap:0.25rem;padding:0.5rem 1rem 0.5rem 0;}
.editorial .tl-label strong{font-weight:400;font-size:var(--text-sm);line-height:1.2;text-transform:uppercase;color:var(--white);}
.editorial .tl-label span{font-size:var(--text-xs);line-height:1.3;color:var(--on-dark-soft);}
/* a thin line at the start of every week */
.editorial .tl-track,.editorial .tl-bars{--wk:repeating-linear-gradient(90deg,color-mix(in srgb,var(--on-dark-line) 55%,transparent) 0 1px,transparent 1px calc(100% * 7 / var(--days)));}
.editorial .tl-track{box-sizing:border-box;min-height:3.5rem;padding:0.375rem 0;background:var(--wk);}
.editorial .tl-row{height:var(--row);}
.editorial .tl-name{display:none;}
.editorial .tl-bars{position:relative;height:100%;}

.editorial .tl-pill{position:absolute;left:calc(var(--s) / var(--days) * 100%);top:0;width:calc((var(--e) - var(--s)) / var(--days) * 100%);height:calc(var(--row) - 0.375rem);
  box-sizing:border-box;margin:0;padding:0;border:0;background:none;font:inherit;font-size:var(--text-xs);line-height:calc(var(--row) - 0.375rem);text-align:left;color:var(--on-dark-text);cursor:pointer;}
.editorial .tl-pill::before{content:"";position:absolute;inset:0;border-radius:0.25rem;
  background:repeating-linear-gradient(128.5deg,var(--gantt-pill) var(--tl-so) calc(var(--tl-so) + 0.4438rem),var(--gantt-stripe) calc(var(--tl-so) + 0.4438rem) calc(var(--tl-so) + 0.7563rem));animation:tl-stripes .9s linear infinite;}
.editorial .tl-pill > span{position:relative;display:block;padding:0 0.5rem;white-space:nowrap;}
/* a pill long enough for its name grows to fit it, like the journey map's pills */
.editorial .tl-pill--in{min-width:max-content;}
.editorial .tl-pill--right > span,.editorial .tl-pill--left > span{position:absolute;top:0;color:var(--on-dark-soft);}
.editorial .tl-pill--right > span{left:100%;}
.editorial .tl-pill--left > span{right:100%;}
.editorial .tl-pill--none > span{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);}
.editorial .tl-pill.is-active::before{background:repeating-linear-gradient(128.5deg,var(--red) var(--tl-so) calc(var(--tl-so) + 0.4438rem),var(--highlight) calc(var(--tl-so) + 0.4438rem) calc(var(--tl-so) + 0.7563rem));}
.editorial .tl-pill.is-active > span{color:var(--white);}
.editorial .tl-pill:focus-visible{outline:0.125rem solid var(--white);outline-offset:0.125rem;border-radius:0.25rem;}

/* the orange line that runs over the board while it fills */
.editorial .tl-sweep{position:absolute;top:0;bottom:0;left:var(--lab);right:0;pointer-events:none;}
.editorial .tl-sweep i{position:absolute;top:0;bottom:0;left:0;width:1px;background:var(--red);opacity:0;}

/* waiting (motion allowed, not in view yet): the board is empty; playing: everything fills in day order */
:root.anim .editorial .tl:not(.is-playing):not(.is-done) .tl-pill::before{clip-path:inset(0 100% 0 0);}
:root.anim .editorial .tl:not(.is-playing):not(.is-done) .tl-pill > span{opacity:0;}
.editorial .tl.is-playing .tl-pill::before{animation:tl-stripes .9s linear infinite,tl-fill calc((var(--e) - var(--s)) / var(--days) * var(--T)) linear calc(var(--s) / var(--days) * var(--T)) both;}
.editorial .tl.is-playing .tl-pill > span{animation:tl-fade .35s ease-out calc(var(--e) / var(--days) * var(--T)) both;}
.editorial .tl.is-playing .tl-sweep i{animation:tl-sweep var(--T) linear both;}

.editorial .tl-info{box-sizing:border-box;min-height:4.8rem;margin-top:1rem;padding:1rem 1.25rem;border:1px solid var(--on-dark-line);border-radius:0.25rem;background:var(--on-dark-panel);}
.editorial .tl-info p{margin:0;max-width:56rem;font-size:var(--text-base);line-height:1.4;color:var(--white-70);}
.editorial .tl-info strong{font-weight:400;color:var(--white);}
.editorial .tl-info span{margin-right:0.375rem;color:var(--white);}

@media(prefers-reduced-motion:reduce){.editorial .tl-pill::before{animation:none;}}

/* phone: a list that fits the screen. The lane title becomes a small header over its rows; every row shows its name on
   the left and the bar on the right; the axis shows every fourth week. */
@media(max-width:699px){
  .editorial .tl{--lab:8.75rem;--row:1.5rem;padding:1.125rem 1rem 1rem;}
  .editorial .tl-head{margin-bottom:0.5rem;}
  .editorial .tl-count b{font-size:1.75rem;}
  .editorial .tl-scroll{overflow:visible;}
  .editorial .tl-board{min-width:0;}
  .editorial .tl-wk:not(.is-major),.editorial .tl-wk:last-child{display:none;}
  .editorial .tl-wk i:not(.tl-short){display:none;}
  .editorial .tl-wk .tl-short{display:inline;}
  .editorial .tl-lane{grid-template-columns:minmax(0,1fr);}
  .editorial .tl-label{flex-direction:row;align-items:baseline;gap:0.5rem;padding:0.5rem 0 0.25rem;}
  .editorial .tl-label strong{font-size:var(--text-xs);}
  .editorial .tl-track{min-height:0;padding:0 0 0.375rem;background:none;}
  .editorial .tl-row{display:grid;grid-template-columns:var(--lab) minmax(0,1fr);align-items:start;cursor:pointer;}
  .editorial .tl-name{display:block;padding-right:0.5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:calc(var(--row) - 0.375rem);color:var(--on-dark-soft);}
  .editorial .tl-row:has(.is-active) .tl-name{color:var(--white);}
  .editorial .tl-bars{background:var(--wk);}
  .editorial .tl-pill,.editorial .tl-pill--in{min-width:0.375rem;}
  .editorial .tl-pill > span{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);}
  .editorial .tl-info{min-height:6.5rem;margin-top:0.75rem;padding:0.875rem 1rem;}
  .editorial .tl-info p{font-size:var(--text-sm);}
}
