Jacky Zhao
2025-03-09 9c8fec06d2b58e4e3bbe280ddc665a99fcc4878c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@use "../../styles/variables.scss" as *;
 
.toc {
  display: flex;
  flex-direction: column;
 
  overflow-y: hidden;
  flex: 0 1 auto;
  &:has(button.toc-header.collapsed) {
    flex: 0 1 1.2rem;
  }
}
 
@media all and not ($mobile) {
  .toc-header {
    display: flex;
  }
}
 
button.toc-header {
  background-color: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 0;
  color: var(--dark);
  display: flex;
  align-items: center;
 
  & h3 {
    font-size: 1rem;
    display: inline-block;
    margin: 0;
  }
 
  & .fold {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    opacity: 0.8;
  }
 
  &.collapsed .fold {
    transform: rotateZ(-90deg);
  }
}
 
.toc-content {
  list-style: none;
  position: relative;
 
  & ul {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0;
    & > li > a {
      color: var(--dark);
      opacity: 0.35;
      transition:
        0.5s ease opacity,
        0.3s ease color;
      &.in-view {
        opacity: 0.75;
      }
    }
  }
 
  @for $i from 0 through 6 {
    & .depth-#{$i} {
      padding-left: calc(1rem * #{$i});
    }
  }
}