/*!
Theme Name: WPMM Blog
Theme URI: https://wpmm.jp/
Author: 株式会社レイヤーワークス
Author URI: https://layerworks.co.jp/
Description: WP Maintenance Manager 公式ブログ用テーマ。LP（wpmm.jp）の世界観を継承したダークテーマ。日本語版／英語版の 2 つの WordPress インストールに同一テーマを配備し、サイトの WPLANG（get_locale()）でナビ等のラベルを自動振り分けする。
Version: 0.1.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wpmm-blog
Tags: dark, blog, custom-menu, custom-logo, threaded-comments, translation-ready
*/

/* =====================================================
   RESET & BASE
   ※ LP（server/wpmm-web/includes/header.php の <style>）と
     同じトークン体系を使う。差分はブログ固有部分のみ末尾に追加。
===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1a2332;
  --bg-card-hover: #1e2a3a;
  --border:        #21262d;
  --border-accent: #30363d;

  --accent-blue:   #2f81f7;
  --accent-blue-2: #388bfd;
  --accent-green:  #3fb950;
  --accent-green-2:#56d364;
  --accent-purple: #a371f7;
  --accent-orange: #f0883e;

  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;
  --text-code:     #79c0ff;

  --gradient-hero: linear-gradient(135deg, #0d1117 0%, #1a2332 50%, #0d2137 100%);
  --gradient-accent: linear-gradient(135deg, #2f81f7, #3fb950);
  --gradient-card: linear-gradient(145deg, #1a2332, #1e2a3a);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 30px rgba(47,129,247,0.15);
  --shadow-green: 0 0 30px rgba(63,185,80,0.15);

  --font-jp: 'Noto Sans JP', sans-serif;
  --font-en: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --nav-height: 88px;
  --section-gap: 120px;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-jp);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 英語ロケール（en_US 等）では本文も Inter ベース */
body.locale-en {
  font-family: var(--font-en);
}

a { color: var(--accent-blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-blue-2); }

img { max-width: 100%; height: auto; }

/* =====================================================
   UTILITY
===================================================== */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 860px; margin: 0 auto; padding: 0 24px; }
.container-article { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* .article-col — single.php の「サイドバー領域も含めて layout 全幅で広がるコンテナ」。
   .article-layout の **外枠**（max-width 1160px / padding 0 24px）と一致するため、
   article-header / article-thumbnail / article-footer / post-navigation の各ブロックは
   本文（col1 = 776px）+ sidebar 領域も使った広い 1112px 幅で表示される。
   本文と sidebar の隣接行だけグリッドで分割される、いわゆるマガジンレイアウト。 */
.article-col {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 1023px) {
  /* sidebar が下に scaffolded される breakpoint では article-layout が単一カラム
     (max-width 760px) にフォールバックするため、article-col もそれに合わせる。 */
  .article-col {
    max-width: 760px;
    padding: 0 24px;
  }
}

.screen-reader-text {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px; height: 1px;
  overflow: hidden;
  word-wrap: normal !important;
}

/* =====================================================
   NAVBAR (LP と同設計)
===================================================== */
#navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-height); z-index: 1000;
  background: rgba(13,17,23,0.95);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
#navbar.scrolled { border-bottom-color: var(--border); background: rgba(13,17,23,0.95); }

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-height); max-width: 1160px; margin: 0 auto; padding: 0 24px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
  font-family: var(--font-en); font-weight: 700;
}
.nav-logo-icon { width: 47px; height: 47px; flex-shrink: 0; }
.nav-logo-icon img { width: 47px; height: 47px; object-fit: contain; }
.nav-logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.nav-logo-main { font-size: 18px; font-weight: 700; }
.nav-logo-sub { font-size: 14px; font-weight: 400; color: var(--text-secondary); font-family: var(--font-en); }

.nav-menu { display: flex; align-items: center; gap: 32px; list-style: none; }
.nav-menu a {
  text-decoration: none; color: var(--text-secondary);
  font-size: 14px; font-weight: 500; transition: color 0.2s;
  font-family: var(--font-jp);
}
body.locale-en .nav-menu a { font-family: var(--font-en); }
.nav-menu a:hover, .nav-menu a.active { color: var(--text-primary); }

.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gradient-accent); color: #fff !important;
  font-weight: 600 !important; font-size: 13px !important;
  padding: 8px 18px; border-radius: 8px;
  transition: opacity 0.2s, transform 0.2s !important;
}
.nav-cta:hover { opacity: 0.9; transform: translateY(-1px) !important; }

.nav-hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; }
.nav-hamburger span { display: block; width: 24px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: all 0.3s; }

.nav-mobile {
  display: none; flex-direction: column;
  background: rgba(22,27,34,0.98); border-bottom: 1px solid var(--border); padding: 16px 24px;
}
.nav-mobile.open { display: flex; }
.nav-mobile a { text-decoration: none; color: var(--text-secondary); font-size: 15px; padding: 12px 0; border-bottom: 1px solid var(--border); transition: color 0.2s; }
.nav-mobile a:hover { color: var(--text-primary); }
.nav-mobile a:last-child { border-bottom: none; }

/* =====================================================
   FOOTER (LP と同設計)
===================================================== */
#footer { padding: 64px 0 40px; }
.footer-inner { display: flex; flex-direction: column; gap: 32px; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; }
.footer-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); }
.footer-logo-icon { width: 32px; height: 32px; }
.footer-logo-icon img { width: 32px; height: 32px; object-fit: contain; }
.footer-logo-text { font-family: var(--font-en); font-weight: 700; font-size: 14px; }
.footer-tagline { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.footer-links { display: flex; gap: 32px; flex-wrap: wrap; }
.footer-links a { text-decoration: none; color: var(--text-muted); font-size: 13px; transition: color 0.2s; }
.footer-links a:hover { color: var(--text-primary); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-copyright { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* =====================================================
   SCROLL-TOP BUTTON
===================================================== */
#scroll-top {
  position: fixed; bottom: 32px; right: 32px;
  width: 44px; height: 44px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 900; font-size: 16px;
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { background: var(--bg-card-hover); color: var(--text-primary); transform: translateY(-2px); }

/* =====================================================
   PAGE HEADER (ブログ一覧・記事タイトル上のヒーロー)
===================================================== */
.page-header {
  padding: calc(var(--nav-height) + 56px) 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 64px;
  background: var(--gradient-hero);
}
.page-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-blue);
  background: rgba(47,129,247,0.08); border: 1px solid rgba(47,129,247,0.2);
  padding: 5px 12px; border-radius: 20px; margin-bottom: 20px;
}
.page-title {
  font-family: var(--font-en); font-size: 40px; font-weight: 900;
  letter-spacing: -0.03em; line-height: 1.2;
  margin-bottom: 12px;
}
.page-subtitle { font-size: 15px; color: var(--text-secondary); line-height: 1.6; }

/* =====================================================
   POST LIST (index.php / archive.php)
===================================================== */
.post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding-bottom: 80px;
}

.post-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.post-card-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
  margin-bottom: 12px;
}
.post-card-meta time { color: var(--text-muted); }
.post-card-meta .post-cat {
  color: var(--accent-blue);
  background: rgba(47,129,247,0.08);
  border: 1px solid rgba(47,129,247,0.2);
  padding: 2px 10px; border-radius: 12px;
  font-size: 11px;
}

.post-card-title {
  font-size: 22px; font-weight: 700; line-height: 1.4;
  margin-bottom: 10px;
}
.post-card-title a { color: var(--text-primary); text-decoration: none; transition: color 0.2s; }
.post-card-title a:hover { color: var(--accent-blue); }

.post-card-excerpt {
  color: var(--text-secondary); font-size: 14px; line-height: 1.7;
  margin-bottom: 16px;
}

.post-card-readmore {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-blue); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: gap 0.2s;
}
.post-card-readmore:hover { gap: 10px; color: var(--accent-blue-2); }

/* =====================================================
   PAGINATION
===================================================== */
.pagination {
  display: flex; justify-content: center; gap: 8px;
  padding: 32px 0 80px;
  flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-secondary);
  font-family: var(--font-mono); font-size: 13px;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.pagination .page-numbers:hover {
  border-color: var(--accent-blue); color: var(--text-primary);
}
.pagination .page-numbers.current {
  background: var(--accent-blue); color: #fff; border-color: var(--accent-blue);
}
.pagination .page-numbers.dots { border: none; background: transparent; }

/* =====================================================
   ARTICLE BODY (single.php / page.php — 段階2 で詳細化)
===================================================== */
.article-body {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.85;
}
.article-body h2 {
  font-size: 26px; font-weight: 700; line-height: 1.4;
  margin: 56px 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.article-body h3 {
  font-size: 20px; font-weight: 700; line-height: 1.4;
  margin: 40px 0 16px;
  color: var(--text-primary);
}
.article-body h4 {
  font-size: 17px; font-weight: 600; line-height: 1.5;
  margin: 32px 0 12px;
  color: var(--text-primary);
}
.article-body p { margin: 0 0 1.4em; }
.article-body ul, .article-body ol { margin: 0 0 1.4em; padding-left: 1.6em; }
.article-body li { margin-bottom: 0.4em; }
.article-body strong { color: var(--text-primary); font-weight: 700; }
.article-body em { color: var(--text-primary); font-style: italic; }

.article-body a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-body a:hover { color: var(--accent-blue-2); }

.article-body blockquote {
  border-left: 3px solid var(--accent-blue);
  background: rgba(47,129,247,0.06);
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(110,118,129,0.16);
  color: var(--text-code);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-word;
}
.article-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 24px 0;
  overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px;
  line-height: 1.6;
}
.article-body pre code {
  background: transparent; color: var(--text-primary);
  padding: 0; font-size: inherit; word-break: normal;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.article-body th, .article-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-body th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}
.article-body tr:last-child td { border-bottom: none; }

.article-body img,
.article-body figure {
  max-width: 100%;
  margin: 24px auto;
  border-radius: var(--radius-sm);
}
.article-body figure { display: block; }
.article-body figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* 記事メタ・タグ・著者情報 */
.article-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

/* =====================================================
   404 / NO RESULTS
===================================================== */
.no-results {
  text-align: center;
  padding: 80px 0;
  color: var(--text-secondary);
}
.no-results h2 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* =====================================================
   BREADCRUMBS
===================================================== */
.breadcrumbs {
  margin: 0 0 24px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.breadcrumbs ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
}
.breadcrumbs li {
  display: inline-flex; align-items: center; gap: 6px;
}
.breadcrumbs li + li::before {
  content: "/";
  color: var(--border-accent);
  margin-right: 0;
}
.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumbs a:hover { color: var(--accent-blue); }
.breadcrumbs [aria-current="page"] {
  color: var(--text-secondary);
}

/* =====================================================
   SINGLE / PAGE — 記事個別
===================================================== */
.single-main { padding-top: var(--nav-height); }

.article-header {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  background: var(--gradient-hero);
}
.article-category {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: rgba(47,129,247,0.08);
  border: 1px solid rgba(47,129,247,0.2);
  padding: 5px 12px;
  border-radius: 20px;
  text-decoration: none;
  margin-bottom: 16px;
  transition: background 0.2s, border-color 0.2s;
}
.article-category:hover {
  background: rgba(47,129,247,0.16);
  border-color: rgba(47,129,247,0.4);
  color: var(--accent-blue);
}

.article-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  font-size: 13px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.article-meta time, .article-meta span {
  display: inline-flex; align-items: center; gap: 6px;
}
.article-meta i { font-size: 12px; }
.article-meta-updated { color: var(--accent-green); }

.article-thumbnail {
  margin-bottom: 32px;
}
.article-thumbnail img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.article-footer {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.article-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.article-tags-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.article-tags ul {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; padding: 0; margin: 0;
}
.article-tags a {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 16px;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.article-tags a:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

/* 記事末尾の LP CTA */
.article-cta {
  margin-top: 48px;
  padding: 32px;
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.article-cta::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-accent);
}
.article-cta-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.article-cta-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 20px;
}
.article-cta-button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gradient-accent);
  color: #fff !important;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
}
.article-cta-button:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}
.article-cta-button i { font-size: 12px; }

/* =====================================================
   POST NAVIGATION (前後記事)
===================================================== */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 64px auto 96px;
}
.post-nav-prev a,
.post-nav-next a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  height: 100%;
}
.post-nav-prev a:hover,
.post-nav-next a:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}
.post-nav-next { text-align: right; }
.post-nav-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.post-nav-title {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.5;
}

/* =====================================================
   SEARCH FORM
===================================================== */
.search-form {
  display: flex;
  gap: 8px;
  margin: 24px 0 40px;
}
.search-form input[type="search"] {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-form input[type="search"]::placeholder { color: var(--text-muted); }
.search-form input[type="search"]:focus { border-color: var(--accent-blue); }
.search-form button {
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.2s;
}
.search-form button:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* =====================================================
   404
===================================================== */
.error-404 {
  text-align: center;
  padding: 40px 0 96px;
}
.error-404-suggest {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 24px;
}
.error-404-actions {
  list-style: none;
  padding: 0;
  margin: 0 auto 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 480px;
}
.error-404-actions li { width: 100%; }
.error-404-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.error-404-actions a:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}
.error-404 .search-form {
  max-width: 480px;
  margin: 0 auto;
}

/* =====================================================
   PAGE BREAKS (wp_link_pages 出力用)
===================================================== */
.article-pages {
  margin: 32px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}
.article-pages a, .article-pages span {
  display: inline-block;
  margin-right: 8px;
}
.article-pages a {
  color: var(--accent-blue);
  text-decoration: none;
}

/* =====================================================
   PRISM.JS — テーマ調整（Tomorrow ベース＋LP 色味）
===================================================== */
.article-body pre[class*="language-"] {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 24px 0;
}
.article-body :not(pre) > code[class*="language-"],
.article-body code[class*="language-"] {
  background: rgba(110,118,129,0.16);
  color: var(--text-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.article-body pre[class*="language-"] code {
  background: transparent;
  padding: 0;
}
/* Prism ツールバー（コピー to clipboard） */
div.code-toolbar > .toolbar {
  top: 8px;
  right: 8px;
}
div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > a {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s, border-color 0.2s;
}
div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > a:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

/* =====================================================
   ARTICLE LAYOUT (single.php) — 本文 + 右サイドバー
===================================================== */
.article-layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 56px;
  /* align-items は default の stretch のままにする。
     `start` にすると sidebar の grid item がコンテンツ高さに縮み、
     その内部の position: sticky が「貼れる土台（containing block）」を失って
     本文を読み進めるとサイドバーごと流れていってしまう（sticky が効かなくなる）。
     stretch なら item box が行高（=本文の高さ）まで伸びるので sticky が機能する。 */
}
.article-layout > .article-body,
.article-layout > .post-list-wrap { min-width: 0; }

.article-sidebar { position: relative; }
.article-sidebar-inner {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  max-height: calc(100vh - var(--nav-height) - 40px);
  overflow-y: auto;
  padding-right: 4px;
}
.article-sidebar-inner::-webkit-scrollbar { width: 6px; }
.article-sidebar-inner::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 3px; }

.sidebar-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
}
.sidebar-heading i { color: var(--accent-blue); font-size: 12px; }

/* TOC */
.article-toc + .article-categories { margin-top: 28px; }
.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.55;
  counter-reset: toc;
}
.article-toc-list li { margin: 0; }
.article-toc-list .toc-h3 a { padding-left: 22px; font-size: 12.5px; }
.article-toc-list a {
  display: block;
  padding: 5px 10px 5px 10px;
  margin-left: -10px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  border-radius: 0 4px 4px 0;
}
.article-toc-list a:hover {
  color: var(--text-primary);
  border-left-color: var(--border-accent);
  background: var(--bg-secondary);
}
.article-toc-list a.is-active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
  background: var(--bg-secondary);
}

/* Categories */
.article-categories-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.article-categories-list li { margin: 0 0 4px; }
.article-categories-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.article-categories-list a:hover {
  background: var(--bg-card);
  color: var(--accent-blue);
  border-color: var(--border);
}
.article-categories-list a.is-active {
  background: var(--bg-card);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.article-categories-list a.is-active .cat-count {
  color: var(--accent-blue);
  background: rgba(47, 129, 247, 0.12);
}

/* Tags（chip 型・カテゴリーの下に並ぶ） */
.article-categories + .article-tags-section { margin-top: 28px; }
.article-tags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.article-tags-list li { margin: 0; }
.article-tags-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.4;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.article-tags-list a:hover {
  background: var(--bg-card);
  color: var(--accent-blue);
  border-color: var(--border-accent);
}
.article-tags-list a.is-active {
  background: rgba(47, 129, 247, 0.1);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.article-tags-list .tag-name {
  font-family: var(--font-mono);
  font-weight: 500;
}
.article-tags-list .tag-count {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.article-tags-list a.is-active .tag-count { color: var(--accent-blue); }
.article-categories-list .cat-name { flex: 1 1 auto; }
.article-categories-list .cat-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  flex: 0 0 auto;
}

/* タブレット〜スマホ: 1カラムにスタック */
@media (max-width: 1023px) {
  .article-layout {
    max-width: 760px;
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
  .article-sidebar-inner {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 768px) {
  .nav-menu { display: none; }
  .nav-hamburger { display: flex; }
  .page-title { font-size: 28px; }
  .footer-top { flex-direction: column; }
  .footer-links { flex-direction: column; gap: 12px; }
  .post-card { padding: 22px 22px; }
  .post-card-title { font-size: 19px; }
  .article-body h2 { font-size: 22px; }
  .article-body h3 { font-size: 18px; }
  .article-title { font-size: 24px; }
  .article-header { padding: 36px 0 24px; }
  .article-meta { gap: 12px; font-size: 12px; }
  .article-cta { padding: 24px; }
  .post-navigation { grid-template-columns: 1fr; margin: 40px auto 64px; }
  .post-nav-next { text-align: left; }
}
