.post-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 26px;
}

.post h1.post-title {
  font-size: 36px;
  margin: 8px 0 6px;
}

.post-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #e3e3e3;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.post-back-link::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
}

.post-back-link:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.post-back-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.62);
  outline-offset: 2px;
}

.post-content {
  margin-top: 4px;
  font-size: 18px;
}

.post-content h2 {
  margin-top: 28px;
}

.post-content h3 {
  margin-top: 22px;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  scroll-margin-top: 96px;
}

.post-content p {
  color: #dddddd;
}

.post-tags {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

/* Inline code */
code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

/* Code blocks */
.code-wrap {
  position: relative;
  margin: 1.5em 0;
  border-radius: 10px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  counter-reset: line;
}

/* Header bar with language and copy button */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-lang {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.code-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
}

.code-copy .icon-copy,
.code-copy .icon-check {
  pointer-events: none;
}

.code-copy .icon-check {
  display: none;
  color: #4ade80;
}

.code-copy.copied .icon-copy {
  display: none;
}

.code-copy.copied .icon-check {
  display: block;
}

/* Code container with line numbers */

.code-wrap pre {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow-x: auto;
}

.code-wrap pre code {
  display: block;
  background: transparent;
  padding: 14px 14px 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1;
  tab-size: 2;
}

.code-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-height: 1em;
}

.code-line::before {
  counter-increment: line;
  content: counter(line);
  flex: none;
  width: calc(var(--digit-width) * 0.56ch + 8px);
  margin-right: 16px;
  text-align: right;
  color: rgba(255, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1;
  user-select: none;
}

.code-line-text {
  flex: 1;
  min-width: 0;
}

blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid #666666;
  background: rgba(255, 255, 255, 0.06);
}

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  /* center within reading width */
  transform: none;
  border-radius: 8px;
}

.post-content figure {
  margin: 1rem 0;
  text-align: center;
}

.post-content figcaption {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
}

.post-content thead {
  background: rgba(255, 255, 255, 0.06);
}

.anchor-link {
  text-decoration: none;
  color: var(--muted);
  margin-left: 6px;
  opacity: 0;
  transition: opacity .15s ease;
}

.post-content h1:hover .anchor-link,
.post-content h2:hover .anchor-link,
.post-content h3:hover .anchor-link,
.post-content h4:hover .anchor-link,
.post-content h5:hover .anchor-link,
.post-content h6:hover .anchor-link {
  opacity: .8;
}

.post-content h1:focus-within .anchor-link,
.post-content h2:focus-within .anchor-link,
.post-content h3:focus-within .anchor-link,
.post-content h4:focus-within .anchor-link,
.post-content h5:focus-within .anchor-link,
.post-content h6:focus-within .anchor-link,
.anchor-link:focus-visible {
  opacity: 1;
}

.anchor-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.62);
  outline-offset: 2px;
  border-radius: 4px;
}

.post-content mjx-container[jax="SVG"] svg {
  fill: currentColor;
}

.post-content mjx-container {
  line-height: 1.2;
}

.post-content mjx-container[display="true"] {
  display: block;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.hljs,
pre code.hljs {
  color: #e6e6e6;
  background: transparent;
}

.hljs-comment,
.hljs-quote {
  color: #7f8c98;
  font-style: italic;
}

.hljs-keyword,
.hljs-doctag,
.hljs-formula {
  color: #c792ea;
}

.hljs-type,
.hljs-built_in,
.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable {
  color: #82aaff;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-meta .hljs-string {
  color: #c3e88d;
}

.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet {
  color: #f78c6c;
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-title.class_,
.hljs-class .hljs-title {
  color: #82aaff;
}

.hljs-subst,
.hljs-meta,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-selector-tag {
  color: #89ddff;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.hljs-code {
  color: #e6e6e6;
}

.minimap__container {
  position: fixed;
  top: 24px;
  right: 24px;
  left: auto;
  width: auto;
  z-index: 100;
  user-select: none;
  overflow: hidden;
  opacity: .8;
  transition: opacity .2s ease, transform .2s ease;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .35));
}

.minimap__container:hover {
  opacity: 1;
}

.minimap__size {
  position: relative;
  width: 100%;
  height: auto;
  z-index: 5;
  border-radius: 6px;
  overflow: hidden;
}

.minimap__viewer {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  z-index: 10;
  border: 1px solid #ffffff22;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  will-change: transform;
  cursor: grab;
  touch-action: none;
}

.minimap__viewer.dragging {
  cursor: grabbing;
}

.minimap__content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform-origin: 0 0;
  border: none;
  pointer-events: none;
  border-radius: 6px;
  background: #0b0b0b;
  will-change: transform;
}

@media (max-width: 1024px) {
  .minimap__container {
    display: none;
  }
}

@media (max-width: 640px) {
  .post-back-link {
    margin-bottom: 6px;
    padding: 5px 10px 5px 9px;
    font-size: 12px;
  }

  .post h1.post-title {
    font-size: 31px;
  }
}
