@import 'fonts.css';

/* Global Styles */
:root {
  --heading-color: rgb(29, 31, 32);
  --text-color: rgba(29, 31, 32, .85);
  --text-color-faded: rgb(29, 31, 32, 0.5);
  --primary-color: rgb(0, 201, 37);
  --background-color: rgb(255, 255, 255);
  --callout-background: rgb(244, 255, 229);
  --primary-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --heading-font: "Eiko", "Wremena", Times New Roman, Times, serif;
  --secondary-heading-font: "Wremena", Times New Roman, Times, serif;
  --tertiary-font: "Inter", "Courier Prime", "Courier", monospace;
  /* Set headings to large size by increasing :root em font size */
  /* Calc with vw makes font sizes intrinsically responsive */
  font-size: calc(1.5em + 0.5vw);
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reset non-headings to a smaller size while retaining visual rhythm */
section>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6),
footer *,
nav * {
  font-size: .6rem;
}

/* Full bleed reset */
body,
html {
  margin: 0;
  padding: 0;
}

/* Body Styles */
body {
  background-color: var(--background-color);
  font-family: var(--primary-font);
  color: var(--text-color);
  max-width: 1750px;
  margin: 0 auto;
  padding: 4vh 6vw;
  overflow-wrap: anywhere;
}

::selection {
  color: black;
  background: var(--primary-color);
}

::-moz-selection {
  color: black;
  background: var(--primary-color);
}

/* Top Nav */
nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0 1em;
  font-family: var(--secondary-heading-font);
  flex-wrap: wrap;
}

nav li:first-child {
  flex-grow: 1;
  text-transform: uppercase;
}

/* Heading Styles */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--secondary-heading-font);
  color: var(--heading-color);
  margin: calc(0.2em + 4vw) 0 calc(0.2em + .5vw);
  padding-bottom: 0;
  font-weight: 100;
  line-height: 1;
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

article>h1:first-of-type {
  font-size: calc(1em + 4vw);
  line-height: 1;
  font-family: var(--heading-font);
  font-style: italic;
  margin: 0 0 calc(0.2em + .5vw);
}

.note-layout main article>h1:first-of-type,
.page-title>h1:first-of-type {
  font-family: var(--heading-font);
  font-style: italic;
  font-size: calc(1em + 4vw);
}

.page-title>p:first-child {
  font-style: italic;
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
  font-weight: 200;
}

/* h2+h3 {
  margin-top: 0.25em;
}

h1+p,
h2+p,
h3+p {
  margin-top: 0.25em;
}

h3 {
  font-weight: 400;
  font-size: 0.900rem;
} */

nav {
  margin: 1em 0 calc(1em + 1vw);
}

main {
  display: grid;
  grid-template-columns: 3fr 1fr;
  grid-gap: 2em;
}

.note-layout main {
  margin: calc(0.5em + 14vw) 0;
}

article {
  display: grid;
}

article::after {
  content: "";
  border-bottom: 1px solid var(--text-color-faded);
  opacity: 20%;
}

section {
  width: 100%;
}

main section {
  grid-column: 1 / -1;
}

@media (max-width: 1200px) {

  article,
  aside {
    grid-column: 1 / -1;
    max-width: calc(100vw - 12vw)
  }
}

section.callout {
  padding: 1em 0;
  background: var(--callout-background);
  border-radius: 4px;
  margin: 3em 0;
  font-family: var(--tertiary-font);
}

section.callout p {
  /* font-size: calc(.5em + 1.5vh); */
  padding: 0 calc(1em + 1.5vh);
}

/* Backlink box */
aside {
  display: grid;
  grid-gap: calc(0.5em + 0.5vw);
  align-content: start;
}

aside h5 {
  margin: 0;
}

.backlink-box {
  background: var(--callout-background);
  padding: 1em;
  border-radius: 4px;
  font-size: 0.5rem;
  font-family: var(--tertiary-font);
}

.backlink-box p {
  margin: 0.5em 0;
  line-height: 1.5;
}

/* Article */
header,
.archive span {
  font-feature-settings: "ss01" 1, "zero" 1, "case" 1;
  font-variant-numeric: slashed-zero;
}

header p {
  color: var(--text-color-faded);
  font-size: 0.5rem;
  margin-top: 0;
  padding-bottom: calc(.5em + 2vw);
  font-family: var(--tertiary-font);
}

/* Article Images */
article img {
  max-width: 100%;
  border-radius: 4px;
  text-align: center;
  display: block;
  margin: 0 auto;
  max-height: 65vh;
}

article figure {
  columns: 6;
  column-gap: .5em;
  column-width: calc(5em + 14vw);
  margin: 2em 0 3em 0;
}

figure img {
  border-radius: 2px;
  max-height: initial;
}

figure p {
  margin: 0;
}

figure img:only-of-type {
  margin: 0 auto;
  column-span: all;
  max-height: 55vh;
  width: auto;
}

figure p+p,
figure img+img {
  margin-top: 1em;
}

p img {
  margin-top: 1em;
}

article figcaption {
  font-size: .8em;
  color: var(--text-color-faded);
  text-align: center;
  padding-top: 1em;
  column-span: all;
  font-family: var(--tertiary-font);
}

figcaption>* {
  padding: 0;
}

figcaption a,
footer a {
  color: var(--text-color);
  border-bottom: 1px solid;
}

figcaption a::after,
footer a::after {
  content: "";
}

blockquote {
  background: var(--callout-background);
  border-radius: 4px;
  border-left: 4px solid var(--primary-color);
  font-family: var(--tertiary-font);
  width: 100%;
  margin: 2em 0;
  padding: 1em 0;
}

blockquote p {
  padding: 0 calc(1em + 1vw);
}

hr {
  width: 100%;
  border: 0;
  height: 1px;
  margin: 1.5em 0;
}

strong,
b {
  font-weight: 700;
  color: var(--heading-color);
}

/* Footer */
footer {
  margin: 3em 0;
  color: var(--text-color-faded);
  border-top: 1px solid var(--text-color-faded);
  font-family: var(--tertiary-font);
}

.table ul.archive a.internal-link,
.table ul.archive a,
.table ul.archive h3,
.table ul.archive p {
  font-family: var(--primary-font);
  font-size: 1em;
  font-style: normal;
  font-weight: 400;
  margin: 0;
  /* padding: 0; */
}

ul.archive,
ul.archive li {
  list-style: none;
  margin: 0;
  padding: 0;
  list-style-type: none;
  gap: 0;
}

ul.archive li:first-of-type a p {
  font-weight: bold;
}

ul.archive li:first-of-type a:hover,
ul.archive li:first-of-type a:focus {
  background-color: initial;
  cursor: auto;
}

.table ul.archive li a {
  display: grid;
  grid-template-columns: minmax(4em, 3fr) minmax(3em, 2fr) 1fr;
  align-items: baseline;
  column-gap: 2em;
  padding: .15em;
  color: inherit;
}

ul.archive li a *:last-child {
  justify-self: end;
  text-align: right;
}

ul.archive a::after {
  content: "";
}

@media (max-width: 950px) {

  div.table {
    margin-top: 2em;
  }

  ul.archive li:first-of-type {
    display: none;
  }

  .table ul.archive li a.internal-link,
  .table ul.archive li a {
    grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
    padding: 1em 0;
  }


  .table ul.archive h3 {
    font-size: 120%;
  }

  .table ul.archive p:first-of-type {
    display: none;
  }

  ul.archive li a *:last-child {
    justify-self: inherit;
    text-align: inherit;
  }
}


/* Tables in Markdown */
table {
  max-width: 100%;
  width: 100%;
}

table,
table>*>*>* {
  border: 1px solid var(--text-color-faded);
  border-collapse: collapse;
  color: var(--heading-color);
}

table th,
table td {
  padding: 0.25em 0.5em
}

/* Links */
a {
  transition: all 300ms;
  font-weight: 600;
  color: var(--heading-color);
  border-bottom: 1px solid var(--primary-color);
  text-decoration: none;
}

a:hover,
a:focus {
  transition: all 300ms;
  background: var(--callout-background);
}

a::after {
  font-size: 15px;
  content: "↗";
  color: var(--text-color-faded);
  top: -0.5em;
  position: relative;
  font-family: monospace;
  font-weight: 100;
}

/* Need to exclude a img arrow for external links eventually */
a.internal-link:after,
a.footnote-backref:after {
  content: "";
}

*:focus {
  background: var(--primary-color);
}

.invalid-link {
  color: var(--text-color-faded);
  cursor: help;
  background: var(--callout-background);
  padding: 0 0.1em
}

.invalid-link-brackets {
  color: #ccc;
  cursor: help
}

/* Link Preview Box */
#tooltip-wrapper {
  background: white;
  padding: 1em;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  position: absolute;
  width: 400px;
  height: 250px;
  font-size: 0.5rem;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 100ms;
}

#tooltip-wrapper:after {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  pointer-events: none;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 90%);
  width: 100%;
  height: 75px;
}

/* Footnotes */
.footnote-ref a,
a.footnote-backref {
  border-bottom: 0;
}

.footnote-ref a {
  font-feature-settings: "sups" 1;
  line-height: 1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-decoration: underline;
  position: relative;
}

.footnote-ref a::before {
  content: "[";
}

.footnote-ref a::after {
  content: "]";
  font-size: inherit;
  color: inherit;
  top: 0;
  position: inherit;
  font-family: inherit;
  font-weight: inherit;
}

/* Graph */
.links line {
  stroke: #ccc;
  opacity: 0.5;
}

.nodes circle {
  cursor: pointer;
  fill: var(--primary-color);
  transition: all 0.15s ease-out;
}

.text text {
  cursor: pointer;
  fill: #333;
  text-shadow: -1px -1px 0 #fafafabb, 1px -1px 0 #fafafabb, -1px 1px 0 #fafafabb, 1px 1px 0 #fafafabb;
}

.nodes [active],
.text [active] {
  cursor: pointer;
  fill: black;
}

.inactive {
  opacity: 0.1;
  transition: all 0.15s ease-out;
}

#graph-wrapper {
  background: var(--callout-background);
  border-radius: 4px;
  height: auto;
}

/* Code blocks */
code {
  background: var(--callout-background);
  padding: 0 0.2em;
  border-radius: 4px;
  font-family: var(--tertiary-font);
  white-space: pre-wrap;
}

pre code {
  padding: 0;
  background: transparent;
  font-size: 85%;
}

pre {
  background: var(--callout-background);
  padding: 1.5em 1em;
  margin: 2em 0;
  border-radius: 4px;
  overflow-x: scroll;
  font-family: var(--tertiary-font);
  white-space: pre-wrap;
  opacity: 0.7;
}

div.highlight {
  background: var(--callout-background);
  border-radius: 4px;
  font-size: 1em;
  font-size: 0.9em;
  overflow: scroll;
  margin: 1em 0;
  display: grid;
  font-family: var(--tertiary-font);
}

div.highlight pre {
  margin: 1em;
  background: transparent;
}

.highlight .c {
  color: #999988;
  font-style: italic
}

.highlight .err {
  color: #a61717;
  background-color: #e3d2d2
}

.highlight .k {
  font-weight: bold
}

.highlight .o {
  font-weight: bold
}

.highlight .cm {
  color: #999988;
  font-style: italic
}

.highlight .cp {
  color: #999999;
  font-weight: bold
}

.highlight .c1 {
  color: #999988;
  font-style: italic
}

.highlight .cs {
  color: #999999;
  font-weight: bold;
  font-style: italic
}

.highlight .gd {
  color: #000000;
  background-color: #ffdddd
}

.highlight .gd .x {
  color: #000000;
  background-color: #ffaaaa
}

.highlight .ge {
  font-style: italic
}

.highlight .gr {
  color: #aa0000
}

.highlight .gh {
  color: #999999
}

.highlight .gi {
  color: #000000;
  background-color: #ddffdd
}

.highlight .gi .x {
  color: #000000;
  background-color: #aaffaa
}

.highlight .go {
  color: #888888
}

.highlight .gp {
  color: #555555
}

.highlight .gs {
  font-weight: bold
}

.highlight .gu {
  color: #aaaaaa
}

.highlight .gt {
  color: #aa0000
}

.highlight .kc {
  font-weight: bold
}

.highlight .kd {
  font-weight: bold
}

.highlight .kp {
  font-weight: bold
}

.highlight .kr {
  font-weight: bold
}

.highlight .kt {
  color: #445588;
  font-weight: bold
}

.highlight .m {
  color: #009999
}

.highlight .s {
  color: #d14
}

.highlight .na {
  color: #008080
}

.highlight .nb {
  color: #0086B3
}

.highlight .nc {
  color: #445588;
  font-weight: bold
}

.highlight .no {
  color: #008080
}

.highlight .ni {
  color: #800080
}

.highlight .ne {
  color: #990000;
  font-weight: bold
}

.highlight .nf {
  color: #990000;
  font-weight: bold
}

.highlight .nn {
  color: #555555
}

.highlight .nt {
  color: #000080
}

.highlight .nv {
  color: #008080
}

.highlight .ow {
  font-weight: bold
}

.highlight .w {
  color: #bbbbbb
}

.highlight .mf {
  color: #009999
}

.highlight .mh {
  color: #009999
}

.highlight .mi {
  color: #009999
}

.highlight .mo {
  color: #009999
}

.highlight .sb {
  color: #d14
}

.highlight .sc {
  color: #d14
}

.highlight .sd {
  color: #d14
}

.highlight .s2 {
  color: #d14
}

.highlight .se {
  color: #d14
}

.highlight .sh {
  color: #d14
}

.highlight .si {
  color: #d14
}

.highlight .sx {
  color: #d14
}

.highlight .sr {
  color: #009926
}

.highlight .s1 {
  color: #d14
}

.highlight .ss {
  color: #990073
}

.highlight .bp {
  color: #999999
}

.highlight .vc {
  color: #008080
}

.highlight .vg {
  color: #008080
}

.highlight .vi {
  color: #008080
}

.highlight .il {
  color: #009999
}
