/*
 * Reset, typography and the layout helpers every page shares.
 * Component styles live in their own files — see functions.php for what loads
 * where, and the README for why a shared component must not sit in a
 * page-scoped stylesheet.
 */

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

img,
video {
	height: auto;
}

a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

button {
	font: inherit;
	color: inherit;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-body);
	font-weight: 500;
	line-height: 1.25;
}

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

/*
 * The hidden attribute, restored.
 *
 * The UA stylesheet's `[hidden] { display: none }` is a bare attribute
 * selector, so any class rule that sets `display` outruns it — and the
 * carousel arrows, the drawer panels and the cart panel all set one. That
 * silently turns `el.hidden = true` into a no-op: the arrows on a rail with
 * nothing to scroll were still appearing on hover.
 *
 * Declared once, here, so every component's `hidden` means hidden.
 */
[hidden] {
	display: none !important;
}

.container {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

.icon {
	display: block;
	width: 20px;
	height: 20px;
}

/* Accessibility helpers (the class names WordPress and WooCommerce use). */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	border: 0;
	word-wrap: normal !important;
}

.skip-link:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 1000;
	width: auto;
	height: auto;
	padding: 10px 16px;
	clip: auto;
	clip-path: none;
	background: var(--color-navy);
	color: var(--color-white);
	font-size: 14px;
}

/* Page titles: centred, with air above and below, as the design sets them. */
.page-title {
	margin: 0;
	padding-block: var(--page-title-gap);
	font-family: var(--font-heading);
	font-size: var(--fs-page-title);
	font-weight: 400;
	letter-spacing: 0.06em;
	text-align: center;
	text-transform: uppercase;
}

/*
 * WooCommerce pages take the container's full width.
 *
 * index.php renders a page inside `.entry__content`, which footer.css caps at
 * 760px because prose reads badly wider than that. The cart, the checkout and
 * the account page are two-column layouts, not prose, and the cap quietly
 * squeezed each of them into a 760px column in the middle of the page.
 *
 * Scoped by body class rather than named as one: a bare `.woocommerce-cart {}`
 * would style the whole document, which is the trap that shrank every search
 * page in the supplement theme.
 */
.woocommerce-cart .entry__content,
.woocommerce-checkout .entry__content,
.woocommerce-account .entry__content {
	max-width: none;
}

/* The line under a page title — the cart's "1 Product" — with the hairline
   the reference draws across the page beneath it. */
.page-subtitle {
	margin: -28px 0 34px;
	padding-block-end: 20px;
	border-block-end: 1px solid var(--color-border-light);
	color: var(--color-text-muted);
	font-size: 14px;
	text-align: center;
}

.site-main {
	min-height: 40vh;
}

/*
 * Buttons. Site-wide, because the footer's sign-up, the cart panel's checkout
 * and the shop's filters are the same object — a page-scoped copy would render
 * unstyled everywhere else.
 *
 * The design's button is a wide, flat, letterspaced rectangle: no radius, no
 * shadow, uppercase at a small size.
 */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 12px 30px;
	border: 0;
	background: var(--color-charcoal);
	color: var(--color-white);
	font-family: var(--font-body);
	/* 14px / 600, the size and weight measured off the reference. Jost carries
	   more colour than the licensed face at the same weight, so 600 rather
	   than the 700 the original sets. */
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.11em;
	line-height: 1.2;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
	background: var(--color-ink);
	color: var(--color-white);
}

/* The loud variant: the charcoal slab the account page and checkout use. */
.btn--dark {
	background: var(--color-charcoal);
	color: var(--color-white);
}

.btn--dark:hover {
	background: var(--color-ink);
	color: var(--color-white);
}

/* The quiet variant: a grey slab with dark text, as the footer draws it. */
.btn--muted {
	background: var(--color-border);
	color: var(--color-ink);
}

.btn--muted:hover {
	background: #cfcfcf;
	color: var(--color-ink);
}

/* WooCommerce's breadcrumb, styled to the design's quiet grey trail. */
.woocommerce-breadcrumb {
	margin: 0 0 6px;
	padding-block-start: 18px;
	color: var(--color-text-muted);
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.woocommerce-breadcrumb a {
	color: var(--color-text-muted);
	text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
	color: var(--color-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/*
 * WooCommerce notices. Site-wide, not on the account stylesheet: the same
 * markup carries errors on cart, checkout and the product page, and a
 * page-scoped copy would leave them unstyled everywhere else.
 */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
	margin: 0 auto 26px;
	max-width: 760px;
	/*
	 * WooCommerce pads 3.5em on the left to clear an icon drawn from its own
	 * icon font, and puts a 3px purple rule along the top. Both are replaced
	 * here — a coloured rule down the side, and no icon — so the padding goes
	 * back to something even. The theme's stylesheets load after WooCommerce's,
	 * so equal specificity is enough.
	 */
	padding: 14px 18px;
	border: 0;
	border-inline-start: 3px solid var(--color-navy);
	background: var(--color-surface);
	color: var(--color-ink);
	font-size: 15px;
	line-height: 1.5;
	list-style: none;
}

/*
 * WooCommerce gives a notice tabindex="-1" and focuses it so a screen reader
 * announces the error. Chrome treats that programmatic focus as :focus-visible
 * and draws the theme's 2px ring, which reads as a second border around the
 * box. The element takes no keyboard interaction — it is focused only to be
 * spoken — so there is nothing for a focus indicator to indicate.
 */
.woocommerce-error:focus,
.woocommerce-message:focus,
.woocommerce-info:focus,
.woocommerce-error:focus-visible,
.woocommerce-message:focus-visible,
.woocommerce-info:focus-visible {
	outline: none;
}

/* The icon is from WooCommerce's font and is off-brand; the coloured rule
   already says which kind of notice this is. */
.woocommerce-error::before,
.woocommerce-message::before,
.woocommerce-info::before {
	display: none;
}

.woocommerce-error {
	border-inline-start-color: var(--color-accent);
}

.woocommerce-message {
	border-inline-start-color: #5d7a3a;
}

.woocommerce-error li + li,
.woocommerce-message li + li {
	margin-block-start: 6px;
}

.woocommerce-error a,
.woocommerce-message a,
.woocommerce-info a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* WooCommerce puts its own button class on the notice's action link. */
.woocommerce-message .button,
.woocommerce-info .button {
	float: inline-end;
	margin-inline-start: 16px;
}

/*
 * Hover captions.
 *
 * On a pointer that can hover, a photograph darkens to 50% black and shows its
 * title in the serif, centred — the reference's treatment on every titled
 * image (the department tiles, the seasonal row, the feature cards, the
 * lookbooks). Site-wide, because the same treatment appears on the home page
 * and on the content pages.
 *
 * The caption is decorative: the title is always also in the document as a
 * visible label or heading next to the image, so it is aria-hidden where it is
 * used. Touch screens never see it — there is no hover to reveal it with, and
 * a first tap that only shows a caption would feel broken.
 */
.photo-hover {
	position: relative;
	display: block;
	overflow: hidden;
}

.photo-hover__caption {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px;
	background: rgba(0, 0, 0, 0.5);
	color: var(--color-white);
	font-family: var(--font-heading);
	font-size: clamp(18px, 2.2vw, 32px);
	font-weight: 400;
	line-height: 1.15;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

@media (hover: hover) {
	.photo-hover:hover .photo-hover__caption,
	.photo-hover-group:hover .photo-hover__caption,
	.photo-hover:focus-visible .photo-hover__caption {
		opacity: 1;
	}

	/* The label under the photograph underlines with it, as on the reference. */
	.photo-hover-group:hover .photo-hover-label {
		text-decoration: underline;
		text-underline-offset: 4px;
	}
}

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