/* 全体の横幅は画面幅を超えないようにする */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* 横スクロールを防止 */
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
}

main, .content-wrapper, .posts {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/*レイアウトは Grid や Flexbox を使う*/
.main-wrapper {
  display: flex;
  flex-wrap: wrap;
}


header {
  height: 200px;
  background-image: url("/画像/ヘッダー8.jpg");
  background-size: cover;
  background-position: center;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

header h1 {
  font-size: 2rem;
  margin: 0;
  font-weight: 600;
  color: black;
}

/* スマホ向け調整（768px以下） */
@media (max-width: 768px) {
  header {
    height: 100px !important;
  }

  header h1 {
    font-size: 1.2rem !important;
  }
}

.header-image {
  width: 100%;        /* 親要素（header）の横幅に合わせる */
  height: auto;       /* 縦横比を保つ */
  display: block;     /* 画像の下に変な余白が出ないように */
  border-radius: 0;   /* 必要なら角を丸めない */
}


/*フッター*/
footer {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: #e5f3ff;
  color: black;
  padding: 15px;
  text-align: center;
  font-size: 1.0rem;
}

footer .sns {
  text-align: left;        /* ← 左寄せ */
  padding-left: 20px;     /* 左に余白 */
}


footer .sns ul {
  list-style: none;        /* ← ・を消す */
  padding-left: 0;         /* ← 左の余白もなくす */
  margin: 0;
}

footer .sns li {
  display: inline-block;   /* 複数アイコンが横並びになるように */
  margin-right: 10px;      /* 必要に応じてスペース調整 */
}


/*これで画像がスマホの横幅にフィット*/
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* カテゴリバー全体の背景・余白・幅*/
.category-bar {
  background-color: #374653;
  padding: 0.2rem 1rem;
  width:100%;
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
  white-space: nowrap;
}

/* リストを横並びにし、中央揃えに */
.category-bar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  padding: 1rem 0;  /* ← 縦幅を太くする */
  justify-content: center;
}



/* 各リンクのスタイル */
.category-bar a {
  text-decoration: none;
  color: white;
  font-weight: 400;              /* 通常：400、やや細くしたいなら 300 */
  padding: 0.3rem 0.6rem;
  transition: color 0.3s ease;   /* 色変化をスムーズに */
}

/* ホバー時の色変化 */
.category-bar a:hover {
  color: #007acc;
}

@media (max-width: 768px) {
  .category-bar ul {
    flex-wrap: wrap;             /* 項目を折り返し可能に */
    justify-content: center;     /* 中央寄せ（必要に応じて） */
    padding: 0.1rem;/* ← ul自体の上下余白も調整 */
    gap: 0.4rem;/* ← カテゴリー項目間のスペースも少し縮める */
    overflow: hidden;
  }

  .category-bar a {
    font-size: 0.85rem;          /* 文字サイズを小さく */
    padding: 0.2rem 0.3rem;      /* 余白を小さくして幅を節約 */
    white-space: nowrap;         /* 項目の途中で改行しないように */
    display: inline-block;
    max-width: 100%;             /* はみ出さないよう制限 */
    overflow: hidden;            /* はみ出しを隠す */
    text-overflow: ellipsis;     /* 長すぎる場合は「...」で省略 */
  }

  .category-bar {
    overflow-x: hidden;          /* 横スクロールを無効に */
    width: 100%;
  }
}


.posts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex-grow: 1;
  max-width: calc(100% - 260px);
}

/*投稿とサイドメニュー並べるやつ */
.content-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
  flex-wrap: wrap;
}

/* 投稿記事のサムネ等 */
.content-wrapper {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
}

.side-menu {
  width: 240px;
  background-color: #eee;
  padding: 1rem;
  border-radius: 6px;
  flex-shrink: 0;
  margin-right: 20px; /* サイドメニューの右側に余白 */
}

@media (max-width: 768px) {
  .side-menu {
    display: none;
  }
}
/* スマホ表示（幅が768px以下）のときだけ 2列に変更 */
@media (max-width: 768px) {
  .posts {
    grid-template-columns: repeat(2, 1fr);
  max-width: calc(100%);/* スマホ表示（幅が768px以下）のとき画面右側のサイドメニュー用の余白を無くす*/
  }
}

.post { 
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  box-sizing: border-box;
  min-width: 0;             /* ← 横幅崩れを防ぐ */
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}


.post h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.post .date {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 12px;
}

.post p {
  flex-grow: 1;
  color: #444;
  font-size: 0.9rem;
  line-height: 1.4;
}

.post img {
  width: 100%;
  aspect-ratio: 16 / 9; /* 横長比率（比率調整は好みで） */
  object-fit: cover;     /* トリミングして枠にぴったり */
  display: block;
｝

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
}