/* readme.md: the guide. Paper page, one file tree on the left, black figures. */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 40px;
  background: var(--paper);
}

.readme-page {
  background: var(--paper);
  color: var(--ink);
  font: 500 14px/1.6 var(--mono);
}

.readme {
  display: grid;
  grid-template-columns: 250px minmax(0, 760px);
  justify-content: center;
  gap: 104px;
  width: min(1240px, 100% - 96px);
  margin: 0 auto;
  padding: 184px 0 120px;
}

/* ---------------------------------------------------------------------------------------------
   File tree
   --------------------------------------------------------------------------------------------- */

.tree {
  position: sticky;
  top: 48px;
  align-self: start;
  max-height: calc(100svh - 96px);
  overflow-y: auto;
  scrollbar-width: none;
  font-size: 13px;
  line-height: 1.4;
}

.tree::-webkit-scrollbar {
  display: none;
}

.tree-root {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.tree-root i {
  width: 9px;
  height: 9px;
  background: var(--ink);
  transform: rotate(12deg);
}

.tree ol {
  margin: 12px 0 0 4px;
  border-left: 1px solid #080a0440;
}

.tree li {
  position: relative;
}

.tree li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 1px;
  background: #080a0440;
}

.tree li:last-child::after {
  content: "";
  position: absolute;
  top: calc(50% + 1px);
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--paper);
}

.tree a {
  position: relative;
  display: flex;
  gap: 1.2ch;
  padding: 7px 0 7px 22px;
  color: var(--ink-soft);
  transition: color 250ms ease, padding-left 350ms var(--ease);
}

.tree a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 18px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  background: var(--ink);
  transform: scale(0);
  transition: transform 350ms var(--ease);
}

.tree a span {
  color: #80846f;
}

.tree a:hover,
.tree a.is-active {
  padding-left: 36px;
  color: var(--ink);
}

.tree a:hover::before,
.tree a.is-active::before {
  transform: scale(1);
}

/* ---------------------------------------------------------------------------------------------
   Text
   --------------------------------------------------------------------------------------------- */

.doc {
  min-width: 0;
  font-size: 18px;
  line-height: 1.7;
}

.hash {
  color: #9a9d8c;
}

.doc h1 {
  font: 500 44px/1.15 var(--mono);
  letter-spacing: -0.04em;
}

.doc-lede {
  max-width: 32ch;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.doc section {
  padding-top: 104px;
}

.doc h2 {
  font: 500 30px/1.2 var(--mono);
  letter-spacing: -0.04em;
}

.doc h2 + p,
.doc h2 + .big {
  margin-top: 22px;
}

.doc p + p {
  margin-top: 16px;
}

.doc p {
  color: #1c1f16;
}

.big {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 20px;
}

.big b {
  padding: 0 14px;
  background: var(--lime);
  font: 500 58px/1.22 var(--mono);
  letter-spacing: -0.05em;
}

.big span {
  color: var(--ink-soft);
  font-size: 16px;
}

.note {
  margin-top: 22px;
  padding: 16px 20px;
  border-left: 3px solid var(--ink);
  background: #080a040d;
  font-size: 16px;
  line-height: 1.6;
}

.doc ul.plain-list {
  margin-top: 22px;
  border-top: 1px solid #080a0426;
}

.doc ul.plain-list li {
  position: relative;
  padding: 16px 0 16px 30px;
  border-bottom: 1px solid #080a0426;
}

.doc ul.plain-list li::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--lime);
  outline: 1px solid #080a0440;
  transform: rotate(12deg);
}

/* ---------------------------------------------------------------------------------------------
   Figures
   --------------------------------------------------------------------------------------------- */

.fig {
  margin: 30px 0 0;
  background: #050505;
}

.fig-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3c35 transparent;
}

.fig svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.fig figcaption {
  padding: 12px 20px 14px;
  border-top: 1px solid #deded61c;
  color: #a4a69e;
  font-size: 13px;
  line-height: 1.5;
}

.fig text {
  fill: #deded6;
  font: 500 13px var(--mono);
}

.fig .t-dim {
  fill: #8f9186;
}

.fig .t-lime {
  fill: #d2fc52;
}

.fig .t-ink {
  fill: #050505;
}

.fig .t-big {
  font-size: 26px;
  letter-spacing: -0.04em;
}

.fig .t-mid {
  font-size: 16px;
}

.fig .ln {
  fill: none;
  stroke: #deded6;
  stroke-width: 1.5;
}

.fig .ln-dim {
  fill: none;
  stroke: #5d6056;
  stroke-width: 1.5;
}

.fig .ln-lime {
  fill: none;
  stroke: #d2fc52;
  stroke-width: 2;
}

.fig .dash {
  stroke-dasharray: 5 6;
}

.fig .box {
  fill: #0e0f0c;
  stroke: #deded6;
  stroke-width: 1.5;
}

.fig .box-dim {
  fill: #121310;
  stroke: #5d6056;
  stroke-width: 1.5;
}

.fig .lime {
  fill: #d2fc52;
}

/* ---------------------------------------------------------------------------------------------
   A few words, and the end of the file
   --------------------------------------------------------------------------------------------- */

.words {
  margin-top: 26px;
  border-top: 1px solid #080a0426;
  font-size: 16px;
  line-height: 1.6;
}

.words div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid #080a0426;
}

.words dt {
  color: var(--ink);
}

.words dd {
  margin: 0;
  color: var(--ink-soft);
}

.words code {
  font: inherit;
  overflow-wrap: anywhere;
}

.doc-end {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin-top: 72px;
}

.doc-end .cta {
  grid-column: auto;
  --cta-fill: #050505;
  --cta-text: var(--lime);
}

.doc-end .doc-home {
  display: grid;
  place-items: center;
  height: 56px;
  padding: 0 20px;
  background: #0505050f;
  color: var(--ink);
  font-size: 14px;
  transition: background-color 250ms ease;
}

.doc-end .doc-home:hover {
  background: #0505051f;
}

.doc-foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #080a0426;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------------------------
   900px wide and under
   --------------------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .readme {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 56px;
  }
}

@media (max-width: 900px) {
  html {
    scroll-padding-top: 20px;
  }

  .readme {
    display: block;
    width: auto;
    padding: 104px 20px 72px;
  }

  .tree {
    position: static;
    max-height: none;
    margin-bottom: 56px;
    padding: 16px 16px 12px;
    border: 1px solid #080a0433;
  }

  .tree a {
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 14px;
  }

  .doc {
    font-size: 17px;
    line-height: 1.65;
  }

  .doc h1 {
    font-size: 36px;
  }

  .doc-lede {
    font-size: 19px;
  }

  .doc section {
    padding-top: 72px;
  }

  .doc h2 {
    font-size: 25px;
  }

  .big b {
    font-size: 46px;
  }

  .fig {
    margin-left: -20px;
    margin-right: -20px;
  }

  .fig svg {
    width: 680px;
    min-width: 680px;
  }

  .words div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .doc-end .cta {
    display: flex;
  }

  .doc-end .cta .cta-plus-start {
    display: none;
  }

  .doc-end .cta .cta-label {
    padding: 0 12px;
    transform: none;
  }

  .doc-end .cta .cta-plus-end {
    position: static;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .tree a,
  .tree a::before,
  .doc-end .doc-home {
    transition: none;
  }
}
