/* * {
  margin: 0;
  padding: 0;
} */

@font-face {
  font-family: "Domine";
  src: url("/assets/fonts/Domine.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/PublicSans.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}


/* Dark mode (default) */
:root {
  --color1: #895637;
  --color2: #52891a;
  --color3: #ff7700;

  --bg-lightness: 0;
}

@media (prefers-color-scheme: light) {
:root {
  --bg-lightness: 100;
}
}

:root {
  --bg-primary: hsl(from var(--color1) h s calc(abs(var(--bg-lightness) - 7)));
  --bg-secondary: hsl(from var(--color1) h s calc(abs(var(--bg-lightness) - 10)));
  --text-primary: hsl(from var(--color1) h s calc(abs(var(--bg-lightness) - 97)));
  --text-secondary: hsl(from var(--color1) h s calc(abs(var(--bg-lightness) - 93)));
  --border-color: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 30)));
  --post-accent: hsl(from var(--color3) h s calc(abs(var(--bg-lightness) - 10)));
  --header: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 10)));
  --gray: #595959;
  --linkpill-highlight: hsl(from var(--color3) h 100 70);
}


a { 
  color: hsl(from currentcolor 240 s calc(abs(var(--bg-lightness) - 80)));
}
a:visited {
  color: hsl(from currentcolor 320 s calc(abs(var(--bg-lightness) - 80)));
}

hr {
  color: hsl(from var(--color3) h s calc(abs(var(--bg-lightness) - 30)));
}

h1 {
  color: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 88)));
}

h2 {
  color: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 90)));
}

h3 {
  color: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 92)));
}

h4, h5, h6 {
  color: hsl(from var(--color2) h s calc(abs(var(--bg-lightness) - 94)));
}

html {
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* This combined with the CSS for pre, allows pre to scroll horizontally and for section to shrink */
section {
  min-width: 0;
  /* top | right | bottom | left */
  /* padding: 0;
  margin: 0 .5rem 0 .75rem; */
  padding: 1rem;
}

body {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: "Public Sans", sans-serif;
  margin: 0;
  padding: 0;
}

p, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: .5rem 0;
}

ul li, ol li {
  margin-left: 1rem;
}

table {
  border-collapse: collapse;
}

td, th {
  border: 1px solid var(--gray);
  padding: .5rem;
}

header {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.75rem;
  border-bottom: 4px solid var(--border-color);
  background-color: var(--header);
  font-family: "Domine", serif;
}

header h1 a, header h1 a:visited {
  text-decoration: none;
  color: var(--text-primary);
}
header h1 a:hover {
  /* invert lightness for better contrast */
  color: hsl(from var(--text-primary) h s calc(abs(var(--bg-lightness) - 80)));
}

nav {
  margin-bottom: .2%;
  display: inline-flex;
  gap: .5rem;
}

nav .linkpill {
  font-weight: bold;
}


.linkpill, .linkpill:visited {
  font-weight: bold;
  text-decoration: none;
  background-color: floralwhite;
  color: #333;
  border-radius: 20px;
  border-style: solid;
  box-shadow: .1vw .1vw #000;
  padding: 4px 8px 4px 8px;
  border-top: 1px solid #000;
  border-left: 1px solid #000;
  display: inline-block;
  margin: 0;
  white-space: nowrap;
}

.linkpill:hover, .linkpill:focus {
  background-color: var(--linkpill-highlight);
}

footer {
  border-top: 4px solid var(--border-color);
  background-color: var(--header);
  text-align: center;
  padding: 1rem 0;
  margin-top: auto;
}

/* Table of contents (top of some pages)*/
.toc {
  font-weight: bold;
  background-color: var(--bg-secondary);
  color: var(--post-accent);
  border-radius: 5px;
  border-style: solid;
  /* box-shadow: .2vw .2vw var(--text-primary); */
  padding: 1vw 3vw 1.5vw 1vw;
  border-top: 1px solid var(--post-accent);
  border-left: 1px solid var(--post-accent);
  display: inline-block;
  margin: 1rem;
}


/* Posts Index */
.post_preview {
  font-weight: bold;
  background-color: var(--bg-secondary);
  color: var(--post-accent);
  border-radius: 20px;
  border-style: solid;
  box-shadow: .2vw .2vw var(--text-primary);
  padding: 4px 8px 4px 8px;
  border-top: 1px solid var(--post-accent);
  border-left: 1px solid var(--post-accent);
  display: inline-block;
  margin: 1rem;
}

.post_preview a {
  text-decoration: none;
  color: var(--text-primary);
  /* Put the text and image preview side-by-side (or top-bottom) */
  display: flex;
  overflow: scroll;
  flex-wrap: wrap;
}
.post_preview a time {
  text-decoration: none;
  color: var(--text-secondary);
}
.post_preview:hover, .post_preview:focus {
  background-color: var(--post-accent);
}

.post_preview_img {
  max-width: 15rem;
  max-height: 15rem;
  border-radius: 5px;
  margin: .5rem;
  flex-shrink: 0
}


/* Misc */
@media print {
  .do-not-print {
    display: none;
    position: fixed;
    top: 0;
    visibility: hidden;
  }
}

/* Without this, wide pre blocks prevent the whole page from having a smaller width *and* wrapping. */
pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

/* Without this, imgs with a large width/height can be HUGE or small. */
img {
  max-width: 90svw;
  max-height: 90svh;
}