/**
 * ZAI COFFEE — Modern reset
 * -----------------------------------------------------------------------------
 * Accessible, opinionated baseline. Sets no brand colours; only structural
 * defaults and sensible pre-token fallbacks.
 *
 * @package zaicoffeetheme
 * @since   1.0.0
 */

/* Use a predictable box model everywhere. */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* Kill default margins so layout is explicit. */
* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Prevent iOS Safari from inflating text in landscape. */
	-moz-text-size-adjust: 100%;
}

/* Respect the user's reduced-motion preference globally. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 1ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 1ms !important;
		scroll-behavior: auto !important;
	}
}

body {
	min-height: 100vh;
	/* Better font rendering on macOS. */
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Never synthesise faked bold/italic for the display face. */
	font-synthesis: none;
	text-rendering: optimizeLegibility;
	/* Prevent long words from overflowing narrow viewports. */
	overflow-wrap: break-word;
}

/* Media defaults: never overflow their container. */
img,
picture,
video,
canvas,
svg,
iframe,
embed,
object {
	display: block;
	max-width: 100%;
}

img,
video {
	height: auto;
}

/*
 * SVG fills.
 *
 * CRITICAL — do not reintroduce `svg { fill: currentColor }`.
 *
 * A CSS declaration outranks a presentation attribute, so a blanket
 * `fill: currentColor` overrides the `fill="none"` attribute that every outline
 * icon in this theme relies on. All 22 icons then render as SOLID FILLED BLOBS
 * instead of clean line art — which is exactly why an earlier phase expanded the
 * icon registry but the icons still looked unchanged on screen.
 *
 * The theme's icon set is stroke-based, so the baseline for inline SVG is
 * `fill: none`. Filled details inside an icon (for instance the dot on the
 * Instagram glyph) declare `fill="currentColor"` as a PRESENTATION ATTRIBUTE on
 * that specific element, which still works because no CSS rule targets it.
 *
 * `.zai-icon` restates both properties so icons stay correct even when a
 * third-party stylesheet applies a different `svg` default.
 */
svg {
	fill: none;
}

.zai-icon {
	display: inline-block;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	vertical-align: middle;
	/* The attribute sets the geometry; this keeps the box predictable. */
	overflow: visible;
}

/* Remove the tiny gap under replaced inline elements. */
img {
	vertical-align: middle;
}

/* Forms inherit typography — critical for consistent UI text. */
input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/* Buttons and labels must never select text on double tap. */
button,
[type="button"],
[type="submit"],
[type="reset"],
label {
	touch-action: manipulation;
}

textarea {
	resize: vertical;
}

/* Tables collapse predictably. */
table {
	border-collapse: collapse;
	border-spacing: 0;
	width: 100%;
}

/* Lists keep semantics but lose default markers when used as layout. */
ul[role="list"],
ol[role="list"] {
	list-style: none;
	padding: 0;
}

/* Headings and paragraphs stay balanced/unbroken where supported. */
h1,
h2,
h3,
h4,
h5,
h6 {
	text-wrap: balance;
	font-size: inherit;
	font-weight: inherit;
}

p {
	text-wrap: pretty;
}

/* Long-form content links should wrap rather than overflow. */
a {
	overflow-wrap: break-word;
	text-decoration-skip-ink: auto;
}

/* Respect scroll anchoring for dynamic content such as cart fragments. */
[hidden] {
	display: none !important;
}

/* Prevent the "double-tap to zoom" delay on touch devices. */
a,
area,
button,
input,
label,
select,
summary,
textarea {
	touch-action: manipulation;
}

/* Numerals stay aligned in prices and quantities. */
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
table,
[data-numeric] {
	font-variant-numeric: tabular-nums;
}

/*
 * Focus policy.
 * Native outlines are replaced by a high-contrast token ring, applied only for
 * keyboard users so pointer interactions stay visually quiet.
 */
:focus {
	outline: none;
}

:focus-visible {
	outline: var(--zai-focus-width, 2px) solid var(--zai-focus-color, currentColor);
	outline-offset: var(--zai-focus-offset, 2px);
}

/* Never suppress focus outlines on elements that require them. */
[tabindex="-1"]:focus-visible {
	outline: none;
}

/* Reduce the chance of layout shift from scrollbars. */
html {
	scrollbar-gutter: stable;
}

/* Selection uses a brand tint rather than the browser default blue. */
::selection {
	background-color: var(--zai-green-soft);
	color: var(--zai-text);
}

/* WordPress alignment primitives must not cause overflow. */
.alignleft {
	float: left;
	margin-inline-end: 1.5rem;
	margin-block: 0 1rem;
}

.alignright {
	float: right;
	margin-inline-start: 1.5rem;
	margin-block: 0 1rem;
}

.aligncenter {
	margin-inline: auto;
}

.alignwide,
.alignfull {
	clear: both;
}
