/* ---------- Colour scheme: light by default, dark when the visitor chooses it or their system asks for it ---------- */
:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    --background-color: #131416;
    --text-color: #E8EAED;
    color-scheme: dark;
}

/* Raised surfaces: one step lighter than the page instead of a shadow */
:root[data-theme="dark"] .card {
    background-color: color-mix(in srgb, var(--text-color) 3%, var(--background-color));
}

:root[data-theme="dark"] .footer-outer {
    background-color: color-mix(in srgb, var(--text-color) 3%, var(--background-color));
    border-color: transparent;
}

/* Menu bar: same shade as the page, separated by its bottom hairline */
:root[data-theme="dark"] .header {
    background-color: var(--background-color);
}

/* Footer band: darker than the page rather than flipping to light */
:root[data-theme="dark"] .footer {
    background-color: #0B0C0F;
}

:root[data-theme="dark"] .footer-bottom .social {
    border-color: var(--text-color-40);
}

:root[data-theme="dark"] .footer-bottom .social path {
    fill: var(--text-color);
}

:root[data-theme="dark"] .to-top path {
    stroke: var(--text-color);
}

:root[data-theme="dark"] .footer-credits,
:root[data-theme="dark"] .footer-credits a,
:root[data-theme="dark"] .footer-credit-mobile,
:root[data-theme="dark"] .footer-credit-mobile a {
    color: var(--text-color);
}

:root[data-theme="dark"] .credits-line {
    background-color: var(--text-color);
}

:root[data-theme="dark"] .footer-bottom .footer-button:hover {
    background-color: var(--text-color);
}

:root[data-theme="dark"] .footer-bottom .footer-button:hover:not(.to-top-button) path {
    fill: #0B0C0F;
}

:root[data-theme="dark"] .footer-bottom .to-top-button:hover path {
    stroke: #0B0C0F;
}

/* Images: slight dimming so white screenshots do not glare */
:root[data-theme="dark"] .post-content img,
:root[data-theme="dark"] .card-image img {
    filter: brightness(0.9);
}

/* Code highlighting: GitHub dark token colours over the theme's own block styling */
:root[data-theme="dark"] .hljs {
    color: var(--text-color);
    background: transparent;
}

:root[data-theme="dark"] .hljs-comment,
:root[data-theme="dark"] .hljs-punctuation {
    color: #8B949E;
}

:root[data-theme="dark"] .hljs-doctag,
:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-meta .hljs-keyword,
:root[data-theme="dark"] .hljs-template-tag,
:root[data-theme="dark"] .hljs-template-variable,
:root[data-theme="dark"] .hljs-type,
:root[data-theme="dark"] .hljs-variable.language_ {
    color: #FF7B72;
}

:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-title.class_,
:root[data-theme="dark"] .hljs-title.class_.inherited__,
:root[data-theme="dark"] .hljs-title.function_ {
    color: #D2A8FF;
}

:root[data-theme="dark"] .hljs-attr,
:root[data-theme="dark"] .hljs-attribute,
:root[data-theme="dark"] .hljs-literal,
:root[data-theme="dark"] .hljs-meta,
:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-operator,
:root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-selector-attr,
:root[data-theme="dark"] .hljs-selector-class,
:root[data-theme="dark"] .hljs-selector-id {
    color: #79C0FF;
}

:root[data-theme="dark"] .hljs-regexp,
:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-meta .hljs-string {
    color: #A5D6FF;
}

:root[data-theme="dark"] .hljs-built_in,
:root[data-theme="dark"] .hljs-symbol {
    color: #FFA657;
}

:root[data-theme="dark"] .hljs-name,
:root[data-theme="dark"] .hljs-quote,
:root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-selector-pseudo {
    color: #7EE787;
}

:root[data-theme="dark"] .hljs-subst {
    color: var(--text-color);
}

:root[data-theme="dark"] .hljs-section {
    color: #58A6FF;
    font-weight: bold;
}

:root[data-theme="dark"] .hljs-bullet {
    color: #F2CC60;
}

:root[data-theme="dark"] .hljs-emphasis {
    font-style: italic;
}

:root[data-theme="dark"] .hljs-strong {
    font-weight: bold;
}

:root[data-theme="dark"] .hljs-addition {
    color: #AFF5B4;
    background-color: #033A16;
}

:root[data-theme="dark"] .hljs-deletion {
    color: #FFDCD7;
    background-color: #67060C;
}

/* Blockquotes: a cool blue-grey surface and rule so quotes read differently from code blocks */
:root[data-theme="dark"] .post-content blockquote {
    background: color-mix(in srgb, #8AB4F8 10%, var(--background-color));
    border-left-color: #8AB4F8;
}
