@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/EBGaramond-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/EBGaramond-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/EBGaramond-Italic.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/EBGaramond-Italic.woff2') format('woff2');
}

@font-face {
  font-family: 'unscii 16';
  src: url('fonts/unscii-16.woff') format('woff');
  font-display: swap;
}

@font-face {
  font-family: 'KaTeX_Typewriter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2') format('woff2');
}

* { box-sizing: border-box; }

body { margin: 0; }

.theme-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.site {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #555555;
  --link: #00386e;
  --border: #d9d9d9;
  --code-bg: #f5f3ee;
  --tok-kw: #0f3b8c;
  --tok-str: #1e6b3a;
  --tok-com: #767676;
  --tok-num: #a64d00;
  --tok-ti: #5a3e91;
  --tok-attr: #a64d00;
  --tok-meta: #767676;

  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "EB Garamond", Georgia, "Times New Roman", Times, serif;
  line-height: 1.4;
  font-size: 19px;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  -webkit-hyphenate-limit-chars: 6 3 2;
  hyphenate-limit-chars: 6 3 2;
}

html.dark body {
  background: #182a0f;
}

html.dark .site {
  --bg: #182a0f;
  --fg: #ffffff;
  --muted: #a9c0a6;
  --link: #9ed6a8;
  --border: #3a5240;
  --code-bg: #243a2c;
  --tok-kw: #9db4ff;
  --tok-str: #9ed6a8;
  --tok-com: #8d9c8d;
  --tok-num: #e8c08a;
  --tok-ti: #c9b8ff;
  --tok-attr: #e8c08a;
  --tok-meta: #8d9c8d;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  min-width: 0;
  font-size: 1.3rem;
  color: var(--fg);
  text-decoration: none;
}

.site-title:hover { color: var(--link); }

nav {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
}

nav a {
  color: var(--link);
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: 0.03em;
}

nav a:hover { text-decoration: underline; }

nav a.nav-active {
  border-bottom: 2px solid var(--link);
}

.theme-button {
  cursor: pointer;
  user-select: none;
  padding: 0.05em 0.5em;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.theme-button:hover {
  color: var(--fg);
  background: var(--code-bg);
}

#theme-toggle:focus-visible ~ .site .theme-button {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

html.dark .site .theme-button {
  color: var(--fg);
  border-color: var(--link);
}

.theme-button .icon { font-size: 1.1em; }

.icon-sun { display: none; }

html.dark .site .icon-moon { display: none; }

html.dark .site .icon-sun { display: inline; }

html.dark .site img.invert,
html.dark .site .graph svg.invert { filter: invert(1) hue-rotate(180deg); }

.light-img { display: block; }
.dark-img  { display: none; }
html.dark .site .light-img { display: none; }
html.dark .site .dark-img  { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

main {
  --content-width: 46rem;
  max-width: var(--content-width);
  margin: 0 round(calc(50vw - var(--content-width) / 2), 1px);
  padding: 1.5rem 1.5rem 2.5rem;
}

h1, h2, h3, h4, h5, h6 {
  text-align: left;
}

h1 {
  line-height: 1.25;
  margin: 0.3em 0 0.5em;
}

h2 { margin-top: 1.0em; }

h3 { margin-top: 0.4em; }
h4 { margin-top: 0.5em; }

.post-date {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -0.25em 0 1em;
}

a { color: var(--link); }

blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

table {
  border-collapse: collapse;
  margin: 1em 0;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.3em 0.8em;
}

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

code {
  font-family: "KaTeX_Typewriter", "DejaVu Sans Mono", "Liberation Mono", Consolas, monospace;
  font-size: 16px;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.9em 1em;
  overflow-x: auto;
  line-height: 1;
  -webkit-font-smoothing: none;
  font-smooth: never;
  transform: translateZ(0);
}

pre code {
  font-family: "unscii 16", "DejaVu Sans Mono", "Liberation Mono", Consolas, monospace;
  background: none;
  padding: 0;
}

figure {
  margin: 1.5em auto;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  color: var(--fg);
}

figure video {
  max-width: 100%;
  height: auto;
}

figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5em;
}

.graph {
  margin: 2em auto;
  text-align: center;
  max-width: 600px;
}

.graph svg {
  width: 100%;
  height: auto;
}

.graph svg text {
  font-family: "KaTeX_Main", Georgia, serif;
  font-size: 16px;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1.5em;
  padding: 0.4em 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child { border-bottom: none; }

.post-list .post-date {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.katex-display {
  margin: 1.25em 0;
  padding: 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.hljs-comment, .hljs-doctag, .hljs-prompt { color: var(--tok-com); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-template-tag { color: var(--tok-kw); }
.hljs-string, .hljs-quote, .hljs-regexp { color: var(--tok-str); }
.hljs-number, .hljs-literal, .hljs-attr, .hljs-attribute { color: var(--tok-num); }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--tok-ti); }
.hljs-type, .hljs-title.class_, .hljs-built_in, .hljs-builtin-name { color: var(--tok-ti); }
.hljs-meta, .hljs-symbol, .hljs-bullet, .hljs-link, .hljs-variable { color: var(--tok-meta); }
.hljs-params { color: var(--fg); }

pre.shiki {
  overflow-x: auto;
}
html.dark pre.shiki span[style*="--shiki-dark"] {
  color: var(--shiki-dark) !important;
}

footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.social-links {
  margin-left: auto;
  display: flex;
  gap: 0.75em;
}

.social-link {
  display: inline-flex;
  align-items: baseline;
  color: #111111;
  text-decoration: none;
}

html.dark .site .social-link {
  color: #ffffff;
}

.social-link svg {
  width: 1.65em;
  height: 1.65em;
  vertical-align: -0.2em;
}

@media (max-width: 46rem) {
  header, main, footer {
    --content-width: 100%;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  nav {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
  }
  .site-title {
    font-size: 1.1rem;
  }
}

.note {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
  font-size: 0.8em;
  color: var(--muted);
}

.note::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--code-bg);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.note::after {
  content: attr(data-note);
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4em 0.6em;
  font-size: 0.85em;
  white-space: normal;
  min-width: 20rem;
  max-width: 20rem;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  line-height: 1.3;
  color: var(--fg);
}

.note:hover::before,
.note:focus::before {
  opacity: 1;
}

.note:hover::after,
.note:focus::after {
  display: block;
}

.portfolio-cards {
  display: grid;
  gap: 2rem;
  margin-top: 1.5rem;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  min-width: 10rem;
  background: var(--code-bg);
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 1.2em;
}

.card-description {
  margin: 0;
}

.card-description > p:first-child {
  margin-top: 0;
}

.card-description > p:last-child {
  margin-bottom: 0;
}

.card-description ul {
  margin: 0.5em 0;
}

.card-links {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-link {
  display: inline-block;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.1em 0.5em;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--link);
}

.card-link:hover {
  background: var(--bg);
}

.card-link-text {
  display: inline-block;
  font-size: 0.85em;
  color: var(--muted);
  padding: 0.1em 0.5em;
  border: 1px solid var(--border);
  border-radius: 3px;
}

sup.footnote-ref {
  font-size: inherit;
  vertical-align: baseline;
}

.footnote {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--border);
  font-size: 0.9em;
}

.footnote ol {
  padding-left: 1.5em;
  margin: 0;
}

.footnote li {
  padding: 0.3em 0;
}

.footnote a.footnote-backref {
  display: none;
}

.katex .base {
  max-width: 100%;
  width: auto;
}

/* markdown-it-texmath (apt package) */
/* style for html inside of browsers */
.katex { font-size: 1em !important; } /* align KaTeX font-size to surrounding text */

eq { display: inline-block; }
eqn { display: block}
section.eqno {
    display: flex;
    flex-direction: row;
    align-content: space-between;
    align-items: center;
}
section.eqno > eqn {
    width: 100%;
    margin-left: 3em;
}
section.eqno > span {
    width:3em;
    text-align:right;
}
