section[data-history-timeline] {
  position: relative;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, var(--bg-raised));
  border-bottom: 0.5px solid var(--border);

  > div {
    display: grid;
    gap: 12px;
    padding-block: 16px;
    overflow: visible;
  }

  [data-history-timeline-controls] {
    display: grid;
    grid-template-columns: 90px minmax(626px, 1fr) auto;
    gap: 16px;
    align-items: center;
  }

  [data-history-timeline-year] {
    width: 90px;
  }

  [data-history-timeline-capture] {
    width: max-content;
    min-width: 188px;

    > div[role="listbox"] {
      right: 0;
      left: auto;
      width: max-content;
      min-width: 100%;
      max-width: min(260px, calc(100vw - 48px));
    }
  }

  [data-history-timeline-months] {
    min-width: 626px;
  }

  [data-history-timeline-days-wrap] {
    position: relative;
    overflow: hidden;

    &::before,
    &::after {
      position: absolute;
      top: 0;
      bottom: 0;
      z-index: 1;
      width: 34px;
      content: "";
      opacity: 0;
      pointer-events: none;
      transition: opacity 120ms ease;
    }

    &::before {
      left: 0;
      background: linear-gradient(90deg, var(--bg), transparent);
    }

    &::after {
      right: 0;
      background: linear-gradient(270deg, var(--bg), transparent);
    }

    &.can-scroll-left::before,
    &.can-scroll-right::after {
      opacity: 1;
    }
  }

  [data-history-timeline-days] {
    display: flex;
    gap: 10px;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    scroll-snap-type: x proximity;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  a[data-history-timeline-day] {
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 3px;
    min-width: 66px;
    padding: 8px 10px 10px;
    color: var(--ink);
    background: var(--bg-raised);
    border: 0.5px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    scroll-snap-align: center;
    text-align: center;
    text-decoration: none;

    &[hidden] {
      display: none;
    }

    &:hover {
      color: var(--clay-deep);
      border-color: var(--border-strong);
      text-decoration: none;
    }

    &[aria-current="page"] {
      min-width: 78px;
      color: var(--clay-deep);
      background: color-mix(in srgb, var(--clay) 6%, transparent);
      border: 0.5px solid var(--clay);

      &::after {
        position: absolute;
        bottom: 4px;
        left: 50%;
        width: 5px;
        height: 5px;
        background: var(--clay);
        border-radius: 999px;
        content: "";
        transform: translateX(-50%);
      }

      > span:first-child,
      > span:last-child {
        color: var(--clay-deep);
      }
    }

    > span:first-child {
      color: var(--ink-muted);
      font-size: 13px;
      font-weight: 500;
    }

    > span:nth-child(2) {
      color: inherit;
      font-size: 22px;
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      line-height: 1.05;
    }

    > span:last-child {
      color: var(--ink-muted);
      font-size: 13px;
      font-variant-numeric: tabular-nums;
    }
  }

  @media (max-width: 820px) {
    > div {
      padding-block: 16px;
    }

    [data-history-timeline-controls] {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      overflow-y: hidden;
      overscroll-behavior-y: none;
      scrollbar-width: none;

      &::-webkit-scrollbar {
        display: none;
      }
    }

    [data-history-timeline-months] {
      grid-template-columns: repeat(12, 44px);
      min-width: auto;
    }

    [data-history-timeline-capture] {
      width: 220px;
    }
  }
}
