@import "./font.css";

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  margin-block-start: 0;
  margin-block-end: 0;
}

/* html */
:root {
  font-family: "Crimson Text", serif;
  font-size-adjust: ex-height 0.55;
  --line-height: 1.5rem;
  line-height: var(--line-height);
  --code-default-foreground: #4c504c;
  --code-keyword-foreground: #000000;
  --code-const-foreground: #75507b;
  --code-function-foreground: #3465a4;
  --code-string-foreground: #397104;
  --code-number-foreground: var(--code-string-foreground);
  background: #eeeeec;
}

body {
  max-width: 80ch;
  padding: 2ch;
  margin: auto;
}

/* site header */
header {
  margin: 1em 0;
  & nav { display: flex; column-gap: 2ch; align-items: baseline; flex-wrap: wrap; }
  & a { font-style: normal; color: rgba(0, 0, 0, .8); text-decoration: none; }
  & a:hover { color: rgba(0, 0, 0, .8); text-decoration: underline; }
  & a:visited { color: rgba(0, 0, 0, .8); }
  & .sitename { font-size: 1.2em; flex-grow: 2; }
}

/* article header */
header:has(> h1) {
  margin: .75rem 0;
  & h1 { margin-bottom: 0; line-height: 1.2 }
}

footer {
  margin-top: 3rem;
  & p { display: flex; column-gap: 2ch; justify-content: center; flex-wrap: wrap; }
  & a {
    display: flex; align-items: center; gap: 0.5ch;
    color: rgba(0, 0, 0, .8); text-decoration: none; white-space: nowrap;
    & svg { width: 1.25rem; height: 1.25rem; }
  }
}

article > *, article > section > *, figure.blockquote { max-width: 65ch; }
article > section, article > figure, article > section > figure {
  max-width: 80ch;
  overflow-x: auto;
  overflow-y: clip;
}

h1     { margin: 0.75rem 0; }
h2, h3 { margin: 0.5rem 0; }
section { margin-top: 1rem; }
p, table, ol, ul, figure, aside, dl, hr { margin-bottom: var(--line-height); }

sup, sub { line-height: 0; }

h1, h2, h3 {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  color: rgba(7,112,171,.9);
  text-rendering: optimizeLegibility;
  text-wrap: balance;
  line-height: 1em;
}
h1, h2 { font-size: 2rem; }
h3 { font-size: 1.5rem;}

section:target > :is(h1, h2, h3)         { position: relative; }
section:target > :is(h1, h2, h3)::before { position: absolute; left: -1.2ch; content: "§"; }
:is(h1, h2, h3) > a { color: inherit; text-decoration:none }
:is(h1, h2, h3) > a:hover { color: inherit; text-decoration:none }


/* Block */

img, video { display: inline-block; vertical-align: middle; max-width: 100%; height: auto; }
figure > img, figure > video { display: block; margin-left: auto; margin-right: auto; }

p { hyphens: auto; text-align: justify; }
figure.blockquote { padding-left: 1em; border-left: 3px solid #ba3925; }
figure.blockquote > figcaption { text-align: right; }

table { border-collapse: collapse; background: #fff;  }
table, td, th { border: 1px solid #dedede; }
td, th { padding: 0.5625em 0.625em }

ol, ul, dd { padding-left: 3ch; }
ul { list-style-type: circle;}
.roman { list-style-type: lower-roman; }

dt { margin-top: 1rem; font-weight: bold; }

aside.admn { display: flex; flex-direction: row; align-items: center; }
aside.admn > svg.icon { flex-shrink: 0; width: 2rem; height: 2rem; fill: #19407c; }
aside.admn.warn > svg.icon { fill: #ba3925; }
aside.admn > div { flex: 1; min-width: 0; padding-left: 1ch; margin-left: 1ch; border-left: 1px solid #dddddf }

aside.block {
  border-style: solid;
  border-width: 1px;
  border-radius: 4px;
  border-color: #dbdbd6;
  padding: 1em;
  background: #f3f3f2;
}

aside.block > .title {
  font-family: "Inter", sans-serif; font-size: 1.5rem; color: #7a2518;
  text-align: center;
  margin-top: 0; margin-bottom: 0.5rem;
}

aside.block > :last-child { margin-bottom: 0; }

details { padding-left: 1em; border-left: 3px solid #19407c; }

code {
  font-family: "LiberationMono", monospace;
  font-variant-ligatures: none;
  color: var(--code-default-foreground);
}

figcaption.title {
  font-style: italic; font-weight: 400;
  line-height: 1.45;
  color: #7a2518;
  margin-top: 0; margin-bottom: 0.25em;
}
figure.code-block > pre > code {
  line-height: 1.2;
}

blockquote > p {
  border-left: .25rem solid rgba(7,112,171,.9);
  padding-left: 1rem;
}

ol.callout { list-style: none; counter-reset: callout; }
ol.callout > li { position: relative; }
ol.callout > li::before {
  counter-increment: callout; content: counter(callout);
  position: absolute; top: 0.2rem; left: -1.1rem;
}
i.callout::after {
  content: attr(data-value);
}
ol.callout > li::before, i.callout::after {
  font-family: monospace; font-style: normal; font-size: 0.75rem; font-weight: bold;
  display: inline-block; width: 0.9rem; height: 0.9rem; line-height: 0.9rem;
  border-radius: 100%;
  background-color: black;
  color: white;
  text-align: center;
}

.two-col { display: flex; flex-direction: row; }
.two-col > *:first-child { flex: 30%; }
.two-col > *:last-child { flex: 30%; }

hr { border: none; height: 0; overflow: visible; color: black; height: 1rem; }
hr::after { content: '❧'; display: block; text-align: center; }

/* Inline */

p>code { white-space: nowrap; } /* Sadly, overflow-wrap: anywhere doesn't compose with this */
p>code { line-height: 0px; } /* https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align */
.display { display: block; margin: 1em 0; text-align: center; overflow-x: auto; overflow-y: clip; }

a { text-decoration-color: #2156a5; text-decoration-thickness: 7%; color: black; }
a:hover, a:focus { color: #2156a5; fill: #2156a5; }
a:hover, a:focus { & code { color: #2156a5; fill: #2156a5; } }
a.url { word-break: break-all; }

kbd {
  font-family: monospace; font-variant-ligatures: none;
  line-height: 1;
}

kbd > kbd {
  display: inline-block;
  color: rgba(0, 0, 0, .8); background: #f7f7f7; border: 1px solid #ccc; border-radius: 3px; box-shadow: 0 1px 0 rgb(0 0 0 / 20%), 0 0 0 0.1em #fff inset;
  margin: 0 0.15em; padding: 0.2em 0.5em; top: -0.1em;
  vertical-align: middle; position: relative; white-space: nowrap;
}

dfn, .small-caps { font-style: normal; font-variant: small-caps; }

.meta { display: block; color: #828282; font-family: "Inter", sans-serif; font-size: 1.5rem; font-weight: 400;}

.menu { font-weight: bold; }

/* Special Cases */

.post-list      { margin-left: 0; list-style: none; }
.post-list > li { margin-top: 1em; }
.post-list h2   { margin-top: 0; }
.post-list a       { color: rgb(7,112,171); text-decoration: none; display: block; }
.post-list a:hover { color: rgb(7,112,171,.7); text-decoration: underline; }

.about-ava { float: left; margin-right: 2ch; display: inline;}

/* Highlighting */

.hl-keyword { color: var(--code-keyword-foreground); }
.hl-literal { color: var(--code-const-foreground); }
/* .hl-type    { color: #0086B3; } */
.hl-tag     { color: #000080; }
.hl-title { color: var(--code-function-foreground); }
.hl-title.class_ { color: var(--code-default-foreground); }

.hl-title.function_ { color: var(--code-function-foreground); }
.hl-comment { color: #b35000; }
/* .hl-title.class_{ color: #445588; } */
/* .hl-built_in, .hl-meta { color: #3c5d5d; font-weight: bold; } */
.hl-built_in { color: #000000; }
.hl-meta { color: #3c5d5d; }
.hl-number { color: var(--code-number-foreground); }
.hl-string { color: var(--code-number-foreground); }
.hl-output { color: #2156a5; }
.hl-subst { color: rgba(0, 0, 0, .9); }
.hl-attr, .hl-symbol { color: #008080; }
.hl-line { background-color: #ffc; }
