File size: 7,080 Bytes
9b7d64e
 
 
 
 
 
9ebbb3c
 
 
 
 
 
 
 
 
 
 
 
9b7d64e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76fc93a
9b7d64e
76fc93a
 
9b7d64e
9ebbb3c
76fc93a
 
 
 
 
 
 
 
9ebbb3c
76fc93a
9ebbb3c
76fc93a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ebbb3c
 
 
 
76fc93a
9ebbb3c
 
 
 
 
 
76fc93a
9ebbb3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76fc93a
9ebbb3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76fc93a
9ebbb3c
76fc93a
9ebbb3c
 
76fc93a
 
9ebbb3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76fc93a
 
 
 
 
 
 
 
 
 
 
9ebbb3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76fc93a
 
9ebbb3c
c68749f
 
 
 
 
 
76fc93a
c68749f
 
 
 
 
 
 
 
 
 
 
 
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
/* ============================================================================ */
/* Table of Contents                                                           */
/* Extracted from TableOfContents.astro scoped styles.                         */
/* Shared between editor and publisher.                                        */
/* ============================================================================ */

/* Loading state */
.table-of-contents.toc-loading,
.toc-mobile-sidebar.toc-loading {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.table-of-contents.toc-loaded,
.toc-mobile-sidebar.toc-loaded {
  opacity: 1;
}

/* Desktop TOC */
.table-of-contents {
  position: sticky;
  top: 32px;
  margin-top: 12px;
}

.table-of-contents nav {
  border-left: 1px solid var(--border-color);
  padding-left: 16px;
  font-size: 13px;
}

.table-of-contents .title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.table-of-contents nav ul {
  margin: 0 0 6px;
  padding-left: 1em;
}

.table-of-contents nav li {
  list-style: none;
  margin: 0.25em 0;
}

.table-of-contents nav a,
.table-of-contents nav a:link,
.table-of-contents nav a:visited {
  color: var(--text-color);
  text-decoration: none;
  border-bottom: none;
  background: none;
  cursor: pointer;
}

.table-of-contents nav > ul > li > a {
  font-weight: 700;
}

.table-of-contents nav a:hover {
  text-decoration: underline solid var(--muted-color);
}

.table-of-contents nav a.active {
  color: var(--primary-color);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
  text-underline-offset: 2px;
}

/* Collapsible sub-sections.
   We wrap every nested <ul> in a <div class="toc-children"> and animate via
   the grid-template-rows 0fr/1fr trick (CSS can't animate height:auto).
   This matches the editor-side React implementation. */
.toc-children {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  overflow: hidden;
  transition: grid-template-rows 200ms ease, opacity 200ms ease;
}
.toc-children > * {
  overflow: hidden;
  min-height: 0;
}
.toc-collapsible li.collapsed > .toc-children {
  grid-template-rows: 0fr;
  opacity: 0;
}

/* Applied on the nav root during init to suppress transitions for the first
   paint, then removed on the next animation frame. Avoids a close-animation
   flash when auto-collapse is enabled. */
.toc-collapsible.toc-no-transition .toc-children,
.toc-collapsible.toc-no-transition .toc-children > * {
  transition: none !important;
}

/* ============================================================================ */
/* Mobile TOC - toggle button                                                   */
/* Hidden on desktop, shown at @media (max-width: 1100px) below.                */
/* ============================================================================ */

.toc-mobile-toggle {
  display: none;
  position: fixed;
  top: var(--spacing-4);
  left: var(--spacing-4);
  z-index: var(--z-overlay);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--page-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: var(--text-color);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.toc-mobile-toggle:active {
  transform: scale(0.92);
}

/* ============================================================================ */
/* Mobile TOC - backdrop                                                        */
/* ============================================================================ */

.toc-mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 1);
  background: rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.toc-mobile-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================================ */
/* Mobile TOC - sidebar panel                                                   */
/* ============================================================================ */

.toc-mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: calc(var(--z-overlay) + 2);
  width: min(320px, 85vw);
  background: var(--page-bg);
  border-right: 1px solid var(--border-color);
  transform: translateX(-100%);
  transition: transform 300ms cubic-bezier(.4,0,.2,1);
  flex-direction: column;
}
.toc-mobile-sidebar.open {
  transform: translateX(0);
}

.toc-mobile-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.toc-mobile-sidebar__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-color);
}

.toc-mobile-sidebar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toc-mobile-sidebar__close,
.toc-mobile-sidebar__theme {
  background: none;
  border: none;
  color: var(--muted-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease, background 150ms ease;
}
.toc-mobile-sidebar__close:hover,
.toc-mobile-sidebar__theme:hover {
  color: var(--text-color);
  background: var(--surface-bg);
}

/* Theme icon visibility in sidebar */
.toc-mobile-sidebar__theme .icon.dark {
  display: none;
}
[data-theme="dark"] .toc-mobile-sidebar__theme .icon.light {
  display: none;
}
[data-theme="dark"] .toc-mobile-sidebar__theme .icon.dark {
  display: inline;
}

.toc-mobile-sidebar__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* TOC styles inside mobile sidebar */
.toc-mobile-sidebar nav ul {
  margin: 0 0 6px;
  padding-left: 1em;
}
.toc-mobile-sidebar nav li {
  list-style: none;
  margin: 0.35em 0;
}
.toc-mobile-sidebar nav a,
.toc-mobile-sidebar nav a:link,
.toc-mobile-sidebar nav a:visited {
  color: var(--text-color);
  text-decoration: none;
  border-bottom: none;
  font-size: 14px;
  line-height: 1.5;
}
.toc-mobile-sidebar nav > ul > li > a {
  font-weight: 700;
}
.toc-mobile-sidebar nav a:hover {
  text-decoration: underline solid var(--muted-color);
}
.toc-mobile-sidebar nav a.active {
  color: var(--primary-color);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
  text-underline-offset: 2px;
}

/* ============================================================================ */
/* Responsive: show mobile TOC elements on small viewports                      */
/* Must be AFTER default display:none rules to win in the cascade               */
/* ============================================================================ */

@media (max-width: 1100px) {
  .toc-mobile-toggle {
    display: flex;
  }

  .toc-mobile-backdrop {
    display: block;
  }

  .toc-mobile-sidebar {
    display: flex;
  }
}