/* 名前だけ知らないラジオ：記事パーツ（色や書体はテーマに任せ、形だけ整える） */

.wr-part {
	margin-block: 2em;
}

.wr-part-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wr-part-list li {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1em;
	align-items: baseline;
	justify-content: space-between;
	padding-block: 0.5em;
	border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

.wr-part-list a {
	overflow-wrap: anywhere;
}

.wr-part-list time,
.wr-part-note,
.wr-part-empty,
.wr-letter-status {
	font-size: 0.85em;
	opacity: 0.75;
}

.wr-letter input[type="text"],
.wr-letter textarea {
	box-sizing: border-box;
	width: 100%;
	font: inherit;
}

/* ロボットよけの欄は人には見せない（display: none だと埋めないロボットがいるので画面の外へ）。 */
.wr-letter-website {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.wr-letter-status:empty {
	display: none;
}

/* リストに画像があるときはカードに（番組各回・ほかの回・ほかの CM） */

.wr-part-list:has(.wr-part-thumb) {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
	gap: 24px;
}

.wr-part-list:has(.wr-part-thumb) li {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: stretch;
	padding: 0;
	border: 0;
}

.wr-part-list:has(.wr-part-thumb) a {
	display: flex;
	flex-direction: column;
	gap: 8px;
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

.wr-part-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	border: 1px solid currentColor;
	border-radius: 8px;
	object-fit: cover;
}

/* 画像がないときの代わりの枠（色はテーマに任せる） */
.wr-thumb-empty {
	background-color: color-mix(in srgb, currentColor 12%, transparent);
}

/* YouTube（16:9 で幅いっぱい） */

.wr-part-youtube iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 8px;
}

/* 編集画面で、中身をプレイヤーが作るブロック */

.wr-part-placeholder {
	padding: 16px;
	border: 1px dashed currentColor;
	border-radius: 8px;
}

/* 放送中の番組：ON AIR・番組名・再生時間 */

.wr-onair {
	display: flex;
	flex-direction: column;
	gap: 16px;
	align-items: center;
	text-align: center;
}

.wr-onair > * {
	margin: 0;
}

.wr-onair-label {
	color: #e5484d;
	font-weight: 900;
	letter-spacing: 0.04em;
}

/*
 * 放送中の番組名は 1 行で。入りきらないときは、文字の高さはそのままで横幅だけ縮める
 * （player.js が --wr-squeeze に縮める割合を入れる）。はみ出した分は真ん中から左右に振り分けて縮める。
 */
.wr-onair-show {
	display: flex;
	justify-content: center;
	align-self: stretch;
	max-width: 100%;
	overflow: hidden;
	font-size: 2rem;
	font-weight: 900;
	line-height: 1.25;
}

.wr-onair-show a {
	flex: none;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
	transform: scaleX(var(--wr-squeeze, 1));
	transform-origin: center;
}


.wr-onair-episode:empty {
	display: none;
}

.wr-onair-time {
	display: flex;
	gap: 24px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* 放送中のサムネイル：今の番組が真ん中。番組が変わると 1 枚分左へ流れる */

.wr-carousel {
	--wr-carousel-item: 35%;
	--wr-carousel-gap: 24px;
	--wr-carousel-side: 2;
	--wr-carousel-shift: calc(50% - (var(--wr-carousel-side) + 0.5) * var(--wr-carousel-item) - var(--wr-carousel-side) * var(--wr-carousel-gap));

	position: relative;
	overflow: hidden;
	padding-block: 48px;
	background: #111;
}

/* 左右の端を黒くぼかす */
.wr-carousel::after {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, #111 4%, transparent 11%, transparent 89%, #111 96%);
	pointer-events: none;
	content: "";
}

.wr-carousel-track {
	display: flex;
	gap: var(--wr-carousel-gap);
	transform: translateX(var(--wr-carousel-shift));
}

.wr-carousel-track.is-moving {
	transform: translateX(calc(var(--wr-carousel-shift) - var(--wr-carousel-item) - var(--wr-carousel-gap)));
	transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.wr-carousel-item {
	position: relative;
	display: block;
	flex: 0 0 var(--wr-carousel-item);
	overflow: hidden;
	aspect-ratio: 1;
	border-radius: 8px;
	background: #2a2a2a;
	opacity: 0.55;
	transition: opacity 1.2s ease;
}

.wr-carousel-item.is-current {
	opacity: 1;
}

.wr-carousel-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 画像がない番組は名前を出す。画像があるときは読み上げ用だけ */
.wr-carousel-label {
	position: absolute;
	inset: auto 0 0;
	padding: 12px;
	color: #fff;
	font-weight: 900;
}

.wr-carousel-item img + .wr-carousel-label {
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 450px) {
	.wr-carousel {
		--wr-carousel-item: 70%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wr-carousel-track.is-moving,
	.wr-carousel-item {
		transition: none;
	}
}

/* 見出しの上の小さな英字（OTHER EPISODE など） */

.wr-part-head {
	margin-bottom: 1em;
}

.wr-part-head > * {
	margin: 0;
}

.wr-part-eyebrow {
	font-weight: 900;
}

/* おたよりのテーマと投函期限 */

.wr-letter-topic {
	display: flex;
	flex-direction: column;
	gap: 0.75em;
	align-items: center;
	margin-bottom: 1.5em;
	padding: 24px 36px;
	border-radius: 8px;
	background: color-mix(in srgb, currentColor 6%, transparent);
	text-align: center;
}

.wr-letter-topic > * {
	margin: 0;
}

.wr-letter-topic-label {
	font-weight: 700;
}

.wr-letter-topic-theme {
	font-size: 1.25rem;
	font-weight: 900;
}

.wr-letter-closed {
	font-weight: 700;
	text-align: center;
}

/* ループカルーセル（番組一覧・CM 一覧）：同じ並びを 2 つつなげて流し続ける */

.wr-loop {
	--wr-loop-item: 40cqi;
	--wr-loop-gap: 24px;

	display: flex;
	overflow: hidden;
	container-type: inline-size;
}

.wr-loop-cm {
	--wr-loop-item: 32cqi;
}

.wr-loop-track {
	display: flex;
	flex: 0 0 auto;
	gap: var(--wr-loop-gap);
	min-width: 100%;
	margin: 0;
	padding: 0 var(--wr-loop-gap) 0 0;
	list-style: none;
	animation: wr-loop var(--wr-loop-duration, 40s) linear infinite;
}

.wr-loop:hover .wr-loop-track,
.wr-loop:focus-within .wr-loop-track {
	animation-play-state: paused;
}

.wr-loop-track li {
	flex: 0 0 var(--wr-loop-item);
	margin: 0;
}

.wr-loop-item {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1;
	border: 1px solid currentColor;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
}

.wr-loop-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wr-loop-label {
	position: absolute;
	inset: auto 0 0;
	padding: 12px;
	font-weight: 900;
}

.wr-loop-item img + .wr-loop-label {
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@keyframes wr-loop {
	to {
		transform: translateX(-100%);
	}
}

@media (max-width: 750px) {
	.wr-loop-cm {
		--wr-loop-item: 47cqi;
	}
}

@media (max-width: 450px) {
	.wr-loop-show {
		--wr-loop-item: 70cqi;
	}
}

/* 動きを減らす設定では流さず、横にスクロールして見る */
@media (prefers-reduced-motion: reduce) {
	.wr-loop {
		overflow-x: auto;
	}

	.wr-loop-track {
		animation: none;
	}

	.wr-loop-track[aria-hidden="true"] {
		display: none;
	}
}
