/* =====================================================
   Muku Lab — style.css
   ===================================================== */

/* ---------- CSS 変数 (ライト/ダーク) ---------- */
:root {
  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --bg-hover: #edf0f8;
  --border: #dde3ee;
  --accent: #4f6ef7;
  --accent2: #7c3aed;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-faint: #a0aec0;
  --code-bg: #f0f4f8;
  --header-h: 64px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .1);
  --glow: 0 0 40px rgba(79, 110, 247, .12);
}

[data-theme="dark"] {
  --bg: #1c1c1e;
  --bg-card: #252527;
  --bg-hover: #2e2e30;
  --border: #3a3a3c;
  --accent: #7083d8;
  --accent2: #b0aca6;
  --text: #f0ede8;
  --text-muted: #9a9896;
  --text-faint: #5a5856;
  --code-bg: #141414;
  --shadow: 0 4px 24px rgba(0, 0, 0, .55);
  --glow: 0 0 40px rgba(255, 255, 255, .04);
}

/* ---------- テーマフラッシュ防止 ---------- */
/* 初回ロード時のみ付与し、100ms後に除去する */
.no-transition,
.no-transition *,
.no-transition *::before,
.no-transition *::after {
  transition: none !important;
  animation: none !important;
}

/* ---------- リセット ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background .3s, color .3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

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

/* ---------- ヘッダー ---------- */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(244, 246, 251, .88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}

[data-theme="dark"] #site-header {
  background: rgba(28, 28, 30, .88);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-nav {
  display: flex;
  gap: 8px;
  margin-right: auto;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .9rem;
  transition: color .2s, background .2s;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 検索 */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 36px 7px 36px;
  font-size: .875rem;
  width: 220px;
  transition: border-color .2s, box-shadow .2s, width .3s;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 142, 245, .2);
  width: 280px;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .2s;
}

.search-clear:hover {
  color: var(--text);
}

/* テーマトグル */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ---------- メイン ---------- */
#main-content {
  flex: 1;
}

/* ページ切り替え */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ---------- ヒーロー ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 36px 24px 28px;
  text-align: center;
}

.hero-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(108, 142, 245, .25) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(167, 139, 250, .15) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(108, 142, 245, .15), rgba(167, 139, 250, .15));
  border: 1px solid rgba(108, 142, 245, .35);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ---------- タグバー ---------- */
.tags-bar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.tags-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tags-bar-inner::-webkit-scrollbar {
  display: none;
}

.tags-label {
  color: var(--text-muted);
  font-size: .8rem;
  flex-shrink: 0;
}

.tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.tag-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.tag-btn:hover,
.tag-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- コンテナ ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- 記事グリッド ---------- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* 記事カード */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s, box-shadow .25s, border-color .25s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), var(--glow);
  border-color: var(--accent);
}

.post-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-hover), var(--border));
}

.post-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-hover) 0%, var(--border) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-faint);
}

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-card-tag {
  background: rgba(108, 142, 245, .12);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.post-card-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.post-card-date {
  font-size: .78rem;
  color: var(--text-faint);
}

.post-card-read {
  font-size: .78rem;
  color: var(--text-faint);
}

/* スケルトン */
.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 280px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

/* 空ステート */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-text {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ---------- 記事レイアウト ---------- */
.article-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  align-items: start;
}

.article-main {
  min-width: 0;
}

/* 記事ヘッダー */
.article-meta-top {
  margin-bottom: 24px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}

.back-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.back-btn svg {
  width: 16px;
  height: 16px;
}

.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.article-tag {
  background: rgba(108, 142, 245, .12);
  color: var(--accent);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}

.article-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: .85rem;
  margin-bottom: 24px;
}

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

/* ---------- Markdown 本文 ---------- */
.markdown-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.markdown-body h1 {
  font-size: 1.8rem;
  margin: 40px 0 16px;
}

.markdown-body h2 {
  font-size: 1.4rem;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.markdown-body h3 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  color: var(--accent);
}

.markdown-body h4 {
  font-size: 1rem;
  margin: 20px 0 8px;
}

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 16px 24px;
}

.markdown-body li {
  margin-bottom: 6px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(108, 142, 245, .07);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 8px 14px;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-hover);
  font-weight: 600;
}

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

.markdown-body a {
  color: var(--accent);
}

.markdown-body img {
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid var(--border);
}

/* インラインコード */
.markdown-body code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .875em;
  color: var(--accent2);
}

/* コードブロック */
.code-block-wrapper {
  position: relative;
  margin: 20px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, .4);
  padding: 8px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem;
  color: var(--text-muted);
}

.code-copy-btn {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .72rem;
  transition: all .2s;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, .15);
  color: var(--text);
}

.code-copy-btn.copied {
  color: #4ade80;
  border-color: #4ade80;
}

.code-block-wrapper pre {
  margin: 0;
  overflow-x: auto;
  padding: 16px;
  background: var(--code-bg) !important;
}

.code-block-wrapper pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .875rem;
  color: inherit;
}

/* ---------- カスタム Markdown 要素 ---------- */

/* --- Callout ボックス --- */
.md-callout {
  border-radius: 10px;
  padding: 14px 18px;
  margin: 24px 0;
  border-left: 4px solid;
}

.md-callout-header {
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.md-callout-body {
  font-size: .92rem;
  line-height: 1.7;
}

.md-callout.md-callout-note {
  background: rgba(59, 130, 246, .08);
  border-color: #3b82f6;
}

.md-callout-note .md-callout-header {
  color: #3b82f6;
}

.md-callout.md-callout-tip {
  background: rgba(16, 185, 129, .08);
  border-color: #10b981;
}

.md-callout-tip .md-callout-header {
  color: #10b981;
}

.md-callout.md-callout-important {
  background: rgba(168, 85, 247, .08);
  border-color: #a855f7;
}

.md-callout-important .md-callout-header {
  color: #a855f7;
}

.md-callout.md-callout-warning {
  background: rgba(245, 158, 11, .08);
  border-color: #f59e0b;
}

.md-callout-warning .md-callout-header {
  color: #f59e0b;
}

.md-callout.md-callout-caution {
  background: rgba(239, 68, 68, .08);
  border-color: #ef4444;
}

.md-callout-caution .md-callout-header {
  color: #ef4444;
}

/* blockquote (通常) */
.md-blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(108, 142, 245, .07);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}

/* --- ==ハイライト== --- */
mark.md-highlight {
  background: rgba(245, 158, 11, .22);
  color: var(--text);
  border-radius: 3px;
  padding: 1px 5px;
  font-style: normal;
}

[data-theme="dark"] mark.md-highlight {
  background: rgba(245, 158, 11, .28);
}

/* --- ++スタイリッシュ下線++ --- */
u.md-underline {
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-size: 100% 2px;
  background-repeat: no-repeat;
  padding-bottom: 2px;
  font-style: normal;
}

/* --- ::バッジ:: --- */
.md-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 1px 11px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  vertical-align: middle;
  line-height: 1.8;
}

/* --- [[Kbd]] --- */
.md-kbd {
  display: inline-block;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--border);
  border-radius: 5px;
  padding: 1px 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78em;
  color: var(--text-muted);
  vertical-align: middle;
  line-height: 1.8;
}


.unity-player-wrapper {
  margin: 32px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  box-shadow: var(--shadow);
}

.unity-player-container {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  aspect-ratio: 16/9;
  background: #000;
}

.unity-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  /* 画像補間によるぼやけを防ぐ設定 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Unity ローディングオーバーレイ */
.unity-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #050508;
  z-index: 10;
  gap: 16px;
  transition: opacity .5s;
}

.unity-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.unity-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(108, 142, 245, .2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.unity-loading-text {
  color: #9aa3b5;
  font-size: .9rem;
}

.unity-progress-bar-outer {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, .1);
  border-radius: 4px;
  overflow: hidden;
}

.unity-progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width .2s;
  width: 0%;
}

.unity-progress-pct {
  color: #6c88a2;
  font-size: .78rem;
}

.unity-error-msg {
  color: #f87171;
  font-size: .85rem;
  text-align: center;
  max-width: 360px;
  padding: 0 16px;
}

/* Unity コントロールバー */
.unity-controls {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  background: #0a0c14;
  border-top: 1px solid #1a2030;
}

.unity-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #9aa3b5;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .8rem;
  transition: all .2s;
}

.unity-fullscreen-btn:hover {
  background: rgba(108, 142, 245, .2);
  border-color: var(--accent);
  color: #fff;
}

.unity-fullscreen-btn svg {
  width: 15px;
  height: 15px;
}

/* フルスクリーン時のキャンバスリサイズ */
.unity-player-container:fullscreen,
.unity-player-container:-webkit-full-screen,
.unity-player-container:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* ---------- 前後ナビ ---------- */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.article-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color .2s, transform .2s;
}

.article-nav-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.article-nav-btn.next {
  text-align: right;
}

.nav-dir {
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
}

.nav-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- サイドバー・目次 ---------- */
.article-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.toc-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toc-header {
  padding: 12px 16px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.toc-nav {
  padding: 10px 0;
}

.toc-link {
  display: block;
  padding: 5px 16px;
  font-size: .82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s, background .2s;
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc-link.level-3 {
  padding-left: 28px;
  font-size: .78rem;
}

/* ---------- 404 ---------- */
.not-found {
  text-align: center;
  padding: 120px 24px;
}

.not-found-code {
  font-size: 6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 16px;
}

.not-found-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.not-found-text {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}

.btn-primary:hover {
  opacity: .85;
  transform: translateY(-2px);
}

/* ---------- フッター ---------- */
#site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.footer-copy {
  color: var(--text-faint);
  font-size: .82rem;
}

/* ---------- スクロールトップ ---------- */
.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(108, 142, 245, .5);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .3s, transform .3s;
  z-index: 200;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top svg {
  width: 20px;
  height: 20px;
}

.scroll-top:hover {
  transform: translateY(-2px);
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 960px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    display: none;
  }
}

@media (max-width: 640px) {
  .search-input {
    width: 140px;
  }

  .search-input:focus {
    width: 160px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 48px 16px 40px;
  }

  .article-nav {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 24px 16px 60px;
  }

  .header-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .article-layout {
    padding: 24px 16px 60px;
  }

  .scroll-top {
    bottom: 16px;
    right: 16px;
  }
}

/* スクリーンリーダー専用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toc-mobile-wrapper {
  display: none;
  margin: 24px 0;
}

@media (max-width: 960px) {

  /* サイドバーの目次を非表示に */
  .article-sidebar {
    display: none;
  }

  /* スマホ用コンテナを表示 */
  .toc-mobile-wrapper {
    display: block;
  }

  /* 記事内目次の微調整（背景を少し変えて区別しやすく） */
  .toc-mobile-wrapper .toc-box {
    width: 100%;
    background-color: var(--bg-hover);
    border: 1px solid var(--border);
  }
}