/**
 * Mervia Group — WordPress layer.
 *
 * The only stylesheet authored inside the theme. Everything else in
 * assets/css/ is a synced copy of design/ (docs/01-decisions.md D-06).
 *
 * Scope rule: a rule belongs here only if it exists because WordPress emits
 * markup this project did not write — block output, comment lists, admin bar,
 * gallery classes, plugin widgets. Anything that would also be true in a plain
 * HTML page belongs in design/components.css instead.
 */

/* ==========================================================================
   1. ADMIN BAR
   ==========================================================================
   The logged-in admin bar is 32px of fixed chrome that the sticky header knows
   nothing about, so the header would slide underneath it.
   ---------------------------------------------------------------------- */

.admin-bar .c-header {
	top: 32px;
}

.admin-bar .c-drawer {
	inset-block-start: calc(var(--co-header-height) + 32px);
}

@media (max-width: 782px) {
	.admin-bar .c-header {
		top: 46px;
	}

	.admin-bar .c-drawer {
		inset-block-start: calc(var(--co-header-height) + 46px);
	}
}

@media (max-width: 600px) {
	/* Below 600px WordPress un-fixes the admin bar, so the offset must go. */
	.admin-bar .c-header {
		top: 0;
	}
}

/* ==========================================================================
   2. BLOCK EDITOR OUTPUT
   ==========================================================================
   Editors write in blocks; the front end renders them inside .co-prose. These
   rules keep block output inside the design system instead of letting core's
   defaults leak through.
   ---------------------------------------------------------------------- */

.co-prose .wp-block-image {
	margin-block: var(--co-space-6);
}

.co-prose .wp-block-image img {
	border-radius: var(--co-radius-md);
}

.co-prose .wp-block-image.alignwide,
.co-prose .wp-block-image.alignfull {
	max-width: min(var(--co-container), 100%);
	margin-inline: auto;
}

.co-prose .wp-block-quote {
	border-inline-start: var(--co-border-accent-width) solid var(--co-color-action);
	padding-inline-start: var(--co-space-5);
	font-size: var(--co-text-md);
	color: var(--co-color-text-muted);
}

.co-prose .wp-block-quote cite {
	display: block;
	margin-block-start: var(--co-space-3);
	font-size: var(--co-text-sm);
	font-style: normal;
	color: var(--co-color-text-subtle);
}

.co-prose .wp-block-pullquote {
	padding: var(--co-space-6) 0;
	border-block: var(--co-border-width-thick) solid var(--co-color-rule);
	text-align: start;
}

.co-prose .wp-block-separator {
	border: 0;
	border-top: var(--co-border-width) solid var(--co-color-rule);
	margin-block: var(--co-space-8);
}

.co-prose .wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--co-text-sm);
}

.co-prose .wp-block-table th,
.co-prose .wp-block-table td {
	padding: var(--co-table-row-padding);
	border-bottom: var(--co-border-width) solid var(--co-color-border);
	text-align: start;
	vertical-align: top;
}

.co-prose .wp-block-table th {
	background: var(--co-color-surface-sunken);
	font-weight: var(--co-weight-semibold);
}

/* Wide tables are common in spec and compliance content and are the single
   most reliable source of horizontal page scroll on a phone. */
.co-prose .wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.co-prose .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--co-control-height);
	padding-inline: var(--co-space-5);
	background: var(--co-color-action);
	color: var(--co-color-action-text);
	border-radius: var(--co-radius-md);
	font-size: var(--co-text-sm);
	font-weight: var(--co-weight-semibold);
	text-decoration: none;
}

.co-prose .wp-block-button__link:hover {
	background: var(--co-color-action-hover);
	color: var(--co-color-action-text);
}

.co-prose .is-style-outline .wp-block-button__link {
	background: transparent;
	border: var(--co-border-width) solid var(--co-color-border-strong);
	color: var(--co-color-text);
}

.co-prose .wp-block-list {
	padding-inline-start: var(--co-space-5);
}

.co-prose .wp-block-embed__wrapper {
	position: relative;
}

.co-prose .wp-block-code {
	background: var(--co-color-surface-sunken);
	border-radius: var(--co-radius-md);
	padding: var(--co-space-4);
	overflow-x: auto;
}

/* ==========================================================================
   3. WIDGETS
   ========================================================================== */

.c-widget + .c-widget {
	margin-block-start: var(--co-space-7);
	padding-block-start: var(--co-space-7);
	border-block-start: var(--co-border-width) solid var(--co-color-rule);
}

.c-widget__title {
	font-size: var(--co-text-xs);
	font-weight: var(--co-weight-semibold);
	text-transform: uppercase;
	letter-spacing: var(--co-tracking-wide);
	color: var(--co-color-text-muted);
	margin-block-end: var(--co-space-4);
}

.c-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--co-space-2);
	font-size: var(--co-text-sm);
}

.c-widget a {
	color: var(--co-color-text-muted);
	text-decoration: none;
}

.c-widget a:hover {
	color: var(--co-color-action);
}

/* ==========================================================================
   4. ICONS FROM THE SPRITE
   ==========================================================================
   mervia_icon() prints an <svg> with no width or height, so the size comes
   from CSS and one sprite serves every context.
   ---------------------------------------------------------------------- */

.c-icon {
	width: var(--co-icon-md);
	height: var(--co-icon-md);
	flex: 0 0 auto;
	vertical-align: middle;
}

.c-icon--sm { width: var(--co-icon-sm); height: var(--co-icon-sm); }
.c-icon--lg { width: var(--co-icon-lg); height: var(--co-icon-lg); }

/* ==========================================================================
   5. COMMENTS
   ==========================================================================
   Comments are closed site-wide on a B2B catalogue, but the templates still
   render if someone opens them on a blog post, and unstyled core markup on a
   supplier site looks like a hacked page.
   ---------------------------------------------------------------------- */

.comment-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.comment-body {
	padding-block: var(--co-space-5);
	border-block-end: var(--co-border-width) solid var(--co-color-rule);
}

.comment-meta {
	font-size: var(--co-text-xs);
	color: var(--co-color-text-subtle);
	margin-block-end: var(--co-space-2);
}
