/* 9Senses managed structural pages: native horizontal geometry.
 *
 * One owner, two concepts:
 *   --ns-page-row     the shared outer row for every top-level page section
 *   --ns-page-measure the readable text measure inside that row
 *
 * The row determines the horizontal origin. The measure may shorten prose on
 * the right, but it is never centred and never creates a second left lane.
 * Component rows (cards, tabsets, panels, FAQ, CTA, embeds) remain free to use
 * the whole page row. Hero rendering sits outside .ns-ir-inner and is untouched.
 */
.ns-ir{
	--ns-page-row:min(1080px,90vw);
	--ns-page-measure:min(700px,100%);
}

/* The section grid is the sole top-level horizontal layout primitive. */
.ns-ir .ns-ir-inner{
	display:grid!important;
	grid-template-columns:minmax(0,var(--ns-page-row))!important;
	justify-content:center!important;
	align-items:start!important;
	/* Framework structural CSS may leave a grid row-gap on this shell.
	 * The adjacent .ns-sec rule below is the sole vertical spacing owner, so
	 * any grid gap here would compound that section gap before a plugin row. */
	gap:0!important;
	width:100%!important;
	max-width:none!important;
	margin-left:0!important;
	margin-right:0!important;
	padding-left:0!important;
	padding-right:0!important;
	box-sizing:border-box!important;
}
.ns-ir .ns-ir-inner>.ns-sec{
	grid-column:1!important;
	width:100%!important;
	max-width:none!important;
	min-width:0!important;
	margin-left:0!important;
	margin-right:0!important;
	padding-left:0!important;
	padding-right:0!important;
	box-sizing:border-box!important;
}

/* A section may have many component-specific row names, but none may create a
 * second outer width or horizontal origin. Keep vertical margins untouched. */
.ns-ir .ns-ir-inner>.ns-sec>*{
	max-width:100%!important;
	min-width:0!important;
	margin-left:0!important;
	margin-right:0!important;
	box-sizing:border-box!important;
}

/* Prose rows occupy the SAME page row as cards and other components. */
.ns-ir .nst-prose-row,
.ns-ir .nst-prose-col,
.ns-ir .nst-prose-text,
.ns-ir .nst-prose-text>.nst-inner{
	width:100%!important;
	max-width:none!important;
	min-width:0!important;
	margin-left:0!important;
	margin-right:0!important;
	padding-left:0!important;
	padding-right:0!important;
	box-sizing:border-box!important;
}

/* The readable measure shortens text only on the RIGHT. It never centres the
 * prose inside the 1080px row, so its left edge is identical to a card row. */
.ns-ir .nst-prose-col>.nst-eyebrow,
.ns-ir .nst-prose-col>.entry-title{
	width:var(--ns-page-measure)!important;
	max-width:var(--ns-page-measure)!important;
	margin-left:0!important;
	margin-right:auto!important;
	padding-left:0!important;
	padding-right:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-prose-row .ns-ed-prose>p,
.ns-ir .nst-prose-row .ns-ed-prose>ul,
.ns-ir .nst-prose-row .ns-ed-prose>ol,
.ns-ir .nst-prose-row .ns-ed-prose>h1,
.ns-ir .nst-prose-row .ns-ed-prose>h2,
.ns-ir .nst-prose-row .ns-ed-prose>h3,
.ns-ir .nst-prose-row .ns-ed-prose>h4,
.ns-ir .nst-prose-row .ns-ed-prose>h5,
.ns-ir .nst-prose-row .ns-ed-prose>h6,
.ns-ir .nst-prose-row .ns-ed-prose>blockquote:not(.ns-obj--quote){
	width:var(--ns-page-measure)!important;
	max-width:var(--ns-page-measure)!important;
	margin-left:0!important;
	margin-right:auto!important;
	box-sizing:border-box!important;
}

/* Full-width Editorial objects deliberately opt out of the reading measure,
 * but still begin on the exact same page-row edge. */
/* Only genuinely full-row Editorial objects opt out of their own side
 * margins. Right/left aligned objects keep the Post Editorial gutter because
 * they share the main prose area and text is meant to wrap beside them. */
.ns-ir .nst-prose-row .ns-ed-prose>.ns-obj--full,
.ns-ir .nst-prose-row .ns-ed-prose>.ns-obj--row,
.ns-ir .nst-prose-row .ns-ed-prose>.ns-obj--tablewrap,
.ns-ir .nst-prose-row .ns-ed-prose>.ns-related-row{
	margin-left:0!important;
	margin-right:0!important;
}

@media (max-width:767px){
	/* The structural layout has collapsed to the phone/one-column state. Keep
	 * the 90vw safety inset used by the base row so fixed left-side controls
	 * cannot overlap the reading column. */
	.ns-ir{--ns-page-measure:100%}
	/* The fixed header companion is emitted before the body so it can participate
	 * in the desktop float rail, exactly like Post Editorial. At the same mobile
	 * breakpoint Post Editorial turns its flow into a flex column and orders the
	 * body before the sidebar. Apply that existing order contract to the page's
	 * structural row without importing the post shell width. */
	.ns-ir .ns-sec.ns-hdr>.nst-prose-row>.nst-prose-col{
		display:flex!important;
		flex-direction:column!important;
	}
}

/* -------------------------------------------------------------------------
 * Hero: the post contract, verbatim
 * -------------------------------------------------------------------------
 * When a featured image is selected the renderer wraps .ns-ir-inner in the
 * Editorial .ns-ed-shell (pull-up, overlay band, side inset all come from the
 * Editorial stylesheet). The page contributes only what a post's flow
 * contributes: sit above the band, and let the shell's padding, not the
 * header's no-hero padding, set the distance from the band's top edge.
 * Measured on /the-broken-gate at 1200: band 1080x168, eyebrow 20px below
 * the band top. */
.ns-ir .ns-ir-shell>.ns-ir-inner{
	position:relative!important;
	z-index:1!important;
}
.ns-ir .ns-ir-shell>.ns-ir-inner>.ns-sec.ns-hdr{
	padding-top:0!important;
}
.ns-ir .ns-ir-shell>.ns-ir-inner>.ns-sec.ns-hdr .nst-eyebrow{
	margin-top:0!important;
}

/* -------------------------------------------------------------------------
 * Native vertical rhythm
 * -------------------------------------------------------------------------
 * Structural pages have the same rule vertically as horizontally: one owner.
 * Framework component rows used to carry their own 40px top/bottom margins
 * while adjacent .ns-sec wrappers also carried section spacing. At a
 * prose -> widget/card boundary those independent margins accumulated into an
 * 80px-ish void. The page shell now owns inter-section spacing exactly once;
 * component rows own paint and internal layout, never exterior separation.
 */
.ns-ir{
	--ns-page-section-gap:var(--ns-sp-5,clamp(32px,3.4vw,48px));
	--ns-page-component-gap:var(--ns-sp-4,clamp(22px,2vw,30px));
}

/* Top-level sections never contribute their own leading/trailing margins.
 * One adjacent-sibling rule is the sole inter-section gap. */
.ns-ir .ns-ir-inner>.ns-sec{
	margin-top:0!important;
	margin-bottom:0!important;
}
.ns-ir .ns-ir-inner>.ns-sec+.ns-sec{
	margin-top:var(--ns-page-section-gap)!important;
}
/* A contextual right-rail marker is not a new semantic page section. It is an
 * insertion inside running content, so it must not inherit the much larger
 * section-to-section gap. Use the same beat as ordinary paragraph/list flow. */
.ns-ir .ns-ir-inner>.ns-sec+.ns-sec.ns-inline-rail-section{
	margin-top:calc(var(--ns-sp-3,18px) - 4px)!important;
}

/* The header text column's last child carried a 24px trailing margin that
 * the framework measured off the reference header's QUOTE module and applied
 * to whatever is last in that column. On a managed page the next section's
 * gap is the only spacing owner, so the header's trailing margin is 0 here;
 * measured on /academy: 65px above the first embed against 41px everywhere
 * else. The header's internal spacing (eyebrow, title, prose top) is untouched. */
.ns-ir .ns-ir-inner>.ns-sec.ns-hdr .nst-hdr-text>:last-child{
	margin-bottom:0!important;
}

/* Direct structural rows may be called widget, carousel, cards, FAQ, panel,
 * CTA, etc. Those framework roles must not add another exterior margin on a
 * managed page. Padding is deliberately left alone because it can be part of
 * a component's painted box. */
.ns-ir .ns-sec>:is(
	.nst-prose-row,
	.nst-cards-row,
	.nst-embed-row,
	.nst-tabset-head-row,
	.nst-tiles,
	.nst-panel-main-row,
	.nst-panel-grid,
	.nst-faq-row,
	.nst-cta-row
){
	margin-top:0!important;
	margin-bottom:0!important;
}

/* When prose and a component intentionally share one section, there is no
 * section boundary to supply the gap. Add exactly one internal transition gap
 * from the component that follows the prose/header row. */
.ns-ir .ns-cards>.nst-prose-row+.nst-cards-row,
.ns-ir .ns-tabset>.nst-tabset-head-row+.nst-tiles,
.ns-ir .ns-panel>.nst-panel-main-row+.nst-panel-grid{
	margin-top:var(--ns-page-component-gap)!important;
}

/* Widget sections can contain trailing copy in the same column. Neutralise the
 * old row/module margins and make that transition obey the same single-gap
 * contract. */
/* The embed column can carry legacy component classes such as ns-emboss
 * and ns-aixblock. Their old exterior margins must not become a second
 * section gap inside the structural page shell. */
.ns-ir .nst-embed-row>.nst-embed-col{
	margin-top:0!important;
	margin-bottom:0!important;
}
.ns-ir .nst-embed-col>.nst-embed-widget,
.ns-ir .nst-embed-col>.nst-embed-text,
.ns-ir .nst-embed-widget>.nst-code-inner{
	margin-top:0!important;
	margin-bottom:0!important;
}
/* Shortcodes often emit a component root with its own page-level margin. The
 * embed slot owns that exterior edge, while the plugin keeps all internal
 * spacing and padding. This also prevents first-child margin collapse from
 * visually compounding the prose -> plugin transition. */
.ns-ir .nst-embed-widget>.nst-code-inner>:first-child{
	margin-top:0!important;
}
.ns-ir .nst-embed-widget>.nst-code-inner>:last-child{
	margin-bottom:0!important;
}
.ns-ir .nst-embed-col>.nst-embed-widget+.nst-embed-text,
.ns-ir .nst-embed-col>.nst-embed-text+.nst-embed-text{
	margin-top:var(--ns-page-component-gap)!important;
}

/* -------------------------------------------------------------------------
 * Header companion stack
 * -------------------------------------------------------------------------
 * The right-hand header rail is a list, not a single widget slot. Framework
 * component CSS may style the individual widgets, but it must not position
 * siblings on top of one another. This native rule owns only the stacking
 * geometry and leaves each component's internal paint untouched.
 */
.ns-ir .nst-hdr-aside{
	min-width:0!important;
	display:flex!important;
	flex-direction:column!important;
	gap:var(--ns-page-component-gap,clamp(22px,2vw,30px))!important;
}
.ns-ir .nst-hdr-aside>.nst-hdr-aside-item{
	position:relative!important;
	inset:auto!important;
	width:100%!important;
	max-width:100%!important;
	min-width:0!important;
	margin:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-hdr-aside>.nst-hdr-aside-item+.nst-hdr-aside-item{
	margin-top:0!important;
}
.ns-ir .nst-hdr-aside-item>.ns-obj--related,
.ns-ir .nst-hdr-aside-item>.ns-obj--related.ns-ed-rail-item,
.ns-ir .nst-hdr-aside-item>.ns-vmap-shell{
	float:none!important;
	clear:none!important;
	width:100%!important;
	max-width:100%!important;
	min-width:0!important;
	margin:0!important;
}
.ns-ir .nst-hdr-aside-widget,
.ns-ir .nst-hdr-aside-text,
.ns-ir .nst-hdr-aside-text>.nst-inner{
	width:100%!important;
	max-width:100%!important;
	min-width:0!important;
	margin-left:0!important;
	margin-right:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-hdr-aside-widget+.nst-hdr-aside-text,
.ns-ir .nst-hdr-aside-text+.nst-hdr-aside-text{
	margin-top:var(--ns-page-component-gap,clamp(22px,2vw,30px))!important;
}

/* -------------------------------------------------------------------------
 * Contextual right rail
 * -------------------------------------------------------------------------
 * Copy the proven Editorial-post Related Content contract, rather than
 * inventing a Structural float. The rail is a DIRECT CHILD of .ns-ed-prose and
 * carries the shared .ns-ed-rail-item class. Editorial therefore owns exactly
 * the same float/right-track geometry it uses for Related Content:
 *
 *     float:right; width:var(--ns-side); margin-left:var(--ns-gutter)
 *
 * The ordinary prose children keep Structural's 700px readable measure. The
 * rail never owns or alters that left-column width.
 */
.ns-ir .ns-ed-prose>.nst-inline-rail.ns-ed-rail-item{
	clear:right;
	min-width:0!important;
	max-width:var(--ns-side)!important;
	margin-top:0;
	margin-right:0!important;
	margin-bottom:calc(var(--ns-sp-3,18px) - 4px)!important;
	padding:0!important;
	background:none!important;
	box-shadow:none!important;
}
/* Same lifecycle as the post body: the float can influence following prose,
 * but the containing prose run clears it before a genuinely separate page
 * component begins. This clear is at the END of the run, never at insertion. */
.ns-ir .nst-prose-text--inline-rail>.ns-ed-prose::after{
	content:"";
	display:block;
	clear:both;
}
.ns-ir .nst-inline-rail>.nst-inline-rail-item{
	position:relative!important;
	inset:auto!important;
	width:100%!important;
	max-width:100%!important;
	min-width:0!important;
	margin:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-inline-rail{
	display:flex;
	flex-direction:column;
	gap:var(--ns-page-component-gap,clamp(22px,2vw,30px));
}
.ns-ir .nst-inline-rail>.nst-inline-rail-item+.nst-inline-rail-item{
	margin-top:0!important;
}
.ns-ir .nst-inline-rail-widget,
.ns-ir .nst-inline-rail-text,
.ns-ir .nst-inline-rail-text>.nst-inner,
.ns-ir .nst-inline-rail-figure,
.ns-ir .nst-inline-rail-img{
	width:100%!important;
	max-width:100%!important;
	min-width:0!important;
	margin-left:0!important;
	margin-right:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-inline-rail-figure{margin-top:0!important;margin-bottom:0!important}
.ns-ir .nst-inline-rail-img{height:auto!important;display:block!important}
.ns-ir .nst-inline-rail-widget>:first-child{margin-top:0!important}
.ns-ir .nst-inline-rail-widget>:last-child{margin-bottom:0!important}
.ns-ir .nst-inline-rail-widget+.nst-inline-rail-text,
.ns-ir .nst-inline-rail-text+.nst-inline-rail-text{
	margin-top:var(--ns-page-component-gap,clamp(22px,2vw,30px))!important;
}

/* Desktop contextual rails intentionally inherit Editorial post rhythm.
 * Do not bridge heading/paragraph spacing here. The shared Editorial rules
 * already set heading margins, `h2/h3/h4 + *`, the `.ns-ed-rail-item` float,
 * and the `floatTops()` optical alignment pass. Structural owns only the
 * rail's page-specific paint/stacking and mobile reflow. */

@media (max-width:767px){
	/* Per-item authoring switch. Existing items default to visible, so this is
	 * opt-in and does not change legacy structural pages. */
	.ns-ir .nst-hide-mobile{display:none!important}

	/* Unlike post Related Content, a page widget must not disappear when the
	 * desktop rail collapses. It rejoins document flow at the same authored
	 * anchor; the shared Editorial script moves it after the anchor block. */
	.ns-ir .ns-ed-prose>.nst-inline-rail.ns-ed-rail-item{
		float:none!important;
		clear:none!important;
		width:100%!important;
		max-width:100%!important;
		margin-top:calc(var(--ns-sp-3,18px) - 4px)!important;
		margin-left:0!important;
		margin-right:0!important;
		margin-bottom:calc(var(--ns-sp-3,18px) - 4px)!important;
	}
}

/* Full-width variant of the page-only Image element. */
.ns-ir .nst-page-figure{
	width:100%!important;
	max-width:100%!important;
	margin:0!important;
	box-sizing:border-box!important;
}
.ns-ir .nst-page-img{display:block!important;width:100%!important;max-width:100%!important;height:auto!important}
.ns-ir .nst-page-caption{margin-top:.65rem!important}
