/*
 * ASAE News Releases — public-side styles.
 *
 * Two surfaces share this stylesheet:
 *   - Single news_release page (bundled template): `.asae-nr-single*`
 *   - Listing shortcode `[asae_news_releases]`: `.asae-nr-list*`
 *
 * Layout: search row of two filters + actions, then a vertical list of
 * release cards. Switches to single-column form below ~720px so labels
 * never get cropped on phone widths. Colors tuned for WCAG 2.2 AA
 * contrast on a white page background; themes that change page bg
 * should override `.asae-nr-list` / `.asae-nr-single`.
 *
 * Color scheme: primary accent comes from `--nv-primary-accent` when
 * the active theme is Neve (so the plugin matches the site brand —
 * e.g. ASAE's rust orange #bd491e), and falls back to WP-admin blue
 * #2271b1 elsewhere. Inline text links (back link, body anchors) have
 * NO explicit color rule and inherit the theme's normal link styling.
 * Hover states use `filter: brightness(0.85)` so the darkening works
 * regardless of base color.
 */

/* ── Single news_release page ───────────────────────────────────────────
 *
 * Two paths share these styles:
 *   - The active theme's page.php (default chrome — breadcrumb + title +
 *     content; we prepend the publish date and append Media Contact +
 *     About ASAE via the_content filter).
 *   - The plugin's bundled fallback template (used only when the theme
 *     has no page.php).
 *
 * The shared classes are .asae-nr-publish-date, .asae-nr-media-contact,
 * .asae-nr-about-asae — applied to elements injected into the_content,
 * so they render the same way regardless of which template wraps them.
 * The .asae-nr-single-* classes (-wrap, -title, -header, -back-link)
 * are bundled-template-only.
 */

/* "← Return to News Releases" link rendered at the bottom of
 * the_content via the_content filter at priority 25 (after the
 * boilerplate at priority 20). Set off from the About ASAE block
 * above with a top border so it reads as end-of-release navigation
 * rather than part of the boilerplate. */
.asae-nr-back-link {
	margin: 1.5em 0 0;
	padding-top: 1em;
	border-top: 1px solid var(--asae-border-subtle, #dddddd);
	font-size: 0.95em;
}
.asae-nr-back-link a {
	/* Inherit theme's link color rather than forcing one — keeps the
	 * end-of-release nav consistent with how the theme styles links
	 * elsewhere. */
	text-decoration: none;
}
.asae-nr-back-link a:hover,
.asae-nr-back-link a:focus {
	text-decoration: underline;
}

/* CEO section on Updates from the CEO singulars — wraps the optional
 * signature image and the optional CEO card. Appended to the_content
 * at priority 15 (between the publish-date prepend at 5 and the
 * Media Contact / About ASAE boilerplate append at 20). */
.asae-nr-mu-ceo-section {
	margin: 2em 0 0;
}
.asae-nr-mu-signature {
	margin: 0 0 20px;
}
.asae-nr-mu-signature img {
	max-width: 280px;
	height: auto;
	display: block;
}
.asae-nr-mu-ceo-card {
	display: flex;
	align-items: center;
	gap: 1em;
	padding: 1em 1.25em;
	background: var(--asae-surface, #f7f7f7);
	border-left: 3px solid var(--nv-primary-accent, #bd491e);
	border-radius: 0 var(--asae-radius, 3px) var(--asae-radius, 3px) 0;
	font-size: 0.95em;
}
.asae-nr-mu-ceo-card-photo {
	flex: 0 0 auto;
}
.asae-nr-mu-ceo-card-photo img {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}
.asae-nr-mu-ceo-card-body {
	flex: 1 1 auto;
	min-width: 0;
}
.asae-nr-mu-ceo-card-body p {
	margin: 0 0 0.2em;
}
.asae-nr-mu-ceo-card-body p:last-child {
	margin-bottom: 0;
}
.asae-nr-mu-ceo-card-name strong {
	font-weight: 700;
}
.asae-nr-mu-ceo-card-title {
	color: var(--asae-text-muted, #595959);
	font-style: italic;
}

/* Stale-content warning box — pale yellow, shown when a release is
 * more than 1 year old. Sits between the back link and the title. */
.asae-nr-stale-warning {
	margin: 0 0 1em;
	padding: 0.75em 1.25em;
	background: #fcf8e3;
	border-left: 4px solid #f0ad4e;
	border-radius: 0 var(--asae-radius, 3px) var(--asae-radius, 3px) 0;
	color: var(--nv-text-color, #2b2b2b);
	font-size: 0.95em;
}
.asae-nr-stale-warning strong {
	font-weight: 700;
}

/* Publish date — prepended to the_content as a labeled <time>. Renders
 * just below the theme's page title, looking like article subhead. */
.asae-nr-publish-date {
	margin: -0.4em 0 1.2em;
	color: var(--asae-text-muted, #595959);
	font-style: italic;
	font-size: 0.95em;
}
.asae-nr-publish-date time {
	display: inline;
}

/* Theme chrome cleanup — fired on the body.asae-nr-streamlined class
 * added by ASAE_NR_Content::add_streamlined_body_class().
 *
 * The Neve theme renders a "post cover" block (.nv-post-cover) above
 * page.php's content area for any single-post-shaped view, regardless
 * of which template_include returns. The block contains a duplicated
 * breadcrumb + H1 PLUS author byline + date — all unwanted on a press
 * release. page.php's own .nv-page-title-wrap renders the breadcrumb
 * + title cleanly without the author/date, which is what we want, so
 * we hide the cover block here.
 *
 * The sidebar (.nv-sidebar-wrap) is also unwanted; we hide it and
 * expand .nv-single-page-wrap to full width so content fills the row.
 *
 * Selectors are scoped under body.asae-nr-streamlined so these rules
 * never affect other pages on the site. !important is necessary
 * because Neve's inline customizer-driven styles use the cascade we
 * have to win against. */
body.asae-nr-streamlined .nv-post-cover,
body.asae-nr-streamlined .nv-sidebar-wrap {
	display: none !important;
}
body.asae-nr-streamlined .neve-main > .container > .row > .col,
body.asae-nr-streamlined .neve-main > .container-fluid > .row > .col {
	max-width: 100% !important;
	flex: 0 0 100% !important;
	width: 100% !important;
}

/* The stale warning is echoed by loop_start, which fires inside
 * the_post(). Neve renders .nv-page-title-wrap from OUTSIDE the loop,
 * so the warning lands AFTER the title-wrap in DOM order. Make
 * .nv-single-page-wrap.col a flex column and assign orders so the
 * visual sequence becomes:
 *   1. .nv-page-title-wrap    → order 1 (breadcrumb + title)
 *   2. stale warning (if any) → order 2 (between title and content)
 *   3. .nv-content-wrap       → order 3 (date, body, boilerplate,
 *                                       bottom back link inside)
 * The bottom back link lives inside .nv-content-wrap so its position
 * is untouched by these orders (it's not a direct child of the flex
 * container). */
body.asae-nr-streamlined .nv-single-page-wrap.col {
	display: flex !important;
	flex-direction: column !important;
}
body.asae-nr-streamlined .nv-single-page-wrap.col > .nv-page-title-wrap {
	order: 1;
}
body.asae-nr-streamlined .nv-single-page-wrap.col > .asae-nr-stale-warning {
	order: 2;
}
body.asae-nr-streamlined .nv-single-page-wrap.col > .nv-content-wrap {
	order: 3;
}
/* Title alignment matches body Pages (left), not Neve's wide-screen
 * default which centers .nv-page-title-wrap. */
body.asae-nr-streamlined .nv-page-title-wrap,
body.asae-nr-streamlined .nv-page-title,
body.asae-nr-streamlined .nv-page-title-wrap .neve-breadcrumbs-wrapper,
body.asae-nr-streamlined .nv-page-title-wrap h1 {
	--textalign: left;
	text-align: left;
}

/* Bundled-fallback layout (rare — only when theme has no page.php) */

.asae-nr-single-wrap {
	max-width: 760px;
	margin: 2em auto;
	padding: 0 1.25em;
	color: var(--nv-text-color, #2b2b2b);
	font-size: 17px;
	line-height: 1.6;
}
.asae-nr-single-article {
	background: var(--nv-site-bg, #fff);
}
.asae-nr-single-header {
	margin: 0 0 1.5em;
	padding-bottom: 1em;
	border-bottom: 1px solid var(--asae-border-subtle, #dddddd);
}
.asae-nr-single-title {
	margin: 0 0 0.4em;
	font-size: 2em;
	line-height: 1.2;
	font-weight: 700;
	color: var(--nv-text-color, #2b2b2b);
}
.asae-nr-single-meta {
	margin: 0;
	color: var(--asae-text-muted, #595959);
	font-size: 0.95em;
	font-style: italic;
}
.asae-nr-single-body {
	margin: 0;
}
.asae-nr-single-body p {
	margin: 0 0 1em;
}
.asae-nr-single-body h2,
.asae-nr-single-body h3 {
	margin-top: 1.4em;
	margin-bottom: 0.5em;
	line-height: 1.25;
}
.asae-nr-single-body a {
	/* Inherit theme link color. */
}
.asae-nr-single-body a:hover,
.asae-nr-single-body a:focus {
	text-decoration: underline;
}

/* Boilerplate (Media Contact + About ASAE) appended via the_content
 * filter — render as visually distinct sections set off from the body.
 * Left accent uses the theme's brand color when available (Neve's
 * --nv-primary-accent) and falls back to WP-admin blue elsewhere. */
.asae-nr-single-body .asae-nr-media-contact,
.asae-nr-single-body .asae-nr-about-asae {
	display: block;
	margin: 2em 0 0;
	padding: 1em 1.25em;
	background: var(--asae-surface, #f7f7f7);
	border-left: 3px solid var(--nv-primary-accent, #bd491e);
	border-radius: 0 var(--asae-radius, 3px) var(--asae-radius, 3px) 0;
	font-size: 0.95em;
}
.asae-nr-single-body .asae-nr-media-contact > :first-child,
.asae-nr-single-body .asae-nr-about-asae > :first-child {
	margin-top: 0;
}
.asae-nr-single-body .asae-nr-media-contact > :last-child,
.asae-nr-single-body .asae-nr-about-asae > :last-child {
	margin-bottom: 0;
}

.asae-nr-single-back {
	margin: 2em 0 0;
	padding-top: 1em;
	border-top: 1px solid var(--asae-border-subtle, #dddddd);
}
.asae-nr-single-back-link {
	/* Inherit theme link color. */
	text-decoration: none;
	font-weight: 500;
}
.asae-nr-single-back-link:hover,
.asae-nr-single-back-link:focus {
	text-decoration: underline;
}

/* Defensive: if a theme injects a sidebar via aside selector inside our
 * main, don't let it break the layout — but our template doesn't call
 * get_sidebar() so this is just belt-and-braces. */
.asae-nr-single > aside,
.asae-nr-single .sidebar,
.asae-nr-single #sidebar {
	display: none !important;
}

@media (max-width: 720px) {
	.asae-nr-single-wrap {
		margin: 1em auto;
		font-size: 16px;
	}
	.asae-nr-single-title {
		font-size: 1.6em;
	}
}

/* ── Listing shortcode ──────────────────────────────────────────────── */

.asae-nr-list {
	color: var(--nv-text-color, #2b2b2b);
	font-size: 16px;
	line-height: 1.5;
}

/* Focus rings: only on genuinely interactive elements. Defensive scoping
 * so themes that focus-style their landmark regions don't outline the
 * entire widget. */
.asae-nr-list a:focus-visible,
.asae-nr-list button:focus-visible,
.asae-nr-list input:focus-visible,
.asae-nr-list select:focus-visible {
	outline: 3px solid var(--nv-primary-accent, #bd491e);
	outline-offset: 2px;
}
.asae-nr-list:focus,
.asae-nr-list:focus-visible,
.asae-nr-list:focus-within,
.asae-nr-list[tabindex]:focus,
.asae-nr-list[tabindex]:focus-visible,
.asae-nr-search:focus,
.asae-nr-search:focus-visible,
.asae-nr-search:focus-within,
.asae-nr-search[tabindex]:focus,
.asae-nr-search[tabindex]:focus-visible {
	outline: none !important;
	box-shadow: none !important;
}

/* Search form */
.asae-nr-search {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75em 1em;
	margin-bottom: 0.75em;
}
.asae-nr-search-field {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	flex: 1 1 240px;
	min-width: 160px;
}
/* Search-text input gets more room than the scope toggle */
.asae-nr-search-text {
	flex: 1 1 320px;
}

/* Search scope toggle — radio pair "Title only" / "Search all text". */
.asae-nr-search-scope {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	margin: 0;
	padding: 0;
	border: 0;
	flex: 0 1 auto;
}
.asae-nr-search-scope label {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	font-size: 0.95em;
	cursor: pointer;
}
.asae-nr-search-scope input[type="radio"] {
	margin: 0;
}

/* Year navigation — clickable list, "All" first, then years newest-first. */
.asae-nr-years {
	margin: 0 0 1em;
}
.asae-nr-years ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 0.4em;
	list-style: none;
	margin: 0;
	padding: 0;
	align-items: center;
}
.asae-nr-years a,
.asae-nr-years span {
	display: inline-block;
	padding: 0.25em 0.7em;
	border: 1px solid var(--asae-border-subtle, #dddddd);
	border-radius: var(--asae-radius-sm, 2px);
	color: var(--nv-primary-accent, #bd491e);
	background: var(--nv-site-bg, #fff);
	text-decoration: none;
	font-size: 0.95em;
	min-width: 3em;
	text-align: center;
}
.asae-nr-years a:hover,
.asae-nr-years a:focus {
	border-color: var(--nv-primary-accent, #bd491e);
	filter: brightness(0.95);
}
.asae-nr-years .is-current span {
	background: var(--nv-primary-accent, #bd491e);
	border-color: var(--nv-primary-accent, #bd491e);
	color: #fff;
	font-weight: 600;
}
.asae-nr-search-field label {
	font-weight: 600;
	font-size: 0.95em;
}
.asae-nr-search input[type="search"],
.asae-nr-search select {
	min-height: 2.4em;
	padding: 0.3em 0.6em;
	border: 1px solid var(--asae-border-control, #767676);
	border-radius: var(--asae-radius-sm, 2px);
	font: inherit;
	background: var(--nv-site-bg, #fff);
}
.asae-nr-search-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6em;
}
.asae-nr-search-submit {
	padding: 0.4em 1em;
	border: 1px solid var(--nv-primary-accent, #bd491e);
	background: var(--nv-primary-accent, #bd491e);
	color: #fff;
	border-radius: var(--asae-radius-sm, 2px);
	cursor: pointer;
	font: inherit;
}
.asae-nr-search-submit:hover,
.asae-nr-search-submit:focus {
	/* Theme-agnostic darken — works for whatever color the brand
	 * variable resolves to.
	 *
	 * Uses a translucent black layer rather than `filter: brightness()`: a
	 * filter applies to everything the element paints, including its own white
	 * label, so it greyed the text while darkening the button and lowered
	 * contrast instead of raising it. */
	background-image: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
}
.asae-nr-search-clear {
	/* Inherit theme link color. */
	text-decoration: underline;
}

/* Results summary line */
.asae-nr-results-summary {
	margin: 0.5em 0 0.75em;
	font-style: italic;
	color: var(--asae-text-muted, #595959);
}

/* Empty state */
.asae-nr-empty {
	padding: 1em 1.25em;
	background: var(--asae-surface, #f7f7f7);
	border: 1px solid var(--asae-border-subtle, #dddddd);
	border-radius: var(--asae-radius, 3px);
	font-style: italic;
}

/* List of release cards */
.asae-nr-items {
	list-style: none;
	margin: 0 0 1em;
	padding: 0;
}
.asae-nr-item {
	padding: 1em 0;
	border-bottom: 1px solid var(--asae-border-subtle, #dddddd);
}
.asae-nr-item:first-child {
	border-top: 1px solid var(--asae-border-subtle, #dddddd);
}
.asae-nr-item-title {
	margin: 0 0 0.25em;
	font-size: 1.15em;
	font-weight: 600;
	line-height: 1.3;
}
.asae-nr-item-title a {
	/* Inherit theme link color so card titles match the rest of
	 * the site's link styling. */
	text-decoration: none;
}
.asae-nr-item-title a:hover,
.asae-nr-item-title a:focus {
	text-decoration: underline;
}
.asae-nr-item-meta {
	margin: 0 0 0.5em;
	font-size: 0.9em;
	color: var(--asae-text-muted, #595959);
}
.asae-nr-item-excerpt {
	margin: 0;
}

/* Pagination — same visual language as the CAE Roster shortcode */
.asae-nr-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em;
	list-style: none;
	margin: 1em 0;
	padding: 0;
	align-items: center;
}
.asae-nr-pagination a,
.asae-nr-pagination span {
	display: inline-block;
	padding: 0.3em 0.7em;
	border: 1px solid var(--asae-border-subtle, #dddddd);
	border-radius: var(--asae-radius-sm, 2px);
	color: var(--nv-primary-accent, #bd491e);
	background: var(--nv-site-bg, #fff);
	text-decoration: none;
	min-width: 2.4em;
	text-align: center;
}
.asae-nr-pagination a:hover,
.asae-nr-pagination a:focus {
	border-color: var(--nv-primary-accent, #bd491e);
	filter: brightness(0.95);
}
.asae-nr-pagination .is-current span {
	background: var(--nv-primary-accent, #bd491e);
	border-color: var(--nv-primary-accent, #bd491e);
	color: #fff;
	font-weight: 600;
}
.asae-nr-pagination .is-disabled span {
	color: #a7aaad;
	background: var(--asae-surface, #f7f7f7);
	border-color: var(--asae-border-subtle, #dddddd);
	cursor: not-allowed;
}
.asae-nr-pagination .is-ellipsis span {
	border: none;
	background: transparent;
	padding: 0.3em 0.2em;
	color: var(--asae-text-muted, #595959);
}

/* Stack form vertically below 720px so 240-min flex children don't
 * wrap weirdly on phones. */
@media (max-width: 720px) {
	.asae-nr-search {
		flex-direction: column;
		align-items: stretch;
	}
	.asae-nr-search-field {
		flex: 1 1 auto;
	}
}

/* ── Updates from the CEO: members-only (v1.0.3) ──────────────────────────
 * Pill states and contrast mirror the AN / Content Partnership lock chips:
 * locked is filled and assertive, unlocked outlined and quiet, and the
 * shackle glyph differs too, so state never rests on colour alone. */
.asae-nr-item-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35em 0.75em;
}
.asae-nr-lock-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.12em 0.6em;
	border-radius: 999px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}
.asae-nr-lock__glyph {
	flex: 0 0 auto;
	width: 1.15em;
	height: 1.15em;
}
/* #fff on #2c3338 = 12.6:1. */
.asae-nr-lock-chip--locked {
	background: #2c3338;
	color: #fff;
}
/* Ink on white = 15:1; the 3.05:1 ring carries the boundary (1.4.11). */
.asae-nr-lock-chip--unlocked {
	background: transparent;
	color: #1d2327;
	box-shadow: inset 0 0 0 1px #8c8f94;
}

.asae-nr-mu-teaser {
	margin-bottom: 1.5em;
}
.asae-nr-memberwall {
	margin: 2em 0;
	padding: 1.75em 1.25em;
	border: 1px solid var(--asae-border-subtle, #dddddd);
	border-radius: var(--asae-radius-md, 8px);
	text-align: center;
}
.asae-nr-memberwall h2 {
	margin-top: 0;
}
.asae-nr-memberwall__lock {
	display: inline-block;
	margin-right: 0.35em;
	vertical-align: -0.1em;
}
.asae-nr-memberwall__lock .asae-nr-lock__glyph {
	width: 0.9em;
	height: 0.9em;
}
.asae-nr-memberwall .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75em;
}
