/* ====== Single: Base & Layout ====== */
.single .content h2,
.single .content h3,
.single .content h4 {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px
}

a {
  color: var(--link);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

/* 共通ページ幅。single は >=1200px で --wrap-wide を適用 */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 8px;
  background: #000;
  color: #fff
}

/* ====== Header ====== */
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--ink)
}

.logo img {
  border-radius: 8px
}

.site-name {
  font-size: 18px
}

.global-nav ul {
  display: flex;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0
}

.header-ghost {
  height: 0
}

/* for layout stability */

/* ====== Breadcrumb ====== */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin: 18px 0
}

.breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px
}

.breadcrumb a {
  color: var(--muted)
}

/* ====== Single Layout ====== */
.single .post-header {
  margin-bottom: 22px
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px
}

.post-meta .cat {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #000;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700
}

.post-meta .cat a {
  color: #000
}

.post-title {
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.3;
  margin: .2em 0 .6em
}

.lead {
  font-size: 18px;
  color: var(--ink-dim);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 12px;
}

/* Share & Meta Footer */
.meta-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin: 32px 0;
  padding: 16px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.meta-label {
  font-weight: 700;
  margin-right: 4px;
}

.share-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-dim);
  font-weight: 700;
  transition: all var(--dur-1) var(--ease);
}

.share-btn.sm {
  padding: 4px 10px;
  font-size: 13px
}

.share-btn:hover {
  background: var(--bg-soft);
  text-decoration: none;
  filter: brightness(1.1)
}

/* Brand Colors */
.share-btn--x {
  background: #000;
  color: #fff;
  border-color: #000;
}

.share-btn--x:hover {
  background: #333;
  color: #fff;
}

.share-btn--line {
  background: #06C755;
  color: #fff;
  border-color: #06C755;
}

.share-btn--line:hover {
  background: #05a447;
  color: #fff;
}

.share-btn--hatebu {
  background: #00A4DE;
  color: #fff;
  border-color: #00A4DE;
}

.share-btn--hatebu:hover {
  background: #008ebf;
  color: #fff;
}

.share-btn--youtube {
  background: #FF0000;
  color: #fff;
  border-color: #FF0000;
}

.share-btn--youtube:hover {
  background: #cc0000;
  color: #fff;
}

/* URL Copy Button */
.share-btn--copy {
  background: var(--panel);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

.share-btn--copy:hover {
  background: var(--bg-soft);
  text-decoration: none;
}

/* Eyecatch */
.eyecatch {
  margin: 12px 0
}

.eyecatch figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px
}

/* ====== Grid ====== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--aside-w);
  gap: var(--gap-w);
  margin-top: 16px;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr
  }
}

.content {
  min-width: 0
}

/* 1025px〜1199px は 2カラム（本文 + サイドバー）で TOC は上に移動 */
@media (min-width: 1025px) and (max-width: 1199px) {
  .single .layout {
    grid-template-columns: minmax(0, 1fr) var(--aside-w);
    /* 本文 + サイドバー */
    gap: var(--gap-w-md);
  }

  .single :is(.toc, #toc_container, .ez-toc-container) {
    grid-column: 1 / -1;
    position: relative;
    top: auto;
    margin-bottom: 16px;
  }
}

/* ====== TOC ====== */
:is(.toc, #toc_container, .ez-toc-container) {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 14px;
  margin-bottom: 20px;
}

:is(.toc-title, .toc-heading, .ez-toc-title) {
  font-weight: 700;
  margin-bottom: 6px
}

:is(.toc, #toc_container, .ez-toc-container) ol {
  margin: 0;
  padding-left: 18px
}

:is(.toc, #toc_container, .ez-toc-container) a {
  color: var(--ink-dim);
  text-decoration: none;
}

:is(.toc, #toc_container, .ez-toc-container) a:hover {
  color: var(--ink)
}

:is(.toc, #toc_container, .ez-toc-container) a:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* ====== Content ====== */
.section {
  padding: 18px 0;
  border-bottom: 1px dashed var(--line)
}

.section:last-child {
  border-bottom: none
}

p {
  margin: .8em 0
}

ul,
ol {
  padding-left: 1.4em
}

blockquote {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  background: var(--bg-soft);
  border-radius: 10px;
}

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden
}

.tbl th,
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line)
}

.tbl thead th {
  background: var(--panel);
  text-align: left
}

.tbl tbody tr:nth-child(even) {
  background: var(--bg-soft)
}

/* Code */
pre.code {
  background: var(--bg-soft);
  /* ライト/ダークで自動切替 */
  color: var(--ink);
  /* テキストもトークンで */
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 12px;
  overflow: auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace
}

/* Callouts */
.callout {
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand);
  background: var(--bg-soft);
  padding: 12px;
  border-radius: 12px;
  margin: 12px 0
}

.callout.success {
  border-left-color: var(--success)
}

.callout.warn {
  border-left-color: var(--warn)
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

@media(max-width:720px) {
  .grid-2 {
    grid-template-columns: 1fr
  }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px
}

.card.warn {
  border-color: rgba(255, 176, 32, .5)
}

/* Tags & Share */
.tags-share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  margin-top: 10px
}

.tags a {
  display: inline-block;
  margin-left: 6px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink-dim)
}

.tags a:hover {
  color: var(--ink)
}

/* Author box */
.author-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft)
}

.author-box img {
  border-radius: 50%
}

.author-links {
  display: flex;
  gap: 12px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none
}

/* Ad slot */
.ad-slot .ad {
  display: grid;
  place-items: center;
  height: 250px;
  background: repeating-linear-gradient(45deg, var(--bg-soft), var(--bg-soft) 10px, var(--panel) 10px, var(--panel) 20px);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted)
}

/* Pager */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0
}

.pager a {
  flex: 1;
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink-dim)
}

.pager a:hover {
  background: var(--bg-soft);
  text-decoration: none
}

.pager .k {
  opacity: .6
}

/* Related */
.related h2 {
  margin-bottom: 10px
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px
}

@media(max-width:920px) {
  .cards {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media(max-width:640px) {
  .cards {
    grid-template-columns: 1fr
  }
}

.r-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 10px
}

.r-card:hover {
  text-decoration: none;
  background: var(--bg-soft)
}

.r-card img {
  width: 92px;
  height: 64px;
  max-height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ====== Comments ====== */
.comments-area {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.comments-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* コメント一覧（カスタムコールバック） */
.comment-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tatsujin-comment {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.comment-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.comment-avatar img {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-body-wrap {
  flex: 1;
  min-width: 0;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-author-name {
  font-weight: 700;
  font-size: 14px;
}

.comment-time {
  font-size: 12px;
  color: var(--muted);
}

.comment-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
}

.comment-reply {
  margin-top: 6px;
}

.comment-reply-link {
  font-size: 12px;
  color: var(--link);
}

.comment-awaiting-moderation {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* コメントフォーム */
.comment-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink-dim);
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
}

.comment-form-author,
.comment-form-email {
  flex: 1;
}

.comment-form .form-submit {
  margin: 0;
}

.comment-form .submit.btn--brand,
.comment-form .btn--brand {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: filter 0.2s;
}

.comment-form .submit.btn--brand:hover,
.comment-form .btn--brand:hover {
  filter: brightness(1.1);
}

@media (min-width: 640px) {
  .comment-form-fields-row {
    display: flex;
    gap: 12px;
  }
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.widget {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px
}

.widget-title {
  font-size: 16px;
  margin: 0 0 8px
}

.rank {
  margin: 0;
  padding-left: 18px
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #000;
  border: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim)
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.05)
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px
}

.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 16px
}

.site-footer nav a {
  color: var(--ink-dim);
  margin-right: 12px
}

/* Utilities */
.hidden {
  display: none !important
}

/* ====== Wide layout: 3 columns (TOC | Content | Sidebar) ====== */
@media (min-width: 1200px) {

  /* 3カラムが必要なページに body.has-toc-3col を付与 */
  .has-toc-3col .layout {
    grid-template-columns: 240px minmax(0, 1fr) var(--aside-w);
    align-items: start;
  }

  .has-toc-3col :is(.toc, #toc_container, .ez-toc-container) {
    grid-column: 1;
  }

  .has-toc-3col .content {
    grid-column: 2;
  }

  .has-toc-3col .sidebar {
    grid-column: 3;
  }

  /* 本文＋サイドバーの2カラムに変更 */
  .single.wrap {
    max-width: var(--wrap-wide);
  }

  .single .layout {
    grid-template-columns: minmax(0, 1fr) var(--aside-w);
    gap: var(--gap-w);
  }

  /* 目次は本文の上に全幅で表示、sticky解除 */
  .single :is(.toc, #toc_container, .ez-toc-container) {
    grid-column: 1 / -1;
    /* レイアウトの先頭に全幅で配置 */
    position: relative;
    top: auto;
    margin-bottom: 20px;
  }

  /* ★ここを追加：本文/サイドバーの列を再指定（3カラムの指定を打ち消す） */
  .single .content {
    grid-column: 1;
  }

  /* 本文は1列目（広い列） */
  .single .sidebar {
    grid-column: 2;
  }

  /* サイドバーは2列目 */

  .sidebar {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    max-height: calc(100dvh - var(--header-h) - 24px);
    overflow: auto;
  }
}

/* 目次が長くても本文を押し出さないように */
:is(.toc, #toc_container, .ez-toc-container) {
  max-height: calc(100dvh - var(--header-h) - 16px);
  overflow: auto;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

.indent {
  margin-left: 1em;
  /*全体を１文字分右へ*/
  text-indent: -1em;
  /*１行めだけ１文字分左へ*/
}

.blogcard-snippet {
  display: none;
}

/* small-marginスタイルのCSS */
.is-style-small-margin {
  margin-bottom: 0em !important;
  /* 段落の下部の隙間を小さく */
}

/* small-margin-indentスタイルのCSS */
.is-style-small-margin-indent {
  margin-left: 1em;
  text-indent: -1em;
  margin-bottom: 0em !important;
  /* ブロックの下の隙間を小さく */
}

/* only-indentスタイルのCSS */
.is-style-only-indent {
  margin-left: 1em !important;
  text-indent: -1em !important;
}

.bold-highlight {
  font-weight: bold;
  background-color: #EA5506;
  color: #fff;
  padding: 2px 4px;
}