/* BW Guides — admin reading UI */

.bw-guides-filters {
	margin: 16px 0 20px;
}

/* The search box is the primary way in once the library is dozens of guides
   deep, so it gets its own prominent row above the secondary tag/source
   filters rather than sitting shoulder-to-shoulder with them. */
.bw-guides-search-row {
	margin: 0 0 10px;
}

.bw-guides-search-input {
	width: 100%;
	max-width: 560px;
	font-size: 16px;
	line-height: 1.4;
	padding: 10px 14px;
	border-radius: 6px;
	border: 1px solid #8c8f94;
}

.bw-guides-filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Category group headers on the browse grid — see
   BW_Guides_Keywords::group_guides(). Deliberately a real heading (not the
   small uppercase label style used for "In this guide"/"Jump straight to")
   since these are the primary scan targets on a page of dozens of cards. */
.bw-guides-group {
	margin: 0 0 32px;
}

.bw-guides-group:last-child {
	margin-bottom: 0;
}

.bw-guides-group-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 14px;
	padding: 0 0 8px;
	border-bottom: 1px solid #dcdcde;
	max-width: 1100px;
}

.bw-guides-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 16px;
	max-width: 1100px;
}

.bw-guides-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 16px 18px;
	display: flex;
	flex-direction: column;
}

.bw-guides-card h2 {
	margin: 8px 0 6px;
	font-size: 16px;
	line-height: 1.35;
}

.bw-guides-card h2 a {
	text-decoration: none;
}

.bw-guides-card-excerpt {
	color: #50575e;
	margin: 0 0 12px;
	flex-grow: 1;
}

/* Up to 3 quick links to a card's first h2s — kept small and muted so the
   card stays scannable rather than busy; the excerpt (flex-grow above) is
   still what pushes the footer to the bottom of the card regardless of
   whether a given card has any quick links at all. */
.bw-guides-card-quicklinks {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
	font-size: 12px;
}

.bw-guides-card-quicklinks li {
	margin: 0 0 4px;
}

.bw-guides-card-quicklinks a {
	text-decoration: none;
	color: #2271b1;
}

.bw-guides-card-quicklinks a::before {
	content: "→ ";
	color: #8c8f94;
}

.bw-guides-card-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	font-size: 12px;
	color: #757575;
}

.bw-guides-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 2px 8px;
	border-radius: 10px;
}

.bw-guides-badge-hub {
	background: #f0e6ff;
	color: #5a2ca0;
}

.bw-guides-badge-local {
	background: #e5f1e8;
	color: #1a7a35;
}

.bw-guides-tag {
	display: inline-block;
	background: #f0f0f1;
	border-radius: 10px;
	padding: 1px 8px;
	margin: 0 2px 2px 0;
	text-decoration: none;
	font-size: 12px;
}

.bw-guides-empty {
	background: #fff;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	padding: 32px;
	max-width: 640px;
	text-align: center;
}

/* Single guide */

.bw-guides-single-head {
	max-width: 760px;
}

.bw-guides-single-head h1 {
	margin: 8px 0 4px;
	padding: 0;
}

.bw-guides-meta {
	color: #757575;
	margin-top: 0;
}

.bw-guides-content {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 32px 40px;
	max-width: 760px;
	margin: 16px 0 24px;
	font-size: 15px;
	line-height: 1.7;
}

.bw-guides-content h2 {
	font-size: 1.4em;
	margin: 1.4em 0 0.5em;
}

.bw-guides-content h3 {
	font-size: 1.15em;
	margin: 1.2em 0 0.4em;
}

.bw-guides-content img {
	max-width: 100%;
	height: auto;
}

.bw-guides-content ul,
.bw-guides-content ol {
	padding-left: 1.4em;
	list-style: revert;
}

/* Contents list at the top of a guide, generated from its h2s. */

.bw-guides-toc {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 16px 24px;
	max-width: 760px;
	margin: 16px 0 0;
}

.bw-guides-toc-title {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #757575;
	margin: 0 0 8px;
	padding: 0;
}

.bw-guides-toc ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
}

.bw-guides-toc li {
	margin: 0;
}

/* "Jump straight to" — heading matches on the guides list. */

.bw-guides-sections {
	background: #fff;
	border: 1px solid #dcdcde;
	border-left: 4px solid #2271b1;
	border-radius: 4px;
	padding: 16px 24px;
	margin: 16px 0;
	max-width: 760px;
}

.bw-guides-sections h2 {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #757575;
	margin: 0 0 10px;
	padding: 0;
}

.bw-guides-sections ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bw-guides-sections li {
	margin: 0 0 6px;
}

.bw-guides-sections li:last-child {
	margin-bottom: 0;
}

.bw-guides-sections a {
	font-weight: 600;
	text-decoration: none;
}

.bw-guides-section-source {
	color: #757575;
	font-size: 13px;
	margin-left: 8px;
}

/* Shown on a "Jump straight to" hit that only matched via a guide's hidden
   keywords (via=keyword), not the visible heading text — a subtle nod to why
   an unexpected-looking section showed up, without exposing scores. */
.bw-guides-section-hint {
	color: #757575;
	font-size: 12px;
	font-style: italic;
	margin-left: 6px;
}

/* Anchored headings must clear the fixed admin bar when jumped to. */
.bw-guides-content h2[id],
.bw-guides-content h3[id] {
	scroll-margin-top: 48px;
}

/* ---------------------------------------------------------------------------
 * Core block rendering inside a guide.
 *
 * Guides render in wp-admin, NOT through the theme, so the environment is
 * identical on every client site — design once, looks the same everywhere.
 * The catch: WordPress hooks wp_enqueue_global_styles() to wp_enqueue_scripts
 * only, never admin_enqueue_scripts. So theme.json output is absent here:
 * no --wp--style--block-gap, no --wp--preset--* variables, and no
 * .wp-element-button styling. wp-block-library gives us structure but not
 * appearance. Everything below supplies what global styles would have.
 *
 * Consequence for authoring: preset palette classes
 * (has-vivid-red-background-color et al) resolve to nothing here. Hub patterns
 * therefore carry explicit hex in inline styles, which survive wp_kses_post.
 * All rules are scoped to .bw-guides-content so nothing leaks into wp-admin.
 * ------------------------------------------------------------------------ */

.bw-guides-content > *:first-child {
	margin-top: 0;
}

.bw-guides-content > *:last-child {
	margin-bottom: 0;
}

/* Group — the callout/note container. Inline styles from patterns override
   these defaults, so this is only a floor for hand-authored groups. */
.bw-guides-content .wp-block-group {
	margin: 1.5em 0;
}

.bw-guides-content .wp-block-group.has-background {
	padding: 20px 24px;
	border-radius: 6px;
}

.bw-guides-content .wp-block-group.has-background > *:first-child {
	margin-top: 0;
}

.bw-guides-content .wp-block-group.has-background > *:last-child {
	margin-bottom: 0;
}

/* Columns — block-gap would normally come from theme.json. */
.bw-guides-content .wp-block-columns {
	display: flex;
	gap: 20px;
	margin: 1.5em 0;
	align-items: stretch;
}

.bw-guides-content .wp-block-column {
	flex: 1 1 0;
	min-width: 0;
}

.bw-guides-content .wp-block-column > *:first-child {
	margin-top: 0;
}

.bw-guides-content .wp-block-column > *:last-child {
	margin-bottom: 0;
}

/* The guide card is 760px, so stack columns well before the core 782px
   breakpoint — side-by-side columns get cramped inside the card first. */
@media screen and (max-width: 1100px) {
	.bw-guides-content .wp-block-columns:not(.is-not-stacked-on-mobile) {
		flex-wrap: wrap;
	}

	.bw-guides-content .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
		flex-basis: 100% !important;
	}
}

/* Buttons — .wp-element-button styling lives in theme.json, absent here. */
.bw-guides-content .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 1.5em 0;
}

.bw-guides-content .wp-block-button__link {
	display: inline-block;
	background: #2271b1;
	color: #fff;
	border: 1px solid #2271b1;
	border-radius: 3px;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.bw-guides-content .wp-block-button__link:hover,
.bw-guides-content .wp-block-button__link:focus {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
}

.bw-guides-content .wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: #2271b1;
}

.bw-guides-content .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: #f0f6fc;
	color: #135e96;
}

/* Details — the FAQ accordion. */
.bw-guides-content .wp-block-details {
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 12px 16px;
	margin: 0.75em 0;
	background: #fff;
}

.bw-guides-content .wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	list-style-position: outside;
}

.bw-guides-content .wp-block-details[open] summary {
	margin-bottom: 0.6em;
	border-bottom: 1px solid #f0f0f1;
	padding-bottom: 0.6em;
}

.bw-guides-content .wp-block-details > *:last-child {
	margin-bottom: 0;
}

/* Tables */
.bw-guides-content .wp-block-table {
	margin: 1.5em 0;
	overflow-x: auto;
}

.bw-guides-content .wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.bw-guides-content .wp-block-table th,
.bw-guides-content .wp-block-table td {
	border: 1px solid #dcdcde;
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
}

.bw-guides-content .wp-block-table thead th {
	background: #f6f7f7;
	font-weight: 600;
}

.bw-guides-content .wp-block-table figcaption {
	color: #757575;
	font-size: 13px;
	margin-top: 6px;
}

/* Separator, quotes, images, media & text */
.bw-guides-content .wp-block-separator {
	border: 0;
	border-top: 1px solid #dcdcde;
	margin: 2em 0;
}

.bw-guides-content .wp-block-quote {
	border-left: 4px solid #2271b1;
	margin: 1.5em 0;
	padding: 4px 0 4px 16px;
	font-style: normal;
}

.bw-guides-content .wp-block-quote cite {
	color: #757575;
	font-size: 13px;
	font-style: normal;
}

.bw-guides-content .wp-block-image {
	margin: 1.5em 0;
}

.bw-guides-content .wp-block-image figcaption {
	color: #757575;
	font-size: 13px;
	margin-top: 6px;
}

.bw-guides-content .wp-block-media-text {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	align-items: center;
	margin: 1.5em 0;
}

.bw-guides-content .wp-block-media-text.has-media-on-the-right .wp-block-media-text__media {
	order: 2;
}

@media screen and (max-width: 1100px) {
	.bw-guides-content .wp-block-media-text.is-stacked-on-mobile {
		grid-template-columns: 1fr;
	}
}

/* Code shown inline in instructions, e.g. /wp-admin */
.bw-guides-content code {
	background: #f0f0f1;
	border-radius: 3px;
	padding: 2px 5px;
	font-size: 0.92em;
}

/* ---------------------------------------------------------------------------
 * BW guide components (the design kit).
 *
 * Hub patterns apply these class names via the core Group/List blocks' plain
 * className attribute — no custom blocks, no hand-serialized inline styles.
 * That matters for two reasons: the block markup stays trivially valid in
 * Gutenberg (hand-written style attributes risk "unexpected or invalid
 * content" warnings), and the house style can be restyled here later without
 * touching a single published guide.
 *
 * These rules are mirrored in the hub's editor stylesheet
 * (bw-guides-server/assets/css/editor.css) so the hub editor previews what
 * clients will actually see. Keep the two in sync when changing a colour.
 * ------------------------------------------------------------------------ */

.bw-guides-content .bw-callout {
	background: #eef4ff;
	border-left: 4px solid #2271b1;
	border-radius: 6px;
	padding: 16px 20px;
	margin: 1.5em 0;
}

.bw-guides-content .bw-callout > *:first-child {
	margin-top: 0;
}

.bw-guides-content .bw-callout > *:last-child {
	margin-bottom: 0;
}

.bw-guides-content .bw-callout-warning {
	background: #fff8e5;
	border-left-color: #dba617;
}

.bw-guides-content .bw-callout-success {
	background: #edf8f0;
	border-left-color: #00a32a;
}

.bw-guides-content .bw-callout-danger {
	background: #fcf0f1;
	border-left-color: #d63638;
}

/* The small bold lead-in line at the top of a callout. */
.bw-guides-content .bw-callout-label {
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	margin: 0 0 6px;
	color: #1d2327;
}

/* Numbered steps — bigger, better-separated list items for procedures. */
.bw-guides-content .bw-steps {
	counter-reset: bw-step;
	list-style: none;
	padding-left: 0;
	margin: 1.5em 0;
}

.bw-guides-content .bw-steps > li {
	counter-increment: bw-step;
	position: relative;
	padding: 0 0 0 42px;
	margin: 0 0 16px;
	min-height: 28px;
}

.bw-guides-content .bw-steps > li::before {
	content: counter(bw-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #2271b1;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 28px;
	text-align: center;
}

.bw-guides-content .bw-steps > li:last-child {
	margin-bottom: 0;
}

.bw-guides-panel {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 16px 24px;
	max-width: 760px;
	margin-bottom: 16px;
}

.bw-guides-panel h2 {
	margin-top: 4px;
	font-size: 14px;
}

.bw-guides-feedback {
	margin-left: 8px;
	font-style: italic;
	color: #1a7a35;
}

.bw-guides-feedback.bw-guides-feedback-error {
	color: #b32d2e;
}

.bw-guides-update-banner {
	max-width: 760px;
}

/* Settings */

.bw-guides-inline-form {
	display: inline-block;
	margin-right: 8px;
}

.bw-guides-status-ok {
	color: #1a7a35;
	font-weight: 600;
}

.bw-guides-status-error {
	color: #b32d2e;
	font-weight: 600;
}
