/* ブログ(一覧・記事)共通の見た目。色・フォント・背景は style.css の変数をそのまま使う */

.blog-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) 24px 64px;
}

/* ── 上部: 戻るリンクとブログ名 ───────────────── */
.blog-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.blog-name {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-decoration: none;
}

/* ── 一覧 ───────────────── */
.blog-index-title {
  margin: 48px 0 32px;
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
}
.post-list {
  list-style: none;
  margin: 0;
  padding: 0 clamp(16px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* 背景の写真の上でも読みやすいよう、記事と同じく薄く塗ってぼかす */
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.post-list li:last-child { border-bottom: 0; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 0.2em 1.2em;
  padding: 18px 4px;
  color: var(--text);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
.post-list time { color: var(--muted); font-size: 0.85rem; padding-top: 0.15em; }
.post-list-title { font-size: 1.1rem; }
.post-list-desc { grid-column: 2; color: var(--muted); font-size: 0.85rem; }
.post-empty { color: var(--muted); }
@media (hover: hover) {
  .post-list a:hover { color: var(--accent); background: color-mix(in srgb, var(--surface) 50%, transparent); }
}

/* ── 記事 ───────────────── */
.post {
  margin-top: 40px;
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* 背景の写真の上でも読みやすいよう、薄く塗ってぼかす */
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.post-date { margin: 0; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; }
.post-head h1 {
  margin: 8px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.35;
  letter-spacing: 0.04em;
}
.post-tags { margin-top: 16px; }

.post-body { margin-top: 32px; line-height: 2; }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 1.2em 0; }
/* 見出しはカードの見出しと同じ、角かっこ風 */
.post-body h2 {
  display: inline-block;
  margin: 2.2em 0 0.6em;
  padding: 0 0.6em;
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  background:
    linear-gradient(var(--accent), var(--accent)) left top / 6px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 6px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right top / 6px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 6px 2px no-repeat;
  font-size: 1.25rem;
  line-height: 1.6;
}
/* ### は L 字の線(左の縦線 + 下の横線)で囲む */
.post-body h3 {
  display: inline-block;
  margin: 1.8em 0 0.4em;
  padding: 0.15em 0.9em 0.25em 0.6em;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  font-size: 1.1rem;
  line-height: 1.6;
}
/* #### は短い線のあとに */
.post-body h4 {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 1.6em 0 0.3em;
  font-size: 1rem;
}
.post-body h4::before {
  content: "";
  flex: none;
  width: 1em;
  height: 2px;
  background: var(--accent);
}
/* ##### 以下は小さめの太字 */
.post-body h5,
.post-body h6 {
  margin: 1.4em 0 0.2em;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.post-body a { color: var(--accent); text-underline-offset: 3px; }
.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6em auto;
  border-radius: var(--radius);
}
.post-body blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.post-body ul,
.post-body ol { padding-left: 1.4em; }
.post-body li + li { margin-top: 0.3em; }
.post-body code {
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  font-size: 0.9em;
}
.post-body pre {
  overflow-x: auto;
  padding: 1em 1.2em;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  line-height: 1.6;
}
.post-body pre code { padding: 0; background: none; }
.post-body hr { margin: 2.4em 0; border: 0; border-top: 1px dashed var(--line); }

/* 前後の記事 */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  font-size: 0.9rem;
}
.post-nav a { color: var(--muted); text-decoration: none; }
@media (hover: hover) {
  .post-nav a:hover { color: var(--accent); }
}

.blog-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 96px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

/* ── トップページとの行き来(assets/js/blog.js) ───────────────── */
/* 来たとき: 上から降りてきて、なめらかに止まる */
.is-entering .blog-wrap { animation: blog-enter .8s cubic-bezier(.2, .8, .2, 1) both; }
/* 戻るとき: 上へ加速しながら抜けていく */
.is-leaving .blog-wrap { animation: blog-leave .45s cubic-bezier(.6, 0, .9, .3) both; }
@keyframes blog-enter {
  from { opacity: 0; transform: translateY(-60vh); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blog-leave {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-60vh); }
}

/* 埋め込んだポスト(X)を記事の中央に置く。読み込まれる前はリンクだけの引用として表示される */
.post-body .twitter-tweet { margin: 1.6em auto !important; }
.post-body blockquote.twitter-tweet {
  max-width: 550px;
  padding: 1em 1.2em;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

/* 埋め込んだ動画(YouTube など)は、横幅いっぱいに 16:9 で */
.post-body iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 1.6em auto;
  border: 0;
  border-radius: var(--radius);
}

/* ルビ: <ruby>漢字<rt>かんじ</rt></ruby> */
.post-body ruby { ruby-position: over; }
.post-body rt {
  color: var(--muted);
  font-size: 0.55em;
  letter-spacing: 0.04em;
}

/* 打ち消し線: ~~文字~~ */
.post-body del {
  color: var(--muted);
  text-decoration-thickness: 1px;
}
