/**
 * 固定ページ: institutes 専用スタイル
 * URL: /institutes
 *
 * KV: 9文字。1025px+は1行、1024px以下は5+4（6文字目から改行）
 * KV 画像枠: styles/daynight/_kv.css と同じ（1440 clamp / 768 で 160px）。オーバーレイ余白は intro-kv と同系（clamp + 1024px）
 * パンくず: page-introduction の .breadcrumb と同系（about 配下3階層）
 */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.page-institutes {
	/* 固定ヘッダー分は common/_header.css の .site-content padding-top に任せる（負の margin で相殺しない） */
	margin-top: 0;
	color: var(--color-black);
	font-family: var(--font-family-primary);
}

/* ----- KV（styles/daynight/_kv.css と同じ画像枠・ブレークポイント） ----- */
.page-institutes .institutes-kv {
	position: relative;
	width: 100%;
}

.page-institutes .institutes-kv__image {
	width: 100%;
	line-height: 0;
}

.page-institutes .institutes-kv__image picture {
	display: block;
	width: 100%;
}

.page-institutes .institutes-kv__image img {
	width: 100%;
	height: auto;
	display: block;
}

@media (max-width: 1440px) {
	.page-institutes .institutes-kv__image {
		height: clamp(160px, 18.75vw, 270px);
		overflow: hidden;
	}

	.page-institutes .institutes-kv__image picture {
		height: 100%;
	}

	.page-institutes .institutes-kv__image img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		object-position: center;
	}
}

.page-institutes .institutes-kv__text {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	padding: 0 clamp(1.5rem, 4.9vw, 4.8125rem);
	box-sizing: border-box;
}

@media screen and (max-width: 1024px) {
	.page-institutes .institutes-kv__text {
		padding: 0 1.5rem;
	}
}

.page-institutes .institutes-kv__title {
	margin: 0;
	font-size: var(--font-size-xl);
	font-weight: var(--font-weight-bold);
	line-height: 1.4;
	color: var(--color-black);
}

/* ph2-production/normalize の .ph2-page h1 を打ち消し */
.page-institutes.ph2-page .institutes-kv .institutes-kv__title {
	margin: 0;
	font-size: var(--font-size-xl);
	line-height: 1.4;
}

.page-institutes .institutes-kv__title-inner {
	display: flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	max-width: 100%;
	flex-wrap: wrap;
	row-gap: 4px;
	height: auto;
}

.page-institutes .institutes-kv__title-inner .title-contact-break--sp,
.page-institutes .institutes-kv__title-inner .title-contact-break--tablet {
	flex: 0 0 100%;
	width: 0;
	height: 0;
	display: none;
}

/* 大きいPC: 1行（両方の改行を無効化） */
@media (min-width: 1025px) {
	.page-institutes .institutes-kv__title-inner {
		flex-wrap: nowrap;
	}

	.page-institutes .institutes-kv__title-inner .title-contact-break--sp,
	.page-institutes .institutes-kv__title-inner .title-contact-break--tablet {
		display: none;
	}
}

/*
 * 1024px以下: 5文字目のあとで改行（6文字目から2行目）。SP専用の4文字後改行は使わない。
 */
@media (max-width: 1024px) {
	.page-institutes .institutes-kv__title-inner .title-contact-break--sp {
		display: none;
	}

	.page-institutes .institutes-kv__title-inner .title-contact-break--tablet {
		display: block;
	}
}

/* タブレット: 折り返し・余白 */
@media (min-width: 769px) and (max-width: 1024px) {
	.page-institutes .institutes-kv__title-inner {
		flex-wrap: wrap;
		column-gap: 0.5rem;
		row-gap: 0.75rem;
	}
}

.page-institutes .institutes-kv__title-inner .title-contact-text {
	display: flex;
	align-items: center;
	line-height: 0;
}

.page-institutes .institutes-kv__title-inner .mask-text {
	width: 100%;
	height: auto;
	display: block;
}

/* 1440px〜768px：マスクSVG（page-program と同系） */
@media (max-width: 1440px) and (min-width: 769px) {
	.page-institutes .institutes-kv__title-inner {
		height: auto;
		width: 100%;
	}

	.page-institutes .institutes-kv__title-inner .title-contact-text {
		display: block;
		height: 100%;
		min-height: 0;
		min-width: 0;
		max-width: none;
	}

	.page-institutes .institutes-kv__title-inner .mask-text {
		height: calc(2.5rem * (0.46 + 54vw / 1440));
		width: auto;
		max-width: 100%;
		object-fit: contain;
		display: block;
	}
}

/* タブレット最終調整（後勝ちで guidance 相当に固定） */
@media (min-width: 769px) and (max-width: 1024px) {
	.page-institutes .institutes-kv__title-inner {
		column-gap: 0.5rem;
		row-gap: 0.75rem;
	}

	.page-institutes .institutes-kv__title-inner .mask-text {
		height: 4rem;
		width: auto;
	}

	/* KV 5文字目「・」: 他文字 4rem に対して一段小さい固定 rem（SP は下記ブロックで 2rem 基準に揃える） */
	.page-institutes .institutes-kv__title-inner .title-contact-text--dot .mask-text {
		height: 1.25rem;
	}
}

@media screen and (max-width: 768px) {
	.page-institutes .institutes-kv__image {
		height: 160px;
	}

	.page-institutes .institutes-kv__title-inner {
		width: 100%;
		gap: 0.15rem;
		row-gap: 0.25rem;
	}

	.page-institutes .institutes-kv__title-inner .title-contact-text {
		flex: 0 0 auto;
		width: max-content;
	}

	.page-institutes .institutes-kv__title-inner .mask-text {
		height: 2rem;
		width: auto;
		max-width: none;
		object-fit: contain;
	}

	/* KV 5文字目「・」: タブレットと同様、他文字の高さに対して固定 rem（2rem × 0.88 = 1.76rem） */
	.page-institutes .institutes-kv__title-inner .title-contact-text--dot .mask-text {
		height: 0.7rem;
	}
}

/* ----- パンくず（page-introduction の .breadcrumb と同系） ----- */
.page-institutes .breadcrumb {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 0 8px;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding: 12px 2em;
	margin-bottom: 80px;
	background-color: var(--color-gray-bg);
	font-family: var(--font-family-primary);
	font-size: var(--font-size-xs);
	line-height: var(--line-height-normal);
	font-weight: var(--font-weight-bold);
	color: var(--color-gray-dark);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.page-institutes .breadcrumb::-webkit-scrollbar {
	display: none;
}

.page-institutes .breadcrumb a,
.page-institutes .breadcrumb span {
	white-space: nowrap;
}

.page-institutes .breadcrumb a {
	color: var(--color-gray-dark);
	text-decoration: none;
}

.page-institutes .breadcrumb a:hover {
	text-decoration: underline;
}

.page-institutes .breadcrumb span {
	color: var(--color-gray-dark);
	user-select: none;
}

@media (max-width: 768px) {
	.page-institutes .breadcrumb {
		margin-bottom: 40px;
	}
}

/* ----- メインラッパー（KV 下〜本文）: page-circle .container と同じ幅・横余白 ----- */
.page-institutes .institutes-container {
	max-width: 1280px;
	width: 100%;
	margin: 0 auto;
	padding: 0 24px 2.5rem;
	box-sizing: border-box;
}

/*
 * Figma node 3320:4917
 * border 4px #1f1f1f, radius 8px, padding 50×40, 18px Bold, lh 29px, #1e2939
 */
.page-institutes .institutes-lead {
	box-sizing: border-box;
	max-width: 924px;
	border: 4px solid #1f1f1f;
	border-radius: 8px;
	background: #fff;
	padding: 46px 40px;
	margin: 0 auto 64px;
}

.page-institutes .institutes-lead__text {
	margin: 0;
	font-family: var(--font-family-primary);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: calc(29 / 18);
	color: #1e2939;
}

@media (max-width: 768px) {
	.page-institutes .institutes-lead {
		padding: 24px;
		margin-bottom: 49px;
	}

	.page-institutes .institutes-lead__text {
		font-size: 1rem;
		line-height: 1.4;
	}
}

/* ----- Figma node 3324:32446（施設カード） ----- */
.page-institutes .institutes-facilities {
	display: grid;
	gap: 80px;
}

.page-institutes .institutes-facility {
	position: relative;
	overflow: visible;
	border: 4px solid #1f1f1f;
	border-radius: 10px;
	padding: 52px 40px 40px;
	box-sizing: border-box;
}

/*
 * 六角: 枠の均一化は「SVG の stroke + vector-effect: non-scaling-stroke」。
 * viewBox は 100×100（introduction の hex 系と同系の頂点比）。拡大は none で矩形に合わせる。
 */
.page-institutes .institutes-facility__title {
	position: absolute;
	top: -26px;
	left: 0;
	right: 0;
	margin: 0 auto;
	width: fit-content;
	max-width: 100%;
	min-width: 423px;
	height: 52px;
	padding: 0 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	box-sizing: border-box;
}

.page-institutes .institutes-facility__title-shape {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
	pointer-events: none;
	z-index: 0;
}

.page-institutes .institutes-facility__title-hex {
	fill: #fff;
	stroke: #1f1f1f;
	stroke-width: 4px;
	vector-effect: non-scaling-stroke;
	stroke-linejoin: miter;
	stroke-miterlimit: 8;
	shape-rendering: geometricPrecision;
}

.page-institutes .institutes-facility__title span {
	position: relative;
	z-index: 1;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.1em;
	color: #1f1f1f;
	white-space: nowrap;
}

.page-institutes .institutes-facility__body {
	/* 画像枠 4px×2 と画像高さ 270（482×270）に合わせた右カラム min-height 用 */
	--institutes-facility-image-border-total: 8px;
	--institutes-facility-figure-outer: calc(270px + var(--institutes-facility-image-border-total));
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: clamp(20px, 3vw, 40px);
	min-width: 0;
	max-width: 100%;
	width: 100%;
	box-sizing: border-box;
	overflow: visible;
}

.page-institutes .institutes-facility__image-wrap {
	position: relative;
	flex: 0 1 482px;
	min-width: 0;
	max-width: 482px;
	width: 100%;
	/* 親の --institutes-facility-figure-outer（画像 270px + 枠）で枠を固定し、画像を cover で全面に敷く */
	height: var(--institutes-facility-figure-outer);
	border: 4px solid #1f1f1f;
	border-radius: 8px;
	overflow: hidden;
	background: #d9d9d9;
	box-sizing: border-box;
}

.page-institutes .institutes-facility__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

.page-institutes .institutes-facility__main {
	flex: 1 1 0;
	min-width: 0;
	max-width: 100%;
	min-height: var(--institutes-facility-figure-outer);
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.page-institutes .institutes-facility__desc {
	margin: 80px 0 0;
	max-width: 100%;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: calc(29 / 18);
	color: #1e2939;
}

/* 共通 .btn-more（styles/common/_btn-more.css）。front-page と同系の赤 / ホバー白はインライン変数で付与 */
.page-institutes .institutes-facility__main .btn-more.institutes-facility__btn {
	margin-top: auto;
	align-self: flex-end;
}

/* 768px 以下をタブレット扱い: 線・枠 2px ＋ 施設カードは縦並び（769px 以上は 4px 枠の横並び） */
@media (max-width: 768px) {
	.page-institutes .institutes-lead {
		border-width: 2px;
	}

	.page-institutes .institutes-facility {
		border-width: 2px;
	}

	.page-institutes .institutes-facility__body {
		--institutes-facility-image-border-total: 4px;
		--institutes-facility-figure-outer: calc(270px + var(--institutes-facility-image-border-total));
		flex-direction: column;
		align-items: stretch;
		gap: 20px;
		min-height: 0;
	}

	.page-institutes .institutes-facility__title-hex {
		stroke-width: 2px;
	}

	.page-institutes .institutes-facility .btn-more.institutes-facility__btn {
		border-width: 2px;
	}

	.page-institutes .institutes-facilities {
		gap: 56px;
	}

	.page-institutes .institutes-facility {
		padding: 37px 24px 24px;
	}

	.page-institutes .institutes-facility__title {
		top: -23px;
		min-width: 280px;
		height: 44px;
		padding: 0 20px;
	}

	.page-institutes .institutes-facility__title span {
		font-size: 1.125rem;
		letter-spacing: 0.05em;
	}

	.page-institutes .institutes-facility__image-wrap {
		flex: none;
		width: 100%;
		max-width: none;
		align-self: stretch;
		min-height: 0;
		border-width: 2px;
		height: auto;
		line-height: 0;
	}

	/*
	 * SP: aspect-ratio と position:absolute の img の組み合わせで右にすき間が出ることがあるため、
	 * padding-bottom 比率ボックス（482:270）で高さを確定する。
	 */
	.page-institutes .institutes-facility__image-wrap::before {
		content: "";
		display: block;
		width: 100%;
		padding-bottom: calc(270 / 482 * 100%);
	}

	.page-institutes .institutes-facility__main {
		flex: none;
		width: 100%;
		min-height: 0;
		gap: 24px;
		overflow: visible;
		text-align: left;
	}

	.page-institutes .institutes-facility__main .btn-more.institutes-facility__btn {
		margin-top: 0;
		align-self: stretch;
		width: 100%;
		max-width: none;
	}

	.page-institutes .institutes-facility__desc {
		margin-top: 0;
		font-size: 1rem;
		line-height: 1.4;
	}

}

