/*
 * DirectMM navigation. Below 768px the theme's list is replaced by the drawer dmm-menu.js
 * builds and is kept display:none, which is what stops its lazy thumbnails from loading.
 * From 768px: the home symbol, the category panel, the flex division of the bar, the
 * desktop-only / mobile-only classes and the header's logo spacing.
 */

/* ============================================================
 * Below 768px - the drawer
 * ============================================================ */
@media only screen and (max-width: 767px) {

	/*
	 * html.js is set in the head, before the menu is parsed, so the list is hidden from the
	 * first layout; without JavaScript the theme's no-js list stays. If dmm-menu.js does not
	 * load, the theme's own mobile menu marks the list with these classes and runs it as today;
	 * it waits for the closing transition to end, which display:none would prevent.
	 */
	html.js #main-menu > ul.radium_mega,
	#main-menu > ul.radium_mega > li.dmm-desktop-only,
	#main-menu .dmm-home-icon {
		display: none;
	}

	html.js #main-menu > ul.radium_mega.dl-menuopen,
	html.js #main-menu > ul.radium_mega.dl-menu-toggle {
		display: block;
	}

	/* On body: an ancestor with perspective would break position:fixed. Above the cookie bar. */
	.dmm-menu {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 100001;
		font-family: Roboto, Lato, Arial, sans-serif;
	}

	.dmm-menu[hidden] {
		display: none;
	}

	.dmm-menu__dim {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.55);
		opacity: 0;
		transition: opacity 0.2s;
	}

	.dmm-menu.is-open .dmm-menu__dim {
		opacity: 1;
	}

	/* The 44px left free are the tap-outside strip. */
	.dmm-menu__drawer {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		width: calc(100% - 44px);
		display: flex;
		flex-direction: column;
		background: #22272a;
		color: #fff;
		box-shadow: 4px 0 16px rgba(0, 0, 0, 0.4);
		transform: translateX(-105%);
		transition: transform 0.2s ease-out;
	}

	/* Vertical scroll and pinch zoom stay native. Also on the scrolling level: touch-action is read only up to the nearest scroller. */
	.dmm-menu__dim,
	.dmm-menu__drawer,
	.dmm-menu__level {
		touch-action: pan-y pinch-zoom;
	}

	.dmm-menu.is-open .dmm-menu__drawer {
		transform: none;
	}

	.dmm-menu.is-dragging .dmm-menu__drawer {
		transition: none;
	}

	.dmm-menu__head {
		flex: none;
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 56px;
		padding: 0 6px 0 16px;
		box-sizing: border-box;
		background: #1b1f22;
		border-top: 3px solid #ff5a00;
		border-bottom: 1px solid #363a3d;
		font-size: 15px;
		font-weight: 600;
		letter-spacing: 0.08em;
		text-transform: uppercase;
	}

	/* margin: 0 on the buttons - the theme gives every button a bottom margin. */
	.dmm-menu__close {
		width: 44px;
		height: 44px;
		margin: 0;
		padding: 0;
		border: 0;
		background: transparent;
		color: #fff;
		font-size: 22px;
		line-height: 1;
		cursor: pointer;
	}

	.dmm-menu__levels {
		position: relative;
		flex: 1;
		overflow: hidden;
	}

	/* The inactive level is hidden once its slide ends, visible again from the moment the slide back starts. */
	.dmm-menu__level {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		background: #22272a;
		transition: transform 0.15s ease-out, visibility 0s;
	}

	.dmm-menu__level--2,
	.dmm-menu__levels.is-level2 .dmm-menu__level--1 {
		visibility: hidden;
		transition-delay: 0s, 0.15s;
	}

	.dmm-menu__level--2 {
		transform: translateX(100%);
	}

	.dmm-menu__levels.is-level2 .dmm-menu__level--1 {
		transform: translateX(-30%);
	}

	.dmm-menu__levels.is-level2 .dmm-menu__level--2 {
		transform: none;
		visibility: visible;
		transition-delay: 0s;
	}

	/* Level 1 */
	.dmm-menu__list {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.dmm-menu__row {
		display: flex;
		align-items: stretch;
		margin: 0;
		padding: 0;
		border-bottom: 1px solid #363a3d;
	}

	.dmm-menu__link {
		flex: 1;
		min-width: 0;
		padding: 0 16px;
		font-size: 16px;
		line-height: 48px;
		text-transform: uppercase;
		color: #fff;
		text-decoration: none;
	}

	.dmm-menu__more {
		flex: none;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		margin: 0;
		padding: 0;
		border: 0;
		border-left: 1px solid #363a3d;
		background: transparent;
		color: #ff5a00;
		cursor: pointer;
	}

	/* Level 2. min-height: an enlarged title wraps and grows the bar instead of being cut. */
	.dmm-menu__bar {
		display: flex;
		align-items: center;
		min-height: 56px;
		padding-right: 12px;
		background: rgba(255, 255, 255, 0.06);
		border-bottom: 1px solid #363a3d;
	}

	.dmm-menu__back {
		flex: none;
		align-self: stretch;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		margin: 0 10px 0 0;
		padding: 0;
		border: 0;
		border-right: 1px solid #363a3d;
		background: transparent;
		color: #fff;
		cursor: pointer;
	}

	/* Optical centring of the chevron. */
	.dmm-menu__back svg {
		margin-left: 1px;
	}

	.dmm-menu__title {
		flex: 1;
		min-width: 0;
		font-size: 19px;
		font-weight: 700;
		line-height: 1.2;
		text-transform: uppercase;
		overflow-wrap: break-word;
	}

	.dmm-menu__all {
		flex: none;
		display: inline-flex;
		align-items: center;
		padding: 0 12px 0 14px;
		border: 1.5px solid #ffb27a;
		border-radius: 18px;
		font-size: 14px;
		font-weight: 600;
		line-height: 32px;
		color: #ffb27a;
		text-decoration: none;
	}

	.dmm-menu__all svg {
		margin-left: 5px;
	}

	.dmm-menu__sec {
		padding: 14px 16px 6px;
		font-size: 13px;
		font-weight: 600;
		line-height: 1.2;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: #9aa0a6;
	}

	.dmm-menu__chips {
		display: flex;
		flex-wrap: wrap;
		padding: 2px 12px 8px;
	}

	/* 36px visible, 44px touch target. */
	.dmm-menu__chip {
		position: relative;
		margin: 4px;
		padding: 0 14px;
		border: 1px solid #4a5055;
		border-radius: 17px;
		font-size: 14px;
		line-height: 34px;
		color: #fff;
		text-decoration: none;
	}

	.dmm-menu__chip:before {
		content: "";
		position: absolute;
		top: -4px;
		right: -4px;
		bottom: -4px;
		left: -4px;
	}

	.dmm-menu__post {
		display: flex;
		align-items: flex-start;
		padding: 12px 16px;
		border-bottom: 1px solid #363a3d;
		font-size: 16px;
		line-height: 21px;
		color: #fff;
		text-decoration: none;
	}

	/* 16:9, the crop's own ratio: shown whole. */
	.dmm-menu__post img {
		flex: none;
		display: block;
		width: 112px;
		height: 63px;
		margin-right: 12px;
		object-fit: cover;
	}

	.dmm-menu__post span {
		min-width: 0;
		overflow-wrap: break-word;
	}

	.dmm-menu a:hover,
	.dmm-menu a:focus {
		color: #fff;
	}

	.dmm-menu__all:hover,
	.dmm-menu__all:focus {
		color: #ffb27a;
	}

	/* Flat in every state; the theme paints buttons on hover and focus. */
	.dmm-menu__close:hover,
	.dmm-menu__close:focus,
	.dmm-menu__close:active,
	.dmm-menu__more:hover,
	.dmm-menu__more:focus,
	.dmm-menu__more:active,
	.dmm-menu__back:hover,
	.dmm-menu__back:focus,
	.dmm-menu__back:active {
		background: transparent;
		box-shadow: none;
		outline: none;
	}

	.dmm-menu__close:hover,
	.dmm-menu__close:focus,
	.dmm-menu__back:hover,
	.dmm-menu__back:focus {
		color: #fff;
	}

	.dmm-menu__more:hover,
	.dmm-menu__more:focus {
		color: #ff5a00;
	}

	.dmm-menu button:focus-visible,
	.dmm-menu a:focus-visible {
		outline: 2px solid #ffb27a;
		outline-offset: -2px;
	}

	/* Set by the script while the drawer is open. */
	html.dmm-menu-lock {
		overflow: hidden;
	}

	@media (prefers-reduced-motion: reduce) {
		.dmm-menu__dim,
		.dmm-menu__drawer,
		.dmm-menu__level {
			transition: none;
		}
	}
}

/* ============================================================
 * From 768px - the theme's bar
 * ============================================================ */
@media only screen and (min-width: 768px) {

	/* Flex division whatever the count; #main-menu outranks the calc(100% / 10) rule from Theme Options. */
	#main-menu > ul.radium_mega {
		display: flex;
	}

	#main-menu > ul.radium_mega > li {
		flex: 1 1 0;
		float: none;
		width: auto;
	}

	/* !important: the theme's script writes display inline on items with a panel while measuring. */
	#main-menu > ul.radium_mega > li.dmm-mobile-only {
		display: none !important;
	}

	/* Home: the symbol shows, the text stays for screen readers. */
	#main-menu > ul.radium_mega > li.dmm-home {
		flex: 0 0 52px;
	}

	#main-menu > ul.radium_mega > li.dmm-home > a {
		padding-left: 0;
		padding-right: 0;
	}

	/* The theme's current-item colour, which it applies to the text span the symbol stands in for. */
	#main-menu > ul.radium_mega > li.dmm-home.current-menu-item > a {
		color: #ff5a00;
	}

	#main-menu .dmm-home .menu-title-outer {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	/* The wrapper keeps the text line's height, so the link stays as tall as its neighbours; the symbol is centred on that line. */
	#main-menu .dmm-home-icon {
		display: block;
		position: relative;
		height: 16px;
	}

	#main-menu .dmm-home-icon svg {
		display: block;
		position: absolute;
		top: 50%;
		left: 50%;
		width: 18px;
		height: 18px;
		margin: -9px 0 0 -9px;
	}

	/*
	 * Dropdown thumbnails load only once the item is approached: a closed panel is transparent
	 * and scaled to nothing, which a lazy image still counts as visible. The width and height
	 * attributes reserve the space. Without dmm-menu.js the theme's open class shows them.
	 */
	#main-menu .sub-mega-wrap:not(.dmm-seen):not(.open) img {
		display: none;
	}

	/* The item is a button, not a link; the panel spans the bar, so the item must not be its positioning box. */
	#main-menu > ul.radium_mega > li.dmm-categorii {
		position: static;
	}

	#main-menu > ul.radium_mega > li.dmm-categorii > a {
		cursor: default;
	}

	#main-menu > ul.radium_mega > li.dmm-categorii > a:focus-visible {
		outline: 2px solid #ff5a00;
		outline-offset: -2px;
	}

	/*
	 * The logo: inline on a text baseline with a vertical-align keyword Firefox does not know, so
	 * its spacing differed by browser and page. Block, plus the same space written explicitly:
	 * the line's ascent minus half the logo's height (521x85, as wide as its column).
	 */
	#header .site-title-wrapper a,
	#header .site-title-wrapper img.logo {
		display: block;
	}

	#header .site-title-wrapper img.logo {
		margin-top: calc(35px - 8.1574%);
	}

	/* The theme's panel classes give it the opening animation and the orange lines. */
	#main-menu .dmm-catpanel {
		left: 0;
		top: 100%;
		width: 100%;
		z-index: 5;
		padding: 24px 28px 8px;
		box-sizing: border-box;
		background: #fff;
		border-radius: 0;
		box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
	}

	#main-menu .dmm-cols {
		columns: 4;
		column-gap: 36px;
	}

	#main-menu .dmm-g {
		break-inside: avoid;
		page-break-inside: avoid;
		margin: 0 0 22px;
	}

	#main-menu .dmm-p {
		display: block;
		margin: 0 0 6px;
		padding: 0 0 6px;
		border-bottom: 1px solid #d9d9d9;
		font: 400 18px/1.2 Oswald, Lato, Arial, sans-serif;
		letter-spacing: 0.02em;
		text-align: left;
		text-transform: uppercase;
		color: #111;
	}

	#main-menu .dmm-k {
		display: block;
		padding: 0 0 0 12px;
		font: 400 15px/27px Roboto, Lato, Arial, sans-serif;
		text-align: left;
		text-transform: none;
		color: #4a4a4a;
	}

	#main-menu .dmm-p:hover,
	#main-menu .dmm-k:hover {
		color: #ff5a00;
	}
}
