:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --text: #1a2230;
  --muted: #5b6675;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eef2ff;
  --border: #e7eaef;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --maxw: 720px;
  --maxw-wide: 960px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 17px;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img { max-width: 100%; height: auto; border-radius: 10px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== ヘッダー ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}
.site-logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--text);
}
.site-logo:hover { text-decoration: none; color: var(--accent); }

/* ===== ヒーロー（トップ） ===== */
.hero {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 64px 20px 40px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.35;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}
.hero p {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 記事一覧 ===== */
.post-list {
  list-style: none;
  padding: 0 20px;
  margin: 16px auto 72px;
  max-width: var(--maxw-wide);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.post-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.1), 0 18px 40px rgba(16, 24, 40, 0.08);
}
.post-link { display: block; color: var(--text); }
.post-link:hover { text-decoration: none; }
.post-date {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
.post-item-title {
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 12px;
}
.post-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 10px 0 0;
}

/* ===== 記事ページ ===== */
.post { padding: 48px 0 8px; }
.post-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.45;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}
.post-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 28px;
}

/* リード文（冒頭の段落） */
.post-body .lead {
  font-size: 1.12rem;
  line-height: 1.95;
  font-weight: 500;
  color: #2b3543;
  padding: 2px 0;
  background: linear-gradient(transparent 68%, #e3ecff 0);
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* 目次 */
.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 22px;
  margin: 0 0 40px;
}
.toc-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
}
.toc-title::before { content: "📑 "; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin: 6px 0; font-size: 0.95rem; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); }

/* 本文 */
.post-body { counter-reset: h2; font-size: 1.04rem; }
.post-body > *:first-child { margin-top: 0; }

.post-body h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.45rem;
  line-height: 1.5;
  margin: 52px 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.post-body h2::before {
  counter-increment: h2;
  content: counter(h2);
  flex: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 800;
}
.post-body h3 {
  font-size: 1.18rem;
  margin: 32px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.post-body p { margin: 18px 0; }
.post-body strong {
  font-weight: 700;
  background: linear-gradient(transparent 60%, #fff1a8 0);
  padding: 0 1px;
}
.post-body a { text-decoration: underline; text-underline-offset: 2px; }

/* 箇条書き（おしゃれなマーカー） */
.post-body ul { list-style: none; padding-left: 0; }
.post-body ul li { position: relative; padding-left: 1.6em; margin: 10px 0; }
.post-body ul li::before {
  content: "";
  position: absolute;
  left: 0.25em;
  top: 0.7em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}
.post-body ol { padding-left: 1.4em; }
.post-body ol li { margin: 10px 0; }

/* 表 */
.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 24px 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  border-radius: 10px;
}
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.post-body th { background: var(--accent-soft); font-weight: 700; }
.post-body tr:nth-child(even) td { background: #fcfcfd; }

/* コード */
.post-body code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.post-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.6;
}
.post-body pre code { background: none; padding: 0; color: inherit; }

/* ポイント枠（引用を吹き出し風に） */
.post-body blockquote {
  position: relative;
  margin: 28px 0;
  padding: 18px 20px 18px 52px;
  background: #f3f7ff;
  border: 1px solid #dbe4ff;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  color: #33415a;
}
.post-body blockquote::before {
  content: "💡";
  position: absolute;
  left: 16px;
  top: 16px;
  font-size: 1.1rem;
}
.post-body blockquote p { margin: 6px 0; }

/* 用語解説ボックス */
.post-body .term {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 22px 0;
  font-size: 0.97rem;
  line-height: 1.8;
}
.post-body .term::before {
  content: "📘";
  flex: none;
  font-size: 1.1rem;
  line-height: 1.7;
}
.post-body .term strong { background: none; color: #15803d; }

/* たとえばボックス（イメージ・比喩） */
.post-body .analogy {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 22px 0;
}
.post-body .analogy::before {
  content: "💭 イメージ";
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: #b45309;
  margin-bottom: 4px;
}

/* 図（Mermaid）の表示枠 */
.post-body .mermaid {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin: 24px 0;
  text-align: center;
  overflow-x: auto;
}

.back-link { margin: 48px 0 16px; }
.back-link a { font-weight: 600; }

/* ===== フッター ===== */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 28px 20px;
  margin-top: 56px;
  background: var(--bg-soft);
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 44px 20px 28px; }
  .post { padding: 32px 0 8px; }
  .post-body h2 { font-size: 1.25rem; }
  .post-body h2::before { width: 28px; height: 28px; }
}
