diff options
| author | aman333nolawz <amananudhiu@gmail.com> | 2026-03-02 21:49:13 +0530 |
|---|---|---|
| committer | aman333nolawz <amananudhiu@gmail.com> | 2026-03-02 21:49:13 +0530 |
| commit | d41eff9eccf66644c4c60f53cb516bf079937a28 (patch) | |
| tree | 248a0863a3181369f943d678ec4273911d35efac /src/styles | |
Using astro-erudite for static site generation
Diffstat (limited to 'src/styles')
| -rw-r--r-- | src/styles/global.css | 77 | ||||
| -rw-r--r-- | src/styles/typography.css | 162 |
2 files changed, 239 insertions, 0 deletions
diff --git a/src/styles/global.css b/src/styles/global.css new file mode 100644 index 0000000..719f8dc --- /dev/null +++ b/src/styles/global.css @@ -0,0 +1,77 @@ +@import 'tailwindcss'; + +@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *)); + +@theme inline { + --font-sans: + Geist, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; + --font-mono: + Geist Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, + 'Liberation Mono', 'Courier New', monospace; + + --color-background: var(--background); + --color-foreground: var(--foreground); + + --color-primary: var(--primary); + --color-primary-foreground: var(--primary-foreground); + + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + + --color-destructive: var(--destructive); + --color-destructive-foreground: var(--destructive-foreground); + + --color-border: var(--border); + --color-ring: var(--ring); +} + +@font-face { + font-family: 'Geist'; + src: url('/fonts/GeistVF.woff2') format('woff2-variations'); + font-weight: 100 900; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Geist Mono'; + src: url('/fonts/GeistMonoVF.woff2') format('woff2-variations'); + font-weight: 100 900; + font-style: normal; + font-display: swap; +} + +:root { + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); + --primary: oklch(0.205 0 0); + --primary-foreground: oklch(0.985 0 0); + --muted: oklch(0.97 0 0); + --muted-foreground: oklch(0.556 0 0); + --destructive: oklch(0.577 0.245 27.325); + --border: oklch(0.922 0 0); + --ring: oklch(0.708 0 0); +} + +[data-theme='dark'] { + --background: oklch(0.145 0 0); + --foreground: oklch(0.985 0 0); + --primary: oklch(0.922 0 0); + --primary-foreground: oklch(0.205 0 0); + --muted: oklch(0.269 0 0); + --muted-foreground: oklch(0.708 0 0); + --destructive: oklch(0.704 0.191 22.216); + --border: oklch(1 0 0 / 10%); + --ring: oklch(0.556 0 0); +} + +@layer base { + *, + ::after, + ::before, + ::backdrop, + ::file-selector-button { + @apply border-border outline-ring/50 tracking-tight; + } +} diff --git a/src/styles/typography.css b/src/styles/typography.css new file mode 100644 index 0000000..e8f6e14 --- /dev/null +++ b/src/styles/typography.css @@ -0,0 +1,162 @@ +@reference './global.css'; + +@layer base { + p, + h1, + h2, + h3, + h4, + h5, + h6 { + @apply wrap-break-word; + } + + h1, + h2, + h3, + h4, + h5, + h6 { + @apply text-balance; + } + + p { + @apply text-pretty; + } +} + +@layer components { + .prose { + @apply text-foreground text-base leading-7; + + :where(p):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground/80 my-5; + } + + :where(h1, h2, h3, h4, h5, h6):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground scroll-mt-32 font-medium xl:scroll-mt-20; + } + + :first-child:not(:where(.not-prose, .not-prose *)) { + @apply mt-0; + } + + /* Don't use an <h1> in your posts, one is already generated in blog/[...id].astro */ + :where(h1):not(:where(.not-prose, .not-prose *)) { + @apply mt-8 mb-6 text-4xl; + } + + :where(h2):not(:where(.not-prose, .not-prose *)) { + @apply mt-8 mb-4 text-2xl; + } + + :where(h3):not(:where(.not-prose, .not-prose *)) { + @apply mt-8 mb-4 text-xl; + } + + :where(h4):not(:where(.not-prose, .not-prose *)) { + @apply mt-7 mb-3 text-lg; + } + + :where(h5, h6):not(:where(.not-prose, .not-prose *)) { + @apply mt-5 mb-3; + } + + :where(a):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground decoration-muted-foreground hover:decoration-foreground font-medium break-words underline underline-offset-[3px] transition-colors; + } + + :where(strong):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground font-medium; + } + + :where(ul):not(:where(.not-prose, .not-prose *)) { + @apply marker:text-foreground/30 my-5 ml-6 list-disc [&>li]:mt-2; + } + + :where(ol):not(:where(.not-prose, .not-prose *)) { + @apply marker:text-foreground/30 my-5 ml-6 list-decimal [&>li]:mt-2; + @apply [&[type='A']]:list-[upper-alpha] [&[type='I']]:list-[upper-roman] [&[type='a']]:list-[lower-alpha] [&[type='i']]:list-[lower-roman]; + } + + :where(li):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground/80 pl-2 [&>p]:my-0; + } + + :where(ul ul, ol ol, ul ol, ol ul):not(:where(.not-prose, .not-prose *)) { + @apply marker:text-foreground/30 my-2 ml-6; + } + + :where(code):not(:where(.not-prose, .not-prose *)) { + @apply bg-muted/50 text-foreground relative rounded-sm px-[0.3rem] py-[0.2rem] text-sm font-medium break-words; + } + + :where(.shiki):not(:where(pre *, .not-prose, .not-prose *)) { + @apply bg-muted/50! text-foreground relative rounded-sm px-[0.3rem] py-[0.2rem] text-sm font-medium break-words; + } + + :where(.shiki code):not(:where(.not-prose, .not-prose *)) { + @apply bg-transparent p-0; + } + + :where(.shiki span):not(:where(pre *, .not-prose, .not-prose *)) { + @apply dark:text-(--shiki-dark)!; + } + + :where(blockquote):not(:where(.not-prose, .not-prose *)) { + @apply [&_*]:text-muted-foreground small my-6 border-l-2 pl-6; + } + + :where(hr):not(:where(.not-prose, .not-prose *)) { + @apply my-8 border-t; + } + + :where(table):not(:where(.not-prose, .not-prose *)) { + @apply mx-auto my-6 block max-w-fit overflow-x-auto text-sm; + } + + :where(thead):not(:where(.not-prose, .not-prose *)) { + @apply border-muted-foreground/30 border-b; + } + + :where(th):not(:where(.not-prose, .not-prose *)) { + @apply px-4 py-2 font-medium; + @apply text-left [&[align=center]]:text-center [&[align=right]]:text-right; + } + + :where(tr):not(:where(.not-prose, .not-prose *)) { + @apply border-muted-foreground/30 border-y first:border-t-0 last:border-b-0; + } + + :where(td):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground/80 small px-4 py-2 align-top break-words [&>*]:first:mt-0! [&>*]:last:mb-0!; + @apply text-left [&[align=center]]:text-center [&[align=right]]:text-right; + } + + :where(img, video, figure, .expressive-code):not( + :where(.not-prose, .not-prose *) + ) { + @apply mx-auto my-6; + } + + :where(pre):not(:where(.not-prose, .not-prose *)) { + @apply max-h-[min(68vh,1000px)]! overflow-y-auto [&::-webkit-scrollbar-corner]:hidden; + } + + :where(summary):not(:where(.not-prose, .not-prose *)) { + @apply [&~*]:small [&~*>*]:first:mt-0! [&~*>*]:last:mb-0!; + } + + :where(kbd):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground bg-muted rounded-md border px-2 py-1 text-xs font-medium; + } + + :where(.katex-display):not(:where(.not-prose, .not-prose *)) { + @apply text-foreground/80 my-6 overflow-x-auto overflow-y-hidden py-2 tracking-normal; + } + } +} + +@utility small { + @apply text-sm leading-6 [&_code]:text-xs [&_img,video,figure,details,blockquote,.katex-display,.expressive-code]:my-4! [&_li,ol]:mt-0 [&_p]:my-2! [&_ul]:my-0; +} |
