/**
 * Base — reset, elements, layout primitives, buttons, a11y.
 * Mobile-first. Depends on tokens.css.
 */

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--ds-header-h) + var(--ds-space-md));
}

body {
	min-height: 100vh;
	background-color: var(--ds-bg);
	color: var(--ds-fg);
	font-family: var(--ds-font-body);
	font-size: var(--ds-fs-body);
	line-height: var(--ds-lh-body);
	font-synthesis: none;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Mobile only: tighten flow-text line-height slightly (the shared
   --ds-lh-body token itself is untouched, so desktop keeps its airier
   1.65). Headings are unaffected — they already set their own explicit
   line-height (--ds-lh-snug/--ds-lh-tight) which takes precedence over this
   inherited body value. */
@media (max-width: 48em) {
	body {
		line-height: 1.5;
	}
}

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

svg {
	fill: currentColor;
}

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

button {
	cursor: pointer;
	background: none;
	border: none;
}

a {
	color: var(--ds-accent);
	text-decoration: none;
	transition: color var(--ds-dur-fast) var(--ds-ease);
}

a:hover {
	color: var(--ds-oxblood-deep);
}

ul,
ol {
	list-style: none;
	padding: 0;
}

/* ---- Headings ------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--ds-heading);
	font-family: var(--ds-font-display);
	font-weight: 500;
	line-height: var(--ds-lh-snug);
	letter-spacing: -0.01em;
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* ---- Layout: shell -------------------------------------------------------- */
.ds-shell {
	width: 100%;
	max-width: var(--ds-shell-max);
	margin-inline: auto;
	padding-inline: var(--ds-shell-pad);
}

.ds-main {
	display: block;
}

/* ---- Reusable eyebrow label ---------------------------------------------- */
.ds-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--ds-space-xs);
	font-family: var(--ds-font-mono);
	font-size: var(--ds-fs-eyebrow);
	font-weight: var(--ds-fw-label);
	letter-spacing: var(--ds-ls-wide);
	text-transform: uppercase;
	color: var(--ds-accent);
}

/* ---- Reusable gold-underline hover utility --------------------------------
   Apply to a text span inside any link/card. If the hoverable element is an
   ancestor (e.g. the whole card), the caller adds one rule targeting
   `.ancestor:hover .ds-link-underline::after { width: 100% }` — see
   featured-collections.css for an example. */
.ds-link-underline {
	position: relative;
	display: inline-block;
}

.ds-link-underline::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 2px;
	background-color: var(--ds-gold);
	transition: width var(--ds-dur) var(--ds-ease);
}

.ds-link-underline:hover::after,
.ds-link-underline:focus-visible::after {
	width: 100%;
}

/* ---- Buttons ----------------------------------------------------------------
   .ds-btn is the single source of truth for button sizing/spacing across the
   theme — variants (primary/gold/ghost/block) only swap the --_bg/--_fg/--_bd
   custom properties above, never padding/height/radius/font-size, so every
   button stays proportional. Other components (footer, forms) should apply
   this class rather than declaring their own padding. */
.ds-btn {
	--_bg: var(--ds-oxblood);
	--_fg: var(--ds-on-accent);
	--_bd: var(--ds-oxblood);

	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ds-space-xs);
	padding: 0.7em 1.3em;
	border: 1px solid var(--_bd);
	border-radius: var(--ds-radius-pill);
	background-color: var(--_bg);
	color: var(--_fg);
	font-size: var(--ds-fs-button);
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1;
	text-align: center;
	transition:
		transform var(--ds-dur-fast) var(--ds-ease),
		background-color var(--ds-dur) var(--ds-ease),
		color var(--ds-dur) var(--ds-ease),
		box-shadow var(--ds-dur) var(--ds-ease);
}

.ds-btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--ds-shadow-md);
	color: var(--_fg);
}

.ds-btn:active {
	transform: translateY(0);
}

.ds-btn--primary {
	--_bg: var(--ds-oxblood);
	--_fg: var(--ds-on-accent);
	--_bd: var(--ds-oxblood);
}

.ds-btn--primary:hover {
	--_bg: var(--ds-oxblood-deep);
}

.ds-btn--gold {
	--_bg: var(--ds-gold);
	--_fg: var(--ds-ink);
	--_bd: var(--ds-gold);
}

.ds-btn--ghost {
	--_bg: transparent;
	--_fg: var(--ds-ink);
	--_bd: var(--ds-line-strong);
}

.ds-btn--ghost:hover {
	--_bg: var(--ds-ink);
	--_fg: var(--ds-paper);
	--_bd: var(--ds-ink);
}

.ds-btn--block {
	width: 100%;
}

/* ---- Icon button ---------------------------------------------------------- */
.ds-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: var(--ds-radius-md);
	color: var(--ds-ink);
	transition:
		background-color var(--ds-dur-fast) var(--ds-ease),
		color var(--ds-dur-fast) var(--ds-ease);
}

.ds-iconbtn:hover {
	background-color: var(--ds-oxblood-tint);
	color: var(--ds-oxblood);
}

/* ---- Accessibility: skip link & SR-only ----------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ds-skip-link {
	position: fixed;
	top: var(--ds-space-xs);
	left: var(--ds-space-xs);
	z-index: var(--ds-z-toast);
	padding: 0.75em 1.25em;
	border-radius: var(--ds-radius-md);
	background-color: var(--ds-ink);
	color: var(--ds-paper);
	font-weight: 600;
	transform: translateY(-150%);
	transition: transform var(--ds-dur) var(--ds-ease);
}

.ds-skip-link:focus {
	transform: translateY(0);
	color: var(--ds-paper);
}

/* ---- Focus visibility ----------------------------------------------------- */
:focus-visible {
	outline: 2px solid var(--ds-focus);
	outline-offset: 2px;
	border-radius: 3px;
}

/* ---- Body scroll lock (mobile drawer / search open) ----------------------- */
.ds-body.is-locked {
	overflow: hidden;
}

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}
