/* ── WPImage site chrome (header + footer) ────────────────────────────────────
   Ported from the prototype's .site-header / .site-footer rules. Every value is
   the original's; only the class names are prefixed (`wpi-`), because the
   prototype's names — .nav, .shell, .bar — are far too generic to drop into a
   theme that isn't expecting them.

   The prototype's design tokens are declared on the components themselves rather
   than :root. Scoping them means Brandy can never read them and we can never
   clobber a token Brandy owns (it has its own --border, among others), while the
   rules below stay a near-verbatim copy of the original.                       */

.wpi-site-header,
.wpi-site-footer {
	--wpi-accent: #3858e9;
	--wpi-accent-dark: #2145e6;
	--wpi-accent-tint: #eef1fd;

	--wpi-surface-muted: #f6f7f7;
	--wpi-border: #e0e0e0;
	--wpi-border-strong: #949494;
	--wpi-fg: #1e1e1e;
	--wpi-fg-muted: #757575;
	--wpi-gray-100: #f0f0f0;

	--wpi-radius-sm: 2px;

	/* The prototype's --shell-max is 1240px, which with .shell's 24px padding
	   gives a 1192px content column. Post 28's sections are built at
	   contentSize:1180px, so copying 1240 here left the brand mark and the
	   footer 6px to the left of the hero headline above it. 1228 = 1180 + 48,
	   which lands the chrome on the body's column. Deliberately 12px off the
	   original rather than 6px off everything it sits next to. */
	--wpi-shell-max: 1228px;

	--wpi-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

	font-family: var(--wpi-font-sans);
	box-sizing: border-box;
}

.wpi-site-header *,
.wpi-site-footer * {
	box-sizing: border-box;
}

/* ---------- layout primitive ---------- */
.wpi-shell {
	max-width: var(--wpi-shell-max);
	margin: 0 auto;
	padding: 0 24px;
}

/* ---------- header ---------- */
.wpi-site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.82);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--wpi-border);
}

/* The admin bar is position:fixed for logged-in admins; without this the sticky
   header slides under it. Below 782px core stops fixing the bar (it scrolls
   away), so the offset is removed again at that breakpoint. */
.admin-bar .wpi-site-header {
	top: 32px;
}

.wpi-site-header .wpi-bar {
	display: flex;
	align-items: center;
	gap: 28px;
	height: 68px;
}

.wpi-brand-link {
	display: inline-flex;
	text-decoration: none;
	color: var(--wpi-fg);
	flex: none;
}

.wpi-brand-link:hover,
.wpi-brand-link:focus {
	color: var(--wpi-fg);
}

.wpi-brand-lockup {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wpi-brand-name {
	font: 600 18px/1 var(--wpi-font-sans);
	letter-spacing: -0.01em;
}

.wpi-brand-io {
	color: var(--wpi-fg-muted);
	font-weight: 400;
}

.wpi-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: 8px;
}

.wpi-nav a {
	padding: 8px 12px;
	border-radius: var(--wpi-radius-sm);
	font: 500 14px/1 var(--wpi-font-sans);
	color: var(--wpi-fg-muted);
	text-decoration: none;
	transition: color 0.1s, background-color 0.1s;
}

.wpi-nav a:hover {
	color: var(--wpi-fg);
	background: var(--wpi-gray-100);
}

.wpi-header-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

/* ---------- buttons (header scale only: .btn.sm) ------------------------------
   NOT `.wpi-btn`: that name is already taken. build.py's button() puts it on
   core/button's *wrapper* (`<div class="wp-block-button wpi-btn">`) and
   custom.css styles the link through it (`.wpi-btn .wp-block-button__link`).
   Reusing it here meant this rule's `padding: 0 22px` and `height: 48px` landed
   on all six of post 28's button wrappers, making each one 44px too wide.
   These are the prototype's real <a class="btn"> elements — a different thing
   from a Gutenberg button wrapper — so they get a name of their own. */
.wpi-chrome-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 48px;
	padding: 0 22px;
	border: none;
	cursor: pointer;
	font: 500 15px/1 var(--wpi-font-sans);
	border-radius: var(--wpi-radius-sm);
	transition: background-color 0.12s, box-shadow 0.12s, color 0.12s;
	white-space: nowrap;
	text-decoration: none;
}

.wpi-chrome-btn.is-sm {
	height: 38px;
	padding: 0 16px;
	font-size: 14px;
}

.wpi-chrome-btn.is-ghost {
	background: transparent;
	color: var(--wpi-accent);
}

.wpi-chrome-btn.is-ghost:hover {
	background: var(--wpi-accent-tint);
	color: var(--wpi-accent);
}

.wpi-chrome-btn.is-secondary {
	background: #fff;
	color: var(--wpi-fg);
	box-shadow: inset 0 0 0 1px var(--wpi-border-strong);
}

.wpi-chrome-btn.is-secondary:hover {
	box-shadow: inset 0 0 0 1.5px var(--wpi-accent);
	color: var(--wpi-accent);
}

/* ---------- footer ---------- */
.wpi-site-footer {
	border-top: 1px solid var(--wpi-border);
	background: var(--wpi-surface-muted);
	padding: 56px 0 32px;
}

.wpi-footer-grid {
	display: grid;
	grid-template-columns: 1.6fr 1fr 1fr 1fr;
	gap: 36px;
}

.wpi-footer-blurb {
	font-size: 14px;
	line-height: 1.6;
	color: var(--wpi-fg-muted);
	margin: 16px 0 0;
	max-width: 280px;
}

.wpi-footer-col h4 {
	font: 600 12px/1 var(--wpi-font-sans);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wpi-fg-muted);
	margin: 0 0 16px;
}

.wpi-footer-col a {
	display: block;
	font-size: 14px;
	color: var(--wpi-fg);
	padding: 7px 0;
	text-decoration: none;
	transition: color 0.1s;
}

.wpi-footer-col a:hover {
	color: var(--wpi-accent);
}

.wpi-footer-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 48px;
	padding-top: 24px;
	border-top: 1px solid var(--wpi-border);
	font-size: 13px;
	color: var(--wpi-fg-muted);
	flex-wrap: wrap;
}

.wpi-footer-made {
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Anchor jumps: the sections' own 80px top padding already clears the 68px
   sticky header, which is why the prototype needs no scroll-margin and neither
   do we. The admin bar is the exception — it is 32px the prototype never had to
   account for, and without this an admin clicking "How it works" lands with the
   heading tucked behind the chrome. Scoped to .admin-bar so a visitor's scroll
   position stays exactly the original's. */
.admin-bar .wp-block-group[id] {
	scroll-margin-top: 32px;
}

/* ---------- responsive (original breakpoints) ---------- */
@media (max-width: 1080px) {
	.wpi-footer-grid {
		grid-template-columns: 1fr 1fr;
		gap: 32px;
	}
}

@media (max-width: 900px) {
	/* The original simply drops the nav below 900px — there is no hamburger in
	   the prototype. Kept as-is; the same links live in the footer. */
	.wpi-nav {
		display: none;
	}
}

@media (max-width: 600px) {
	.wpi-shell {
		padding: 0 16px;
	}

	.wpi-footer-grid {
		grid-template-columns: 1fr 1fr;
		gap: 28px 24px;
	}

	.wpi-footer-brand {
		grid-column: 1 / -1;
	}

	/* header: keep just the brand + primary CTA, drop the secondary link */
	.wpi-site-header .wpi-bar {
		gap: 12px;
		height: 60px;
	}

	.wpi-header-actions {
		gap: 8px;
	}

	.wpi-header-actions .wpi-chrome-btn.is-ghost {
		display: none;
	}

	.wpi-brand-name {
		font-size: 16px;
	}
}

/* The admin bar stops being fixed at 600px, so the sticky offset must go. */
@media (max-width: 782px) {
	.admin-bar .wpi-site-header {
		top: 0;
	}
}
