/**
 * OptConnect core template overrides (PR 4.1) — `single-post`, `single`, `archive`,
 * `search`, `home`, `404`, and the `sidebar` part three of them share.
 *
 * One file because none of these is a *section* an editor places on a page; they are
 * the chrome the templates put around content. Everything reusable already lives in a
 * family file and is not repeated here: the archive card in `card-grid.css`, the
 * loop's grid item, meta line and pager in `post-loop.css`, the hero band in
 * `hero.css`, the form mount in `form-section.css`, the button in `theme.json`.
 *
 * **The parent theme already styles nine of the core blocks used here** —
 * `core/search`, `core/separator`, `core/post-date`, `core/post-terms`,
 * `core/post-navigation-link`, `core/query-pagination`, `core/term-description`,
 * `core/post-title` and `core/columns`' `blockGap` — and all nine are inherited rather
 * than overridden. `core/categories` and `core/tag-cloud` are the two it says
 * **nothing** about, and they are the two that needed real rules.
 *
 * Same no-margins convention as every other family stylesheet: nothing inside a
 * block-gapped group declares a `margin`, because core's flow layout emits
 * `.wp-container-… > * + * { margin-block-start: … }` at one-class specificity and
 * this file loads after it — so a `margin` here silently deletes a `blockGap` the
 * markup asked for. Spacing between blocks is set in the pattern. The three
 * exceptions below say why they are exceptions.
 *
 * Selectors are scoped `.oc-sidebar <part>` / `.oc-post <part>` rather than bare: a
 * part that overrides a global-styles rule at the same specificity is decided by
 * stylesheet order, and global styles print inline in `<head>` while this file is a
 * `<link>` enqueued on the same hook.
 */

/* --------------------------------------------------------------------------
 * Archive shell — the two columns exist only to hold the sidebar
 *
 * `core/columns` collapses at core's own 781px breakpoint, so there is no breakpoint
 * of ours to keep in step. Once stacked the sidebar sits below the results, which is
 * the order it is in the DOM — see `patterns/blog-loop.php` for why.
 * ---------------------------------------------------------------------- */

/* Exception 1: core/columns carries `margin-bottom: 1.75em` in a `:where()` wrapper,
   so this one class clears it. It is not a block gap — the section's padding is. */
.oc-post-loop__cols {
	margin-bottom: 0;
}

/* A grid inside a flex item will not shrink below its tracks' intrinsic width, so
   without this a two-up card grid pushes the column past its own `flex-basis`
   instead of reflowing. */
.oc-post-loop__results {
	min-width: 0;
}

/* --------------------------------------------------------------------------
 * Sidebar — `parts/sidebar.html` → `optconnect/sidebar`
 *
 * Nothing here is sticky and nothing is sized in `vh`: the tag list is 45 chips tall
 * and would be taller than most viewports.
 * ---------------------------------------------------------------------- */

/* The panel headings and the search form's `<label>` are one thing to a reader, so
   they are styled together. `contrast` rather than the `accent-1` blue `theme.json`
   gives every `<h2>`: #0081c2 at 18px bold is **4.27:1**, and 18px is under the
   18.66px that would make it large text. `contrast` is 14.29:1. */
.oc-sidebar .oc-sidebar__title,
.oc-sidebar .wp-block-search__label {
	color: var(--wp--preset--color--contrast, #1d2c38);
	font-family: var(--wp--preset--font-family--nunito, sans-serif);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.3;
}

/* Exception 2: core ships `.wp-block-categories { box-sizing: border-box }` and no
   list reset, and the parent theme has no opinion either — so unstyled this is a UA
   `<ul>` with discs and a 40px indent inside a 28% column. The `margin` is the reset,
   not a gap; the list is a leaf block. */
.oc-sidebar .oc-sidebar__categories {
	margin: 0;
	padding: 0;
	list-style: none;
}

.oc-sidebar .oc-sidebar__categories li + li {
	margin-top: 0.25rem;
}

/* `wp_list_categories` writes the post count *outside* the link, so the link's
   accessible name stays the category name alone. */
.oc-sidebar .oc-sidebar__categories a {
	display: inline-block;
	padding-block: 0.25rem;
	color: var(--wp--preset--color--accent-2, #006ba4);
	text-decoration: none;
}

.oc-sidebar .oc-sidebar__categories a:hover,
.oc-sidebar .oc-sidebar__categories a:focus-visible {
	text-decoration: underline;
}

/* `current-cat` is core's own class; the link inside already carries
   `aria-current="page"`, and this is the visible half of the same statement. */
.oc-sidebar .oc-sidebar__categories .current-cat > a {
	color: var(--wp--preset--color--contrast, #1d2c38);
	font-weight: 700;
}

/* The chip's border, wrapping and `1ch` gap come from core's `outline` variation, so
   only the size is left — and it must go on the *container*: the variation declares
   `font-size: unset !important` on the anchor, which resolves to `inherit`. At the
   sidebar's own 1rem these 45 chips stack nearly one per row and outrun the post grid
   beside them. 32px measured, clearing WCAG 2.5.8's 24px target. */
.oc-sidebar .oc-sidebar__tags {
	font-size: 0.875rem;
}

/* `text-decoration` is `!important` in that variation too, so hover has to be a
   surface change rather than an underline. */
.oc-sidebar .oc-sidebar__tags a {
	padding: 0.3rem 0.65rem;
	border-radius: 4px;
	color: var(--wp--preset--color--accent-2, #006ba4);
	transition: background-color 0.2s ease-in-out;
}

.oc-sidebar .oc-sidebar__tags a:hover,
.oc-sidebar .oc-sidebar__tags a:focus-visible {
	background-color: var(--wp--preset--color--accent-5, #eff2f8);
}

@media (prefers-reduced-motion: reduce) {
	.oc-sidebar .oc-sidebar__tags a {
		transition: none;
	}
}

/* `:not(.wp-element-button)` keeps this off the search submit: at (0,2,0) it would
   beat `theme.json`'s own `:root :where(.wp-element-button)` focus ring at (0,1,0).
   On this white surface that ring is the 5px `contrast` shadow, not the white
   outline. */
.oc-sidebar :focus-visible:not(.wp-element-button) {
	outline: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
 * Single post
 *
 * The 875px measure, the block gaps and the nav's top border are declared in
 * `patterns/post-single.php` so the Site Editor's controls stay truthful. Only what
 * the editor cannot express is here.
 * ---------------------------------------------------------------------- */

/* Exception 3: `core/post-featured-image` zeroes only the left and right margins, so
   the browser's `figure { margin: 1em 40px }` survives top and bottom. Nothing here
   is fighting a gap — the space below is `.oc-post`'s `margin-block-start`. */
.oc-post__media {
	margin-block: 0;
}

/* Each link is `label + title` in one anchor, so it can run as long as a post title;
   capping both at just under half stops them colliding at the row's centre.
   ⚠️ The arrow is core's `<span aria-hidden>` and a *sibling* of the anchor — before
   it on the previous link, after it on the next. So the row is the flex container
   that puts the arrow beside the link and the anchor is a second one that stacks
   label over title. Stack them with `display: block` on the label instead and the
   arrow is pushed onto a line of its own. `baseline` aligns it with the label rather
   than the middle of a two-line block. */
.oc-post .oc-post__nav > .wp-block-post-navigation-link {
	display: flex;
	max-width: 46%;
	align-items: baseline;
	gap: 0.5rem;
}

@media (max-width: 600px) {
	.oc-post .oc-post__nav > .wp-block-post-navigation-link {
		max-width: 100%;
	}
}

.oc-post .oc-post__nav a {
	display: flex;
	flex-direction: column;
	color: var(--wp--preset--color--accent-2, #006ba4);
	text-decoration: none;
}

.oc-post .oc-post__nav a:hover,
.oc-post .oc-post__nav a:focus-visible {
	text-decoration: underline;
}

/* The label is the smaller half of the pair and must not read as the link text. */
.oc-post .oc-post__nav .post-navigation-link__label {
	color: var(--wp--preset--color--accent-6, #454545);
	font-size: 0.875rem;
	font-weight: 400;
}

.oc-post .oc-post__nav .post-navigation-link__title {
	font-weight: 700;
}

.oc-post .oc-post__nav :focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	outline-offset: 2px;
}

/* Posts batch 2 (PR 6.1): a call to action over a photo is a `core/cover` sized by its
   content. Core gives every cover `min-height: 430px`, and the block can't store a
   zero minimum — its `save()` drops `minHeight: 0`, so the markup can't carry it. */
.oc-post__cta.wp-block-cover {
	min-height: 0;
}

/* `cta-band.css` greys `.oc-cta__text` for the light band; over the photo's 70%
   overlay it takes the cover's white. */
.oc-post__cta.wp-block-cover .oc-cta__text {
	color: inherit;
}

/* The author's photo keeps its 120px beside the bio: a flex item shrinks to fit by
   default, and `core/image` has no child-layout control to stop it. */
.oc-post__author .oc-post__author-photo {
	flex-shrink: 0;
}

/* "Post — with byline" (posts batch 3): live marked the author with a user icon;
   the word reads the same and needs no icon font. */
.oc-post__byline::before {
	content: "By ";
}

/* An image floated beside the copy (`oc-post__float`) has no room to float on a phone:
   it takes its own line, at the start of the column. */
@media (max-width: 600px) {
	.oc-post .oc-post__float.alignright {
		float: none;
		margin-inline: 0;
	}
}

/* --------------------------------------------------------------------------
 * 404
 *
 * Width and centring come from the group's own 620px `layout.contentSize`. Only
 * core's `core/image` `margin-bottom: 1em` needs clearing — and only the bottom half,
 * since the flow layout sets `margin-block-start`.
 * ---------------------------------------------------------------------- */
.oc-error-404 .oc-error-404__art {
	margin-bottom: 0;
}

/* --------------------------------------------------------------------------
 * Page content — two full-width bands in a row (PR 6.2)
 *
 * `templates/page.html` gives `core/post-content` a constrained layout, so core puts
 * the root `blockGap` (TT5's 1.2rem) above every top-level section. Beside a white,
 * contained section that reads as spacing. Between two `alignfull` bands it is a
 * 19px strip of page white, across the whole viewport, between a coloured band and a
 * cover, say. Measured on 2026-11-29: 54 such strips over 157 pages.
 *
 * Every band carries its own vertical padding, so the gap adds nothing between two of
 * them. (0,3,0) beats core's `:root :where(.is-layout-constrained) > *`, while a
 * margin an editor sets on a band is inline and still wins. Only `post-content`: the
 * archive templates' `main` groups set their own `blockGap` (PR 4.1), and there the
 * bands meet white sections. `.is-root-container` is the same list in the post
 * editor, so it previews no strip the page won't have.
 *
 * `+` needs the two bands to be siblings with nothing between them. A `<script>`,
 * `<style>` or popup printed between two bands keeps the gap; after this rule the
 * sweep found none.
 * ---------------------------------------------------------------------- */
.wp-block-post-content > .alignfull + .alignfull,
.is-root-container > .alignfull + .alignfull {
	margin-block-start: 0;
}

/* A URL printed as text is one unbreakable word. On a phone it pushes the page
   sideways: three agreements (connectivity and managed-services addenda, data
   processing) were 10–105px wider than a 390px viewport, the widest from an ICO PDF
   address. `break-word` breaks a word only when it can't fit its line, so no other
   text changes. */
.wp-block-post-content {
	overflow-wrap: break-word;
}
