/**
 * Theme Name: Claritas (modified)
 * Original: https://github.com/kazimieras-mi/bearblog-claritas-theme
 * License: MIT
 */

@font-face {
    font-family: 'D2Coding';
    src: url('/fonts/d2coding-ver1.3.2-20180524-webfont.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

 html {
    scrollbar-gutter: stable;
}

/* Config */
:root {
    --text-font-family: Georgia, Cambria, "Palatino Linotype", Palatino, "Book Antiqua", serif;
    --light-theme-text-color: black;
    --light-theme-text-color-opposite: white;
    --dark-theme-text-color: white;
    --dark-theme-text-color-opposite: rgb(45, 45, 45);
}

/* Internal Variables */
:root {
    --common-element-size: 18px;
    --common-element-size-2x: calc(var(--common-element-size) * 2);
    --common-element-size-05x: calc(var(--common-element-size) / 2);
    --common-color-shade: rgba(128, 128, 128, 0.05);
    --common-color-line: rgba(128, 128, 128, 0.3);
    --content-width: 70ch;
    --content-min-width: calc(var(--common-element-size) * 15);
    --text-color: var(--light-theme-text-color);
    --text-color-opposite: var(--light-theme-text-color-opposite);
    --text-font-size: var(--common-element-size);
    --text-line-height: 1.8;
    --infobox-background-color: rgba(114, 188, 255, 0.25);
    --infobox-border-color: rgba(114, 188, 255, 0.6);
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-color: var(--dark-theme-text-color);
        --text-color-opposite: var(--dark-theme-text-color-opposite);
    }
}

@media print {
    :root {
        --common-element-size: 12px;
    }
}

/* Common Elements */
body {
    color: var(--text-color);
    font-family: var(--text-font-family);
    font-size: var(--text-font-size);
    line-height: var(--text-line-height);
    background-color: var(--text-color-opposite);
    min-width: var(--content-min-width);
    max-width: var(--content-width);
    padding: 0 var(--common-element-size-2x);
    margin: var(--common-element-size-2x) auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--common-element-size-2x) * 2);
    text-align: left;
}

main {
    flex-grow: 1;
}

footer {
    margin-top: auto;
    border-top: 1px solid currentColor;
    padding-top: var(--common-element-size);
}

p:not(:first-child) {
    margin-top: var(--common-element-size);
}

hr {
    margin: var(--common-element-size) 0;
    border: 0;
    border-top: 1px solid var(--common-color-line);
}

/* Links */
a {
    color: var(--text-color);
    text-decoration-color: transparent;
    padding: 0.1em;
    border-bottom: 2px solid var(--text-color);
}

a:hover, a:focus, a:focus-visible {
    color: var(--text-color-opposite);
    background-color: var(--text-color);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'D2Coding', 'Courier New', monospace;
    line-height: 1.3;
    font-weight: 900;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    hyphens: auto;
    -webkit-text-stroke: 0.7px;
}

header h1 {
    font-family: var(--text-font-family);
    -webkit-text-stroke: 0.3px;
}

h1:not(:first-child), h2:not(:first-child), h3:not(:first-child), h4:not(:first-child), h5:not(:first-child), h6:not(:first-child) {
    margin-top: var(--common-element-size-2x);
}

main h1:first-of-type {
    font-size: calc(var(--text-font-size) * 2.5);
    font-style: italic;
    text-transform: uppercase;
}

/* Embeddings */
img, video, iframe, table {
    max-width: 100%;
}

img:not(:first-child), video:not(:first-child), iframe:not(:first-child), table:not(:first-child) {
    margin-top: var(--common-element-size);
}

/* Code blocks */
pre {
    font-size: calc(var(--text-font-size) * 0.8);
    line-height: 1.6;
    padding: var(--common-element-size-05x);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: pre-wrap;
    font-family: 'D2Coding', 'Courier New', monospace;
}

code {
    font-family: 'D2Coding', 'Courier New', monospace;
    font-size: calc(var(--text-font-size) * 0.85);
}

/* Tables */
table {
    display: table;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-bottom: 1px solid var(--common-color-line);
    border-right: 1px solid var(--common-color-line);
}

th, td {
    padding: var(--common-element-size-05x);
    border-top: 1px solid var(--common-color-line);
    border-left: 1px solid var(--common-color-line);
}

tr:nth-child(2n), th {
    background-color: var(--common-color-shade);
}

td {
    vertical-align: top;
}

th:empty {
    display: none;
}

th hr, td hr {
    margin: var(--common-element-size-05x) 0;
}

/* Text highlights */
mark {
    color: var(--text-color);
    display: inline-block;
    background-color: var(--infobox-background-color);
    border: 1px solid var(--infobox-border-color);
    padding: var(--common-element-size-05x);
    margin: 0.05em;
}

/* Navigation - centered top bar */
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.25rem 2rem;
  margin: 1rem 0 2rem;
}

nav a {
  border-bottom: none;
  padding: 0.15em 0.15em;
  text-decoration: none;
  color: var(--text-color);
  position: relative;
}

nav a.active {
  border-bottom: none;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 4px;
}

/* Printing support */
@media print {
    tr, th, thead, h1, h2, h3 {
        -webkit-column-break-inside: avoid;
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    h1::after, h2::after, h3::after {
        content: "";
        display: block;
        height: 2cm;
        margin-bottom: -2cm;
    }

    nav {
        display: none;
    }
}

/* Blockquotes */
blockquote {
    border-left: 3px solid var(--text-color);
    margin: var(--common-element-size) 0;
    padding: var(--common-element-size-05x) var(--common-element-size);
    font-style: italic;
    opacity: 0.85;
}

/* Time */
time {
    font-family: 'D2Coding', 'Courier New', monospace;
}

/* Selection highlight */
::selection {
    background-color: rgba(119,51,204,0.45);
    color: var(--dark-theme-text-color);
}

/* Compatibility */
body {
    -webkit-text-size-adjust: 100%;
}

/* Cursor animation for headings */
h2::after {
  content: '█';
  animation: blink 1s step-end infinite;
  -webkit-text-stroke: 0;
}

@keyframes blink {
  50% { opacity: 0; }
}