/*
Theme Name: Wikimedia Enterprise
Theme URI: https://enterprise.wikimedia.com
Author: Wikimedia Enterprise
Author URI: https://enterprise.wikimedia.com
Description: WordPress theme for Wikimedia Enterprise using Full Site Editor Block theme.
Requires at least: 6.0
Tested up to: 6.6.1
Requires PHP: 7.4
Version: 1.2.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wikimedia-enterprise-theme

Initial release based on Twenty Twenty-Two WordPress Theme
*/

* {
	box-sizing: border-box;
}

/*
 * Smooth scroll to anchor links.
 */
html {
	scroll-behavior: smooth;
}

/*
 * Font smoothing.
 */
body {
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
}

/*
 * Hack: This stylesheet is included with the editor and body is converted to .editor-styles-wrapper.
 * This was causing the editor background to be smoke when in the design the smoke color background is
 * only for the margins around the main page, which is white background. So, to ensure this can't occur
 * in the editor, we need higher specificty on the body
 */
html > body {
	background-color: #e9ecef;
}

/*
 * Text and navigation link styles.
 * Necessary until the following issue is resolved in Gutenberg:
 * https://github.com/WordPress/gutenberg/issues/38277
 */

a {
	text-decoration: none !important;
	transition: color .3s ease-in-out, filter .3s ease-in-out;
}

:not(:is(h1, h2, h3, h4, h5, h6)) a {
	font-weight: 700;
}

a:hover,
a:focus,
a:active {
	text-decoration: none !important;
}

a:hover:not(:has(img)),
a:focus:not(:has(img)) {
	filter: brightness(175%);
}

ul,
ol {
	padding-inline-start: 1.25em;
}

.wp-block-navigation .wp-block-navigation-item a:hover,
.wp-block-navigation .wp-block-navigation-item a:focus {
	text-decoration: underline;
	text-decoration-style: solid;
}

/* Button styles */
.wp-block-button__link,
.wp-block-search__button,
.wp-block-file .wp-block-file__button {
    transition: filter 0.3s ease, transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Custom: Force Min Width for Button in <main> */
:where(main) .wp-block-button__link {
    min-width: 240px;
}

/* Button hover styles */
/* TODO: Remove custom hover styles once the following Gutenberg issue is resolved:
   https://github.com/WordPress/gutenberg/issues/27075 */
.wp-block-button__link:hover,
.wp-block-search__button:hover,
.wp-block-file .wp-block-file__button:hover {
    filter: brightness(80%);
    transform: translateY(-4px);
}

/*
 * Design calls for wrapper to have max size. Apply default background here.
 */
.wp-site-blocks {
	max-width: var(--wp--custom--content-width--full);
	margin: 0 auto;
	background-color: var(--wp--preset--color--background);
	position: relative;
	padding-top: 79px;
}

/*
 * Header Position, Fixed & Scroll Styles
 */
.wp-site-blocks > header {
    position: fixed;
    top: 0;
    right: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - (2 * var(--wp--custom--spacing--outer)));
    width: calc(100% - (2 * var(--wp--custom--spacing--outer)));
    transition: top 0.2s ease-in;
    z-index: 5;
}

@media only screen and (min-width: 1152px) {
    .wp-site-blocks > header {
        width: calc(var(--wp--custom--content-width--full) - (2 * var(--wp--custom--spacing--outer)));
        max-width: calc(var(--wp--custom--content-width--full) - (2 * var(--wp--custom--spacing--outer)));
    }
}

.wp-site-blocks > header.hidden {
	top: -80px;
}

/*
 * Header Nav Mobile Handling
 */
@media only screen and (max-width: 840px) {

	/** Docs Sidebar Menu Control **/
	.mobile-menu-control {
		position: absolute;
		top: 50%;
		right: var(--wp--custom--spacing--outer);
		transform: translateY(-50%);
		background: transparent;
		appearance: none;
		margin: 0;
		padding: 0;
		border: 0;
		color: var(--wp--preset--color--white);
	}

	header > .wp-block-group > .wp-block-group > .wp-block-navigation {
		display: none !important;
	}

	header > .wp-block-group > .wp-block-group > .mobile-menu-control {
		display: block;
	}

	.mobile-menu {
		position: absolute;
		top: 100%;
		right: -1000px;
		z-index: 10;
		margin-top: 0 !important;
		transition: right 0.2s ease;
	}

	.mobile-menu.open {
		right: 0;
	}

	.mobile-menu > .wp-block-group {
		height: calc(100vh - 79px);
	}

	.mobile-menu > .wp-block-group > .wp-block-group {
		margin-top: auto;
	}

	.wp-site-blocks > .mobile-menu.wp-block-template-part > .wp-block-group.has-background {
		margin: 0 !important;
	}
}

@media only screen and (max-width: 840px) and (orientation: landscape) {

	.mobile-menu.open .wp-block-navigation {
		--navigation-layout-align: baseline;
		--navigation-layout-direction: row;
	}
}

@media only screen and (min-width: 841px) {

	.mobile-menu,
	.mobile-menu-control {
		display: none !important;
	}
}


.wp-site-blocks,
body > .is-root-container,
.edit-post-visual-editor__post-title-wrapper,
.wp-block-group.alignfull,
.wp-block-group.has-background,
.wp-block-cover.alignfull,
.is-root-container .wp-block[data-align="full"] > .wp-block-group,
.is-root-container .wp-block[data-align="full"] > .wp-block-cover {
	padding-left: var(--wp--custom--spacing--outer);
	padding-right: var(--wp--custom--spacing--outer);
}

.wp-site-blocks .alignfull,
.wp-site-blocks > .wp-block-group.has-background,
.wp-site-blocks > .wp-block-cover,
.wp-site-blocks > .wp-block-template-part > .wp-block-group.has-background,
.wp-site-blocks > .wp-block-template-part > .wp-block-cover,
.wp-site-blocks > main > .entry-content > .wp-block-group.has-background,
.wp-site-blocks > main > .entry-content > .wp-block-cover,
body > .is-root-container > .wp-block-cover,
body > .is-root-container > .wp-block-template-part > .wp-block-group.has-background,
body > .is-root-container > .wp-block-template-part > .wp-block-cover,
.is-root-container .wp-block[data-align="full"] {
	margin-left: calc(-1 * var(--wp--custom--spacing--outer)) !important;
	margin-right: calc(-1 * var(--wp--custom--spacing--outer)) !important;
	width: unset;
}

.wp-site-blocks > * + * > .wp-block-cover:first-child,
.wp-site-blocks > * + * > .entry-content > .wp-block-cover:first-child,
.wp-site-blocks > * + * > .wp-block-group.has-background:first-child,
.wp-site-blocks > * + * > .entry-content > .wp-block-group.has-background:first-child {
	margin-top: calc(-1 * var(--wp--style--block-gap)) !important;
}

.wp-site-blocks > * + .wp-block-cover,
.wp-site-blocks > * + .wp-block-group.has-background,
.wp-site-blocks > * + * > .wp-block-cover + .wp-block-cover,
.wp-site-blocks > * + * > .wp-block-cover + .wp-block-group.has-background,
.wp-site-blocks > * + * .entry-content > .wp-block-cover + .wp-block-cover,
.wp-site-blocks > * + * .entry-content > .wp-block-cover + .wp-block-group.has-background,
.wp-site-blocks > * + * > .wp-block-group.has-background + .wp-block-cover,
.wp-site-blocks > * + * > .wp-block-group.has-background + .wp-block-group.has-background,
.wp-site-blocks > * + * .entry-content > .wp-block-group.has-background + .wp-block-cover,
.wp-site-blocks > * + * .entry-content > .wp-block-group.has-background + .wp-block-group.has-background,
.wp-site-blocks > footer {
	margin-top: 0 !important;
}

/* Blocks inside columns don't have negative margins. */
.wp-site-blocks .wp-block-columns .wp-block-column .alignfull,
.is-root-container .wp-block-columns .wp-block-column .wp-block[data-align="full"],
/* We also want to avoid stacking negative margins. */
.wp-site-blocks .alignfull:not(.wp-block-group) .alignfull,
.is-root-container .wp-block[data-align="full"] > *:not(.wp-block-group) .wp-block[data-align="full"] {
	margin-left: auto !important;
	margin-right: auto !important;
	width: inherit;
}

.wp-site-blocks .wp-block-group:where(.has-background) {
	padding-top: var(--wp--custom--spacing--outer);
	padding-bottom: var(--wp--custom--spacing--outer);
}

/*
 * Responsive menu container padding.
 * This ensures the responsive container inherits the same
 * spacing defined above. This behavior may be built into
 * the Block Editor in the future.
 */
.wp-block-navigation__responsive-container.is-menu-open {
	padding-top: var(--wp--custom--spacing--outer);
	padding-bottom: var(--wp--custom--spacing--large);
	padding-right: var(--wp--custom--spacing--outer);
	padding-left: var(--wp--custom--spacing--outer);
}


mark.has-secondary-color {
	display: inline-block;
	background: var(--wp--preset--gradient--horizontal-secondary-to-primary);
	background-clip: text;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

@media only screen and (max-width: 600px) {

	.wp-block-buttons.is-centered-mobile {
		justify-content: center;
	}
}

/**
 * Utility Style: Visually Hidden
 */
.visually-hidden {
	clip: rect(0 0 0 0);
	-webkit-clip-path: inset(50%);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/** OpenAPI Shortcode **/

/**
 * Dark = #d9d9d9
 * Medium = #f1f3f5
 * Light = Mist
 * Borders = #cfd4d9
 */
.openapi_path {
	border-radius: 0.5rem 0.5rem 0 0;
	background-color: var(--wp--preset--color--mist);
	font-size: var(--wp--preset--font-size--tiny);
}

.openapi_path:not(:first-child) {
	margin-top: var(--wp--style--block-gap);
}

.openapi_path h3,
.openapi_path h4,
.openapi_path h5,
.openapi_path p {
	margin: 0;
}

.openapi_path_header h3,
.openapi_path_description,
.openapi_operation_header,
.openapi_operation_parameters,
.openapi_operation_description,
.openapi_operation_body,
.openapi_operation_response {
	padding: 1rem;
	word-break: break-word;
	border-top-width: 2px;
	border-top-style: solid;
	border-top-color: #cfd4d9;
}

.openapi_operation_description,
.openapi_operation_header,
.openapi_path_header + .openapi_operation > .openapi_operation_header {
	border-top: none;
}

.openapi_operation_parameters_title,
.openapi_operation_body_title,
.openapi_operation_response_title {
	font-weight: 700;
}

.openapi_operation_parameters_title,
.openapi_operation_body_title,
.openapi_operation_response_title,
.openapi_operation_header,
.openapi_path_description {
	font-size: var(--wp--preset--font-size--small);
}

.openapi_path_header h3 {
	border-radius: 0.5rem 0.5rem 0 0;
	background-color: #d9d9d9;
	color: var(--wp--preset--color--foreground);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--medium);
	border-bottom-width: 2px;
	border-bottom-style: solid;
	border-bottom-color: var(--wp--preset--color--foreground);
}

.openapi_path_description {
	font-weight: 400;
}

.openapi_operation_header {
	background-color: #f1f3f5;
}

.openapi_operation_action {
	font-weight: 700;
	display: inline-block;
	padding-right: 1rem;
}

.openapi_operation_action-get {
	color: #5d78e7;
}

.openapi_operation_action-post {
	color: #5fc59a;
}

.openapi_operation_action-put {
	color: #f69b80;
}

.openapi_operation_action-delete {
	color: #f64f1e;
}

.openapi_operation_body_content,
.openapi_operation_parameters_content,
.openapi_operation_response_content {
	margin: 1rem 0;
	padding: 0;
	position: relative;
}

.openapi_operation_body_content,
.openapi_operation_response_content {
	min-height: 180px;
}

@media only screen and (min-width: 600px ) {

	.openapi_operation_body_content,
	.openapi_operation_response_content {
		padding-right: 50%;
	}
}

.openapi_operation_response_content {
	list-style-type: none;
}

.openapi_operation_response_type {
	padding-bottom: 1rem;
}

.openapi_operation_response_type input {
	display: none;
}

.openapi_operation_response_type label {
	cursor: pointer;
	color: var(--wp--preset--color--light-slate);
	transition: color ease-in-out .5ms;
}

@media only screen and (max-width: 601px ) {

	.openapi_operation_response_type label {
		display: inline-block;
		margin-bottom: .5rem;
	}
}

.openapi_operation_response_type label:hover,
.openapi_operation_response_type label:active {
	color: var(--wp--preset--color--foreground);
}

.openapi_operation_response_type input:checked ~ label {
	color: var(--wp--preset--color--foreground);
}

.openapi_operation_response_type .openapi-code-example {
	display: none;
}

.openapi_operation_response_type input:checked ~ .openapi-code-example {
	display: block;
}

.openapi-code-example {
	max-height: 180px;
}

@media only screen and (min-width: 600px ) {

	.openapi-code-example {
		position: absolute;
		right: 0;
		top: 0;
		width: 50%;
	}
}

.openapi-parameter-list-each {
	padding-left: var(--wp--style--block-gap);
	margin-bottom: .5rem;
	display: flex;
	flex-flow: row wrap;
	align-items: center;
	justify-content: flex-start;
	gap: .25rem .5rem;
}

.openapi-parameter-list-each dd,
.openapi-parameter-list-each dt {
	margin: 0;
	padding: 0;
}

.openapi-parameter-list-each dt {
	margin-left: calc(-1 * var(--wp--style--block-gap));
}

.openapi-parameter-list-each .type {
	font-style: italic;
}

.openapi-parameter-list-each .description {
	font-size: var(--wp--preset--font-size--tiny);
}

.openapi-indicator-required,
.openapi-indicator-optional {
	font-weight: 700;
	color: var(--wp--preset--color--secondary);
}


/** !blog && content specific **/

/** Custom Style: Cover Block has Dim on Mobile **/
@media only screen and (max-width: 780px) {

	.wp-block-cover.is-style-dim-on-mobile .wp-block-cover__background {
		opacity: .75 !important;
	}

	.wp-block-cover.is-style-dim-on-mobile .wp-block-cover__background:not([class*="-background-color"]) {
		background-color: #000;
	}
}

/* squeeze in the single post title  */
@media only screen and (min-width: 880px) {
	.single-post .wp-block-cover__inner-container {
		max-width: 80%;
	}
}


/* inline code like `markdown` but don't touch pre>code blocks */
.openapi_path :where(:not(pre)) > code,
:where(:not(pre.wp-block-code)) > code {
	display: inline-block;
	white-space: break-spaces;
	margin: 0;
	font-size: 90%;
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	padding: .2rem .3rem;
	background: var(--wp--preset--color--blizzard);
	border-radius: 6px;
}

@media only screen and (max-width: 600px) {

	/* some response fields are long causing side-scroll on phones */
	.openapi_path :where(:not(pre)) > code,
	:where(:not(pre.wp-block-code)) > code {
		word-break: break-all;
	}

	/* ignore data dictionary as divs scroll to avoid side-scroll */
	.data-dictionary :where(:not(pre.wp-block-code)) > code {
		word-break: normal;
	}
}

/* blockquotes */
blockquote.wp-block-quote {
	border-image: linear-gradient(180deg, var(--wp--preset--color--secondary) 1.65%, var(--wp--preset--color--primary)) 1 100%;
	border-width: 4px;
}

blockquote.wp-block-quote cite::before {
	content: "\2014 \2009";
}

/* news (index) template and !blog */
.blog .news-latest-post .wp-block-post-title a,
.blog .wp-block-post-title a {
	display: inline-block;
	background: var(--wp--preset--gradient--horizontal-secondary-to-primary);
	background-clip: text;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

.blog .wp-block-post-title a:hover,
.blog .wp-block-post-title a:focus {
	filter: none;
}

.blog .wp-block-post {
	transition: .2s ease;
}

.blog .wp-block-post .wp-block-post-featured-image {
	border-radius: 6px;
	overflow: hidden; /* for img transition */
}

/*
 * Make sure primary input mechanism can hover over elements.
 * Fixes oddity in firefox mobile.
 */
@media (hover: hover) {

	.blog .wp-block-post:hover {
		opacity: .7;
		cursor: pointer;
	}

	.blog .wp-block-post .wp-block-post-featured-image img {
		transition: .2s ease;
	}

	.blog .news-latest-post .wp-block-post:hover .wp-block-post-featured-image img {
		transform: scale(1.02, 1.02);
	}

	.blog .wp-block-post:hover .wp-block-post-featured-image img {
		transform: scale(1.05, 1.05);
	}
}
