11/**
2- * Custom CSS for ServiceNow Code Snippets GitHub Pages
3- * Additional styles and overrides
2+ * Improved Custom CSS for ServiceNow Code Snippets GitHub Pages
3+ * Enhancements for performance, maintainability, and accessibility
44 */
55
6- /* Custom scrollbar */
6+ /* === Scrollbar Styling === */
77::-webkit-scrollbar {
88 width : 8px ;
99 height : 8px ;
1616::-webkit-scrollbar-thumb {
1717 background : var (--border-color );
1818 border-radius : 4px ;
19+ transition : background-color 0.3s ease;
1920}
2021
2122::-webkit-scrollbar-thumb : hover {
2223 background : var (--text-muted );
2324}
2425
25- /* Selection styling */
26- ::selection {
27- background : var (--primary-color );
28- color : white;
29- }
30-
26+ /* === Text Selection Styling === */
27+ ::selection ,
3128::-moz-selection {
3229 background : var (--primary-color );
33- color : white ;
30+ color : # fff ;
3431}
3532
36- /* Focus styles for accessibility */
37- * : focus {
33+ /* === Focus Styles for Accessibility === */
34+ * : focus-visible {
3835 outline : 2px solid var (--primary-color );
3936 outline-offset : 2px ;
4037}
4138
39+ /* Skip link for keyboard users */
4240.skip-link {
4341 position : absolute;
4442 top : -40px ;
4543 left : 6px ;
4644 background : var (--primary-color );
47- color : white ;
45+ color : # fff ;
4846 padding : 8px ;
4947 text-decoration : none;
50- transition : top 0.3s ;
48+ transition : top 0.3s ease ;
5149 z-index : 1000 ;
5250}
5351
54- .skip-link : focus {
52+ .skip-link : focus-visible {
5553 top : 6px ;
5654}
5755
58- /* Animation classes */
56+ /* === Animations === */
5957@keyframes fadeIn {
6058 from {
6159 opacity : 0 ;
8684}
8785
8886.fade-in {
89- animation : fadeIn 0.6s ease-out;
87+ animation : fadeIn 0.6s ease-out forwards ;
9088}
9189
9290.slide-in {
93- animation : slideIn 0.5s ease-out;
91+ animation : slideIn 0.5s ease-out forwards ;
9492}
9593
9694.pulse-hover : hover {
9795 animation : pulse 0.3s ease-in-out;
9896}
9997
100- /* Loading states */
98+ /* Loading skeleton shimmer */
10199.loading-skeleton {
102- background : linear-gradient (90deg , var (--bg-secondary ) 25% , var (--border-light ) 50% , var (--bg-secondary ) 75% );
100+ background : linear-gradient (
101+ 90deg ,
102+ var (--bg-secondary ) 25% ,
103+ var (--border-light ) 50% ,
104+ var (--bg-secondary ) 75%
105+ );
103106 background-size : 200% 100% ;
104- animation : loading 1.5s infinite;
107+ animation : loading 1.5s infinite linear ;
105108}
106109
107110@keyframes loading {
113116 }
114117}
115118
116- /* Code syntax highlighting enhancements */
119+ /* === Code Syntax Highlighting Enhancements === */
117120pre [class *= "language-" ] {
118121 position : relative;
122+ padding-top : 1.5rem ; /* add padding to accommodate label */
119123}
120124
121125pre [class *= "language-" ]::before {
@@ -124,11 +128,12 @@ pre[class*="language-"]::before {
124128 top : 0 ;
125129 right : 0 ;
126130 background : var (--primary-color );
127- color : white ;
131+ color : # fff ;
128132 padding : 0.25rem 0.5rem ;
129133 font-size : 0.75rem ;
130134 text-transform : uppercase;
131135 border-bottom-left-radius : 4px ;
136+ user-select : none;
132137}
133138
134139/* Copy code button */
@@ -143,18 +148,22 @@ pre[class*="language-"]::before {
143148 font-size : 0.75rem ;
144149 cursor : pointer;
145150 opacity : 0 ;
146- transition : opacity 0.2s ease;
151+ transition : opacity 0.2s ease, background-color 0.2s ease;
152+ user-select : none;
147153}
148154
149- .code-preview : hover .code-copy-btn {
155+ .code-preview : hover .code-copy-btn ,
156+ .code-copy-btn : focus-visible {
150157 opacity : 1 ;
151158}
152159
153- .code-copy-btn : hover {
160+ .code-copy-btn : hover ,
161+ .code-copy-btn : focus-visible {
154162 background : var (--bg-secondary );
163+ outline : none;
155164}
156165
157- /* Search enhancements */
166+ /* === Search Suggestions === */
158167.search-suggestions {
159168 position : absolute;
160169 top : 100% ;
@@ -177,8 +186,10 @@ pre[class*="language-"]::before {
177186 transition : background-color 0.2s ease;
178187}
179188
180- .search-suggestion : hover {
189+ .search-suggestion : hover ,
190+ .search-suggestion : focus-visible {
181191 background : var (--bg-secondary );
192+ outline : none;
182193}
183194
184195.search-suggestion : last-child {
@@ -195,10 +206,10 @@ pre[class*="language-"]::before {
195206 color : var (--text-secondary );
196207}
197208
198- /* Mobile enhancements */
209+ /* === Responsive and Mobile Enhancements === */
199210@media (max-width : 768px ) {
200211 .mobile-hidden {
201- display : none;
212+ display : none !important ;
202213 }
203214
204215 .mobile-menu-toggle {
@@ -208,6 +219,14 @@ pre[class*="language-"]::before {
208219 font-size : 1.5rem ;
209220 color : var (--text-primary );
210221 cursor : pointer;
222+ padding : 0.5rem ;
223+ transition : color 0.2s ease;
224+ }
225+
226+ .mobile-menu-toggle : hover ,
227+ .mobile-menu-toggle : focus-visible {
228+ color : var (--primary-color );
229+ outline : none;
211230 }
212231
213232 .nav-content {
@@ -229,7 +248,7 @@ pre[class*="language-"]::before {
229248
230249 .mobile-menu .open {
231250 display : block;
232- animation : slideIn 0.3s ease-out;
251+ animation : slideIn 0.3s ease-out forwards ;
233252 }
234253
235254 .mobile-menu-item {
@@ -238,52 +257,51 @@ pre[class*="language-"]::before {
238257 text-decoration : none;
239258 color : var (--text-primary );
240259 display : block;
260+ transition : background-color 0.2s ease;
241261 }
242262
243263 .mobile-menu-item : last-child {
244264 border-bottom : none;
245265 }
246266
247- .mobile-menu-item : hover {
267+ .mobile-menu-item : hover ,
268+ .mobile-menu-item : focus-visible {
248269 background : var (--bg-secondary );
270+ outline : none;
249271 }
250272}
251273
252- /* Print styles */
274+ /* === Print Styles === */
253275@media print {
254276 .header ,
255277 .nav ,
256278 .search-section ,
257279 .footer {
258- display : none;
280+ display : none !important ;
259281 }
260282
261283 .main-content {
262- max-width : none;
263- padding : 0 ;
264- }
265-
266- .category-card {
267- break-inside : avoid;
268- page-break-inside : avoid;
284+ max-width : none !important ;
285+ padding : 0 !important ;
269286 }
270287
288+ .category-card ,
271289 .code-preview {
272290 break-inside : avoid;
273291 page-break-inside : avoid;
274292 }
275293
276294 pre {
277- white-space : pre-wrap;
278- word-wrap : break-word;
295+ white-space : pre-wrap !important ;
296+ word-wrap : break-word !important ;
279297 }
280298}
281299
282- /* High contrast mode support */
300+ /* === High Contrast Mode Support === */
283301@media (prefers-contrast : high) {
284302 : root {
285- --border-color : # 000000 ;
286- --border-light : # 333333 ;
303+ --border-color : # 000 ;
304+ --border-light : # 333 ;
287305 --shadow-sm : 0 2px 4px rgba (0 , 0 , 0 , 0.8 );
288306 --shadow-md : 0 4px 8px rgba (0 , 0 , 0 , 0.8 );
289307 --shadow-lg : 0 8px 16px rgba (0 , 0 , 0 , 0.8 );
@@ -298,7 +316,7 @@ pre[class*="language-"]::before {
298316 }
299317}
300318
301- /* Reduced motion support */
319+ /* === Reduced Motion Support === */
302320@media (prefers-reduced-motion : reduce) {
303321 * ,
304322 * ::before ,
@@ -310,13 +328,13 @@ pre[class*="language-"]::before {
310328 }
311329}
312330
313- /* Utility classes */
331+ /* === Utility Classes === */
314332.text-center { text-align : center; }
315333.text-left { text-align : left; }
316334.text-right { text-align : right; }
317335
318- .hidden { display : none; }
319- .visible { display : block; }
336+ .hidden { display : none !important ; }
337+ .visible { display : block !important ; }
320338
321339.mt-1 { margin-top : 0.25rem ; }
322340.mt-2 { margin-top : 0.5rem ; }
@@ -335,4 +353,4 @@ pre[class*="language-"]::before {
335353
336354.rounded { border-radius : var (--border-radius ); }
337355.shadow { box-shadow : var (--shadow-md ); }
338- .border { border : 1px solid var (--border-color ); }
356+ .border { border : 1px solid var (--border-color ); }
0 commit comments