/* stack.css — page 4 upper half, sequential title stacking (js/sections/stack.js). */

.stack {
  height: 400vh; /* 300vh of pinned travel */
}

.stack__list {
  --dash-period: 60px; /* keep in sync with PERIOD in stack.js */
  --dash: 28px;
  display: flex;
  flex-direction: column;
  gap: 0.06em;
  max-width: none;
  margin: 0;
  padding-top: clamp(40px, 8vh, 96px);
  padding-right: 0;
  list-style: none;
  font-size: min(7.6vw, 13.5vh, 128px);
}

.stack__item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  will-change: transform;
}

.stack__word {
  flex: none;
  font-size: 1em;
  line-height: 1.16;
}

/* dashed rule that draws out to the right edge of the viewport */
.stack__line {
  position: relative;
  flex: 1;
  height: 4px;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--fg) 0 var(--dash), transparent var(--dash) var(--dash-period));
  clip-path: inset(0 calc((1 - var(--draw, 0)) * 100%) 0 0);
}

/* three coloured dashes sitting exactly on the dash grid */
.stack__hl {
  position: absolute;
  top: 0;
  width: calc(var(--dash-period) * 3);
  height: 100%;
  background:
    linear-gradient(var(--c-m), var(--c-m)) 0 0 / var(--dash) 100% no-repeat,
    linear-gradient(var(--c-y), var(--c-y)) var(--dash-period) 0 / var(--dash) 100% no-repeat,
    linear-gradient(var(--c-c), var(--c-c)) calc(var(--dash-period) * 2) 0 / var(--dash) 100% no-repeat;
}

.stack__item--last .dl-title {
  padding-bottom: 0.28em;
}

.stack__item--last .dl-lines {
  height: 0.2em;
}

.stack__item--last .dl-row {
  height: 0.045em;
}

.stack__item--last .dl-row--a {
  top: 0;
}

.stack__item--last .dl-row--b {
  top: 0.11em;
}

/* without JS the section is just a list of headings */
html:not(.js) .stack {
  height: auto;
}

html:not(.js) .stack .pin__stage {
  position: static;
  height: auto;
}

@media (max-width: 640px) {
  .stack__list {
    --dash-period: 36px;
    --dash: 16px;
    font-size: min(12.5vw, 12vh);
  }

  .stack__line {
    height: 3px;
  }
}
