mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 11:41:17 +02:00
🎨 style: optimize heti css styles
This commit is contained in:
parent
85a629b4ee
commit
5408676c64
23 changed files with 63 additions and 130 deletions
|
@ -4,50 +4,28 @@
|
|||
* Author: Sivan [sun.sivan@gmail.com]
|
||||
*/
|
||||
|
||||
/* Global Styles */
|
||||
/* Global Styles */
|
||||
.heti {
|
||||
--at-apply: 'break-words leading-1.55em tracking-0.02em hyphens-auto';
|
||||
--at-apply: 'break-words leading-1.5em tracking-0.02em hyphens-auto';
|
||||
}
|
||||
.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(ko)) {
|
||||
--at-apply: 'leading-1.5em tracking-0';
|
||||
--at-apply: 'tracking-0';
|
||||
}
|
||||
|
||||
/* Article Title */
|
||||
.heti .post-title {
|
||||
--at-apply: 'mb-2 text-9 leading-12 font-bold text-balance c-primary';
|
||||
--at-apply: 'mb-2 text-8.6 leading-12 font-bold c-primary lg:text-9';
|
||||
}
|
||||
|
||||
/* Links */
|
||||
.heti :where(a) {
|
||||
--at-apply: 'break-all font-medium tracking-0 underline decoration-secondary/40 underline-0.075em underline-offset-0.2em';
|
||||
--at-apply: 'break-all font-medium tracking-0 underline decoration-secondary/40 underline-0.075em underline-offset-0.14em';
|
||||
--at-apply: 'transition-colors hover:(c-primary decoration-secondary/80) lg:underline-0.1em';
|
||||
}
|
||||
|
||||
/* Images */
|
||||
.heti :where(img) {
|
||||
--at-apply: 'mx-auto my-5 cursor-zoom-in force-gpu';
|
||||
}
|
||||
.heti :where(figure) {
|
||||
--at-apply: 'mx-auto my-5';
|
||||
}
|
||||
.heti figure > :where(img) {
|
||||
--at-apply: 'my-0';
|
||||
}
|
||||
.heti figure > :where(figcaption) {
|
||||
--at-apply: 'text-center text-sm mt-3 text-secondary/80';
|
||||
}
|
||||
.heti :where(h1 + p > img:first-child),
|
||||
.heti :where(h2 + p > img:first-child),
|
||||
.heti :where(h3 + p > img:first-child),
|
||||
.heti :where(h4 + p > img:first-child),
|
||||
.heti :where(h5 + p > img:first-child),
|
||||
.heti :where(h6 + p > img:first-child) {
|
||||
--at-apply: 'mt-4';
|
||||
}
|
||||
|
||||
/* Paragraphs */
|
||||
.heti :where(p) {
|
||||
--at-apply: 'mb-4 text-justify';
|
||||
--at-apply: 'mt-3 mb-6 text-justify text-pretty';
|
||||
}
|
||||
.heti :where(p:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))) {
|
||||
--at-apply: 'text-start';
|
||||
|
@ -60,7 +38,7 @@
|
|||
.heti :where(h4),
|
||||
.heti :where(h5),
|
||||
.heti :where(h6) {
|
||||
--at-apply: 'mt-6 mb-4 font-bold';
|
||||
--at-apply: 'mt-6 mb-3 font-semibold';
|
||||
}
|
||||
.heti :where(h1) {
|
||||
--at-apply: 'text-8 leading-12';
|
||||
|
@ -80,6 +58,16 @@
|
|||
.heti :where(h6) {
|
||||
--at-apply: 'text-3.5 leading-6';
|
||||
}
|
||||
.heti :where(h1),
|
||||
.heti :where(h2),
|
||||
.heti :where(h3) {
|
||||
--at-apply: 'text-pretty tracking-0.05em';
|
||||
}
|
||||
.heti :where(h1:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))),
|
||||
.heti :where(h2:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))),
|
||||
.heti :where(h3:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))) {
|
||||
--at-apply: 'text-balance tracking-0';
|
||||
}
|
||||
.heti :where(h1 + h2),
|
||||
.heti :where(h2 + h3),
|
||||
.heti :where(h3 + h4),
|
||||
|
@ -87,36 +75,24 @@
|
|||
.heti :where(h5 + h6) {
|
||||
--at-apply: 'mt-3';
|
||||
}
|
||||
.heti :where(h1:has(+ h2)),
|
||||
.heti :where(h2:has(+ h3)),
|
||||
.heti :where(h3:has(+ h4)),
|
||||
.heti :where(h4:has(+ h5)),
|
||||
.heti :where(h5:has(+ h6)),
|
||||
.heti :where(h1:has(+ p)),
|
||||
.heti :where(h2:has(+ p)),
|
||||
.heti :where(h3:has(+ p)),
|
||||
.heti :where(h4:has(+ p)),
|
||||
.heti :where(h5:has(+ p)),
|
||||
.heti :where(h6:has(+ p)) {
|
||||
--at-apply: 'mb-3';
|
||||
|
||||
/* Images */
|
||||
.heti :where(img) {
|
||||
--at-apply: 'mx-auto cursor-zoom-in force-gpu';
|
||||
}
|
||||
.heti :where(h1),
|
||||
.heti :where(h2),
|
||||
.heti :where(h3) {
|
||||
--at-apply: 'tracking-0.05em';
|
||||
.heti :where(figure) {
|
||||
--at-apply: 'mx-auto mt-3 mb-6';
|
||||
}
|
||||
.heti :where(h1:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))),
|
||||
.heti :where(h2:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))),
|
||||
.heti :where(h3:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))) {
|
||||
--at-apply: 'tracking-0';
|
||||
.heti figure > :where(figcaption) {
|
||||
--at-apply: 'text-center text-sm mt-3 text-secondary/80';
|
||||
}
|
||||
|
||||
/* Code Blocks */
|
||||
.heti :where(pre) {
|
||||
--at-apply: 'overflow-auto mb-4 p-4 rounded bg-secondary/5! border border-solid border-secondary/5';
|
||||
--at-apply: 'overflow-auto mt-3 mb-6 px-4 py-3 rounded bg-secondary/5! border border-solid border-secondary/5';
|
||||
}
|
||||
.heti pre :where(code) {
|
||||
--at-apply: 'p-0 border-none bg-transparent tracking-0 whitespace-pre';
|
||||
--at-apply: 'p-0 border-none bg-transparent whitespace-pre';
|
||||
}
|
||||
html.dark .heti pre :where(span) {
|
||||
--at-apply: 'text-[var(--shiki-dark)]!';
|
||||
|
@ -131,7 +107,7 @@ html.dark .heti pre :where(span) {
|
|||
--at-apply: 'relative pl-8';
|
||||
}
|
||||
.heti :where(code) span.line::before {
|
||||
--at-apply: 'absolute left-0 w-4 leading-1.95em text-secondary/40 align-bottom';
|
||||
--at-apply: 'absolute left-0 w-4 leading-1.9em text-secondary/40';
|
||||
content: counter(line);
|
||||
counter-increment: line;
|
||||
direction: rtl;
|
||||
|
@ -139,12 +115,12 @@ html.dark .heti pre :where(span) {
|
|||
|
||||
/* Blockquotes */
|
||||
.heti :where(blockquote) {
|
||||
--at-apply: 'px-1em c-secondary/80 border-l-0.25em border-solid border-secondary/25';
|
||||
--at-apply: 'mt-3 mb-6 px-4 c-secondary/80 border-l-4 border-solid border-secondary/25';
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
.heti :where(table) {
|
||||
--at-apply: 'block box-border table-fixed max-w-full mb-4 overflow-x-auto scrollbar-hidden';
|
||||
--at-apply: 'mt-3 mb-6 block box-border table-fixed max-w-full overflow-x-auto scrollbar-hidden';
|
||||
}
|
||||
.heti :where(table)::-webkit-scrollbar {
|
||||
--at-apply: 'hidden';
|
||||
|
@ -153,20 +129,20 @@ html.dark .heti pre :where(span) {
|
|||
.heti :where(td) {
|
||||
--at-apply: 'px-3 py-1.5 border border-solid border-secondary/40';
|
||||
}
|
||||
.heti :where(tbody tr:nth-child(even)) {
|
||||
.heti :where(th) {
|
||||
--at-apply: 'bg-secondary/5';
|
||||
}
|
||||
|
||||
/* Lists */
|
||||
.heti :where(ul),
|
||||
.heti :where(ol) {
|
||||
--at-apply: 'mb-4 pl-2em';
|
||||
--at-apply: 'mt-3 mb-6 pl-2em';
|
||||
}
|
||||
.heti ul :where(ul),
|
||||
.heti ul :where(ol),
|
||||
.heti ol :where(ul),
|
||||
.heti ol :where(ol) {
|
||||
--at-apply: 'mb-0.25em';
|
||||
--at-apply: 'mt-0 mb-0.25em';
|
||||
}
|
||||
.heti :where(ul) {
|
||||
--at-apply: 'list-disc';
|
||||
|
@ -199,22 +175,10 @@ html.dark .heti pre :where(span) {
|
|||
.heti :where(sup) {
|
||||
--at-apply: 'top--0.5em';
|
||||
}
|
||||
.heti sub :where(a),
|
||||
.heti sup :where(a) {
|
||||
--at-apply: 'no-underline';
|
||||
}
|
||||
.heti sup:target,
|
||||
.heti sup a:target {
|
||||
--at-apply: 'bg-#ff0';
|
||||
}
|
||||
html.dark .heti sup:target,
|
||||
html.dark .heti sup a:target {
|
||||
--at-apply: 'bg-#4d4a00e0';
|
||||
}
|
||||
|
||||
/* Abbreviations */
|
||||
.heti :where(abbr[title]) {
|
||||
--at-apply: 'pb-0.06em border-b-1 border-dotted border-secondary no-underline cursor-help';
|
||||
--at-apply: 'pb-0.25 border-b-1 border-dotted border-secondary no-underline cursor-help';
|
||||
}
|
||||
|
||||
/* Wavy Underline */
|
||||
|
@ -233,40 +197,24 @@ html.dark .heti :where(u) {
|
|||
|
||||
/* Highlighted Text */
|
||||
.heti :where(mark) {
|
||||
--at-apply: 'py-0.06em text-inherit bg-#ff0';
|
||||
--at-apply: 'py-0.25 text-inherit bg-#fff700e0';
|
||||
}
|
||||
html.dark .heti :where(mark) {
|
||||
--at-apply: 'bg-#4d4a00e0';
|
||||
}
|
||||
|
||||
/* Footnotes */
|
||||
.footnotes > h2,
|
||||
.footnotes > h3 {
|
||||
--at-apply: 'hidden';
|
||||
.heti sub :where(a),
|
||||
.heti sup :where(a) {
|
||||
--at-apply: 'no-underline';
|
||||
}
|
||||
.footnotes:lang(zh-CN)::before {
|
||||
content: "脚注";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold tracking-0.05em';
|
||||
.heti sup:target,
|
||||
.heti sup a:target {
|
||||
--at-apply: 'bg-#ff0';
|
||||
}
|
||||
.footnotes:lang(zh-TW)::before {
|
||||
content: "腳註";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold tracking-0.05em';
|
||||
}
|
||||
.footnotes:lang(ja)::before {
|
||||
content: "脚注";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold tracking-0.05em';
|
||||
}
|
||||
.footnotes:lang(en)::before {
|
||||
content: "Footnotes";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold';
|
||||
}
|
||||
.footnotes:lang(es)::before {
|
||||
content: "Notas al pie";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold';
|
||||
}
|
||||
.footnotes:lang(ru)::before {
|
||||
content: "Сноски";
|
||||
--at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold';
|
||||
html.dark .heti sup:target,
|
||||
html.dark .heti sup a:target {
|
||||
--at-apply: 'bg-#4d4a00e0';
|
||||
}
|
||||
.heti :where(.data-footnote-backref) {
|
||||
--at-apply: 'no-underline';
|
||||
|
@ -275,7 +223,7 @@ html.dark .heti :where(mark) {
|
|||
/* Bold */
|
||||
.heti :where(b),
|
||||
.heti :where(strong) {
|
||||
--at-apply: 'font-bold';
|
||||
--at-apply: 'font-semibold';
|
||||
}
|
||||
|
||||
/* Italic */
|
||||
|
@ -294,7 +242,7 @@ html.dark .heti :where(mark) {
|
|||
|
||||
/* Horizontal Rules */
|
||||
.heti :where(hr) {
|
||||
--at-apply: 'my-6 border-t-2 border-secondary/25';
|
||||
--at-apply: 'mt-6 mb-3 border-t-2 border-secondary/25';
|
||||
}
|
||||
|
||||
/* KaTeX Mathematical */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue