.news-archive-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.intro-text {
  margin-bottom: 2rem;
  text-align: center; /* ← テキストを中央揃えにする */
  font-size: 2rem;
}

/* 絞り込み・ソートのスタイル */
.filter-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #ccc;
  border-radius: 20px;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background-color: #D7743B;
  color: white;
  border-color: #D7743B;
}

/* selectタグを囲むラッパー */
.select-wrapper {
  position: relative; /* 矢印を配置する基準点にする */
  display: inline-block;
}

/* セレクトボックス自体のスタイル */
#sort-select {
  /* ブラウザのデフォルトの見た目を消す */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* ボタンと似たデザインにする */
  padding: 0.5rem 2.5rem 0.5rem 1rem; /* 右側に矢印用のスペースを確保 */
  border: 2.5px solid #ccc;
  border-radius: 20px;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease; /* アニメーション効果 */
}

/* ★ドロップダウンがアクティブな時のスタイル (こちらが新しい正しい指定です) */
#sort-select.active {
  background-color: #D7743B;
  color: white;
  border-color: #D7743B;
}

/* カスタムの矢印を作成 */
.select-wrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 1rem; /* 右からの位置 */
  transform: translateY(-50%);
  pointer-events: none; /* 矢印部分がクリックを邪魔しないように */
  
  /* 三角形を描画 */
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #555; /* 矢印の色 */
}

/* --- 縦型タイムラインのレイアウト --- */
.history {
  padding: 20px;
}

.history-item {
  background-color: #f7f7f7;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px; /* ★縦並びの余白 */
  border-left: 5px solid #D7743B; /* 左のアクセントライン */
  display: flex;
  align-items: flex-start; /* 上揃えにする */
  gap: 24px; /* テキストと画像の間の隙間 */
}


/* ★テキストコンテンツ部分（左側）*/
.history-text-content {
  flex: 1; /* ★残りのスペースをすべて使う */
}

/* ★画像部分（右側）*/
.history-image {
  flex: 0 0 250px; /* ★画像の幅を250pxで固定 */
  margin-top: 0; /* 不要になるのでリセット */
}

.history-image img {
  width: 100%;
  border-radius: 4px;
  display: block;
}

/* --- タグのスタイル --- */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
  color: white;
  margin-bottom: 15px; /* 下のテキストとの余白 */
}

/* カテゴリごとの色分け */
.tag.設立 { background-color: #28a745; }
.tag.イベント { background-color: #fd7e14; }
.tag.ニュース { background-color: #17a2b8; }


/* --- カード内部のスタイル（前回とほぼ同じ）--- */
.history-header .year { font-size: 2.5rem; font-weight: bold; }
.history-header .month { font-size: 1rem; }
.history-body { margin-top: 16px; line-height: 1.6; }
.history-image { margin-top: 24px; }
.history-image img { width: 100%; max-width: 300px; border-radius: 4px; }

/* ===================================
   スマホ表示用の特別スタイル (768px以下で適用)
   =================================== */
@media (max-width: 768px) {

  /* --- 横スクロールの原因解消 & オーバーレイの準備 --- */
  .history-item {
    display: block; /* display:flexを解除し、横並びをやめる */
    position: relative; /* 子要素を絶対配置する基準にする */
    padding: 0; /* 内側の余白はテキスト側に持たせるのでリセット */
    overflow: hidden; /* 角丸から画像がはみ出ないように */
    border-left: 5px solid #D7743B; /* 左の線は維持 */
    gap: 16px;
  }

  /* --- 画像を背景のように配置 --- */
  .history-image {
    /* 親要素いっぱいに広がる背景にする */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* テキストより奥に配置 */
    margin: 0; /* 不要な余白をリセット */
  }

  .history-image img {
    /* 画像自体を半透明にする */
    opacity: 0.2;
    flex: 1 1 40%;
    /* 画像がコンテナを綺麗に埋めるように調整 */
    object-fit: cover;
    height: 100%;
    max-width: none; /* 横幅の制限を解除 */
  }
  
  /* --- テキストを画像の上に重ねる --- */
  .history-text-content {
    position: relative; /* position:absoluteの画像より手前に来るように */
    z-index: 2; /* 画像より手前に配置 */
    flex: 1 1 60%;
    /* テキストが読みやすいように調整 */
    padding: 24px;
    background-color: rgba(244, 189, 90, 0.2); /* 少し暗いオーバーレイを敷く */
    min-height: 200px; /* カードの最低限の高さを確保 */
    color: #D7743B; /* テキストの基本色を白に */
  }

  /* --- テキスト内部の各要素の色も調整 --- */
  .history-header .year,
  .history-header .month,
  .history-body h3,
  .history-body p {
    color: #D7743B; /* すべての文字を白にして可読性を上げる */
  }

  .tag {
    /* タグの色はカテゴリカラーを維持しつつ、文字色を調整 */
    color: white;
    text-shadow: 0 0 3px rgba(0,0,0,0.5); /* 影をつけて読みやすく */
  }
}