/**
 * トップページのカード（決まり6章）。
 *
 * ピックアップ・新着記事・カテゴリーごとの新着で共通の見た目。
 * セクションの見出しと「もっと見る」のボタンは section-head.css にある
 * （カードを出さないブロックでも使うため。0.34.8 で分けた）。
 *
 * ここを1枚のファイルにまとめている理由（0.34.1 の直し）:
 *
 * ブロックごとの CSS（block.json の style）は、そのブロックがページに
 * 出たときだけ読み込まれる。0.34.0 では、この共通のカードの CSS を
 * ピックアップブロックの中に置いていたため、ヒーローを出して
 * ピックアップを出さないトップページでは1行も読み込まれず、
 * 新着記事のカードが素の HTML のまま（文字が1行につながり、
 * リンクの下線と色が付いた状態）で出てしまった。
 *
 * そこで、カードを出す3つのブロック（ピックアップ・新着記事・
 * カテゴリーごとの新着）のどれが出ても読み込まれるように、
 * プラグイン側の1枚にまとめ、inc/magazine.php から
 * wp_enqueue_block_style() で3つのブロックに結び付けている。
 *
 * 色はすべて --lastshot-* の変数から取る（決まり1章）。
 * 782px を境に、スマホとパソコンで分ける。
 */

/* --- カード（共通） --------------------------------------------------- */

.lastshot-mag-card {
	margin: 0;
}

/*
 * カードぜんたいがリンク。下線と色は付けない（題名は本文の色のまま）。
 * ここを指定しないと、ブラウザの標準でカードの中の文字すべてに
 * 下線とリンク色が付いてしまう。
 */
.lastshot-mag-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.lastshot-mag-card__link:hover,
.lastshot-mag-card__link:focus {
	text-decoration: none;
}

/* 写真。右上の角だけを切る（決まり3章）。 */
.lastshot-mag-card__thumb {
	display: block;
	overflow: hidden;
	border-radius: var( --lastshot-media-radius, 0 var( --lastshot-arc-list, 18px ) 0 0 );
	background: var( --lastshot-info-soft, #f5f6f8 );
}

/* 画像の縦横比を決めて、読み込みで位置がずれないようにする。 */
.lastshot-mag-card__image {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

/*
 * 写真がない記事。写真の場所をカテゴリーの色で塗り、
 * 白い文字でカテゴリー名を出す（決まり1章）。
 */
.lastshot-mag-card__blank {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	padding: 0.5rem;
	aspect-ratio: 3 / 2;
	background: var( --lastshot-cat, #12355b );
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
}

/* カテゴリー名・題名・筆者と日付は、それぞれ別の行にする。 */
.lastshot-mag-card__body {
	display: block;
}

.lastshot-mag-card__cat {
	display: block;
	margin: 0.5rem 0 0.15rem;
	color: var( --lastshot-cat, #12355b );
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.5;
}

.lastshot-mag-card__title {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	color: var( --lastshot-ink, #1f2328 );
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.5;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.lastshot-mag-card__link:hover .lastshot-mag-card__title,
.lastshot-mag-card__link:focus .lastshot-mag-card__title {
	text-decoration: underline;
}

.lastshot-mag-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem;
	margin: 0.35rem 0 0;
	color: var( --lastshot-muted, #5b6270 );
	font-size: 0.75rem;
	line-height: 1.5;
}

.lastshot-mag-card__sep {
	opacity: 0.6;
}

/* 筆者と日付は、途中で折り返さない。 */
.lastshot-mag-card__date,
.lastshot-mag-card__who {
	white-space: nowrap;
}

/* 「更新」の印（更新日を出しているとき）。 */
.lastshot-mag-card .lastshot-card-date__badge {
	color: var( --lastshot-main, #12355b );
	font-weight: 700;
}

/* --- 並べ方 ----------------------------------------------------------- */

.lastshot-mag-section {
	margin-bottom: var( --wp--preset--spacing--50, 2rem );
}

/* 新着記事（パソコンは2列）。 */
.lastshot-mag-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var( --wp--preset--spacing--40, 1.5rem );
}

/* カテゴリーごとの新着（パソコンは3列）。 */
.lastshot-mag-cols {
	display: grid;
	grid-template-columns: 1fr;
	gap: var( --wp--preset--spacing--30, 1rem );
}

/* 横長の一覧（左に写真・右に題名）。 */
.lastshot-mag-rows {
	display: grid;
	grid-template-columns: 1fr;
	gap: var( --wp--preset--spacing--30, 1rem );
}

/* --- スマホ（781.98px 以下） ------------------------------------------ */

/*
 * 新着記事・カテゴリーごとの新着は、左に小さな写真・右に題名の
 * 横並びにする（決まり9章）。1画面に見える記事を増やすため余白は詰める。
 */
@media (max-width: 781.98px) {

	.lastshot-mag-grid .lastshot-mag-card__link,
	.lastshot-mag-cols .lastshot-mag-card__link,
	.lastshot-mag-rows .lastshot-mag-card__link {
		display: grid;
		grid-template-columns: 124px minmax( 0, 1fr );
		gap: 0.75rem;
		align-items: start;
	}

	.lastshot-mag-grid .lastshot-mag-card__thumb,
	.lastshot-mag-cols .lastshot-mag-card__thumb,
	.lastshot-mag-rows .lastshot-mag-card__thumb {
		border-radius: var( --lastshot-media-radius, 0 var( --lastshot-arc-list, 18px ) 0 0 );
	}

	.lastshot-mag-grid .lastshot-mag-card__cat,
	.lastshot-mag-cols .lastshot-mag-card__cat,
	.lastshot-mag-rows .lastshot-mag-card__cat {
		margin-top: 0;
	}

	.lastshot-mag-grid .lastshot-mag-card__title,
	.lastshot-mag-cols .lastshot-mag-card__title,
	.lastshot-mag-rows .lastshot-mag-card__title {
		font-size: 0.9375rem;
	}

	.lastshot-mag-grid,
	.lastshot-mag-cols,
	.lastshot-mag-rows {
		gap: 0.75rem;
	}

	.lastshot-mag-grid .lastshot-mag-card,
	.lastshot-mag-cols .lastshot-mag-card,
	.lastshot-mag-rows .lastshot-mag-card {
		padding-bottom: 0.75rem;
		border-bottom: 1px solid var( --lastshot-line-light, #eef0f3 );
	}

	.lastshot-mag-grid .lastshot-mag-card:last-child,
	.lastshot-mag-cols .lastshot-mag-card:last-child,
	.lastshot-mag-rows .lastshot-mag-card:last-child {
		padding-bottom: 0;
		border-bottom: 0;
	}
}

/* --- パソコン（782px 以上） ------------------------------------------- */

@media (min-width: 782px) {

	/* 新着記事は2列（6本なら2列×3段）。写真の弧は 40px。 */
	.lastshot-mag-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}

	.lastshot-mag-grid .lastshot-mag-card__thumb {
		border-radius: var( --lastshot-media-radius, 0 var( --lastshot-arc-wide, 40px ) 0 0 );
	}

	/* カテゴリーごとの新着は3列。写真の弧は 32px。 */
	.lastshot-mag-cols {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	}

	.lastshot-mag-cols .lastshot-mag-card__thumb {
		border-radius: var( --lastshot-media-radius, 0 var( --lastshot-arc-cat, 32px ) 0 0 );
	}

	.lastshot-mag-cols .lastshot-mag-card__title {
		font-size: 0.9375rem;
		-webkit-line-clamp: 3;
	}

	/* 横長の一覧は、パソコンでも左に写真・右に題名のまま。 */
	.lastshot-mag-rows .lastshot-mag-card__link {
		display: grid;
		grid-template-columns: 200px minmax( 0, 1fr );
		gap: var( --wp--preset--spacing--30, 1rem );
		align-items: start;
	}

	.lastshot-mag-rows .lastshot-mag-card__cat {
		margin-top: 0;
	}

	.lastshot-mag-rows .lastshot-mag-card {
		padding-bottom: var( --wp--preset--spacing--30, 1rem );
		border-bottom: 1px solid var( --lastshot-line-light, #eef0f3 );
	}

	.lastshot-mag-rows .lastshot-mag-card:last-child {
		padding-bottom: 0;
		border-bottom: 0;
	}

	.lastshot-mag-rows .lastshot-mag-card__title {
		-webkit-line-clamp: 2;
	}
}

/* --- カテゴリーごとの新着のまとまり ----------------------------------- */

.lastshot-mag-cats {
	display: block;
}

.lastshot-mag-cats .lastshot-mag-section:last-child {
	margin-bottom: 0;
}
