.article-page {
  --max-w: 1176px;
  font-weight: 400;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.article-layout {
  max-width: var(--max-w);
  width: 100%;
  margin-inline: auto;
  padding: clamp(24px, 5vh, 60px) 24px 0;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 48px clamp(32px, 6vw, 88px);
  overflow-wrap: anywhere;
}

.article-reader {
  min-height: 0;
  overflow-y: auto;
  padding-inline: 4px;
}

.article-reader .footer-portfolio .wrap { padding: 0; }

.article-heading {
  margin-bottom: 28px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--rule);
}

.article-heading h1 {
  max-width: 24ch;
  margin: 20px 0;
  font-size: 44px;
  font-weight: 550;
  letter-spacing: -0.045em;
  line-height: 1.04;
  text-wrap: balance;
}

.article-heading a,
.article-index a,
#post-meta {
  color: var(--ink-dim);
  font-size: 15px;
}

.article-layout a {
  color: inherit;
  text-underline-offset: 0.18em;
}

.article-index {
  min-height: 0;
  overflow-y: auto;
}

.article-index, .article-reader { scrollbar-width: none; }
.article-index::-webkit-scrollbar, .article-reader::-webkit-scrollbar { display: none; }

.article-index h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

#post-toc a {
  display: block;
  padding: 4px 0;
  color: var(--ink-dim);
  text-decoration: none;
}

#post-toc a:hover { text-decoration: underline; }

.article-copy {
  min-width: 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-mid);
}

.article-copy > * + * { margin-top: 1em; }
.article-copy :is(h1, h2, h3, h4) {
  color: var(--ink);
  font-weight: 550;
  line-height: 1.2;
  scroll-margin-top: 12px;
}
.article-copy h3 { font-size: 1.15em; }
.article-copy :is(ol, ul) { padding-inline-start: 1.3em; }
.article-copy img { max-width: 100%; height: auto; }
.article-copy pre, .article-copy table { max-width: 100%; overflow-x: auto; }
.article-copy table { display: block; }

.code-block {
  --syntax-comment: #929292;
  --syntax-keyword: #ff826f;
  --syntax-string: #a2d8ff;
  --syntax-function: #d4adff;
  --syntax-tag: #97dc95;
  --syntax-class: #ffb268;
  --syntax-attribute: #83c9fe;
}
[data-theme="light"] .code-block {
  --syntax-comment: #656565;
  --syntax-keyword: #a72d24;
  --syntax-string: #075c81;
  --syntax-function: #71439a;
  --syntax-tag: #22642c;
  --syntax-class: #8b4a06;
  --syntax-attribute: #155f85;
}
.code-block {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--ink);
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-dim);
  font-size: 12px;
}
.code-bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-family: inherit;
  cursor: pointer;
}
.code-bar button::before {
  content: "";
  width: 7px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  box-shadow: -2px -2px var(--surface-soft), -3px -3px currentColor;
}
.code-bar button:hover { color: var(--ink); }
.code-rows {
  display: flex;
  gap: 15px;
  padding: 14px 18px;
  overflow-x: auto;
  font: 13px/22px "Geist Mono", ui-monospace, Consolas, monospace;
}
.code-numbers {
  white-space: pre;
  text-align: right;
  color: var(--ink-dim);
  user-select: none;
}
.code-rows pre, .code-rows code {
  margin: 0;
  font: inherit;
  white-space: pre;
}
.article-copy .code-rows pre { flex: none; max-width: none; overflow: visible; }
.code-block .token.comment, .code-block .token.punctuation { color: var(--syntax-comment); }
.code-block .token.keyword, .code-block .token.operator { color: var(--syntax-keyword); }
.code-block .token.string, .code-block .token.attr-value { color: var(--syntax-string); }
.code-block .token.function, .code-block .token.number { color: var(--syntax-function); }
.code-block .token.tag { color: var(--syntax-tag); }
.code-block .token.class-name, .code-block .token.boolean { color: var(--syntax-class); }
.code-block .token.attr-name { color: var(--syntax-attribute); }
.article-copy blockquote { padding-left: 0.8em; border-left: 2px solid var(--rule); }

@media (max-width: 760px), (max-width: 1176px) and (orientation: portrait) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-index { display: none; }
}
