/**
 * PIXIMIXI — site chrome.
 *
 * Header, primary navigation, the mobile drawer, and the footer.
 *
 * Everything positional is written with logical properties (`inset-inline`,
 * `margin-inline`, `padding-inline`) rather than left/right, so the same rules
 * serve English and Persian without an RTL override. `rtl.css` therefore only
 * has to correct the handful of things that genuinely differ.
 *
 * @package PIXIMIXI
 */

/* ==========================================================================
   Skip link
   ========================================================================== */

.pm-skip-link {
	position: absolute;
	inset-block-start: -100%;
}

/* ==========================================================================
   Header
   ========================================================================== */

.pm-header {
	position: sticky;
	inset-block-start: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.82);
	backdrop-filter: blur(18px) saturate(160%);
	-webkit-backdrop-filter: blur(18px) saturate(160%);
	border-block-end: 1px solid var(--border-color);
}

/* WordPress's own admin bar is fixed at the top, so the sticky header has to
   start below it or it hides the site title on the front end. */
body.admin-bar .pm-header {
	inset-block-start: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .pm-header {
		inset-block-start: 46px;
	}
}

.pm-header__inner {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-block-size: var(--header-height);
}

/* ==========================================================================
   Logo and wordmark

   The wordmark spells out the arithmetic: PIXI in red, MIXI in yellow, set
   solid so the join reads as one word. Both halves stay Latin in Persian —
   the brand name is a name, not a phrase to be translated.
   ========================================================================== */

.pm-brand {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	margin-inline-end: auto;
	text-decoration: none;
	color: inherit;
}

.pm-brand:hover,
.pm-brand:focus {
	text-decoration: none;
}

.pm-brand__mark {
	flex: none;
	inline-size: 2.5rem;
	block-size: 2.5rem;
}

.pm-brand__text {
	display: flex;
	flex-direction: column;
	line-height: 1;
}

.pm-brand__name {
	font-family: var(--font-latin);
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	/* The wordmark is always Latin and always left-to-right, in both locales. */
	direction: ltr;
	unicode-bidi: isolate;
}

.pm-brand__name .pm-pixi {
	color: var(--red-ink);
}

.pm-brand__name .pm-mixi {
	color: var(--sun-ink);
}

.pm-brand__tagline {
	margin-block-start: 0.3rem;
	color: var(--ink-muted);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0;
}

/* A custom logo uploaded in the customizer replaces the mark and wordmark. */
.pm-brand .custom-logo {
	max-block-size: 2.75rem;
	inline-size: auto;
}

@media (max-width: 30rem) {
	.pm-brand__tagline {
		display: none;
	}
}

/* ==========================================================================
   Primary navigation
   ========================================================================== */

.pm-nav {
	display: none;
}

@media (min-width: 62rem) {
	.pm-nav {
		display: block;
	}
}

.pm-nav ul {
	display: flex;
	align-items: center;
	gap: 0.15rem;
	padding: 0;
	margin: 0;
	list-style: none;
}

.pm-nav li {
	position: relative;
}

.pm-nav a {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.55rem 0.85rem;
	border-radius: var(--radius-pill);
	color: var(--ink-soft);
	font-size: var(--step--1);
	font-weight: 800;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.pm-nav a:hover,
.pm-nav a:focus {
	background: rgba(255, 59, 48, 0.07);
	color: var(--red-ink);
}

.pm-nav .current-menu-item > a,
.pm-nav .current_page_item > a,
.pm-nav .current-menu-ancestor > a,
.pm-nav .current-menu-parent > a {
	background: rgba(255, 59, 48, 0.1);
	color: var(--red-ink);
}

/* Sub-menus. Opened on hover for pointers and on focus for keyboards, and
   toggled by the button below for touch. */
.pm-nav .sub-menu {
	position: absolute;
	inset-block-start: calc(100% + 0.4rem);
	inset-inline-start: 0;
	z-index: 10;
	display: block;
	min-inline-size: 13rem;
	padding: 0.4rem;
	border: 1px solid var(--hairline);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-lift);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-0.4rem);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.pm-nav .sub-menu .sub-menu {
	inset-block-start: -0.4rem;
	inset-inline-start: calc(100% + 0.4rem);
}

.pm-nav li:hover > .sub-menu,
.pm-nav li:focus-within > .sub-menu,
.pm-nav li.pm-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.pm-nav .sub-menu a {
	display: flex;
	inline-size: 100%;
	border-radius: var(--radius-sm);
	white-space: normal;
}

/* The caret that opens a sub-menu without following its parent link. */
.pm-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 1.75rem;
	block-size: 1.75rem;
	padding: 0;
	border: 0;
	border-radius: var(--radius-pill);
	background: none;
	color: var(--ink-muted);
	cursor: pointer;
}

.pm-submenu-toggle:hover {
	background: rgba(0, 0, 0, 0.05);
	color: var(--ink);
}

.pm-submenu-toggle svg {
	inline-size: 1rem;
	block-size: 1rem;
	transition: transform 0.2s ease;
}

.pm-open > a > .pm-submenu-toggle svg,
.pm-open > .pm-submenu-toggle svg {
	transform: rotate(180deg);
}

/* ==========================================================================
   Header actions
   ========================================================================== */

.pm-header__actions {
	display: none;
	align-items: center;
	gap: 0.5rem;
}

@media (min-width: 62rem) {
	.pm-header__actions {
		display: flex;
	}
}

/* The language switch. Two locales, so a pair of links reads faster than a
   dropdown — and the inactive one is a real link, not a disabled control. */
.pm-locale-switch {
	display: inline-flex;
	align-items: center;
	padding: 0.2rem;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-pill);
	background: var(--surface);
}

.pm-locale-switch a,
.pm-locale-switch span {
	padding: 0.3rem 0.7rem;
	border-radius: var(--radius-pill);
	color: var(--ink-muted);
	font-size: 0.75rem;
	font-weight: 800;
	text-decoration: none;
	/* Locale labels are language names in their own script, so each one is
	   isolated from the surrounding direction. */
	unicode-bidi: isolate;
}

.pm-locale-switch a:hover,
.pm-locale-switch a:focus {
	background: rgba(255, 59, 48, 0.08);
	color: var(--red-ink);
}

.pm-locale-switch [aria-current="true"] {
	background: var(--red-solid);
	color: #fff;
}

/* ==========================================================================
   Mobile drawer
   ========================================================================== */

.pm-drawer-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.85rem;
	block-size: 2.85rem;
	padding: 0;
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
}

.pm-drawer-toggle:hover {
	border-color: var(--red-solid);
	color: var(--red-ink);
}

.pm-drawer-toggle svg {
	inline-size: 1.4rem;
	block-size: 1.4rem;
}

@media (min-width: 62rem) {
	.pm-drawer-toggle {
		display: none;
	}
}

.pm-drawer-overlay {
	position: fixed;
	inset: 0;
	z-index: 80;
	background: rgba(32, 32, 32, 0.45);
	animation: pm-fade-in 0.2s ease both;
}

.pm-drawer {
	position: fixed;
	inset-block: 0;
	inset-inline-end: 0;
	z-index: 90;
	display: flex;
	flex-direction: column;
	inline-size: min(22rem, 88vw);
	padding: 1.25rem;
	background: var(--surface);
	box-shadow: var(--shadow-lift);
	overflow-y: auto;
	animation: pm-drawer-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pm-drawer[hidden],
.pm-drawer-overlay[hidden] {
	display: none;
}

.pm-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-block-end: 1.25rem;
}

.pm-drawer nav ul {
	padding: 0;
	margin: 0;
	list-style: none;
}

.pm-drawer nav li + li {
	margin-block-start: 0.15rem;
}

.pm-drawer nav a {
	display: block;
	padding: 0.7rem 0.85rem;
	border-radius: var(--radius);
	color: var(--ink);
	font-size: var(--step-0);
	font-weight: 800;
	text-decoration: none;
}

.pm-drawer nav a:hover,
.pm-drawer nav a:focus {
	background: rgba(255, 59, 48, 0.07);
	color: var(--red-ink);
}

.pm-drawer nav .current-menu-item > a,
.pm-drawer nav .current_page_item > a {
	background: rgba(255, 59, 48, 0.1);
	color: var(--red-ink);
}

/* In the drawer a sub-menu is an indented list rather than a popover: there is
   no hover on a touch screen, and a nested popover has nowhere to go. */
.pm-drawer .sub-menu {
	padding-inline-start: 0.85rem;
	margin-block: 0.15rem;
	border-inline-start: 2px solid var(--border-color);
}

.pm-drawer .sub-menu a {
	font-size: var(--step--1);
	font-weight: 700;
	color: var(--ink-soft);
}

.pm-drawer__foot {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-block-start: auto;
	padding-block-start: 1.5rem;
}

body.pm-drawer-open {
	overflow: hidden;
}

/* ==========================================================================
   Page header (everything that is not the front page)
   ========================================================================== */

.pm-page-header {
	padding-block: clamp(2.25rem, 1.5rem + 3vw, 4rem) clamp(1.5rem, 1rem + 2vw, 2.5rem);
	background-color: var(--surface-sunken);
	background-image: var(--mesh);
	text-align: center;
}

.pm-page-header__inner {
	max-inline-size: 48rem;
	margin-inline: auto;
}

.pm-page-title {
	margin-block: 0;
	font-size: var(--step-4);
}

.pm-page-header__desc {
	margin-block: 0.85rem 0;
	color: var(--ink-soft);
	font-size: var(--step-1);
	line-height: 1.55;
}

/* Breadcrumb. A single ordered list, because the steps do have an order. */
.pm-breadcrumb {
	margin-block-end: 0.85rem;
}

.pm-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	list-style: none;
	font-size: var(--step--1);
	font-weight: 700;
	color: var(--ink-muted);
}

.pm-breadcrumb a {
	color: var(--ink-muted);
	text-decoration: none;
}

.pm-breadcrumb a:hover,
.pm-breadcrumb a:focus {
	color: var(--red-ink);
	text-decoration: underline;
}

.pm-breadcrumb li + li::before {
	content: "/";
	margin-inline-end: 0.4rem;
	color: var(--ink-faint);
}

[dir="rtl"] .pm-breadcrumb li + li::before {
	content: "\\";
}

/* ==========================================================================
   Footer
   ========================================================================== */

.pm-footer {
	margin-block-start: var(--section-y);
	border-block-start: 1px solid var(--border-color);
	background: var(--surface);
}

.pm-footer__top {
	display: grid;
	gap: clamp(1.5rem, 1rem + 2vw, 2.5rem);
	padding-block: clamp(2.5rem, 2rem + 2vw, 4rem);
	grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
	.pm-footer__top {
		grid-template-columns: 1.4fr 1fr;
	}
}

@media (min-width: 62rem) {
	.pm-footer__top {
		grid-template-columns: 1.6fr 2fr;
	}
}

.pm-footer__about p {
	max-inline-size: 30ch;
	margin-block: 1rem 0;
	color: var(--ink-soft);
	font-size: var(--step--1);
	line-height: 1.6;
}

.pm-footer__widgets {
	display: grid;
	gap: clamp(1.25rem, 1rem + 1.5vw, 2rem);
	grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
}

/* Column headings are h2, not h3: on a page whose only other heading is the
   h1, an h3 here skips a level and the document outline breaks. */
.pm-footer__widgets h2,
.pm-footer__widgets .widget-title {
	margin-block: 0 0.85rem;
	font-family: var(--font-latin);
	font-size: var(--step--1);
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink);
}

[dir="rtl"] .pm-footer__widgets h2,
[dir="rtl"] .pm-footer__widgets .widget-title {
	font-family: var(--font-fa);
	letter-spacing: 0;
}

.pm-footer__widgets ul {
	padding: 0;
	margin: 0;
	list-style: none;
}

.pm-footer__widgets li + li {
	margin-block-start: 0.5rem;
}

.pm-footer__widgets a {
	color: var(--ink-soft);
	font-size: var(--step--1);
	font-weight: 600;
	text-decoration: none;
}

.pm-footer__widgets a:hover,
.pm-footer__widgets a:focus {
	color: var(--red-ink);
	text-decoration: underline;
}

.pm-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	align-items: center;
	justify-content: space-between;
	padding-block: 1.25rem;
	border-block-start: 1px solid var(--border-color);
	color: var(--ink-muted);
	font-size: var(--step--1);
}

.pm-footer__bottom p {
	margin: 0;
}

.pm-footer__social {
	display: flex;
	gap: 0.4rem;
	padding: 0;
	margin: 0;
	list-style: none;
}

.pm-footer__social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.25rem;
	block-size: 2.25rem;
	border: 1px solid var(--border-color);
	border-radius: var(--radius-pill);
	color: var(--ink-soft);
}

.pm-footer__social a:hover,
.pm-footer__social a:focus {
	border-color: var(--red-solid);
	background: rgba(255, 59, 48, 0.07);
	color: var(--red-ink);
}

.pm-footer__social svg {
	inline-size: 1.1rem;
	block-size: 1.1rem;
}
