/**
 * Horta Purper - foundation stylesheet (M1).
 *
 * Tokens, base/reset, typography, layout, utilities, header, topline,
 * navigation (desktop + mobile), footer, base buttons/forms, accessibility.
 * Values are ported faithfully from the approved prototype (styles.css).
 * WooCommerce / checkout / component styles arrive in later milestones.
 */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
	--color-primary: #254a33;
	--color-primary-dark: #183722;
	--color-sage: #eaf0e5;
	--color-accent-lime: #accf65;
	--color-paper: #ffffff;
	--color-surface-soft: #f6f8f3;
	--color-text: #20352b;
	--color-muted: #57675b;
	--color-border: #dce4d9;
	--focus-ring: #a4bd57;
	--scrollbar-thumb: #899c87;
	--scrollbar-track: #f6f8f3;

	/* Colours used over the green surfaces (story/footer) in the prototype. */
	--color-on-green-soft: #bfd6ae;
	--color-on-green-icon: #c7dbb5;
	--color-on-green-muted: #d2dfc7;
	--color-on-green-border: rgba(255, 255, 255, 0.15);
	--color-on-green-surface: rgba(255, 255, 255, 0.03);

	--font-display: "Fraunces", Georgia, serif;
	--font-body: "DM Sans", Arial, Helvetica, sans-serif;

	--radius: 12px;
	--radius-button: 7px;
	--radius-input: 8px;

	--container: min(1180px, calc(100% - 80px));
}

/* ==========================================================================
   2. Reset / base
   ========================================================================== */
*,
*::before,
*::after {
	box-sizing: border-box;
	scrollbar-width: thin;
	scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: 24px;
}

body {
	margin: 0;
	background: var(--color-paper);
	color: var(--color-text);
	font: 16px/1.6 var(--font-body);
}

[hidden] {
	display: none !important;
}

a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
	text-underline-offset: 5px;
}

button,
input,
select,
textarea {
	font: inherit;
}

button,
a,
select {
	touch-action: manipulation;
}

button,
a {
	cursor: pointer;
}

button {
	color: inherit;
	border: 0;
	background: transparent;
}

button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

img {
	max-width: 100%;
	height: auto;
}

svg {
	width: 24px;
	height: 24px;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex-shrink: 0;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */
h1,
h2,
h3,
p,
figure {
	margin: 0;
}

h1,
h2,
h3 {
	line-height: 1.12;
}

h1,
h2 {
	font-family: var(--font-display);
	font-weight: 500;
	letter-spacing: -1.6px;
}

h1 {
	font-size: clamp(40px, 4.8vw, 66px);
}

h2 {
	font-size: clamp(28px, 3.1vw, 40px);
}

h3 {
	font-size: 20px;
	letter-spacing: -0.4px;
}

.section-label {
	font-size: 11px;
	letter-spacing: 1.6px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--color-muted);
	margin-bottom: 12px;
}

.small {
	font-size: 13px;
	color: var(--color-muted);
}

/* ==========================================================================
   4. Layout
   ========================================================================== */
.wrap {
	width: var(--container);
	margin-inline: auto;
}

.site-main {
	padding-top: 40px;
	padding-bottom: 60px;
}

/* ==========================================================================
   5. Buttons (base)
   ========================================================================== */
.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: var(--color-primary);
	color: #fff;
	padding: 13px 21px;
	border-radius: var(--radius-button);
	min-height: 48px;
	font-weight: 600;
	font-size: 14px;
	transition: background 0.15s ease;
}

.button:hover {
	background: var(--color-primary-dark);
	text-decoration: none;
	color: #fff;
}

.button.light {
	background: var(--color-sage);
	color: var(--color-primary);
}

.button.light:hover {
	background: #d8e5ce;
}

.button.full {
	width: 100%;
}

/* ==========================================================================
   6. Forms (base)
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-input);
	background: #fff;
	color: var(--color-text);
	min-height: 44px;
	padding: 10px 12px;
	width: 100%;
}

label {
	font-size: 14px;
}

/* ==========================================================================
   7. Topline
   ========================================================================== */
.topline {
	background: var(--color-sage);
	font-size: 12px;
}

.topline .wrap {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-block: 8px;
	gap: 12px;
}

.topline a {
	font-weight: 700;
}

/* ==========================================================================
   8. Header + branding
   ========================================================================== */
.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 105px;
	gap: 28px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 9px;
	white-space: nowrap;
	color: var(--color-primary);
}

.brand-mark,
.brand .custom-logo {
	width: 41px;
	height: 35px;
	flex-shrink: 0;
	object-fit: contain;
}

.brand-name {
	font: 500 26px var(--font-display);
	letter-spacing: -1px;
	color: var(--color-primary);
}

/* ==========================================================================
   9. Navigation (desktop)
   ========================================================================== */
.primary-nav-list {
	display: flex;
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 14px;
}

.primary-nav-list a {
	display: inline-block;
	padding: 10px 0;
}

.primary-nav-list .current-menu-item > a,
.primary-nav-list a[aria-current="page"] {
	color: var(--color-primary);
	box-shadow: 0 2px var(--color-primary);
	font-weight: 700;
}

/* Toggle is only meaningful on mobile; hidden until JS enhances the nav. */
.nav-toggle {
	display: none;
	width: 44px;
	height: 44px;
	align-items: center;
	justify-content: center;
	margin-left: auto;
	border-radius: var(--radius-button);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
	content: "";
	display: block;
	width: 22px;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.nav-toggle-bars::before {
	transform: translateY(-7px);
}

.nav-toggle-bars::after {
	transform: translateY(5px);
}

.nav-toggle.is-active .nav-toggle-bars {
	background: transparent;
}

.nav-toggle.is-active .nav-toggle-bars::before {
	transform: translateY(0) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bars::after {
	transform: translateY(-2px) rotate(-45deg);
}

/* ==========================================================================
   10. Cart / bag indicator
   ========================================================================== */
.bag-button {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 12px 0;
	min-height: 44px;
	color: inherit;
}

.bag-button:hover {
	text-decoration: none;
}

.bag-label {
	font-size: 14px;
}

.cart-count {
	background: var(--color-sage);
	border-radius: 100%;
	min-width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
}

/* Header actions: account entry + cart, grouped at the end of the header. */
.header-actions {
	display: flex;
	align-items: center;
	gap: 20px;
}

.account-button {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 12px 0;
	min-height: 44px;
	color: inherit;
}

.account-button:hover {
	text-decoration: none;
	color: var(--color-primary);
}

.account-button svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.account-label {
	font-size: 14px;
}

/* ==========================================================================
   11. Footer
   ========================================================================== */
.site-footer {
	background: var(--color-primary);
	color: #fff;
}

.footer-main {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 38px;
	padding-bottom: 28px;
	gap: 25px;
}

.footer-brand {
	display: flex;
	align-items: center;
	gap: 7px;
	font: 500 27px var(--font-display);
	color: #fff;
}

.footer-brand .brand-mark {
	width: 33px;
	height: 28px;
	filter: brightness(0) invert(1);
}

.footer-nav-list {
	display: flex;
	gap: 25px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
	flex-wrap: wrap;
}

.footer-bottom {
	display: flex;
	justify-content: space-between;
	border-top: 1px solid var(--color-on-green-border);
	padding-top: 20px;
	padding-bottom: 25px;
	font-size: 11px;
	color: var(--color-on-green-muted);
	gap: 18px;
}

/* ==========================================================================
   12. Accessibility utilities
   ========================================================================== */
.screen-reader-text,
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: 16px;
	top: -100px;
	z-index: 100;
	background: #fff;
	color: var(--color-text);
	padding: 14px;
	border-radius: var(--radius-button);
}

.skip-link:focus {
	top: 10px;
	width: auto;
	height: auto;
	clip: auto;
	clip-path: none;
}

:focus-visible {
	outline: 3px solid var(--focus-ring);
	outline-offset: 4px;
}

.toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-primary);
	color: #fff;
	padding: 12px 22px;
	border-radius: var(--radius-input);
	box-shadow: 0 5px 24px rgba(0, 0, 0, 0.12);
	font-size: 14px;
	z-index: 10;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
	width: max-content;
	max-width: 90vw;
}

.toast.is-visible {
	opacity: 1;
}

/* ==========================================================================
   13. Responsive
   ========================================================================== */
@media (max-width: 1000px) {
	:root {
		--container: calc(100% - 48px);
	}

	.brand-name {
		display: none;
	}

	.primary-nav-list {
		gap: 22px;
	}

	.footer-main {
		align-items: flex-start;
	}

	.footer-nav-list {
		justify-content: flex-end;
	}
}

@media (max-width: 650px) {
	:root {
		--container: calc(100% - 36px);
	}

	.topline {
		font-size: 10px;
	}

	.site-header {
		height: auto;
		min-height: 112px;
		flex-wrap: wrap;
		gap: 0;
		padding-top: 10px;
		padding-bottom: 12px;
	}

	.brand {
		gap: 6px;
	}

	.brand-mark,
	.brand .custom-logo {
		width: 33px;
		height: 28px;
	}

	.brand-name {
		display: block;
		font-size: 21px;
	}

	.nav-toggle {
		display: inline-flex;
		color: var(--color-primary);
	}

	.bag-label {
		display: none;
	}

	/* Account + cart share the top row next to the toggle; account stays
	   reachable without hover and never depends on the collapsed menu. */
	.header-actions {
		order: 2;
		gap: 12px;
	}

	.bag-button {
		order: 0;
	}

	.account-label {
		font-size: 12px;
	}

	.primary-nav {
		order: 3;
		width: 100%;
	}

	.primary-nav-list {
		flex-wrap: wrap;
		width: 100%;
		justify-content: space-between;
		gap: 10px;
		row-gap: 6px;
		font-size: 12px;
		margin-top: 9px;
	}

	.primary-nav-list a {
		padding: 8px 0;
	}

	/* When JS is present, the mobile menu collapses behind the toggle. */
	.has-js-nav .primary-nav {
		display: none;
	}

	.has-js-nav .primary-nav.is-open {
		display: block;
	}

	.footer-main {
		flex-direction: column;
		padding-top: 30px;
		gap: 25px;
	}

	.footer-nav-list {
		justify-content: flex-start;
		gap: 18px;
		font-size: 12px;
	}

	.footer-bottom {
		flex-direction: column;
		gap: 18px;
		font-size: 10px;
	}
}

/* ==========================================================================
   14. Motion / forced colors
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}

@media (forced-colors: active) {
	* {
		scrollbar-color: auto;
	}

	.button {
		border: 1px solid ButtonText;
	}
}
