//
//	Typo
//

@mixin orange-focus {
	&:focus-visible {
		outline: 1px solid $orange;
		outline-offset: 2px;
	}
}

html {
	@media ($min-desktop-viewport) {
		font-size: 112.5%;
	}
}
h1, .h1 {
	font-size: $fz-1;
	color : $green;
	font-weight: normal;
	line-height: 1.2;
}
h2, .h2 {
	font-size: $fz-2;
	line-height: 1.2;
	font-weight: bold;
}
h3, .h3 {
	font-size: $fz-3;
	line-height: 1.3;
	font-weight: normal;
}
h4, .h4 {
	font-size: $fz-4;
	line-height: 1.3;
	font-weight: normal;
}
a, .a {
	text-decoration: underline dotted;
	text-underline-offset: 3px;
	&:hover, &:focus {
		color: $blue-dark;
		text-decoration: underline;
	}
	@include orange-focus;
}
.description, .theme-description {
	font-size: $font-small;
	color: $font-color;
	padding-top: 0;
	*:first-child {
		margin-top: 0;
	}
	a:not(:hover) {
		color: inherit;
		text-decoration: none;
	}
}

//
// buttons
//

%button {
	text-decoration: none;
	border-radius: $button-border-radius !important;
	&::before {
		content: none;
		display: inline-block;
		width: 1em;
		height: 1em;
		color: inherit;
		font-family: "FontAwesome";
		margin-right: .33em;
	}
	@include orange-focus;
}

a.pk-inverted-button,
div.link-cell.pk-inverted-button ul > li > a {
	@extend %inverted-button;
	display: inline-block;
}

%button.icon-back,
.link-cell.icon-back ul > li > a {
	&::before {
		content: "\f060" !important;
	}
}

// hexagone
@mixin hexagon($width, $radius) {
	$sqtr3: 1.7320508075688772;
	border-radius: $radius;
	height: calc(#{$width / $sqtr3} + #{$radius / 2});
	&:before,
	&:after {
		content: '';
		display: block;
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		height: 100%;
		background-color: inherit;
		border-radius: inherit;
		transform: rotate(60deg);
		z-index: -1;
	}
	&:after {
		transform: rotate(-60deg);
	}
}


//
//	HEADER
//

#top {
	display: flex;
	align-items: center;
	min-height: $header-height;
}

h1#logo.has-logo {
	flex-grow: 1;
	line-height: 0;
	margin-right: 1rem;
	@media ($min-desktop-viewport) {
		padding-left: 0;
	}
	a {
		&:before {
			margin-right: 0;
			@media ($min-desktop-viewport) {
				width: 360px;
				height: 55px;
			}
		}
	}
}

#toplinks {
	position: static;
	text-align: center;
	font-size: $font-small;
	word-spacing: 1rem;
	a {
		vertical-align: middle;
	}
	.login-link,
	.account-link {
		display: inline-block;
		white-space: nowrap;
		@media ($max-mobile-viewport) {
			max-width: 9em;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		@extend %button;
		margin-right: 0;
		&::before {
			content: "\f2be";
		}
	}
}


//
//	NAV
//
.gru-nav-wrapper {
	@media ($max-mobile-viewport) {
		margin-top: -$header-height;
	}
}
div.gru-nav .gru-nav-button {
	height: 80px;
	border: 0 solid transparent;
	border-width: #{($header-height - $nav-menu-side) / 2} 0;
	.icon-bar {
		height: 3px;
	}
	&:not(.toggled) {
		.icon-bar-1, .icon-bar-3 {
			width: 50%;
			left: 25%;
		}
	}
	+ ul {
		margin: 0;
		a {
			font-weight: 600;
			&:hover {
				text-decoration: underline;
				text-decoration-thickness: 2px;
				text-underline-offset: 5px;
			}
		}
	}
}

// Page image
body.has-picture .site-nav::after {
	position: static;;
	margin-bottom: -3rem;
	@media ($max-mobile-viewport) {
		height: 125px;
	}
}

//
//	Main
//

main {
	padding-left: 1em;
	padding-right: 1em;
}
#columns-wrapper {
	padding: 0;
}

// Page header
.theme-page-header {
	display: flow-root;
	background-color: white;
	border-radius: $radius-l;
	padding: 1rem;
	@media (max-width: $width) {
		margin: 0 0.33rem;
	}
	@media ($min-desktop-viewport) {
		padding: 3rem;
	}
	h1:first-child {
		margin-top: 0;
	}
	.cell + .default-header {
		display: none;
	}
	.page-header--description {
		font-size: $fz-5;
	}
}

// Home page page header
body {
	overflow-x: hidden;
}
.page-template-homepage {
	&.has-picture .site-nav::after {
		content: none;
	}
	.theme-page-header {
		background-color: transparent;
		padding: 0;
		.banner.text-cell {
			border-radius: 0;
			background-image: $gradient;
			padding-top: 50px;
			padding-bottom: 50px;
			// fill viewport
			width: 100vw;
			margin-left: calc(-50vw + 50%);
			padding-left: calc(50vw - 50%);
			padding-right: calc(50vw - 50%);
			color: white !important;
			@media ($min-desktop-viewport) {
				padding-top: 100px;
				padding-bottom: 100px;
				position: relative;
				> div {
					width: 50%;
				}
				// Page image
				&::after {
					content: "";
					background: var(--page-picture) no-repeat;
					background-size: contain;
					background-position: bottom left;
					display: block;
					position: absolute;
					top: 0;
					bottom: 0;
					left: 50%;
					right: 0;
				}
			}
			* {
				color: inherit;
				margin: 0;
				font-weight: normal;
			}

			+ .tracking-code-input-cell {
				margin-top: -3rem;
				@media ($min-desktop-viewport) {
					margin-top: -4rem;
					max-width: 60%;
					position: relative;
				}
			}
		}
	}
}

//
//	Cells
//

.column div.a2-block,
.gru-content div.cell,
.block {
	margin-bottom: 1.5rem;
	& h2 + div,
	.cell--body {
		padding-top: 0;
	}
	&.has-asset-picture picture {
		padding-left: $title-padding;
		display: block;
		img {
			width: 48px;
			height: 48px;
			padding: 8px;
		}
	}
	&.foldable {
		h2:first-child {
			&:hover {
				color: $blue-dark;
			}
		}
	}
}

%cell-links-list {
	& > li {
		> a {
			@extend .a;
		}
	}
	li div.description {
		padding: 0;
		@extend .theme-description;
		padding-bottom: 0.5rem;

	}
}

.bordered-cell {
	.gru-content &.cell {
		border: $cell-entry-border;
		h2:first-child {
			@extend .h4;
			font-weight: bold;
		}
		.links-list ul li a {
			.form-number, .form-status {
				color: $font-color;
				text-decoration: none;
			}
			&:hover {
				background-color: $gray-light;
			}

		}
	}
}

// For tracking code cells
.violet-cell {
		background-color: $violet-xlight;
		background-image:
			repeating-linear-gradient(
				-45deg,
				$violet-light,
				$violet-light 4px,
				$violet 4px,
				$violet 8px
			)
		;
		background-repeat: no-repeat;
		background-size: 5px 100%;
		h2:first-child, h3 {
			color: $violet
		}
}

// Custom text-cell
.green-cell {
	.gru-content &.text-cell {
		background-color: $green-light;
		border-radius: $radius-l;
		padding: 1rem;
		padding-bottom: 2rem;
	}
}
.gray-cell {
	.gru-content &.text-cell {
		@extend .green-cell;
		background-color: $gray-xlight;
	}
}
.true-title {
	.gru-content &.text-cell {
		h2:first-child {
			font-size: $fz-2;
			font-weight: bold;
		}
	}
}


.tracking-code-input-cell {
	.gru-content &.cell {
		@extend .violet-cell;
	}
}

// Custom forms-of-category cells
.category-link {
	.gru-content &.wcs-forms-of-category-cell {
		border-top: $cell-entry-border;
		.cell--title {
			@extend %title;
			@extend .a;
			font-size: 1rem;

		}
		picture + .cell--title {
			padding-top: 0;
		}
	}
}
.forms-only-2-cols {
	.gru-content &.wcs-forms-of-category-cell {
		.links-list ul {
			@extend .fx-grid;
			> li {
				border-top: $cell-entry-border;
				border-bottom: none;
				@media ($min-grid-tablet-viewport) {
					flex-basis: calc( 50% - #{$fx-grid-gutter});
				}
			}
		}
	}
}
.category-header {
	.gru-content &.wcs-forms-of-category-cell {
		.cell--title {
			display: flex;
			picture {
				flex: 0 0 1em;
				height: 1em;

				padding-left: 0;
				margin-right: .33em;
				align-self: center;
				img {
					width: 100%;
					height: 100%;
					padding: 0;
					filter: hue-rotate(340deg) brightness(120%);
				}
			}
		}
	}
}

// menu-cell
.menu-cell {
	.gru-content & {
		.links-list ul {
			> li {
				border: none;
				> a {
					&:not(:hover) {
						color: $font-color;
						text-decoration: none;
					}
				}

				&.selected > a {
					color: white;
					background-color: $blue;
					display: flex;
					border-radius: $radius-s;
					span {
						text-decoration: underline 2px;
					}
					&::after {
						content: "\f061"; // arrow right
						font-family: fontawesome;
						flex-grow: 1;
						text-align: right;
					}
				}
			}
		}
	}
}


//
//	WCS
//

.wcs-page {
	.theme-page-header {
		display: none;

	}
	.form-content--sidebox .tracking-code-part,
	.form-content--body #tracking-code {
		@extend .violet-cell;
	}
	.form-content--body #tracking-code {
		padding: 1em;
	}
}

.form-content--title {
	@extend .h1;
	padding-left: 0;
}

div#rub_service {
	h3 {
		font-weight: bold;
	}
	.section.foldable h2:first-child {
		padding-left: 0;
		@extend .h2;
		&:hover {
			color: $blue;
			text-decoration: underline;
		}
	}
}

label {
	font-weight: 600;
}

.widget .error {
	font-weight: normal;
	color: $red-dark;
}


// steps
.wcs-step {
	margin-bottom: $wcs-steps-spacing * 2;
	&.current {
		font-weight: normal;
	}
	&.step-before {
		color: $blue;
	}
	&.step-before &--marker {
		color: white;
		background-color: $blue;
	}
}
@media ($mq-max--wcs-steps-small-layout) {
	.wcs-step.current .wcs-step--marker{
		background-color: white;
		color: $blue-dark;
		width: auto;
		&-nb {
			display: inline-block;
			background-color: $blue-dark;
			color: white;
			width: 2em;
			@include hexagon(2em, 5px);
		}
	}
}
@media ($mq-min--wcs-steps-horizontal-layout) {
	.wcs-steps {
		font-size: 1em;
	}
	.wcs-step {
		&--marker {
			@include hexagon($wcs-step-marker-size, 5px);
			.step-after & {
				filter: drop-shadow(0 0 2px #333);
			}
			&-nb {
				line-height: 0;
			}
		}
	}
	.wcs-step--label {
		font-size: 1em;
	}
}
@include desktop-vertical-steps() {
	.wcs-steps {
		margin-top: 2rem;
	}
}


//
//	FOOTER
//

#footer-wrapper {
	background-image: $gradient-reverse;
	padding-top: 2.5rem;
	padding-botom: 2.5rem;

	%cell-links-list {
		> li {
			border: none;
		}
		> li > a {
			padding-top: 0;
			padding-bottom: 0;
		}
	}
}
.back-top--link:not(:hover) {
	text-decoration: none;
}
