@font-face {
  font-family: "Berkeley Mono";
  src: url("BerkeleyMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --ink: #fff;
  --muted: #bdbdbd;
  --rule: rgb(255 255 255 / 0.1);
  --chip: #161616;
  --up: oklch(0.8 0.13 155);
  --down: oklch(0.69 0.2 33);
  --m: 24px;
  --pad: 16px;
  --line: 15.6px;
  --e: cubic-bezier(0.2, 0, 0, 1);

  @media (width <= 700px) {
    --m: 16px;
    --pad: 12px;
  }
}

html {
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 1680px;
  margin-inline: auto;
  padding: 0 var(--m) calc(var(--line) * 10);
  background: var(--bg);
  color: var(--ink);
  font: 500 13px / var(--line) balto, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
th {
  font: inherit;
  text-align: start;
}

ul,
ol {
  list-style: none;
}

code {
  font: 400 12px / var(--line) "Berkeley Mono", monospace;
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--m);
  color: var(--muted);

  img {
    display: block;
    width: auto;
    height: 20px;
  }
}

page-column {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--m);

  > * {
    grid-column: 1 / -1;

    @media (width > 700px) {
      grid-column: 1 / 7;
    }

    @media (width > 1200px) {
      grid-column: 1 / 5;
    }
  }

  > p,
  > ol {
    color: var(--muted);
    text-wrap: pretty;
  }
}

section:not(#figure) > page-column {
  row-gap: var(--line);
}

ol {
  display: grid;
  gap: var(--line);
  counter-reset: step;

  li {
    position: relative;
    padding-left: 3ch;
    counter-increment: step;

    &::before {
      content: counter(step) ".";
      position: absolute;
      left: 0;
      width: 2ch;
      text-align: end;
    }
  }
}

section {
  margin-top: calc(var(--line) * 6);

  @media (width > 700px) {
    margin-top: calc(var(--line) * 8);
  }

  > * + * {
    margin-top: calc(var(--line) * 2);
  }

  > h3 {
    margin-top: calc(var(--line) * 4);
    color: var(--muted);
  }
}

#figure {
  margin-top: calc(var(--line) * 4);

  > figure-fit {
    margin-top: var(--line);
  }

  > page-column {
    row-gap: var(--line);
    margin-top: calc(var(--line) * 2);
  }

  @media (width > 700px) {
    figure-states,
    [data-says] {
      grid-column: 7 / 13;
    }

    page-column > p:first-child {
      grid-row: 1 / 3;
    }
  }

  @media (width > 1200px) {
    figure-states,
    [data-says] {
      grid-column: 7 / 11;
    }
  }
}

figure-fit {
  display: block;
  container-type: inline-size;
}

tvl-figure {
  display: flex;
  width: max-content;
  font-size: min(calc(100cqi / var(--em, 8.2)), 220px);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

digit-wheel {
  display: block;
  height: 1em;
  overflow: hidden;
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

digit-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;

  &[data-fast] {
    color: var(--muted);
  }
}

figure-states {
  display: flex;
  gap: 4px;

  button {
    padding: 8px 10px;
    border: 0;
    border-radius: 3px;
    background: var(--chip);
    color: var(--muted);
    font: inherit;
    cursor: pointer;

    &:hover,
    &[aria-pressed="true"] {
      color: var(--ink);
    }

    &[aria-pressed="true"]::before {
      content: "";
      display: inline-block;
      width: 6px;
      height: 6px;
      margin-right: 6px;
      border-radius: 50%;
      background: var(--up);
      vertical-align: 1px;
    }

    &[data-state="fell"]::before {
      background: var(--down);
    }
  }
}

data-table {
  display: block;
  margin-inline: calc(var(--pad) * -1);
  padding-block: calc(var(--pad) - 6px);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 6px calc(var(--pad) - 1px);
  vertical-align: top;
  text-wrap: pretty;
}

thead th,
td {
  color: var(--muted);
}

data-table {
  @media (width > 700px) {
    th:nth-child(1),
    th:nth-child(2),
    details td:nth-child(2) {
      width: 25%;
    }

    th:nth-child(3),
    details td:nth-child(3) {
      width: 16.667%;
    }
  }

  td:nth-child(3) {
    color: var(--ink);
  }
}

share-bar {
  display: inline-block;
  width: max(1px, calc(var(--share) * 0.8));
  height: 7px;
  margin-right: 8px;
  background: var(--ink);
}

summary {
  padding: 6px calc(var(--pad) - 1px);
  color: var(--muted);
  cursor: pointer;

  &:hover,
  details[open] > & {
    color: var(--ink);
  }
}

move-lists {
  display: grid;
  gap: 4px;
  margin-inline: calc(var(--pad) * -1);

  @media (width > 700px) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  > div {
    padding: calc(var(--pad) - 1px);
    border: 1px solid var(--rule);
    border-radius: 3px;
  }

  h3::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--up);
    vertical-align: 1px;
  }

  [data-move="down"] h3::before {
    background: var(--down);
  }

  ul {
    margin-top: var(--line);
    color: var(--muted);
  }
}

tvl-chart {
  --gutter: 48px;
  --side: 184px;
  position: relative;
  display: block;
  height: 360px;
  margin-bottom: calc(var(--line) * 4);

  @media (width <= 700px) {
    --side: 124px;
    height: 240px;
  }

  svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  [data-website] {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
  }
}

chart-plot {
  position: absolute;
  inset: 0 var(--side) 0 var(--gutter);
}

chart-lines span {
  position: absolute;
  inset-inline: 0 var(--side);
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}

chart-bands > span {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  white-space: nowrap;
  translate: 0 50%;

  &::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    background: var(--shade);
  }

  &:last-child::before {
    height: 1.5px;
    background: var(--ink);
    vertical-align: 3px;
  }

  span {
    color: var(--muted);

    @media (width <= 700px) {
      display: none;
    }
  }
}

chart-months {
  position: absolute;
  inset: 100% 0 auto;
  height: var(--line);
  margin-top: 6px;
  color: var(--muted);

  span {
    position: absolute;

    @media (width <= 700px) {
      &[data-minor] {
        display: none;
      }
    }
  }
}

@media (width <= 700px) {
  thead {
    display: none;
  }

  tr {
    display: block;
    padding: 6px calc(var(--pad) - 1px);
  }

  th,
  td {
    display: block;
    width: auto;
    padding: 0;
  }

  data-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--m);

    td:nth-child(2) {
      grid-row: 2;
    }

    td:nth-child(4) {
      grid-row: 2;
      text-align: end;
    }
  }

  share-bar {
    display: none;
  }
}
