Skip to content

Commit a38b521

Browse files
authored
fix: don't use transparent sidebars on mobile (#3861)
1 parent 4fd935b commit a38b521

1 file changed

Lines changed: 118 additions & 38 deletions

File tree

docs/src/styles/custom.css

Lines changed: 118 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,23 @@
8484
display: none;
8585
}
8686

87-
/* Light Theme Transparent Backgrounds */
88-
:root[data-theme='light'] .page {
89-
background: transparent !important;
90-
}
87+
/* Light Theme Transparent Backgrounds - Desktop only */
88+
@media (min-width: 769px) {
89+
:root[data-theme='light'] .page {
90+
background: transparent !important;
91+
}
9192

92-
:root[data-theme='light'] .main-frame {
93-
background: transparent !important;
94-
}
93+
:root[data-theme='light'] .main-frame {
94+
background: transparent !important;
95+
}
9596

96-
:root[data-theme='light'] main {
97-
background: transparent !important;
98-
}
97+
:root[data-theme='light'] main {
98+
background: transparent !important;
99+
}
99100

100-
:root[data-theme='light'] .content-panel {
101-
background: transparent !important;
101+
:root[data-theme='light'] .content-panel {
102+
background: transparent !important;
103+
}
102104
}
103105

104106
/* Light Theme Glow Animation */
@@ -120,7 +122,13 @@
120122
/* Light Theme Sidebar */
121123
:root[data-theme='light'] .sidebar {
122124
border-right: 1px solid #d0d7de;
123-
background: transparent !important;
125+
}
126+
127+
/* Light Theme Sidebar - Desktop only transparent */
128+
@media (min-width: 769px) {
129+
:root[data-theme='light'] .sidebar {
130+
background: transparent !important;
131+
}
124132
}
125133

126134
/* Light Theme Hero */
@@ -262,21 +270,23 @@ body:has(.hero)::before {
262270
display: block;
263271
}
264272

265-
/* Dark Theme Transparent Backgrounds */
266-
.page {
267-
background: transparent !important;
268-
}
273+
/* Dark Theme Transparent Backgrounds - Desktop only */
274+
@media (min-width: 769px) {
275+
.page {
276+
background: transparent !important;
277+
}
269278

270-
.main-frame {
271-
background: transparent !important;
272-
}
279+
.main-frame {
280+
background: transparent !important;
281+
}
273282

274-
main {
275-
background: transparent !important;
276-
}
283+
main {
284+
background: transparent !important;
285+
}
277286

278-
.content-panel {
279-
background: transparent !important;
287+
.content-panel {
288+
background: transparent !important;
289+
}
280290
}
281291

282292
/* Dark Theme Glow Animation */
@@ -297,16 +307,22 @@ main {
297307

298308
/* Dark Theme Sidebar */
299309
#starlight__sidebar, .sidebar {
300-
background-color: transparent !important;
301310
border-right: 1px solid rgba(48, 54, 61, 0.25);
302311
}
303312

304-
.sidebar-content {
305-
background: transparent !important;
306-
}
313+
/* Only make sidebar transparent on desktop */
314+
@media (min-width: 769px) {
315+
#starlight__sidebar, .sidebar {
316+
background-color: transparent !important;
317+
}
307318

308-
.sidebar-pane {
309-
background: transparent !important;
319+
.sidebar-content {
320+
background: transparent !important;
321+
}
322+
323+
.sidebar-pane {
324+
background: transparent !important;
325+
}
310326
}
311327

312328
/* Sidebar Navigation Styling */
@@ -679,14 +695,16 @@ a.button:hover {
679695
}
680696

681697
/* Right Sidebar (TOC) */
682-
:root[data-theme='light'] .right-sidebar,
683-
:root[data-theme='light'] .right-sidebar[class*="astro-"] {
684-
border-left-color: rgba(208, 215, 222, 0.4);
685-
}
698+
@media (min-width: 769px) {
699+
:root[data-theme='light'] .right-sidebar,
700+
:root[data-theme='light'] .right-sidebar[class*="astro-"] {
701+
border-left-color: rgba(208, 215, 222, 0.4);
702+
}
686703

687-
.right-sidebar,
688-
.right-sidebar[class*="astro-"] {
689-
border-left: 1px solid rgba(48, 54, 61, 0.25);
704+
.right-sidebar,
705+
.right-sidebar[class*="astro-"] {
706+
border-left: 1px solid rgba(48, 54, 61, 0.25);
707+
}
690708
}
691709

692710
/* Table of Contents */
@@ -945,6 +963,68 @@ html {
945963
color: #f0f6fc;
946964
}
947965

966+
/* Mobile Navigation - Ensure header elements are visible on mobile */
967+
@media (max-width: 769px) {
968+
/* Keep custom header links visible on mobile but make them more compact */
969+
.custom-header-links {
970+
display: flex !important;
971+
gap: 0.5rem !important;
972+
margin-right: 0.5rem !important;
973+
}
974+
975+
.header-link {
976+
padding: 0.25rem 0.5rem !important;
977+
font-size: 0.8125rem !important;
978+
}
979+
980+
/* Ensure theme toggle is visible on mobile */
981+
starlight-theme-select {
982+
display: flex !important;
983+
}
984+
}
985+
986+
/* Extra small mobile - responsive navigation */
987+
@media (max-width: 768px) {
988+
.custom-header-links {
989+
display: none !important;
990+
}
991+
992+
/* Hide title text on mobile to save space - keep only logo icon */
993+
.site-title span {
994+
display: none !important;
995+
}
996+
997+
/* Force theme toggle to stay visible on mobile */
998+
header starlight-theme-select,
999+
.header starlight-theme-select,
1000+
starlight-theme-select {
1001+
display: flex !important;
1002+
visibility: visible !important;
1003+
opacity: 1 !important;
1004+
}
1005+
1006+
/* Override Starlight's hiding of header right side on mobile */
1007+
header .sl-flex,
1008+
header .right-group,
1009+
header [class*="right"],
1010+
.social-icons {
1011+
display: flex !important;
1012+
visibility: visible !important;
1013+
}
1014+
1015+
/* Make theme toggle easier to tap on mobile */
1016+
starlight-theme-select .icon-wrapper {
1017+
width: 2.5rem !important;
1018+
height: 2.5rem !important;
1019+
min-width: 2.5rem !important;
1020+
}
1021+
1022+
/* Ensure proper spacing on mobile header */
1023+
header {
1024+
padding: 0.5rem 1rem !important;
1025+
}
1026+
}
1027+
9481028
/* Hero Section */
9491029
.hero .action.primary {
9501030
background: linear-gradient(180deg, #d896ff 0%, #6639ba 100%);

0 commit comments

Comments
 (0)