body {
  font-family: "Karla", system-ui, -apple-system, sans-serif;
  background-color: #FBF9F6;
  background-image: repeating-linear-gradient(-45deg, #F5F1EB 0, #F5F1EB 1px, transparent 0, transparent 50%);
  background-size: 10px 10px;
  background-attachment: fixed;
  color: #4A443C;
}
h1, h2, h3, h4, h5, h6 {
  font-family: "Gowun Batang", Georgia, serif;
  color: #4A443C;
}

.copy-link-button {
  transition: color 150ms ease;
}
.copy-link-button [data-copy-icon] {
  display: inline-block;
  transition: transform 150ms ease;
}
.copy-link-button[data-copy-state="success"] {
  color: #15803d;
}
.copy-link-button[data-copy-state="success"] [data-copy-icon] {
  transform: scale(1.2);
}
.copy-link-button[data-copy-state="error"] {
  color: #b91c1c;
}

.note-body {
  line-height: 1.65;
  word-wrap: break-word;
}
.note-body > :first-child {
  margin-top: 0;
}
.note-body h1,
.note-body h2,
.note-body h3,
.note-body h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.note-body h1 { font-size: 1.9rem; }
.note-body h2 { font-size: 1.5rem; }
.note-body h3 { font-size: 1.25rem; }
.note-body p,
.note-body ul,
.note-body ol,
.note-body blockquote,
.note-body pre,
.note-body table {
  margin: 0.75em 0;
}
.note-body ul { list-style: disc; padding-left: 1.5rem; }
.note-body ol { list-style: decimal; padding-left: 1.5rem; }
/* Nested lists must hug their parent item — the 0.75em block margin above is
   meant for top-level lists only; on a sub-list it adds a gap before the first
   sub-item and after the last. */
.note-body li > ul,
.note-body li > ol {
  margin-top: 0;
  margin-bottom: 0;
}
.note-body a { color: #4338ca; text-decoration: underline; }
.note-body a:hover { color: #3730a3; }
.note-body code {
  background: #f4f1ea;
  border: 1px solid #e7e2d7;
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
}
.note-body pre {
  background: #faf8f3;
  border: 1px solid #e7e2d7;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}
.note-body pre code {
  background: transparent;
  border: none;
  padding: 0;
}
.note-body blockquote {
  border-left: 3px solid #d6cfc2;
  padding-left: 1rem;
  color: #6b635a;
  font-style: italic;
}
.note-body table {
  border-collapse: collapse;
  width: 100%;
}
.note-body th,
.note-body td {
  border: 1px solid #e7e2d7;
  padding: 0.4rem 0.7rem;
  text-align: left;
}
.note-body th { background: #f4f1ea; }
.note-body hr {
  border: none;
  border-top: 1px solid #e7e2d7;
  margin: 1.5rem 0;
}
.note-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.note-body .mermaid {
  margin: 0.75em 0;
  overflow-x: auto;
}
.note-body .mermaid svg {
  max-width: 100%;
  height: auto;
}
.note-body li.task-item {
  list-style: none;
  margin-left: -1.25rem;
}
.note-body li.task-item > input[type="checkbox"] {
  margin-right: 0.5rem;
  vertical-align: baseline;
  transform: translateY(1px);
}

/* Keep note cards at the same reading width with or without a comment rail. */
.note-page-width {
  max-width: 54rem;
}
.note-view-layout > article,
.note-comments-layout > .comment-rail {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}
.comment-composer > summary {
  list-style: none;
}
.comment-composer > summary::-webkit-details-marker {
  display: none;
}
.comment-composer[open] > summary {
  border-bottom: 1px solid #e7e2d7;
}
.comment-composer[open] .comment-composer-icon {
  transform: rotate(45deg);
}
.comment-composer-icon {
  transition: transform 150ms ease;
}
.comment-thread-list {
  transition: opacity 150ms ease;
}
.comment-rail.is-adding-comment .comment-thread-list {
  opacity: 0.28;
}

@media (min-width: 1200px) {
  .note-header-width--comments {
    max-width: 75rem;
  }
  .note-header-width--empty {
    max-width: 69rem;
  }
  .note-comments-layout {
    display: grid;
    grid-template-columns: minmax(0, 52rem) 20rem;
    gap: 1rem;
    align-items: start;
    justify-content: center;
  }
  .note-comments-layout > article,
  .note-comments-layout > .comment-rail {
    max-width: none;
    margin: 0;
  }
  .note-comments-layout > .comment-rail {
    margin-top: 0;
  }
  .note-comments-layout--empty {
    grid-template-columns: minmax(0, 52rem) 14rem;
  }
  .note-comments-layout .comment-rail [data-comment-quote] {
    display: none;
  }
  .note-comments-layout .comment-composer.is-floating {
    position: fixed;
    top: 1rem;
    z-index: 5;
  }
  .comment-thread-list.is-positioned {
    position: relative;
  }
  .comment-thread-list.is-positioned > .comment-thread {
    position: absolute;
    left: 0;
    right: 0;
    margin-top: 0 !important;
  }
}

/* Anchored comments: highlights in the note, the selection popover, and the
   pairing between a highlight and its thread item. */
mark.comment-highlight {
  background: rgba(251, 191, 36, 0.28);
  color: inherit;
  border-bottom: 1px solid rgba(217, 119, 6, 0.55);
  border-radius: 2px;
  cursor: pointer;
}
mark.comment-highlight.is-active { background: rgba(251, 191, 36, 0.6); }
mark.comment-highlight.is-pending {
  background: rgba(99, 102, 241, 0.16);
  border-bottom-color: rgba(79, 70, 229, 0.5);
  cursor: text;
}
.comment-popover {
  position: absolute;
  z-index: 20;
  padding: 0.3rem 0.75rem;
  font: 500 0.8rem/1.4 "Karla", system-ui, sans-serif;
  color: #fff;
  background: #4338ca;
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  user-select: none;
}
.comment-popover:hover { background: #3730a3; }
#comments li.comment {
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
#comments li.comment-thread {
  background-color: rgba(255, 255, 255, 0.68);
}
#comments li.comment-thread:hover,
#comments li.comment-thread:focus-within {
  background-color: #fff;
}
#comments li.comment-thread:hover {
  border-color: #d6cfc2;
}
#comments li.comment > [data-comment-header] [data-confirm-delete] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
#comments li.comment:hover > [data-comment-header] [data-confirm-delete],
#comments li.comment:focus-within > [data-comment-header] [data-confirm-delete] {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  #comments li.comment > [data-comment-header] [data-confirm-delete] {
    opacity: 1;
    pointer-events: auto;
  }
}
#comments li.comment-thread:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.45);
  outline-offset: 2px;
}
#comments li.comment-thread > [data-reply-control][open] {
  margin-top: 0.5rem;
}
#comments li.comment-reply {
  position: relative;
}
#comments li.comment-reply::before {
  content: "";
  position: absolute;
  top: 0.15rem;
  bottom: 0.15rem;
  left: -0.75rem;
  width: 2px;
  border-radius: 999px;
  background: #f0ede7;
}
#comments li.comment.is-active {
  background: rgba(251, 191, 36, 0.08);
}
#comments li.is-anchored > [data-comment-quote] { cursor: pointer; }
#comments li.is-anchored > [data-comment-quote]:hover { color: #4A443C; }
#comments li.is-orphaned > [data-comment-quote] {
  border-left-color: #d6cfc2;
  text-decoration: line-through;
}
