/* コードブロック（<pre class="code-block"><code class="language-xxx">）。
   エディタ風の暗い配色（VS Code Dark+ 準拠）＋上部バー（言語名・コピーボタン）。
   色分けは assets/js/vendor/prism.min.js、ボタンは assets/js/code-block.js。
   本文に code-block がある記事だけ読み込む。素の <pre> には当てない（既存記事に影響させない）。
   上部バーの高さは padding-top で先に確保しておき、JS でボタンが入っても本文がずれないようにする。 */

.post .post-main pre.code-block {
  position: relative;
  margin: 20px 0 24px;
  padding: 38px 0 0;
  background: #1e1e1e;
  border: 1px solid #2d2d2d;
  border-radius: 10px;
  overflow: hidden;
  font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.post .post-main pre.code-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 38px;
  background: #2d2d30;
  border-bottom: 1px solid #3c3c3c;
}

.post .post-main pre.code-block > code {
  display: block;
  margin: 0;
  padding: 14px 18px 16px;
  background: transparent !important;
  color: #d4d4d4 !important;
  border: 0;
  border-radius: 0;
  font-family: inherit !important;
  font-size: 0.86rem;
  line-height: 1.7;
  tab-size: 4;
  /* サイト全体の方針どおり横スクロールさせずに折り返す。単語の途中では極力切らない */
  white-space: pre-wrap;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

/* 上部バーの言語名 */
.post .post-main pre.code-block .code-block__label {
  position: absolute;
  top: 0; left: 16px;
  height: 38px;
  display: flex;
  align-items: center;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9ca3af;
  z-index: 1;
}

/* コピーボタン */
.post .post-main pre.code-block .code-block__copy {
  position: absolute;
  top: 6px; right: 8px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: #d4d4d4;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  z-index: 1;
}
.post .post-main pre.code-block .code-block__copy:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.post .post-main pre.code-block .code-block__copy:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.post .post-main pre.code-block .code-block__copy.is-copied {
  color: #4ec9b0;
  border-color: rgba(78, 201, 176, 0.5);
}
.post .post-main pre.code-block .code-block__copy svg { flex-shrink: 0; }

/* ===== トークンの色（Prism の .token.*） ===== */
.post .post-main pre.code-block .token { background: none; }
.post .post-main pre.code-block .token.comment,
.post .post-main pre.code-block .token.prolog { color: #6a9955; }
.post .post-main pre.code-block .token.string,
.post .post-main pre.code-block .token.attr-value,
.post .post-main pre.code-block .token.value,
.post .post-main pre.code-block .token.char { color: #ce9178; }
.post .post-main pre.code-block .token.number { color: #b5cea8; }
.post .post-main pre.code-block .token.boolean,
.post .post-main pre.code-block .token.keyword,
.post .post-main pre.code-block .token.important,
.post .post-main pre.code-block .token.constant { color: #569cd6; }
.post .post-main pre.code-block .token.function { color: #dcdcaa; }
.post .post-main pre.code-block .token.variable,
.post .post-main pre.code-block .token.parameter,
.post .post-main pre.code-block .token.property,
.post .post-main pre.code-block .token.attr-name,
.post .post-main pre.code-block .token.key { color: #9cdcfe; }
.post .post-main pre.code-block .token.section,
.post .post-main pre.code-block .token.selector,
.post .post-main pre.code-block .token.class-name,
.post .post-main pre.code-block .token.namespace,
.post .post-main pre.code-block .token.builtin { color: #4ec9b0; }
.post .post-main pre.code-block .token.label,
.post .post-main pre.code-block .token.regex,
.post .post-main pre.code-block .token.atrule { color: #c586c0; }
.post .post-main pre.code-block .token.operator,
.post .post-main pre.code-block .token.punctuation { color: #d4d4d4; }
.post .post-main pre.code-block .token.bold { font-weight: 700; }
.post .post-main pre.code-block .token.italic { font-style: italic; }

@media (max-width: 644px) {
  .post .post-main pre.code-block { border-radius: 8px; }
  .post .post-main pre.code-block > code { padding: 12px 14px 14px; font-size: 0.8rem; }
  .post .post-main pre.code-block .code-block__label { left: 12px; }
}
