/* トップ「井上じゅんこチャンネル」内のショート動画一覧（sections/sec_youtube_shorts.php）
   gulp を通さない素のCSS。front-page のときだけ読み込む（functions.php） */

/* 上の余白は「最新動画」側の margin-bottom で取る。
   ショート欄が消えても（RSSが取れないとき）「横長動画」見出しとの間が詰まらないように */
.topYoutubeChannel__head {
  margin-bottom: 40px;
}

.topYoutubeShorts {
  margin: 0 0 40px;
}

.topYoutubeShorts__ttl {
  font-size: 20px;
  margin-bottom: calc(1.8rem + 6px); /* 赤丸のはみ出し(1.8rem) ＋ 見出しとの間隔6px */
}

/* 長尺3本の上の「横長動画」見出し（sections/sec_youtube_channel.php）。ショートの見出しと同じ見た目 */
.topYoutubeVideos__ttl {
  font-size: 20px;
  margin-bottom: 16px;
}

.topYoutubeShorts__list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topYoutubeShorts__item {
  position: relative;
}

/* 先頭（いちばん新しい）だけ「最新ショート」の赤丸。長尺の「最新長尺」と同じ見た目 */
.topYoutubeShorts__item--latest::before {
  content: "最新\Aショート";
  white-space: pre;
  position: absolute;
  z-index: 2;
  top: -1.8rem;
  left: -1.5rem;
  width: 5rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.2;
  border-radius: 50%;
  background: #ea1300;
  color: #fff;
  pointer-events: none;
}

.topYoutubeShorts__item a {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* ショートのサムネイル（4:3・左右に黒帯）を 9:16 で切り抜くと、黒帯がちょうど消える */
.topYoutubeShorts__thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

.topYoutubeShorts__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.topYoutubeShorts__item a:hover .topYoutubeShorts__thumb img {
  transform: scale(1.05);
}

.topYoutubeShorts__title {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media screen and (max-width: 999px) {
  .topYoutubeShorts__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* スマホは横スクロール */
@media screen and (max-width: 767px) {
  .topYoutubeChannel__head {
    margin-bottom: 3rem;
  }

  .topYoutubeShorts {
    margin: 0 0 3rem;
  }

  .topYoutubeShorts__ttl {
    padding: 0 2rem;
    font-size: 18px;
    margin-bottom: 0; /* 余白はリスト側の padding-top で取る */
  }

  .topYoutubeVideos__ttl {
    padding: 0 2rem;
    font-size: 18px;
    margin-bottom: 0; /* スマホは各カードに margin-top 3rem が付いている */
  }

  .topYoutubeShorts__list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* 横スクロールの枠で赤丸が切れないよう、上と左に余白 */
    padding: calc(1.8rem + 6px) 2rem 8px 3rem; /* 上は赤丸のはみ出し＋6px */
    /* 吸着の基準も余白の内側に。無いと左の余白ごとスクロールして赤丸が切れる */
    scroll-padding-left: 3rem;
    -webkit-overflow-scrolling: touch;
  }

  .topYoutubeShorts__item {
    flex: 0 0 42%;
    scroll-snap-align: start;
  }
}
