@charset "UTF-8";

@font-face {
  font-family: "Vollkorn";
  font-weight: 400;
  font-style: normal;
  src: url("../fonts/Vollkorn-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Vollkorn";
  font-weight: 400;
  font-style: italic;
  src: url("../fonts/Vollkorn-Italic.woff2") format("woff2");
}

@font-face {
  font-family: "Vollkorn";
  font-weight: 500;
  font-style: normal;
  src: url("../fonts/Vollkorn-Semibold.woff2") format("woff2");
}

@font-face {
  font-family: "Vollkorn";
  font-weight: 500;
  font-style: italic;
  src: url("../fonts/Vollkorn-SemiboldItalic.woff2") format("woff2");
}

*, *:before, *:after {
  box-sizing: border-box;
  text-rendering: optimizelegibility;
}

:root {
  /* Baseline defaults for all devices */
  --base-unit: 5vh;
  --column-width: 50vw;
}

@supports (width: clamp(28px, 5vh, 48px)) {
  :root {
    /* Baseline defaults for all devices and browsers that support clamp() */
    /* Edge Chromium on Android has an issue with supporting clamp() for widths */
    --base-unit: clamp(28px, 5vh, 48px);
    --column-width: clamp(480px, 50vw, 640px);
  }
}

:root {
  --base-unit-half: calc( var(--base-unit) / 2.0 );

  --body-text-font-stack: "Vollkorn", serif;
  --heading-text-font-stack: "Vollkorn", serif;
  --font-size: var(--base-unit-half);
  --line-height: 1.4rem;
  --print-line-height: 1.4rem;

  --vertical-padding: var(--base-unit);

  /* this 4.0 is a bit cryptic; we are making space for the toc button:; */
  --column-height: calc(100vh - calc(var(--vertical-padding) * 4.0));
  --column-gap: var(--base-unit);

  --paper-hue: 44;
  --paper-saturation: 10%;
  --paper-lightness: 99%;
  /*--paper-color: hsla( var(--paper-hue), var(--paper-saturation), var(--paper-lightness), 1.0 );*/
  --paper-color: rgb(253,246,227);
  /* these are for the "shades" that obscure text on the sides of the screen in wider browsers 
  --shade-color-destination: hsla(var(--paper-hue), var(--paper-saturation), var(--paper-lightness), 0.0);
  --shade-color-origin: hsla(var(--paper-hue), var(--paper-saturation), var(--paper-lightness), 0.75);*/
  --shade-color-origin: rgba(253, 246, 227, 0.6);
  --shade-color-destination: rgb(253, 246, 227);
  --spot-color: rgb(0, 22, 133);
  --selection-color: rgb(205, 193, 255);
  --text-color: rgb(5, 5, 5);

  --page-count: 1;
}
/* 
@media(prefers-color-scheme:dark) {
  :root {
    --paper-color: rgb(125, 94, 7);
    --shade-color-origin: rgba(125, 94, 7, .6);
    --paper-color: rgba(125, 94, 7, 0.6);
  
    --selection-color: hsla(340, 100%, 25%, 0);
    --text-color: rgb(250, 250, 250);
  }
} */

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

/* reset */
button {
  outline: none;
  border: none;
  background: none;
  background-color: transparent;
  touch-action: manipulation;
}

html {
  overflow: hidden; /* the key, always */
  font-size: var(--font-size);
  scroll-behavior: smooth;

  /* ss11 gives us the more normal 1 digit in Vollkorn */
  font-feature-settings: "kern", "liga", "ss11";
}

body {
  margin: 0;

  height: 100vh; /* so scrollbar appears at bottom */

  background-color: var(--paper-color);
  padding: var(--vertical-padding) 0 0 0;

  overflow-x: auto;
  overflow-y: hidden;

  /* to justify or not to justify? */
  text-align: left; /* sigh */
  line-height: var(--line-height);

  color: var(--text-color);
  font-family: var(--body-text-font-stack);
  font-size: 1rem;
  font-weight: 400;
}

div.tutorial {
  display: flex;
  flex-direction: column;
  justify-content: center;

  width: var(--column-width);
  height: calc( var(--column-height) - 1px ); /* full 100vh was causing an extra page break */

  text-align: center;
  break-after: column;
}

div.tutorial h2 {
  height: auto;
  flex-grow: 0;
  margin-top: 0;
  margin-bottom: var(--line-height);
  font-family: var(--body-text-font-stack); /* a bit ugly */
}

div.tutorial p {
  flex-grow: 0;
  text-indent: 0;
  margin-bottom: var(--line-height);
}

button.toc-button {
  display: flex;
  position: fixed;
  bottom: 0;

  left: 50vw;

  flex-direction: column;
  justify-content: center;

  z-index: 100000;
  width: calc( var(--base-unit) * 2.0 );
  height: var(--base-unit);

  border: 1px solid var(--text-color);
  background-color: var(--paper-color);
  color: inherit;
  transform: translateX(-50%) translateY(-50%);
}

button.toc-button:hover {
  border: 1px solid var(--spot-color);
  color: var(--spot-color);
}

button.toc-button svg {
  fill: currentColor;
  flex-grow: 1;
}

nav {
  position: fixed;

  top: calc( var(--vertical-padding) + var(--base-unit) );
  /* the toc is 90% of the page's width */
  left: calc( 50vw - var(--column-width) * 0.45);

  z-index: 10000;
  /* this is all a little bit stupid and I'm sure there's a more
  principled way to do it */
  width: calc( var(--column-width) * 0.9 );
  height: calc( var(--column-height) - var(--base-unit) );

  border: 1px solid var(--spot-color);

  background-color: hsla(var(--paper-hue), calc(var(--paper-saturation) * 2.0), var(--paper-lightness), 1.0);

  overflow-x: hidden;
  overflow-y: hidden;

  text-align: left;

  transition: opacity 0.1s;

  box-shadow: 0 0 var(--base-unit-half) 1px var(--spot-color);
}

nav.visible {
  opacity: 1.0;
  pointer-events: auto;
}

nav.invisible {
  opacity: 0.0;
  pointer-events: none;
}

nav div.toc {
  width: calc( var(--column-width) * 0.9 );
  height: calc( var(--column-height) - var(--base-unit) * 2.0 );

  padding: var(--base-unit);

  overflow-x: hidden;
  overflow-y: scroll;
  position: relative;
}

nav div.close-button {
  position: fixed;
  top: calc( var(--vertical-padding) + var(--base-unit) + var(--base-unit));
  right: calc( 50vw + var(--base-unit) - var(--column-width) * 0.45);
  width: var(--base-unit-half);
  height: var(--base-unit-half);
  stroke: var(--spot-color);
  stroke-width: 1px;
}

nav div.close-button:hover {
  cursor: pointer;
}

nav div.controls {
  display: flex;
  position: fixed;

  /* this is getting a bit silly... */
  top: calc( var(--vertical-padding) +
             var(--column-height) - var(--base-unit) * 2.0 );
  left: calc( 50vw - var(--column-width) * 0.45);

  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;

  width: calc( var(--column-width) * 0.9 );
  height: calc( var(--base-unit) * 2.0 );

  border: 1px solid var(--spot-color);

  background-color: hsla(var(--paper-hue), calc(var(--paper-saturation) * 2.0), var(--paper-lightness), 1.0);

  z-index: 100000;
}

nav div.controls button {
  flex-shrink: 0;

  margin: 0 var(--base-unit-half) 0 0;
  width: var(--base-unit);
  height: auto;

  padding: 0;

  cursor: pointer;
  text-align: center;
  color: var(--spot-color);
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

nav div.controls button:last-child {
  margin: 0 0 0 0;
}

nav div.controls button:hover {
  color: var(--text-color);
}

nav h1 {
  margin: 0 0 var(--line-height) 0;
  width: calc( var(--column-width) * 0.9 - calc( var(--base-unit) * 2.0 ) );
  padding: 0;
  font-style: italic;
  line-height: var(--line-height);
  font-size: 1rem;
  font-weight: 400;
}

nav ol {
  margin: 0;
  width: 90%;
  padding: 0;
  list-style-type: none;
  margin-bottom: var(--line-height);
}

nav ol li {
  margin: 0 0 var(--line-height) 0;
  line-height: var(--line-height);
  font-size: 1rem;
}

nav ol li:last-of-type {
  margin: 0 0 0 0;
}

div.bookmark {
  display: none;
  position: absolute;
  z-index: 100000;
  width: var(--base-unit);
  height: calc( var(--base-unit) * 2.0 );
  top: calc( var(--vertical-padding) * -2.5 ); /* now THAT is a stupid magic number */
  left: calc( var(--column-width) / 2.0 );
  transform: translateX(-50%);
  fill: var(--spot-color);

  /* https://stackoverflow.com/questions/58404417/mobile-safari-not-rendering-fixed-element-outside-of-viewport-unless-it-has-no-c */
  /* computers... */
}

/* GENERAL STYLES */

h2 {
  margin: calc( var(--line-height) * 6.0 ) 0 calc( var(--line-height) * 2.0 ) 0;
  padding: 0;
  line-height: calc( var(--line-height) * 2.0 );

  font-family: var(--heading-text-font-stack);
  font-size: 1.5rem;
  font-weight: 500;
  font-style: italic;
  break-before: column;
}

a, a:link, a:visited {
  color: var(--spot-color);
}

a:hover, a:active {
  color: var(--text-color);
}

p {
  margin: 0;
  padding: 1rem 0 0 0;
  text-indent: var(--base-unit-half);
}

span.nobr {
  white-space: nowrap;
}

p.spacetime {
  margin-top: var(--line-height);
  text-indent: 0;
}

small {
  text-transform: lowercase;
  font-size: 1.025rem;
  font-variant: small-caps;
  font-variant-caps: small-caps;
  font-feature-settings: "kern", "liga", "ss11", "smcp";
  hyphens: none;
}

img {
  display: block;
  /* this was sort of interesting but, nah */
  /* transform: translateX( var(--base-unit-half) ); */
  /* width: calc(var(--column-width) + var(--base-unit)); */
  width: var(--column-width);
  height: var(--column-height);
  max-height: var(--column-height);

  overflow: hidden;
  break-before: column;
  break-after: column;
  /* max-width: 100%; */
  mix-blend-mode: multiply;
  object-fit: contain; /* contain? */
}

hr {
  margin: var(--base-unit) auto var(--base-unit) auto;
  width: 50%;
  border: none;
  border-bottom: 1px solid var(--spot-color);
  break-after: avoid-column;
  /* break-after: column; */
}

p.last-page {
  break-before: column;
}

p.last-page::after {
  display: block;
  height: var(--column-height);

  content: "";
}

blockquote {
  margin: 0;
  background-color: rgba(0, 0, 0, 0.125);
  padding: var(--base-unit);
  font-style: italic;
  break-before: avoid-column;
}

/* BOOK BLOCK LAYOUT */

div.book {
  position: relative;

  scroll-snap-align: start;
  column-gap: var(--base-unit);
  column-fill: auto;
  column-count: auto;
  column-width: var(--column-width);

  margin: var(--base-unit-half);
  width: var(--column-width);
  height: var(--column-height);
}

div.book div.title {
  display: flex;
  flex-direction: column;
  justify-content: center;

  width: var(--column-width);
  height: calc( var(--column-height) - 1px ); /* full 100vh was causing an extra page break */

  text-align: center;
  /* break-after: column; */
}

div.book div.title h1 {
  height: auto;

  flex-grow: 0;
  margin: 0;
  padding: 0;
  text-transform: lowercase;
  line-height: calc( var(--line-height) * 2.0 );

  font-family: var(--heading-text-font-stack);
  font-size: 2rem;
  font-weight: 500;
  font-variant: small-caps;
  font-variant-caps: small-caps;
  font-feature-settings: "kern", "liga", "smcp", "ss11";

  color: var(--text-color);
  break-before: avoid; /* updated b/c of Chrome change */
}

div.book div.title h1 span {
  display: block;
}

div.book div.title h2 {
  flex-grow: 0;
  margin-top: var(--line-height);
  break-before: avoid; /* updated b/c of Chrome change */
}

div.book h1 {
  height: calc( var(--column-height) - 1px);

  margin: 0;
  padding: 0;
  text-transform: lowercase;
  line-height: var(--column-height);

  font-family: var(--heading-text-font-stack);
  font-size: 2rem;
  font-weight: 500;
  font-variant: small-caps;
  font-variant-caps: small-caps;
  font-feature-settings: "kern", "liga", "smcp", "ss11";

  color: var(--spot-color);

  text-align: center;

  break-before: column;
  break-after: column;
}

div.book::before {
  content: "";
  position: fixed;
  top: 0;
  z-index: 1000;
  width: calc( ( 100vw - var(--column-width) - var(--base-unit) ) / 2.0 );
  height: 100vh;

  /* specific to left shade */
  left: 0;
  background: linear-gradient(to right,
                              var(--shade-color-origin) 0%,
                              var(--shade-color-origin) 95%,
                              var(--shade-color-destination) 100%);

}

div.book::after {
  content: "";
  position: fixed;
  top: 0;
  z-index: 1000;
  width: calc( ( 100vw - var(--column-width) - var(--base-unit) ) / 2.0 );
  height: 100vh;

  /* specific to right shade */
  right: 0;
  background: linear-gradient(to left,
                              var(--shade-color-origin) 0%,
                              var(--shade-color-origin) 95%,
                              var(--shade-color-destination) 100%);
}

/* PRINT STYLES */
/* this is a mess... */

div.print-cover {
  display: none;

  width: 100%;
  height: 100%;

  page-break-after: always;
}

div.print-cover div.title {
  display: flex;
  flex-direction: column;
  justify-content: center;

  width: 100%;
  height: 100%;

  text-align: center;
}

div.print-cover div.title h1 {
  flex-grow: 0;
  margin: 0;
  padding: 0;
  text-transform: lowercase;
  line-height: calc( var(--line-height) * 2.0 );

  font-family: var(--heading-text-font-stack);
  font-size: 2rem;
  font-weight: 500;
  font-variant:small-caps;
  font-variant-caps: small-caps;
  font-feature-settings: "kern", "liga", "smcp", "ss11";
}

div.print-cover div.title h1 span {
  display: block;
}

div.print-cover div.title h2 {
  flex-grow: 0;
  margin-top: var(--line-height);
}

/* RESPONSIVE STUFF */

@media screen and (max-width: 640px) {

  :root {
    --column-width: calc(100vw - var(--base-unit));
    --column-height: calc(100vh - calc(var(--vertical-padding) * 5.0));
    /* x5.0 gets us enough clearance for mobile browser chrome */
    /* I hate it, but I don't think there's presently a better solution */
  }

  body {
    height: calc( var(--column-height) + var(--vertical-padding) * 2.0 );
  }

  div.book::before, div.book::after {
    display: none;
  }

}

@media screen and (min-width: 640px) {
  div.book {
    margin-left: calc(50vw - var(--column-width) / 2.0);
  }
}

@media screen and (min-height: 1000px) {
  :root {
    --vertical-padding: calc( var(--base-unit) * 2.0 );
  }

  div.bookmark {
    top: calc( var(--vertical-padding) * -1.5 ); /* now THAT is a stupid magic number */
  }
}

@media print {

  html {
    width: 100%;
    overflow: auto;
    font-size: 16pt;
    overflow: visible !important; /* BLERF this fixed a lot of my print style woes */
  }

  div.book::before, div.book::after, nav, button.toc-button, img.cover, div.last-page, div.bookmark, div.tutorial {
    display: none;
  }

  div.book div.title {
    display: none;
  }

  @page {
    margin: 1.5in;
  }

  body {
    width: 100%;
    height: auto;
    overflow-x: auto;
    overflow-y: auto;
    line-height: var(--print-line-height);
    color: rgb(0, 0, 0);
    background-color: rgb(255, 255, 255);
  }

  div.print-cover {
    display: block;
  }

  div.book {

    /* i really wanted columns to work for printing but... they do not */
    column-count: 0;
    column-width: auto;
    column-gap: 0;
    column-fill: auto;

    columns: 100% 1;

    margin: 0;
    width: 100%;
    height: auto;

    /*
    column-width: auto;
    column-count: 2;
    column-gap: var(--base-unit);
    column-fill: auto;
    */

  }

  h2 {
    display: block;
    position: relative;

    margin-top: 0;
    margin-bottom: var(--print-line-height);
    line-height: var(--print-line-height);

    font-size: 1rem;

    /* this isn't working :( */

    break-before: page !important;
  }

  hr {
    break-after: avoid-page !important;
  }

  small {
    /* small caps weren't working correctly when actually printed, so! */
    text-transform: none;
    font-size: 1.0rem;
    font-weight: 400;
    font-variant: none;
    font-variant-caps: none;
  }
}


.highlight .hll { background-color: #ffffcc }
.highlight  { background: #ffffff; }
.highlight .c { color: #008800; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #000080; font-weight: bold } /* Keyword */
.highlight .ch { color: #008800; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #008800; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #008080 } /* Comment.Preproc */
.highlight .cpf { color: #008800; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #008800; font-style: italic } /* Comment.Single */
.highlight .cs { color: #008800; font-weight: bold } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #000080; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #000080; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #000080; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #000080; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #000080; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #000080; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000FF } /* Literal.Number */
.highlight .s { color: #0000FF } /* Literal.String */
.highlight .na { color: #FF0000 } /* Name.Attribute */
.highlight .nt { color: #000080; font-weight: bold } /* Name.Tag */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000FF } /* Literal.Number.Bin */
.highlight .mf { color: #0000FF } /* Literal.Number.Float */
.highlight .mh { color: #0000FF } /* Literal.Number.Hex */
.highlight .mi { color: #0000FF } /* Literal.Number.Integer */
.highlight .mo { color: #0000FF } /* Literal.Number.Oct */
.highlight .sa { color: #0000FF } /* Literal.String.Affix */
.highlight .sb { color: #0000FF } /* Literal.String.Backtick */
.highlight .sc { color: #800080 } /* Literal.String.Char */
.highlight .dl { color: #0000FF } /* Literal.String.Delimiter */
.highlight .sd { color: #0000FF } /* Literal.String.Doc */
.highlight .s2 { color: #0000FF } /* Literal.String.Double */
.highlight .se { color: #0000FF } /* Literal.String.Escape */
.highlight .sh { color: #0000FF } /* Literal.String.Heredoc */
.highlight .si { color: #0000FF } /* Literal.String.Interpol */
.highlight .sx { color: #0000FF } /* Literal.String.Other */
.highlight .sr { color: #0000FF } /* Literal.String.Regex */
.highlight .s1 { color: #0000FF } /* Literal.String.Single */
.highlight .ss { color: #0000FF } /* Literal.String.Symbol */
.highlight .il { color: #0000FF } /* Literal.Number.Integer.Long */
