/**
 * トップ新着記事スライダー（css/latest-slider.css）
 *
 * .latest-slider          … ブロック外枠
 *   .latest-slider__head  … 見出し（既存 menu-light-green を併用）
 *   .latest-slider__viewport … 相対配置・左右ナビの基準
 *     .latest-slider__track  … 横スクロール＋スクロールスナップのトラック
 *       .latest-slider__item / .latest-card … 記事カード
 *     .latest-slider__nav    … 左右送りボタン（JSで表示制御）
 *
 * archive-nav（下段）のスタイルは blog-cards.css を流用。
 * @package yukai
 */

.latest-block {
  margin: 4% auto;
}

/* ---- リスト⇄カード 切替：目立たないテキストリンク ---- */
/* 「カードで見る」= new枠内の右下 ／ 「リストに戻す」= カード下の右寄せ。 */
.latest-toggle--text {
  display: inline-block;
  padding: 2px;
  border: none;
  background: none;
  color: #6b7d5f;          /* 落ち着いた緑グレーで控えめに */
  font-size: 80%;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}
.latest-toggle--text:hover,
.latest-toggle--text:focus-visible {
  color: #3E672B;
  text-decoration: underline;
}

/* 新着リスト枠（.ul-ri）内・右下に置く「カードで見る」 */
.ul-ri__more {
  list-style: none !important;
  padding: 0.2em 0 0 !important;
  text-align: right;
}
/* 通常 li の new アイコン（:before）と new タブ（:after）を打ち消す */
.ul-ri__more::before,
.ul-ri__more::after {
  content: none !important;
}

/* カード下の「リストに戻す」行：右寄せ */
.latest-cards__foot {
  margin-top: 6px;
  text-align: right;
}

/* リストビューは元の .ul-ri 余白が大きいので、この文脈では詰める */
.latest-view--list .ul-ri {
  margin: 0;
}

/* ---- ビューポート（左右ナビの配置基準） ---- */
.latest-slider__viewport {
  position: relative;
}

/* ---- トラック：横スクロール＋スナップ（＝スワイプ対応） ---- */
.latest-slider__track {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 4px 4px 14px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #63945f transparent;
}
.latest-slider__track::-webkit-scrollbar {
  height: 8px;
}
.latest-slider__track::-webkit-scrollbar-thumb {
  background: #63945f;
  border-radius: 8px;
}
.latest-slider__track::-webkit-scrollbar-track {
  background: transparent;
}

.latest-slider__item {
  flex: 0 0 auto;
  width: 220px;
  scroll-snap-align: start;
  list-style-type: none !important;
}

/* ---- 記事カード ---- */
.latest-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: solid 2px #3E672B;
  border-radius: 8px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.latest-card:hover,
.latest-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(62, 103, 43, .28);
  color: inherit;
  text-decoration: none;
}

.latest-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #eef2ea;
  overflow: hidden;
}
/* aspect-ratio 非対応ブラウザ向けフォールバック */
@supports not (aspect-ratio: 4 / 3) {
  .latest-card__media { height: 165px; }
}

.latest-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.latest-card__noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 10px;
  text-align: center;
  font-size: 90%;
  color: #6b7d5f;
  background: repeating-linear-gradient(135deg, #eef2ea, #eef2ea 10px, #e6ece1 10px, #e6ece1 20px);
}

.latest-card__date {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 3px 8px;
  font-size: 78%;
  color: #fff;
  background: rgba(62, 103, 43, .85);
}

.latest-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 10px 12px 12px;
  font-size: 95%;
  line-height: 1.45;
  font-weight: 600;
}

/* ---- 左右送りボタン（JSで hidden を外す） ---- */
.latest-slider__nav {
  position: absolute;
  top: calc(50% - 14px); /* カード上部の画像中央あたり */
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(62, 103, 43, .9);
  color: #fff;
  font-size: 26px;
  line-height: 40px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: background .15s ease, opacity .15s ease;
}
.latest-slider__nav:hover {
  background: #3E672B;
}
.latest-slider__nav[disabled] {
  opacity: .35;
  cursor: default;
}
.latest-slider__nav--prev { left: -6px; }
.latest-slider__nav--next { right: -6px; }

/* ---- 過去の記事：月タイル横スライダー ---- */
.archive-nav--top {
  margin-top: 1.5rem;
}

/* 見出しクリックで開閉（初期は閉じてすっきり） */
.archive-collapse__summary {
  display: flex;
  align-items: center;
  gap: .5em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  margin-bottom: 0; /* 閉じている間は下余白なし */
}
.archive-collapse[open] > .archive-collapse__summary {
  margin-bottom: .9rem;
}
.archive-collapse__summary::-webkit-details-marker { display: none; }
/* 開閉キャレット（CSS三角・FA非依存） */
.archive-collapse__summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 8px solid #3E672B;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  transition: transform .2s ease;
}
.archive-collapse[open] > .archive-collapse__summary::before {
  transform: rotate(90deg);
}

/* 月リンク（アコーディオン内）：クリックで記事スライダーを開く */
.archive-month {
  cursor: pointer;
}
.archive-month.is-active {
  background: #3E672B;
  color: #fff;
  border-radius: 4px;
}
.archive-month.is-active .archive-nav__mc {
  color: #e8efe2;
}

/* 月クリックでその場に開く記事スライダーのパネル（全幅） */
.archive-month-panel {
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px dashed #cdd8c4;
}
.archive-month-loading,
.archive-month-empty {
  margin: .6rem 0;
  padding: .4rem;
  color: #6b7d5f;
  font-size: 90%;
}

/* ---- スマホ ---- */
@media screen and (max-width: 590px) {
  .latest-block { margin: 4% 0; }
  .latest-slider__item { width: 160px; }
  .latest-slider__nav { display: none; } /* スワイプで操作 */
}

/* =========================================================
 * メインビジュアル・カルーセル（myphp/carousel.php）の高さ統一
 * -------------------------------------------------------
 * 各写真の比率差（4:3 / 5:4）で img-fluid（高さauto）だと
 * スライドごとに高さが変わり、切替時に表示がガタつく。
 * → 枠を 4:3 に固定し、写真は object-fit:contain で全体表示
 *   （切り取らない）。枠に足りない分は背景色のフレームで埋める。
 * フェードで2枚が重なっても崩れないよう各スライドは絶対配置。
 * ========================================================= */
#main_visual .carousel-inner {
  position: relative;
  aspect-ratio: 4 / 3;   /* 全スライド共通の枠比率（3枚中2枚が 4:3） */
  background: #f4f1ea;   /* フレーム（余白）の色 */
  overflow: hidden;
}
/* aspect-ratio 非対応ブラウザ向けフォールバック（3/4 = 75%） */
@supports not (aspect-ratio: 4 / 3) {
  #main_visual .carousel-inner { height: 0; padding-bottom: 75%; }
}
#main_visual .carousel-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
#main_visual .carousel-item > img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* 写真全体を表示・切り取らない */
  object-position: center;
}
