/* ==========================================================================
   HOMEPAGE & LAYOUT SCAFFOLD

   The band rhythm and the grids every surface is built on. Read
   docs/design-reference.md §2-§3 first: the bands are spacious because of
   type scale and image size, not padding, so the vertical padding here is
   much smaller than it looks like it should be. Resist increasing it.
   ========================================================================== */

/* --- The wrapper ---------------------------------------------------------
   1664px, wider than most WordPress themes allow and deliberately so. */
.kbia-wrap {
	width: 100%;
	max-width: var(--kbia-container);
	margin-inline: auto;
	padding-inline: var(--kbia-gutter);
}

/* --- Bands ---------------------------------------------------------------
   Grounds alternate white -> white -> pale grey, per the reference. */
.kbia-band {
	padding-block: var(--kbia-band-y);
}

.kbia-band--alt {
	background: var(--kbia-surface-alt);
}

.kbia-band--invert {
	background: var(--kbia-blue-800);
	color: #fff;
}

.kbia-band--invert a {
	color: #fff;
}

/* The eyebrow over a band title. Same treatment as .kbia-card__eyebrow in
   components.css, and in --kbia-muted (5.3:1 on the pale band ground) rather
   than the hero eyebrow's --kbia-blue-200 -- that blue is mixed for the dark
   hero and falls to 1.5:1 here, which is a label nobody can read. */
.kbia-band__eyebrow {
	margin: 0 0 0.75rem;
	font-family: var(--kbia-font-mono);
	font-size: var(--kbia-fs-eyebrow);
	font-weight: 500;
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
	color: var(--kbia-muted);
}

.kbia-band__title {
	font-family: var(--kbia-font-heading);
	font-size: var(--kbia-fs-h2);
	line-height: var(--kbia-lh-heading);
	color: var(--kbia-heading);
	margin: 0 0 1.5rem;
	text-wrap: balance;
}

.kbia-band--invert .kbia-band__title {
	color: #fff;
}

.kbia-band__standfirst {
	max-width: var(--kbia-container-text);
	margin: -0.75rem 0 2rem;
	font-size: var(--kbia-fs-body);
	line-height: var(--kbia-lh-body);
	color: var(--kbia-muted);
}

.kbia-band__more {
	margin-top: 2rem;
}

/* --- Grids ---------------------------------------------------------------
   auto-fit with a minimum rather than fixed column counts: the same grid then
   serves 3 board members and 24 businesses without a media query per case. */
.kbia-grid {
	display: grid;
	gap: clamp(1rem, 2vw, 2rem);
}

.kbia-grid--tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.kbia-grid--4     { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.kbia-grid--3     { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }

/* Cap the tile grid at three across so six tiles read as 3x2, not 6x1. */
@media (min-width: 64rem) {
	.kbia-grid--tiles { grid-template-columns: repeat(3, 1fr); }
	.kbia-grid--4     { grid-template-columns: repeat(4, 1fr); }
	.kbia-grid--3     { grid-template-columns: repeat(3, 1fr); }
}

/* --- Hero ----------------------------------------------------------------
   Interior heroes use the large top padding to clear the fixed header. */
.kbia-hero {
	background: var(--kbia-blue-800);
	color: #fff;
	padding-block: var(--kbia-band-y-lg) var(--kbia-band-y);
}

.kbia-hero--home {
	min-height: min(78vh, 46rem);
	display: flex;
	align-items: flex-end;
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

.kbia-hero--home::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--kbia-scrim-hero), var(--kbia-blue-900);
}

.kbia-hero__eyebrow {
	font-family: var(--kbia-font-mono);
	font-size: var(--kbia-fs-eyebrow);
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
	color: var(--kbia-blue-200);
	margin: 0 0 0.75rem;
}

/* The breadcrumb in an interior hero.
 *
 * The eyebrow's own colour never reached the breadcrumb, because the eyebrow
 * on these templates is made of links and a link takes its colour from the
 * parent theme, not from its container: My Listing styles `a` at #242429,
 * which on the interior hero's #0a3a5e ground computes to roughly 1.3:1. That
 * is not an off-brand colour, it is an unreadable one, and it applied to every
 * breadcrumb on single-kbia_community.php and single-kbia_project.php.
 *
 * White rather than the eyebrow's blue-200: these sit directly under a white
 * h1 and read as one unit with it, and at this size -- 12-14px, uppercase,
 * letter-spaced -- blue-200 is doing well to reach 7:1 where white reaches 12.
 *
 * Scoped to --interior deliberately. The homepage hero eyebrow carries no
 * link, and the 404 hero sits on a light ground with its own colour rules in
 * listing.css; neither should be dragged into this. */
.kbia-hero--interior .kbia-hero__eyebrow,
.kbia-hero--interior .kbia-hero__eyebrow a {
	color: #fff;
}

/* A breadcrumb is not underlined at rest by convention, so the affordance is
   a faint rule that solidifies on hover and focus. */
.kbia-hero--interior .kbia-hero__eyebrow a {
	text-decoration: none;
	border-bottom: 1px solid rgb(255 255 255 / 35%);
	transition: border-color var(--kbia-dur-fast) var(--kbia-ease-out);
}

.kbia-hero--interior .kbia-hero__eyebrow a:hover,
.kbia-hero--interior .kbia-hero__eyebrow a:focus-visible {
	border-bottom-color: #fff;
}

.kbia-hero__title {
	font-family: var(--kbia-font-heading);
	font-size: var(--kbia-fs-hero);
	line-height: var(--kbia-lh-hero);
	font-weight: 700;
	margin: 0;
	text-wrap: balance;
}

.kbia-hero--interior .kbia-hero__title {
	font-size: var(--kbia-fs-h2);
}

.kbia-hero__standfirst {
	max-width: var(--kbia-container-text);
	margin: 1.25rem 0 0;
	font-size: var(--kbia-fs-hero-lede);
	line-height: var(--kbia-lh-body);
	color: var(--kbia-blue-100);
}

.kbia-hero--home .kbia-btn {
	margin-top: 2rem;
}

/* --- Band 6 pillars ------------------------------------------------------ */
.kbia-pillars {
	margin-bottom: 3rem;
}

/* Direct child only. The pillar now contains a card, and that card's own
   .kbia-card__title is an h3 too -- a descendant selector here painted the
   signature accent rule under the article headline as well, which read as a
   second, broken pillar heading. */
.kbia-pillar > h3 {
	font-family: var(--kbia-font-heading);
	font-size: var(--kbia-fs-h3);
	color: var(--kbia-heading);
	margin: 0 0 0.5rem;
	padding-bottom: 0.5rem;
	/* The signature accent rule, reused at pillar scale. */
	border-bottom: var(--kbia-rule) solid var(--kbia-accent);
	display: inline-block;
}

.kbia-pillar > p {
	margin: 0;
	line-height: var(--kbia-lh-body);
	color: var(--kbia-body);
}

/* The worked example beneath each pillar. The gap separates it from the blurb
   so the two read as heading-and-example rather than as one block of text. */
.kbia-pillar .kbia-card {
	margin-top: 1.5rem;
}

/* --- Band 7 social wall -------------------------------------------------- */
/* Six reels: one row of six wide, 3x2 on a tablet, 2x3 on a phone. Every
   breakpoint divides into six exactly, so no layout ends on an orphan row.
   Six across is also what keeps a 9:16 card sensible -- three across on this
   1664px container would be 528px wide and over 900px tall each, a band you
   scroll past rather than look at. */
.kbia-reels {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: clamp(1rem, 2vw, 2rem);
	margin-top: 2rem;
}

@media (min-width: 48rem) {
	.kbia-reels { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 64rem) {
	.kbia-reels { grid-template-columns: repeat(6, 1fr); }
}

.kbia-reel {
	position: relative;
	overflow: hidden;
	border-radius: var(--kbia-radius-lg);
	background: var(--kbia-blue-900);
}

/* The 9:16 the reels were shot at, held exactly. object-fit: cover matters for
   the poster as much as the video -- a frame at any other ratio letterboxes
   against the card's dark ground rather than filling it. */
.kbia-reel__video {
	display: block;
	width: 100%;
	aspect-ratio: 9 / 16;
	object-fit: cover;
	background: var(--kbia-blue-900);
}

/* Our play affordance, in place of the browser's. `hidden` in the markup and
   revealed by assets/js/social.js, so with no JS the native controls the markup
   ships with are what the visitor gets -- see that file. The scrim is the same
   bottom-up gradient the cards use: a white circle on a bright poster frame
   needs something under it. */
.kbia-reel__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0;
	border: 0;
	background: var(--kbia-scrim);
	color: inherit;
	cursor: pointer;
}

/* `hidden` has to be spelled out here. The browser's own `[hidden]{display:none}`
   is a 0,1,0 attribute selector, exactly the same weight as .kbia-reel__play
   above it -- so the later rule, ours, wins and the attribute does nothing. The
   button then stays on top of a playing clip, and because it is inset:0 it eats
   every click aimed at the native controls underneath. */
.kbia-reel__play[hidden] {
	display: none;
}

.kbia-reel__play::after {
	content: "";
	width: 3.25rem;
	height: 3.25rem;
	border-radius: 50%;
	background: rgb(255 255 255 / 92%);
	transition: transform var(--kbia-dur-slow) var(--kbia-ease-smooth);
}

/* The triangle, centred over the circle rather than beside it -- both
   pseudo-elements would otherwise be flex items on the same row. Nudged right
   of true centre because an optical centre is what reads as centred. */
.kbia-reel__play::before {
	content: "";
	position: absolute;
	z-index: 1;
	top: 50%;
	left: 50%;
	transform: translate(-40%, -50%);
	border-style: solid;
	border-width: 0.5rem 0 0.5rem 0.85rem;
	border-color: transparent transparent transparent var(--kbia-blue-800);
}

.kbia-reel__play:hover::after,
.kbia-reel__play:focus-visible::after {
	transform: scale(1.08);
}

/* The button is the whole card, so a focus ring on it is the card's own edge. */
.kbia-reel__play:focus-visible {
	outline: 3px solid var(--kbia-accent);
	outline-offset: -3px;
}

/* The button's only text. Visually hidden rather than absent: the control has
   no label otherwise, and "button" is what a screen reader announces. */
.kbia-reel__play-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	clip-path: inset(50%);
}

/* --- Band 8 newsletter --------------------------------------------------- */
/* Two equal halves, each vertically centred against the other, so the copy and
   the signup form read as one balanced pair rather than a short column beside
   a tall one. */
.kbia-newsletter {
	display: grid;
	gap: 2.5rem;
	align-items: center;
}

@media (min-width: 60rem) {
	.kbia-newsletter {
		grid-template-columns: 1fr 1fr;
		gap: 4rem;
	}
}

.kbia-newsletter p {
	max-width: var(--kbia-container-text);
	margin: 0;
	line-height: var(--kbia-lh-body);
	color: var(--kbia-blue-100);
}

/* The form fills its half, with no block margin of its own -- the band's own
   padding and the grid gap set the spacing. WPForms centres its container with
   `div.wpforms-container-full:not(:empty) { margin: 24px auto }`, which outscores
   a plain two-class selector, so `.kbia-wpform` is carried here to win on
   specificity rather than with !important. */
.kbia-newsletter__form,
.kbia-newsletter__form .kbia-wpform.wpforms-container {
	width: 100%;
	margin: 0;
}

.kbia-social {
	margin-top: 2rem;
}

.kbia-social ul {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.kbia-social a {
	font-family: var(--kbia-font-mono);
	font-size: var(--kbia-fs-eyebrow);
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: var(--kbia-underline) solid transparent;
	transition: border-color var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-social a:hover {
	border-bottom-color: var(--kbia-warm);
}

/* ==========================================================================
   HERO VIDEO

   The client already publishes a 95s montage of Kennedy Road businesses behind
   the hero on the live site. It is reused here rather than replaced, because it
   is BIA-owned footage of the actual street -- see docs/image-credits.md.
   ========================================================================== */

/*
 * HERO HEIGHT IS DERIVED FROM THE FOOTAGE, NOT CHOSEN.
 *
 * The source is a filmstrip: six panels of different Kennedy Road footage laid
 * side by side in one 1750x524 frame. Only four are wanted, so the delivered
 * file is cropped to panels 1-4 (1190x524 -- boundaries measured at x=296, 591,
 * 895, 1191, 1511, which are not equal sixths).
 *
 * Because the video is `object-fit: cover`, the band's aspect ratio decides how
 * much of that width survives: any taller and the outer panels are cropped away,
 * any shorter and a sliver of a fifth panel creeps back in. Matching the ratio
 * to the crop is therefore the only height that shows exactly four whole panels,
 * which is why this is aspect-ratio rather than a height someone picked.
 *
 * min-height is the floor for narrow viewports, where four panels across cannot
 * be legible at any height and cropping to fewer is the right outcome.
 */
.kbia-hero--video {
	/*
	 * width is explicit, not auto. With `width: auto` the inline size is
	 * indefinite, so once min-height wins -- which it does at every narrow
	 * viewport -- the ratio resolves backwards and derives the *width* from
	 * the height (544px floor x 1190/524 = 1235px). That overflowed the
	 * document sideways and dragged the fixed header out with it, because the
	 * header is width:100% of a layout viewport that had grown to 1235px.
	 * Pinning the inline size keeps the ratio doing only what the comment
	 * above describes: deriving height from width, with min-height as a floor.
	 */
	width: 100%;
	aspect-ratio: 1190 / 524;
	min-height: min(78vh, 34rem);
}

.kbia-hero__media {
	position: absolute;
	inset: 0;
	z-index: -2;              /* below the ::after scrim, which is -1 */
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.kbia-hero__video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/*
 * The base hero scrim is `gradient, solid navy` -- the solid is there so a hero
 * with no imagery is still a deliberate colour rather than a hole. Over video
 * that solid layer would hide the footage completely, so the video variant
 * keeps the gradient and drops the fill.
 */
.kbia-hero--video::after {
	background: var(--kbia-scrim-hero);
}

/* --- Pause control ------------------------------------------------------- */

/*
 * Sits bottom-right, out of the way of the left-weighted hero copy. Rendered
 * with [hidden] and revealed by assets/js/hero.js only once a video is actually
 * attached.
 */
.kbia-hero__toggle {
	position: absolute;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	/* A 1px hairline, enough to edge the control against a bright frame. Not
	   --kbia-rule: that is the 8px accent under tile titles, and as a border it
	   drew a second, thicker box around the button. */
	border: 1px solid rgb(255 255 255 / 45%);
	border-radius: var(--kbia-radius);
	background: rgb(10 39 64 / 65%);
	color: #fff;
	font-family: var(--kbia-font-mono);
	font-size: 0.6875rem;
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
	cursor: pointer;
}

.kbia-hero__toggle:hover {
	background: rgb(10 39 64 / 85%);
	border-color: #fff;
}

/* Two bars for pause, a triangle for play. Drawn rather than iconographic so
   the control carries no icon-font or SVG dependency. */
.kbia-hero__toggle-icon {
	width: 0.5rem;
	height: 0.7rem;
	border-inline: 0.1875rem solid currentcolor;
}

.kbia-hero__toggle.is-paused .kbia-hero__toggle-icon {
	width: 0;
	height: 0;
	border: 0.35rem solid transparent;
	border-inline-start: 0.55rem solid currentcolor;
}

/* --- Hero search --------------------------------------------------------- */

/*
 * A shortcut into /directory/'s own `q` and `bucket` filters rather than a
 * second search. The shared radius and button tokens keep it part of the system
 * rather than a floating widget.
 */
.kbia-herosearch {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	max-width: 46rem;
	margin: 2rem 0 0;
	border-radius: var(--kbia-radius-lg);
	background: rgb(255 255 255 / 96%);
	padding: 0.5rem;
}

.kbia-herosearch__field {
	margin: 0;
	flex: 1 1 12rem;
	min-width: 0;
}

.kbia-herosearch__field input,
.kbia-herosearch__field select {
	width: 100%;
	height: 3rem;
	padding-inline: 0.875rem;
	border: 0;
	border-radius: var(--kbia-radius-sm);
	background: transparent;
	color: var(--kbia-blue-900);
	font: inherit;
	/* After the shorthand, which resets font-size to the inherited <p> value. */
	font-size: var(--kbia-fs-herosearch);
}

/* A hairline between the two fields, not a box around each. 1px, not
   --kbia-rule: that token is the 8px accent under tile titles, and here it drew
   a thick pale bar between the fields. */
.kbia-herosearch__field--bucket {
	border-inline-start: 1px solid var(--kbia-blue-100);
}

.kbia-herosearch__field input:focus-visible,
.kbia-herosearch__field select:focus-visible {
	outline: 2px solid var(--kbia-accent);
	outline-offset: -2px;
}

.kbia-herosearch__actions {
	margin: 0;
	flex: 0 0 auto;
}

.kbia-herosearch__actions .kbia-btn {
	height: 3rem;
	margin: 0;
	padding-inline: 1.75rem;
	font-size: var(--kbia-fs-herosearch);
}

.kbia-hero__browse {
	display: inline-block;
	margin-top: 1.25rem;
	font-size: var(--kbia-fs-hero-lede);
	color: #fff;
}

@media (max-width: 40rem) {
	.kbia-herosearch {
		display: block;
	}

	/* The same 1px hairline, turned horizontal once the fields stack. */
	.kbia-herosearch__field--bucket {
		border-inline-start: 0;
		border-block-start: 1px solid var(--kbia-blue-100);
	}

	.kbia-herosearch__actions .kbia-btn {
		width: 100%;
		margin-top: 0.5rem;
	}

	/*
	 * There is no room for the pause control and the "browse all six
	 * categories" link on the same line here, and the control was landing on
	 * top of the link. Collapsing to the icon alone gets it out of the way
	 * without moving it. The label is taken off the screen rather than hidden:
	 * display:none would leave the button with no accessible name, and hero.js
	 * rewrites that same text to announce play/pause state.
	 */
	/* 44px minimum: icon-only, the button is otherwise about 30px square, and
	   it used to reach 44px only because of the 8px border now removed above. */
	.kbia-hero__toggle {
		justify-content: center;
		min-width: 2.75rem;
		min-height: 2.75rem;
		padding: 0.625rem;
	}

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

/* --- Category tiles: photograph vs authored tile ------------------------- */

/*
 * Four buckets reuse the live site's category photographs; the remaining two
 * fall back to the authored SVG. They need opposite treatment. A photograph is
 * busy and needs holding back so the overlaid label stays legible; the SVG is
 * already a flat brand tile and only gets muddied by the same filter.
 */
.kbia-tile--photo .kbia-tile__img {
	filter: saturate(0.9) brightness(0.92);
	transition: transform var(--kbia-dur, 200ms) ease;
}

.kbia-tile--photo:hover .kbia-tile__img {
	transform: scale(1.03);
}

/*
 * The categories/ artwork is drawn at the tile's own 16:11 ratio, so cover and
 * contain are equivalent here; cover is the safer of the two if that ratio ever
 * drifts. No filter: the dimming applied to photographs exists to hold busy
 * detail back behind the label, and there is no detail here to hold back.
 *
 * Note these tiles deliberately sit outside the `img[src*="kbia-placeholder"]`
 * selectors in components.css. Those carry the saturation knock-back and the
 * "Photo coming soon" badge, both of which are about a *listing* whose
 * photograph is missing -- true of 290 of 347. A category is not a thing that
 * has a photograph of itself, and this artwork is a finished design rather than
 * a stand-in, so neither treatment applies. Renaming the file is what opts it
 * out; there is no override to keep in sync.
 */
.kbia-tile--drawn .kbia-tile__img {
	object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
	.kbia-tile--photo .kbia-tile__img,
	.kbia-tile--photo:hover .kbia-tile__img {
		transition: none;
		transform: none;
	}
}

/* --- Hero legibility ----------------------------------------------------- */

/*
 * base.css styles h1..h6 with a bare element selector and the navy heading
 * token. An element selector beats `color:#fff` *inherited* from .kbia-hero --
 * inheritance loses to any direct rule regardless of specificity -- so the hero
 * title has always rendered navy. On the solid navy ground that was invisible
 * and simply never noticed; over footage it is unreadable. Setting it on the
 * title itself is the fix, and it applies to the interior hero too, which had
 * the same defect.
 */
.kbia-hero__title {
	color: #fff;
}

/*
 * Over video the copy needs more help than the base scrim gives it. The base
 * gradient reaches zero at the right edge, but the hero h1 is up to 128px and
 * runs well past halfway, so its tail sat over clear footage. Hold the dark
 * further across, and cap the measure so the line cannot reach the bright end.
 */
.kbia-hero--video::after {
	background: linear-gradient(
		90deg,
		rgb(0 0 0 / 80%) 0%,
		rgb(0 0 0 / 58%) 45%,
		rgb(0 0 0 / 12%) 100%
	);
}

.kbia-hero--video .kbia-hero__title {
	max-width: 16ch;
}

.kbia-hero--video .kbia-hero__standfirst {
	max-width: 38ch;
}

/* blue-200 is a mid tone that reads fine on flat navy and disappears on bright
   frames. White, with the letterspacing already doing the eyebrow's work. */
.kbia-hero--video .kbia-hero__eyebrow {
	color: #fff;
}

.kbia-hero--video .kbia-hero__standfirst {
	color: rgb(255 255 255 / 92%);
}
