/*!
 * Project: Heti
 * URL: https://github.com/sivan/heti
 * Author: Sivan [sun.sivan@gmail.com]
 */

 /* Global Styles */
.heti {
  --at-apply: 'break-words leading-1.55em tracking-0.02em hyphens-auto';
}
.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(ko)) {
  --at-apply: 'leading-1.5em tracking-0';
}

/* Article Title */
.heti .post-title {
  --at-apply: 'mb-2 text-9 leading-12 font-bold text-balance c-primary';
}

/* 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: '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';
}
.heti :where(p:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))) {
  --at-apply: 'text-start';
}

/* Headings */
.heti :where(h1),
.heti :where(h2),
.heti :where(h3),
.heti :where(h4),
.heti :where(h5),
.heti :where(h6) {
  --at-apply: 'mt-6 mb-4 font-bold';
}
.heti :where(h1) {
  --at-apply: 'text-8 leading-12';
}
.heti :where(h2) {
  --at-apply: 'text-6 leading-9';
}
.heti :where(h3) {
  --at-apply: 'text-5 leading-9';
}
.heti :where(h4) {
  --at-apply: 'text-4.5 leading-6';
}
.heti :where(h5) {
  --at-apply: 'text-4 leading-6';
}
.heti :where(h6) {
  --at-apply: 'text-3.5 leading-6';
}
.heti :where(h1 + h2),
.heti :where(h2 + h3),
.heti :where(h3 + h4),
.heti :where(h4 + h5),
.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';
}
.heti :where(h1),
.heti :where(h2),
.heti :where(h3) {
  --at-apply: '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: 'tracking-0';
}

/* Code Blocks */
.heti :where(pre) {
  --at-apply: 'overflow-auto mb-4 p-4 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';
}
html.dark .heti pre :where(span) {
  --at-apply: 'text-[var(--shiki-dark)]!';
}

/* Inline Code */
.heti :where(code) {
  --at-apply: 'px-0.4em py-0.2em text-0.85em tracking-0 whitespace-pre-wrap rounded bg-secondary/5 border border-solid border-secondary/5';
  counter-reset: line;
}
.heti :where(code) span.line {
  --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';
  content: counter(line);
  counter-increment: line;
  direction: rtl;
}

/* Blockquotes */
.heti :where(blockquote) {
  --at-apply: 'px-1em c-secondary/80 border-l-0.25em 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';
}
.heti :where(table)::-webkit-scrollbar {
  --at-apply: 'hidden';
}
.heti :where(th),
.heti :where(td) {
  --at-apply: 'px-3 py-1.5 border border-solid border-secondary/40';
}
.heti :where(tbody tr:nth-child(even)) {
  --at-apply: 'bg-secondary/5';
}

/* Lists */
.heti :where(ul),
.heti :where(ol) {
  --at-apply: 'mb-4 pl-2em';
}
.heti ul :where(ul),
.heti ul :where(ol),
.heti ol :where(ul),
.heti ol :where(ol) {
  --at-apply: 'mb-0.25em';
}
.heti :where(ul) {
  --at-apply: 'list-disc';
}
.heti :where(ol) {
  --at-apply: 'list-decimal';
}
.heti ul :where(ul),
.heti ol :where(ul) {
  --at-apply: 'list-circle';
}
.heti ul ul :where(ul),
.heti ul ol :where(ul),
.heti ol ul :where(ul),
.heti ol ol :where(ul) {
  --at-apply: 'list-square';
}
.heti :where(li) {
  --at-apply: 'list-unset mt-0.25em';
}

/* Superscript and Subscript >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
.heti :where(sub),
.heti :where(sup) {
  --at-apply: 'relative mx-0.1em text-0.75em leading-1 align-baseline';
}
.heti :where(sub) {
  --at-apply: 'bottom--0.25em';
}
.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';
}

/* Wavy Underline */
.heti :where(u) {
  --at-apply: 'underline underline-offset-0.25em decoration-wavy decoration-red';
}
html.dark .heti :where(u) {
  --at-apply: 'decoration-#A14F50';
}

/* Keyboard Input */
.heti :where(kbd) {
  --at-apply: 'inline-block px-0.4em py-0.3em text-0.85em font-bold leading-none tracking-0 whitespace-nowrap';
  --at-apply: 'rounded border border-solid border-secondary/40 text-secondary';
}

/* Highlighted Text */
.heti :where(mark) {
  --at-apply: 'py-0.06em text-inherit bg-#ff0';
}
html.dark .heti :where(mark) {
  --at-apply: 'bg-#4d4a00e0';
}

/* Footnotes */
.footnotes > h2,
.footnotes > h3 {
  --at-apply: 'hidden';
}
.footnotes:lang(zh-CN)::before {
  content: "脚注";
  --at-apply: 'block mt-7.4 mb-4.2 text-6 font-bold tracking-0.05em';
}
.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';
}
.heti :where(.data-footnote-backref) {
  --at-apply: 'no-underline';
}

/* Bold */
.heti :where(b),
.heti :where(strong) {
  --at-apply: 'font-bold';
}

/* Italic */
.heti :where(em) {
  --at-apply: 'italic';
}

/* Quotes */
.heti :where(q) {
  quotes: "「" "」" "『" "』";
}
.heti :where(q:not(:lang(zh)):not(:lang(ja)):not(:lang(ko))) {
  quotes: initial;
  quotes: auto;
}

/* Horizontal Rules */
.heti :where(hr) {
  --at-apply: 'my-6 border-t-2 border-secondary/25';
}

/* KaTeX Mathematical */
.heti :where(.katex-display) {
  --at-apply: 'block max-w-full overflow-x-auto overflow-y-hidden scrollbar-hidden';
}
.heti :where(.katex-display)::-webkit-scrollbar {
  display: none;
}

/* Markdown Extensions Style >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
/* .heti :where(details) {
  --at-apply: 'my-4 px-4 py-3 border border-solid border-secondary/25 rounded cursor-pointer';
}
.heti details :where(summary) {
  --at-apply: 'cursor-pointer';
}
.heti details[open] :where(summary) {
  --at-apply: 'border-b border-solid border-secondary/25 mb-3 pb-3';
} */

/* .heti details :where(summary) {
  list-style: none;
}
.heti details summary::-webkit-details-marker {
  display: none;
}
.heti details summary::marker {
  content: '';
} */
