/* ==========================================================================
   Goldoun — font, reset, base elements, shared utilities
   ========================================================================== */

/* ---------- Font: self-hosted Vazirmatn variable (OFL, see fonts/OFL.txt) ---------- */
@font-face {
	font-family: "Vazirmatn";
	src: url("../fonts/Vazirmatn-wght.woff2") format("woff2-variations"),
	     url("../fonts/Vazirmatn-wght.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scrollbar-gutter: stable; /* no layout jump when the scroll lock hides the scrollbar */
	scroll-behavior: smooth;
}

body {
	margin: 0;
	overflow-x: hidden;
	background: var(--color-bg);
	color: var(--color-text-dark);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	line-height: 1.85;
	-webkit-font-smoothing: antialiased;
}

/* Sticky footer (v0.5.1): the body is at least one screen high and <main>
   takes the free space, so on short pages the footer sits at the bottom of
   the screen instead of leaving an empty band under it. Topbar, header,
   main and footer are the only in-flow children; the panels, the scrim and
   the admin bar are fixed. svh = the height with the browser bars shown
   (no jump when Safari's bar collapses); vh is the fallback. */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100svh;
}

/* WordPress pushes the page down by the admin bar (html margin-top). */
body.admin-bar {
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px));
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 32px));
}

.site-main { flex: 1 0 auto; }

/* Scroll lock while a drawer is open. position:fixed is what stops scrolling in
   iOS Safari; main.js sets `top` to the negative scroll offset and restores the
   scroll position on unlock. */
body.is-locked {
	position: fixed;
	inset-inline: 0;
	width: 100%;
	overflow: hidden;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-line: none; }

/* Every underline on the site looks the same: components only switch it on
   with `text-decoration-line: underline` (never the `text-decoration`
   shorthand, which would reset the thickness). */
*,
::before,
::after {
	text-underline-offset: var(--underline-offset);
	text-decoration-thickness: var(--underline-thickness);
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 3px;
}

/* Anything carrying [hidden] stays hidden regardless of component styles. */
[hidden] { display: none !important; }

/* ---------- Shared utilities ---------- */
.wrap {
	width: 100%;
	max-width: calc(var(--content-max) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Skip link becomes visible when focused with the keyboard. */
.skip-link:focus {
	position: fixed;
	top: 12px;
	inset-inline-start: 12px;
	z-index: 1000;
	width: auto;
	height: auto;
	margin: 0;
	clip: auto;
	padding: 10px 16px;
	background: var(--color-primary);
	color: var(--color-white);
	font-size: var(--fs-small);
	font-weight: 700;
}

/* ---------- Logo ---------- */
.logo { display: inline-block; }
.logo img { width: 160px; height: auto; }

@media (max-width: 768px) {
	.logo img { width: 128px; }
}

/* ---------- Fallback content (index.php) ---------- */
.section { padding-block: clamp(48px, 6.5vw, 96px); }

.entry {
	padding-block: 20px;
	border-bottom: 1px solid var(--border-light);
}

.entry__title {
	font-size: var(--fs-h3);
	font-weight: 700;
	color: var(--color-primary);
}

/* ---------- Generic page (page.php) ---------- */
/* Title row: the title, and on some pages a small link at the other end
   (checkout: «بازگشت به سبد خرید», inc/checkout.php). */
.page-entry__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 24px;
	margin-bottom: 28px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--border-light);
}
.page-entry__title {
	font-size: var(--fs-h2);
	font-weight: 700;
	line-height: 1.4;
}
.page-entry__back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	font-size: var(--fs-small);
	color: var(--color-text-muted);
	text-decoration-line: underline;
	text-decoration-color: transparent;
	text-underline-offset: var(--underline-offset);
	text-decoration-thickness: var(--underline-thickness);
	transition: color var(--t-fast), text-decoration-color var(--t-fast);
}
.page-entry__back:hover { color: var(--color-text-dark); text-decoration-color: currentColor; }

.page-entry__content > * + * { margin-top: 1em; }
/* Links in page text are maroon; buttons keep their own colours (e.g. the
   black checkout button on the cart page would get maroon text). */
.page-entry__content a:not(.btn) { color: var(--color-primary); }

@media (max-width: 768px) {
	.section { padding-block: 44px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*,
	*::before,
	*::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
}
