/* --- ベース --- */
:root{
  --max-width: 820px;
  --content-width: 700px;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --muted: #7a7a7a;
  --accent: #0066cc;
  --radius: 0;
  --shadow: 0;
  --text: #222;
}

* { box-sizing: border-box; }


body {
  font-family: "YakuHanJP", "游ゴシック体", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding-top: 60px; /* ナビ分の余白を確保 */
}
html, body {
  overflow-x: hidden !important;
}
body p{
  font-family: "YakuHanJP", "游ゴシック体", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 1.125rem;
}
/* コンテナー（中央寄せ） */
.container {
  max-width: var(--max-width);
  margin: 36px auto;
  padding: 24px;
}

/* --- 記事カード --- */
.blog-article,
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 24px;
  overflow: hidden;
}

/* タイトル */
.blog-article h1 {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

/* メタ情報 */
.blog-article .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

/* コンテンツ領域 */
.blog-article .content {
  margin-top: 18px;
  font-size: 1.03rem;
  color: var(--text);
}

/*本文の段落*/
.blog-article .content p {
  margin: 1em 0;
}

/* 見出し */
.blog-article .content h2 {
  font-size: 1.25rem;
  margin: 1.4em 0 0.6em;
  letter-spacing: -0.01em;
}
.blog-article .content h3 {
  font-size: 1.05rem;
  margin: 1.2em 0 0.5em;
}

/* リスト */
.blog-article .content ul,
.blog-article .content ol {
  margin: 1em 0 1em 1.2em;
  padding: 0;
}

/* 引用 */
.blog-article .content blockquote {
  margin: 1em 0;
  padding: 14px 18px;
  background: #f6f8fa;
  border-left: 4px solid #e6eefc;
  border-radius: 8px;
  color: #333;
}

/* コードブロック */
.blog-article .content pre {
  background: #0f1724;
  color: #e6eef8;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Noto Sans Mono", monospace;
  font-size: 0.92rem;
}

/* インラインコード */
.blog-article .content code {
  background: #f4f6f8;
  padding: 0 6px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
}

/* リンク */
.blog-article .content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- 画像の表示制御（ここが重要） --- */

/* 画像はカード内で中央に揃え、最大幅はコンテンツ幅に合わせる */
.blog-article .content figure,
.blog-article .content .image,
.blog-article .content p img {
  display: block;
  margin: 18px auto;
  max-width: 100%;
  width: auto;
}

/* 画像そのもの */
.blog-article .content img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: cover; /* トリミングされるのを避けるがある程度見栄え良く */
  user-select: none;       /* ドラッグや選択無効 */
  display: block;
}

/* 大きすぎる画像を親幅に収め、縦長でも横長でも美しく */
.blog-article .content figure {
  max-width: var(--content-width);
  width: 100%;
}

/* 画像キャプション */
.blog-article .content figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* 画像にリンクがある場合、リンクのテキスト（ファイル名）が見える不具合対策：
   画像だけを含むリンクの「可視テキスト」を消す（スクリーンリーダー用の alt と title は残す）*/
.blog-article .content a > img {
  vertical-align: middle;
}

/* modern browsers: hide text nodes inside links that only wrap images using :has()
   ブラウザ互換性に注意（Safari/Chrome/Edgeは対応） */
.blog-article .content a:has(img) {
  color: inherit;
  text-decoration: none;
}

/* Fallback: smaller font-size for a>img (hides adjacent plain text less intrusively) */
.blog-article .content a:has(img) * { font-size: 0; line-height: 0; }

/* --- stats / like area --- */
.blog-article .stats {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.98rem;
}
#like-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
#like-btn:hover { background: rgba(0,0,0,0.03); }

/* --- フォーム（Trixエディタ）向け調整 --- */
trix-editor {
  min-height: 380px;
  border-radius: 8px;
  border: 1px solid #e6e6e6;
  background: #fff;
  padding: 14px;
  box-shadow: none;
  font-size: 1rem;
}

/* Trixのツールバーをnote風に少し整える */
.trix-button-row {
  border-bottom: 1px solid #eee;
  background: transparent;
}

/* フォーム下部の説明等 */
.note-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

/* --- レスポンシブ調整 --- */
@media (max-width: 900px){
  :root { --max-width: 92%; --content-width: 100%; }
  .container { padding: 16px; margin: 20px auto; }
  .blog-article { padding: 20px; }
  .blog-article h1 { font-size: 1.5rem; }
}

@media (max-width: 480px){
  body { font-size: 15px; }
  .blog-article .content { font-size: 1rem; }
  trix-editor { min-height: 260px; }
}
nav.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(250, 250, 250, 0.95);
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transform: translateY(0);
  transition: transform 0.4s ease, background 0.3s ease;
  z-index: 1000;
}

nav.navbar.hidden {
  transform: translateY(-100%);
}

nav.navbar .nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

nav.navbar .logo {
  font-family: 'Permanent Marker', cursive;
  font-size: 1.4rem;
  color: #222;
  text-decoration: none;
}

nav.navbar a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
/* ✅ ロゴ画像調整 */
nav.navbar .logo {
  height: 42px;          /* ロゴの高さを調整（ちょうど良いサイズ） */
  width: auto;
  object-fit: contain;
  margin-right: 1rem;
}
nav.navbar a:hover {
  color: #0070f3;
}
.prev-next {
  display: flex;
  justify-content: space-between;
  margin: 30px 0;
  font-family: 'Noto Sans JP', sans-serif;
}

.prev-next a {
  text-decoration: none;
  color: #333;
  background: #f2f2f2;
  padding: 10px 20px;
  border-radius: 8px;
  transition: 0.3s;
}

.prev-next a:hover {
  background: #e0e0e0;
}

/* ===============================
   ランダム記事セクション
   =============================== */
.random-articles {
  margin-top: 50px;
}

.random-articles h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-family: 'Noto Sans JP', sans-serif;
  color: #222;
}

.random-articles .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
}

.random-articles .item {
  display: block;
  text-decoration: none;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.random-articles .item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.random-articles .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.random-articles .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.random-articles .title {
  padding: 10px;
  font-size: 1rem;
  text-align: center;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.3;
}
/* ====== 768px以下用 ====== */
@media (max-width: 768px) {
  nav.navbar .nav-inner {
    padding: 8px 15px;
    gap: 1rem;
    flex-wrap: wrap; /* アイテムが折り返す場合に対応 */
  }

  nav.navbar .logo {
    height: 36px;  /* 小さい画面用にロゴを縮小 */
    margin-right: 0.5rem;
  }

  nav.navbar a {
    font-size: 0.85rem; /* フォントを少し小さく */
  }
}
