/*
 * Aspire Shop — base layer.
 * Reset, elements, layout primitives, header/footer, buttons, forms.
 * Everything here reads from tokens.css.
 */

/* --- Reset ------------------------------------------------------------- */

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd { margin: 0; }

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

body {
	font-family: var(--font-body);
	font-size: var(--fs-base);
	line-height: var(--lh-body);
	color: var(--c-body);
	background: var(--c-surface);
	-webkit-font-smoothing: antialiased;
}

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

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

/* --- Typography -------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-head);
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
	color: var(--c-ink);
	text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p, ul, ol, table, figure, blockquote { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--c-accent-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--c-brand); }

:focus-visible {
	outline: 2px solid var(--c-accent);
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: var(--sp-4);
	top: -100%;
	z-index: 100;
	padding: var(--sp-2) var(--sp-4);
	background: var(--c-brand);
	color: #fff;
	border-radius: 0 0 var(--radius) var(--radius);
	text-decoration: none;
}
.skip-link:focus { top: 0; color: #fff; }

/* --- Layout ------------------------------------------------------------ */

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

.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
.site-main { flex: 1 0 auto; padding-block: var(--sp-6); }

@media (min-width: 768px) {
	.site-main { padding-block: var(--sp-7); }
	h1 { font-size: var(--fs-4xl); }
}

/* --- Header ------------------------------------------------------------ */

.site-header {
	/* No bottom rule: every page opens with a hero block, which does the separating. */
	background: var(--c-surface);
}

.site-header__inner {
	display: flex;
	align-items: center;
	/* Lets the full-width nav panel drop onto its own line under the bar on mobile. */
	flex-wrap: wrap;
	gap: var(--sp-3);
	padding-block: var(--sp-3);
	min-height: 72px;
}

@media (min-width: 768px) {
	.site-header__inner {
		padding-block: var(--sp-4);
		min-height: 84px;
	}
}

.site-branding { margin-right: auto; flex: 0 1 auto; min-width: 0; }
.site-branding a { text-decoration: none; color: var(--c-ink); }

/*
 * Institutions upload logos at whatever size they have, so the header constrains by
 * height and lets width follow — a wide wordmark and a square crest both sit correctly.
 */
.site-logo { display: block; }
.site-logo img,
.custom-logo {
	width: auto;
	height: auto;
	max-width: min(var(--logo-max-w), 100%);
	max-height: var(--logo-max-h);
	object-fit: contain;
}

/* Don't let the branding column be squeezed by the nav on narrow screens. */
.site-branding { min-width: 0; }
.site-title {
	font-size: var(--fs-xl);
	font-weight: var(--fw-bold);
	letter-spacing: -0.01em;
}
.site-description {
	font-size: var(--fs-xs);
	color: var(--c-muted);
}

.nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	background: none;
	border: 1px solid var(--c-line);
	border-radius: var(--radius-sm);
	cursor: pointer;
}
.nav-toggle:hover { background: var(--c-surface-alt); }

/*
 * Mobile ordering: logo, then the shop actions, with the menu button last on the right.
 * Set with `order` rather than by moving the markup, so the tab order still runs
 * logo → account → basket → menu → the panel the button opens.
 */
.site-branding { order: 1; }
.site-actions  { order: 2; }
.nav-toggle    { order: 3; margin-left: var(--sp-2); }
.primary-nav   { order: 4; }

/* Drawn in CSS rather than a glyph so it renders identically everywhere. */
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--c-ink);
	border-radius: 2px;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: "";
	position: absolute;
	left: 0;
}
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

.primary-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.primary-nav a {
	display: block;
	padding: var(--sp-2) 0;
	color: var(--c-ink);
	text-decoration: none;
	font-weight: var(--fw-medium);
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a { color: var(--c-accent-dark); }

/*
 * Top-level items get a rule that grows from the left on hover. Drawn as a pseudo-element
 * rather than text-decoration so it can animate and sit clear of the descenders.
 */
.primary-nav > ul > .menu-item > a,
.primary-nav .menu-item__toggle {
	position: relative;
	font-size: var(--fs-sm);
	letter-spacing: 0.01em;
}

.primary-nav > ul > .menu-item > a::after,
.primary-nav .menu-item__toggle::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: var(--c-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--transition);
}

.primary-nav > ul > .menu-item > a:hover::after,
.primary-nav > ul > .current-menu-item > a::after,
.menu-item-has-children:hover .menu-item__toggle::after,
.menu-item-has-children.is-open .menu-item__toggle::after { transform: scaleX(1); }

/* --- Nav submenus -------------------------------------------------------- */

.menu-item__toggle {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	width: 100%;
	padding: var(--sp-2) 0;
	background: none;
	border: 0;
	border-radius: 0;
	color: var(--c-ink);
	font-weight: var(--fw-medium);
	text-align: left;
	cursor: pointer;
	/* Beats justify-content:center inherited from the generic button rule. */
	justify-content: flex-start;
}
.menu-item__toggle:hover { background: none; color: var(--c-accent-dark); }

/*
 * Chevron drawn from two borders on a rotated square, so it inherits the text colour
 * and needs no icon. Rotating to -135deg flips it to point up when open.
 */
.menu-item__caret {
	width: 7px;
	height: 7px;
	margin-top: -3px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--transition), margin-top var(--transition);
}
.menu-item-has-children.is-open .menu-item__caret {
	margin-top: 2px;
	transform: rotate(-135deg);
}

.primary-nav .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 var(--sp-2) var(--sp-4);
}

/* Mobile: the submenu is a nested list, revealed in flow. */
.menu-item-has-children .sub-menu { display: none; }
.menu-item-has-children.is-open .sub-menu { display: block; }

/* Mobile: nav collapses under the bar as a full-width panel. */
.primary-nav {
	display: none;
	width: 100%;
	margin-top: var(--sp-2);
	padding: var(--sp-3) 0 var(--sp-4);
	border-top: 1px solid var(--c-line);
}
.primary-nav.is-open { display: block; }

@media (max-width: 1023px) {
	/* Roomier tap targets, each row separated so the list scans as a menu. */
	.primary-nav > ul > .menu-item { border-bottom: 1px solid var(--c-line); }
	.primary-nav > ul > .menu-item:last-child { border-bottom: 0; }

	.primary-nav > ul > .menu-item > a,
	.primary-nav .menu-item__toggle {
		padding-block: var(--sp-3);
		font-size: var(--fs-base);
	}

	/* The growing rule is a desktop affordance; on touch it just flashes. */
	.primary-nav > ul > .menu-item > a::after,
	.primary-nav .menu-item__toggle::after { display: none; }

	.primary-nav .menu-item__toggle { justify-content: space-between; }
	.primary-nav .sub-menu { padding-bottom: var(--sp-3); }
	.primary-nav .sub-menu a { color: var(--c-body); }
}

/* --- Header actions (account + basket) --------------------------------- */

.site-actions {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
}

.site-action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: 1px solid var(--c-line);
	border-radius: 50%;
	color: var(--c-ink);
	text-decoration: none;
	transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.site-action:hover {
	border-color: var(--c-accent);
	background: var(--c-surface-alt);
	color: var(--c-accent-dark);
}

.site-action__icon {
	width: 21px;
	height: 21px;
	fill: currentColor;
}

/*
 * Item counter, sitting on the edge of the bag circle. Fixed width and height with no
 * padding so it stays a true circle rather than stretching to a pill — a three-digit
 * basket is not a case worth distorting the shape for.
 */
.site-action__count {
	position: absolute;
	top: -3px;
	right: -3px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 2px solid var(--c-surface);
	border-radius: 50%;
	background: var(--c-accent);
	color: #fff;
	font-size: 11px;
	font-weight: var(--fw-semibold);
	line-height: 1;
}

/* --- Platform landing header -------------------------------------------- */

/*
 * The main site sells nothing, so it carries no nav, basket or account — just the mark
 * on a dark bar, which lets the directory below open like a landing page.
 */
.site-header--platform {
	background: var(--c-brand-dark);
	border-bottom: 0;
}
.site-header--platform .site-header__inner { justify-content: center; }
.site-header--platform .site-branding { margin-right: 0; text-align: center; }
.site-header--platform .site-title a,
.site-header--platform .site-description { color: #fff; }

@media (min-width: 1024px) {
	.nav-toggle { display: none; }
	.site-header__inner { flex-wrap: nowrap; }

	/* Logo left, nav centred, actions right. */
	.site-header--shop .site-branding { margin-right: 0; }
	.site-header--shop .primary-nav {
		flex: 1 1 auto;
		display: flex;
		justify-content: center;
		order: 2;
	}
	.site-header--shop .site-actions { order: 3; }

	.primary-nav {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
	}
	/*
	 * align-items: center matters — the list items stretch, and without it the block <a>
	 * sits at the top of its box while the flex <button> centres in its own, leaving the
	 * dropdown headings a couple of pixels out of line with the plain links.
	 */
	.primary-nav > ul {
		display: flex;
		align-items: center;
		gap: var(--sp-5);
	}
	.primary-nav > ul > .menu-item { display: flex; align-items: center; }

	.primary-nav a { padding: 0; }
	.primary-nav > ul > .menu-item > a,
	.primary-nav .menu-item__toggle {
		display: flex;
		align-items: center;
		line-height: 1.2;
	}

	/* Desktop: submenus become dropdown panels, on hover or on click. */
	.menu-item-has-children { position: relative; }
	.menu-item__toggle { width: auto; padding: 0; }

	.menu-item-has-children .sub-menu {
		display: block;
		position: absolute;
		top: calc(100% + var(--sp-4));
		left: 50%;
		transform: translateX(-50%);
		z-index: 60;
		min-width: 180px;
		padding: var(--sp-2);
		background: var(--c-surface);
		border: 1px solid var(--c-line);
		border-radius: var(--radius);
		border-bottom-left-radius: 0;
		box-shadow: var(--shadow);
		/* Hidden but still laid out, so opening it cannot shift the header. */
		opacity: 0;
		visibility: hidden;
		transition: opacity var(--transition), visibility var(--transition);
	}

	.menu-item-has-children:hover .sub-menu,
	.menu-item-has-children:focus-within .sub-menu,
	.menu-item-has-children.is-open .sub-menu {
		opacity: 1;
		visibility: visible;
	}

	/* Bridges the gap between the button and the panel so hover survives the trip. */
	.menu-item-has-children::after {
		content: "";
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		height: var(--sp-4);
	}

	.sub-menu .menu-item a {
		display: block;
		padding: var(--sp-2) var(--sp-3);
		border-radius: var(--radius-sm);
		white-space: nowrap;
	}
	.sub-menu .menu-item a:hover { background: var(--c-surface-alt); }
}

/* --- Buttons ----------------------------------------------------------- */

.button,
button,
input[type="submit"],
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	padding: var(--sp-3) var(--sp-5);
	border: 1px solid transparent;
	border-radius: var(--radius-control);
	/* Signature corner — squared off at the bottom left. */
	border-bottom-left-radius: 0;
	background: var(--c-accent);
	color: #fff;
	font-weight: var(--fw-medium);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--transition), color var(--transition);
}

/* Inline icons sit on the text baseline and inherit its colour. */
.button__icon {
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
	fill: currentColor;
}
.button:hover,
button:hover,
input[type="submit"]:hover { background: var(--c-accent-dark); color: #fff; }

.button--ghost {
	background: transparent;
	border-color: var(--c-brand);
	color: var(--c-brand);
}
.button--ghost:hover { background: var(--c-brand); color: #fff; }

/* --- Forms ------------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
select {
	width: 100%;
	padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--c-line);
	border-radius: var(--radius-control);
	background: var(--c-surface);
}

textarea {
	width: 100%;
	padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--c-line);
	border-radius: var(--radius-field);
	background: var(--c-surface);
}
input:focus, textarea:focus, select:focus { border-color: var(--c-accent); }

.search-form {
	display: flex;
	gap: var(--sp-2);
}

/* --- Content ----------------------------------------------------------- */

.page-header {
	padding-block: var(--sp-6) 0;
}
.page-header__title { margin-bottom: var(--sp-2); }

.entry__meta {
	font-size: var(--fs-sm);
	color: var(--c-muted);
	margin-bottom: var(--sp-3);
}

.entry-list {
	display: grid;
	gap: var(--sp-6);
}
@media (min-width: 768px) {
	.entry-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
	.entry-list { grid-template-columns: repeat(3, 1fr); }
}

.entry-card__thumb img { border-radius: var(--radius); width: 100%; }
.entry-card__title { margin-block: var(--sp-3) var(--sp-2); font-size: var(--fs-lg); }
.entry-card__title a { color: var(--c-ink); text-decoration: none; }
.entry-card__title a:hover { color: var(--c-accent-dark); }

.pagination {
	margin-top: var(--sp-7);
	display: flex;
	justify-content: center;
}
.pagination .page-numbers {
	display: inline-block;
	min-width: 40px;
	padding: var(--sp-2) var(--sp-3);
	text-align: center;
	text-decoration: none;
	border-radius: var(--radius-control);
}
.pagination .current { background: var(--c-brand); color: #fff; }

/* --- Footer ------------------------------------------------------------ */

.site-footer {
	margin-top: var(--sp-8);
	padding-block: var(--sp-7) var(--sp-5);
	/* A shade below the CTA band, so the two stack as one block with a soft step. */
	background: var(--c-brand-dark);
	color: rgba(255, 255, 255, 0.78);
	font-size: var(--fs-sm);
}

/* CTA band runs straight into the footer — no white gap between them. */
.has-footer-cta .site-footer { margin-top: 0; }
.site-footer a { color: #fff; }
.site-footer h2, .site-footer .widget__title {
	color: #fff;
	font-size: var(--fs-base);
	margin-bottom: var(--sp-3);
}
.site-footer__cols {
	display: grid;
	gap: var(--sp-6);
}
@media (min-width: 768px) {
	.site-footer__cols { grid-template-columns: repeat(3, 1fr); }
}
.site-footer .widget ul { list-style: none; margin: 0; padding: 0; }
.site-footer .widget li { margin-bottom: var(--sp-2); }

.site-footer__bottom {
	margin-top: var(--sp-6);
	padding-top: var(--sp-4);
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-3);
	justify-content: space-between;
	align-items: center;
}
.footer-nav ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-4);
	margin: 0;
	padding: 0;
}
