/**
 * UNO Core: Offcanvas navigation
 *
 * .is-menu-open はハンバーガーメニューを開いたときのみ付与されるため、
 * メディアクエリは使わない（ブレイクポイントは theme.json 側で一元管理）。
 * .uno-offcanvas-closing は offcanvas.js が閉じるアニメーション中に付与する。
 */

/* 画面全体のコンテナ = 暗幕 */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open {
	padding: 0;
	background-color: var(--wp--custom--offcanvas--backdrop, rgb(0 0 0 / 0.5)) !important;
	animation: uno-offcanvas-fade-in 0.3s ease-out;
}

/* パネル本体 */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
	position: fixed;
	inset: 0 0 0 auto;
	width: var(--wp--custom--offcanvas--width, min(80vw, 360px));
	max-width: none;
	margin: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: var(--wp--custom--offcanvas--background, var(--wp--preset--color--base, #fff));
	animation: uno-offcanvas-slide-in 0.3s ease-out;
}

/* パネル内の余白 */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	padding: var(--wp--preset--spacing--40, 1.5rem);
	padding-bottom: calc(var(--wp--preset--spacing--40, 1.5rem) + env(safe-area-inset-bottom, 0px));
}

/* 閉じるアニメーション */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open.uno-offcanvas-closing {
	pointer-events: none;
	animation: uno-offcanvas-fade-out 0.3s ease-in forwards;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open.uno-offcanvas-closing .wp-block-navigation__responsive-close {
	animation: uno-offcanvas-slide-out 0.3s ease-in forwards;
}

/* ログイン時の管理バー */
.admin-bar .wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
	top: 46px;
}

@media (min-width: 783px) {
	.admin-bar .wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
		top: 32px;
	}
}

@keyframes uno-offcanvas-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes uno-offcanvas-fade-out {
	from { opacity: 1; }
	to   { opacity: 0; }
}

@keyframes uno-offcanvas-slide-in {
	from { transform: translateX(100%); }
	to   { transform: none; }
}

@keyframes uno-offcanvas-slide-out {
	from { transform: none; }
	to   { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open,
	.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
		animation: none !important;
	}
}


/* メニューを開いた際のスクロールバー消失による画面幅の変化を防ぐ */
html {
	scrollbar-gutter: stable;
}