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

html {
  font-family: "EB Garamond", serif;
  font-size-adjust: ex-height 0.53;
  -webkit-text-size-adjust: 100%;
  --line-height: 1.7rem;
  line-height: var(--line-height);
}

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

header {
  /* Site Header */
  margin-bottom: 2rem;
  & 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;
  }
  & .title {
    font-size: 1.2em;
    flex-grow: 2;
  }
}

header:has(> h1) {
  /* Article Header */
  margin-bottom: 0.75rem;
  & h1 {
    margin-bottom: 0;
    line-height: 1.2;
  }
}

footer {
  margin-top: 2rem;
  & 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: 1rem;
      height: 1rem;
    }
  }
}

article > *,
article > section > *,
figure.blockquote {
  max-width: 55ch;
}
article > section,
article > figure,
article > section > figure {
  max-width: 80ch;
}

h1 {
  margin-bottom: 0.75rem;
}
h2,
h3 {
  margin-bottom: 0.5rem;
}
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: "Open Sans", sans-serif;
  font-weight: 300;
  color: #ba3925;
  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-right: auto;
}

.ecg-live-frame {
  display: block;
  width: min(1100px, calc(100vw - 24px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
  height: 1380px;
  border: 1px solid #dedede;
}

@media (max-width: 850px) {
  .ecg-live-frame {
    height: 1180px;
  }
}

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 {
  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;
  & > :last-child {
    margin-bottom: 0;
  }
}

aside.block {
  border-style: solid;
  border-width: 1px;
  border-radius: 4px;
  border-color: #dbdbd6;
  padding: 1em;
  background: #f3f3f2;
  & > :last-child {
    margin-bottom: 0;
  }
  & > .title {
    font-family: "Open Sans", sans-serif;
    font-size: 1.5rem;
    color: #7a2518;
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.5rem;
  }
}

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

code {
  font-family: "JetBrains Mono", monospace;
  font-variant-ligatures: none;
  color: rgba(0, 0, 0, .9);
}
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 {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: clip;
  counter-reset: line;
  line-height: 1.2;
}
figure.code-block > pre > code > .line {
  counter-increment: line;
}
figure.code-block > pre > code > .line:before {
  content: counter(line);
  display: inline-block;
  width: 3ch;
  padding-right: 0.5ch;
  margin-right: 1ch;
  text-align: right;
  opacity: .35;
  border-right: 1px solid black;
}
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.5rem;
  left: -1.1rem;
}
i.callout::after {
  content: attr(data-value);
}
ol.callout > li::before,
i.callout::after {
  font-family: "JetBrains Mono";
  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: var(--line-height);
}
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:not(.display) {
  line-height: 0px;
} /* https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align */
.display {
  display: block;
  margin: calc(var(--line-height) / 2) 0;
  text-align: center;
  overflow-x: auto;
}

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: "JetBrains Mono", 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: "Open Sans", sans-serif;
  font-size: 1.5rem;
}

.menu {
  font-weight: bold;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch;
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  font-family: "Open Sans", sans-serif;
  font-size: 0.85rem;
  background: #e8e8e8;
  color: #555;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  text-decoration: none;
}

.tag:hover {
  background: #d0d0d0;
  color: #333;
  text-decoration: none;
}

dt .tag {
  font-size: 0.75rem;
  padding: 0.1em 0.35em;
}

.tag.active {
  background: #ba3925;
  color: #fff;
}

.tag.active:hover {
  background: #9a2f1e;
  color: #fff;
}

/* Search */
.search-form {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.search-form input[type="search"] {
  font-family: "Open Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.2em 0.5em;
  border: 1px solid #ccc;
  border-radius: 3px;
  width: 14ch;
  background: #f7f7f7;
}

.search-form input[type="search"]:focus {
  outline: none;
  border-color: #ba3925;
  background: #fff;
}

.search-form-large {
  margin-bottom: 1rem;
}

.search-form-large input[type="search"] {
  font-family: "Open Sans", sans-serif;
  font-size: 1.1rem;
  padding: 0.4em 0.75em;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  max-width: 40ch;
  background: #fff;
}

.search-form-large input[type="search"]:focus {
  outline: none;
  border-color: #ba3925;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch;
  margin-bottom: 2rem;
}

.search-empty {
  color: #828282;
  font-style: italic;
}

.search-loading {
  color: #828282;
}

.result-type {
  font-family: "Open Sans", sans-serif;
  font-size: 0.75rem;
  color: #828282;
  font-weight: 300;
  vertical-align: middle;
}

#search-heading {
  margin-bottom: 1rem;
}

/* 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: #ba3925;
  text-decoration: none;
  display: block;
}
.post-list a:hover {
  color: #ba3925;
  text-decoration: underline;
}

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

/* Highlighting */

.hl-keyword,
.hl-literal {
  color: #000000;
  font-weight: bold;
}
.hl-type {
  color: #0086B3;
}
.hl-tag {
  color: #000080;
}
.hl-title.function_ {
  color: #990000;
  font-weight: bold;
}
.hl-title.class_ {
  color: #445588;
  font-weight: bold;
}
.hl-comment {
  color: #008000;
  font-style: italic;
}
.hl-built_in,
.hl-meta {
  color: #3c5d5d;
  font-weight: bold;
}
.hl-number {
  color: #009999;
}
.hl-string {
  color: #d14;
}
.hl-output {
  color: #2156a5;
}
.hl-subst {
  color: rgba(0, 0, 0, .9);
}
.hl-attr,
.hl-symbol {
  color: #008080;
}
.hl-line {
  background-color: #ffc;
}

.flow-diagram {
  display: block;
  width: min(760px, calc(100vw - 24px));
  max-width: none;
  margin: 1rem 0 1rem 50%;
  transform: translateX(-50%);
  overflow-x: auto;
  & svg {
    display: block;
    width: 100%;
    height: auto;
  }
  & svg.v {
    display: none;
  }
  & .box {
    fill: #fff;
    stroke: #c9c9c3;
    stroke-width: 1.2;
  }
  & .box.hot {
    stroke: #ba3925;
    stroke-width: 2;
  }
  & .box.gh {
    stroke: #2156a5;
    stroke-width: 2;
  }
  & .band {
    fill: #f6f6f4;
  }
  & .t {
    font: 700 13px "JetBrains Mono", monospace;
    fill: #222;
  }
  & .s {
    font: 400 14px "EB Garamond", serif;
    fill: #555;
  }
  & .lbl {
    font: 400 11px "JetBrains Mono", monospace;
    fill: #7a2518;
  }
  & .band-lbl {
    font: 700 11px "JetBrains Mono", monospace;
    fill: #828282;
    letter-spacing: .08em;
  }
  & .arrow {
    fill: none;
    stroke: #555;
    stroke-width: 1.5;
  }
  & .arrow.maybe {
    stroke: #ba3925;
    stroke-dasharray: 4 4;
  }
  & .arrow.flow {
    stroke: #2156a5;
    stroke-dasharray: 6 4;
    animation: flow-dash .9s linear infinite;
  }
  & .harness {
    fill: #fff;
    stroke: #ba3925;
    stroke-dasharray: 3 3;
  }
}

@keyframes flow-dash {
  from {
    stroke-dashoffset: 10;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-diagram .arrow.flow {
    animation: none;
  }
}

@media (max-width: 640px) {
  .flow-diagram svg.h {
    display: none;
  }
  .flow-diagram svg.v {
    display: block;
    max-width: 420px;
    margin: 0 auto;
  }
}

.flow-diagram.slice-diagram {
  width: 100%;
  max-width: 560px;
  margin: 1rem 0;
  transform: none;
  & .t.sm {
    font-size: 11px;
  }
  & .box.slice {
    stroke: #2156a5;
    stroke-width: 1.6;
  }
  & .box.more {
    stroke: #9a9a94;
    stroke-dasharray: 4 4;
  }
  & .cell {
    fill: #f3f3f2;
    stroke: #dbdbd6;
  }
  & .row-guide {
    stroke: #dbdbd6;
    stroke-dasharray: 2 4;
  }
  & .layer {
    font: 700 11px "JetBrains Mono", monospace;
    fill: #828282;
  }
  & .dots {
    font: 400 32px "EB Garamond", serif;
    fill: #828282;
  }
  & .face {
    stroke: #fff;
    stroke-width: 1;
    stroke-linejoin: round;
  }
  & .slice.faded {
    opacity: .35;
  }
}
