@import url('./fonts/Libertinus/documentation/libertinus.css');

@font-face {
  font-family: 'FontWithASyntaxHighlighterLightOwl';
  src:
    url('./fonts/FontWithASyntaxHighlighterLightOwl-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'FontWithASyntaxHighlighter';
  src:
    url('./fonts/FontWithASyntaxHighlighter-Regular.woff2') format('woff2');
  font-weight: 400;
}

body {
  font-family: 'Libertinus Serif', 'Times New Roman', serif;
  font-feature-settings: 'liga', 'tnum', 'calt', 'zero';
}

main {
  max-width: 110ch;
  margin: 0 auto;
  padding: 16px;
}

kbd {
  font-family: 'Libertinus Keyboard', monospace;
}

aside, footer, h1, h2, h3, h4, h5, h6, figcaption {
  font-family: 'Libertinus Sans', sans-serif;
}

h2 {
  text-transform: uppercase;
}

abbr {
  font-variant: all-small-caps;
}

blockquote {
  border-left: 4px solid #ccc;
  margin: 1rem 0;
  padding: 0.5em 1em;
  background-color: #f3f3f3;
}

figure.blockquote {
  border-left: 4px solid #ccc !important;
  margin-top: 1em;
  margin-bottom: 1em;
  padding: 0.5em;
  background-color: #f3f3f3f3;
}

figure.blockquote > blockquote {
  margin: unset;
  border: unset !important;
}

figure.blockquote > blockquote + figcaption {
  text-align: right;
  padding-top: unset !important;
}

aside {
  font-size: smaller;
  padding-left: 1ch;
  border-left: #ccc 1px solid;
}

/* above a standard width, the aside jumps out to be a sidenote */
@media (min-width: 80rem) {
  aside {
    float: right;
    clear: right;
    margin-top: 0.25ch;
    margin-bottom: 0.25ch;
    margin-right: calc(-50vw + 26rem);
    width: calc(50vw - 28rem);
  }

  aside > * {
    max-width: 60ch;
  }
}

pre {
  /* cloned by cell.css */
  padding: 1ch;
  overflow: auto;
  background-color: #f3f3f3;
  border-radius: 4px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  margin-top: 2ch;
  margin-bottom: 0.5ch;
}

figure.card,
figure.card-figure {
  display: inline-block;
  margin-top: 1em;
  margin-bottom: 1em;
  padding: 0.5em;
  border: 1px solid #ccc;
  background-color: #f3f3f3f3;
}

figure.card figcaption,
figure.card-figure figcaption {
  padding-top: 0.5em;
}

output {
  font-family: monospace;
}

time {
  font-variant: small-caps;
  font-family: 'Libertinus Sans'
}

/* Silcrow styling */
h1 > a[href^="#"], 
h2 > a[href^="#"], 
h3 > a[href^="#"], 
h4 > a[href^="#"], 
h5 > a[href^="#"], 
h6 > a[href^="#"] {
    position: relative;
    transition: opacity 0.2s;
    opacity: 0.5;
    text-decoration: none;
    font-size: smaller;
    vertical-align: top;
}

h1 > a[href^="#"] {
  left: -1.2rem;
}
h2 > a[href^="#"] {
  left: -2.6rem;
}
h3 > a[href^="#"] {
  left: -3.1rem;
}
h4 > a[href^="#"] {
  left: -3.5rem;
}
h5 > a[href^="#"] {
  left: -3.65rem;
}
h6 > a[href^="#"] {
  left: -3.60rem;
}

h1 > a[href^="#"]:hover, 
h2 > a[href^="#"]:hover, 
h3 > a[href^="#"]:hover, 
h4 > a[href^="#"]:hover, 
h5 > a[href^="#"]:hover, 
h6 > a[href^="#"]:hover {
    opacity: 1;
    text-decoration: none;
}

h1 > a[href^="#"]::before, 
h2 > a[href^="#"]::before, 
h3 > a[href^="#"]::before, 
h4 > a[href^="#"]::before, 
h5 > a[href^="#"]::before, 
h6 > a[href^="#"]::before {
    content: "§";
}

a:hover, *::part(bh-a):hover  {
  text-underline-offset: 2px;
}

a:active, *::part(bh-a):active  {
  background-color: yellow;
  text-underline-offset: 3px;
}

:target {
  background-color: yellow;
}

table {
  border-collapse: collapse;
  width: 100%;
}

table, th, td {
  border: 1px solid #ddd;
}

th, td {
  padding: 8px;
  text-align: left;
}

th {
  background-color: #f3f3f3;
}

p,
.p {
  padding-top: 0.25ch;
  padding-bottom: 0.25ch;
}

/* if p is followed by an script.echo or style.echo, add a little space above the script */
p + script.echo, p + style.echo,
.p + script.echo, .p + style.echo {
  margin-top: 0.5ch;
}

/* if p is followed by an div.observablehq, add a little space above the inspector */
p:has(+ div.observablehq),
.p:has(+ div.observablehq) {
  margin-bottom: 1ch;
}

/* if an div.observablehq is followed by an script.echo, add a little space above the script */
div.observablehq + script.echo {
  margin-top: 0.5ch;
}

.subtitle {
  font-style: italic;
}

code {
  border: 1px solid #ddd;
  padding: 0 3px 1px;
  border-radius: 4px;
}

script, pre, style {
  margin-bottom: 1ch;
}

.table-of-contents {
  font-family: 'Libertinus Sans', sans-serif;
}

.authors .author a {
  text-decoration: none;
}

.authors a.author {
  text-decoration: none;
}

.authors .author .author-name {
  text-transform: uppercase;
  font-family: 'Libertinus Sans', sans-serif;
  font-size: larger;
}

.authors .author .author-affiliation {
  font-size: larger
}

.abstract {
  margin: 1em 0 2em;
  padding: 1em;
  border: 1px solid #ccc;
  border-radius: 4px
}

.favicon {
  display: inline;
  width: 1.6ch;
  height: 1.6ch;
}

/* keep in sync with cell.css */
pre code {
  font-family: "FontWithASyntaxHighlighterLightOwl", monospace !important;
  font-feature-settings: "colr", "calt";
  font-size: 0.83rem;
  line-height: 1.42;
  border: initial;
  padding: initial;
  border-radius: initial;
}

/** counters */
body {
  counter-reset: h2counter;
}

h2 {
  counter-reset: h3counter;
  counter-increment: h2counter;
}

h3 {
  counter-reset: h4counter;
  counter-increment: h3counter;
}

h4 {
  counter-reset: h5counter;
  counter-increment: h4counter;
}

h5 {
  counter-reset: h6counter;
  counter-increment: h5counter;
}

h6 {
  counter-increment: h6counter;
}

h2::before {
  content: counter(h2counter);
  padding-right: 1ch;
}

h3::before {
  content: counter(h2counter) "." counter(h3counter);
  padding-right: 1ch;
}

h4::before {
  content: counter(h2counter) "." counter(h3counter) "." counter(h4counter);
  padding-right: 1ch;
}

h5::before {
  content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter);
  padding-right: 1ch;
}

h6::before {
  content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter);
  padding-right: 1ch;
}

/*
  Josh's Custom CSS Reset
  https://www.joshwcomeau.com/css/custom-css-reset/
*/
*, *::before, *::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
body {
  -webkit-font-smoothing: antialiased;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
input, button, textarea, select {
  font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
#root, #__next {
  isolation: isolate;
}
