/* =========================================================================
   OTS theme layer — header, footer, shell.
   Consumes the design system tokens (ots-design-system.css). Component-level
   styles (property cards, filters, detail pages) arrive in Phase 4.
   ========================================================================= */

/* Accessibility helpers */
.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;
}
.skip-link {
	position: absolute; left: -9999px; top: 0; z-index: 1000;
	background: var(--color-accent); color: #fff; padding: var(--space-2) var(--space-4);
}
.skip-link:focus { left: var(--space-4); }

/* ---- Utility bar --------------------------------------------------------- */
.utilitybar {
	background: var(--color-surface-inverse);
	color: var(--color-text-inverse);
	font-size: var(--text-xs);
	position: sticky;
	top: 0;
	z-index: 101;
}
.utilitybar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	min-height: var(--utilitybar-height);
}
.utilitybar__tagline {
	color: rgba(255, 255, 255, 0.75);
	font-family: var(--font-sans);
	font-size: 12px;
	line-height: 1.2;
}
.utilitybar__menu {
	display: flex;
	gap: var(--space-5);
	list-style: none;
	margin: 0;
	padding: 0;
}
.utilitybar__menu a { color: #FAFAF6; }
.utilitybar__menu a:hover { color: #fff; text-decoration: none; }

/* ---- Header -------------------------------------------------------------- */
.site-header {
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-divider);
	position: sticky;
	top: var(--utilitybar-height);
	z-index: 100;
	box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.05);
}
.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-8);
	min-height: var(--header-height);
}
.site-header__logo,
.custom-logo-link {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}
.site-header__logo img,
.site-header__logo .custom-logo,
.site-header__logo-img,
.custom-logo-link img,
.custom-logo {
	display: block;
	height: 24px;
	width: auto;
}
.logo-fallback {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.5rem;
	color: var(--color-accent);
	letter-spacing: 0.02em;
}
.logo-fallback--light { color: #fff; }

/* Surplus wordmark styles live in assets/css/app.css (Tailwind components). */

/* Figma surplus header sits on white, above the cream page background. */
.site-header--surplus { background: #fff; }

.site-nav { margin-right: auto; }
.site-header--surplus .site-nav {
	margin: 0 auto;
}
.site-nav__menu {
	display: flex;
	align-items: center;
	gap: var(--space-6);
	list-style: none;
	margin: 0;
	padding: 0;
}
.site-nav__menu--mobile { display: none; }
.site-nav__menu > li { position: relative; }
.site-nav__menu a {
	color: var(--navy-700);
	font-weight: var(--weight-regular);
	font-size: var(--text-base);
}
.site-nav__menu a:hover,
.site-nav__menu .current-menu-item > a,
.site-nav__menu .current-menu-ancestor > a {
	color: var(--navy-800);
	text-decoration: none;
}
.site-nav__menu .menu-item-has-children > a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.site-nav__menu .menu-item-has-children > a::after {
	content: '';
	width: 6px;
	height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-1px);
	opacity: 0.7;
}
.site-nav__menu .sub-menu {
	display: none;
	position: absolute;
	top: calc(100% + 12px);
	left: 0;
	min-width: 220px;
	padding: var(--space-3) 0;
	margin: 0;
	list-style: none;
	background: var(--color-bg);
	border: 1px solid var(--color-divider);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	z-index: 120;
}
.site-nav__menu > li:hover > .sub-menu,
.site-nav__menu > li:focus-within > .sub-menu {
	display: block;
}
.site-nav__menu .sub-menu a {
	display: block;
	padding: var(--space-2) var(--space-4);
	font-weight: var(--weight-regular, 400);
	white-space: nowrap;
}

.site-nav__cta { display: none; }

.site-header__actions {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	flex-shrink: 0;
}
.site-header__login {
	font-weight: var(--weight-semibold);
	color: var(--color-accent);
	text-decoration: none;
}
.site-header__login:hover { text-decoration: none; color: var(--color-accent-hover); }
.site-header__member,
.site-header__browse {
	white-space: nowrap;
}
.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	background: var(--color-bg);
	color: var(--color-text);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	cursor: pointer;
}
.icon-btn:hover { border-color: var(--color-text-muted); }
.menu-toggle { display: none; }
.menu-toggle__close { display: none; }
body.is-nav-open .menu-toggle__open { display: none; }
body.is-nav-open .menu-toggle__close { display: inline-grid; }

/* ---- Footer --------------------------------------------------------------
   Figma: Footer 1:19646 · Surplus Footer 1:22147
   ----------------------------------------------------------------------- */
.site-footer {
	background: var(--color-surface-inverse);
	color: var(--color-text-inverse);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: none; }

.site-footer__grid {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 64px;
	padding-block: 64px;
}
.site-footer__brand {
	display: flex;
	flex-direction: column;
	gap: 24px;
	flex: 0 1 340px;
	min-width: 0;
}
.site-footer__cols {
	display: flex;
	gap: 40px;
	flex: 1 1 120px;
	min-width: 0;
}
.site-footer__col {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1 1 120px;
	min-width: 0;
}
.site-footer__newsletter {
	display: flex;
	flex-direction: column;
	gap: 16px;
	flex: 0 1 324px;
}
.site-footer__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.newsletter-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Surplus Footer 1:22147 */
[data-brand="surplus"] .site-footer__grid { gap: 48px; padding-block: 64px 48px; }
/* Figma 1:22147 — brand column holds 414px so the link columns start at x=526. */
[data-brand="surplus"] .site-footer__brand { gap: 16px; }
@media (max-width: 900px) {
	[data-brand="surplus"] .site-footer__grid {
		padding: 64px 24px;
	}
}
@media (min-width: 561px) {
	[data-brand="surplus"] .site-footer__grid {
		gap: 64px;
	}
	[data-brand="surplus"] .site-footer__brand { flex: 0 1 414px; }
}
[data-brand="surplus"] .site-footer__col { gap: 14px; flex: 1 1 140px; }
[data-brand="surplus"] .site-footer__menu { gap: 14px; }
[data-brand="surplus"] .site-footer__newsletter { gap: 12px; flex: 0 1 300px; }
/* Figma: Inter Bold 25, same wordmark as the header. Needs the [data-brand]
   prefix to out-specify [data-brand="surplus"] h1,…,h4 (font-family/weight). */
[data-brand="surplus"] .site-footer__logo-text {
	font-family: var(--font-sans);
	font-weight: 700;
	font-size: 25px;
	letter-spacing: -0.01em;
}
[data-brand="surplus"] .site-footer__logo img {
	height: 24px;
	width: auto;
	filter: brightness(0) invert(1);
}
/* Colour has to be re-stated here: [data-brand="surplus"] h4 (0,1,1) beats the
   base .site-footer__newsletter-title (0,1,0) and painted it ink-on-black. */
[data-brand="surplus"] .site-footer__newsletter-title {
	color: #fafaf6;
	font-family: var(--font-sans);
	font-size: 20px;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 20px;
}
[data-brand="surplus"] .site-footer__newsletter-copy { display: none; }
[data-brand="surplus"] .newsletter-form { gap: 12px; }

.site-footer__logo {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	color: #fafaf6;
	line-height: 1;
}
.site-footer__logo:hover { color: #fafaf6; }
.site-footer__logo-img {
	display: block;
	width: 176px;
	height: 48px;
	object-fit: contain;
}
.site-footer__logo-text {
	font-family: var(--font-display);
	font-weight: var(--weight-medium);
	font-size: 1.25rem;
	letter-spacing: -0.01em;
	text-transform: lowercase;
}

.site-footer__tagline {
	margin: 0;
	max-width: 340px;
	color: #fafaf6;
	opacity: 0.72;
	font-family: var(--font-sans);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
}
.site-footer__family {
	margin: 0;
	color: #fafaf6;
	opacity: 0.55;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 400;
	line-height: 12px;
	letter-spacing: -0.03em;
	text-transform: none;
}
.site-footer__social {
	display: flex;
	align-items: center;
	gap: 16px;
}
.site-footer__social a {
	display: inline-flex;
	width: 16px;
	height: 16px;
	border: 0;
	border-radius: 0;
	background: transparent;
	opacity: 0.95;
}
.site-footer__social a:hover { opacity: 1; background: transparent; }
.site-footer__social img {
	display: block;
	width: 16px;
	height: 16px;
}

.site-footer__col h4,
.site-footer__col .u-label {
	margin: 0;
	color: #fafaf6;
	opacity: 0.55;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 12px;
}
.site-footer__menu a {
	color: #fafaf6;
	font-family: var(--font-sans);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
	opacity: 0.92;
}
.site-footer__menu a:hover { color: #fff; opacity: 1; }

.site-footer__newsletter-title {
	margin: 0;
	color: #fafaf6;
	font-family: var(--font-sans);
	font-size: 21px;
	font-weight: 400;
	letter-spacing: 0;
	line-height: 27px;
}
.site-footer__newsletter-copy {
	margin: 0;
	color: #fafaf6;
	opacity: 0.72;
	font-family: var(--font-sans);
	font-size: 12px;
	font-weight: 400;
	line-height: 18px;
}
.newsletter-form .field {
	min-height: 48px;
	padding: 12px 14px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	color: #fafaf6;
	font-size: 16px;
	line-height: 24px;
}
.newsletter-form .field::placeholder { color: rgba(250, 250, 246, 0.45); }
.newsletter-form .field:focus-visible {
	outline: none;
	border-color: rgba(255, 255, 255, 0.4);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.newsletter-form .btn {
	width: 100%;
	min-height: 45px;
	padding: 13px 20px;
	border-radius: 8px;
	font-size: 16px;
}

.site-footer__bottom { 
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	padding-top: 24px;
	padding-bottom: 24px;
}
.site-footer__bottom-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	font-family: var(--font-sans);
	font-size: 12px;
	line-height: 18px;
	color: rgba(250, 250, 246, 0.55);
	flex-wrap: nowrap;
}
.site-footer__bottom-inner > span { flex: 1 1 auto; min-width: 0; }
.site-footer__bottom-inner > nav { flex: 0 0 auto; }
.site-footer__legal {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 20px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.site-footer__legal a { color: rgba(250, 250, 246, 0.65); }
.site-footer__legal a:hover { color: #fff; }

/* ---- Generic content shell (index.php) ---------------------------------- */
.page-head { margin-bottom: var(--space-8); }
.entry-list { display: grid; gap: var(--space-8); }
.entry__title a { color: var(--color-text); }
.empty-state { text-align: center; padding-top: var(--space-20); padding-bottom: var(--space-10); }

/* ---- Static pages (page.php) -------------------------------------------- */
.page__head { max-width: 760px; margin: 0 auto var(--space-8); text-align: center; }
.page__head h1 { font-size: var(--text-h1); }
.page__sub { color: var(--color-text-muted); font-size: var(--text-lg); }
.page__content { max-width: 760px; margin: 0 auto; }

/* Prose — readable long-form content */
.prose { color: var(--color-text-secondary); line-height: 1.7; }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { font-size: var(--text-h2); color: var(--color-text); margin-top: var(--space-8); }
.prose h3 { font-size: var(--text-h3); color: var(--color-text); margin-top: var(--space-6); }
.prose h4 { color: var(--color-text); margin-top: var(--space-5); }
.prose a { color: var(--color-accent); text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: var(--space-2); }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { border-left: 3px solid var(--color-accent); padding-left: var(--space-4); color: var(--color-text-muted); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border-bottom: 1px solid var(--color-divider); padding: var(--space-3); text-align: left; }

/* ---- 404 ---------------------------------------------------------------- */
.error404 { max-width: 720px; margin-inline: auto; text-align: center; }
.error404__code { color: var(--color-accent); }
.error404__title { font-size: var(--text-h1); margin: var(--space-2) 0 var(--space-3); }
.error404__lede { color: var(--color-text-muted); font-size: var(--text-lg); margin-bottom: var(--space-6); }
.error404__search { display: flex; gap: var(--space-2); max-width: 520px; margin: 0 auto var(--space-8); }
.error404__links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); text-align: left; }
.error404__link { display: grid; gap: 2px; padding: var(--space-4) var(--space-5); }
.error404__link:hover { border-color: var(--color-accent); text-decoration: none; }
.error404__link strong { color: var(--color-text); }
.error404__link span { color: var(--color-text-muted); font-size: var(--text-sm); }
@media (max-width: 560px) { .error404__links { grid-template-columns: 1fr; } .error404__search { flex-direction: column; } }

/* ---- Mobile -------------------------------------------------------------- */
@media (max-width: 1100px) {
	.site-footer__brand { flex: 1 1 280px; }
	.site-footer__col { flex: 1 1 160px; }
	.site-footer__newsletter { flex: 1 1 100%; max-width: 420px; }
	[data-brand="surplus"] .site-footer__newsletter { flex: 1 1 100%; max-width: 420px; width: 100%; }
}

@media (max-width: 1200px) {
	.utilitybar__nav { display: none; }
	.utilitybar__inner { justify-content: center; }
	[data-brand="surplus"] .utilitybar__inner { justify-content: flex-start; }

	.site-nav { display: none; }
	.site-header__login,
	.site-header__member,
	.site-header__contact,
	.site-header__browse,
	.site-header__search { display: none; }
	.menu-toggle { display: inline-grid; }
	.menu-toggle span { line-height: 0.5px; }
	.site-header__inner { gap: var(--space-4); justify-content: space-between; }
	.site-header--surplus .site-nav { margin-left: 0; }

	.site-footer__brand { flex: 1 1 100%; }
	.site-footer__cols {
		flex: 1 1 100%;
		flex-direction: column;
		gap: 48px;
	}
	.site-footer__newsletter { flex: 1 1 100%; max-width: 100%; min-width: 100%; }
	.site-footer__bottom-inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 2rem;
	}
	.site-footer__legal { justify-content: flex-start; }
}

@media (max-width: 900px) {
	.site-header__inner {
		padding-inline: 24px;
	}
	[data-brand="surplus"] .site-footer__col {
		flex: 1 1 100%;
	}
}

@media (max-width: 560px) {
	.site-header__logo img,
	.site-header__logo .custom-logo,
	.site-header__logo-img,
	.custom-logo-link img,
	.custom-logo {
		height: 20px;
	}
	.site-footer__grid {
		flex-direction: column;
	}
	.site-footer__tagline { max-width: none; }
	.site-footer__logo-img { width: 148px; height: 40px; }
	[data-brand="surplus"] .site-footer__logo img {
		height: 20px;
	}
}

/* Mobile nav drawer (toggled by main.js) */
.site-nav.is-open {
	display: flex;
	flex-direction: column;
	position: fixed;
	inset: calc(var(--utilitybar-height) + 73px) 0 0 0;
	background: var(--color-bg);
	z-index: 90;
	overflow-y: auto;
}
.site-nav.is-open .site-nav__menu {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
}
.site-nav.is-open .site-nav__menu--desktop { display: none; }
.site-nav.is-open .site-nav__menu--mobile { display: flex; }
.site-nav.is-open .site-nav__menu > li {
	border-bottom: 1px solid var(--color-divider);
}
.site-nav.is-open .site-nav__menu > li > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 48px;
	font-size: 18px;
	font-weight: var(--weight-medium);
	color: var(--color-text);
}
.site-nav.is-open .site-nav__menu .menu-item-has-children > a::after {
	width: 8px;
	height: 8px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	opacity: 0.55;
	flex-shrink: 0;
}
.site-nav.is-open .site-nav__menu .menu-item-has-children.is-expanded > a::after {
	transform: rotate(45deg);
}
.site-nav.is-open .site-nav__menu .sub-menu {
	display: none;
	position: static;
	min-width: 0;
	padding: 0 0 12px;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
}
.site-nav.is-open .site-nav__menu .menu-item-has-children.is-expanded > .sub-menu {
	display: block;
}
.site-nav.is-open .site-nav__menu .sub-menu a {
	padding: 10px 0 10px 16px;
	font-size: 16px;
	font-weight: 400;
	white-space: normal;
	border-left: 2px solid transparent;
}
.site-nav.is-open .site-nav__menu .sub-menu .current-menu-item > a {
	color: var(--color-accent);
	border-left-color: var(--color-accent);
	padding-left: 14px;
}

.site-nav.is-open .site-nav__cta {
	display: flex;
	flex-direction: column;
	gap: 12px;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px));
	background: var(--color-bg);
	border-top: 1px solid var(--color-divider);
	z-index: 91;
}
.site-nav.is-open .site-nav__cta .btn {
	width: 100%;
	min-height: 48px;
}
/* Login / Contact ghost sits under primary CTA */
.site-nav.is-open .site-nav__cta .btn--ghost {
	order: 2;
}
.site-nav.is-open .site-nav__cta .btn:not(.btn--ghost) {
	order: 1;
}

@media (max-width: 900px) {
	.site-nav.is-open .site-nav__menu > li > a {
		padding: 16px 24px;
	}
}