/* =========================================================================
   Fonts
   ========================================================================= */

@font-face {
  font-family: "hoefler";
  src: url("/assets/fonts/hoefler.ttf");
}

/* =========================================================================
   Reset / Base
   ========================================================================= */

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

html {
  overflow-y: scroll;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: #000;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
}

img { max-width: 100%; }

a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.5; }

a[href^="http"]::after {
  content: "↗";
  font-size: 0.65em;
  vertical-align: super;
  margin-left: 0.15em;
  opacity: 0.5;
}
.site-nav a::after,
.posts-list__link::after,
.posts-list__thumbnail a::after { content: none; }

pre {
  margin: 0 0 1.45rem;
  font-size: 0.85rem;
  line-height: 1.6;
  background: #f7f7f7;
  border-radius: 3px;
  overflow: auto;
  padding: 1rem 1.25rem;
}

code { font-size: 0.85rem; }

blockquote {
  border-left: 3px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  background: rgba(255, 220, 0, 0.04);
  margin: 1.2em 0;
  padding: 0.6em 1em;
  color: rgba(0,0,0,0.75);
}

table {
  font-size: 1rem;
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.45rem;
}

th, td {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(0,0,0,0.08);
}


/* =========================================================================
   Reading progress bar
   ========================================================================= */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: #000;
  z-index: 1000;
  transition: width 0.08s linear;
}

/* =========================================================================
   Header / Nav
   ========================================================================= */

.site-header {
  background: #fff;
  border-bottom: 0.5px solid #e0e0e0;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: 25%;
  margin-right: 25%;
  padding: 15px 1.25rem;
}

.site-nav__logo {
  font-size: 22px;
  font-weight: 700;
  color: #000;
}

.site-nav__links {
  display: flex;
  gap: 24px;
}

.site-nav__links a {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: #000;
}

/* =========================================================================
   Page (static pages: home, about, etc.)
   ========================================================================= */

.page {
  font-family: inherit;
  color: rgba(0,0,0,0.8);
  line-height: 1.7em;
}

.page__body {
  margin-left: 25%;
  margin-right: 25%;
  padding: 1rem 1.25rem;
}

.page__body h1 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 42px;
  margin: 0.5rem 0 0.66rem;
}

.page__body p {
  font-weight: 400;
  font-size: 16px;
  line-height: 27px;
  color: rgb(15, 23, 42);
  margin: 1em 0;
}

.page__body p a {
  border-bottom: 1px solid rgba(0,0,0,0.4);
}
.page__body a{
  border-bottom: 1px solid rgba(0,0,0,0.4);
}


/* =========================================================================
   Post
   ========================================================================= */

.post {
  font-family: inherit;
  color: rgba(0,0,0,0.8);
  line-height: 1.7em;
}

/* -- Post info header -- */

.post__info {
  padding: 0.75rem 1.25rem;
  margin-left: 25%;
  margin-right: 25%;
}

.post__info h1 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 42px;
  margin: 0 0 0.33rem;
  margin-top: 20px;
  line-height: 52px;
}

.post__excerpt {
  font-weight: 400;
  font-size: 16px;
  line-height: 27px;
  color: rgb(15, 23, 42);
  margin: 0 0 0.33rem;
  line-height: 1.7em;
}

.post__rule {
  padding: 3px 0;
  border: none;
  position: relative;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}
.post__rule::before {
  content: "";
  display: block;
  position: absolute;
  left: 0; right: 0;
  border-bottom: 0.5px solid #e0e0e0;
}

.post__byline {
  display: flex;
  gap: 50px;
  font-size: 12px;
  line-height: 1.7;
  padding: 8px 0;
}

.post__byline > div {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post__byline span {
  line-height: 1;
}

.post__byline h3 {
  font-size: 0.65rem;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

/* -- Post layout -- */

.post__wrapper {
  display: flex;
  width: 100%;
}


.post__toc,
.note__toc {
  flex-basis: 25%;
}

.post__toc > div,
.note__toc > div {
  padding: 0 3rem 0 0;
  position: sticky;
  top: 2rem;
  max-width: 220px;
  margin-left: auto;
}
.post__toc > div::after,
.note__toc > div::after {
  content: "";
  position: absolute;
  right: 1.5rem;
  top: 0;
  bottom: 0;
  border-right: 1px solid rgba(0,0,0,0.08);
}


.post__toc h3,
.note__toc h3 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.6rem;
  color: rgba(0,0,0,0.4);
}

.post__toc ul, .note__toc ul { margin-top: 0; list-style: none; padding: 0; }
.post__toc li, .note__toc li { margin: 0; }
.post__toc ul li ul, .note__toc ul li ul { margin-left: 1rem; }
.post__toc a, .note__toc a { font-size: 13px; font-weight: 400; line-height: 1.3; display: block; padding: 3px 0; margin-bottom: 4px; }
.post__toc ul li li a, .note__toc ul li li a { font-size: 12px; opacity: 0.8; }
.post__toc a.toc-active, .note__toc a.toc-active { color: #000; opacity: 1; font-weight: 600; position: relative; }
.post__toc a.toc-active::before,
.note__toc a.toc-active::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #000;
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
}
.post__toc a:not(.toc-active), .note__toc a:not(.toc-active) { opacity: 0.5; }

.post__body {
  flex: 1;
  min-width: 0;
  margin: 0 0 48px;
  padding: 0 1.25rem;
}

.post__right { flex-basis: 25%; }

/* -- Post body content -- */

.post-content p {
  font-weight: 400;
  font-size: 16px;
  line-height: 27px;
  color: rgb(15, 23, 42);
  margin: 1em 0;
}

.post-content h2, .post-content h3 { margin-left: 0; }

.post-content h2 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 24px;
  font-weight: 700;
  margin: 1.75em 0 1.75em;
  line-height: 1.3em;
  padding-bottom: 0.35em;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
}

.post-content h3 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  /* letter-spacing: 0.06em; */
  line-height: 1.4em;
  margin: 2em 0 0.6em;
  color: #000;
}

.post-content h1:target,
.post-content h2:target,
.post-content h3:target,
.post-content h4:target {
  background: #fffbccc5;
  border-radius: 3px;
  padding: 0.1em 0.3em;
  margin-left: -0.3em;
}

.post-content a {
  border-bottom: 1px solid rgba(0,0,0,0.4);
}

.post-content ul {
  list-style: initial;
  padding-left: 1.45rem;
  margin-bottom: 1.45rem;
}

.post-content ol {
  padding-left: 1.45rem;
  margin-bottom: 1.45rem;
}

.post-content li {
  line-height: 1.7em;
}

.post__body.post-content hr {
  display: none;
}

.note__body.post-content hr {
  border: none;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  margin: 1.5em 0;
}

/* -- Callouts -- */
.callout {
  border-left: 3px solid #aaa;
  border-radius: 4px;
  background: #f9f9f9;
  margin: 1.2em 0;
  padding: 0.6em 1em;
}
.callout-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4em;
  color: #555;
}
.callout-body {
  font-size: 16px;
  line-height: 27px;
  color: rgb(15, 23, 42);
}
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }

.callout-note, .callout-info { border-color: #2A7AE2; }
.callout-note .callout-title, .callout-info .callout-title { color: #2A7AE2; }

.callout-warning, .callout-caution, .callout-attention { border-color: #e0a000; }
.callout-warning .callout-title, .callout-caution .callout-title, .callout-attention .callout-title { color: #b07800; }

.callout-danger, .callout-error { border-color: #d9534f; }
.callout-danger .callout-title, .callout-error .callout-title { color: #d9534f; }

.callout-success, .callout-check, .callout-done { border-color: #3aaa5e; }
.callout-success .callout-title, .callout-check .callout-title, .callout-done .callout-title { color: #3aaa5e; }

.callout-tip, .callout-hint { border-color: #17a2b8; }
.callout-tip .callout-title, .callout-hint .callout-title { color: #17a2b8; }

.post-content {
  counter-reset: figure;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.post-content figure {
  position: relative;
  margin: 1.5rem 0 2rem;
  counter-increment: figure;
}

.post-content figure img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.note__body img {
  display: block;
  max-width: 100%;
  margin: 1em auto;
}

.post-content figcaption {
  position: absolute;
  left: calc(100% + 1.25rem);
  top: 8px;
  width: calc(25vw - 2.5rem);
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0,0,0,0.65);
  font-style: italic;
}

.post-content figcaption::before {
  content: "Figure " counter(figure) ". ";
  font-style: normal;
  font-weight: 700;
  color: #000;
}

/* -- Citation section (inline with post) -- */

.post__citation-section {
  margin-left: 25%;
  margin-right: 25%;
  padding: 0.5rem 1.25rem 1rem;
}

.post__citation-section h2 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 0.6em;
  line-height: 1.3em;
  padding-bottom: 0.35em;
  border-bottom: 0.5px solid #e0e0e0;
}

.post__citation-section p {
  font-size: 16px;
  line-height: 27px;
  color: rgb(15, 23, 42);
  margin: 1em 0;
}

@media (max-width: 900px) {
  .post__citation-section { margin-left: 0; margin-right: 0; }
}

/* -- Post footer -- */

.post__footer {
  min-width: 100%;
  border-top: 0.5px solid #e0e0e0;
  background: #f7f7f6;
  padding-bottom: 48px;
}

.post__footer__item {
  padding-top: 48px;
  margin-left: 25%;
  margin-right: 25%;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.post__footer__item p,
.post__footer__item li {
  font-size: 13px;
  color: rgba(0,0,0,0.5);
}

.post__footer__item h3 {
  font-size: 16px;
  font-weight: 700;
  color: rgba(0,0,0,0.65);
  margin-bottom: 12px;
}

.post__footer__item ul { list-style: disc; margin-left: 3rem; }

.post__citation {
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  padding: 12px 18px;
  border-radius: 4px;
  color: rgba(0,0,0,0.5);
  word-break: break-word;
  margin-bottom: 20px;
  white-space: pre-wrap;
}

.post__references { list-style: decimal; padding-left: 1.5rem; }
.post__references li { font-size: 13px; color: rgba(0,0,0,0.5); margin-bottom: 1rem; }

/* -- Citation hover -- */

.citation {
  cursor: default;
  white-space: nowrap;
  font-size: 85%;
  display: inline-block;
  line-height: 1.1em;
  text-align: center;
  position: relative;
  top: -4px;
  margin: 0 2px;
}

.citation__label {
  color: rgba(0, 0, 0, 0.45);
}

.citation__hoverbox {
  position: fixed;
  padding: 12px 14px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #dadada;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.citation__hoverbox-title { font-weight: 500; margin-bottom: 4px; color: rgb(15, 23, 42); }
.citation__hoverbox-meta { color: #666; margin-top: 2px; }

/* -- Wikilinks -- */

.wikilink-unpublished {
  color: rgba(0,0,0,0.35);
  cursor: default;
  border-bottom: 1px dashed rgba(0,0,0,0.2);
}

/* =========================================================================
   Note
   ========================================================================= */

.note {
  margin-left: 0;
  margin-right: 0;
  padding: 1.5rem 0;
}

.note__wrapper {
  display: flex;
  width: 100%;
}

.note__header {
  margin-bottom: 2rem;
}

.note__body h1 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 28px;
  margin: 1.25rem 0 0;
}

.note__byline {
  font-size: 12px;
  color: rgba(0,0,0,0.4);
  line-height: 1.7;
  padding: 8px 0;
  margin-top: 0.75rem;
  border-top: 0.5px solid #e0e0e0;
  border-bottom: 0.5px solid #e0e0e0;
}

.note__byline__label {
  /* font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: rgba(0,0,0,0.5); */
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.6rem;
  color: rgba(0,0,0,0.4);
}

.note__byline__sep {
  color: rgba(0,0,0,0.65);
  padding: 0 0.4rem;
}

.note__body {
  flex: 1;
  min-width: 0;
  padding: 0 1.25rem;
  margin-bottom: 3rem;
}

.note__right { flex-basis: 25%; }

.note__backlinks {
  flex-basis: 25%;
  align-self: flex-start;
  padding: 0 0 0 3rem;
  position: sticky;
  top: 2rem;
}
.note__backlinks::before {
  content: "";
  position: absolute;
  left: 1.5rem;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(0,0,0,0.08);
}

.note__backlinks h3 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.6rem;
  color: rgba(0,0,0,0.4);
}

.note__backlinks ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.note__backlinks li { margin-bottom: 0.4rem; }

.note__backlinks a {
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.2);
}

/* =========================================================================
   Blog / Posts index
   ========================================================================= */

.posts-index {
  font-family: inherit;
  color: rgba(0,0,0,0.8);
  line-height: 1.7em;
  margin-top: 50px;
}

.posts-list {
  list-style: none;
  padding: 0;
  margin-left: 25%;
  margin-right: 25%;
}

.posts-list hr {
  border: none;
  padding: 20px 0;
  position: relative;
}
.posts-list hr::before {
  content: "";
  display: block;
  position: absolute;
  left: 0; right: 0;
  border-bottom: 0.5px solid #e0e0e0;
}

.posts-list__link {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 10px 1.25rem;
  text-decoration: none;
  color: inherit;
}

.posts-list__date {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0,0,0,0.4);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.posts-list__info { flex: 1; }

.posts-list__info h2 {
  font-family: "hoefler", "Georgia", serif;
  font-size: 24px;
  margin: 0 0 0.5rem;
}

.posts-list__info p {
  font-size: 16px;
  line-height: 1.7em;
  margin: 0;
  color: rgba(0,0,0,0.7);
}

.posts-list__thumbnail {
  min-width: 200px;
  max-width: 200px;
}

.posts-list__thumbnail img {
  max-width: 200px;
  object-fit: contain;
}

/* =========================================================================
   Peek popup (hover preview for internal note links)
   ========================================================================= */

#peek-popup {
  position: fixed;
  z-index: 1000;
  width: 680px;
  max-width: calc(100vw - 16px);
  max-height: 520px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dadada;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 1rem 1.25rem;
}

.peek__title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.peek__body {
  font-size: 0.85rem;
}

/* =========================================================================
   Responsive
   ========================================================================= */


@media (max-width: 900px) {
  .site-nav { margin-left: 0; margin-right: 0; }
  .post__toc,
  .note__toc,
  .post__right { display: none; }
  .post__info { margin-left: 0; margin-right: 0; }
  .post__body { padding: 0 1.25rem 1.5rem; }
  .posts-list { margin-left: 0; margin-right: 0; }
  .page__body { margin-left: 0; margin-right: 0; }
  .note { margin-left: 0; margin-right: 0; padding: 1.5rem 0; }
  .note__wrapper { flex-direction: column; }
  .note__right { display: none; }
  .note__backlinks { width: 100%; padding: 1.5rem 1.25rem 0; border-top: 0.5px solid #e0e0e0; position: static; }
  .note__backlinks::before { display: none; }
  .post-content figcaption { position: static; width: auto; margin-top: 0.5rem; }
}

@media (max-width: 768px) {
  .posts-list__link { flex-direction: column; padding: 1.5rem 1.25rem; }
  .posts-list__thumbnail { min-width: unset; max-width: 100%; padding-top: 10px; }
  .post__info { text-align: left; }
}
