/**
 * PC shell layout — left menu / right post
 * Figma: 詳細ページ node 133:907
 *
 * --hds-type-scale: 1300px 付近を基準（1）。SP（〜781px）は独自サイズのため 1 のまま。
 */
:root {
	--hds-type-scale: 0.95;
	/* 1400px=800px を基準。旧 880 からの縮小比 800/880 */
	--hds-news-entry-rail: calc(780px * 800 / 880);
	--hds-legal-rail: calc(742px * 800 / 880);
	--hds-teams-rail: calc(1100px * 800 / 880);
	--hds-teams-diagram: calc(906px * 800 / 880);
}

.hds-shell {
	position: relative;
	display: grid;
	/* 左 370px 固定（ブラウザ左端）+ 残りをコンテンツエリア */
	grid-template-columns: 370px minmax(0, 1fr);
	justify-content: stretch;
	align-items: start;
	width: 100%;
	max-width: none;
	margin: 0;
	min-height: 100vh;
	--hds-content-gutter: 55px;
	--hds-content-rail: min(calc(780px * 800 / 880), calc(100% - (var(--hds-content-gutter) * 2)));
}

@media screen and (min-width: 1200px) {
	:root {
		--hds-type-scale: 1;
	}

	.hds-shell {
		--hds-content-rail: calc(780px * 800 / 880);
	}
}

@media screen and (min-width: 1400px) {
	:root {
		--hds-type-scale: 1.05;
		--hds-news-entry-rail: 800px;
		--hds-legal-rail: calc(742px * 800 / 780);
		--hds-teams-rail: calc(1100px * 800 / 780);
		--hds-teams-diagram: calc(906px * 800 / 780);
	}

	.hds-shell {
		--hds-content-rail: 800px;
	}
}

@media screen and (min-width: 1600px) {
	:root {
		--hds-type-scale: 1.1;
		--hds-news-entry-rail: calc(1000px * 800 / 880);
		--hds-legal-rail: calc(742px * 1000 * 800 / (780 * 880));
		--hds-teams-rail: calc(1100px * 1000 * 800 / (780 * 880));
		--hds-teams-diagram: calc(906px * 1000 * 800 / (780 * 880));
	}

	.hds-shell {
		--hds-content-rail: calc(1000px * 800 / 880);
	}
}

.hds-shell.alignfull,
.wp-block-group.alignfull.hds-shell {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

.hds-shell__aside {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 15px;
	width: 370px;
	max-width: 370px;
	padding: 0 0 2rem;
	box-sizing: border-box;
	/*
	 * max-height で切らない。
	 * 右コンテンツを最後までスクロールすると、sticky が解除され
	 * メニュー下端まで見える（途中の画面下のはみ出しはそのまま）。
	 */
}

.hds-shell--works .hds-shell__aside {
	background-color: rgba(255, 255, 255, 0.03);
	min-height: 100vh;
}

/* ヘッダー〜サイドメニュー間は gap:15px のみ（WP blockGap を打ち消し） */
.hds-shell__aside > * + * {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell__main {
	min-width: 0;
	width: 100%;
	max-width: none;
	padding: 0 55px 4rem;
	box-sizing: border-box;
}

.hds-shell__main > .wp-block-post-title,
.hds-shell__main > .wp-block-post-date,
.hds-shell__main > .wp-block-post-content,
.hds-shell__main > .wp-block-query {
	max-width: 800px;
}

/*
 * Works FV — 16:7（1920×840）/ top:0 / 右端揃え
 * 上・右の余白をなくす（エディターの inline padding / root padding も打ち消し）
 */
body:has(.hds-shell--works),
body:has(.hds-works-featured) {
	padding-top: 0 !important;
	margin-top: 0 !important;
}

body:has(.hds-shell--works) .wp-site-blocks,
body:has(.hds-works-featured) .wp-site-blocks {
	padding-top: 0 !important;
	margin-top: 0 !important;
	overflow-x: clip;
}

.hds-shell--works,
.hds-shell:has(.hds-works-featured) {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
	padding-top: 0 !important;
	gap: 0;
	row-gap: 0;
	align-items: start;
}

/*
 * 左カラム（aside）の次の main に WP blockGap の margin-block-start が付き、
 * グリッド2列目だけ下にずれて FV 上に余白が出るのを打ち消す
 */
.hds-shell--works > .hds-shell__main,
.hds-shell:has(.hds-works-featured) > .hds-shell__main,
.hds-shell--works > * + *,
.hds-shell:has(.hds-works-featured) > * + * {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell--works .hds-shell__main,
.hds-shell:has(.hds-works-featured) .hds-shell__main {
	max-width: none;
	padding-top: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	overflow-x: visible;
}

.hds-shell--works .hds-works-kv,
.hds-shell:has(.hds-works-featured) .hds-works-kv {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

.hds-shell--works .hds-shell__main > .hds-works-kv + *,
.hds-shell:has(.hds-works-featured) .hds-shell__main > .hds-works-kv + * {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell--works .hds-works-featured,
.hds-shell--works .wp-block-post-featured-image.hds-works-featured,
.hds-shell:has(.hds-works-featured) .hds-works-featured {
	display: block;
	padding: 0 !important;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	margin-block-start: 0 !important;
	aspect-ratio: 16 / 7;
	overflow: hidden;
	box-sizing: border-box;
}

.hds-shell--works .hds-works-featured img,
.hds-shell--works .wp-block-post-featured-image.hds-works-featured img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

/*
 * Works content rail: 1200→780×800/880 / 1400→800 / 1600→1000×800/880, with gutter below 1200
 * .hds-works-entry（HTMLブロック）と .wp-block-post-content を同幅・同位置に揃える
 */
.hds-shell--works .hds-shell__main > .wp-block-html:not(:has(.hds-works-entry__breadcrumb)),
.hds-shell--works .hds-shell__main > .hds-works-entry,
.hds-shell--works .hds-shell__main > .wp-block-post-content,
.hds-shell--works .hds-shell__main > .entry-content {
	width: 100%;
	max-width: var(--hds-content-rail);
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

/* タイトル行の直後〜本文：blockGap による上マージンを消す */
.hds-shell__main > .wp-block-post-content,
.hds-shell__main > .entry-content,
.hds-shell--works .hds-shell__main > .wp-block-post-content,
.hds-shell--works .hds-shell__main > .entry-content {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

/* PC: works-entry も本文と同じレール幅 */
.hds-shell--works .hds-works-entry,
.hds-shell--works .hds-shell__main > .wp-block-html:has(.hds-works-entry),
.hds-shell--works .hds-shell__main > .wp-block-html .hds-works-entry {
	width: 100%;
	max-width: var(--hds-content-rail);
	margin-left: auto !important;
	margin-right: auto !important;
	margin-block-end: 0 !important;
	padding-bottom: 0;
	box-sizing: border-box;
}

/* post-content 内ブロックもレール幅いっぱいに（二重の中央寄せを防ぐ） */
.hds-shell--works .hds-shell__main > .wp-block-post-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)),
.hds-shell--works .hds-shell__main > .entry-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

/*
 * News detail — Figma 265:11812
 * Full-page centered layout (not works left-rail shell)
 */
.hds-shell--news {
	display: block;
	max-width: 1280px;
	margin: 0 auto;
	min-height: 0;
}

.hds-shell--news > .hds-shell__main,
.hds-shell--news > * + * {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell__aside--news {
	position: static;
	width: 100%;
	padding: 0;
	gap: 0;
}

.hds-shell__aside--news .hds-header {
	width: 100%;
}

.hds-shell--news .hds-shell__main--news {
	width: 100%;
	max-width: none;
	min-width: 0;
	padding: 0 40px;
	box-sizing: border-box;
}

.hds-shell--news .hds-shell__main > .wp-block-html,
.hds-shell--news .hds-shell__main > .hds-news-entry,
.hds-shell--news .hds-shell__main > .hds-news-back,
.hds-shell--news .hds-shell__main > .wp-block-post-content,
.hds-shell--news .hds-shell__main > .entry-content {
	width: 100%;
	max-width: var(--hds-news-entry-rail);
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

.hds-shell--news .hds-shell__main > .wp-block-post-content,
.hds-shell--news .hds-shell__main > .entry-content {
	max-width: var(--hds-news-entry-rail);
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell--news .hds-shell__main > .wp-block-html:has(.hds-news-back),
.hds-shell--news .hds-shell__main > .hds-news-back {
	margin-top: 70px !important;
	margin-block-start: 70px !important;
}

.hds-shell--news .hds-shell__main > .wp-block-post-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)),
.hds-shell--news .hds-shell__main > .entry-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

/*
 * About page — Figma 133:1234
 * Site-wide back.jpg (body::before) + centered content rail (742px)
 *
 * Our teams — Figma 133:1346
 * Same full-width header shell; content rail 1100px (90px inset)
 *
 * Recruit — Figma 133:1426
 * Same full-width header shell; content rail 742px (About と同じ)
 *
 * Contact — Figma 133:1679
 * Same full-width header shell; content rail 742px (About と同じ)
 */
.hds-shell--about,
.hds-shell--teams,
.hds-shell--recruit,
.hds-shell--policy,
.hds-shell--terms,
.hds-shell--contact {
	display: block;
	position: relative;
	max-width: 1280px;
	margin: 0 auto;
	background: transparent;
}

.hds-shell--home {
	display: block;
	position: relative;
	max-width: none;
	width: 100%;
	margin: 0;
	background: transparent;
}

.hds-shell--about > .hds-shell__main,
.hds-shell--about > * + *,
.hds-shell--teams > .hds-shell__main,
.hds-shell--teams > * + *,
.hds-shell--recruit > .hds-shell__main,
.hds-shell--recruit > * + *,
.hds-shell--policy > .hds-shell__main,
.hds-shell--policy > * + *,
.hds-shell--terms > .hds-shell__main,
.hds-shell--terms > * + *,
.hds-shell--contact > .hds-shell__main,
.hds-shell--contact > * + *,
.hds-shell--home > .hds-shell__main,
.hds-shell--home > * + * {
	margin-top: 0 !important;
	margin-block-start: 0 !important;
}

.hds-shell__aside--about,
.hds-shell__aside--teams,
.hds-shell__aside--recruit,
.hds-shell__aside--policy,
.hds-shell__aside--terms,
.hds-shell__aside--contact,
.hds-shell__aside--home {
	position: static;
	width: 100%;
	padding: 0;
	gap: 0;
}

.hds-shell__aside--about .hds-header,
.hds-shell__aside--teams .hds-header,
.hds-shell__aside--recruit .hds-header,
.hds-shell__aside--policy .hds-header,
.hds-shell__aside--terms .hds-header,
.hds-shell__aside--contact .hds-header,
.hds-shell__aside--home .hds-header {
	width: 100%;
}

.hds-shell--about .hds-shell__main--about,
.hds-shell--recruit .hds-shell__main--recruit,
.hds-shell--contact .hds-shell__main--contact,
.hds-shell--home .hds-shell__main--home {
	width: 100%;
	max-width: none;
	min-width: 0;
	padding: 0;
	box-sizing: border-box;
}

.hds-shell--teams .hds-shell__main--teams,
.hds-shell--policy .hds-shell__main--policy,
.hds-shell--terms .hds-shell__main--terms {
	width: 100%;
	max-width: none;
	min-width: 0;
	padding: 0 40px;
	box-sizing: border-box;
}

.hds-shell--teams .hds-shell__main--teams {
	padding: 0 90px;
}

@media screen and (max-width: 1099px) {
	.hds-shell--teams .hds-shell__main--teams {
		padding: 0 40px;
	}
}

.hds-shell--about .hds-shell__main > .wp-block-html,
.hds-shell--about .hds-shell__main > .hds-about,
.hds-shell--about .hds-shell__main > .wp-block-post-content,
.hds-shell--about .hds-shell__main > .entry-content,
.hds-shell--recruit .hds-shell__main > .wp-block-html,
.hds-shell--recruit .hds-shell__main > .hds-recruit,
.hds-shell--recruit .hds-shell__main > .wp-block-post-content,
.hds-shell--recruit .hds-shell__main > .entry-content,
.hds-shell--contact .hds-shell__main > .wp-block-html,
.hds-shell--contact .hds-shell__main > .hds-contact,
.hds-shell--contact .hds-shell__main > .wp-block-post-content,
.hds-shell--contact .hds-shell__main > .entry-content,
.hds-shell--home .hds-shell__main > .wp-block-html,
.hds-shell--home .hds-shell__main > .hds-home,
.hds-shell--home .hds-shell__main > .wp-block-post-content,
.hds-shell--home .hds-shell__main > .entry-content {
	width: 100%;
	max-width: none;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
}

.hds-shell--policy .hds-shell__main > .wp-block-html,
.hds-shell--policy .hds-shell__main > .hds-policy,
.hds-shell--policy .hds-shell__main > .wp-block-post-content,
.hds-shell--policy .hds-shell__main > .entry-content,
.hds-shell--terms .hds-shell__main > .wp-block-html,
.hds-shell--terms .hds-shell__main > .hds-terms,
.hds-shell--terms .hds-shell__main > .wp-block-post-content,
.hds-shell--terms .hds-shell__main > .entry-content {
	width: 100%;
	max-width: var(--hds-legal-rail);
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

.hds-shell--teams .hds-shell__main > .wp-block-html,
.hds-shell--teams .hds-shell__main > .hds-teams,
.hds-shell--teams .hds-shell__main > .wp-block-post-content,
.hds-shell--teams .hds-shell__main > .entry-content {
	width: 100%;
	max-width: var(--hds-teams-rail);
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

/* Header sits inside left column */
.hds-shell__aside .hds-header {
	width: 100%;
}

.hds-shell__aside .hds-header__inner {
	padding: 12px 16px;
}

/* Footer stays full width below shell */
.hds-shell + .hds-footer,
body .wp-site-blocks > .hds-footer,
body .wp-site-blocks > footer.hds-footer,
body .wp-site-blocks > .wp-block-template-part:has(.hds-footer),
body .wp-site-blocks > footer {
	max-width: 1280px;
	margin-left: auto;
	margin-right: auto;
}

@media screen and (min-width: 782px) {
	body .wp-site-blocks {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
}

@media screen and (max-width: 1100px) {
	.hds-shell {
		grid-template-columns: 370px minmax(0, 1fr);
	}

	.hds-shell__main {
		padding-left: 2rem;
		padding-right: 2rem;
	}

	.hds-shell--works .hds-shell__main {
		padding-top: 0 !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* 1100以下はシェル全幅なので FV もカラム幅いっぱい */
	.hds-shell--works .hds-works-featured,
	.hds-shell--works .wp-block-post-featured-image.hds-works-featured {
		width: 100% !important;
	}

	.hds-shell--works .hds-shell__main > .wp-block-html,
	.hds-shell--works .hds-shell__main > .hds-works-entry,
	.hds-shell--works .hds-shell__main > .wp-block-post-content,
	.hds-shell--works .hds-shell__main > .entry-content {
		max-width: var(--hds-content-rail);
	}

	.hds-shell--news .hds-shell__main > .wp-block-html,
	.hds-shell--news .hds-shell__main > .hds-news-entry,
	.hds-shell--news .hds-shell__main > .hds-news-back,
	.hds-shell--news .hds-shell__main > .wp-block-post-content,
	.hds-shell--news .hds-shell__main > .entry-content {
		max-width: min(var(--hds-news-entry-rail), calc(100% - 4rem));
	}

	.hds-shell--news .hds-shell__main > .wp-block-post-content,
	.hds-shell--news .hds-shell__main > .entry-content {
		max-width: min(var(--hds-news-entry-rail), calc(100% - 4rem));
	}
}

@media screen and (max-width: 781px) {
	:root {
		--hds-type-scale: 1;
	}

	.hds-shell {
		display: block;
		max-width: none;
	}

	.hds-shell__aside {
		position: static;
		width: 100%;
		max-width: none;
		min-height: 0;
		gap: 0;
		padding: 0;
		background-color: transparent;
	}

	.hds-shell--works .hds-shell__aside {
		min-height: 0;
		height: auto;
		background-color: transparent;
	}

	.hds-shell__aside .hds-header {
		width: 100%;
	}

	.hds-shell__aside .hds-header__inner {
		padding: 14px 32px;
	}

	.hds-shell__main {
		padding: 1.5rem var(--wp--preset--spacing--40, 1.5rem) 3rem;
	}

	.hds-shell--works .hds-shell__main {
		padding-top: 0 !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
		padding-bottom: 3rem;
	}

	.hds-shell--works .hds-works-kv {
		margin-bottom: 0;
	}

	/* FV直後にパンくず（Figma Frame 242）が続く */
	.hds-shell--works .hds-works-featured,
	.hds-shell--works .wp-block-post-featured-image.hds-works-featured {
		margin-bottom: 0 !important;
	}

	/* パンくずは左右24px、本文は30pxなのでシェル共通paddingは外す */
	.hds-shell--works .hds-shell__main > .wp-block-html,
	.hds-shell--works .hds-shell__main > .hds-works-entry,
	.hds-shell--works .hds-shell__main > .wp-block-html:has(.hds-works-entry),
	.hds-shell--works .hds-shell__main > .wp-block-html .hds-works-entry {
		max-width: none;
		width: 100%;
		margin-left: 0 !important;
		margin-right: 0 !important;
		padding-left: 0;
		padding-right: 0;
	}

	.hds-shell--works .hds-shell__main > .wp-block-post-content,
	.hds-shell--works .hds-shell__main > .entry-content,
	.hds-shell--works .hds-shell__main > .wp-block-html:has(.hds-works-entry-meta) {
		max-width: none;
		/* Figma リード Frame 246: left 30 / width 341 */
		padding-left: 30px;
		padding-right: 30px;
		box-sizing: border-box;
	}

	.hds-shell--news .hds-shell__main--news {
		padding: 0 var(--wp--preset--spacing--40, 1.5rem);
	}

	.hds-shell--news .hds-shell__main > .wp-block-html,
	.hds-shell--news .hds-shell__main > .hds-news-entry,
	.hds-shell--news .hds-shell__main > .hds-news-back,
	.hds-shell--news .hds-shell__main > .wp-block-post-content,
	.hds-shell--news .hds-shell__main > .entry-content {
		max-width: none;
		width: 100%;
	}

	.hds-shell--news .hds-shell__main > .wp-block-post-content,
	.hds-shell--news .hds-shell__main > .entry-content {
		margin-top: 0 !important;
		margin-block-start: 0 !important;
	}

	.hds-shell--about .hds-shell__main--about,
	.hds-shell--recruit .hds-shell__main--recruit,
	.hds-shell--contact .hds-shell__main--contact,
	.hds-shell--home .hds-shell__main--home {
		padding: 0;
	}

	.hds-shell--teams .hds-shell__main--teams,
	.hds-shell--policy .hds-shell__main--policy,
	.hds-shell--terms .hds-shell__main--terms {
		padding: 0 var(--wp--preset--spacing--40, 1.5rem) 3rem;
	}

	.hds-shell--about .hds-shell__main > .wp-block-html,
	.hds-shell--about .hds-shell__main > .hds-about,
	.hds-shell--teams .hds-shell__main > .wp-block-html,
	.hds-shell--teams .hds-shell__main > .hds-teams,
	.hds-shell--recruit .hds-shell__main > .wp-block-html,
	.hds-shell--recruit .hds-shell__main > .hds-recruit,
	.hds-shell--policy .hds-shell__main > .wp-block-html,
	.hds-shell--policy .hds-shell__main > .hds-policy,
	.hds-shell--terms .hds-shell__main > .wp-block-html,
	.hds-shell--terms .hds-shell__main > .hds-terms,
	.hds-shell--contact .hds-shell__main > .wp-block-html,
	.hds-shell--contact .hds-shell__main > .hds-contact,
	.hds-shell--home .hds-shell__main > .wp-block-html,
	.hds-shell--home .hds-shell__main > .hds-home {
		max-width: none;
		width: 100%;
	}

	.hds-sidebar {
		display: none;
	}
}
