/* Visually hidden (screen-reader only) utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    html,
    body {
        scroll-behavior: auto;
    }
}

/* Katex styles */
.katex .eqn-num:before {
    content: " ";
}

@media (max-width: 430px) {
    .katex .tag {
        display: none;
    }
}

.katex-display {
    overflow: auto hidden;
}

.katex .vlist-t2 {
    margin-right: 0px;
}

.katex {
    font-size: var(--blog-katex-size);
}

.katex a:hover {
    text-decoration: none;
}

/* Global Caption Styles */
.caption {
    display: block;
    font-size: smaller;
    text-align: center;
    font-style: italic;
    margin: 16px auto;
}

.caption .katex {
    font-size: inherit;
}

.caption {
    color: var(--blog-caption-color);
}

/* Global Subtitle Styles */
.subtitle {
    display: block;
    font-size: smaller;
    text-align: left;
    font-style: italic;
    margin: 16px auto;
}

.subtitle {
    color: var(--blog-subtitle-color);
}

/* Temp Global Blockquote Styles */

/* Theme-aware blockquote colors. These defaults match the light appearance;
   useNotieConfig overrides them per theme appearance (light/dark). */
:root {
    --blog-bq-definition-bg: rgba(174, 247, 126, 0.2);
    --blog-bq-definition-label: #31dd2e;
    --blog-bq-proof-bg: rgba(174, 247, 126, 0.2);
    --blog-bq-proof-label: #31dd2e;
    --blog-bq-equation-bg: rgba(126, 174, 247, 0.2);
    --blog-bq-equation-label: #486bd5;
    --blog-bq-theorem-bg: rgba(126, 174, 247, 0.2);
    --blog-bq-theorem-label: #486bd5;
    --blog-bq-algorithm-bg: rgba(126, 174, 247, 0.2);
    --blog-bq-algorithm-label: #486bd5;
    --blog-bq-problem-bg: rgba(126, 174, 247, 0.2);
    --blog-bq-problem-label: #486bd5;
    --blog-bq-important-bg: rgba(247, 126, 126, 0.2);
    --blog-bq-important-label: #dd2e2e;
    --blog-bq-note-bg: rgb(255 253 0 / 19%);
    --blog-bq-note-label: lch(86 109.24 91.22);
    --blog-bq-shadow: 0 1px 2px rgba(0, 0, 0, 0.12),
        0 3px 10px rgba(0, 0, 0, 0.08);
}

blockquote {
    margin-block-start: 0;
    margin-inline-start: 0;
    display: block;
    border-radius: 5px;
    box-shadow: var(--blog-bq-shadow);
    padding-left: 0.8rem;
    padding-right: 0.8rem;
    padding-bottom: 0.9em;
    margin: 16px auto;
}

blockquote p:first-child {
    margin-top: 0.5em;
}

blockquote p:last-child {
    margin-bottom: 0;
}

blockquote::before {
    display: block;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
    padding-top: 0.9rem;
}

/* Definition */
blockquote.definition::before {
    color: var(--blog-bq-definition-label);
    content: "Definition";
}

blockquote.definition {
    background: var(--blog-bq-definition-bg);
    border-left: 5px solid #31dd2e;
}

/* Proof */
blockquote.proof::before {
    color: var(--blog-bq-proof-label);
    content: "Proof";
}

blockquote.proof {
    background: var(--blog-bq-proof-bg);
    border-left: 5px solid #31dd2e;
}

/* Equation */
blockquote.equation::before {
    color: var(--blog-bq-equation-label);
    content: "Equation";
}

blockquote.equation {
    background: var(--blog-bq-equation-bg);
    border-left: 5px solid #486bd5;
    padding-bottom: 0.1em;
}

/* Theorem */
blockquote.theorem::before {
    color: var(--blog-bq-theorem-label);
    content: "Theorem";
}

blockquote.theorem {
    background: var(--blog-bq-theorem-bg);
    border-left: 5px solid #486bd5;
}

/* Lemma */
blockquote.lemma::before {
    color: var(--blog-bq-theorem-label);
    content: "Lemma";
}

blockquote.lemma {
    background: var(--blog-bq-theorem-bg);
    border-left: 5px solid #486bd5;
}

/* Algorithm */
blockquote.algorithm::before {
    color: var(--blog-bq-algorithm-label);
    content: "Algorithm";
}

blockquote.algorithm {
    background: var(--blog-bq-algorithm-bg);
    border-left: 5px solid #486bd5;
}

/* Problem */
blockquote.problem::before {
    color: var(--blog-bq-problem-label);
    content: "Problem";
}

blockquote.problem {
    background: var(--blog-bq-problem-bg);
    border-left: 5px solid #486bd5;
}

/* Important */
blockquote.important::before {
    color: var(--blog-bq-important-label);
    content: "Important";
}

blockquote.important {
    background: var(--blog-bq-important-bg);
    border-left: 5px solid #dd2e2e;
}

/* Note */
blockquote.note::before {
    color: var(--blog-bq-note-label);
    content: "Note";
}

blockquote.note {
    background: var(--blog-bq-note-bg);
    border-left: 5px solid #ffea00;
}

/* Definition Styles in Math Mode */
[style*="--blog-blockquote-style: latex"] blockquote:not(.note) {
    margin-block-start: 0;
    margin-inline-start: 0;
    display: block;
    border-radius: 5px;
    box-shadow: var(--blog-bq-shadow);
    padding: 0.9rem 0.8rem;
    margin: 16px auto;
    position: relative;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

[style*="--blog-blockquote-style: latex"] blockquote:not(.note) p:first-child {
    margin-top: 0;
    display: inline;
}

[style*="--blog-blockquote-style: latex"] blockquote:not(.note) p:last-child {
    display: inline;
}

[style*="--blog-blockquote-style: latex"] blockquote:not(.note)::before {
    font-weight: bold;
    text-transform: none;
    font-size: 1.1em;
    display: inline-block;
    padding-top: 0;
    font-style: normal;
}

[style*="--blog-blockquote-style: latex"] blockquote.definition {
    font-style: italic;
}

[style*="--blog-blockquote-style: latex"] blockquote.definition::before {
    content: attr(blockquote-definition-number) " ";
    color: inherit;
}

[style*="--blog-blockquote-style: latex"] blockquote.theorem {
    font-style: italic;
}

[style*="--blog-blockquote-style: latex"] blockquote.theorem::before {
    content: attr(blockquote-theorem-number) " ";
    color: inherit;
}

[style*="--blog-blockquote-style: latex"] blockquote.lemma {
    font-style: italic;
}

[style*="--blog-blockquote-style: latex"] blockquote.lemma::before {
    content: attr(blockquote-theorem-number) " ";
    color: inherit;
}

[style*="--blog-blockquote-style: latex"] blockquote.algorithm {
    font-style: normal;
}

[style*="--blog-blockquote-style: latex"] blockquote.algorithm::before {
    content: attr(blockquote-algorithm-number) " ";
    color: inherit;
}

[style*="--blog-blockquote-style: latex"] blockquote.equation {
    font-style: normal;
}

[style*="--blog-blockquote-style: latex"] blockquote.equation::before {
    content: none;
}

[style*="--blog-blockquote-style: latex"] blockquote.problem {
    font-style: normal;
}

[style*="--blog-blockquote-style: latex"] blockquote.problem::before {
    content: attr(blockquote-problem-number) " ";
    color: inherit;
}

[style*="--blog-blockquote-style: latex"] blockquote.proof {
    all: unset;
    position: relative;
    font-style: inherit;
    display: block;
}

[style*="--blog-blockquote-style: latex"] blockquote.proof::before {
    font-weight: inherit;
    font-style: italic;
    content: "Proof. ";
    color: inherit;
    margin-right: 0.3em;
}

[style*="--blog-blockquote-style: latex"]
    blockquote.proof:not(:has(p:last-child))::after {
    content: "□";
    font-style: normal;
    color: inherit;
    font-size: 2.2em;
    display: block;
    text-align: right;
    line-height: 0.75em;
}

[style*="--blog-blockquote-style: latex"] blockquote.proof p:last-child {
    display: inline-block;
    margin-right: 1.5em; /* Push text away from QED symbol */
    margin-bottom: 1rem;
}

[style*="--blog-blockquote-style: latex"] blockquote.proof p:last-child::after {
    content: "□";
    font-style: normal;
    color: inherit;
    font-size: 2.2em;
    position: absolute;
    right: 0rem;
    line-height: 0.75em;
}
