/* ==========================================================================
   single.css — 記事詳細ページスタイル
   ========================================================================== */

/* ===== ARTICLE LAYOUT (2カラム: コンテンツ + TOCサイドバー) ===== */
.article-layout{
  max-width:1200px;
  margin:0 auto;
  padding:2rem clamp(1.5rem,5vw,4rem) 0;
  display:grid;
  grid-template-columns:1fr 240px;
  gap:3rem;
  align-items:start;
}

/* ===== ARTICLE MAIN ===== */
.article-main{
  max-width:var(--content-width);
  min-width:0;
}

/* ===== ARTICLE HEADER ===== */
.article-header{margin-bottom:2.5rem}

.article-tags{
  display:flex;gap:.5rem;flex-wrap:wrap;
  margin-bottom:1rem;
  list-style:none;padding:0;
}
.article-tags li a{
  display:inline-block;
  font-family:var(--font-heading);
  font-size:.75rem;font-weight:600;
  padding:5px 14px;
  border-radius:100px;
  text-decoration:none;
  transition:all .3s;
}
/* 全タグ: アクセントカラー統一 */
.article-tags li a{
  background:var(--accent-soft);
  color:var(--accent);
  border:1px solid var(--accent-medium);
}

.article-title{
  font-family:var(--font-heading);
  font-size:clamp(1.6rem,4vw,2.2rem);
  font-weight:800;
  letter-spacing:-0.035em;
  line-height:1.35;
  margin-bottom:1.25rem;
  color:var(--text-primary);
}

.article-meta{
  display:flex;align-items:center;gap:1.25rem;
  flex-wrap:wrap;
}

.article-date{
  font-family:var(--font-heading);
  font-size:.8rem;
  color:var(--text-tertiary);
  display:flex;align-items:center;gap:.4rem;
}
.article-date svg{width:14px;height:14px}

/* ===== SINGLE DATE ===== */
.single__date{
  font-family:var(--font-heading);
  font-size:.8rem;
  color:var(--text-tertiary);
  display:flex;align-items:center;gap:.75rem;
  flex-wrap:wrap;
}
.single__date span{
  display:flex;align-items:center;gap:.35rem;
}
.single__date svg{width:13px;height:13px;opacity:.7;flex-shrink:0}

/* ===== BOOKMARK BUTTON ===== */
.single__bookmark.bookmark-btn,
.article-meta .bookmark-btn{
  position:relative;
  top:auto;right:auto;
  width:auto;height:auto;
  display:flex;align-items:center;gap:.5rem;
  padding:8px 18px;
  border-radius:100px;
  border:1px solid var(--border);
  background:transparent;
  color:var(--text-secondary);
  font-family:var(--font-heading);
  font-size:.8rem;font-weight:500;
  cursor:pointer;
  transition:all .3s var(--ease-spring);
  margin-left:auto;
  backdrop-filter:none;
}
.single__bookmark.bookmark-btn.is-bookmarked,
.article-meta .bookmark-btn.is-bookmarked{
  border-color:var(--accent);
  color:var(--accent);
  background:var(--accent-soft);
}
.bookmark-btn svg{width:14px;height:14px}
.bookmark-btn.is-bookmarked svg{fill:currentColor}

/* ===== ARTICLE THUMBNAIL ===== */
.article-thumb{
  width:100%;
  border-radius:16px;
  overflow:hidden;
  margin-bottom:3rem;
  background:var(--bg-elevated);
  aspect-ratio:16/9;
  display:flex;
  align-items:center;justify-content:center;
  font-family:var(--font-heading);
  font-size:.85rem;
  color:var(--text-tertiary);
  position:relative;
}
.article-thumb img{
  width:100%;height:100%;
  object-fit:cover;
  display:block;
}
.article-thumb::before{
  content:'';
  position:absolute;inset:0;
  background:linear-gradient(135deg,var(--bg-elevated),color-mix(in srgb,var(--accent) 6%,var(--bg-elevated)));
}
.article-thumb span{position:relative;z-index:1}

/* ===== ARTICLE BODY ===== */
.article-body h2{
  font-family:var(--font-heading);
  font-size:1.5rem;font-weight:700;
  letter-spacing:0.07em;
  margin:3rem 0 1.25rem;
  padding-bottom:.75rem;
  border-bottom:1px solid var(--border);
  scroll-margin-top:80px;
  color:var(--text-primary);
  position: relative;
  padding-left: 1.5rem;
}
.article-body h2::before{
  content:'';
  position:absolute;left:0;bottom:0;
  height: 1.5rem;
  width:3px;
  background:var(--accent);
  border-radius:5px;
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  left: 0;
}

.article-body h3{
  font-family:var(--font-heading);
  font-size:1.15rem;font-weight:600;
  letter-spacing:-0.02em;
  margin:2rem 0 1rem;
  scroll-margin-top:80px;
  color:var(--text-primary);
}

.article-body p{
  margin-bottom:1.5rem;
  letter-spacing: 0.05em;
  color:var(--text-secondary);
  font-size:1rem;
}

.article-body strong{
  color:var(--text-primary);
  font-weight:700;
}

.article-body ul,
.article-body ol{
  margin:0 0 1.5rem 1.5rem;
  color:var(--text-secondary);
}

.article-body li{margin-bottom:.5rem}

.article-body a:not(.btn){
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:3px;
  transition:opacity .3s;
}

.article-body code{
  background:var(--bg-elevated);
  padding:2px 8px;
  border-radius:4px;
  font-family:var(--font-mono);
  font-size:.85rem;
}
.article-body mark{
  background: unset;
  color: var(--white);
}

/* ===== CODE BLOCK ===== */
.code-block{
  margin:1.5rem 0 2rem;
  border-radius:12px;
  border:1px solid var(--border);
  overflow:hidden;
  background:var(--bg-code);
  transition:border-color .3s;
}

.code-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:.6rem 1rem;
  background:var(--bg-code-header);
  border-bottom:1px solid var(--border);
}

.code-lang{
  font-family:var(--font-mono);
  font-size:.7rem;font-weight:500;
  color:var(--text-tertiary);
  text-transform:uppercase;
  letter-spacing:.05em;
}

.copy-btn{
  display:flex;align-items:center;gap:.4rem;
  padding:4px 12px;
  border-radius:6px;
  border:none;
  background:transparent;
  color:var(--text-tertiary);
  font-family:var(--font-mono);
  font-size:.7rem;
  cursor:pointer;
  transition:all .3s;
}
.copy-btn.copied{color:var(--accent)}
.copy-btn svg{width:14px;height:14px}

.code-content{
  padding:1.25rem 1.5rem;
  overflow-x:auto;
  font-family:var(--font-mono);
  font-size:.85rem;
  line-height:1.7;
  color:var(--text-secondary);
}
.code-content .kw{color:var(--code-keyword)}
.code-content .str{color:var(--code-string)}
.code-content .fn{color:var(--code-func)}
.code-content .cm{color:var(--code-comment);font-style:italic}
.code-content .tg{color:var(--code-tag)}
.code-content .at{color:var(--code-attr)}

/* ===== TOC SIDEBAR ===== */
.toc{
  position:sticky;
  top:80px;
  max-height:calc(100vh - 100px);
  overflow-y:auto;
}

.toc-title{
  font-family:var(--font-heading);
  font-size:.75rem;font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--text-tertiary);
  margin-bottom:1rem;
}

.toc-list{
  list-style:none;
  border-left:1px solid var(--border);
  padding-left:0;
}

.toc-item{position:relative}

.toc-item a{
  display:block;
  padding:.4rem 0 .4rem 1.25rem;
  font-family:var(--font-heading);
  font-size:.8rem;
  color:var(--text-tertiary);
  text-decoration:none;
  transition:color .3s,padding-left .3s var(--ease-out-expo);
  line-height:1.4;
}
.toc-item.active a{
  color:var(--accent);
  padding-left:1.5rem;
}
.toc-item.active::before{
  content:'';
  position:absolute;
  left:-1px;top:0;bottom:0;
  width:2px;
  background:var(--accent);
  border-radius:1px;
  animation:tocSlide .3s var(--ease-out-expo);
}

.toc-item--sub a{
  font-size:.75rem;
  padding-left:2rem;
}
.toc-item--sub.active a{padding-left:2.25rem}

@keyframes tocSlide{
  from{opacity:0;transform:scaleY(0)}
  to{opacity:1;transform:scaleY(1)}
}

/* ===== ENV SECTION ===== */
.env-section{
  margin:3rem 0;
  padding:1.5rem 2rem;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--bg-card);
}

.env-title{
  font-family:var(--font-heading);
  font-size:.85rem;font-weight:700;
  color:var(--text-tertiary);
  margin-bottom:1rem;
  display:flex;align-items:center;gap:.5rem;
}
.env-title svg{width:16px;height:16px;color:var(--accent)}

.env-list{list-style:none}
.env-list li{
  display:flex;justify-content:space-between;
  padding:.6rem 0;
  border-bottom:1px solid var(--border);
  font-size:.9rem;
}
.env-list li:last-child{border:none}
.env-list .env-name{color:var(--text-secondary)}
.env-list .env-link{
  color:var(--accent);
  text-decoration:none;
  font-family:var(--font-heading);
  font-weight:500;
  transition:opacity .3s;
}

/* ===== CATEGORY LINK ===== */
.cat-link{
  display:inline-flex;align-items:center;gap:.5rem;
  margin:3rem 0;
  padding:14px 28px;
  border-radius:100px;
  border:1px solid var(--border);
  color:var(--text-secondary);
  font-family:var(--font-heading);
  font-size:.85rem;font-weight:600;
  text-decoration:none;
  transition:all .4s var(--ease-out-expo);
}
.cat-link svg{width:16px;height:16px;transition:transform .4s var(--ease-out-expo)}

/* ===== RELATED POSTS ===== */
.related{margin:4rem 0}

.related-title{
  font-family:var(--font-heading);
  font-size:1.1rem;font-weight:700;
  letter-spacing:-0.02em;
  margin-bottom:1.5rem;
  display:flex;align-items:center;gap:.75rem;
  color:var(--text-primary);
}
.related-title::after{
  content:'';flex:1;height:1px;
  background:var(--border);
}

.related-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1.25rem;
}

.related-card{
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  text-decoration:none;
  color:inherit;
  transition:all .5s var(--ease-out-expo);
  display:block;
}

.related-card-thumb{
  height:140px;
  overflow:hidden;
  background:var(--bg-elevated);
}
.related-card-thumb div{
  width:100%;height:100%;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-heading);
  font-size:.75rem;
  color:var(--text-tertiary);
  transition:transform .7s var(--ease-out-expo);
  background:linear-gradient(135deg,var(--bg-elevated),color-mix(in srgb,var(--accent) 5%,var(--bg-elevated)));
}
.related-card-thumb img{
  width:100%;height:100%;
  object-fit:cover;
  transition:transform .7s var(--ease-out-expo);
}

.related-card-body{padding:1rem 1.25rem}

.related-card-date{
  font-family:var(--font-heading);
  font-size:.7rem;
  color:var(--text-tertiary);
  margin-bottom:.4rem;
}

.related-card-title{
  font-family:var(--font-heading);
  font-size:.9rem;font-weight:600;
  letter-spacing:-0.015em;
  line-height:1.5;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  color:var(--text-primary);
}

/* ===== VIEW COUNT ===== */
.single__view-count{
  display:flex;align-items:center;gap:5px;
  font-family:var(--font-heading);
  font-size:.8rem;
  color:var(--text-tertiary);
}
.single__view-count svg{width:14px;height:14px;opacity:.6}

/* ===== COMMENTS ===== */
.comments-area{
  margin-top:3rem;
  padding:2rem 2.5rem;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:16px;
}
.comment-respond h3{
  font-size:1.2rem;
  font-weight:700;
  color:var(--text-primary);
  margin-bottom:1.5rem;
}
.comment-form .submit{
  background:var(--accent);
  color:#09090B;
  border:none;
  border-radius:100px;
  padding:.75rem 2rem;
  font-size:.875rem;
  font-weight:600;
  cursor:pointer;
  transition:opacity .2s,transform .2s;
}
.comment-body{
  padding:1rem 1.25rem;
  background:var(--bg-elevated);
  border-radius:10px;
  margin-bottom:1rem;
  border-left:2px solid var(--accent-medium);
}

.comment-reply-link{
  display:inline-flex;align-items:center;
  font-family:var(--font-heading);
  font-size:.75rem;
  color:var(--text-tertiary);
  text-decoration:none;
  padding:3px 12px;
  border-radius:100px;
  border:1px solid var(--border);
  transition:all .25s;
  margin-top:.5rem;
}

#comments{
  margin:4rem 0 2rem;
  padding-top:2rem;
  border-top:1px solid var(--border);
}

.comments-title{
  font-family:var(--font-heading);
  font-size:1.1rem;font-weight:700;
  letter-spacing:-0.02em;
  margin-bottom:1.5rem;
  display:flex;align-items:center;gap:.75rem;
  color:var(--text-primary);
}
.comments-title::after{
  content:'';flex:1;height:1px;
  background:var(--border);
}

.comment-list{
  list-style:none;
  padding:0;margin:0 0 2rem;
}

.comment-list .comment{
  padding:1.25rem 0;
  border-bottom:1px solid var(--border);
}
.comment-list .comment:last-child{border:none}

.comment-author{
  display:flex;align-items:center;gap:.75rem;
  margin-bottom:.5rem;
}
.comment-author img{
  width:36px;height:36px;
  border-radius:50%;
  object-fit:cover;
}
.comment-author .fn{
  font-family:var(--font-heading);
  font-size:.85rem;font-weight:600;
  color:var(--text-primary);
}
.comment-metadata{
  font-size:.75rem;
  color:var(--text-tertiary);
}
.comment-content p{
  margin:0;
  font-size:.9rem;
  color:var(--text-secondary);
  line-height:1.7;
}

#respond{
  margin-top:2rem;
  padding:1.5rem 2rem;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--bg-card);
}

#respond h3{
  font-family:var(--font-heading);
  font-size:1rem;font-weight:700;
  margin-bottom:1.25rem;
  color:var(--text-primary);
}

.comment-form p{margin-bottom:1rem}

.comment-form label{
  display:block;
  font-family:var(--font-heading);
  font-size:.75rem;font-weight:600;
  color:var(--text-tertiary);
  margin-bottom:.4rem;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea{
  width:100%;
  padding:.7rem 1rem;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--bg-card);
  color:var(--text-primary);
  font-family:var(--font-body);
  font-size:.9rem;
  transition:border-color .3s;
  box-sizing:border-box;
}
.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus{
  outline:none;
  border-color:var(--accent);
}

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

.form-submit #submit{
  display:inline-flex;align-items:center;
  padding:10px 28px;
  border-radius:100px;
  border:none;
  background:var(--accent);
  font-family:var(--font-heading);
  font-size:.85rem;font-weight:600;
  cursor:pointer;
  transition:opacity .3s,transform .3s;
}

/* Comment notes and extras */
.comment-form-note{
  font-size:.8rem;
  color:var(--text-tertiary);
  margin-bottom:1rem;
}
.comment-form-cookies-consent{
  display:flex;align-items:center;gap:.5rem;
  font-size:.8rem;
  color:var(--text-secondary);
}
.comment-form-cookies-consent input[type="checkbox"]{
  accent-color:var(--accent);
}
/* SiteGuard CAPTCHA */
.comment-form .siteguard-captcha{
  margin:1rem 0;
}
.comment-form .siteguard-captcha img{
  border-radius:6px;
  border:1px solid var(--border);
}
/* Posted comments list */
.comment-list{
  list-style:none;padding:0;margin:0 0 2rem;
}
.comment-list .comment{
  padding:1rem 0;
  border-bottom:1px solid var(--border);
}
.comment-list .comment-author{
  font-family:var(--font-heading);
  font-weight:600;font-size:.85rem;
}
.comment-list .comment-meta{
  font-size:.75rem;color:var(--text-tertiary);
  margin-bottom:.5rem;
}
.comment-list .comment-content p{
  font-size:.9rem;line-height:1.7;
}

/* ===== HOVER ===== */
@media(hover:hover){
  .article-tags li a:hover{
    background:var(--accent-medium);
    color:var(--accent);
  }
  .single__bookmark.bookmark-btn:hover,
  .article-meta .bookmark-btn:hover{
    border-color:var(--accent);
    color:var(--accent);
    background:var(--accent-soft);
  }
  .article-body a:hover{opacity:.7}
  .code-block:hover{border-color:var(--border-hover)}
  .copy-btn:hover{background:var(--accent-soft);color:var(--accent)}
  .toc-item a:hover{color:var(--text-primary)}
  .env-list .env-link:hover{opacity:.7}
  .cat-link:hover{
    border-color:var(--accent);
    color:var(--accent);
    background:var(--accent-soft);
    transform:translateX(4px);
  }
  .cat-link:hover svg{transform:translateX(4px)}
  .related-card:hover{
    border-color:var(--border-hover);
    transform:translateY(-3px);
    box-shadow:0 16px 48px -12px rgba(0,0,0,.25);
  }
  .related-card:hover .related-card-thumb div{transform:scale(1.05)}
  .related-card:hover .related-card-thumb img{transform:scale(1.05)}
  .comment-form .submit:hover{opacity:.85;transform:translateY(-1px)}
  .comment-reply-link:hover{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}
  .form-submit #submit:hover{
    opacity:.85;
    transform:translateY(-1px);
  }
  .related-internal a:hover{color:var(--accent)}
  .article-env:hover{border-color:var(--accent-medium)}
  .article-env__link:hover{opacity:1}
}

/* ===== RESPONSIVE ===== */
@media(max-width:900px){
  .article-layout{
    grid-template-columns:1fr;
    gap:0;
  }
  .toc{display:none}
}

@media(max-width:767px){
  .article-main{max-width:100%}
  .related-grid{grid-template-columns:1fr}
  .article-body h2{font-size:1.3rem}
  .article-body h3{font-size:1.05rem}
  .env-section{padding:1.25rem 1.5rem}
}

/* ===== READING TIME ===== */
.single__reading-time{
  display:flex;align-items:center;gap:.4rem;
  font-family:var(--font-heading);
  font-size:.8rem;
  color:var(--text-tertiary);
}
.single__reading-time svg{width:14px;height:14px;opacity:.6}

/* ===== 合わせて読みたい ===== */
.related-internal{
  margin:3rem 0 0;
  padding:1.5rem;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:12px;
}
.related-internal h3{
  font-family:var(--font-heading);
  font-size:.8rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--accent);
  margin:0 0 1rem;
}
.related-internal ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.5rem}
.related-internal a{
  font-size:.9rem;
  color:var(--text-secondary);
  text-decoration:none;
  border-bottom:1px solid var(--border);
  padding-bottom:.5rem;
  display:block;
  transition:color .3s;
}
.related-internal li:last-child a{border-bottom:none;padding-bottom:0}

/* ===== この記事の環境 ===== */
.article-env{display:grid;grid-template-columns:3px 1fr;border-radius:12px;overflow:hidden;border:1px solid var(--border);margin:3rem 0;transition:border-color .4s;padding: 0 !important;}
.article-env__bar{background:var(--accent)}
.article-env__inner{background:var(--bg-card);padding:1.25rem 1.5rem;display:flex;align-items:center;gap:1.25rem;flex-wrap:wrap}
.article-env__badge{display:flex;flex-direction:column;align-items:center;gap:4px;flex-shrink:0}
.article-env__icon{width:40px;height:40px;border-radius:10px;background:var(--accent-soft);display:flex;align-items:center;justify-content:center}
.article-env__badge-label{font-family:var(--font-heading);font-size:9px;font-weight:700;color:var(--accent);letter-spacing:.1em}
.article-env__body{flex:1;min-width:0}
p.article-env__title{font-family:var(--font-heading);font-size:15px;font-weight:700;color:var(--text-primary);margin:0 0 3px;letter-spacing:-.02em}
p.article-env__subtitle{font-size:12px;color:var(--text-tertiary);margin:0;line-height:1.5}
.article-env__items{display:flex;flex-direction:column;width:100%;margin-top:4px}
.article-env__row{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-top:1px solid var(--border)}
.article-env__row-left{display:flex;align-items:center;gap:10px}
.article-env__dot{width:5px;height:5px;border-radius:50%;background:var(--accent);flex-shrink:0}
.article-env__name{font-family:var(--font-heading);font-size:14px;font-weight:700;color:var(--text-primary)}
.article-env__type{font-size:11px;color:var(--text-tertiary);margin-left:8px}
.article-env__link{display:inline-flex;align-items:center;gap:4px;font-family:var(--font-heading);font-size:11px;color:var(--accent);text-decoration:none;font-weight:600;transition:opacity .3s;opacity:.8}
@media(max-width:767px){.article-env__inner{flex-direction:column;align-items:flex-start}.article-env__badge{flex-direction:row;gap:8px}}
