/*
Theme Name: Moiraine
Theme URI: https://imagewize.com/resources/moiraine-theme/
Author: Jasper Frumau
Author URI: https://github.com/jasperf
Description: Launch a blazing-fast, pixel-perfect website with the Moiraine WordPress block theme! Moiraine features over 50 beautiful pattern designs, 7 full-page pattern layouts, and a fully-customizable design system with Global Styles. Moiraine integrates seamlessly with all of the powerful new WordPress editor features, giving you the most lightweight and powerful website builder on the planet — no expensive page builder plugin required! ✶ Full demo: https://demo.imagewize.com ✶
Tags: blog, portfolio, entertainment, grid-layout, one-column, two-columns, three-columns, four-columns, block-patterns, block-styles, custom-logo, custom-menu, editor-style, featured-images, full-site-editing, full-width-template, rtl-language-support, style-variations, template-editing, theme-options, translation-ready, wide-blocks
Tested up to: 6.9
Requires PHP: 7.3
Version: 2.8.0
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: moiraine

Moiraine WordPress Theme, (C) 2025 Jasper Frumau based on Ollie by Mike McAlister.
Moiraine is distributed under the terms of the GNU GPL.
*/

/* Table of Contents
---------------------------------------------------------------------------- */
/*
1. Classic Editor Compatibility (imported from classic-styles.css)
2. CSS Reset
3. Standardize Form Styling
4. Helper Styles
5. Block-Specific Adjustments
6. Mobile Responsive
7. Accessibility Fixes
*/

/* 1. Classic Editor Compatibility
---------------------------------------------------------------------------- */
@import url('classic-styles.css');

/* 2. CSS Reset
---------------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: inherit;
}

html {
	box-sizing: border-box;
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
}

b,
strong {
	font-weight: var(--wp--custom--font-weight--semi-bold);
}

ol,
ul {
	padding: 0;
}

ol:where(:not([class*="wp-block"])),
ol:where(.wp-block-list),
ul:where(:not([class*="wp-block"])),
ul:where(.wp-block-list) {
	padding-inline-start: var(--wp--preset--spacing--medium);
}

div[class*="wp-block-"] figcaption {
	color: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--x-small);
	margin-bottom: 0;
	margin-top: 20px;
	text-align: center;
}

img,
figure {
	max-width: 100%;
	height: auto;
}

/* 3. Standardize Form Styling
---------------------------------------------------------------------------- */

input,
button,
textarea,
select {
	font: inherit;
}

input[type="button"],
input[type="email"],
input[type="search"],
input[type="submit"],
input[type="text"],
textarea {
	-webkit-appearance: none;
	appearance: none;
}

input:not([type="submit"]),
select,
textarea,
.wp-block-post-comments-form input:not([type="submit"]):not([type="checkbox"]),
.wp-block-post-comments-form textarea {
	color: var(--wp--preset--color--main);
	border-radius: 5px;
	border: solid 1px var(--wp--preset--color--main-accent);
	padding: .5em 1em;
	font-size: var(--wp--preset--font-size--small);
}

input:focus-visible,
textarea:focus-visible {
	outline-color: var(--wp--preset--color--primary);
}

input[type="checkbox"],
input[type="image"],
input[type="radio"] {
	width: auto;
}

label {
	width: 100%;
	display: block;
}

::placeholder {
	color: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.75;
}

/* 4. Helper Styles
---------------------------------------------------------------------------- */

a.more-link {
	display: block;
}

/* 5. Block-Specific Adjustments
---------------------------------------------------------------------------- */

/* Adjust terms at bottom of posts */
.single .wp-block-group .wp-block-post-terms,
.blog .wp-block-group .wp-block-post-terms {
	margin-bottom: -8px !important;
}

/* Remove margin on term description on archive pages */
.wp-block-term-description p:last-child {
	margin-bottom: 0;
}

/* Remove last separator on post list */
.remove-border-and-padding .wp-block-post-template li:last-child .wp-block-separator {
	display: none;
}

/* Hide post meta div if no tags assigned */
.single .wp-block-group:has(> .post-meta:empty) {
	display: none;
}

.wp-block-group:empty:has(+ .comment-respond) {
	display: none;
}

.row-logos > figure {
	flex-shrink: 1 !important;
}

/* 6. Mobile Responsive
---------------------------------------------------------------------------- */

@media (max-width: 781px) {
	.moiraine-hide-on-mobile {
		display: none;
	}

	.moiraine-unstick-mobile {
		position: static;
	}

	/* Hide desktop menu panel on mobile */
	.moiraine-menu-desktop-only,
	.moiraine-menu-desktop-only .moiraine-mega-menu,
	.moiraine-menu-desktop-only .wp-block-moiraine-mega-menu__menu-container {
		display: none !important;
	}

	/* Mobile menu positioning - work with existing layout */
	.moiraine-mega-menu.menu-justified-center,
	.wp-block-moiraine-mega-menu__menu-container.menu-justified-center {
		left: -1rem;
		right: 1rem;
		transform: none;
		width: auto;
		max-width: none;
		min-width: auto;
	}
}

@media (min-width: 782px) {
	/* Hide mobile menu panel on desktop */
	.moiraine-menu-mobile-only,
	.moiraine-menu-mobile-only .moiraine-mega-menu,
	.moiraine-menu-mobile-only .wp-block-moiraine-mega-menu__menu-container {
		display: none !important;
	}
}

/* 7. Accessibility Fixes
---------------------------------------------------------------------------- */

/* Fix navigation list structure - ensure only li elements are direct children */
.wp-block-navigation__container > :not(li):not(script):not(template) {
	display: contents;
}

/* Skip link - improved focus state visibility
   Uses !important to override WordPress core inline CSS for accessibility compliance */
.skip-link.screen-reader-text:focus,
a.skip-link.screen-reader-text:focus {
	background-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
	outline: 3px solid var(--wp--preset--color--main) !important;
	outline-offset: 3px !important;
	padding: 1em 1.5em !important;
	text-decoration: none !important;
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary) !important;
	z-index: 100000 !important;
	clip-path: none !important;
	height: auto !important;
	width: auto !important;
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	display: block !important;
}

/* Ensure skip link is visually hidden but accessible
   Modern technique using clip instead of left: -9999px for better tab order */
.skip-link:not(:focus),
a.skip-link:not(:focus) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border-width: 0 !important;
}

/* Skip link tab order priority - position at top of page when focused */
.skip-link,
a.skip-link {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	z-index: 100000 !important;
}
