/**
 * No.21 カードリンク（type=download / ogp）。
 * Figma: 750:10739。プレビューカタログは固定サンプルのまま。
 * 幅は PC 75%、SP 100%。
 * hover の :hover は @media (hover: hover) and (pointer: fine)。
 * SP（max-width: 767px）で三角を常時ロゴブルーにしているのは「タッチ時の意図的な表示」。
 * @media は CSS 変数を使えないため、値を直書きしている。
 */

/* PDF 以外の core/file ダウンロードボタン。白地＋青文字を反転する。 */
.wp-block-file__button.wp-element-button {
	--hover-invert-a: var(--wp--preset--color--base-white);
	--hover-invert-b: var(--wp--preset--color--logo-blue);
}

.card-link {
	--card-link-action-size: 2.75rem;
	display: block;
	position: relative;
	width: 75%;
	overflow: hidden;
	text-decoration: none;
	color: var(--wp--preset--color--base-black);
}

a.card-link:focus,
a.card-link:active {
	text-decoration: none;
}

.card-link__inner {
	display: flex;
	align-items: stretch;
	box-sizing: border-box;
	height: 7.5rem;
	border: var(--wp--custom--border-width--thin) solid var(--wp--preset--color--line-grey);
	background-color: var(--wp--preset--color--base-white);
}

.card-link__figure {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-sizing: border-box;
	width: 5.375rem;
	margin: 0;
	padding: var(--wp--custom--atom--rg);
	border-right: var(--wp--custom--border-width--thin) solid var(--wp--preset--color--line-grey);
	overflow: hidden;
}

.card-link[data-type="ogp"] .card-link__figure {
	width: 6rem;
}

.card-link__figure img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card-link[data-type="ogp"] .card-link__figure img {
	object-fit: contain;
}

.card-link__detail {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	min-width: 0;
	padding: var(--wp--custom--atom--xxl);
}

.card-link[data-type="download"] .card-link__detail {
	padding: var(--wp--custom--atom--rg);
	gap: var(--wp--custom--molecule--xs);
}

.card-link__head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--custom--atom--xs);
	width: 100%;
	min-width: 0;
}

.card-link__title,
.card-link .marker-text {
	max-width: 100%;
	width: fit-content;
	overflow: hidden;
	font-family: var(--wp--preset--font-family--jp-sans);
	font-weight: var(--wp--custom--font-weight--regular);
	letter-spacing: var(--wp--custom--letter-spacing--none);
	white-space: nowrap;
	text-overflow: ellipsis;
	color: inherit;
}

.card-link .marker-text {
	flex-shrink: 1;
}

.card-link[data-type="download"] .marker-text,
.card-link[data-type="download"] .marker-text__label {
	font-size: var(--wp--preset--font-size--text-md);
}

.card-link .marker-text__label {
	flex-shrink: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.card-link__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--text-md);
	line-height: var(--wp--custom--line-height--regular);
}

.card-link__body,
.card-link__meta {
	box-sizing: border-box;
	width: 0;
	min-width: 100%;
	max-width: 100%;
}

.card-link__body {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	font-family: var(--wp--preset--font-family--jp-sans);
	font-size: var(--wp--preset--font-size--text-xs);
	font-weight: var(--wp--custom--font-weight--regular);
	line-height: var(--wp--custom--line-height--regular);
	letter-spacing: var(--wp--custom--letter-spacing--none);
	color: inherit;
}

.card-link__meta {
	margin: 0;
	overflow: hidden;
	font-family: var(--wp--preset--font-family--jp-sans);
	font-size: var(--wp--preset--font-size--text-xs);
	font-weight: var(--wp--custom--font-weight--regular);
	line-height: var(--wp--custom--line-height--regular);
	letter-spacing: var(--wp--custom--letter-spacing--none);
	white-space: nowrap;
	text-overflow: ellipsis;
	color: inherit;
}

.card-link__action {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: 1;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	box-sizing: border-box;
	width: var(--card-link-action-size);
	height: var(--card-link-action-size);
	padding: var(--wp--custom--atom--xs);
	overflow: hidden;
	pointer-events: none;
	color: var(--wp--preset--color--base-white);
}

.card-link__action > [data-hover-action] {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	box-sizing: border-box;
	padding: inherit;
}

.card-link__action::before {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 0 0 var(--card-link-action-size) var(--card-link-action-size);
	border-color: transparent transparent var(--wp--preset--color--line-grey) transparent;
	transition: 0.3s;
}

.card-link__action .icon {
	inline-size: 1.125rem;
	block-size: 1.125rem;
}

.card-link:focus {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.card-link__action::before {
		transition: none;
	}
}

/* SP: 全幅。三角は常時ロゴブルー（hover 相当を初期表示）。 */
@media (max-width: 767px) {
	.card-link {
		width: 100%;
	}

	.card-link__action::before,
	.card-link:hover .card-link__action::before,
	.card-link:focus-visible .card-link__action::before {
		border-color: transparent transparent var(--wp--preset--color--logo-blue) transparent;
	}

	.card-link[data-type="ogp"] .card-link__title,
	.card-link[data-type="download"] .marker-text,
	.card-link[data-type="download"] .marker-text__label,
	.card-link__title {
		font-size: var(--wp--preset--font-size--text-sm);
	}

	.card-link[data-type="ogp"] .card-link__body,
	.card-link__body {
		font-size: var(--wp--preset--font-size--text-xs);
	}

	.card-link__action .icon {
		inline-size: 1rem;
		block-size: 1rem;
	}
}

/* :focus-visible（常時有効） */
a.card-link:focus-visible {
	text-decoration: none;
}

.card-link:focus-visible .card-link__action::before {
	border-color: transparent transparent var(--wp--preset--color--logo-blue) transparent;
}

.card-link:focus-visible {
	outline: 1px solid var(--wp--preset--color--logo-blue);
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	a.card-link:hover {
		text-decoration: none;
	}

	.card-link:hover .card-link__action::before {
		border-color: transparent transparent var(--wp--preset--color--logo-blue) transparent;
	}

}
