A text-mode web browser with AI help, inspired by Lynx, plus TextFirst.css for text-first websites.

0 downloads

dbbasic-textbrowser/textfirst.css
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-textbrowser.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-textbrowser.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-textbrowser.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add Gateway Architecture documentation 2693936 1 year ago History
textfirst.css · 13.0 KB · 753 lines
1/**
2 * TextFirst.css - A Semantic CSS Framework
3 *
4 * Philosophy: Enhance semantic HTML instead of replacing it.
5 * Works in text browsers AND graphical browsers.
6 * Against the Tri-Hard Pattern.
7 *
8 * Version: 0.1.0
9 * License: MIT
10 * Date: 2025-01-28
11 */
12
13/* ============================================
14 BASE STYLES
15 ============================================ */
16
17* {
18 box-sizing: border-box;
19}
20
21body {
22 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
23 'Helvetica Neue', Arial, sans-serif;
24 line-height: 1.6;
25 color: #1f2937;
26 max-width: 80ch;
27 margin: 0 auto;
28 padding: 2rem 1rem;
29 background-color: #ffffff;
30}
31
32/* ============================================
33 TYPOGRAPHY
34 ============================================ */
35
36h1, h2, h3, h4, h5, h6 {
37 line-height: 1.2;
38 margin-top: 2rem;
39 margin-bottom: 1rem;
40 font-weight: 700;
41}
42
43h1 { font-size: 2.5rem; color: #111827; }
44h2 { font-size: 2rem; color: #1f2937; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.5rem; }
45h3 { font-size: 1.5rem; color: #374151; }
46h4 { font-size: 1.25rem; color: #4b5563; }
47h5 { font-size: 1.125rem; color: #6b7280; }
48h6 { font-size: 1rem; color: #6b7280; }
49
50p {
51 margin: 1rem 0;
52}
53
54hr {
55 border: none;
56 border-top: 2px solid #e5e7eb;
57 margin: 2rem 0;
58}
59
60/* ============================================
61 ENHANCE OLD SEMANTIC TAGS
62 ============================================ */
63
64/* Font colors - enhance <font color> tag */
65font[color="red"] {
66 color: #dc2626;
67 background-color: #fef2f2;
68 padding: 0.125rem 0.375rem;
69 border-radius: 0.25rem;
70 font-weight: 500;
71}
72
73font[color="green"] {
74 color: #16a34a;
75 background-color: #f0fdf4;
76 padding: 0.125rem 0.375rem;
77 border-radius: 0.25rem;
78 font-weight: 500;
79}
80
81font[color="yellow"] {
82 color: #ca8a04;
83 background-color: #fefce8;
84 padding: 0.125rem 0.375rem;
85 border-radius: 0.25rem;
86 font-weight: 500;
87}
88
89font[color="blue"] {
90 color: #2563eb;
91 background-color: #eff6ff;
92 padding: 0.125rem 0.375rem;
93 border-radius: 0.25rem;
94 font-weight: 500;
95}
96
97font[color="cyan"] {
98 color: #0891b2;
99 background-color: #ecfeff;
100 padding: 0.125rem 0.375rem;
101 border-radius: 0.25rem;
102 font-weight: 500;
103}
104
105font[color="magenta"] {
106 color: #c026d3;
107 background-color: #fdf4ff;
108 padding: 0.125rem 0.375rem;
109 border-radius: 0.25rem;
110 font-weight: 500;
111}
112
113font[color="white"] {
114 color: #f9fafb;
115 background-color: #111827;
116 padding: 0.125rem 0.375rem;
117 border-radius: 0.25rem;
118}
119
120/* Center tag - works in text, enhanced in graphical */
121center {
122 text-align: center;
123 display: block;
124 margin: 1rem 0;
125}
126
127/* Menu tag - numbered lists */
128menu {
129 list-style: none;
130 padding: 0;
131 counter-reset: menu-counter;
132 margin: 1rem 0;
133}
134
135menu li {
136 counter-increment: menu-counter;
137 padding: 0.75rem 1rem;
138 margin: 0.5rem 0;
139 border-left: 4px solid #3b82f6;
140 background-color: #f9fafb;
141 border-radius: 0 0.375rem 0.375rem 0;
142 transition: all 0.2s;
143}
144
145menu li:hover {
146 background-color: #eff6ff;
147 border-left-width: 6px;
148}
149
150menu li::before {
151 content: "[" counter(menu-counter) "] ";
152 font-weight: bold;
153 color: #3b82f6;
154 margin-right: 0.75rem;
155 font-family: 'Courier New', monospace;
156}
157
158menu li a {
159 text-decoration: none;
160 color: #1f2937;
161 font-weight: 500;
162}
163
164menu li a:hover {
165 color: #3b82f6;
166}
167
168/* Blockquote - add visual bar */
169blockquote {
170 border-left: 4px solid #3b82f6;
171 padding-left: 1.5rem;
172 margin: 1.5rem 0;
173 color: #4b5563;
174 font-style: italic;
175 background-color: #f9fafb;
176 padding: 1rem 1.5rem;
177 border-radius: 0 0.5rem 0.5rem 0;
178}
179
180blockquote footer {
181 margin-top: 0.5rem;
182 font-size: 0.875rem;
183 color: #6b7280;
184 font-style: normal;
185}
186
187/* ============================================
188 CODE AND PRE
189 ============================================ */
190
191code {
192 background-color: #f3f4f6;
193 padding: 0.125rem 0.375rem;
194 border-radius: 0.25rem;
195 font-family: 'Monaco', 'Courier New', monospace;
196 font-size: 0.875em;
197 color: #dc2626;
198}
199
200pre {
201 background-color: #1f2937;
202 color: #f9fafb;
203 padding: 1.5rem;
204 border-radius: 0.5rem;
205 overflow-x: auto;
206 margin: 1.5rem 0;
207 border: 2px solid #374151;
208}
209
210pre code {
211 background: none;
212 color: inherit;
213 padding: 0;
214 font-size: 0.875rem;
215 line-height: 1.7;
216}
217
218kbd {
219 background-color: #1f2937;
220 color: #f9fafb;
221 padding: 0.125rem 0.5rem;
222 border-radius: 0.25rem;
223 font-family: 'Monaco', 'Courier New', monospace;
224 font-size: 0.875em;
225 border: 1px solid #374151;
226 box-shadow: 0 2px 0 #374151;
227}
228
229samp {
230 background-color: #f3f4f6;
231 padding: 0.5rem 1rem;
232 display: block;
233 margin: 1rem 0;
234 border-left: 3px solid #6b7280;
235 font-family: 'Monaco', 'Courier New', monospace;
236 font-size: 0.875rem;
237}
238
239/* ============================================
240 DETAILS AND SUMMARY
241 ============================================ */
242
243details {
244 border: 2px solid #e5e7eb;
245 border-radius: 0.5rem;
246 padding: 1rem;
247 margin: 1rem 0;
248 background-color: #f9fafb;
249}
250
251details[open] {
252 background-color: #ffffff;
253 border-color: #3b82f6;
254}
255
256summary {
257 cursor: pointer;
258 font-weight: 600;
259 user-select: none;
260 list-style: none;
261 padding: 0.5rem;
262 margin: -0.5rem;
263 border-radius: 0.375rem;
264 transition: background-color 0.2s;
265}
266
267summary::-webkit-details-marker {
268 display: none;
269}
270
271summary::before {
272 content: "[+] ";
273 color: #3b82f6;
274 font-weight: bold;
275 margin-right: 0.5rem;
276 font-family: 'Courier New', monospace;
277}
278
279details[open] summary::before {
280 content: "[-] ";
281 color: #16a34a;
282}
283
284summary:hover {
285 background-color: #eff6ff;
286}
287
288details[open] summary {
289 margin-bottom: 1rem;
290 border-bottom: 2px solid #e5e7eb;
291}
292
293/* ============================================
294 HTML5 SEMANTIC TAGS
295 ============================================ */
296
297article {
298 max-width: 75ch;
299 margin: 2rem auto;
300}
301
302article header {
303 border-bottom: 3px solid #3b82f6;
304 margin-bottom: 2rem;
305 padding-bottom: 1rem;
306}
307
308article header h1 {
309 margin-top: 0;
310}
311
312article footer {
313 border-top: 2px solid #e5e7eb;
314 margin-top: 3rem;
315 padding-top: 1.5rem;
316 color: #6b7280;
317 font-size: 0.875rem;
318}
319
320aside {
321 background-color: #fefce8;
322 border-left: 4px solid #eab308;
323 padding: 1.5rem;
324 margin: 1.5rem 0;
325 border-radius: 0 0.5rem 0.5rem 0;
326}
327
328aside h1, aside h2, aside h3 {
329 margin-top: 0;
330}
331
332section {
333 margin: 3rem 0;
334}
335
336nav ul {
337 list-style: none;
338 padding: 0;
339}
340
341nav ul li {
342 display: inline-block;
343 margin-right: 1.5rem;
344}
345
346nav ul li a {
347 text-decoration: none;
348 color: #3b82f6;
349 font-weight: 500;
350 transition: color 0.2s;
351}
352
353nav ul li a:hover {
354 color: #1e40af;
355 text-decoration: underline;
356}
357
358/* ============================================
359 NEW SEMANTIC TAGS (custom elements)
360 ============================================ */
361
362/* <color name="error|success|warning|info|muted|highlight"> */
363color {
364 padding: 0.125rem 0.375rem;
365 border-radius: 0.25rem;
366 font-weight: 500;
367}
368
369color[name="error"] {
370 color: #dc2626;
371 background-color: #fef2f2;
372}
373
374color[name="success"] {
375 color: #16a34a;
376 background-color: #f0fdf4;
377}
378
379color[name="warning"] {
380 color: #ca8a04;
381 background-color: #fefce8;
382}
383
384color[name="info"] {
385 color: #2563eb;
386 background-color: #eff6ff;
387}
388
389color[name="muted"] {
390 color: #6b7280;
391 background-color: transparent;
392 padding: 0;
393}
394
395color[name="highlight"] {
396 background-color: #fef08a;
397 color: #854d0e;
398 font-weight: 600;
399}
400
401/* <box style="single|double|rounded|bold"> */
402box {
403 display: block;
404 border: 2px solid #3b82f6;
405 padding: 1.5rem;
406 margin: 1.5rem 0;
407 border-radius: 0.5rem;
408 background-color: #ffffff;
409}
410
411box[style="double"] {
412 border-width: 4px;
413 border-color: #1e40af;
414}
415
416box[style="rounded"] {
417 border-radius: 1rem;
418}
419
420box[style="bold"] {
421 border-width: 3px;
422 border-color: #1e40af;
423 box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
424}
425
426box h1, box h2, box h3, box h4, box h5, box h6 {
427 margin-top: 0;
428}
429
430/* <banner type="info|warning|error|success"> */
431banner {
432 display: block;
433 padding: 1rem 1.5rem;
434 margin: 1.5rem 0;
435 border-radius: 0.5rem;
436 border: 2px solid;
437 font-weight: 500;
438}
439
440banner[type="info"] {
441 background-color: #eff6ff;
442 border-color: #3b82f6;
443 color: #1e40af;
444}
445
446banner[type="warning"] {
447 background-color: #fefce8;
448 border-color: #eab308;
449 color: #854d0e;
450}
451
452banner[type="error"] {
453 background-color: #fef2f2;
454 border-color: #ef4444;
455 color: #991b1b;
456}
457
458banner[type="success"] {
459 background-color: #f0fdf4;
460 border-color: #16a34a;
461 color: #166534;
462}
463
464banner::before {
465 font-weight: bold;
466 margin-right: 0.75rem;
467 font-size: 1.25em;
468}
469
470banner[type="info"]::before {
471 content: "ℹ️";
472}
473
474banner[type="warning"]::before {
475 content: "⚠️";
476}
477
478banner[type="error"]::before {
479 content: "❌";
480}
481
482banner[type="success"]::before {
483 content: "✅";
484}
485
486/* <status value="online|offline|degraded|unknown"> */
487status {
488 font-weight: 500;
489}
490
491status::before {
492 content: "● ";
493 font-size: 1.2em;
494 margin-right: 0.5rem;
495}
496
497status[value="online"] {
498 color: #16a34a;
499}
500
501status[value="online"]::before {
502 color: #16a34a;
503}
504
505status[value="offline"] {
506 color: #dc2626;
507}
508
509status[value="offline"]::before {
510 color: #dc2626;
511}
512
513status[value="degraded"] {
514 color: #eab308;
515}
516
517status[value="degraded"]::before {
518 color: #eab308;
519}
520
521status[value="unknown"] {
522 color: #9ca3af;
523}
524
525status[value="unknown"]::before {
526 color: #9ca3af;
527}
528
529/* ============================================
530 TABLES
531 ============================================ */
532
533table {
534 width: 100%;
535 border-collapse: collapse;
536 margin: 1.5rem 0;
537}
538
539th, td {
540 padding: 0.75rem 1rem;
541 text-align: left;
542 border-bottom: 1px solid #e5e7eb;
543}
544
545th {
546 background-color: #f9fafb;
547 font-weight: 600;
548 border-bottom: 2px solid #d1d5db;
549 color: #374151;
550}
551
552tr:hover {
553 background-color: #f9fafb;
554}
555
556table[simple] {
557 border: 2px solid #d1d5db;
558 border-radius: 0.5rem;
559 overflow: hidden;
560}
561
562table[simple] th {
563 background-color: #e5e7eb;
564 border-bottom: 3px solid #d1d5db;
565}
566
567/* ============================================
568 FORMS
569 ============================================ */
570
571label {
572 display: block;
573 font-weight: 600;
574 margin-bottom: 0.5rem;
575 color: #374151;
576}
577
578input, textarea, select {
579 font-family: inherit;
580 font-size: 1rem;
581 padding: 0.625rem 0.875rem;
582 border: 2px solid #d1d5db;
583 border-radius: 0.375rem;
584 width: 100%;
585 max-width: 30rem;
586 transition: all 0.2s;
587}
588
589input:focus, textarea:focus, select:focus {
590 outline: none;
591 border-color: #3b82f6;
592 box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
593}
594
595input[type="checkbox"], input[type="radio"] {
596 width: auto;
597 margin-right: 0.5rem;
598}
599
600button, input[type="submit"], input[type="button"] {
601 background-color: #3b82f6;
602 color: white;
603 border: none;
604 padding: 0.625rem 1.25rem;
605 border-radius: 0.375rem;
606 cursor: pointer;
607 font-weight: 600;
608 width: auto;
609 transition: background-color 0.2s;
610 font-size: 1rem;
611}
612
613button:hover, input[type="submit"]:hover, input[type="button"]:hover {
614 background-color: #2563eb;
615}
616
617button:active, input[type="submit"]:active, input[type="button"]:active {
618 background-color: #1e40af;
619}
620
621fieldset {
622 border: 2px solid #e5e7eb;
623 border-radius: 0.5rem;
624 padding: 1.5rem;
625 margin: 1rem 0;
626}
627
628legend {
629 font-weight: 600;
630 padding: 0 0.5rem;
631 color: #374151;
632}
633
634/* ============================================
635 LISTS
636 ============================================ */
637
638ul, ol {
639 margin: 1rem 0;
640 padding-left: 2rem;
641}
642
643li {
644 margin: 0.5rem 0;
645}
646
647dl {
648 margin: 1rem 0;
649}
650
651dt {
652 font-weight: 600;
653 color: #374151;
654 margin-top: 1rem;
655}
656
657dd {
658 margin-left: 2rem;
659 margin-top: 0.5rem;
660 color: #4b5563;
661}
662
663/* ============================================
664 LINKS
665 ============================================ */
666
667a {
668 color: #3b82f6;
669 text-decoration: underline;
670 transition: color 0.2s;
671}
672
673a:hover {
674 color: #1e40af;
675}
676
677a:visited {
678 color: #7c3aed;
679}
680
681/* ============================================
682 UTILITIES (minimal, semantic only)
683 ============================================ */
684
685.text-center { text-align: center; }
686.text-right { text-align: right; }
687.text-left { text-align: left; }
688
689.mb-0 { margin-bottom: 0; }
690.mb-1 { margin-bottom: 0.5rem; }
691.mb-2 { margin-bottom: 1rem; }
692.mb-4 { margin-bottom: 2rem; }
693
694.mt-0 { margin-top: 0; }
695.mt-1 { margin-top: 0.5rem; }
696.mt-2 { margin-top: 1rem; }
697.mt-4 { margin-top: 2rem; }
698
699.hidden { display: none; }
700.block { display: block; }
701.inline { display: inline; }
702.inline-block { display: inline-block; }
703
704/* ============================================
705 RESPONSIVE
706 ============================================ */
707
708@media (max-width: 768px) {
709 body {
710 padding: 1rem;
711 }
712
713 h1 { font-size: 2rem; }
714 h2 { font-size: 1.75rem; }
715 h3 { font-size: 1.5rem; }
716
717 menu li {
718 padding: 0.5rem 0.75rem;
719 }
720
721 table {
722 font-size: 0.875rem;
723 }
724
725 th, td {
726 padding: 0.5rem;
727 }
728}
729
730/* ============================================
731 PRINT STYLES
732 ============================================ */
733
734@media print {
735 body {
736 max-width: 100%;
737 font-size: 12pt;
738 }
739
740 a {
741 color: #000;
742 text-decoration: underline;
743 }
744
745 a[href]::after {
746 content: " (" attr(href) ")";
747 font-size: 0.875em;
748 }
749
750 banner, box, details, blockquote {
751 page-break-inside: avoid;
752 }
753}