/*
 * Stand-in for "Sidecar: optional divider rule between content and rail" (nova-blocks#658). Remove when Nova ships it.
 * Only Sidecars with a populated right rail, only while the rail sits beside the content (Nova's 1024px breakpoint).
 * Tokens only: Nova's rule weight and rule colour (20% of the current ink), drawn at the rail's start edge (the last pixel of the ace → ge gap, against the sidebar box).
 * Inner gutter (George 2026-09-26, part of the #658 ask): the rail's content is inset by Nova's spacing step (var(--nb-spacing)) on both sides,
 * so the order is content → gap → rule → gutter → widgets, as in Hive. The rail box (and so the rule) does not move; below 1024 nothing applies.
 * Rule start (George 2026-09-26, same #658 ask): when the Sidecar follows the header, Nova's header script moves the header height plus the
 * Sidecar's own top spacing into its areas' padding, so grid row 1 starts under the header. The rule skips exactly that offset (Nova's header
 * height + the Sidecar's block/content top spacing tokens), so it starts at the content top (meta line / first rail card), as in Hive.
 * Rail cards pad once (nova-blocks#666): retired 2026-09-27, Nova Blocks 2.7.0 no longer doubles a coloured Group's padding in nested
 * plain Groups (switch-off test identical, port/RELEASE-2.7.0-UPDATE.md). Not a native replacement for the rule: 2.7.0's Sidecar Rule
 * draws at the centre of the rail gap from the Sidecar top, without the gutter; this file keeps George's placement.
 * Firefox 115 ESR (nova-blocks#685 row 3, 2026-09-29): the populated-rail test is the server-printed class
 * `nb-sidecar--has-right-content` (fixes/nova-sidecar-rail-content-classes.php); Firefox 115 has no :has(). The :has() rules
 * are kept below as separate twins (a :has() selector would invalidate a shared selector list in Firefox 115), so switching
 * off the class printer restores the previous behaviour; drop them together with the class printer once Nova ships #685.
 */

/* Populated right rail: server-printed class (Firefox 115 ESR safe). */
@media only screen and (min-width: 1024px) {
	.nb-sidecar.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail).nb-sidecar--has-right-content::before {
		content: "";
		grid-row: 1;
		grid-column: ace / ge;
		align-self: stretch;
		pointer-events: none;
		background: linear-gradient(var(--nb-rule-color, color-mix(in srgb, currentColor 20%, transparent)), var(--nb-rule-color, color-mix(in srgb, currentColor 20%, transparent))) right center / var(--nb-rule-weight, 1px) 100% no-repeat; /* on the rail's start edge (ge), like Hive classic */
	}

	.nb-sidecar.nb-header-neighbour.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail).nb-sidecar--has-right-content::before {
		margin-top: calc(var(--nb-header-height, 0px) + (var(--nb-block-top-spacing, 0) + var(--nb-emphasis-top-spacing, 0)) * var(--nb-current-spacing) * var(--nb-spacing-multiplier-override, 1)); /* the offset Nova moved into the areas' padding-top */
	}

	.nb-sidecar.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail).nb-sidecar--has-right-content > .nb-sidecar-area--sidebar-right {
		padding-left: var(--nb-spacing);
		padding-right: var(--nb-spacing); /* the rule's inner gutter: rule → widgets = one Nova spacing step */
	}
}

/* :has() twins: same declarations; dropped by Firefox 115, used by current browsers if the class printer is switched off. */
@media only screen and (min-width: 1024px) {
	.nb-sidecar.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail):has(> .nb-sidecar-area--sidebar-right > *)::before {
		content: "";
		grid-row: 1;
		grid-column: ace / ge;
		align-self: stretch;
		pointer-events: none;
		background: linear-gradient(var(--nb-rule-color, color-mix(in srgb, currentColor 20%, transparent)), var(--nb-rule-color, color-mix(in srgb, currentColor 20%, transparent))) right center / var(--nb-rule-weight, 1px) 100% no-repeat; /* on the rail's start edge (ge), like Hive classic */
	}

	.nb-sidecar.nb-header-neighbour.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail):has(> .nb-sidecar-area--sidebar-right > *)::before {
		margin-top: calc(var(--nb-header-height, 0px) + (var(--nb-block-top-spacing, 0) + var(--nb-emphasis-top-spacing, 0)) * var(--nb-current-spacing) * var(--nb-spacing-multiplier-override, 1)); /* the offset Nova moved into the areas' padding-top */
	}

	.nb-sidecar.nb-sidecar--sidebar-right:not(.nb-sidecar--no-right-rail) > .nb-sidecar-area--sidebar-right:has(> *) {
		padding-left: var(--nb-spacing);
		padding-right: var(--nb-spacing); /* the rule's inner gutter: rule → widgets = one Nova spacing step */
	}
}
