/* ==================================================================
   Medisites Core: Sidebars module (1.2.6-beta.13). Front end, every page (small).

   Structure only, like the block CSS (shared.css): layout and spacing from the --ms-* tokens; no
   colours, type or borders. The one look it carries is the Site style Corners (--ms-radius) on
   blocks in the content column (Ben, 2026-10-12): a token, so it follows the site's setting.

   GeneratePress draws the layout (body.right-sidebar / left-sidebar; #primary.content-area and
   #right-sidebar / #left-sidebar inside .site-content, widths from GP's own inline CSS). The module
   adds body.msc-has-sidebar (and .msc-sidebar-sticky) when a page has a sidebar. These rules need
   real specificity: GP's widths (.site-content .content-area) and its full-width content setting
   (.full-width-content .container.grid-container { max-width: 100% }) must lose to them, and the
   block CSS they adapt is zero specificity anyway. The content's padding is written .site > .site-content
   (1.2.6-beta.35): GP's .full-width-content.one-container .site-content { padding: 0 } (0,3,0) beat the
   plain body.msc-has-sidebar .site-content (0,2,1), so on full-width pages the content had no gutter.

   Desktop is 1025px up (GenerateBlocks' tablet breakpoint); below it the sidebar sits under the
   content, as GP's own mobile layout does from 768px.
   ================================================================== */

/* ---------- The content and sidebar, held to the site's container width ---------- */
body.msc-has-sidebar .site.container.grid-container {
	max-width: var(--gb-container-width, 1240px);
	margin-inline: auto;
}
body.msc-has-sidebar .site-content {
	box-sizing: border-box;
	flex-direction: column;
	row-gap: var(--ms-section-space, 48px);
}
body.msc-has-sidebar .site > .site-content {
	padding-inline: var(--ms-gutter, 16px);
	padding-block: var(--ms-section-space, 48px);
}
body.msc-has-sidebar .site-content > .content-area,
body.msc-has-sidebar .site-content > .sidebar {
	width: auto;
	min-width: 0;
}
body.msc-has-sidebar .site-content > .content-area {
	container: msc-content / inline-size;
}

/* Blocks in the content column: full width of the column, their text lined up with the column's edge.
   A block with a background reaches the column's edge plus the gutter, with the site's Corners. */
body.msc-has-sidebar .content-area .ms-block {
	box-sizing: border-box;
	width: auto;
	max-width: none;
	margin-inline: calc(-1 * var(--ms-gutter, 16px));
	padding-inline: var(--ms-gutter, 16px);
}
body.msc-has-sidebar .content-area .ms-block > .ms-wrap {
	max-width: none;
	padding-inline: 0;
}
body.msc-has-sidebar .content-area .ms-block:first-child { padding-top: 0; }
/* The medical review (Practice details module) lines up with the column's edge too (1.2.6-beta.37) */
body.msc-has-sidebar .content-area .ms-review > .ms-wrap { max-width: none; padding-inline: 0; }

/* The sidebar's own blocks (printed without GP's widget box) */
.msc-sidebar {
	display: grid;
	gap: var(--ms-head-space, 32px);
}
.msc-sidebar > * { margin-block: 0; }
html body .widget-area .widget.msc-sidebar-widget { padding: 0; margin: 0; background: none; }

/* The search box and Topics (shortcodes.php), as B39's */
:where(.msc-sidebar .ms-search) { display: flex; gap: 8px; }
:where(.msc-sidebar .ms-search input) { flex: 1; min-width: 0; }
:where(.msc-sidebar .ms-search .ms-btn) { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 0; }
html :where(.msc-sidebar) :is(h2, p):where(.ms-side-title) { margin: 0 0 12px; }
html :where(.msc-sidebar) ul:where(.ms-topics) { margin: 0; padding: 0; list-style: none; }
html :where(.msc-sidebar .ms-topics) > li { margin: 0; border-top: 1px solid var(--ms-divider, color-mix(in srgb, currentColor 20%, transparent)); }
html :where(.msc-sidebar .ms-topics) > li:last-child { border-bottom: 1px solid var(--ms-divider, color-mix(in srgb, currentColor 20%, transparent)); }
:where(.msc-sidebar .ms-topics :is(a, .ms-topic)) { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; }

/* The advice box: its look (background, padding, corners) is the .ms-sidebar-box look style */
html :where(.msc-sidebar .ms-sidebar-box) :is(h2, h3, p) { margin-block: 0; }
:where(.msc-sidebar .ms-sidebar-box, .msc-sidebar .ms-sidebar-box > .wp-block-group__inner-container) { display: grid; gap: 12px; justify-items: start; }

@media (min-width: 768px) {
	body.msc-has-sidebar .site > .site-content { padding-inline: var(--ms-gutter, 32px); padding-block: var(--ms-section-space, 80px); }
	body.msc-has-sidebar .content-area .ms-block { margin-inline: calc(-1 * var(--ms-gutter, 32px)); padding-inline: var(--ms-gutter, 32px); }
}

@media (min-width: 1025px) {
	body.msc-has-sidebar .site-content {
		flex-direction: row;
		align-items: stretch;
		column-gap: calc(2 * var(--ms-gutter, 32px));
	}
	body.msc-has-sidebar .site-content > .content-area { flex: 1 1 0; }
	/* The width set on the Sidebars screen (printed by the module), a share of the container */
	body.msc-has-sidebar .site-content > .sidebar { flex: 0 0 var(--msc-sidebar-width, 30%); width: var(--msc-sidebar-width, 30%); }
	body.msc-has-sidebar.left-sidebar .site-content > .sidebar { order: -1; }
	body.msc-has-sidebar .content-area .ms-block { border-radius: var(--ms-radius, 0); }

	/* Sticky (Sidebars setting): the sidebar's contents stay in view while its column runs */
	body.msc-sidebar-sticky :is(.inside-right-sidebar, .inside-left-sidebar) {
		position: sticky;
		top: var(--ms-sticky-top, 100px);
	}
}

/* ---------- Blocks in a narrow content column (container queries on the column, desktop) ----------
   The block CSS lays blocks out by screen width; beside a sidebar the column is narrower than the
   screen, so the widest layouts step down to fit it. */
@container msc-content (max-width: 900px) {
	body.msc-has-sidebar .content-area .ms-prose { grid-template-columns: minmax(0, 1fr); row-gap: var(--ms-head-space, 32px); }
	body.msc-has-sidebar .content-area .ms-prose > h2 { position: static; }
	body.msc-has-sidebar .content-area .ms-b30 .ms-group { grid-template-columns: minmax(0, 1fr); row-gap: var(--ms-head-space, 32px); }
	body.msc-has-sidebar .content-area .ms-b30 .ms-group > h2 { position: static; }
	body.msc-has-sidebar .content-area ol.ms-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
	body.msc-has-sidebar .content-area .ms-quotes { grid-template-columns: minmax(0, 1fr); }
	body.msc-has-sidebar .content-area :is(.ms-cards, .ms-places, .ms-people, .ms-directory, .ms-info-cards, .ms-videos, .ms-link-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	body.msc-has-sidebar .content-area .ms-split { column-gap: var(--ms-split-gap, 32px); align-items: start; }
	body.msc-has-sidebar .content-area .ms-b42 > .ms-wrap { flex-direction: column; align-items: flex-start; }
	/* The shared Alignment still applies once stacked (Ben, BF14, 2026-12-01: a centred B42 beside a sidebar had
	   its buttons at the left on the site, centred in the editor, which has no sidebar) */
	body.msc-has-sidebar .content-area .ms-b42.ms-centred > .ms-wrap { align-items: center; }
	body.msc-has-sidebar .content-area .ms-b42.ms-right > .ms-wrap { align-items: flex-end; }
	/* B44's copy above its panel or form, and B47's map under both clinics (1.2.6-beta.42; Ben, test1: beside a
	   sidebar the heading broke mid-word and the map sat under one clinic) */
	body.msc-has-sidebar .content-area .ms-b44 .ms-booking { grid-template-columns: minmax(0, 1fr); gap: var(--ms-split-gap, 32px); }
	body.msc-has-sidebar .content-area :is(.ms-b47, .ms-b57) .ms-map { grid-column: 1 / -1; }
	/* B58: two to a row (an odd one at the end of a bar fills its row), the bar's lines straight to the ends */
	body.msc-has-sidebar .content-area .ms-b58 .ms-plates { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	body.msc-has-sidebar .content-area .ms-b58.ms-layout-bar .ms-plates > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
	body.msc-has-sidebar .content-area .ms-b58.ms-layout-bar:not(.ms-bg-brand, .ms-bg-brand-2, .ms-bg-dark) { border-radius: 0; }
}
/* B54 Listings as rows stays one column beside a sidebar; B55's heading goes above its text */
@container msc-content (max-width: 900px) {
	body.msc-has-sidebar .content-area .ms-b55:not(.ms-media-left, .ms-media-right) .ms-content { grid-template-columns: minmax(0, 1fr); row-gap: var(--ms-head-space, 32px); }
	body.msc-has-sidebar .content-area .ms-b55:not(.ms-media-left, .ms-media-right) .ms-content > h2 { position: static; }
	body.msc-has-sidebar .content-area .ms-b56 .ms-cta { flex-direction: column; align-items: stretch; gap: var(--ms-split-gap, 32px); }
	body.msc-has-sidebar .content-area .ms-b56 .ms-cta > * { flex: none; }
	body.msc-has-sidebar .content-area .ms-b55 .ms-content { column-gap: var(--ms-split-gap, 32px); }
	body.msc-has-sidebar .content-area .ms-b54.ms-layout-rows .ms-cards { grid-template-columns: minmax(0, 1fr); }
}
@container msc-content (max-width: 600px) {
	body.msc-has-sidebar .content-area .ms-b55 .ms-content { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 24px; }
	body.msc-has-sidebar .content-area .ms-b55 .ms-content > * { grid-column: 1; grid-row: auto; }
	body.msc-has-sidebar .content-area :is(.ms-split, ol.ms-steps, .ms-cards, .ms-places, .ms-people, .ms-directory, .ms-info-cards, .ms-videos, .ms-link-list) { grid-template-columns: minmax(0, 1fr); }
}
