@charset "UTF-8";

/* Import ET Book styles
   adapted from https://github.com/edwardtufte/et-book/blob/gh-pages/et-book.css */

@font-face {
  font-family: "et-book";
  src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff")
    format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "et-book";
  src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff")
    format("woff");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "et-book";
  src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff")
    format("woff");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "et-book-roman-old-style";
  src: url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff")
    format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Tufte CSS styles with responsive content width variables */
:root {
  --content-width-mobile: 32rem;
  --content-width-tablet: 38rem;
  --content-width-medium: 42rem;
  --content-width-large: 45rem;
  --list-width-mobile: 30rem;
  --list-width-tablet: 36rem;
  --list-width-medium: 40rem;
  --list-width-large: 43rem;
}

html {
  font-size: 15px;
}

body {
  margin-left: auto;
  margin-right: auto;
  padding-right: 12.5%;
  padding-bottom: 3rem;
  padding-left: 12.5%;
  font-family:
    et-book, "Times New Roman", "DejaVu Serif", "Bitstream Charter", Georgia,
    serif;
  background-color: #fffff8;
  color: #111111;
  max-width: 1400px;
  counter-reset: sidenote-counter;
}

h1 {
  font-weight: 400;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
  font-size: 3.2rem;
  line-height: 1;
}

h2 {
  font-style: italic;
  font-weight: 400;
  margin-top: 2.1rem;
  margin-bottom: 1.4rem;
  font-size: 2.2rem;
  line-height: 1;
}

h3 {
  font-style: italic;
  font-weight: 400;
  font-size: 1.7rem;
  margin-top: 2rem;
  margin-bottom: 1.4rem;
  line-height: 1;
}

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

p.subtitle {
  font-style: italic;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  display: block;
  line-height: 1;
}

.numeral {
  font-family: et-book-roman-old-style;
}

.danger {
  color: red;
}

section {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

p,
dl,
ol,
ul {
  font-size: 1.4rem;
  line-height: 2rem;
}

p {
  margin-top: 1.4rem;
  margin-bottom: 1.4rem;
  padding-right: 0;
  vertical-align: baseline;
}

/* Chapter Epigraphs */
div.epigraph {
  margin: 5em 0;
}

div.epigraph > blockquote {
  margin-top: 3em;
  margin-bottom: 3em;
}

div.epigraph > blockquote,
div.epigraph > blockquote > p {
  font-style: italic;
}

div.epigraph > blockquote > footer {
  font-style: normal;
}

div.epigraph > blockquote > footer > cite {
  font-style: italic;
}
/* end chapter epigraphs styles */

blockquote {
  font-size: 1.4rem;
  color: #333333;
}

blockquote p,
blockquote footer {
  margin-right: 40px;
}

blockquote footer {
  font-size: 1.1rem;
  text-align: right;
}

/* Apply content width to main content elements */
hr,
section > p:not(:has(img)),
section > footer,
section > table,
blockquote p,
blockquote footer,
figure {
  width: 100%;
  max-width: var(--content-width-mobile);
}

/* Apply list width to list elements */
section > dl,
section > ol,
section > ul {
  width: 100%;
  max-width: var(--list-width-mobile);
  -webkit-padding-start: 2rem;
  padding-left: 2rem;
}

dt:not(:first-child),
li:not(:first-child) {
  margin-top: 0.25rem;
}

figure {
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  -webkit-margin-start: 0;
  -webkit-margin-end: 0;
  margin: 0 0 3em 0;
}

figcaption {
  float: right;
  clear: right;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  vertical-align: baseline;
  position: relative;
  max-width: 40%;
}

figure.fullwidth figcaption {
  margin-right: 24%;
}

a:link,
a:visited {
  color: #111111;
  text-decoration: none;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.3);
}
a:hover {
  border-bottom-color: rgba(0, 0, 0, 0.6);
}

/* Sidenotes, margin notes, figures, captions */
img {
  max-width: 100%;
}

.sidenote,
.marginnote {
  float: right;
  clear: right;
  margin-right: -50%;
  width: 40%;
  margin-top: 0.3rem;
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  vertical-align: baseline;
  position: relative;
  color: #333333;
}

.sidenote-number {
  counter-increment: sidenote-counter;
}

.sidenote-number:after,
.sidenote:before {
  font-family: et-book-roman-old-style;
  position: relative;
  vertical-align: baseline;
}

.sidenote-number:after {
  content: counter(sidenote-counter);
  font-size: 1rem;
  top: -0.5rem;
  left: 0.1rem;
}

.sidenote:before {
  content: counter(sidenote-counter) " ";
  font-size: 1rem;
  top: -0.5rem;
}

blockquote .sidenote,
blockquote .marginnote {
  margin-right: -82%;
  min-width: 59%;
  text-align: left;
}

div.fullwidth,
table.fullwidth {
  width: 100%;
}

div.table-wrapper {
  overflow-x: auto;
  font-family: "Trebuchet MS", "Gill Sans", "Gill Sans MT", sans-serif;
}

.sans {
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
  letter-spacing: 0.03em;
}

code,
pre > code {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    Liberation Mono,
    monospace;
  font-size: 1rem;
  line-height: 1.42;
  -webkit-text-size-adjust: 100%; /* Prevent adjustments of font size after orientation changes in iOS. See https://github.com/edwardtufte/tufte-css/issues/81#issuecomment-261953409 */
}

.sans > code {
  font-size: 1.2rem;
}

h1 > code,
h2 > code,
h3 > code {
  font-size: 0.8em;
}

.marginnote > code,
.sidenote > code {
  font-size: 1rem;
}

pre {
  background: transparent;
  border-left: 3px solid #e2e2e2;
  padding-left: 0.8rem;
  overflow-x: auto;
  white-space: pre;
}

pre > code {
  font-size: 0.9rem;
  margin-left: 2.5%;
  overflow-x: auto;
  display: block;
}

/* Inline code - subtle background */
:not(pre) > code {
  background-color: #f8f8f8;
  padding: 0.1em 0.3em;
  border: 1px solid #e2e2e2;
  border-radius: 2px;
}

pre.fullwidth > code {
  width: 90%;
}

.fullwidth {
  max-width: 90%;
  clear: both;
}

span.newthought {
  font-variant: small-caps;
  font-size: 1.2em;
}

input.margin-toggle {
  display: none;
}

label.sidenote-number {
  display: inline-block;
  max-height: 2rem; /* should be less than or equal to paragraph line-height */
}

label.margin-toggle:not(.sidenote-number) {
  display: none;
}

.iframe-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  padding-top: 25px;
  height: 0;
}

.iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (max-width: 760px) {
  body {
    width: 84%;
    padding-right: 8%;
    padding-bottom: 3rem;
    padding-left: 8%;
  }

  hr,
  section > p,
  section > footer,
  section > table {
    width: 100%;
  }

  pre > code {
    width: 97%;
  }

  section > dl,
  section > ol,
  section > ul {
    width: 90%;
  }

  figure {
    max-width: 90%;
  }

  figcaption,
  figure.fullwidth figcaption {
    margin-right: 0%;
    max-width: none;
  }

  blockquote {
    margin-left: 1.5em;
    margin-right: 0em;
  }

  blockquote p,
  blockquote footer {
    width: 100%;
  }

  label.margin-toggle:not(.sidenote-number) {
    display: inline;
  }

  .sidenote,
  .marginnote {
    display: none;
  }

  .margin-toggle:checked + .sidenote,
  .margin-toggle:checked + .marginnote {
    display: block;
    float: left;
    left: 1rem;
    clear: both;
    width: 95%;
    margin: 1rem 2.5%;
    vertical-align: baseline;
    position: relative;
  }

  label {
    cursor: pointer;
  }

  div.table-wrapper,
  table {
    width: 85%;
  }

  img {
    width: 100%;
  }
}

/* Intermediate breakpoints for better responsive typography */
/* Responsive content width adjustments using CSS variables */
@media (min-width: 768px) {
  :root {
    --content-width-mobile: var(--content-width-tablet);
    --list-width-mobile: var(--list-width-tablet);
  }

  /* Adjust sidenotes for tablets */
  .sidenote,
  .marginnote {
    margin-right: -45%;
    width: 38%;
  }
}

@media (min-width: 1025px) {
  :root {
    --content-width-mobile: var(--content-width-medium);
    --list-width-mobile: var(--list-width-medium);
  }

  /* Adjust sidenotes for medium screens */
  .sidenote,
  .marginnote {
    margin-right: -52%;
    width: 42%;
  }
}

@media (min-width: 1200px) {
  :root {
    --content-width-mobile: var(--content-width-large);
    --list-width-mobile: var(--list-width-large);
  }

  /* Adjust sidenote positioning for optimal reading width */
  .sidenote,
  .marginnote {
    margin-right: -55%;
    width: 45%;
  }
}

/* Site-specific styles */

/* Site header */
.site-header {
  margin: 2rem 0 0.5rem 0;
}

/* Profile image */
.profile-link {
  border: none;
}
.profile-image {
  border-radius: 50%;
  display: block;
  margin-right: 8px;
  width: 64px;
  height: 64px;
}

/* Social links */
.social {
  display: flex;
  gap: 1rem;
  margin-block-end: 0.5em;
  align-items: center;
}
.social a {
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 0;
  min-height: 24px;
}
.social svg {
  fill: #111111;
  height: 24px;
  transition: all 0.2s ease;
  width: 24px;
  vertical-align: middle;
  display: block;
}
.social svg:hover {
  fill: #666666;
}

/* Index grid layout */
.index-grid {
  margin-top: 5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.index-card {
  border: 1px solid #e7e7e7;
  background: #fffffb;
  padding: 1rem;
  border-radius: 3px;
}
.index-card h3 {
  margin-block-start: 0;
  margin-block-end: 1rem;
}
.index-card ul {
  width: 100%;
  -webkit-padding-start: 1.5rem;
  padding-left: 1.5rem;
  margin: 0;
}
.index-card li {
  margin-top: 0.25rem;
}

/* Responsive index grid */
@media (max-width: 1000px) {
  .index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 85%;
  }
}
@media (max-width: 760px) {
  .index-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    width: 100%;
  }
}

/* Typography adjustments */
.byline {
  color: #444444;
  font-style: italic;
}

/* Media spacing */
img,
figure {
  margin: 1.2rem 0;
}

/* Preserve Chroma syntax highlighting */
.chroma .err,
.chroma .gh,
.chroma .kn,
.chroma .kp,
.chroma .m,
.chroma .mi,
.chroma .no,
.chroma .vi,
.chroma .ss {
  color: #d14;
}
.chroma .kc,
.chroma .kd,
.chroma .n,
.chroma .nt,
.chroma .nx {
  color: #111111;
}
.chroma .k,
.chroma .nb,
.chroma .nf {
  color: #333;
}
.chroma .no,
.chroma .s,
.chroma .s2 {
  color: #666;
}
.chroma .c,
.chroma .c1,
.chroma .ch,
.chroma .cp,
.chroma .o,
.chroma .p {
  color: #999;
}

/* Dark mode styles - must be at end to override light mode styles */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #151515;
    color: #ddd;
  }

  /* Social icons visibility in dark mode */
  .social svg {
    fill: #dddddd;
  }
  .social svg:hover {
    fill: #999999;
  }

  /* Links in dark mode */
  a:link,
  a:visited {
    color: #dddddd;
    border-bottom-color: rgba(221, 221, 221, 0.3);
  }
  a:hover {
    border-bottom-color: rgba(221, 221, 221, 0.6);
  }

  /* Code blocks in dark mode */
  pre {
    border-left-color: #444444;
  }
  :not(pre) > code {
    background-color: #2a2a2a;
    border-color: #444444;
  }

  /* Blockquotes and sidenotes in dark mode */
  blockquote {
    color: #aaaaaa;
  }
  .sidenote,
  .marginnote {
    color: #aaaaaa;
  }

  /* Index cards in dark mode */
  .index-card {
    border-color: #444444;
    background: #1a1a1a;
  }

  /* Byline in dark mode */
  .byline {
    color: #999999;
  }

  /* Syntax highlighting adjustments for dark mode */
  .chroma .kc,
  .chroma .kd,
  .chroma .n,
  .chroma .nt,
  .chroma .nx {
    color: #dddddd;
  }
  .chroma .k,
  .chroma .nb,
  .chroma .nf {
    color: #aaaaaa;
  }
}
