@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
　　ヘッダー
------------------------------ */

/* サイト名 */
.site-name {
	display: flex;
    width: 100%;
	height: 100%;
	margin: 0;

	@include acms.font-size(24);

	color: global.$primary-color;
	font-weight: bold;

	.header-stack & {
		margin: 30px 0 20px;
	}

	a {
		display: flex;
		align-items: center;
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		padding: 15px 0;
		color: global.$primary-color;

		 &:hover,
		 &:focus,
		 &:active,
		 &:visited {
			color: global.$primary-color;
		}
	}
}

.site-logo {
	display: inline-block;
	width: 22px;
	height: auto;
	margin: 0 10px 0 0;
	vertical-align: middle;
}

.site-name-text {
	display: inline;
	vertical-align: middle;
}

.edit-link {
	display: inline-block;
	vertical-align: middle;

	@include acms.font-size(14);
}

.header-nav {
	position: relative;
	display: none;
}

@media (min-width : acms.$breakpoint-md-min) {
	.site-name {
		@include acms.font-size(24);

		.header-stack & {
			text-align: center;
		}
	}

	.site-logo {
		width: 40px;
	}

	.header {
		display: flex;
		width: 100%;

		.header-stack & {
			display: block;
		}
	}

	.header-logo {
		width: 100%;
		vertical-align: middle;

		.header-stack & {
			display: block;
		}
	}

	.header-nav {
		display: none;
		vertical-align: middle;

		.header-stack & {
			display: block;
			width: 100%;
			margin: 0 0 15px;
		}
	}
}

@media (min-width : acms.$breakpoint-lg-min) {
	.header-logo {
		display: flex;
		width: 40%;
		height: 100%;

		.header-stack & {
			display: block;
			width: 100%;
		}
	}

	.header-logo-inner {
		display: flex;
		width: 100%;
		height: 100%;
	}

	.header-nav {
		display: flex;
    	align-items: center;
		justify-content: flex-end;
		width: 60%;
		height: 100%;
	
		
		.header-stack & {
			display: block;
			width: 100%;
			margin: 0 0 15px;
		}
	}
}



/* ------------------------------
　　ナビゲーション
------------------------------ */
.header-logo {
	/* 固定したときの高さを保つ */
	padding: global.$header-height 0 0 0;
}

.site-header {
	position: fixed;
		top: 0;
		right: 0;
	z-index: 9999;
  box-sizing: border-box;
	width: 100%;
	padding: 0 5px;
	background: #FFF;
	border-top: 4px solid global.$secondary-color;
	border-bottom: 1px solid #CCC;

	@if  global.$enable-iphonex == true {
		padding: 0 calc(5px + constant(safe-area-inset-right)) 0 calc(5px + constant(safe-area-inset-left));
	}
}

/* モバイル時ナビゲーションボタン */
.nav-menu-btn {
	display: inline-block;
  box-sizing: border-box;
	height: 44px;
	padding: 7px 5px;
	color: global.$text-color-base;

	@include acms.font-size(20);

	a & {
		color: global.$text-color-base;
	}

	&:hover {
		color: global.$text-color-base;
		text-decoration: none;
	}

	.acms-icon-sort {
		display: inline-block;
	}
}

.nav-menu-btn-text {
	  display: inline-block;
	margin: 0 0 0 5px;
	color: #333;
	font-weight: bold;
	vertical-align: middle;

	@include acms.font-size(11);
}

/* モバイル時ヘッダー アイコン */
.nav-menu-action {
	display: table;
	float: right;
	margin: 0;
	padding: 0;
}

.nav-menu-action-item {
	display: table-cell;
	width: 44px;
	height: 44px;
	color: global.$secondary-color;
	text-align: center;
	vertical-align: middle;

	@include acms.font-size(20);
}

.nav-menu-action-link {
	color: global.$secondary-color;

	 &:hover,
	 &:active,
	 &:visited,
	 &:focus {
		color: global.$secondary-color;
		text-decoration: none;
	}
}

.navbar {
	display: none;
	width: 100%;

	 &.acms-admin-module-edit-wrapper {
		// ログインしているとき、下階層ナビゲーションを非表示にさせない対応
		z-index: 1;
	}

	ul {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	li {
		a {
			display: block;
			padding: 10px;
			color: #333;
			font-weight: bold;

			@include acms.font-size(16);

			 &:hover,
			 &:focus,
			 &:active {
				color: #FFF;
				text-decoration: none;
				background: global.$primary-color;
			}
		}
	}
}

@media (min-width : acms.$breakpoint-lg-min) {
	.header {
		height: 100px;
	}

	.navbar {
		display: inline-block;
		vertical-align: middle;

		 & > ul {
			display: flex;
		 	place-content: center flex-end;
		 	flex-wrap: wrap;
			float: right;
			padding: 0;
			list-style: none;

			.header-stack & {
				display: table;
				float: none;
				width: 100%;
				table-layout: fixed;
				border-right: 1px solid #EEE;
			}
		}

		li {
			position: relative;
			display: flex;
			float: left;
			margin: 0 10px;
			text-align: center;
			vertical-align: middle;
			place-items: center;

			.header-stack &.navbar-btn {
				padding: 0 10px;
			}

			.header-stack & {
				display: table-cell;
				float: none;
				border-left: 1px solid #EEE;
			}

			ul { /* 二階層目 */
				position: absolute;
					top: 100%;
					left: 0;
				display: none;
				min-width: 200px;
			}

			li {
				margin: 0;

				.header-stack & {
					display: block;
					border: 0;
				}
			}

			a { /* 一階層目のリンクのみ */
				padding: 0;
				border-top: 4px solid transparent;
				border-bottom: 4px solid transparent;

				@include acms.transition(border .25s ease-out);

				 &:hover,
				 &:focus,
				 &:active {
					color: #333;
					background: transparent;
				}

				.header-stack & {
					display: block;
					padding: 10px;

					@include acms.font-size(16);
				}
			}

			 &.stay {
				a { /* 一階層目のリンクのみ */
					border-bottom: 4px solid global.$primary-color;

					 &.btn-attention {
						border: 0;
					}
				}
			}

			 &:hover {
				ul { /* 二階層目 */
					z-index: 10000;
					display: block;

					@include acms.animation(0.8s fade-in);
				}

				a { /* 一階層目のリンクのみ */
					border-bottom: 4px solid global.$primary-color;

					 &.btn-attention {
						border: 0;
					}
				}

				li {
					a {
						border: 0;
					}
				}
			}

			li { /* 二階層目以降 */
				display: block;
				float: none;
				text-align: left;
				background: global.$primary-color;
				border: 0;
				border-top: 1px solid global.$primary-color-hover;

				 &:first-child {
					border: 0;
				}

				a {
					margin: 0;
					padding: 10px 15px;
					color: #FFF;
					border: 0;

					 &:hover {
						color: #FFF;
						background: global.$primary-color-hover;
						border: 0;
					}
				}
			}
		}

		a {
			 &.btn-attention { /* ボタン（色付き） */
				background: global.$btn-attention-default-color;

				@include global.btn-base;
				@include global.btn-small;

				border: 0;

				 &:hover {
					@include global.btn-colors(global.$btn-attention-start-color, global.$btn-attention-end-color, #FFF);

					border: 0;
				}

				 &:active,
				 &:focus {
					background: global.$btn-attention-active-color;
				}
			}
		}
	}
}

@media (min-width : acms.$breakpoint-lg-min) {
	.header-logo {
		padding: 0;
	}

	.navbar {
		ul {
			li {
				a {
					@include acms.font-size(14);
				}
			}
		}
	}
}

@media (min-width : acms.$breakpoint-xl-min) {
	.navbar {
		ul {
			li {
				a {
					@include acms.font-size(16);
				}
			}
		}
	}
}


/* ------------------------------
　　サイドメニュー
------------------------------ */
.navbar-side {
	position: absolute;
	top: 0;
	right: 0;

	@include acms.font-size(11);

	text-align: right;
}

.navbar-side-list {
	display: inline-block;
	margin: 0;
	padding: 0;
	overflow: hidden;
	list-style: none;
	background: #333;
	border-radius: 0 0 4px 4px;
}

.navbar-side-item {
	position: relative;
	display: inline-block;
	color: #FFF;

	&::before {
		position: absolute;
		top: 5px;
		bottom: 0;
		left: 0;
		display: block;
		height: 1em;
		border-left: 1px dotted #FFF;
		content: "";
	}

	&:first-child::before {
		content: none;
	}
}

.navbar-side-link {
	display: inline-block;
	padding: 4px 14px 4px 10px;
	color: #FFF;

	[class*="acms-icon"] {
		margin: -2px 5px 0 0;
	}

	&:hover,
	&:visited,
	&:active,
	&:focus {
		color: #FFF;
	}

	&:hover [class*="acms-icon"] {
		text-decoration: none;
	}
}


/* ------------------------------
　　モバイルメニュー
------------------------------ */

/* トグルメニューアイコン */
.icon-toggle-menu {
	position: relative;
	display: inline-block;
	width: 18px;
	height: 2px;
	margin: 6px 0;
	vertical-align: middle;
	background-color: #333;
	border-radius: 1px;
	transition: .1s all;

	&::before,
	&::after {
		position: absolute;
		display: block;
		width: 18px;
		height: 2px;
		background-color: #333;
		border-radius: 1px;
		transition: .3s all;
		content: "";
	}

	&::before {
		top: -6px;
	}

	&::after {
		bottom: -6px;
	}

	[aria-expanded="true"] & {
		background: transparent;
	}

	[aria-expanded="true"] &::before {
		width: 22px;
		transform: translate(-2px,6px) rotate(45deg);
	}

	[aria-expanded="true"] &::after {
		width: 22px;
		transform: translate(-2px,-6px) rotate(-45deg);
	}
}

/* ナビゲーションバー */
@media (max-width : acms.$breakpoint-lg-max) {
	.is-locked {
		overflow: hidden;
	}

	.mobile-nav {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 1000;
		display: none;
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		padding-top: global.$header-height;
		background-color: #fff;
		opacity: 0;
		transition-timing-function: cubic-bezier(.25,.46,.45,.94);
		transition-duration: .3s;
		transition-property: all;

		&.is-active {
			display: block;
		}

		&.is-opened {
			opacity: 1;
		}
	}

	.mobile-nav-wrap {
		display: flex;
		align-items: flex-start;
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		overflow-y: scroll;
		-webkit-overflow-scrolling: touch;
	}

	.mobile-nav-inner {
		padding: 0 20px;

		& + .mobile-nav-inner {
			border-top: 1px solid #CCC;
		}
	}

	.mobile-navbar {
		width: 100%;
	}

	.mobile-navbar-list {
		display: block;
		margin: 20px 0;
		padding: 0;
		line-height: 2.4;
		list-style: none;

		@include acms.font-size(18);

		li {
			display: block;
		}

		.navbar-btn {
			margin-top: 10px;
		}

		a {
			display: block;
		}

		a:not(.btn-attention),
		a:not(.btn-attention):hover,
		a:not(.btn-attention):visited,
		a:not(.btn-attention):active,
		a:not(.btn-attention):focus {
			color: #333;
		}

		a.btn-attention {
			color: global.$btn-attention-default-color;
			font-weight: normal;
			text-align: center;
			background: transparent;
			border: 1px solid global.$btn-attention-default-color;

			@include acms.font-size(16);
		}

		// 下階層は表示しない
		.mobile-navbar-list {
			margin: -5px 0 10px 10px;
			line-height: 2;

			@include acms.font-size(14);

			a:not(.btn-attention),
			a:not(.btn-attention):hover,
			a:not(.btn-attention):visited,
			a:not(.btn-attention):active,
			a:not(.btn-attention):focus {
				color: #666;
			}
		}

	}


	.mobile-nav-side {
		margin:  20px 0;
	}

	.mobile-nav-side-list {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.mobile-nav-side-item {
		display: block;
		margin: 0 0 10px;
	}

	.mobile-nav-side-link {
		display: block;
		color: #333;

		&:hover,
		&:visited,
		&:active,
		&:focus {
			color: #333;
		}
	}

	.mobile-navbar-footer {
		margin: 15px 0 0;

		.sns-list {
			margin: 0 0 30px;
		}
	}

}
