@charset "UTF-8";

/* JotBird — Essay theme (standalone)
   Based on Tufte CSS (https://github.com/edwardtufte/tufte-css) — MIT License.
   This theme REPLACES default.css entirely.
*/

/* =====================================================
   ET Book fonts
   ===================================================== */

@font-face {
  font-family: "et-book";
  src: url("et-book/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.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.woff") format("woff");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* =====================================================
   Tufte CSS — faithful to the GitHub repo
   ===================================================== */

html {
  font-size: 15px;
}

body {
  width: 87.5%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12.5%;
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD",
    "Book Antiqua", Georgia, serif;
  background-color: #fffff8;
  color: #111;
  max-width: 1400px;
  counter-reset: sidenote-counter;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #151515;
    color: #ddd;
  }
}

/* main.publish — just vertical padding, inherits everything else */
main.publish {
  padding: 5rem 0 0;
}

/* =====================================================
   Typography
   ===================================================== */

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

main.publish > h1:first-child {
  margin-top: 0;
}

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

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

h4 {
  font-weight: 400;
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1;
}

h5 {
  font-weight: 400;
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

h6 {
  font-weight: 400;
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1;
  color: #666;
}

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;
}

strong {
  font-weight: bold;
}

/* =====================================================
   Content width — Tufte constrains to 55% of body
   Our HTML uses main.publish instead of article > section
   ===================================================== */

main.publish > p,
main.publish > footer,
main.publish > table,
main.publish > .table-scroll,
main.publish > .callout,
main.publish > pre,
main.publish > section {
  width: 55%;
}

main.publish > dl,
main.publish > ol,
main.publish > ul {
  width: 50%;
  -webkit-padding-start: 5%;
}

blockquote p {
  width: 55%;
}

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

/* =====================================================
   Links
   ===================================================== */

a:link,
a:visited {
  color: inherit;
  text-underline-offset: 0.1em;
  text-decoration-thickness: 0.05em;
  text-decoration-skip-ink: auto;
}

/* =====================================================
   Lists
   ===================================================== */

ol,
ul {
  padding-left: 1.5rem;
}

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

li > p {
  margin-top: 0;
  margin-bottom: 0;
}

/* Task lists */
li.task-list-item {
  list-style-type: none;
  margin-left: -1.5em;
}

.task-list-item-checkbox {
  margin-right: 0.5em;
}

/* =====================================================
   Blockquotes
   ===================================================== */

blockquote {
  font-size: 1.4rem;
}

blockquote p {
  font-style: italic;
  margin-right: 40px;
}

/* =====================================================
   Horizontal rules
   ===================================================== */

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

/* =====================================================
   Code
   ===================================================== */

code,
pre > code {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 1.0rem;
  line-height: 1.42;
  -webkit-text-size-adjust: 100%;
}

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

code {
  padding: 0.15em 0.35em;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 3px;
}

pre {
  margin: 1.4rem 0;
  overflow-x: auto;
}

pre > code {
  font-size: 0.9rem;
  width: 52.5%;
  margin-left: 2.5%;
  overflow-x: auto;
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

/* =====================================================
   Kbd
   ===================================================== */

kbd {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.2em 0.45em;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.85em;
  line-height: 1.3;
  color: #111;
}

/* =====================================================
   Tables
   ===================================================== */

table {
  border-collapse: collapse;
  font-size: 1.1rem;
  margin: 1.5rem 0;
}

th,
td {
  border: 1px solid #ccc;
  padding: 0.5rem 0.75rem;
  text-align: left;
  overflow-wrap: break-word;
}

th {
  font-weight: bold;
}

/* Wide tables */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.table-scroll table {
  margin: 0;
}

/* =====================================================
   Images
   ===================================================== */

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.25rem 0;
}

/* =====================================================
   Details / collapsible
   ===================================================== */

details {
  margin: 1.25rem 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid #ccc;
  overflow-wrap: anywhere;
}

.toc {
  --jb-toc-border: #bbb;
  --jb-toc-bg: rgba(255,255,248,0.5);
  --jb-bg: #fffff8;
  --jb-muted: #666;
  --jb-toc-link: #5a7a9a;
  --jb-text: #111;
}

details[open] {
  padding-bottom: 1rem;
}

summary {
  cursor: pointer;
  font-weight: 400;
  padding: 0.25rem 0;
}

/* =====================================================
   Callouts
   ===================================================== */

.callout {
  margin: 1.25rem 0;
  border-radius: 0 8px 8px 0;
  border-left: 4px solid var(--callout-color, #2563eb);
  background: var(--callout-bg, #eff6ff);
  padding: 0.75rem 1rem;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 600;
  color: var(--callout-color, #2563eb);
  margin-bottom: 0.25rem;
}

.callout-title svg {
  flex-shrink: 0;
}

.callout-content > :first-child { margin-top: 0; }
.callout-content > :last-child { margin-bottom: 0; }

.callout-blue   { --callout-color: #2563eb; --callout-bg: #eff6ff; }
.callout-teal   { --callout-color: #0d9488; --callout-bg: #f0fdfa; }
.callout-green  { --callout-color: #16a34a; --callout-bg: #f0fdf4; }
.callout-purple { --callout-color: #7c3aed; --callout-bg: #f5f3ff; }
.callout-yellow { --callout-color: #ca8a04; --callout-bg: #fefce8; }
.callout-red    { --callout-color: #dc2626; --callout-bg: #fef2f2; }

/* =====================================================
   Heading anchor links
   ===================================================== */

:where(h1, h2, h3, h4, h5, h6) .header-anchor {
  margin-left: 0.3em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  color: #666;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

main.publish > h1:first-child .header-anchor {
  display: none;
}

:where(h1, h2, h3, h4, h5, h6):hover .header-anchor,
.header-anchor:focus-visible {
  opacity: 1;
}

.header-anchor {
  font-size: 0.9em;
  user-select: none;
}

.header-anchor__icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
  stroke-width: 1.4;
}

/* =====================================================
   Math (KaTeX)
   ===================================================== */

.katex-display {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}

/* =====================================================
   Sidenotes (Tufte-style margin notes)
   ===================================================== */

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

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

.sidenote-number:after,
.sidenote:before {
  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;
}

input.margin-toggle {
  display: none;
}

label.sidenote-number {
  display: inline-block;
  max-height: 2rem;
}

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

/* =====================================================
   Updated-at footer
   ===================================================== */

.jotbird-updated {
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD",
    "Book Antiqua", Georgia, serif !important;
  width: 55% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
}

/* =====================================================
   Watermark
   ===================================================== */

.jb-watermark {
  margin: 3.33rem 0 2rem;
  width: 55%;
  text-align: center;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.jb-watermark:hover {
  opacity: 0.8;
}

.jb-watermark img {
  width: 50px;
  height: auto;
  display: block;
  margin: 0 auto 0.6rem;
}

.jb-watermark-text {
  font-size: 0.9rem;
  color: #999;
}

.jb-watermark-text a {
  color: #777;
  text-decoration: none;
  border-bottom: none;
}

/* =====================================================
   Footnotes
   ===================================================== */

hr.footnotes-sep {
  width: 100%;
  margin-top: 3rem;
  margin-bottom: 0;
}

.footnotes {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #666;
}

.footnote-ref a {
  text-decoration: none;
  font-size: 0.75em;
}

.footnote-backref {
  text-decoration: none;
  margin-left: 0.25em;
}

/* Wrapping for long content */
p, li, .footnotes, .footnotes a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =====================================================
   Selection highlight
   ===================================================== */

::selection {
  background: rgba(255, 235, 59, 0.85);
  color: #333;
  text-shadow: none;
}

/* =====================================================
   Dark mode
   ===================================================== */

@media (prefers-color-scheme: dark) {
  h1, h2, h3, h4, h5, h6 {
    color: #ddd;
  }

  h6 {
    color: #999;
  }

  strong {
    color: #eee;
  }

  blockquote {
    color: #bbb;
  }

  hr {
    border-top-color: #333;
  }

  code {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
  }

  pre > code {
    background: transparent;
  }

  kbd {
    border-color: #444;
    color: #ddd;
  }

  th, td {
    border-color: #333;
  }

  details {
    border-bottom-color: #333;
  }

  .toc {
    --jb-toc-border: #444;
    --jb-toc-bg: rgba(255,255,255,0.03);
    --jb-bg: #151515;
    --jb-muted: #999;
    --jb-toc-link: #7ab3d4;
    --jb-text: #ddd;
  }

  .footnotes {
    color: #999;
  }

  .jb-watermark img {
    filter: invert(1);
  }

  .jb-watermark-text {
    color: #777;
  }

  .jb-watermark-text a {
    color: #999;
  }

  .callout {
    background: #1e1e1e !important;
  }
}

/* =====================================================
   Mobile
   ===================================================== */

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

  main.publish {
    padding: 2rem 0;
  }

  hr {
    width: 100%;
  }

  main.publish > p,
  main.publish > footer,
  main.publish > table,
  main.publish > .table-scroll,
  main.publish > .callout,
  main.publish > pre,
  main.publish > section {
    width: 100%;
  }

  main.publish > dl,
  main.publish > ol,
  main.publish > ul {
    width: 90%;
  }

  pre > code {
    width: 97%;
  }

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

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

  img {
    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;
  }
}

/* =====================================================
   Print
   ===================================================== */

@media print {
  html {
    font-size: 12px;
  }

  body {
    width: 100%;
    max-width: none;
    padding: 0;
    background: #fff;
    color: #111;
  }

  main.publish {
    padding: 0;
  }

  main.publish > p,
  main.publish > footer,
  main.publish > table,
  main.publish > .table-scroll,
  main.publish > .callout,
  main.publish > pre,
  main.publish > section {
    width: 100%;
  }

  main.publish > dl,
  main.publish > ol,
  main.publish > ul {
    width: 100%;
  }

  pre > code {
    width: 90%;
  }

  .jb-watermark {
    display: none;
  }
}
