/**
 * SGA4 Ranking for Arkhe - Styles
 *
 * Arkheテーマのデザインシステム (p-postList, c-postThumb 等) と調和し、
 * ランキング順位表示を追加するスタイル。
 * Arkheが提供するベーススタイルの上に最小限の装飾のみ追加。
 */

/* ==========================================================================
   ランキングタイトル
   ========================================================================== */
.sga4-arkhe-title {
	margin-bottom: 1em;
	font-size: 1.1em;
	font-weight: 700;
	padding-bottom: 0.4em;
	border-bottom: 2px solid var(--ark-color--main, #1a7cc5);
}

/* ==========================================================================
   ランキングリスト - 共通
   ========================================================================== */
.sga4-arkhe-ranking {
	list-style: none;
	padding: 0;
	margin: 0;
}

.sga4-arkhe-ranking .p-postList__item {
	position: relative;
}

.sga4-arkhe-ranking .p-postList__link {
	position: relative;
}

/* ==========================================================================
   順位バッジ
   ========================================================================== */
.sga4-arkhe-rank {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.8em;
	height: 1.8em;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background-color: var(--ark-color--main, #1a7cc5);
	border-radius: 0 0 4px 0;
}

/* 1位・2位・3位の特別カラー */
.sga4-arkhe-rank[data-rank="1"] {
	background-color: #daa520;
}
.sga4-arkhe-rank[data-rank="2"] {
	background-color: #a0a0a0;
}
.sga4-arkhe-rank[data-rank="3"] {
	background-color: #cd7f32;
}

/* ==========================================================================
   カードレイアウト (-type-card) 対応
   ========================================================================== */
.sga4-arkhe-ranking.-type-card {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5em;
}

.sga4-arkhe-ranking.-type-card .p-postList__item {
	flex: 1 0 100%;
	min-width: 0;
}

.sga4-arkhe-ranking.-type-card .p-postList__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--ark-color--bg, #fff);
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: box-shadow 0.25s, transform 0.25s;
	text-decoration: none;
	color: inherit;
}

.sga4-arkhe-ranking.-type-card .p-postList__link:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

.sga4-arkhe-ranking.-type-card .p-postList__thumb {
	position: relative;
	overflow: hidden;
}

.sga4-arkhe-ranking.-type-card .c-postThumb__figure {
	position: relative;
	width: 100%;
	margin: 0;
	padding-top: var(--ark-thumb_ratio_card, 56.25%);
	overflow: hidden;
}

.sga4-arkhe-ranking.-type-card .c-postThumb__img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s;
}

.sga4-arkhe-ranking.-type-card .p-postList__link:hover .c-postThumb__img {
	transform: scale(1.05);
}

.sga4-arkhe-ranking.-type-card .p-postList__body {
	padding: 0.8em 1em 1em;
	flex: 1;
}

.sga4-arkhe-ranking.-type-card .p-postList__title {
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sga4-arkhe-ranking.-type-card .p-postList__excerpt {
	margin-top: 0.4em;
	font-size: 0.85em;
	opacity: var(--ark-opacity--thin, 0.75);
	line-height: 1.6;
}

.sga4-arkhe-ranking.-type-card .p-postList__meta {
	margin-top: 0.5em;
	font-size: var(--ark-fz--xs, 0.75em);
	opacity: var(--ark-opacity--thin, 0.75);
}

/* カードレイアウト - シングルカラム 共通 */
.sga4-arkhe-ranking.-type-card.-pc-col1 .p-postList__item {
	flex: 0 0 100%;
}

/* シングルカラム - 縦並び (direction="vertical"、デフォルト) */
.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-vertical .p-postList__link {
	flex-direction: column;
}

.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-vertical .p-postList__item {
	max-width: 480px;
}

/* シングルカラム - 横並び (direction="horizontal") */
.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-horizontal .p-postList__link {
	flex-direction: row;
}

.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-horizontal .p-postList__thumb {
	flex: 0 0 200px;
}

.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-horizontal .p-postList__body {
	flex: 1;
	min-width: 0;
}

@media (max-width: 599px) {
	.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-horizontal .p-postList__link {
		flex-direction: column;
	}
	.sga4-arkhe-ranking.-type-card.-pc-col1.-dir-horizontal .p-postList__thumb {
		flex: 0 0 auto;
	}
}

/* カードレイアウト - 2カラム以上 (PC) */
@media (min-width: 600px) {
	.sga4-arkhe-ranking.-type-card.-pc-col2 .p-postList__item {
		flex: 0 0 calc(50% - 0.75em);
	}
	.sga4-arkhe-ranking.-type-card.-pc-col3 .p-postList__item {
		flex: 0 0 calc(33.333% - 1em);
	}
	.sga4-arkhe-ranking.-type-card.-pc-col4 .p-postList__item {
		flex: 0 0 calc(25% - 1.125em);
	}
}

/* ==========================================================================
   リストレイアウト (-type-list) 対応
   ========================================================================== */
.sga4-arkhe-ranking.-type-list .p-postList__item {
	border-bottom: 1px solid var(--ark-color--border, rgba(0, 0, 0, 0.1));
}

.sga4-arkhe-ranking.-type-list .p-postList__item:first-child {
	border-top: 1px solid var(--ark-color--border, rgba(0, 0, 0, 0.1));
}

.sga4-arkhe-ranking.-type-list .p-postList__link {
	display: flex;
	align-items: flex-start;
	gap: 1em;
	padding: 0.8em 0;
	text-decoration: none;
	color: inherit;
}

.sga4-arkhe-ranking.-type-list .p-postList__link:hover {
	opacity: 0.8;
}

.sga4-arkhe-ranking.-type-list .p-postList__thumb {
	flex: 0 0 120px;
	position: relative;
	overflow: hidden;
	border-radius: 3px;
}

.sga4-arkhe-ranking.-type-list .c-postThumb__figure {
	position: relative;
	width: 100%;
	margin: 0;
	padding-top: var(--ark-thumb_ratio, 61.805%);
	overflow: hidden;
}

.sga4-arkhe-ranking.-type-list .c-postThumb__img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s;
}

.sga4-arkhe-ranking.-type-list .p-postList__link:hover .c-postThumb__img {
	transform: scale(1.05);
}

.sga4-arkhe-ranking.-type-list .p-postList__body {
	flex: 1;
	min-width: 0;
}

.sga4-arkhe-ranking.-type-list .p-postList__title {
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sga4-arkhe-ranking.-type-list .p-postList__excerpt {
	margin-top: 0.3em;
	font-size: 0.85em;
	opacity: var(--ark-opacity--thin, 0.75);
	line-height: 1.5;
}

.sga4-arkhe-ranking.-type-list .p-postList__meta {
	margin-top: 0.4em;
	font-size: var(--ark-fz--xs, 0.75em);
	opacity: var(--ark-opacity--thin, 0.75);
}

/* リストレイアウト - 順位バッジ位置調整 */
.sga4-arkhe-ranking.-type-list.-show-rank .p-postList__link {
	padding-left: 2.2em;
}

.sga4-arkhe-ranking.-type-list .sga4-arkhe-rank {
	top: 0.8em;
	left: 0;
	border-radius: 0 4px 4px 0;
}

/* ==========================================================================
   シンプルレイアウト (-type-simple) 対応
   ========================================================================== */
.sga4-arkhe-ranking.-type-simple .p-postList__item {
	border-bottom: 1px solid var(--ark-color--border, rgba(0, 0, 0, 0.1));
}

.sga4-arkhe-ranking.-type-simple .p-postList__item:first-child {
	border-top: 1px solid var(--ark-color--border, rgba(0, 0, 0, 0.1));
}

.sga4-arkhe-ranking.-type-simple .p-postList__link {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.7em 0;
	text-decoration: none;
	color: inherit;
	transition: background-color 0.2s;
}

.sga4-arkhe-ranking.-type-simple .p-postList__link:hover {
	background-color: var(--ark-color--bg--hover, rgba(0, 0, 0, 0.03));
}

.sga4-arkhe-ranking.-type-simple .sga4-arkhe-rank {
	position: static;
	flex: 0 0 auto;
	border-radius: 50%;
	width: 1.6em;
	height: 1.6em;
	font-size: 0.75rem;
}

.sga4-arkhe-ranking.-type-simple .p-postList__body {
	flex: 1;
	min-width: 0;
}

.sga4-arkhe-ranking.-type-simple .p-postList__title {
	font-size: 0.9em;
	font-weight: 500;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sga4-arkhe-ranking.-type-simple .p-postList__meta {
	margin-top: 0.15em;
	font-size: var(--ark-fz--xs, 0.75em);
	opacity: var(--ark-opacity--thin, 0.75);
}

/* ==========================================================================
   カテゴリバッジ（サムネイル上）
   ========================================================================== */
.c-postThumb__cat {
	position: absolute;
	bottom: 0;
	left: 0;
	z-index: 1;
	padding: 0.15em 0.5em;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.5;
	color: #fff;
	background-color: var(--ark-color--main, #1a7cc5);
}

/* ==========================================================================
   サムネイルなし状態
   ========================================================================== */
.sga4-arkhe-ranking .c-postThumb[data-has-thumb="0"] .c-postThumb__figure {
	background-color: var(--ark-color--border, rgba(0, 0, 0, 0.08));
}

/* ==========================================================================
   日付スタイル
   ========================================================================== */
.sga4-arkhe-ranking .c-postTimes__date {
	font-size: inherit;
	opacity: 0.9;
}

/* ==========================================================================
   レスポンシブ調整
   ========================================================================== */

/* モバイル: サムネイル幅の縮小 */
@media (max-width: 599px) {
	.sga4-arkhe-ranking.-type-list .p-postList__thumb {
		flex: 0 0 90px;
	}

	.sga4-arkhe-ranking.-type-card .p-postList__title {
		font-size: 0.9em;
	}
}
