/**
 * ランキング（よく読まれている記事）。決まり6章の6・12章。
 *
 * 2か所に出す。
 *
 * - サイドバー… 写真 96×64・右上の弧 12px。写真の左上に
 *   番号の四角 24px（見本の R1）
 * - トップページ … うすい色の囲み（右上の弧 32px）＋王冠の見出し。
 *   番号は写真の下の端にかかる丸いメダル 36px（見本の X1）
 *
 * 番号の色は PHP が1つずつ渡す（lastshot_core_rank_badge）。
 *
 * - 1位 #a16207／2位 #6b7280／3位 #9a3412（白い文字）
 * - 4位から #e3e5e8（#1f2328 の文字）
 *
 * 読まれた回数などの数字は画面に出さない（順位だけ）。
 */

/* --- 共通：番号 -------------------------------------------------------- */

.lastshot-rank__badge {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var( --lastshot-rank-bg, #e3e5e8 );
	color: var( --lastshot-rank-fg, #1f2328 );
	font-weight: 700;
	line-height: 1;
}

/* サイドバー（R1）… 写真の左上の四角。 */
.lastshot-rank__badge--side {
	top: 0;
	left: 0;
	width: 24px;
	height: 24px;
	font-size: 0.8125rem;
}

/*
 * トップページ（X1）… 写真の下の端にかかる丸いメダル。
 * 白い縁を付けて、写真の上でも地の上でも形が分かるようにする。
 */
.lastshot-rank__badge--front {
	bottom: -16px;
	left: 8px;
	box-sizing: border-box;
	width: 36px;
	height: 36px;
	border: 3px solid var( --lastshot-paper, #fff );
	border-radius: 50%;
	font-size: 1rem;
	font-weight: 800;
}

/* --- サイドバー（見本の R1） ---------------------------------------------- */

.lastshot-rank__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lastshot-rank__item {
	margin: 0;
	padding: 12px 0;
	border-bottom: 1px solid var( --lastshot-line-light, #eef0f3 );
}

.lastshot-rank__item:first-child {
	padding-top: 0;
}

.lastshot-rank__item:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.lastshot-rank__link {
	display: grid;
	grid-template-columns: 96px minmax( 0, 1fr );
	gap: 10px;
	align-items: start;
	color: inherit;
	text-decoration: none;
}

/* 写真。右上の角だけを切る（決まり3章）。 */
.lastshot-rank__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	width: 96px;
	height: 64px;
	border-radius: var( --lastshot-media-radius, 0 12px 0 0 );
	background: var( --lastshot-info-soft, #f5f6f8 );
}

.lastshot-rank__thumb img {
	display: block;
	width: 96px;
	height: 64px;
	object-fit: cover;
}

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

.lastshot-rank__link:hover .lastshot-rank__title,
.lastshot-rank__link:focus .lastshot-rank__title {
	color: var( --lastshot-main, #12355b );
	text-decoration: underline;
}

.lastshot-rank__link:focus-visible {
	outline: 2px solid var( --lastshot-main, #12355b );
	outline-offset: 2px;
}

/* --- トップページ（見本の X1） ---------------------------------------- */

/*
 * 段ごと「うすい色の囲み」に入れて、上の段（カテゴリーごとの新着）と
 * はっきり分ける。カードは cards.css の共通のもの
 * （.lastshot-mag-cols / .lastshot-mag-card--col）をそのまま使うので、
 * 大きさ・3列・写真の弧・日付は上の段と同じまま。
 *
 * ここで足すのは、囲み・王冠の見出し・丸いメダルの置き場所だけ。
 */

.lastshot-rank-front {
	padding: 22px 18px 20px;

	/* 地はメインカラーを白に 8％ 混ぜた色（使えないブラウザ用の控えつき）。 */
	background-color: var( --lastshot-main-soft, #f2f5f9 );
	background-color: color-mix( in srgb, var( --lastshot-main, #12355b ) 8%, #fff );

	/* 右上だけ弧（決まり3章の例外）。 */
	border-radius: var( --lastshot-media-radius, 0 32px 0 0 );
}

/* 見出し（王冠＋文字）。右へ伸びる線は付けない。 */
.lastshot-rank-front__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
}

.lastshot-rank-front__crown {
	display: block;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
}

.lastshot-rank-front__heading {
	margin: 0;
	padding: 0;
	border: 0;
	color: var( --lastshot-main, #12355b );
	font-size: 1.3125rem;
	font-weight: 800;
	line-height: 1.4;
}

/*
 * メダルが写真の下にはみ出すので、写真の入れ物の切り落としを外す。
 * 代わりに写真そのものに同じ弧を付ける（入れ物の弧をそのまま使う）。
 */
.lastshot-rank-front .lastshot-mag-card__thumb {
	position: relative;
	overflow: visible;
}

.lastshot-rank-front .lastshot-mag-card__image,
.lastshot-rank-front .lastshot-mag-card__blank {
	border-radius: inherit;
}

/* 題名の上を、メダルのぶん広げる。 */
.lastshot-rank-front .lastshot-mag-card__body {
	margin-top: 22px;
}

/* --- スマホ（781.98px 以下。決まり9章） ------------------------------- */

@media (max-width: 781.98px) {

	.lastshot-rank-front {
		padding: 16px 14px 14px;
		border-radius: var( --lastshot-media-radius, 0 24px 0 0 );
	}

	.lastshot-rank-front__head {
		gap: 8px;
		margin-bottom: 10px;
	}

	.lastshot-rank-front__crown {
		width: 22px;
		height: 22px;
	}

	.lastshot-rank-front__heading {
		font-size: 1.125rem;
	}

	/*
	 * スマホのカードは「左に写真・右に題名」の横並びなので、題名の上を
	 * 広げる必要はない。メダルは小さくして、写真の左下にかける。
	 */
	.lastshot-rank-front .lastshot-mag-card__body {
		margin-top: 0;
	}

	.lastshot-rank__badge--front {
		bottom: -8px;
		left: 6px;
		width: 28px;
		height: 28px;
		border-width: 2px;
		font-size: 0.875rem;
	}
}
