
/** DOM example

インナーブロックは全幅か幅広の時のみ指定
そうでないと container-padding が余分についてしまう

entry-body
	wp-block-cover
		wp-block-cover__inner-container
*/
.alignfull,
.alignwide {
	div[class*="__inner-container"]{
		max-width: calc( var(--vk-width-container) - var(--vk-width-container-padding) * 2 );
		margin-left:auto;
		margin-right:auto;
	}
}
.alignfull {
	&,
	div[class*=__inner-container].is-layout-constrained > &,
	&.vk_slider,
	&.wp-block-image,
	&.wp-block-cover-image,
	&.wp-block-cover {
		width:auto; /* Don't use 100vw!! cope with windows */
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		max-width: 100vw;
	}
}
.alignwide {
	&,
	&.vk_slider,
	&.wp-block-image,
	&.wp-block-cover-image,
	&.wp-block-cover {
		// --vk-width-container != 100% なので注意
		// Lightningの幅広 = コンテナの「表示エリア（100%）	」 + 左右余白分の丁度半分
		width: calc( 100% + ( 100vw - 100% ) / 2 );
		margin-left: calc( ( 100% - 100vw ) / 4 );
		margin-right: calc( ( 100% - 100vw ) / 4 );
		max-width: 100vw;
	}
	body .is-layout-constrained > &:where(:not(.alignleft):not(.alignright):not(.alignfull)) {
		margin-left: calc( ( 100% - 100vw ) / 4 ) !important;
		margin-right: calc( ( 100% - 100vw ) / 4 ) !important;
	}
}
.main-section--col--two {
	.alignfull,
	.alignwide {
		margin-left:0;
		margin-right:0;
		max-width: 100%;
		&.wp-block-image {
			// Default block style overwrite
			max-width: 100%;
		}
	}
}

/* Inline Code */
:not(pre) > code,
kbd {
	display: inline-flex;
	margin: 0 0.4em;
	padding: 0.2em 0.4em;
	align-items: center;
	background-color: var(--vk-color-accent-bg);
	border: 1px solid var(--vk-color-border-hr);
	border-radius: 2px;
	color: var(--vk-color-text-body);
	font-size: 0.9em;
	line-height: 1.1;

	&:focus:not(pre) > code[data-rich-text-format-boundary],
	&:focus > kbd[data-rich-text-format-boundary] {
		background-color: var(--vk-color-accent-bg);
	}
}

kbd {
	border-bottom-width: 3px;
}

/* カラム（水平）で点線と余白ができる */
.vk_post .row {
	margin: 0;
}

.wp-block-image {
	max-width: 100%;
	/* 編集画面専用 */
	.components-resizable-box__container {
		max-width: 100%;
	}
	figcaption {
		text-align: center;
		font-size: 0.75rem;
	}
}

.wp-block-quote cite {
	font-size: var(--vk-size-text-xs);
}

/*-------------------------------------------*/
/*  Image Block
/*-------------------------------------------*/
// 6.0 まで .wp-block-image に余白をつけていたのに対して、
// 6.1 からは .wp-block-image figure では 余白 0 で上書きしてくるため補正
body .wp-block-image figure {
	margin-bottom:1em;
}

// Addressing the image ratio issue in WordPress 6.3
.wp-block-image {
	img {
		height:auto;
	}
	img:not([style*='object-fit']) {
		height: auto !important; // !important to override inline styles.
	}
}

/*-------------------------------------------*/
/*  Button Block
/*-------------------------------------------*/
.wp-block-button {
	&__link {
		font-size: 1rem;
		background-color: var(--vk-color-primary);
		transition: all 0.1s ease-in;
	}
	.wp-block-buttons &__link{ // ボタンブロック単独のCSSの方が後に出力されるて負けるため
		border-radius: var(--vk-size-radius);
	}
	.wp-block-button__link:hover,
	.wp-block-button__link:hover:not(.has-background){
		text-decoration: none;
		background-color: var(--vk-color-primary-dark);
		border-color: var(--vk-color-primary-dark);
		color:#fff;
	}
	.wp-block-button__link.has-background:hover{
		// コアのカラーパレットのCSSが !important 付けてくるのでやむなく !important
		background-color: var(--vk-color-primary-dark) !important;
	}
	.wp-block-button__link:hover:not(.has-background){
		// コアのカラーパレットのCSSが !important 付けてくるのでやむなく !important
		color:#fff !important;
	}
	&.is-style-outline {
		& > .wp-block-button__link{
			background-color:transparent; // 6.6で コアのデフォルトスタイルが負けるようになり、背景色がついてしまうので追加
		}
	}
}
.wp-block-button__link {
	padding-top: calc( 0.5em + 1px );
	padding-bottom: calc( 0.5em + 1px );
}
.is-style-outline>.wp-block-button__link,
.wp-block-button__link.is-style-outline{
	padding-top: 0.5em;
	padding-bottom: 0.5em; 
}
.is-style-outline>.wp-block-button__link{
	border-width: 1px;
}


/*-------------------------------------------*/
/*  Table Block
/*-------------------------------------------*/
.wp-block-table {
	thead th.has-text-align-right {
		text-align: center;
	} 
	figcaption {
		margin-top: 0.4rem;
		text-align: center;
		font-size: 0.75rem;
	}
}

/*-------------------------------------------*/
/*  「最新の記事」ブロック
/*-------------------------------------------*/
.wp-block-latest-posts {
	margin: 0;
	padding: 0;
	list-style-type: none;
	//グリット表示の場合
	&.is-grid {
		li {
			// margin: 0 8px 0 8px;
			padding: 0.5rem;
			border-bottom: none;
		}
	}
	li {
		margin: 0;
		padding: 1rem 0;
		border-bottom: 1px solid var(--vk-color-border-hr);
		& > a {
			color: var(--vk-color-text-body);
			text-decoration: none;
			display:block; overflow:hidden;
			margin-bottom:var(--vk-margin-meta);
			&:hover{
				text-decoration: underline;
			}
		}
		&:after {
			content: "";
			display: block;
			clear: both;
		}
	}
	&__post-author,
	&__post-date {
		color: var(--vk-color-text-light);
		font-size: var(--vk-size-text-sm);
	}
	&__featured-image {
		margin-bottom: var(--vk-margin-meta);
		display: block;
		width: auto;
		max-width: 100%;
		img {
			border: 1px solid var(--vk-color-border-hr);
			max-width: 100%;
		}
		&.alignleft {
			float:left;
		}
		&.alignright {
			float:right;
		}
	}
	&__post-excerpt {
		font-size: var(--vk-size-text-sm);
		margin-top:var(--vk-margin-meta);
		color:var(--vk-color-text-body);
	}
}

@media (max-width: 600px){
	.wp-block-media-text {
		&.is-stacked-on-mobile{
			.wp-block-media-text__media {
				margin-bottom:1.6rem;
			}
			&.has-media-on-the-right {
				.wp-block-media-text__media {
					margin-top:1.6rem;
				}
			}
		}
	}
}

/*-------------------------------------------*/
/*  「RSS」ブロック
/*-------------------------------------------*/
.wp-block-rss{
	padding: 0;
	list-style: none;
	&__item{
		margin-bottom:0;
		padding: 0.8rem 0;
		border-bottom: 1px solid rgba(0,0,0,.05);
		&-title{
			margin-bottom: var(--vk-margin-meta);
			a{
				color: var(--vk-color-text-body);
				text-decoration: none;
			}
		}
		&-publish-date{
			margin-right: .5em;
			&:before {
				font-family: "Font Awesome 5 Free";
				font-weight: 900;
				margin-right: 5px;
				margin-left: 0;
				content: "\f073";
			}
		}
		&-author{
			&:before {
				font-family: "Font Awesome 5 Free";
				font-weight: 900;
				margin-right: 5px;
				margin-left: 0;
				content: "\f303";
			}
		}
		&-publish-date,
		&-author{
			font-size: var(--vk-size-text-xs);
			color: var(--vk-color-text-light);
			display:inline-block;
			margin-top: .5em;
		}
		&-excerpt{
			font-size: var(--vk-size-text-xs);
			color: var(--vk-color-text-light);
			margin-top: var(--vk-margin-meta);
		}
		
	}
	&.is-grid {
		justify-content: space-between;
		li {
			margin-left:0;
			margin-right:0;
		}
	}
}


/*-------------------------------------------*/
/*  「検索」ブロック
/*-------------------------------------------*/
.wp-block-search {
	.wp-block-search__label{
		display: none;
	}
	&__input,
	&__button{
		border-radius: var(--vk-size-radius);
	}
	.wp-block-search__button{
		width: 33%;
		color: #fff;
		background-color: var(--vk-color-primary);
		border: none;
		padding: 6px;
		font-size: 16px;
		box-shadow:none;
		text-align: center;
	}
	input.wp-block-search__input {
		max-width: initial;
		width: 64%;
		border: 1px solid #ccc;
		padding: 6px 12px;
		font-size: 14px;
		margin-right: 0;
		margin-bottom: 0;
	}
}

/*-------------------------------------------*/
/*  cover block
/*-------------------------------------------*/
// WP6.3からwp-block-cover にoverflow: clip; がついて、中に幅広・全幅ブロックを設置しても見切れてしまうようになったため追加
.wp-block-cover:has( .alignwide , .alignfull, [data-align=wide], [data-align=full]){
	overflow: visible;
}