/**
 * OnePress Legacy Styles
 *
 * Restores OnePress 2.3.16 front-end rendering on top of 2.3.21+.
 *
 * Every rule is gated behind a body class so each module can be switched on
 * and off independently from Appearance -> OnePress Legacy Styles. The
 * `body.opls-*` prefix also guarantees these rules out-specify the theme's
 * own (unprefixed) selectors without needing `!important`.
 *
 * Only rules that actually CHANGED between 2.3.16 and 2.3.21 are restored.
 * Anything the two versions share (headings, links, base typography, section
 * layout) is deliberately left alone so the theme keeps ownership of it.
 */

/* =============================================================================
   B. Content width & alignment            body class: opls-content-width
   -----------------------------------------------------------------------------
   2.3.21 added a site-wide cap on `.entry-content` children plus full-bleed
   `alignwide` / `alignfull` handling and negative viewport margins on
   `alignleft` / `alignright`. 2.3.16 had none of that: only single posts with
   the no-sidebar layout got auto margins, and floats used a plain 3.5em gutter.
   ============================================================================ */

/* Undo the global max-width + centering. (0,6,0 beats the theme's 0,5,0.) */
body.opls-content-width .entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright) {
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

/* Re-apply the one case 2.3.16 really did centre. (0,8,0.) */
body.opls-content-width.single-post .no-sidebar .site-main,
body.opls-content-width.single-post .no-sidebar .entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright) {
	margin-left: auto;
	margin-right: auto;
}

/* Wide / full stop bleeding out of the container. */
body.opls-content-width .entry-content > .alignwide,
body.opls-content-width .entry-content > .wp-block.alignwide,
body.opls-content-width .entry-content > .alignfull,
body.opls-content-width .entry-content > .wp-block.alignfull {
	width: auto;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

/* Floats go back to the plain `.alignleft` / `.alignright` gutter. */
body.opls-content-width .entry-content > .alignleft,
body.opls-content-width .entry-content > .wp-block.alignleft {
	margin-left: 0;
}

body.opls-content-width .entry-content > .alignright,
body.opls-content-width .entry-content > .wp-block.alignright {
	margin-right: 0;
}

/* Images / covers inside a full-width child keep their natural size. */
body.opls-content-width .entry-content > .wp-block-image.alignfull img,
body.opls-content-width .entry-content > .alignfull img,
body.opls-content-width .entry-content > .wp-block-cover.alignfull,
body.opls-content-width .entry-content > .wp-block-cover.alignfull .wp-block-cover__inner-container {
	width: auto;
	max-width: 100%;
}

/* =============================================================================
   C. [gallery] shortcode                          body class: opls-gallery
   -----------------------------------------------------------------------------
   2.3.21 rewrote `.gallery` as a CSS grid with a 1rem gap and forced every
   thumbnail to `width: 100%`, which visibly upscales small images. 2.3.16 used
   inline-block items with percentage max-widths and natural-size images.
   ============================================================================ */

body.opls-gallery .gallery {
	display: block;
	grid-template-columns: none;
	gap: normal;
	margin-bottom: 1.5em;
}

body.opls-gallery .gallery-item {
	display: inline-block;
	text-align: center;
	vertical-align: top;
	width: 100%;
	margin: 0 0 1.5em;
}

body.opls-gallery .gallery-columns-2 .gallery-item { max-width: 50%; }
body.opls-gallery .gallery-columns-3 .gallery-item { max-width: 33.33%; }
body.opls-gallery .gallery-columns-4 .gallery-item { max-width: 25%; }
body.opls-gallery .gallery-columns-5 .gallery-item { max-width: 20%; }
body.opls-gallery .gallery-columns-6 .gallery-item { max-width: 16.66%; }
body.opls-gallery .gallery-columns-7 .gallery-item { max-width: 14.28%; }
body.opls-gallery .gallery-columns-8 .gallery-item { max-width: 12.5%; }
body.opls-gallery .gallery-columns-9 .gallery-item { max-width: 11.11%; }

/* Thumbnails render at their natural size again instead of filling the cell. */
body.opls-gallery .gallery-item .gallery-icon img {
	display: inline-block;
	width: auto;
	max-width: 100%;
	height: auto;
}

body.opls-gallery .gallery-caption {
	display: block;
	margin-top: 0;
	font-size: inherit;
	line-height: inherit;
}

/* =============================================================================
   D. Block content styling                         body class: opls-blocks
   -----------------------------------------------------------------------------
   2.3.21 added a large set of `.wp-block-*` front-end rules that did not exist
   in 2.3.16. CSS cannot un-declare a rule, so these resets put the layout and
   typography properties back to WordPress core's values. See readme.txt for the
   one thing this cannot fully undo (block button colours).
   ============================================================================ */

body.opls-blocks .wp-block-image {
	margin: 0 0 1em;
}

body.opls-blocks .wp-block-image figcaption {
	font-style: normal;
	font-size: 13px;
	line-height: normal;
	margin: 0.5em 0 1em;
	color: inherit;
}

body.opls-blocks .wp-block-image.alignleft {
	margin: 0 3.5em 0 0;
}

body.opls-blocks .wp-block-image.alignright {
	margin: 0 0 0 3.5em;
}

body.opls-blocks .wp-block-gallery {
	margin: 0 0 1em;
}

body.opls-blocks .wp-block-gallery .wp-block-image figcaption {
	font-size: 13px;
}

body.opls-blocks .wp-block-button {
	margin-bottom: 0;
}

body.opls-blocks .wp-block-button .wp-block-button__link {
	padding: calc(0.667em + 2px) calc(1.333em + 2px);
	border-radius: 9999px;
}

body.opls-blocks .wp-block-button.is-style-outline .wp-block-button__link {
	border-width: 1px; border-color: inherit
}

body.opls-blocks .wp-block-pullquote {
	border-top: none;
	border-bottom: none;
	margin: 0 0 1em;
	padding: 0;
	text-align: inherit;
	font-style: normal;
}

body.opls-blocks .wp-block-pullquote cite {
	font-size: inherit;
	text-transform: none;
	letter-spacing: inherit;
	margin-top: 0;
}

body.opls-blocks .wp-block-pullquote.is-style-solid-color {
	padding: 3em 1.5em;
}

body.opls-blocks .wp-block-cover {
	margin: 0 0 1em;
	min-height: 430px; /* WordPress core default. */
}

body.opls-blocks .wp-block-cover .wp-block-cover__inner-container,
body.opls-blocks .wp-block-cover .wp-block-cover-text {
	padding: 0;
}

body.opls-blocks .wp-block-cover .wp-block-cover-text {
	font-size: inherit;
}

body.opls-blocks .wp-block-columns {
	margin: 0 0 1em;
	gap: 2em; /* WordPress core default block gap. */
}

@media (max-width: 991px) {
	body.opls-blocks .wp-block-columns:not(.is-not-stacked-on-mobile) {
		flex-wrap: wrap;
	}
}

body.opls-blocks .wp-block-column {
	margin-bottom: 0;
}

body.opls-blocks .wp-block-group {
	margin: 0 0 1em;
}

body.opls-blocks .wp-block-group.has-background {
	padding: 1.25em 2.375em; /* WordPress core default. */
}

body.opls-blocks .wp-block-table {
	margin: 0 0 1em;
}

body.opls-blocks .wp-block-table td,
body.opls-blocks .wp-block-table th {
	padding: 0.5em;
	border: 1px solid;
}

body.opls-blocks .wp-block-table th {
	background: none;
	font-weight: inherit;
}

body.opls-blocks .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: none;
}

body.opls-blocks .wp-block-separator {
	margin: 1.65em auto;
	border: none;
	border-bottom: 2px solid;
}

/* Matches core's own guard so `.is-style-wide` and `.is-style-dots` keep
   their full width instead of being capped by the rule above. */
body.opls-blocks .wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
	max-width: 100px;
}

body.opls-blocks .wp-block-separator.is-style-dots::before {
	font-size: 1.5em;
	letter-spacing: 2em;
	padding-left: 2em;
}

body.opls-blocks .wp-block-embed {
	margin: 0 0 1em;
}

body.opls-blocks .wp-block-code,
body.opls-blocks .wp-block-preformatted {
	font-size: inherit;
	background: none;
	padding: 0.8em 1em;
	border-radius: 4px;
	line-height: inherit;
	margin: 0 0 1em;
}

/* 2.3.21's `.wp-block-list li { margin-left: 1em }` only bites outside
   `.entry-content`, where the shared `.entry-content li` rule (identical in
   both versions) already wins on source order. Reset it there, and keep the
   2.5em / nested-0 pairing inside post content. */
body.opls-blocks .wp-block-list li {
	margin-left: 0;
}

body.opls-blocks .entry-content .wp-block-list li {
	margin-left: 2.5em;
}

body.opls-blocks .entry-content .wp-block-list li li {
	margin-left: 0;
}

/* =============================================================================
   E. Section & element details                    body class: opls-details
   ============================================================================ */

/* 2.3.21's autoprefixer pass dropped the Firefox selection colour. */
body.opls-details::-moz-selection {
	background: #000000;
	color: #ffffff;
}

body.opls-details ::-moz-selection {
	background: #000000;
	color: #ffffff;
}

/* Footer social icons: 2.3.16 spaced them with margins on inline anchors,
   2.3.21 switched to a flex row of fixed 30x30 boxes. */
body.opls-details .site-footer .footer-social-icons {
	display: block;
	gap: normal;
}

body.opls-details .site-footer .footer-social a {
	font-size: 30px;
	margin: 0 13px;
	width: auto;
	height: auto;
	display: inline;
	line-height: inherit;
}

/* Feature icons: 2.3.21 moved `scale(1.1)` onto the always-on `.transiton`
   class, so icons render permanently enlarged and the hover effect is gone. */
body.opls-details .feature-item .transiton {
	transform: none;
	transition: all 0.5s ease-in-out;
}

body.opls-details .feature-item:hover .transiton,
body.opls-details .feature-item:hover .icon-background-default {
	transform: scale(1.1);
	transition: all 0.5s ease-in-out;
}
