/*
 * Base: tokens, focus, skip link, buttons, icons, WhatsApp button.
 * Colours come from theme.json (var(--wp--preset--color--<slug>)); layout uses logical properties so Arabic mirrors.
 */

:root {
	--dolphin-gutter: clamp(16px, 4vw - 8px, 24px);
	--dolphin-wide: 1240px;
	/* Content column (max 1240px) plus its gutters: the box every full-width section centres its content in. */
	--dolphin-container: calc(var(--dolphin-wide) + 2 * var(--dolphin-gutter));
	--dolphin-radius-card: 16px;
	--dolphin-radius-pill: 999px;
	--dolphin-shadow-card: 0 1px 2px rgba(15, 61, 50, 0.06);
	--dolphin-shadow-pop: 0 18px 40px rgba(15, 61, 50, 0.16);
	--dolphin-font-ar: Cairo, Poppins, system-ui, "Segoe UI", sans-serif;
	--dolphin-font-en: Poppins, Cairo, system-ui, "Segoe UI", sans-serif;
}

html {
	/* Keeps a focused field or link clear of the floating WhatsApp button. */
	scroll-padding-bottom: 96px;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--forest);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body img,
body svg {
	max-width: 100%;
}

body input::placeholder,
body textarea::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

/* Focus: always visible for keyboard users (prototype: 3px orange-600, cream on dark backgrounds). */
body :focus-visible {
	outline: 3px solid var(--wp--preset--color--orange-600);
	outline-offset: 2px;
}

body .dolphin-on-dark :focus-visible,
body .dolphin-footer :focus-visible,
body .dolphin-help-band :focus-visible {
	outline-color: var(--wp--preset--color--cream);
}

/* Screen-reader-only text (WordPress uses this class too). */
body .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
	word-wrap: normal !important;
}

/* WordPress's "Skip to content" link, styled like the prototype's pill. */
body .skip-link.screen-reader-text:focus,
body .skip-link.screen-reader-text:focus-visible {
	position: absolute !important;
	inset-inline-start: 16px;
	top: 8px;
	z-index: 100000;
	width: auto;
	height: auto;
	margin: 0;
	padding: 10px 18px;
	clip: auto;
	clip-path: none;
	border-radius: var(--dolphin-radius-pill);
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--cream);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	outline-color: var(--wp--preset--color--orange-600);
}

body #main:focus {
	outline: none;
}

/* Icons */
body .dolphin-icon {
	display: block;
	flex: none;
}

[dir="rtl"] .dolphin-flip-rtl {
	transform: scaleX(-1);
}

/* 44px round icon button (☰, search, close). */
body .dolphin-icon-btn {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--dolphin-radius-pill);
	background: transparent;
	color: var(--wp--preset--color--forest);
	font: inherit;
	text-decoration: none;
	cursor: pointer;
}

body .dolphin-icon-btn:hover {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--forest);
}

/*
 * Pill buttons (BRAND.md): orange-600 "Shop now", forest "Checkout / Show all", outline "See offers", WhatsApp (sage-700,
 * questions only), and light / ghost variants for dark bands.
 */
body .dolphin-btn {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 22px;
	border: 2px solid transparent;
	border-radius: var(--dolphin-radius-pill);
	background: var(--wp--preset--color--orange-600);
	color: var(--wp--preset--color--white);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body .dolphin-btn:hover {
	background: var(--wp--preset--color--orange-700);
	color: var(--wp--preset--color--white);
}

body .dolphin-btn--forest {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--cream);
}

body .dolphin-btn--forest:hover {
	background: var(--wp--preset--color--forest-900);
	color: var(--wp--preset--color--cream);
}

body .dolphin-btn--outline {
	border: 1.5px solid var(--wp--preset--color--forest);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--forest);
}

body .dolphin-btn--outline:hover {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--cream);
}

body .dolphin-btn--whatsapp {
	background: var(--wp--preset--color--sage-700);
	color: var(--wp--preset--color--white);
}

body .dolphin-btn--whatsapp:hover {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--white);
}

body .dolphin-btn--light {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--forest);
}

body .dolphin-btn--light .dolphin-icon--whatsapp {
	color: var(--wp--preset--color--sage-700);
}

body .dolphin-btn--light:hover {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--forest);
}

body .dolphin-btn--ghost-light {
	border-color: var(--wp--preset--color--cream);
	background: transparent;
	color: var(--wp--preset--color--cream);
}

body .dolphin-btn--ghost-light:hover {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--forest);
}

/* Language switch link (header, under the phone header, drawer, coming-soon page). */
body .dolphin-lang {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 8px;
	border-radius: var(--dolphin-radius-pill);
	color: var(--wp--preset--color--forest);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}

body .dolphin-lang[lang="ar"] {
	font-family: var(--dolphin-font-ar);
}

body .dolphin-lang:not([lang="ar"]) {
	font-family: var(--dolphin-font-en);
}

body .dolphin-lang:hover {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--forest);
}

body .dolphin-lang .dolphin-icon {
	width: 18px;
	height: 18px;
}

/*
 * WhatsApp: round, icon-only button in the bottom-right corner in both languages (SPEC §2), so "right" is physical.
 * Hidden on cart, checkout and order-placed (inc/chrome.php).
 */
body .dolphin-wa-fab {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: var(--dolphin-radius-pill);
	background: var(--wp--preset--color--sage-700);
	color: var(--wp--preset--color--white);
	box-shadow: 0 6px 18px rgba(15, 61, 50, 0.28);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

body .dolphin-wa-fab .dolphin-icon {
	width: 28px;
	height: 28px;
}

body .dolphin-wa-fab:hover {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--white);
	transform: translateY(-2px);
}

body .dolphin-wa-fab:focus-visible {
	outline-color: var(--wp--preset--color--cream);
	box-shadow: 0 0 0 8px var(--wp--preset--color--forest);
}

@media (min-width: 782px) {
	body .dolphin-wa-fab {
		right: 24px;
		bottom: 24px;
		width: 60px;
		height: 60px;
	}

	body .dolphin-wa-fab .dolphin-icon {
		width: 30px;
		height: 30px;
	}
}

/* While the ☰ drawer is open the page behind it doesn't scroll, and the WhatsApp button steps aside. */
html.dolphin-drawer-open {
	overflow: hidden;
}

/* Separate rule: a browser without :has() would otherwise drop the class rule above too. */
html:has(.dolphin-drawer[open]) {
	overflow: hidden;
}

html.dolphin-drawer-open .dolphin-wa-fab {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	body *,
	body *::before,
	body *::after {
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	body .dolphin-wa-fab:hover {
		transform: none;
	}
}
