/* v2 のニュース・ランキング・お気に入り・記事検索・メール案内・404。記事の組み・サイドバー・カードは article.css と components.css */
@layer components {
	/* ===== ニュースの一覧（v2/index.php） ===== */
	.v2-newslist {
		padding-block: var(--sp-8) var(--sp-9);
	}

	.v2-newslist__list {
		margin: 0;
		padding: 0;
		list-style: none;
		border-top: 1px solid var(--c-line);
	}

	.v2-newslist__list li {
		border-bottom: 1px solid var(--c-line);
	}

	.v2-newslist__list a {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px var(--sp-6);
		padding: var(--sp-5) var(--sp-2);
		text-decoration: none;
	}

	.v2-newslist__date {
		font-family: var(--f-en);
		font-weight: 500;
		font-size: var(--fs-md);
		letter-spacing: var(--ls-en);
		color: var(--c-ink-mute);
	}

	.v2-newslist__title {
		flex: 1 1 0;
		min-width: 0;
		font-weight: 500;
		line-height: 1.8;
	}

	/* 日付は上の行に置き、題名と矢印を同じ行に保つ（SP で矢印が題名の下に落ちないように） */
	.v2-newslist__date {
		flex-basis: 100%;
	}

	@media (min-width: 768px) {
		.v2-newslist__date {
			flex-basis: auto;
		}
	}

	.v2-newslist__list .v2-icon {
		font-size: var(--fs-lg);
		transition: transform var(--dur-fast);
	}

	.v2-newslist__list a:hover .v2-newslist__title {
		text-decoration: underline;
		text-underline-offset: 4px;
	}

	.v2-newslist__list a:hover .v2-icon {
		transform: translateX(4px);
	}

	/* ===== ニュースの詳細（v2/single.php） ===== */
	.v2-newsdetail {
		padding-block: var(--sp-8) var(--sp-9);
	}

	.v2-newsdetail__date {
		font-family: var(--f-en);
		font-weight: 500;
		letter-spacing: var(--ls-en);
		color: var(--c-ink-mute);
	}

	.v2-newsdetail__title {
		position: relative;
		margin-top: var(--sp-3);
		padding-bottom: var(--sp-4);
		border-bottom: 1px solid var(--c-line);
		font-size: var(--fs-2xl);
		line-height: 1.5;
		font-feature-settings: "palt";
	}

	.v2-newsdetail .v2-prose {
		margin-top: var(--sp-6);
	}

	.v2-newsdetail__back {
		margin-top: var(--sp-8);
		text-align: center;
	}

	/* ===== サイドバーの ARTICLES（template-parts/v2/articles-widget.php） ===== */
	.v2-articles-widget__list {
		margin: 0;
		padding: 0;
		list-style: none;
		border-top: 1px solid var(--c-line);
	}

	.v2-articles-widget__list li {
		border-bottom: 1px solid var(--c-line);
	}

	.v2-articles-widget__list a {
		position: relative;
		display: flex;
		align-items: center;
		min-height: 48px;
		padding: 0 32px 0 4px;
		font-size: var(--fs-sm);
		font-weight: 700;
		text-decoration: none;
	}

	.v2-articles-widget__list a::after {
		content: "";
		position: absolute;
		right: 10px;
		top: 50%;
		width: 8px;
		height: 8px;
		margin-top: -4px;
		border-top: 2px solid var(--c-ink-mute);
		border-right: 2px solid var(--c-ink-mute);
		transform: rotate(45deg);
		transition: transform var(--dur-fast);
	}

	.v2-articles-widget__list a:hover {
		text-decoration: underline;
	}

	.v2-articles-widget__list a:hover::after {
		transform: translateX(4px) rotate(45deg);
	}

	/* ===== ランキング（v2/page-ranking.php） ===== */
	.v2-ranking__intro {
		margin: 0 0 var(--sp-5);
	}

	.v2-ranking__section {
		margin-top: var(--sp-8);
	}

	.v2-ranking .v2-tabs + .v2-ranking__section {
		margin-top: var(--sp-6);
	}

	.v2-ranking__note {
		margin-top: var(--sp-2);
		font-size: var(--fs-xs);
		line-height: 1.8;
		color: var(--c-ink-mute);
	}

	.v2-ranking .v2-cards {
		margin-top: var(--sp-5);
	}



	/* ===== お気に入り（v2/page-favorites.php。一覧は article-tools.js が li.favorites__item で描く） ===== */
	.favorites-note {
		margin-bottom: var(--sp-5);
		font-size: var(--fs-sm);
		color: var(--c-ink-mute);
	}

	.favorites__empty {
		padding: var(--sp-6) var(--sp-5);
		border-radius: var(--radius-md);
		background: var(--c-soft);
		text-align: center;
	}

	.favorites__empty[hidden],
	.favorites__list[hidden] {
		display: none;
	}

	.favorites__list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
		gap: var(--sp-6) var(--sp-5);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.favorites__item .box {
		display: flex;
		flex-direction: column;
		background: var(--c-bg);
		text-decoration: none;
		clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
		box-shadow: inset 0 0 0 1px var(--c-line);
	}

	.favorites__item .img-wrap {
		overflow: hidden;
		line-height: 0;
		border-bottom: 4px solid var(--c-accent);
	}

	.favorites__item .img-wrap img {
		width: 100%;
		aspect-ratio: 16 / 10;
		object-fit: cover;
	}

	.favorites__item .text-wrap {
		padding: var(--sp-4) 30px 0 26px;
	}

	.favorites__item .date {
		font-family: var(--f-en);
		font-weight: 500;
		font-size: var(--fs-sm);
		letter-spacing: 0.06em;
		color: var(--c-ink-mute);
	}

	.favorites__item .ttl {
		display: block;
		margin-top: 6px;
		font-size: var(--fs-md);
		font-weight: 500;
		line-height: 1.75;
	}

	.favorites__item .more {
		align-self: flex-end;
		margin: var(--sp-2) 30px var(--sp-4) 0;
		font-family: var(--f-en);
		font-weight: 600;
		font-size: var(--fs-sm);
		letter-spacing: var(--ls-en);
	}

	.favorites__item .box:hover .ttl {
		text-decoration: underline;
		text-underline-offset: 4px;
	}

	.favorites__remove {
		display: inline-flex;
		align-items: center;
		min-height: 40px;
		margin-top: var(--sp-2);
		padding: 0 var(--sp-4);
		border: 1px solid var(--c-line-strong);
		border-radius: var(--radius-pill);
		background: var(--c-bg);
		color: var(--c-ink);
		font-size: var(--fs-xs);
		cursor: pointer;
	}

	.favorites__remove:hover {
		border-color: var(--c-brand);
	}

	/* ===== 記事の検索結果（v2/page-article-search.php。結果は article-search.js が描く） ===== */
	.v2-search .article-search {
		margin-bottom: var(--sp-7);
	}

	.article-search-results__heading {
		position: relative;
		padding-left: 22px;
		font-size: var(--fs-xl);
	}

	.article-search-results__heading::before {
		content: "";
		position: absolute;
		left: 0;
		top: 0.25em;
		width: 10px;
		height: 1.1em;
		background: var(--c-brand);
		clip-path: var(--clip-tag);
	}

	.article-search-results__heading:focus {
		outline: none;
	}

	.article-search-results__heading:focus-visible {
		outline: 3px solid var(--c-focus);
		outline-offset: 2px;
	}

	.article-search-results__note {
		margin-top: var(--sp-2);
		font-size: var(--fs-sm);
		color: var(--c-ink-mute);
	}

	.article-search-results__list {
		margin: var(--sp-5) 0 0;
		padding: 0;
		list-style: none;
		border-top: 1px solid var(--c-line);
	}

	.article-search-results__item {
		padding: var(--sp-4) 4px;
		border-bottom: 1px solid var(--c-line);
	}

	.article-search-results__link {
		display: flex;
		flex-direction: column;
		gap: 4px;
		text-decoration: none;
	}

	.article-search-results__meta {
		font-size: var(--fs-xs);
		color: var(--c-ink-mute);
	}

	.article-search-results__title {
		font-weight: 700;
		line-height: 1.7;
	}

	.article-search-results__link:hover .article-search-results__title {
		text-decoration: underline;
		text-underline-offset: 4px;
	}

	.article-search-results__desc {
		margin-top: 6px;
		font-size: var(--fs-sm);
		line-height: 1.8;
		color: var(--c-ink-sub);
	}

	.article-search-results__more-wrap {
		margin-top: var(--sp-6);
		text-align: center;
	}

	.article-search-results__more-wrap[hidden] {
		display: none;
	}

	.article-search-results__more {
		min-height: 48px;
		padding: 0 var(--sp-7);
		border: 1px solid var(--c-line-strong);
		border-radius: var(--radius-pill);
		background: var(--c-bg);
		color: var(--c-ink);
		font-weight: 700;
		cursor: pointer;
	}

	.article-search-results__more:hover {
		border-color: var(--c-brand);
	}

	/* ===== メール案内（v2/page-newsletter.php。本文は template-parts/newsletter-body.php の .nlp） ===== */
	.v2-newsletter .nlp {
		max-width: calc(960px + var(--gutter) * 2);
		margin: 0 auto;
		padding: var(--sp-8) var(--gutter) var(--sp-9);
		line-height: 1.9;
	}

	.v2-newsletter .nlp-lead {
		margin: 0 0 var(--sp-7);
		font-size: var(--fs-lg);
		font-weight: 700;
		text-align: center;
	}

	.v2-newsletter .nlp-cols {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: var(--sp-7);
		align-items: start;
	}

	@media (min-width: 768px) {
		.v2-newsletter .nlp-cols {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}
	}

	.v2-newsletter .nlp-h2 {
		position: relative;
		margin: 0 0 var(--sp-4);
		padding: 0 0 0 22px;
		font-size: var(--fs-xl);
		line-height: 1.5;
	}

	.v2-newsletter .nlp-h2::before {
		content: "";
		position: absolute;
		left: 0;
		top: 0.25em;
		width: 10px;
		height: 1.1em;
		background: var(--c-brand);
		clip-path: var(--clip-tag);
	}

	.v2-newsletter .nlp-faq-title,
	.v2-newsletter #privacy {
		margin-top: var(--sp-8) !important;
	}

	.v2-newsletter #privacy {
		scroll-margin-top: 24px;
	}

	.v2-newsletter .nlp-spec {
		display: grid;
		grid-template-columns: 6.5em 1fr;
		gap: var(--sp-3) var(--sp-4);
		margin: 0 0 var(--sp-7);
		font-size: var(--fs-md);
		line-height: 1.7;
	}

	.v2-newsletter .nlp-spec dt {
		font-weight: 700;
		color: var(--c-accent-text);
	}

	.v2-newsletter .nlp-spec dd {
		margin: 0;
	}

	.v2-newsletter .nlp-sample {
		padding: var(--sp-5);
		border-radius: var(--radius-md);
		background: var(--c-soft);
	}

	.v2-newsletter .nlp-card {
		padding: var(--sp-4) var(--sp-5);
		border-radius: var(--radius-md);
		background: var(--c-bg);
	}

	.v2-newsletter .nlp-card-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: var(--sp-3);
		padding-bottom: var(--sp-2);
		border-bottom: 1px solid var(--c-line);
	}

	.v2-newsletter .nlp-card-head img {
		margin: 0;
	}

	.v2-newsletter .nlp-card-head span,
	.v2-newsletter .nlp-sec {
		font-size: var(--fs-xs);
		font-weight: 700;
		letter-spacing: 0.06em;
		color: var(--c-brand);
	}

	.v2-newsletter .nlp-card-title {
		margin: 0 0 var(--sp-2);
		font-size: var(--fs-md);
		font-weight: 700;
	}

	.v2-newsletter .nlp-sec {
		margin: var(--sp-2) 0 4px;
	}

	.v2-newsletter .nlp-item {
		display: flex;
		gap: 10px;
		padding: 10px 0;
		border-top: 1px solid var(--c-line);
	}

	.v2-newsletter .nlp-rank {
		flex: none;
		width: 20px;
		font-family: var(--f-en);
		font-weight: 300;
		font-size: var(--fs-lg);
		line-height: 1.2;
		color: var(--c-brand);
	}

	.v2-newsletter .nlp-body {
		flex: 1;
		min-width: 0;
	}

	.v2-newsletter .nlp-cat,
	.v2-newsletter .nlp-users {
		font-size: var(--fs-xs);
		color: var(--c-ink-mute);
	}

	.v2-newsletter .nlp-new {
		display: inline-block;
		margin-right: 4px;
		padding: 0 6px;
		background: var(--c-brand);
		color: var(--c-on-brand);
		font-weight: 700;
		clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
	}

	.v2-newsletter .nlp-ttl {
		font-size: var(--fs-sm);
		font-weight: 700;
		line-height: 1.5;
	}

	.v2-newsletter .nlp-thumb {
		flex: none;
		width: 56px;
		height: 56px;
		margin: 0;
		border-radius: var(--radius-sm);
		object-fit: cover;
	}

	.v2-newsletter .nlp-more {
		margin: var(--sp-2) 0 0;
		font-size: var(--fs-xs);
		text-align: center;
		color: var(--c-ink-mute);
	}

	.v2-newsletter .nlp-faq {
		margin: 0;
	}

	.v2-newsletter .nlp-faq dt {
		position: relative;
		margin: var(--sp-5) 0 4px;
		padding-left: 18px;
		font-weight: 700;
	}

	.v2-newsletter .nlp-faq dt::before {
		content: "";
		position: absolute;
		left: 0;
		top: 0.55em;
		width: 7px;
		height: 0.9em;
		background: var(--c-accent);
		clip-path: var(--clip-tag);
	}

	.v2-newsletter .nlp-faq dd {
		margin: 0;
		padding-left: 18px;
		line-height: 1.9;
		color: var(--c-ink-sub);
	}

	.v2-newsletter a:not([class]) {
		color: var(--c-accent-text);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	/* ===== 404（v2/404.php） ===== */
	.v2-404 {
		position: relative;
		overflow: hidden;
		padding: var(--sp-9) 0;
		background: var(--c-soft);
	}

	.v2-404__plane {
		position: absolute;
		top: 0;
		right: 0;
		width: 34%;
		height: 100%;
		background: var(--c-brand);
		clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%);
		pointer-events: none;
	}

	.v2-404__inner {
		position: relative;
	}

	.v2-404__code {
		font-family: var(--f-en);
		font-weight: 300;
		font-size: var(--fs-display);
		line-height: 1;
		letter-spacing: 0.06em;
	}

	.v2-404__title {
		margin-top: var(--sp-4);
		font-size: var(--fs-xl);
		line-height: 1.5;
	}

	/* SP だけの改行（今の 404 と同じ位置） */
	@media (min-width: 768px) {
		.v2-404__br {
			display: none;
		}
	}

	.v2-404__text {
		margin: var(--sp-4) 0 var(--sp-6);
		line-height: 2;
	}

	@media (max-width: 767px) {
		.v2-404__plane {
			top: auto;
			bottom: 0;
			width: 46%;
			height: 28px;
			clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%);
		}
	}
}

/*
 * ここから @layer の外。メール案内の登録欄は workers/newsletter の widget.js が @layer の外で CSS を入れるので、余白の上書きだけここに書く。
 */
.v2-newsletter .nlp .issoh-newsletter {
	margin: 0;
}

@layer components {
	/* ===== ランキングの一覧（v2/page-ranking.php の ol.v2-rank）。1 位は横長、2・3 位は 2 枚並び、4 位以下は 1 行ずつ ===== */
	.v2-rank {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--sp-4);
		margin: var(--sp-5) 0 0;
		padding: 0;
		list-style: none;
		counter-reset: none;
	}

	.v2-rank__item {
		margin: 0;
		padding: 0;
	}

	.v2-rank__item::before {
		content: none;
	}

	.v2-rank__link {
		position: relative;
		display: grid;
		height: 100%;
		color: var(--c-ink);
		text-decoration: none;
	}

	.v2-rank__img {
		position: relative;
		display: block;
		overflow: hidden;
		background: var(--c-soft);
		line-height: 0;
	}

	.v2-rank__img img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		transition: transform 0.5s ease;
	}

	.v2-rank__link:hover .v2-rank__img img {
		transform: scale(1.04);
	}

	.v2-rank__link:hover .v2-rank__title {
		text-decoration: underline;
		text-decoration-color: var(--c-accent);
		text-underline-offset: 4px;
	}

	.v2-rank__body {
		display: flex;
		flex-direction: column;
		gap: 6px;
		min-width: 0;
	}

	.v2-rank__type {
		font-size: var(--fs-xs);
		font-weight: 700;
		color: var(--c-accent-text);
	}

	.v2-rank__title {
		font-weight: 700;
		line-height: 1.6;
	}

	/* 札（閲覧数・いいね）は画像に重ねず、題名の下に並べる */
	.v2-rank__body .eyecatch-stats {
		position: static;
		justify-content: flex-start;
		margin-top: 2px;
	}

	.v2-rank__body .eyecatch-stat {
		box-shadow: none;
	}

	/* NEW・急上昇は白い文字なので、自分の地の色のまま残す */
	.v2-rank__body .eyecatch-stat:not(.eyecatch-stat--new, .eyecatch-stat--trend) {
		background: var(--c-soft);
	}

	.v2-rank__no {
		font-family: var(--f-en);
		font-weight: 600;
		line-height: 1;
	}

	/* --- 1〜3 位 --- */
	.v2-rank__item--top .v2-rank__link {
		grid-template-rows: auto 1fr;
		border: 1px solid var(--c-line);
		border-radius: var(--radius-md);
		overflow: hidden;
		background: var(--c-bg);
		transition: box-shadow 0.3s ease, transform 0.3s ease;
	}

	.v2-rank__item--top .v2-rank__link:hover {
		transform: translateY(-4px);
		box-shadow: 0 18px 40px rgba(40, 30, 50, 0.12);
	}

	.v2-rank__item--top .v2-rank__img {
		aspect-ratio: 16 / 9;
		border-bottom: 4px solid var(--c-accent);
	}

	.v2-rank__item--top .v2-rank__body {
		padding: var(--sp-4) var(--sp-5) var(--sp-5);
	}

	.v2-rank__item--top .v2-rank__no {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: center;
		min-width: 64px;
		height: 56px;
		padding: 0 22px 0 14px;
		background: var(--c-brand);
		color: var(--c-on-brand);
		font-size: var(--fs-2xl);
		clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
	}

	.v2-rank__item--1 {
		grid-column: 1 / -1;
	}

	.v2-rank__item--1 .v2-rank__link {
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		grid-template-rows: none;
	}

	.v2-rank__item--1 .v2-rank__img {
		aspect-ratio: auto;
		min-height: 300px;
		border-bottom: 0;
		border-right: 4px solid var(--c-accent);
	}

	.v2-rank__item--1 .v2-rank__body {
		justify-content: center;
		padding: var(--sp-6);
	}

	.v2-rank__item--1 .v2-rank__no {
		min-width: 88px;
		height: 72px;
		font-size: var(--fs-2xl);
	}

	.v2-rank__item--1 .v2-rank__title {
		font-size: var(--fs-xl);
		line-height: 1.55;
	}

	/* --- 4 位以下 --- */
	.v2-rank__item--row {
		grid-column: 1 / -1;
	}

	.v2-rank__item--row .v2-rank__link {
		grid-template-columns: 56px 128px minmax(0, 1fr);
		align-items: center;
		gap: var(--sp-4);
		padding: var(--sp-3) 0;
		border-bottom: 1px solid var(--c-line);
	}

	.v2-rank__item--row .v2-rank__no {
		font-size: var(--fs-2xl);
		text-align: center;
		color: var(--c-ink-mute);
	}

	.v2-rank__item--row .v2-rank__img {
		aspect-ratio: 16 / 10;
		border-radius: var(--radius-sm, 4px);
	}

	.v2-rank__item--row .v2-rank__title {
		font-size: var(--fs-md);
	}

	.v2-rank__item--row .v2-rank__link:hover .v2-rank__no {
		color: var(--c-brand);
	}

	/* 対象の切り替えはつまみの形 */
	.v2-ranking .v2-tabs {
		display: inline-flex;
		gap: 4px;
		padding: 4px;
		border: 0;
		border-radius: var(--radius-pill);
		background: var(--c-soft);
	}

	.v2-ranking .v2-tabs a {
		min-height: 40px;
		margin: 0;
		padding: 0 var(--sp-5);
		border: 0;
		border-radius: var(--radius-pill);
	}

	.v2-ranking .v2-tabs a[aria-current] {
		background: var(--c-brand);
		color: var(--c-on-brand);
	}

	.v2-ranking .v2-tabs a:not([aria-current]):hover {
		color: var(--c-ink);
		background: var(--c-bg);
	}

	@media (max-width: 767px) {
		.v2-rank {
			grid-template-columns: 1fr;
			gap: var(--sp-3);
		}

		.v2-rank__item--1 .v2-rank__link {
			grid-template-columns: 1fr;
		}

		.v2-rank__item--1 .v2-rank__img {
			aspect-ratio: 16 / 9;
			min-height: 0;
			border-right: 0;
			border-bottom: 4px solid var(--c-accent);
		}

		.v2-rank__item--1 .v2-rank__body {
			padding: var(--sp-4) var(--sp-5) var(--sp-5);
		}

		.v2-rank__item--1 .v2-rank__title {
			font-size: var(--fs-lg);
		}

		.v2-rank__item--row .v2-rank__link {
			grid-template-columns: 36px 88px minmax(0, 1fr);
			gap: var(--sp-3);
			align-items: start;
		}

		.v2-rank__item--row .v2-rank__no {
			padding-top: 6px;
			font-size: var(--fs-xl);
		}

		.v2-rank__item--row .v2-rank__title {
			font-size: var(--fs-sm);
		}
	}
}
