/* Science A: the method drawn on one canvas held under the scroll */

.method {
  display: grid;
}

.method > * {
  grid-area: 1 / 1;
}

.method__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}

.method__stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.method__steps {
  position: relative;
  z-index: 1;
}

.mstep {
  display: flex;
  align-items: center;
  min-height: 100svh;
  max-width: var(--frame);
  margin: 0 auto;
  padding: 0 var(--gutter);
  pointer-events: none;
}

.mstep--hero {
  padding-top: var(--nav-h);
}

.mstep--last {
  min-height: 130svh;
}

.mstep__body {
  width: var(--col);
  pointer-events: auto;
}

.mstep__body h2 {
  max-width: 16ch;
}

.mstep__body > p {
  max-width: 30ch;
  margin-top: 18px;
  font-size: clamp(1.1875rem, 1.5vw, 1.375rem);
  line-height: 1.4;
  color: var(--ink-2);
}

.mstep--hero h1 {
  max-width: 12ch;
}

.mstep--hero .lede {
  margin: 24px 0 36px;
}

.method__source {
  position: absolute;
  right: var(--gutter);
  bottom: 20px;
  opacity: 0;
}

/* On-graphic annotations: paper knockouts, placed by script beside their marks */
.anno {
  position: absolute;
  left: 0;
  top: 0;
  padding: 12px 14px;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
}

.anno ul {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.anno--anon ul {
  gap: 10px;
}

.anno--anon li {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 14px;
}

.anno--anon i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-lit);
}

.anno--anon span {
  display: flex;
  gap: 6px;
  width: 180px;
  height: 8px;
  border-bottom: 1px solid var(--rule-ink);
}

/* An identity: two bars standing for what would name the person. Script sets --gone 0..1 */
.anno--anon b {
  width: var(--w);
  height: 8px;
  background: var(--ink-3);
  transform-origin: left center;
  transform: scaleX(calc(1 - var(--gone, 0)));
  opacity: calc(1 - var(--gone, 0));
}

.anno--code {
  width: 300px;
}

.anno__by {
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--label-accent);
}

.anno--code ul {
  gap: 12px;
}

.anno--code li p {
  font-size: 0.9375rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-2);
}

.code-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0;
}

.code-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc);
}

/* Library shelf: three categories side by side over hairlines */
.shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 32px;
}

.shelf__col {
  padding-top: 20px;
  border-top: 1px solid var(--rule-ink);
}

.shelf__col h3 {
  margin-bottom: 20px;
}

.shelf ul {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shelf a {
  display: grid;
  gap: 10px;
  text-decoration: none;
}

.shelf__title {
  justify-self: start;
  font-weight: 600;
  font-size: 1.0625rem;
}

.shelf__meta {
  justify-self: start;
  font-size: 0.8125rem;
}

.shelf a:hover .shelf__title {
  text-decoration: underline;
}

@media (max-width: 991px) {
  .mstep {
    align-items: flex-end;
  }

  .mstep__body {
    width: calc(100% + 2 * var(--gutter));
    margin: 0 calc(-1 * var(--gutter));
    padding: 28px var(--gutter) 32px;
    background: linear-gradient(to bottom, transparent, var(--paper) 28px);
  }

  .mstep--hero .mstep__body {
    padding-bottom: 40px;
  }

  .mstep__body > p {
    max-width: 34ch;
    margin-top: 12px;
    font-size: 1.0625rem;
  }

  .mstep--hero .lede {
    margin: 16px 0 24px;
  }

  .method__source {
    left: var(--gutter);
    right: auto;
    top: calc(58svh + 6px);
    bottom: auto;
  }

  .anno {
    padding: 10px 12px;
  }

  .anno--code {
    width: auto;
  }

  .anno--code li p {
    font-size: 0.875rem;
  }

  .shelf {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .shelf ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}
