/* =========================================================================
   jrcs-hbs-core プラグイン CSS
   ---------------------------------------------------------------------
   ここではレイアウトの「骨組み」（グリッド列数・カードの並び方・
   ブレイクポイント）を定義しています。色味やフォントなど見た目の
   細かな調整はLightning子テーマ側（style.css）で上書きしてください。
   ========================================================================= */

/* ▼▼▼ PC／スマートフォンの切り替えブレイクポイント。変更する場合はここを統一して書き換える ▼▼▼ */
:root {
	--hbs-breakpoint: 768px;
	--hbs-red: #e60027;      /* 日赤ブランドカラー（赤） */
	--hbs-red-dark: #b8001f;
	--hbs-text: #222222;
	--hbs-muted: #6b6b6b;
	--hbs-border: #eee;
	--hbs-radius: 12px;
}

.hbs-top,
.hbs-archive,
.hbs-info-archive,
.hbs-episode {
	max-width: 1080px;
	margin: 0 auto;
	padding: 24px 16px 64px;
	box-sizing: border-box;
}

.hbs-section-title {
	font-size: 1.4rem;
	font-weight: 700;
	margin: 40px 0 16px;
	color: var(--hbs-text);
}

/* -------------------------------------------------------------------
   Hero（TOPページ最上部／配信開始前モードも同じ構造を共用）
   ------------------------------------------------------------------- */
.hbs-hero {
	display: grid;
	grid-template-areas: "thumb" "info";
	gap: 16px;
	align-items: center;
}

.hbs-hero__thumb {
	grid-area: thumb;
	display: block;
	/* サムネイルを画面端やヘッダーに密着させないための余白 */
	padding: 8px;
	box-sizing: border-box;
}

.hbs-hero__img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var(--hbs-radius);
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.hbs-hero__img--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0f1;
	color: #999;
}

.hbs-hero__info {
	grid-area: info;
	padding: 0 8px;
}

.hbs-hero__label {
	display: inline-block;
	color: var(--hbs-red);
	font-weight: 700;
	font-size: 0.85rem;
	margin: 0 0 8px;
}

/* 固定ブランドラベル「日赤HeartBeatStation150」：赤背景・白文字のバッジ表示
   TOPのHeroと個別Episodeページの両方で共用します（Task 13/14） */
.hbs-hero__label--brand,
.hbs-episode__no--brand {
	display: inline-block;
	background: var(--hbs-red);
	color: #fff;
	font-weight: 700;
	font-size: 0.75rem;
	letter-spacing: 0.02em;
	padding: 4px 10px;
	border-radius: 4px;
	margin: 0 0 8px;
}

.hbs-hero__title {
	font-size: 1.5rem;
	line-height: 1.4;
	margin: 0 0 12px;
	/* タイトルは省略しない仕様のため line-clamp は使用しない */
}

.hbs-hero__title a {
	color: inherit;
	text-decoration: none;
}

.hbs-hero__excerpt {
	color: var(--hbs-muted);
	line-height: 1.7;
	margin: 0;
	/* PC表示時のみ抜粋文を2行程度に丸める（表示領域に応じてCSSで省略） */
}

/* PC表示：左に情報、右にサムネイル。768pxがPC/スマホの切り替え基準 */
@media (min-width: 768px) {
	.hbs-hero {
		grid-template-columns: 1fr 2fr; /* 情報:映像 = 1:2（PC表示で映像を大きく／Task 15） */
		grid-template-areas: "info thumb";
		gap: 32px;
	}
	.hbs-hero__excerpt {
		display: -webkit-box;
		-webkit-line-clamp: 6;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}
}

/* -------------------------------------------------------------------
   Informationエリア（タイトルリンクのみ・行数で省略）
   ------------------------------------------------------------------- */
.hbs-information-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--hbs-border);
}

.hbs-information-list__item {
	border-bottom: 1px solid var(--hbs-border);
}

.hbs-information-list__link {
	display: flex;
	align-items: baseline;
	gap: 12px;
	padding: 12px 4px;
	text-decoration: none;
	color: var(--hbs-text);
}

.hbs-information-list__date {
	flex: none;
	color: var(--hbs-muted);
	font-size: 0.85rem;
}

.hbs-information-list__title {
	/* Information見出し：スマホでは2行、PCでは1行までで「…」表示 */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

@media (min-width: 768px) {
	.hbs-information-list__title {
		-webkit-line-clamp: 1;
	}
}

/* -------------------------------------------------------------------
   汎用カードグリッド（Heroの次の2話／過去エピソード／番組一覧で共用）
   列数は実際の件数に応じてPHP側で付与されるクラス(.hbs-grid--c1 等)で決まる。
   これにより「空セルができる」「1件だけなのに2カラムの右が空白になる」を防止。
   ------------------------------------------------------------------- */
.hbs-grid {
	display: grid;
	gap: 20px;
	/* ▼ 既定（スマートフォン）：2カラム ▼ */
	grid-template-columns: repeat(2, 1fr);
}

/* 件数が1件だけのときは1カラムで自然な幅に */
.hbs-grid--c1 {
	grid-template-columns: minmax(0, 420px);
	justify-content: start;
}

@media (min-width: 768px) {
	.hbs-grid--c2 {
		grid-template-columns: repeat(2, 1fr);
	}
	/* ▼ PC表示で3件以上ある場合は3カラム ▼ */
	.hbs-grid--c3plus {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* 過去エピソードの9件目はスマートフォンでは表示しない（PC最大9件／スマホ最大8件の仕様） */
@media (max-width: 767.98px) {
	.hbs-card--pc-only-9th {
		display: none;
	}
}

/* -------------------------------------------------------------------
   カード共通スタイル
   ------------------------------------------------------------------- */
.hbs-card {
	display: block;
	text-decoration: none;
	color: var(--hbs-text);
	border-radius: var(--hbs-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hbs-card__thumb {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #f2f2f2;
}

.hbs-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hbs-card__body {
	display: block;
	padding: 12px 14px 16px;
}

.hbs-card__label {
	display: block;
	color: var(--hbs-red);
	font-weight: 700;
	font-size: 0.8rem;
	margin-bottom: 4px;
}

.hbs-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-weight: 600;
	line-height: 1.5;
}

.hbs-card__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--hbs-muted);
	font-size: 0.85rem;
	margin-top: 6px;
	line-height: 1.6;
}
/* 「以前のエピソード」1行目(2列)カードのみ、SP6行/PC3行で省略（三点リーダー） */
.hbs-next-episodes .hbs-card__excerpt {
	-webkit-line-clamp: 6;
}
@media (min-width: 768px) {
	.hbs-next-episodes .hbs-card__excerpt {
		-webkit-line-clamp: 3;
	}
}

/* 過去エピソード（タイトルのみ）はカードを少しコンパクトに */
.hbs-card--simple .hbs-card__body {
	padding: 10px 12px 12px;
}

/* -------------------------------------------------------------------
   全エピソード一覧へ（リンクボタン）
   ------------------------------------------------------------------- */
.hbs-archive-link {
	text-align: center;
	margin: 40px 0 8px;
}

.hbs-archive-link__btn {
	display: inline-block;
	padding: 12px 32px;
	border: 2px solid var(--hbs-red);
	border-radius: 999px;
	color: var(--hbs-red);
	font-weight: 700;
	text-decoration: none;
}

.hbs-archive-link__btn:hover {
	background: var(--hbs-red);
	color: #fff;
}

/* -------------------------------------------------------------------
   番組一覧アーカイブ（/hbs150/）：PC3カラム／スマホ2カラム固定
   ------------------------------------------------------------------- */
.hbs-archive-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px 16px;
	margin-top: 24px;
}

@media (min-width: 768px) {
	.hbs-archive-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 28px 24px;
	}
}

.hbs-archive__title {
	font-size: 1.6rem;
	margin: 0;
}

.hbs-pagination {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 40px;
}

.hbs-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border-radius: 6px;
	text-decoration: none;
	color: var(--hbs-text);
}

.hbs-pagination .page-numbers.current {
	background: var(--hbs-red);
	color: #fff;
}

/* -------------------------------------------------------------------
   番組各話 個別ページ
   ------------------------------------------------------------------- */
.hbs-episode__no {
	color: var(--hbs-red);
	font-weight: 700;
	margin: 0 0 4px;
}

.hbs-episode__date {
	color: var(--hbs-muted);
	font-size: 0.9rem;
	margin: 0 0 8px;
}

.hbs-episode__title {
	font-size: 1.6rem;
	line-height: 1.5;
	margin: 0 0 20px;
}

.hbs-episode__player {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin-bottom: 24px;
	border-radius: var(--hbs-radius);
	overflow: hidden;
	background: #000;
}

.hbs-episode__player iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.hbs-episode__content {
	line-height: 1.9;
	margin-bottom: 40px;
}

/* v1.1.5: お便りアンカーをフォーム区切り線の50px上に配置する。
   スクロール位置補正ではなく、実際のアンカー位置を前方に移す。 */
.hbs-koe-form-anchor {
	height: 50px;
}

.hbs-koe-form {
	border-top: 1px solid var(--hbs-border);
	padding-top: 24px;
}

.hbs-koe-form__notice {
	color: var(--hbs-muted);
}


/* -------------------------------------------------------------------
   個別Episodeページ：PC 2カラムHero（左=映像 / 右=情報＋抜粋） Task 18
   スマホは現状の並び順（情報→映像の順で縦積み）を変更しないため、
   既定（スマホ）はDOM順どおりの単純な縦積みのままです。
   ------------------------------------------------------------------- */
.hbs-episode__hero {
	display: grid;
	gap: 16px;
	margin-bottom: 24px;
}

/* PCのみ表示する抜粋テキスト（スマホは直後に本文が続くため二重表示を避ける） */
.hbs-episode__excerpt {
	display: none;
}

@media (min-width: 768px) {
	.hbs-episode__hero {
		grid-template-columns: 5fr 3fr; /* 映像:情報 ≒ 62:38（60〜65%目安） */
		grid-template-areas: "media info";
		align-items: start;
		gap: 32px;
	}
	.hbs-episode__hero-info {
		grid-area: info;
	}
	.hbs-episode__hero-media {
		grid-area: media;
	}
	.hbs-episode__excerpt {
		display: block;
		color: var(--hbs-muted);
		line-height: 1.8;
		margin-top: 12px;
	}
}

/* YouTube未登録などで映像が無い場合はPCでも1カラムに（空白カラムを防止） */
@media (min-width: 768px) {
	.hbs-episode__hero--no-media {
		grid-template-columns: 1fr;
	}
}

/* -------------------------------------------------------------------
   前へ／次へナビゲーション（Episode／Information共通デザイン） Task 20/21
   ------------------------------------------------------------------- */
.hbs-prevnext {
	display: flex;
	gap: 16px;
	margin: 32px 0;
}

.hbs-prevnext__link {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px;
	border: 1px solid var(--hbs-border);
	border-radius: var(--hbs-radius);
	text-decoration: none;
	color: var(--hbs-text);
	min-width: 0;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.hbs-prevnext__link--next {
	text-align: right;
	align-items: flex-end;
}

.hbs-prevnext__link--empty {
	border-color: transparent;
}

.hbs-prevnext__link:hover {
	border-color: var(--hbs-red);
	background: #fff5f6;
}

.hbs-prevnext__dir {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--hbs-red);
}

.hbs-prevnext__title {
	font-size: 0.9rem;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* =======================================================================
   実機確認後 UI仕上げ＋不具合修正 Phase 追加分
   既存ルールは変更せず、後方に追記してカスケードで上書きする方針です
   （既存ルール自体はそのまま残っています）。
   ======================================================================= */

/* 7. 個別Episode固定ラベルが赤地に赤文字で読めなくなっていた不具合の修正。
   .hbs-episode__no（後方の個別ページ用ルール）の color:var(--hbs-red) が
   .hbs-episode__no--brand の color:#fff を打ち消していたため、詳細度を上げて修正。 */
.hbs-episode__no.hbs-episode__no--brand {
	color: #fff;
}

/* 1. TOP Hero「最新エピソード」バッジ */
.hbs-hero {
	grid-template-areas: "badge" "thumb" "info";
}
.hbs-hero__latest-badge {
	grid-area: badge;
	display: inline-block;
	margin: 0 0 -1px; /* SP: 行間gap16pxと合わせてバッジ下の余白を30px→15pxへ半減 */
	width: fit-content;
	max-width: 100%;
}
.hbs-hero__latest-badge-svg {
	display: block;
	height: 69.06px; /* 旧SVG(4023x1263)を幅220pxで表示していた高さを維持。幅は新SVG(5380x1263)の比率で自動計算され、右方向に伸びる */
	width: auto;
	max-width: 100%;
}

/* 公開日（Hero）：Episodeカードの日付表示（.hbs-card__date）を共用しつつ、
   Hero情報カラム内だけ右詰めにする（実機確認後 小修正Phase） */
.hbs-hero__date {
	text-align: right;
	margin-top: 8px;
}

@media (min-width: 768px) {
	/* 2. Hero情報カラムを上詰めに（PCのみ。SPは元の中央揃えのまま変更しない） */
	.hbs-hero {
		grid-template-areas: "badge thumb" "info  thumb";
		grid-template-rows: auto 1fr;
		align-items: start;
		row-gap: 16px; /* 列間(column-gap)32pxは維持しつつ、行間だけ半減 */
	}
	.hbs-hero__latest-badge {
		margin-bottom: 7px; /* PC: row-gap16px+margin7px=23px = 従来46pxの半分 */
	}
}

/* 3. Information日付の時計アイコン */
.hbs-information-list__date {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

/* 4. Information下のスペース＋「以前のエピソード」見出し */
.hbs-section-title--past {
	margin-top: 50px;
}
@media (min-width: 768px) {
	.hbs-section-title--past {
		margin-top: 80px;
	}
}

/* 5. カードの日付表示（直近2話／過去エピソード共通） */
.hbs-card__date {
	display: block;
	font-size: 0.75rem;
	color: var(--hbs-muted);
	margin-bottom: 4px;
}
.hbs-card__date i {
	margin-right: 2px;
}

/* 6. 過去エピソード（3カラム部）に抜粋を表示。PC3カラム／スマホも3カラムに変更 */
.hbs-grid--c3plus {
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
.hbs-card--simple .hbs-card__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--hbs-muted);
	font-size: 0.72rem;
	line-height: 1.5;
	margin-top: 4px;
}
.hbs-grid--c3plus .hbs-card__title {
	font-size: 0.82rem;
}
@media (min-width: 768px) {
	.hbs-grid--c3plus {
		gap: 20px;
	}
	.hbs-card--simple .hbs-card__excerpt {
		font-size: 0.85rem;
		-webkit-line-clamp: 3;
		margin-top: 6px;
	}
	.hbs-grid--c3plus .hbs-card__title {
		font-size: 0.95rem;
	}
}

/* 12. Episode前後ナビ：小サムネイル（Episode側のみ。--with-thumb修飾クラスがある場合のみ適用し、
   Information側の前後ナビ（サムネイルなし）の見た目は変更しない） */
.hbs-prevnext__thumb {
	flex: none;
	width: 64px;
	height: 36px;
	border-radius: 6px;
	overflow: hidden;
	background: #eee;
}
.hbs-prevnext__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.hbs-prevnext__body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.hbs-prevnext__link--with-thumb {
	flex-direction: row;
	align-items: center;
}
.hbs-prevnext__link--with-thumb.hbs-prevnext__link--next {
	flex-direction: row-reverse;
	align-items: center;
}
@media (max-width: 767.98px) {
	.hbs-prevnext__thumb {
		width: 48px;
		height: 28px;
	}
	.hbs-prevnext__link--with-thumb .hbs-prevnext__title {
		-webkit-line-clamp: 2;
	}
}

/* 13. Information個別ページ：Lightningテーマ標準の前後ナビ（VK Blocksの next-prev）が
   独自ナビと重複表示されるため非表示にする。body.single-hbs_info で範囲を限定しているため
   他の投稿タイプ・固定ページの表示には一切影響しない。 */
body.single-hbs_info .vk_posts.next-prev {
	display: none;
}
