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

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

/* Article Title */
.heti .post-title {
  --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.14em';
  --at-apply: 'transition-colors hover:(c-primary decoration-secondary/80) lg:underline-0.1em';
}

/* Paragraphs */
.heti :where(p) {
  --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';
}

/* Headings */
.heti :where(h1),
.heti :where(h2),
.heti :where(h3),
.heti :where(h4),
.heti :where(h5),
.heti :where(h6) {
  --at-apply: 'mt-6 mb-3 font-semibold';
}
.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),
.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),
.heti :where(h4 + h5),
.heti :where(h5 + h6) {
  --at-apply: 'mt-3';
}

/* Images */
.heti :where(img) {
  --at-apply: 'mx-auto cursor-zoom-in force-gpu';
}
.heti :where(figure) {
  --at-apply: 'mx-auto mt-3 mb-6';
}
.heti figure > :where(figcaption) {
  --at-apply: 'text-center text-sm mt-3 text-secondary/80';
}

/* Code Blocks */
.heti :where(pre) {
  --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 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.9em text-secondary/40';
  content: counter(line);
  counter-increment: line;
  direction: rtl;
}

/* Blockquotes */
.heti :where(blockquote) {
  --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: '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';
}
.heti :where(th),
.heti :where(td) {
  --at-apply: 'px-3 py-1.5 border border-solid border-secondary/40';
}
.heti :where(th) {
  --at-apply: 'bg-secondary/5';
}

/* Lists */
.heti :where(ul),
.heti :where(ol) {
  --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: 'mt-0 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';
}

/* Abbreviations */
.heti :where(abbr[title]) {
  --at-apply: 'pb-0.25 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.25 text-inherit bg-#fff700e0';
}
html.dark .heti :where(mark) {
  --at-apply: 'bg-#4d4a00e0';
}

/* Footnotes */
.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';
}
.heti :where(.data-footnote-backref) {
  --at-apply: 'no-underline';
}

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

/* 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: 'mt-6 mb-3 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: '';
} */
