/**
 * base.css — Della Boutique
 *
 * Reset, document defaults, typography, prose, form primitives, accessibility
 * and the shared motion vocabulary. Loaded on every page.
 *
 * Every colour, font, size, radius and duration comes from the custom
 * properties emitted by inc/css-vars.php. Nothing here hardcodes a brand value:
 * the shop owner changes them from the Theme Dashboard and the whole site moves.
 *
 * DIRECTION: all box-model and alignment rules use CSS logical properties, so
 * the Arabic (RTL) site is a mirror with no per-rule overrides. The only
 * physical values live in the [dir="rtl"] block at the very end of this file —
 * those are the handful of things with no logical equivalent (icon flips,
 * background-position, box-shadow offsets, translateX).
 */

/* =========================================================================
   1. Local layout tokens
   Derived, layout-only values. These are NEW names — never a redefinition of
   a token from css-vars.php, which would break the admin panel.
   ========================================================================= */

:root {
	--della-gutter: 15px;
	--della-gap: 30px;
	--della-announce-h: 35px;
	--della-header-h: 60px;
	--della-mobilebar-h: 55px;
	--della-drawer-w: 340px;

	/* A button's optical size: 14px at the default 100% scale. */
	--della-fs-btn: calc(var(--della-fs-base) - 1px);
	/* Wide editorial tracking for eyebrows and small caps labels. */
	--della-tracking-wide: 0.22em;

	/*
	 * One stroke weight for every outline icon on the site. The SVGs carry
	 * stroke-width="1.4" as a presentation attribute; this token overrides it
	 * from CSS so the whole icon set can be re-weighted in one place and so a
	 * chevron never looks lighter than the bag sitting next to it.
	 */
	--della-icon-stroke: 1.5;

	--della-line: 1px solid var(--della-border);
	--della-line-soft: 1px solid rgba(var(--della-border-rgb), 0.6);
	/* The hairline used to frame homepage cards and tiles. Lighter than
	   --della-line-soft so a grid of framed cards reads as editorial ruling
	   rather than as a table. */
	--della-line-hair: 1px solid rgba(var(--della-border-rgb), 0.45);
	--della-shadow-soft: 0 1px 3px rgba(var(--della-text-rgb), 0.06);
	--della-shadow-pop: 0 6px 28px rgba(var(--della-text-rgb), 0.12);
	--della-shadow-bar: 0 0 9px rgba(var(--della-text-rgb), 0.12);

	/* Drawer slide origin. Flipped once, in the RTL block. */
	--della-slide-end: 100%;
	--della-slide-start: -100%;
}

@media (min-width: 992px) {
	:root {
		--della-header-h: 95px;
		--della-drawer-w: 400px;
	}
}

/* =========================================================================
   2. Reset
   ========================================================================= */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Anchors and the skip link must clear the sticky header. */
	scroll-padding-block-start: calc(var(--della-header-h) + 16px);
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol, fieldset, legend {
	margin: 0;
	padding: 0;
}

ul[class],
ol[class] {
	list-style: none;
}

img,
picture,
svg,
video,
canvas,
iframe {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
	border: 0;
}

svg {
	flex: none;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
	margin: 0;
}

button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: inherit;
	text-align: inherit;
}

table {
	border-collapse: collapse;
	width: 100%;
}

hr {
	border: 0;
	border-block-start: var(--della-line);
	margin-block: 2rem;
}

/* =========================================================================
   3. Document
   ========================================================================= */

body {
	background: var(--della-bg);
	color: var(--della-text);
	font-family: var(--della-font-body);
	font-size: var(--della-fs-base);
	line-height: 1.7;
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Nothing on this site may cause a sideways scroll. */
	overflow-x: hidden;
}

.della-site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	isolation: isolate;
}

.della-main {
	flex: 1 0 auto;
	padding-block-end: var(--della-section-gap);
}

.della-main--home,
.della-main--shop {
	padding-block-end: 0;
}

/* The sticky mobile bar sits over the end of the page; buy it some room. */
.has-mobile-bar {
	padding-block-end: var(--della-mobilebar-h);
}

@media (min-width: 992px) {
	.has-mobile-bar {
		padding-block-end: 0;
	}
}

/* =========================================================================
   4. Typography
   ========================================================================= */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--della-font-heading);
	color: var(--della-heading);
	font-weight: 500;
	line-height: 1.18;
	text-transform: var(--della-heading-transform);
	text-wrap: balance;
}

h1 {
	font-size: clamp(var(--della-fs-xl), 5vw, var(--della-fs-3xl));
	letter-spacing: -0.01em;
}

h2 {
	font-size: clamp(var(--della-fs-lg), 4vw, var(--della-fs-2xl));
}

h3 {
	font-size: var(--della-fs-lg);
}

h4 {
	font-size: var(--della-fs-md);
}

h5,
h6 {
	font-size: var(--della-fs-base);
	font-family: var(--della-font-body);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: var(--della-tracking);
}

p {
	text-wrap: pretty;
}

a {
	color: inherit;
	text-decoration: none;
	transition: color var(--della-dur-fast) var(--della-ease),
		opacity var(--della-dur-fast) var(--della-ease);
}

a:hover {
	color: var(--della-accent-alt);
}

strong,
b {
	font-weight: 600;
	color: var(--della-heading);
}

small {
	font-size: var(--della-fs-xs);
}

code,
kbd,
samp,
pre {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9em;
}

code {
	background: var(--della-surface);
	padding: 0.15em 0.4em;
	border-radius: var(--della-radius-sm);
}

pre {
	background: var(--della-surface);
	padding: 1.25rem;
	border-radius: var(--della-radius);
	overflow-x: auto;
}

blockquote {
	border-inline-start: 2px solid var(--della-accent-alt);
	padding-inline-start: 1.25rem;
	font-family: var(--della-font-heading);
	font-size: var(--della-fs-md);
	font-style: italic;
	color: var(--della-heading);
}

::selection {
	background: var(--della-accent);
	color: var(--della-accent-contrast);
}

/* =========================================================================
   5. Prose — editor content, page bodies, tab panels
   ========================================================================= */

.della-prose {
	font-size: var(--della-fs-base);
	line-height: 1.8;
	color: var(--della-text);
}

.della-prose > * + * {
	margin-block-start: 1.1em;
}

.della-prose h2,
.della-prose h3,
.della-prose h4 {
	margin-block-start: 1.8em;
	margin-block-end: 0.6em;
}

.della-prose h2 {
	font-size: var(--della-fs-xl);
}

.della-prose h3 {
	font-size: var(--della-fs-lg);
}

/*
 * A button inside prose must keep the colour its own component gave it, and
 * restating that colour here would mean two places to change it — so exempt
 * buttons instead. The exemption is wrapped in `:where()` so it contributes
 * nothing to specificity: this rule still weighs exactly (0,1,1), and the
 * page-level resets in checkout.css that already out-rank it keep working.
 */
.della-prose a:where(:not([class*="della-btn"], .button, .della-prompt__action, .showlogin, .showcoupon)) {
	color: var(--della-heading);
	text-decoration: underline;
	text-underline-offset: 0.22em;
	text-decoration-thickness: 1px;
	text-decoration-color: var(--della-border);
}

.della-prose a:where(:not([class*="della-btn"], .button, .della-prompt__action, .showlogin, .showcoupon)):hover {
	color: var(--della-accent-alt);
	text-decoration-color: currentColor;
}

.della-prose ul,
.della-prose ol {
	padding-inline-start: 1.25em;
}

.della-prose ul {
	list-style: disc;
}

.della-prose ol {
	list-style: decimal;
}

.della-prose li + li {
	margin-block-start: 0.4em;
}

.della-prose li::marker {
	color: var(--della-accent-alt);
}

.della-prose img,
.della-prose figure {
	border-radius: var(--della-radius);
}

.della-prose figcaption {
	font-size: var(--della-fs-sm);
	color: var(--della-muted);
	margin-block-start: 0.6em;
	text-align: center;
}

/* Wide/full alignment inside a narrow measure. */
.della-prose .alignwide,
.della-prose .alignfull {
	max-width: none;
}

.della-prose .alignfull {
	margin-inline: calc(50% - 50vw);
	width: 100vw;
}

.della-prose .aligncenter {
	margin-inline: auto;
}

/*
 * A component dropped into prose is not prose. These element-qualified rules
 * out-rank any single-class component selector, so a .della-btn inside
 * .della-prose was taking the prose link colour and underline, and a
 * component's own heading was picking up the 1.8em editorial lead-in. Exempt
 * anything that carries a theme class of its own.
 */
.della-prose h2[class*="della-"],
.della-prose h3[class*="della-"],
.della-prose h4[class*="della-"] {
	margin-block: 0;
}

/*
 * Editorial tables never widen the page — they scroll inside themselves.
 *
 * `display: block` is what makes that scroll box possible, but it also turns
 * the table into a block whose anonymous inner table box shrink-wraps to its
 * content. WooCommerce renders cart / checkout / order screens through the same
 * .della-prose wrapper, so every shop table inherited that — which is why the
 * order-details table sat in the first quarter of the page with a wide empty
 * band beside it. A shop table is page furniture, not prose: it is already
 * 100% wide and already re-flowed into cards below 768px, so exempt it and let
 * it stay a real table.
 */
.della-prose table:not(.shop_table) {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.della-prose th,
.della-prose td {
	border-block-end: var(--della-line);
	padding: 0.7em 0.9em;
	text-align: start;
}

.della-prose th {
	font-weight: 600;
	color: var(--della-heading);
}

/* =========================================================================
   6. Form primitives
   ========================================================================= */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
	inline-size: 100%;
	background: var(--della-bg);
	border: var(--della-line);
	border-radius: var(--della-radius);
	color: var(--della-text);
	font-size: var(--della-fs-base);
	font-family: inherit;
	line-height: 1.4;
	padding: 12px 14px;
	min-block-size: 46px;
	transition: border-color var(--della-dur-fast) var(--della-ease),
		box-shadow var(--della-dur-fast) var(--della-ease);
	appearance: none;
	-webkit-appearance: none;
}

textarea {
	min-block-size: 120px;
	resize: vertical;
}

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

input:hover,
textarea:hover,
select:hover {
	border-color: var(--della-muted);
}

input:focus,
textarea:focus,
select:focus {
	outline: 0;
	border-color: var(--della-accent);
	box-shadow: 0 0 0 1px var(--della-accent);
}

/* Native select needs its own arrow back once appearance is removed. */
select {
	background-image: linear-gradient(45deg, transparent 50%, var(--della-muted) 50%),
		linear-gradient(135deg, var(--della-muted) 50%, transparent 50%);
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 14px) calc(1em + 2px);
	padding-inline-end: 36px;
	cursor: pointer;
}

/*
 * Without appearance:none the browser keeps painting its own control and
 * silently drops the border, background and ::before below — which is why
 * checkout was still showing native blue radios inside themed cards.
 */
input[type="checkbox"],
input[type="radio"] {
	-webkit-appearance: none;
	appearance: none;
	/* Belt and braces: anything that re-enables the native control (a plugin
	   resetting appearance, a form the theme has not seen) still draws in the
	   brand colour instead of browser blue. */
	accent-color: var(--della-accent);
	inline-size: 17px;
	block-size: 17px;
	min-block-size: 0;
	padding: 0;
	border: 1px solid var(--della-muted);
	background: var(--della-bg);
	cursor: pointer;
	flex: none;
	display: inline-grid;
	place-content: center;
	vertical-align: -3px;
}

input[type="radio"] {
	border-radius: 50%;
}

input[type="checkbox"]::before,
input[type="radio"]::before {
	content: "";
	inline-size: 9px;
	block-size: 9px;
	transform: scale(0);
	transition: transform var(--della-dur-fast) var(--della-ease-out);
	background: var(--della-accent);
}

input[type="radio"]::before {
	border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
	border-color: var(--della-accent);
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before {
	transform: scale(1);
}

/* Strip the browser's search decorations so the field matches the theme. */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

input[type="number"] {
	-moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

label {
	display: inline-block;
	font-size: var(--della-fs-sm);
	color: var(--della-muted);
}

fieldset {
	border: var(--della-line);
	padding: 1rem;
}

legend {
	padding-inline: 0.5em;
	font-size: var(--della-fs-sm);
	text-transform: uppercase;
	letter-spacing: var(--della-tracking);
}

/* =========================================================================
   7. Accessibility
   ========================================================================= */

/* One consistent, always-present focus ring. Nothing in this theme sets
   outline:none without putting something back. */
:focus-visible {
	outline: 2px solid var(--della-accent-alt);
	outline-offset: 2px;
	border-radius: var(--della-radius-sm);
}

/* Dark bands need a light ring to stay visible. */
.is-dark :focus-visible,
.della-footer :focus-visible,
.della-announce :focus-visible,
.della-hero__slide.is-light :focus-visible,
.della-banner.is-light :focus-visible {
	outline-color: var(--della-bg);
}

/* The WordPress standard. Present verbatim so core and plugin markup works. */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important; /* Core's own rule; some plugins set word-wrap on ancestors. */
}

.screen-reader-text:focus {
	background-color: var(--della-bg);
	clip-path: none;
	color: var(--della-heading);
	display: block;
	font-size: var(--della-fs-sm);
	font-weight: 600;
	height: auto;
	inset-inline-start: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* Skip link — off-screen until focused, then pinned to the top. */
.della-skip {
	position: fixed;
	inset-block-start: 0;
	inset-inline-start: 0;
	z-index: 1000;
	background: var(--della-accent);
	color: var(--della-accent-contrast);
	font-size: var(--della-fs-sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: var(--della-tracking);
	padding: 14px 22px;
	transform: translateY(-120%);
	transition: transform var(--della-dur) var(--della-ease-out);
}

.della-skip:focus {
	transform: translateY(0);
	color: var(--della-accent-contrast);
}

/* Comfortable thumb targets on touch screens. */
@media (max-width: 991px) {
	.della-header__tool,
	.della-header__burger,
	.della-mobilebar__item,
	.della-menu__toggle,
	.della-menu__link,
	.della-drawer__close,
	.della-modal__close,
	.della-search__close,
	.della-announce__close,
	.della-card__action,
	.della-qty__btn,
	.della-carousel__nav,
	.della-hero__nav,
	.della-tabs__tab,
	.woocommerce-pagination a,
	.woocommerce-pagination span,
	/* Buttons and the sort select are tapped as often as the icons above and
	   were sitting a couple of pixels under the 44px minimum. */
	.della-btn,
	.button,
	.woocommerce-button,
	.della-pill,
	.woocommerce-product-gallery__trigger,
	select {
		min-block-size: 44px;
		min-inline-size: 44px;
	}
}

/*
 * `hidden` must beat the display values this theme sets on drawers, panels and
 * media elements. Those live in later files with equal specificity, so source
 * order would otherwise leave every drawer permanently on screen — this is one
 * of the few places !important is the correct tool rather than a shortcut.
 */
[hidden] {
	display: none !important;
}

/* =========================================================================
   8. Motion vocabulary
   ========================================================================= */

/*
 * Scroll reveal.
 *
 * The BASE state is fully visible. Content only hides itself once PHP has put
 * .has-scroll-animations on <body> AND the JS that adds .is-visible is present,
 * so a JS failure can never leave the page blank.
 */
.della-reveal {
	opacity: 1;
	transform: none;
}

.has-scroll-animations .della-reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity var(--della-dur-slow) var(--della-ease-out),
		transform var(--della-dur-slow) var(--della-ease-out);
	will-change: opacity, transform;
}

.has-scroll-animations .della-reveal.is-visible {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* Staggered children inside one revealed block. */
.has-scroll-animations .della-reveal[data-delay="1"] { transition-delay: 0.08s; }
.has-scroll-animations .della-reveal[data-delay="2"] { transition-delay: 0.16s; }
.has-scroll-animations .della-reveal[data-delay="3"] { transition-delay: 0.24s; }
.has-scroll-animations .della-reveal[data-delay="4"] { transition-delay: 0.32s; }

@keyframes della-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes della-fade-up {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: none; }
}

@keyframes della-zoom-in {
	from { opacity: 0; transform: scale(0.96); }
	to   { opacity: 1; transform: none; }
}

@keyframes della-spin {
	to { transform: rotate(360deg); }
}

/*
 * The duration variables are already collapsed to 0s under reduce-motion by
 * inc/css-vars.php. This block covers what variables cannot: keyframe
 * animations and smooth scrolling.
 */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important; /* Overrides inline/plugin animation shorthands. */
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* =========================================================================
   9. Utilities
   ========================================================================= */

.della-icon {
	display: inline-block;
	vertical-align: middle;
	stroke: currentColor;
	fill: none;
	stroke-width: var(--della-icon-stroke);
	stroke-linecap: round;
	stroke-linejoin: round;
	/* An icon is a fixed-size object; in a flex row it must never be squashed
	   by a long, owner-edited label sitting next to it. */
	flex: none;
	/* Sub-pixel joins on a 1.5px stroke go muddy without this at 16–20px. */
	shape-rendering: geometricPrecision;
}

/*
 * Brand glyphs are single solid shapes. della_icon() already emits them with
 * fill="currentColor" stroke="none", but those are *presentation attributes*
 * and any CSS declaration beats them — so the rule above was quietly turning
 * every filled mark into a hollow outline of itself, which is exactly why the
 * WhatsApp button looked broken. Filled icons opt back out here.
 */
.della-icon--whatsapp,
.della-icon--facebook,
.della-icon--tiktok,
.della-icon--star-filled {
	fill: currentColor;
	stroke: none;
	stroke-width: 0;
}

/*
 * Optical centring. A few glyphs are drawn off the geometric centre of the
 * 24×24 viewBox, so they sit visibly low next to their neighbours in the header
 * and footer rows. The nudges below are the measured offset of each glyph's
 * bounding box from centre, expressed as a percentage of the icon box so they
 * hold at every rendered size (16px in the fit note, 20px in the header, 26px
 * in the FAB). Icons already centred within half a unit are left alone.
 */
.della-icon--heart {
	transform: translateY(-6.3%); /* bbox centre y = 13.52 of 24 */
}

.della-icon--truck {
	transform: translateY(-5.4%); /* bbox centre y = 13.30 */
}

.della-icon--pin {
	transform: translateY(-4.2%); /* bbox centre y = 13.00 */
}

.della-icon--phone {
	transform: translate(2.1%, 6.2%); /* bbox centre = 11.49, 10.51 */
}

/* Dark bands invert the palette wholesale. */
.is-dark {
	background: var(--della-footer-bg);
	color: var(--della-footer-text);
}

.is-dark h1,
.is-dark h2,
.is-dark h3,
.is-dark h4,
.is-dark h5,
.is-dark h6,
.is-dark strong {
	color: var(--della-bg);
}

.is-surface {
	background: var(--della-surface);
}

/* =========================================================================
   10. RTL — physical-property exceptions only
   Everything else in this theme is written with logical properties and mirrors
   on its own. These are the cases with no logical equivalent.
   ========================================================================= */

[dir="rtl"] {
	/* Arabic needs more leading than Latin at the same size. */
	line-height: 1.9;
	--della-slide-end: -100%;
	--della-slide-start: 100%;
}

[dir="rtl"] body,
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select,
[dir="rtl"] button {
	font-family: var(--della-font-arabic);
	line-height: 1.9;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] .della-logo__text {
	font-family: var(--della-font-arabic);
	line-height: 1.45;
}

[dir="rtl"] .della-prose {
	line-height: 2;
}

/* Directional glyphs must point the other way. */
[dir="rtl"] .della-icon--chevron-right,
[dir="rtl"] .della-icon--chevron-left,
[dir="rtl"] .della-icon--arrow-right,
[dir="rtl"] .della-icon--arrow-left {
	transform: scaleX(-1);
}

/* background-position has no logical form. */
[dir="rtl"] select {
	background-position: calc(0% + 14px) calc(1em + 2px), calc(0% + 20px) calc(1em + 2px);
}

/* box-shadow X offsets have no logical form. */
[dir="rtl"] .della-drawer {
	box-shadow: 8px 0 40px rgba(var(--della-text-rgb), 0.14);
}

/* transform-origin takes physical corners, so the sweep and the nav underline
   have to be told which corner "the far end" is in Arabic. */
[dir="rtl"] .della-btn::before {
	transform-origin: 0 100%;
}

[dir="rtl"] .della-menu__link > span::after {
	transform-origin: 100% 50%;
}
