/* Page structure: container, header and navigation, footer, page regions. */
.container {
	inline-size: 100%;
	max-inline-size: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.site-main {
	display: block;
	min-block-size: 60vh;
	padding-block: var(--space-5) var(--space-8);
}

.site-main:focus {
	outline: none;
}

/* Header. */
.site-header {
	position: sticky;
	inset-block-start: 0;
	z-index: 50;
	border-block-end: 1px solid var(--tint-ink-8);
}

/* The frosted glass sits on its own layer: a backdrop-filter on the header itself would trap the fixed menu panel
   and its scrim inside the header's height, so the menu opened empty on phones. */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--tint-bg-88);
	backdrop-filter: saturate(1.4) blur(14px);
}

.admin-bar .site-header {
	inset-block-start: 32px;
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	min-block-size: var(--header-height);
}

/* The brand takes what is left and gives way: a long store name shrinks, then ends in "…", but never pushes the
   language, cart and menu buttons off a 360px screen. */
.site-header__brand {
	flex: 1;
	display: flex;
	justify-content: flex-start;
	min-inline-size: 0;
}

.site-header__lang,
.site-header__cart,
.nav-toggle {
	flex: none;
}

/* Phones: logo at the start, then the language button, the cart and the menu button at the far end. */
.site-header__lang {
	order: 1;
}

.site-header__cart {
	order: 2;
}

.nav-toggle {
	order: 3;
}

/* Phone language list: a globe and the current code, opening a small panel of the four languages. */
.storecore-lang-menu {
	position: relative;
}

.storecore-lang-menu__button {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	min-block-size: var(--tap);
	padding-inline: var(--space-2);
	border-radius: var(--radius-pill);
	font-size: var(--step--1);
	font-weight: var(--weight-semibold);
	list-style: none;
	cursor: pointer;
	transition: background-color var(--duration-fast) var(--ease-out);
}

.storecore-lang-menu__button::-webkit-details-marker {
	display: none;
}

.storecore-lang-menu__button:hover,
.storecore-lang-menu[open] .storecore-lang-menu__button {
	background: var(--color-sand);
}

.storecore-lang-menu__list {
	position: absolute;
	inset-block-start: calc(100% + var(--space-1));
	inset-inline-end: 0;
	z-index: 70;
	min-inline-size: 11rem;
	margin: 0;
	padding: var(--space-2);
	background: var(--color-surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	list-style: none;
}

.storecore-lang-menu__list a {
	display: flex;
	align-items: center;
	min-block-size: var(--tap);
	padding-inline: var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--color-ink);
	text-decoration: none;
}

.storecore-lang-menu__list a:hover,
.storecore-lang-menu__list a[aria-current] {
	background: var(--color-accent-tint);
	color: var(--color-accent-deep);
	font-weight: var(--weight-semibold);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: var(--space-3);
	color: var(--color-ink);
	text-decoration: none;
	line-height: 1;
	min-inline-size: 0;
}

.brand:hover {
	color: var(--color-ink);
}

.brand__mark {
	flex: none;
	inline-size: 30px;
	block-size: auto;
	color: var(--color-accent);
}

.brand__text {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-inline-size: 0;
}

.brand__name {
	font-family: var(--font-heading);
	font-size: 1.6rem;
	font-style: italic;
	font-weight: var(--weight-regular);
	letter-spacing: -0.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	/* The name's own script sets its direction: a Latin name on an Arabic page keeps its first letters and ends in
	   "…", instead of losing its start. */
	unicode-bidi: plaintext;
}

@media (max-width: 47.99rem) {
	.brand__name {
		font-size: 1.25rem;
	}
}

.brand__name b {
	font-style: normal;
	font-weight: var(--weight-medium);
}

/* Cut short like the name: at 350px in Tamazight it ran under the language button. */
.brand__tfng {
	overflow: hidden;
	font-size: 0.7rem;
	color: var(--color-accent-text);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.custom-logo {
	max-block-size: 48px;
	inline-size: auto;
}

.nav-toggle,
.nav-close {
	display: inline-grid;
	place-items: center;
	inline-size: var(--tap);
	block-size: var(--tap);
	padding: 0;
	border: 0;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--color-ink);
	cursor: pointer;
	transition: background-color var(--duration-fast) var(--ease-out);
}

.nav-toggle:hover,
.nav-close:hover {
	background: var(--color-sand);
}

/* Mobile navigation: a panel sliding in from the inline end, where its button is. */
.site-nav {
	position: fixed;
	inset-block: 0;
	inset-inline-end: 0;
	z-index: 60;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	inline-size: min(20rem, 86vw);
	padding: var(--space-4) var(--space-5) var(--space-6);
	background: var(--color-surface);
	box-shadow: var(--shadow-soft);
	overflow-y: auto;
	transform: translateX(100%);
	visibility: hidden;
	transition: transform var(--duration-panel) var(--ease-in), visibility 0s linear var(--duration-panel);
}

[dir="rtl"] .site-nav {
	transform: translateX(-100%);
}

/* A logged-in owner's admin bar covers the top of the page: the panel starts under it, so its close button shows. */
.admin-bar .site-nav {
	inset-block-start: var(--wp-admin--admin-bar--height, 0px);
}

.site-header[data-open] .site-nav {
	transform: none;
	visibility: visible;
	transition: transform var(--duration-panel) var(--ease-out), visibility 0s;
}

.site-nav__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.site-nav__title {
	font-family: var(--font-heading);
	font-size: var(--step-2);
}

.site-nav__list {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__list a {
	display: flex;
	align-items: center;
	min-block-size: var(--tap);
	white-space: nowrap;
	padding-inline: var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--color-ink);
	font-size: var(--step-1);
	text-decoration: none;
	transition: background-color var(--duration-fast) var(--ease-out);
}

.site-nav__list a:hover,
.site-nav__list .current-menu-item > a {
	background: var(--color-accent-tint);
	color: var(--color-accent-deep);
}

/* The phone menu's parts: the brand at the top, an icon and an arrow on each link, a contact card, then the languages
   on one line (header.php, inc/nav.php). */
.site-nav__head {
	padding-block-end: var(--space-3);
	border-block-end: 1px solid var(--color-sand);
}

.site-nav__head .site-nav__title {
	font-size: var(--step-1);
	font-weight: 700;
	color: var(--color-accent-text);
}

.site-nav__logo {
	display: block;
	inline-size: auto;
	max-block-size: 52px;
}

.site-nav__head .nav-close {
	background: var(--color-bg);
	color: var(--color-accent-text);
}

.site-nav__list a {
	gap: var(--space-3);
	font-size: var(--step-0);
}

.site-nav__list .current-menu-item > a {
	font-weight: 700;
}

.site-nav__icon {
	display: inline-flex;
	color: var(--color-accent-text);
}

.site-nav__icon .icon,
.site-nav__chevron .icon {
	inline-size: 1.3rem;
	block-size: 1.3rem;
}

.site-nav__chevron {
	display: inline-flex;
	margin-inline-start: auto;
	color: var(--color-ink-soft);
}

[dir="rtl"] .site-nav__chevron .icon {
	transform: scaleX(-1);
}

.site-nav__help {
	display: grid;
	gap: var(--space-2);
	padding: var(--space-3);
	border-radius: var(--radius-sm);
	background: var(--color-bg);
}

.site-nav__help p {
	margin: 0;
	font-size: var(--step--1);
	color: var(--color-ink-soft);
}

.site-nav__help-links {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
	gap: var(--space-2);
}

.site-nav__help-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-block-size: var(--tap);
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-accent-text);
	font-weight: 700;
	text-decoration: none;
}

.site-nav__help-link--whatsapp {
	border-color: var(--color-accent);
	background: var(--color-accent);
	color: var(--color-on-accent);
}

.site-nav__help-link .icon {
	inline-size: 1.2rem;
	block-size: 1.2rem;
}

/* The social icons switch: a row with its label, the switch at the end. */
/* A row of its own, set off by a line like a settings list. */
.site-nav__setting {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	min-block-size: var(--tap);
	margin-block-start: var(--space-3);
	padding-block-start: var(--space-3);
	border-block-start: 1px solid var(--color-sand);
	font-size: var(--step--1);
	color: var(--color-ink);
}

.site-nav__setting label {
	flex: 1;
	cursor: pointer;
}

.site-nav__setting[hidden] {
	display: none;
}

.switch {
	position: relative;
	flex: none;
	inline-size: 48px;
	block-size: 28px;
	padding: 0;
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-pill);
	background: var(--color-sand);
	cursor: pointer;
}

/* The tap area reaches 44px tall around the drawn switch. */
.switch::before {
	content: "";
	position: absolute;
	inset: -9px -4px;
}

.switch__thumb {
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	inline-size: 22px;
	block-size: 22px;
	border-radius: 50%;
	background: var(--color-surface);
	box-shadow: 0 1px 2px var(--tint-ink-8);
}

.switch[aria-checked="true"] {
	border-color: var(--color-accent);
	background: var(--color-accent);
}

.switch[aria-checked="true"] .switch__thumb {
	transform: translateX(20px);
}

[dir="rtl"] .switch[aria-checked="true"] .switch__thumb {
	transform: translateX(-20px);
}

.switch:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: no-preference) {
	.switch,
	.switch__thumb {
		transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
	}
}

/* The four languages side by side, one line whatever their names. Each cell starts from its own name and the spare
   room is shared out, so a long name ("Tamazight") keeps a margin instead of touching its borders as in equal cells. */
.site-nav__langs {
	margin-block-start: auto;
	padding-block-start: var(--space-3);
	border-block-start: 1px solid var(--color-sand);
}

.site-nav__langs .storecore-lang-switcher ul {
	display: grid;
	grid-auto-columns: auto;
	grid-auto-flow: column;
	gap: 0;
	padding: 0;
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-sm);
	overflow: hidden;
}

.site-nav__langs .storecore-lang-switcher li + li {
	border-inline-start: 1px solid var(--color-line-strong);
}

.site-nav__langs .storecore-lang-switcher a {
	justify-content: center;
	inline-size: 100%;
	min-block-size: var(--tap);
	padding-inline: var(--space-1);
	border-radius: 0;
	/* 320px phones: the names shrink a little so the four still fit the drawer. */
	font-size: min(0.8rem, 3.6vw);
	white-space: nowrap;
}

/* Phones: the whole menu, languages included, fits a 320×568 screen without scrolling. The links keep 44px; the
   room comes from the gaps, the logo, the help card and the switch row. The help and language buttons go to 40px,
   the floor for secondary targets. */
@media (max-width: 47.99rem) {
	.site-nav {
		gap: var(--space-3);
		padding: var(--space-3) var(--space-4);
	}

	.site-nav__head {
		padding-block-end: var(--space-2);
	}

	.site-nav__logo {
		max-block-size: 40px;
	}

	.site-nav__list {
		gap: 0;
	}

	.site-nav__help {
		gap: var(--space-2);
		padding: var(--space-2);
	}

	.site-nav__help-link {
		min-block-size: 40px;
	}

	.site-nav__setting {
		margin-block-start: 0;
		padding-block-start: var(--space-2);
	}

	.site-nav__langs {
		padding-block-start: var(--space-2);
	}

	.site-nav__langs .storecore-lang-switcher a {
		min-block-size: 40px;
	}
}

.nav-scrim {
	position: fixed;
	inset: 0;
	z-index: 55;
	background: var(--tint-ink-40);
}

body.nav-open {
	overflow: hidden;
}

/* The links in a row only where all six fit on one line in every language (about 1,100 px measured); below, the
   phone menu. The four-language pill does not fit beside them, so the globe list stays, at the end of the row. */
@media (min-width: 75rem) {
	.nav-toggle,
	.nav-close,
	.site-nav__head,
	.nav-scrim,
	.site-nav__langs,
	.site-nav__help,
	.site-nav__setting,
	.site-nav__icon,
	.site-nav__chevron {
		display: none !important;
	}

	.site-header__brand {
		flex: none;
	}

	.site-header__lang {
		order: 2;
	}

	.site-header__cart {
		order: 3;
	}

	.site-nav {
		position: static;
		order: 1;
		flex: 1;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		inline-size: auto;
		padding: 0;
		background: none;
		box-shadow: none;
		overflow: visible;
		transform: none;
		visibility: visible;
		transition: none;
	}

	[dir="rtl"] .site-nav {
		transform: none;
	}

	.site-nav__list {
		flex-direction: row;
		gap: clamp(0rem, -1rem + 1.25vw, var(--space-2));
		margin-inline-start: clamp(var(--space-4), -2rem + 4vw, var(--space-6));
	}

	.site-nav__list a {
		position: relative;
		padding-inline: clamp(var(--space-2), -0.5rem + 1vw, var(--space-3));
		font-size: clamp(0.9375rem, 0.75rem + 0.25vw, var(--step-0));
		font-weight: var(--weight-medium);
	}

	.site-nav__list a:hover,
	.site-nav__list .current-menu-item > a {
		background: none;
		color: var(--color-ink);
	}

	.site-nav__list a::after {
		content: "";
		position: absolute;
		inset-inline: clamp(var(--space-2), -0.5rem + 1vw, var(--space-3));
		inset-block-end: 8px;
		block-size: 2px;
		border-radius: 2px;
		background: var(--color-accent);
		transform: scaleX(0);
		transition: transform var(--duration-base) var(--ease-out);
	}

	.site-nav__list a:hover::after,
	.site-nav__list .current-menu-item > a::after {
		transform: scaleX(1);
	}
}

/* Cart icon slot, filled once the cart ships (Task 17). */
.site-header__cart:empty {
	display: none;
}

/* Footer. */
.site-footer {
	padding-block: var(--space-7) var(--space-5);
	border-block-start: 1px solid var(--tint-ink-12);
}

.site-footer__inner {
	display: grid;
	gap: var(--space-6);
}

.site-footer .brand {
	align-items: flex-start;
}

.site-footer__tagline {
	margin-block-start: var(--space-3);
	max-inline-size: 32ch;
	color: var(--color-ink-soft);
}

.site-footer__title {
	margin-block-end: var(--space-3);
	font-size: var(--step-1);
	font-weight: var(--weight-regular);
}

.site-footer__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__list a {
	display: inline-flex;
	align-items: center;
	min-block-size: var(--tap);
	color: var(--color-ink-soft);
	text-decoration: none;
}

.site-footer__list a:hover {
	color: var(--color-accent-text);
}

.site-footer__legal {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--space-2) var(--space-5);
	margin-block: var(--space-6) 0;
	padding-block-start: var(--space-4);
	border-block-start: var(--border);
	font-size: var(--step--1);
	color: var(--color-ink-soft);
}

.site-footer__legal p {
	margin: 0;
}

.site-footer__credit a {
	color: inherit;
	font-weight: var(--weight-semibold);
	text-underline-offset: 3px;
}

/* On a phone: a shorter footer, its menu in two columns. */
@media (max-width: 47.99rem) {
	/* A band of the header's surface, as in D: the cards' shadows end on the page colour, the footer starts on its own. */
	.site-footer {
		padding-block: var(--space-6) var(--space-4);
		background: var(--color-bar);
	}

	.site-footer__inner {
		gap: var(--space-4);
	}

	/* The grid's 16px gap already parts the blocks: the paragraph's own bottom margin doubled it. */
	.site-footer__tagline {
		margin-block: var(--space-2) 0;
	}

	.site-footer__title {
		margin-block-end: var(--space-2);
	}

	.site-footer__list {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--space-3);
	}

	.site-footer__list a {
		display: block;
		min-block-size: 40px;
		padding-block: 10px;
		line-height: 1.3;
	}

	.site-footer__legal {
		margin-block-start: var(--space-3);
		padding-block-start: var(--space-3);
	}
}

@media (min-width: 48rem) {
	/* A wrapping row: the number of columns depends on which details and links are set. */
	.site-footer__inner {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-6) var(--space-8);
	}

	.site-footer__inner > * {
		flex: 1 1 10rem;
	}

	.site-footer__inner > .site-footer__brand {
		flex: 2 1 18rem;
	}
}

/* Page regions. */
.page-head {
	margin-block-end: var(--space-5);
}

.page-head__lead {
	max-inline-size: var(--measure);
	color: var(--color-ink-soft);
}

.page-content .entry__content {
	max-inline-size: var(--measure);
}

.product-layout {
	display: grid;
	gap: var(--space-6);
}

@media (min-width: 56rem) {
	.product-layout {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		gap: var(--space-8);
		align-items: start;
	}

	.product-gallery {
		position: sticky;
		inset-block-start: calc(var(--header-height) + var(--space-5));
	}
}

.product-description {
	margin-block-start: var(--space-8);
	max-inline-size: var(--measure);
}

.not-found {
	display: grid;
	justify-items: center;
	padding-block: var(--space-8);
	text-align: center;
}

.not-found__code {
	margin: 0;
	font-family: var(--font-heading);
	font-size: clamp(4rem, 3rem + 6vw, 7rem);
	line-height: 1;
	color: var(--color-accent);
}

.not-found__text {
	max-inline-size: 40ch;
	color: var(--color-ink-soft);
}

.not-found__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-3);
}

/* Phones: titles, short lines and buttons are centred under the centred photos; long paragraphs stay aligned to
   the start, which reads better. Headings inside a page step down one size so they do not compete with its title. */
@media (max-width: 47.99rem) {
	/* The photo sits close to the header and nearly fills the width; the title follows right under it. The hero rules are
	   scoped to .storecore-hero to outrank components.css, which loads after this file. */
	/* Home: the photo starts just under the header (the page's own top space and the hero's are dropped). */
	.home .site-main {
		padding-block-start: 0;
	}

	.custom-logo {
		max-block-size: 36px;
	}

	.storecore-home .storecore-hero {
		padding-block: var(--space-3) var(--space-4);
	}

	.storecore-hero .storecore-hero__inner {
		gap: var(--space-3);
	}

	/* Nearly the full width of the phone: only the page gutter on each side. */
	.storecore-hero .storecore-hero__art {
		inline-size: min(100%, 26rem);
		margin-inline: auto;
	}

	.storecore-hero .storecore-hero__body {
		text-align: center;
	}

	/* The full width of the phone, so the title takes two lines rather than four. */
	.storecore-hero .storecore-hero__title {
		max-inline-size: none;
		margin-block-end: var(--space-2);
		font-size: var(--step-5);
	}

	.storecore-hero .storecore-hero__subtitle {
		margin-block-end: var(--space-5);
		font-size: var(--step-0);
	}

	.storecore-hero .storecore-hero__title,
	.storecore-hero .storecore-hero__subtitle {
		margin-inline: auto;
	}

	.storecore-hero .storecore-hero__promise {
		margin-block-start: var(--space-5);
	}

	.storecore-hero .storecore-hero__actions,
	.storecore-hero .storecore-hero__promise {
		justify-content: center;
	}

	.storecore-section__title {
		text-align: center;
	}

	.page-content .storecore-section__title {
		font-size: var(--step-3);
		text-align: start;
	}

	.page-content .entry__content h2 {
		font-size: var(--step-2);
	}

	.site-footer__inner {
		justify-items: center;
		text-align: center;
	}

	.site-footer .brand {
		align-items: center;
	}

	.site-footer__tagline {
		margin-inline: auto;
	}

	.site-footer .contact-links {
		justify-items: center;
	}

	/* The menu's links fill their cells (the whole cell taps); the text stays centred. */
	.site-footer__list {
		justify-items: stretch;
	}

	.site-footer .social-links {
		justify-content: center;
	}
}
