/*
 * LTIC Release Notes: styles for the /release-notes list and the
 * "Release Notes Summary + Dialog" block.
 * Loaded only on pages where either block is used.
 */

*:has(+ .ltic-release-notes-summary-plus-dialog) {
	margin-block-end: 0 !important;
}

*:has(> .ltic-release-notes-summary-plus-dialog) {
	container-type: inline-size;
}

.ltic-release-notes-summary-plus-dialog {
	position: relative;
	isolation: isolate;
	/* 12.5px */
	padding-block-start: 0.78125rem;
	/* 25px */
	padding-block-end: 1.5625rem;
	background-color: #111;
	color: #fff;
	container-type: inline-size;
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas:
		"heading trigger-control"
		"list list";
	/* 12.5px */
	gap: 0.78125rem;

	&::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: -1;
		inline-size: 100vw;
		margin-inline-start: calc(-1 * ((100vw - 100%) / 2));
		background-color: #111;
	}

	> .wp-block-heading.ltic-release-notes-summary-plus-dialog-heading {
		margin-block: 0;
		padding: 0;
		color: #fff;
		/* 18px */
		font-size: 1.125rem;
		grid-area: heading;
		align-self: center;

	}

	> ul.ltic-release-notes-summary {
		margin: 0;
		padding-inline-start: 0;
		display: flex;
		flex-direction: column;
		/* 25px */
		gap: 1.5625rem;
		grid-area: list;
		
		/* 800px */
		@container (inline-size >= 50rem) {
			display: grid;
			grid-template-columns: 1fr 1fr 1fr;
		}
	}

	> p.ltic-release-notes-dialog-trigger-control {
		grid-area: trigger-control;
		/* 12.5px */
		margin-block-end: 0.78125rem;
		align-self: center;

		> button[type="button"][commandfor][command] {
			/* 4px */
			padding-block: 0.25rem;
			/* 12.5px */
			padding-inline: 0.78125rem;
			/* 1px */
			border: 0.0625rem solid #fff;
			background-color: #111;
			color: #fff;
			/* 14px: set here, so it scales with the text (the theme's 14px doesn't) */
			font-size: 0.875rem;
			/* 20px on the 14px text (20 / 14). Unitless, so it scales with the
			   text (the theme's 20px doesn't). */
			line-height: 1.4286;
		}
	}

	> ul.ltic-release-notes-summary > li::marker {
		/* 0.01px */
		font-size: 0.000625rem;
		color: transparent;
	}
}


li.ltic-release-note-summary > button[type="button"][commandfor][command],
.wp-block-heading.ltic-release-note-heading {
	position: relative;
	inline-size: 100%;
	block-size: 100%;
	/* 12.5px, 89% of inherited font size */
	gap: max(0.78125rem, 0.89em);
	/* 12px, 86% of inherited font size, 50px */
	padding: clamp(0.75rem, 0.86em, 3.125rem);
	/* 25px, 179% of current font size, 50px */
	padding-block-start: clamp(1.5625rem, 1.79em, 3.125rem);
	display: flex;
	flex-direction: column;
	/* 12.5px, 89% of inherited font size */
	gap: max(0.78125rem, 0.89em);
	font-weight: 400;
	background-color: #111;
	color: #fff;
	text-align: start;

	> strong.new-or-upcoming {
		position: absolute;
		/* -1px */
		inset-block-start: -0.0625rem;
		inset-inline-end: 1rem;
		padding-block: 0;
		/* 8px */
		padding-inline: 0.5rem;
		display: inline-flex;
		align-items: center;
		gap: 0.375rem;
		grid-column: 1 / 4;
		background-color: #111; /* must match the band behind the cards */
		color: #fff;
		/* 12px, 86% of inherited font size */
		font-size: max(0.75rem, 0.86em);
		font-weight: 700;
		line-height: 1.5;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		white-space: nowrap;
		transform: translateY(-50%);

		&.is-new {
			color: #f6c744;
		}

		&.is-new > .new-or-upcoming-icon {
			/* 8px */
			inline-size: 0.5rem;
			/* 8px */
			block-size: 0.5rem;
			border-radius: 50%;
			background-color: currentColor;
		}
		
		> .new-or-upcoming-icon {
			/* 14px */
			inline-size: 0.875rem;
			/* 14px */
			block-size: 0.875rem;
			display: inline-block;
			flex: none;
		}
	}

	> .title {
		font-weight: 900;
		text-transform: uppercase;
	}

	.project-category-users > .project {
		display: block;
		font-family: monospace;
		/* 12px, 86% of inherited font size */
		font-size: max(0.75rem, 0.86em);
	}

	.project-category-users > .category-users {
		/* 11px, 79% of inherited font size */
		font-size: max(0.6875rem, 0.79em);
	}
	
	> .date {
		inline-size: fit-content;
		margin-block-start: auto;
		/* 11px, 79% of inherited font size */
		font-size: max(0.6875rem, 0.79em);
	}

	/* New releases' date ("Released on …"): yellow highlight. Not past
	   releases, even though they share the "Now Available" badge. */
	> .date.is-new {
		/* 8px, 57% of inherited font size */
		padding-inline: max(0.5rem, 0.57em);
		background-color: #f6c744;
		color: #111;
		font-weight: 900;
	}
}

li.ltic-release-note-summary > button[type="button"][commandfor][command] {
	/* 2px */
	border: 0.125rem solid #fff;
	display: grid;
	grid-template-columns: 1fr auto;
	/* 14px */
	font-size: 0.875rem;
	/* 24px on the 14px text (24 / 14). Unitless, so it scales with the text
	   (the theme's 24px on <li> elements doesn't). */
	line-height: 1.7143;

	/* The smaller lines keep the same 24px line height */
	.project-category-users > .project {
		/* 24px on the 12.04px text (24 / 12.04) */
		line-height: 1.9934;
	}

	.project-category-users > .category-users,
	> .date {
		/* 24px on the 11.06px text (24 / 11.06) */
		line-height: 2.17;
	}

	> * {
		grid-column: 1 / 3;
	}

	> .date {
		grid-column: 1 / 2;
		grid-row: 3 / 4;
	}

	> svg[aria-hidden="true"][display="none"] {
		display: block;
		/* 24px */
		inline-size: 1.5rem;
		/* 24px */
		block-size: 1.5rem;
		grid-column: 2 / 3;
		grid-row: 3 / 4;
		align-self: end;
	}
}
/* ==========================================================================
 * Hidden punctuation inside note buttons, headings and Table of Contents links
 *
 * The theme's .visually-hidden is absolutely positioned. Browsers treat a
 * positioned element as block-level and put spaces around it when they build
 * an accessible name ("Title ( Project – … )"). Inside our buttons,
 * headings and links, keep these pieces inline and hide them a different way, so the
 * name reads "Title (Project – Category for Users) (Date)".
 * ========================================================================== */

:is(li.ltic-release-note-summary > button, .wp-block-heading.ltic-release-note-heading, .ltic-release-notes-toc a) .visually-hidden {
	position: static !important;
	display: inline !important;
	inline-size: auto !important;
	block-size: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: visible !important;
	clip: auto !important;
	/* Invisible and next to no width: 1px text, fully clipped, transparent */
	clip-path: inset(50%) !important;
	/* 1px */
	font-size: 0.0625rem !important;
	line-height: 0 !important;
	letter-spacing: 0 !important;
	color: transparent !important;
	white-space: normal !important;
}

/* ==========================================================================
 * /release-notes page only (the plugin adds this body class to that page)
 * ========================================================================== */

.ltic-release-notes-page h1 {
	/* The theme gives the page title a negative bottom margin */
	margin-block-end: 0;
}

/* Layout: "Table of Contents" navigation, then the page content.
   Narrow: stacked (navigation above the content).
   Wide enough (a 17rem sidebar, a 3rem gap and the 39.25rem boxes): the
   navigation becomes a sticky sidebar on the left. A container query, so it
   depends on the space the theme gives the content, not the window. */
.ltic-release-notes-layout {
	container: ltic-rn-layout / inline-size;
}

.ltic-release-notes-layout__inner > .ltic-release-notes-toc {
	/* 32px */
	margin-block-end: 2rem;
}

.ltic-release-notes-layout__content > :first-child {
	margin-block-start: 0;
}

@container ltic-rn-layout (inline-size >= 59.25rem) {
	.ltic-release-notes-layout__inner {
		display: grid;
		/* 272px, 48px */
		grid-template-columns: 17rem minmax(0, 1fr);
		column-gap: 3rem;
		align-items: start;
	}

	/* The sidebar sticks (below the admin bar when it's showing; 24px from
	   the top) and is at most the window's height. The "Table of Contents"
	   heading stays put; only the list below it scrolls, when it's taller
	   than the space left. A column of flex boxes (nav > accordion > item >
	   panel > list) passes the height limit down to the list. */
	.ltic-release-notes-layout__inner > nav.ltic-release-notes-toc {
		position: sticky;
		/* Admin bar height + 24px */
		inset-block-start: calc(var(--wp-admin--admin-bar--height, 0rem) + 1.5rem);
		display: flex;
		flex-direction: column;
		/* Window height - admin bar height - 48px */
		max-block-size: calc(100dvh - var(--wp-admin--admin-bar--height, 0rem) - 3rem);
		margin-block-end: 0;
		box-sizing: border-box;

		> .ltic-release-notes-accordion,
		> .ltic-release-notes-accordion > .wp-block-accordion-item,
		> .ltic-release-notes-accordion > .wp-block-accordion-item > .wp-block-accordion-panel {
			display: flex;
			flex-direction: column;
			min-block-size: 0;
		}

		/* 12px each side, to line up with the list (below) */
		.wp-block-accordion-heading {
			flex: none;
			padding-inline: 0.75rem !important;
		}

		/* The scrolling list. Its 12px padding keeps space between the
		   content and the scrollbar, and room inside the scrolling area for
		   focus indicators (up to 12px), which would otherwise be cut off. */
		.wp-block-accordion-panel > ul {
			min-block-size: 0;
			overflow-block: auto;
			padding: 0.75rem !important;
		}
	}
}

/* The "Table of Contents" navigation (page and dialog): a plain, compact
   docs-style sidebar. Text colour links with padding and no underlines; on
   hover or focus, a light background (all text on it keeps at least 4.5:1
   contrast). Section links in bold; notes indented under their section.
   Many declarations are !important so the theme's own link, list and
   heading styles don't apply here (underlines, list-item spacing, font
   sizes). */
nav.ltic-release-notes-toc {
	--ltic-rn-bg: #fff;
	--ltic-rn-fg: #111;
	/* Hover background: 10% of the text colour. Lightest text on it ("For
	   {Users}", the date) is 5.7:1 on the page and 7.3:1 in the dialog. */
	--ltic-rn-hover-bg: color-mix(in srgb, var(--ltic-rn-fg) 10%, var(--ltic-rn-bg));
	--ltic-rn-muted: color-mix(in srgb, var(--ltic-rn-fg) 70%, var(--ltic-rn-bg));
	color: var(--ltic-rn-fg);
	/* 15px */
	font-size: 0.9375rem;
	line-height: 1.4;

	> .ltic-release-notes-accordion {
		margin: 0;
	}

	/* "Table of Contents" toggle: plain text with the icon at the right edge,
	   the same padding and hover background as the links. Pulled out by its
	   8px padding on both sides, so its text lines up with the text above and
	   below it, and its icon's right edge with the edge of the content. */
	> .ltic-release-notes-accordion .wp-block-accordion-heading__toggle {
		justify-content: space-between;
		box-sizing: border-box;
		inline-size: calc(100% + 1rem);
		margin-inline: -0.5rem;
		/* 12px */
		gap: 0.75rem;
		/* 4px, 8px */
		padding-block: 0.25rem;
		padding-inline: 0.5rem;
		border: 0;
		background-color: transparent;

		&:hover {
			background-color: var(--ltic-rn-hover-bg);
		}

		/* No underline on hover (core's Accordion adds one) */
		.wp-block-accordion-heading__toggle-title {
			text-decoration: none !important;
		}

		/* Icon flush right in its box (lines up with the triangles below) */
		.wp-block-accordion-heading__toggle-icon {
			justify-content: flex-end;
		}
	}

	/* The list is pulled out by the links' 8px padding on both sides, like the
	   toggle above: link text lines up with the text above and below the
	   Table of Contents, and the triangles' right edges with its edge. */
	.wp-block-accordion-panel > ul {
		margin-inline: -0.5rem !important;
	}

	/* No default indent or margins on the lists */
	ul {
		margin: 0 !important;
		padding: 0 !important;
	}

	li {
		margin: 0 !important;
		padding: 0 !important;
		/* 24px on the 15px text */
		line-height: 1.6 !important;
	}

	/* Hide the bullets without touching list-style */
	ul > li::marker {
		/* 0.01px */
		font-size: 0.000625rem;
		color: transparent;
	}

	.wp-block-accordion-panel > ul {
		/* 12px */
		padding-block-start: 0.75rem !important;
	}

	/* Notes: indented 16px under their section; compact, 2px apart (the
	   links' own padding adds the rest) */
	details > ul {
		/* 2px, 16px */
		margin-block-start: 0.125rem !important;
		padding-inline-start: 1rem !important;
	}

	details > ul > li + li {
		margin-block-start: 0.125rem !important;
	}

	/* In the dialog: "See all of our past releases" after the "Past Releases"
	   list, indented and spaced like a note link (the link itself is styled
	   like the other links here), with a decorative arrow */
	details > p.ltic-release-notes-past-releases-link {
		/* 2px */
		margin-block: 0.125rem 0 !important;
		margin-inline: 0 !important;
		padding-block: 0 !important;
		/* 16px */
		padding-inline: 1rem 0 !important;
		/* 14px */
		font-size: 0.875rem !important;

		> a::after {
			/* Hidden from assistive technologies (empty alternative text) */
			/* A space and a right arrow (U+2192), escaped so it survives any stylesheet encoding */
			content: " \2192" / "";
		}
	}

	/* 16px between sections */
	.wp-block-accordion-panel > ul > li + li {
		margin-block-start: 1rem !important;
	}

	/* Links fill the width of their list item, so the whole row can be
	   clicked (and is highlighted on hover) */
	a,
	a:visited,
	a:hover,
	a:focus {
		display: block;
		/* 4px, 8px: room for the hover background */
		padding-block: 0.25rem !important;
		padding-inline: 0.5rem !important;
		color: inherit !important;
		font-size: inherit !important;
		line-height: inherit !important;
		text-decoration: none !important;
	}

	/* Hover and focus: a light background instead of an underline */
	a:is(:hover, :focus) {
		background-color: var(--ltic-rn-hover-bg) !important;
	}

	a:focus-visible {
		/* 2px */
		outline: 0.125rem solid var(--ltic-rn-fg);
		outline-offset: 0;
	}

	/* Section links ("New Releases", "Coming Soon", "Past Releases") */
	.wp-block-accordion-panel > ul > li > a {
		font-weight: 700 !important;
	}

	/* Note links: [date,] title, then "For {Users}", each on its own line.
	   The date and users are smaller and lighter. */
	.date,
	.title,
	.users {
		display: block;
		text-decoration: none !important;
	}

	.title {
		font-weight: 400 !important;
	}

	.date,
	.users {
		/* 13px */
		font-size: 0.8125rem !important;
		/* 24px on the 13px text (24 / 13), so their lines stay as tall as the
		   title's */
		line-height: 1.8462 !important;
		color: var(--ltic-rn-muted);
	}

	/* Each section: the link (full width, apart from room for the toggle),
	   its disclosure toggle (<summary>) at the right edge of the same line,
	   then the notes below. */
	li.has-details {
		position: relative;

		> a {
			/* The toggle's 28px and a 4px gap */
			margin-inline-end: 2rem !important;
		}
	}

	details {
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
	}

	summary {
		/* Fallback placement: at the right edge of the section link's line,
		   as tall as the link: one line (1lh: the same line height, inherited
		   from the <li> element) plus the link's 4px padding above and below. */
		position: absolute;
		inset-block-start: 0;
		inset-inline-end: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		/* 28px (at least 24px: the WCAG 2.2 minimum target size). The 12px
		   triangle in the middle ends 8px from the right edge, like the text
		   inside the links' 8px padding. */
		inline-size: 1.75rem;
		/* 1 line + 8px */
		block-size: calc(1lh + 0.5rem);
		/* Where anchor positioning is supported, inline styles anchor this
		   element to the section link instead (4px after its inline-end
		   edge, as tall as it), outweighing the position and block size
		   here. inset-inline-end is then ignored (over-constrained). */
		box-sizing: border-box;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		background: transparent !important;
		color: var(--ltic-rn-fg);
		list-style: none;
		cursor: pointer;

		&::-webkit-details-marker {
			display: none;
		}

		&::before,
		&::after {
			content: none !important;
		}

		&:hover {
			background-color: var(--ltic-rn-hover-bg) !important;
		}

		&:focus-visible {
			/* 2px */
			outline: 0.125rem solid var(--ltic-rn-fg);
			outline-offset: 0;
		}
	}

	/* Filled triangle: points right when closed, down when open */
	/* Hidden in the HTML (display="none"), so without CSS only the browser's
	   own disclosure marker shows; shown here */
	svg.ltic-release-notes-toc-icon[aria-hidden="true"] {
		display: block;
		flex: none;
		/* 12px */
		inline-size: 0.75rem;
		/* 12px */
		block-size: 0.75rem;
	}

	details[open] > summary > svg.ltic-release-notes-toc-icon[aria-hidden="true"] {
		rotate: 90deg;
	}
}

/* In the dialog: light on dark, as wide as the boxes, above the sections */
#ltic-release-notes-dialog .ltic-release-notes-toc {
	--ltic-rn-bg: #111;
	--ltic-rn-fg: #fff;
	max-inline-size: 39.25rem;
	/* 32px */
	margin-block-end: 2rem;
}

/* Links to a note or section scroll it to just below the top of the window
   (and the admin bar), with the note's badge in view. Same for "Back to
   Table of Contents" links to the Table of Contents' links. */
.ltic-release-notes-page .ltic-release-notes-toc a[id^="link--"] {
	/* 16px */
	scroll-margin-block: calc(var(--wp-admin--admin-bar--height, 0rem) + 1rem) 1rem;
}

/* In the dialog: note headings land with their box (and badge) in view;
   section headings and Table of Contents links 25px from the top. */
#ltic-release-notes-dialog .wp-block-heading.ltic-release-note-heading {
	/* 25px + 25px box padding */
	scroll-margin-block-start: 3.125rem;
}

#ltic-release-notes-dialog .ltic-release-notes-toc a[id^="link--"] {
	/* 25px */
	scroll-margin-block: 1.5625rem;
}

.ltic-release-notes-page .ltic-release-notes-sections {
	> .ltic-release-notes-section-heading,
	> .ltic-release-notes-accordion .wp-block-accordion-heading {
		/* 16px */
		scroll-margin-block-start: calc(var(--wp-admin--admin-bar--height, 0rem) + 1rem);
	}

	.wp-block-heading.ltic-release-note-heading {
		/* 25px box padding + 16px */
		scroll-margin-block-start: calc(var(--wp-admin--admin-bar--height, 0rem) + 2.5625rem);
	}
}

/* ==========================================================================
 * "Back to Table of Contents" links (right after each section and note heading)
 *
 * Output with `hidden`. Shown (CSS only) while its heading is the :target
 * (after following a Table of Contents link) — but only while that Table of
 * Contents link is showing: the Table of Contents accordion is open and, for
 * a note, its section's <details> is open. When the Table of Contents is a
 * sidebar, also only while the main landmark (<main> or role="main") has
 * something with :focus-visible.
 * ========================================================================== */
.ltic-release-notes-sections p.back-link {
	inline-size: fit-content;
	/* 14px */
	font-size: 0.875rem;
	/* 4px above, 16px below */
	margin-block: 0.25rem 1rem;
}

/* The link: a small button-like box. The colours come from the section's
   custom properties, so it's dark on light on the page and light on dark in
   the dialog. !important because the theme's link styles are heavily
   weighted. (The site's focus indicator is added around it.) */
.ltic-release-notes-sections p.back-link a {
	display: inline-block !important;
	/* 6.25px, 12.5px */
	padding-block: 0.390625rem !important;
	padding-inline: 0.78125rem !important;
	/* 1px */
	border: 0.0625rem solid var(--ltic-rn-fg) !important;
	border-radius: 0 !important;
	background-color: color-mix(in srgb, var(--ltic-rn-fg) 7%, var(--ltic-rn-bg)) !important;
	color: var(--ltic-rn-fg) !important;
	/* 14px */
	font-size: 0.875rem !important;
	text-decoration: none !important;
}

/* The hidden context at the end of the link (' ("…") (…)'): the standard
   absolutely positioned visually hidden text, so it adds no width to the
   link. (At the end of the link, it adds no stray spaces to its name.) */
.ltic-release-notes-sections p.back-link .visually-hidden {
	position: absolute !important;
	/* 1px */
	inline-size: 0.0625rem !important;
	/* 1px */
	block-size: 0.0625rem !important;
	/* -1px */
	margin: -0.0625rem !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
}

#ltic-release-notes-dialog,
.ltic-release-notes-layout {
	/* Section headings: their links are always showing when the Table of
	   Contents is open */
	&:has(.ltic-release-notes-toc .wp-block-accordion-item.is-open)
		.ltic-release-notes-sections > .ltic-release-notes-section-heading:target + p.back-link,
	/* Notes: also need their section's <details> open in the Table of Contents.
	   The section link's id ends with the section's id (e.g. "link--new-releases",
	   "link--ltic-release-notes-dialog-new-releases"). */
	&:has(.ltic-release-notes-toc .wp-block-accordion-item.is-open):has(.ltic-release-notes-toc a[id$="-new-releases"] + details[open])
		.ltic-release-notes--new .ltic-release-note-heading:target + p.back-link,
	&:has(.ltic-release-notes-toc .wp-block-accordion-item.is-open):has(.ltic-release-notes-toc a[id$="-coming-soon"] + details[open])
		.ltic-release-notes--upcoming .ltic-release-note-heading:target + p.back-link,
	&:has(.ltic-release-notes-toc .wp-block-accordion-item.is-open):has(.ltic-release-notes-toc a[id$="-past-releases"] + details[open])
		.ltic-release-notes--past .ltic-release-note-heading:target + p.back-link {
		/* !important: some themes hide [hidden] with !important */
		display: block !important;

		/* On the page, when the Table of Contents is a sidebar (same width as
		   the layout's container query): also only shown while something in
		   the main landmark (<main> or role="main") has visible focus (e.g.
		   the heading, after following a Table of Contents link with the
		   keyboard). Not in the dialog (no container), and not when the Table
		   of Contents is above the content.

		   Otherwise it's visually hidden rather than display: none, so it can
		   still receive focus: when Tab moves focus from the heading to it,
		   there's a moment when nothing has focus. With display: none, Chrome
		   would hide it at that moment and focus would be lost. */
		@container ltic-rn-layout (inline-size >= 59.25rem) {
			/* :not(:hover, :focus-within): once it's showing, it stays showing
			   while the pointer is over it or it has focus. So a keyboard user
			   who switches to the mouse can click it: pressing on it moves focus
			   from the heading to the link without :focus-visible, which would
			   otherwise hide it before the click lands. */
			:is(main, [role="main"]):not(:has(:focus-visible)) &:not(:hover, :focus-within) {
				position: absolute !important;
				/* 1px */
				inline-size: 0.0625rem !important;
				/* 1px */
				block-size: 0.0625rem !important;
				/* -1px */
				margin: -0.0625rem !important;
				overflow: hidden !important;
				clip-path: inset(50%) !important;
				white-space: nowrap !important;
			}
		}
	}
}

/* ==========================================================================
 * Dialog and /release-notes page: shared section and list styles
 *
 * Colours come from two custom properties. The /release-notes page (a
 * standard white page) uses dark text on white; the dialog swaps them.
 * ========================================================================== */

.ltic-release-notes-sections {
	--ltic-rn-bg: #fff;
	--ltic-rn-fg: #111;
	/* "Now Available" text: dark on the white page (yellow on white fails contrast) */
	--ltic-rn-new: #111;
	background-color: var(--ltic-rn-bg);
	color: var(--ltic-rn-fg);
	/* Explicit base size, independent of the theme */
	/* 16px */
	font-size: 1rem;
	line-height: 1.5;
}

#ltic-release-notes-dialog,
#ltic-release-notes-dialog .ltic-release-notes-sections {
	--ltic-rn-bg: #111;
	--ltic-rn-fg: #fff;
	--ltic-rn-new: #f6c744;
}

/* "New Releases" / "Coming Soon" / "Past Releases" */
.ltic-release-notes-sections > .ltic-release-notes-section-heading {
	/* As wide as the boxes (628px at most), so the separator above it lines up */
	inline-size: auto;
	max-inline-size: 39.25rem;
	/* 32px, 12.5px */
	margin-block: 2rem 0.78125rem;
	padding: 0;
	font-family: inherit;
	line-height: 1.25;
	background-color: var(--ltic-rn-bg);
	color: var(--ltic-rn-fg);
	/* 18px */
	font-size: 1.125rem;
	font-weight: 900;
	letter-spacing: 0.04em;
}

.ltic-release-notes-sections > :first-child {
	margin-block-start: 0;
}

/* A separator above each section after the first ("Coming Soon"):
   stronger than the lines between notes. */
.ltic-release-notes-sections > .ltic-release-notes-section-heading:not(:first-child) {
	/* 32px */
	padding-block-start: 2rem;
	/* 2px */
	border-block-start: 0.125rem solid var(--ltic-rn-fg);
}

/* The lists: no left margin or padding, bullets hidden without touching list-style */
.ltic-release-notes-sections ul.ltic-release-notes {
	display: flex;
	flex-direction: column;
	/* 28px between the boxes */
	gap: 1.75rem;
	margin-block: 0;
	margin-inline-start: 0;
	/* 14px: room for the badge sitting on the first box's top border */
	padding-block-start: 0.875rem;
	padding-inline-start: 0;

	> li::marker {
		/* 0.01px */
		font-size: 0.000625rem;
		color: transparent;
	}

	/* Each note is a box, like the summary cards */
	> li.ltic-release-note {
		position: relative;
		box-sizing: border-box;
		/* 628px at most (the width in the preview), on the page and in the dialog */
		max-inline-size: 39.25rem;
		margin: 0;
		/* 25px start, 20px end */
		padding-block: 1.5625rem 1.25rem;
		/* 16px */
		padding-inline: 1rem;
		/* 2px */
		border: 0.125rem solid var(--ltic-rn-fg);

		/* The heading's text lines up, left and right, with the content below it. */
		> .wp-block-heading.ltic-release-note-heading {
			/* Static, so the badge is positioned against the whole box, not the heading */
			position: static;
			/* Space after the date line matches the gaps between the heading's lines */
			margin-block: 0 max(0.78125rem, 0.89em);
			padding: 0;
			background-color: var(--ltic-rn-bg);
			color: var(--ltic-rn-fg);
			/* Explicit sizes, so the theme's h3/h4 sizes don't scale everything up.
			   The spans inside are sized in em, relative to this. */
			font-family: inherit;
			/* 17px */
			font-size: 1.0625rem;
			line-height: 1.3;
			letter-spacing: normal;
			text-transform: none;

			> .title {
				/* 17px */
				font-size: 1em;
				line-height: 1.25;
			}

			/* The date line: explicit line height, so it's the same height on the
			   page as in the dialog whatever the theme sets */
			> .date {
				line-height: 1.5;
			}

			/* "Released on …" highlight: a little yellow above and below the text */
			> .date.is-new {
				/* 2px */
				padding-block: 0.125rem;
			}

			/* "Now Available" / "Coming Soon" on the box's top border */
			> strong.new-or-upcoming {
				/* -1px: centred on the 2px border */
				inset-block-start: -0.0625rem;
				/* 12px, fixed rather than relative to the heading */
				font-size: 0.75rem;
				background-color: var(--ltic-rn-bg);
				color: var(--ltic-rn-fg);

				&.is-new {
					color: var(--ltic-rn-new);
				}

				&.is-new > .new-or-upcoming-icon {
					background-color: #f6c744;
				}
			}
		}

		/* The note's content: explicit sizes, so the theme's paragraph and list
		   sizes don't make it bigger than the heading */
		> :not(.wp-block-heading.ltic-release-note-heading) {
			/* 16px */
			font-size: 1rem;
			line-height: 1.5;
		}

		:is(p, li, dd, dt, td, th, blockquote, figcaption) {
			font-size: inherit;
			line-height: inherit;
		}

		p {
			/* 0 above, 16px below */
			margin-block: 0 1rem;
		}

		/* Lists: the same spacing as paragraphs (none above, 16px below), so
		   the space before a list matches the space after it, whatever the
		   theme's list margins are. Lists inside list items: none. */
		:is(ul, ol) {
			/* 0 above, 16px below */
			margin-block: 0 1rem;
		}

		:is(ul, ol) > li > :is(ul, ol) {
			margin-block: 0;
		}

		/* No extra space above the content: the heading's bottom margin sets it.
		   (The heading is followed by its "Back to Table of Contents" link,
		   usually hidden, then the content.) */
		> .wp-block-heading.ltic-release-note-heading + *,
		> .wp-block-heading.ltic-release-note-heading + .back-link + * {
			margin-block-start: 0;
		}

		> :last-child {
			margin-block-end: 0;
		}

		a {
			color: inherit;
		}

		/* When its heading has visible focus (e.g. opened from a summary card
		   with the keyboard), the site's focus style goes on the whole box
		   instead. Only for the heading: other focusable elements inside the
		   box (such as links) show their own focus indicator. :focus-visible,
		   so the box only shows it when the browser's focus-visible heuristic
		   says focus should be shown (mouse cases: see below). */
		&:has(> .wp-block-heading.ltic-release-note-heading:focus-visible) {
			outline: 0.375rem double #000 !important;
			outline-offset: initial !important;
			box-shadow: 0 0 0 0.25rem #fff !important;
		}

	}
}

/* On the /release-notes page and in the dialog, the box also shows the
   focus style when its heading was reached with the mouse, the same as with
   the keyboard (the heading has focus then, but isn't :focus-visible): by
   following a Table of Contents link to it, or (in the dialog) by pressing
   its summary card. The scripts add .is-opened-at to the box when that
   happens and remove it once the heading loses focus (see
   release-notes-page.js and view.js), so clicking the heading later, even
   while it's still the :target, doesn't show it. */
:is(.ltic-release-notes-page, #ltic-release-notes-dialog) .ltic-release-notes-sections ul.ltic-release-notes > li.ltic-release-note.is-opened-at:has(> .wp-block-heading.ltic-release-note-heading:focus) {
	outline: 0.375rem double #000 !important;
	outline-offset: initial !important;
	box-shadow: 0 0 0 0.25rem #fff !important;
}

/* No focus style on the note headings themselves: the box (<li>) shows it
   through :has(:focus-visible) instead. The ID inside :is() gives this rule ID-level
   specificity in both places (dialog and page), so it beats the site's own
   !important :focus-visible rules. */
:is(#ltic-release-notes-dialog, .ltic-release-notes-sections) .wp-block-heading.ltic-release-note-heading:is(:focus, :focus-visible) {
	outline: none !important;
	outline-offset: 0 !important;
}

/* In the dialog, no focus indicator at all on the note heading (the box
   shows it): no theme box-shadow either. */
#ltic-release-notes-dialog .wp-block-heading.ltic-release-note-heading:is(:focus, :focus-visible) {
	box-shadow: none !important;
}

/* In the dialog, a note scrolled to the top keeps 25px of space above it,
   so its badge isn't cut off by the dialog's top edge. */
#ltic-release-notes-dialog ul.ltic-release-notes > li.ltic-release-note,
#ltic-release-notes-dialog .ltic-release-notes-sections > .ltic-release-notes-section-heading,
#ltic-release-notes-dialog .ltic-release-notes-accordion .wp-block-accordion-heading {
	/* 25px */
	scroll-margin-block-start: 1.5625rem;
}

/* "Past Releases" accordion and the "Table of Contents" accordion,
   styled to match the section headings and buttons */
:is(.ltic-release-notes-sections, .ltic-release-notes-toc) > .ltic-release-notes-accordion {
	inline-size: auto;
	/* As wide as the boxes (628px at most) */
	max-inline-size: 39.25rem;
	/* 32px */
	margin-block-start: 2rem;

	.wp-block-accordion-heading {
		margin: 0;
		padding: 0;
		font-family: inherit;
		/* 18px */
		font-size: 1.125rem;
		line-height: 1.25;
		letter-spacing: normal;
	}

	.wp-block-accordion-heading__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		/* 12.5px */
		gap: 0.78125rem;
		inline-size: 100%;
		margin: 0;
		/* 4px */
		padding-block: 0.25rem;
		/* 12.5px */
		padding-inline: 0.78125rem;
		/* 1px */
		border: 0.0625rem solid var(--ltic-rn-fg);
		border-radius: 0;
		background-color: var(--ltic-rn-bg);
		color: var(--ltic-rn-fg);
		font: inherit;
		/* 18px */
		font-size: 1.125rem;
		font-weight: 900;
		line-height: 1.25;
		letter-spacing: 0.04em;
		text-align: start;
		text-transform: none;
		cursor: pointer;

		&:hover {
			background-color: color-mix(in srgb, var(--ltic-rn-fg) 12%, var(--ltic-rn-bg));
		}

		&:focus-visible {
			/* 2px */
			outline: 0.125rem solid var(--ltic-rn-fg);
			outline-offset: 0.125rem;
		}
	}

	.wp-block-accordion-heading__toggle-title {
		text-decoration: none;
	}

	.wp-block-accordion-heading__toggle-icon {
		/* 24px */
		font-size: 1.5rem;
		font-weight: 400;
		line-height: 1;
	}

	.wp-block-accordion-panel {
		margin: 0;
		padding: 0;
	}
}

/* ==========================================================================
 * The dialog
 * ========================================================================== */

/* While the dialog is open, the page behind the backdrop can't scroll.
   scrollbar-gutter keeps the page from shifting sideways when its
   scrollbar disappears. */
html:has(#ltic-release-notes-dialog[open]) {
	overflow: hidden;
	scrollbar-gutter: stable;
}

#ltic-release-notes-dialog {
	box-sizing: border-box;
	/* Up to 680px wide (as in the preview: 628px of content, plus 25px padding
	   and a 1px border each side), with 16px either side on small screens */
	inline-size: min(42.5rem, 100% - 2rem);
	max-inline-size: none;
	/* 40px of space above and below */
	max-block-size: calc(100dvh - 5rem);
	margin: auto;
	/* 25px */
	padding: 1.5625rem;
	/* 1px */
	border: 0.0625rem solid #fff;
	border-radius: 0;
	background-color: #111;
	color: #fff;
	/* Explicit base size, independent of the theme */
	/* 16px */
	font-size: 1rem;
	line-height: 1.5;
	/* The whole dialog scrolls as one: the heading, Close button and permalink
	   scroll away with the list, so nothing ever covers it (works at any zoom). */
	overflow-block: auto;
	overscroll-behavior: contain;

	&::backdrop {
		background-color: rgb(0 0 0 / 0.8);
		/* 16px */
		-webkit-backdrop-filter: blur(1rem);
		/* 16px */
		backdrop-filter: blur(1rem);
	}

	/* Grid only while open: setting display on a closed <dialog> would show it. */
	&[open] {
		display: grid;
		grid-template-columns: 1fr auto;
		/* 12.5px */
		column-gap: 0.78125rem;
		align-items: start;
	}

	/* "Release Notes" */
	> h2 {
		grid-column: 1;
		grid-row: 1;
		margin: 0;
		padding: 0;
		background-color: #111;
		color: #fff;
		font-family: inherit;
		/* 40px */
		font-size: 2.5rem;
		font-weight: 700;
		line-height: 1.1;
		letter-spacing: normal;
		text-transform: none;
	}

	/* "Close": top right, beside the heading (scrolls away with it) */
	> .ltic-release-notes-dialog-close-control {
		grid-column: 2;
		grid-row: 1;
		margin: 0;
		padding: 0;

		> button[type="button"][commandfor][command] {
			/* 4px */
			padding-block: 0.25rem;
			/* 12.5px */
			padding-inline: 0.78125rem;
			/* 1px */
			border: 0.0625rem solid #fff;
			border-radius: 0;
			background-color: #111;
			color: #fff;
			/* Explicit type, independent of the theme's button styles */
			font-family: inherit;
			/* 16px */
			font-size: 1rem;
			font-weight: 400;
			line-height: 1.5;
			letter-spacing: normal;
			text-transform: none;
			cursor: pointer;
		}
	}

	/* Everything else spans the full width */
	> :not(h2, .ltic-release-notes-dialog-close-control) {
		grid-column: 1 / -1;
	}

	> .ltic-release-notes-dialog-permalink {
		/* 8px, 25px */
		margin-block: 0.5rem 1.5625rem;
		padding: 0;
		/* 16px: fits on one line at the dialog's full width (628px of content)
		   with this site's title (about 560px in Helvetica/Arial) */
		font-size: 1rem;
		line-height: 1.5;

		/* Room for its hover and focus background, like the Table of Contents
		   links. Inline, so a long title still wraps; each line gets the
		   padding when it does. */
		> a {
			/* 4px */
			padding-block: 0.25rem;
			/* 8px */
			padding-inline: 0.5rem;
			color: inherit;
			-webkit-box-decoration-break: clone;
			box-decoration-break: clone;
		}
	}
}

/* ==========================================================================
 * Dialog: hover, focus and active states
 *
 * The theme gives links and buttons a light background on hover, focus or
 * active, which put the dialog's white text on light grey. These rules set
 * the background and text colour of every interactive element in the dialog
 * for each of those states, so all text keeps at least 4.5:1 contrast with
 * the pixels around it:
 *
 *   Background                          White text   Grey text (70% white)
 *   #111 (the dialog)                   18.9:1       9.5:1
 *   7% white on #111 (back links)       16.0:1       8.0:1
 *   10% white on #111 (hover, links)    14.6:1       7.3:1
 *   12% white on #111 (hover, buttons)  13.7:1       6.9:1
 *
 * Focus indicators (outline, box-shadow) are left alone. The dialog's ID
 * makes these rules outweigh the theme's own (even !important) rules.
 * ========================================================================== */

/* Every state: no theme background, the dialog's text colour */
#ltic-release-notes-dialog :is(a, button, summary):is(:hover, :focus, :focus-visible, :active) {
	background-color: transparent !important;
	color: var(--ltic-rn-fg, #fff) !important;
}

/* The grey "date" and "For {Users}" lines in Table of Contents links stay grey */
#ltic-release-notes-dialog nav.ltic-release-notes-toc a:is(:hover, :focus, :focus-visible, :active) :is(.date, .users) {
	color: var(--ltic-rn-muted) !important;
}

/* "Back to Table of Contents" links keep their own background */
#ltic-release-notes-dialog .ltic-release-notes-sections p.back-link a:is(:hover, :focus, :focus-visible, :active) {
	background-color: color-mix(in srgb, var(--ltic-rn-fg) 7%, var(--ltic-rn-bg)) !important;
}

/* Hover: the plugin's own hover backgrounds (they win over focus).
   Table of Contents links get the same background while focused, too. */
#ltic-release-notes-dialog nav.ltic-release-notes-toc :is(a:is(:hover, :focus), summary:hover) {
	background-color: var(--ltic-rn-hover-bg) !important;
}

#ltic-release-notes-dialog :is(.wp-block-accordion-heading__toggle, .ltic-release-notes-dialog-close-control > button[type="button"]):hover {
	background-color: color-mix(in srgb, var(--ltic-rn-fg, #fff) 12%, var(--ltic-rn-bg, #111)) !important;
}

/* The Table of Contents toggle uses the Table of Contents' (lighter) hover background */
#ltic-release-notes-dialog nav.ltic-release-notes-toc .wp-block-accordion-heading__toggle:hover {
	background-color: var(--ltic-rn-hover-bg) !important;
}

/* Table of Contents links and "Back to Table of Contents" links (page and
   dialog): the theme's box-shadow only with visible (keyboard-style) focus.
   Not while just hovered, and not while focused or the :target after
   following a link with the mouse (e.g. a "Back to Table of Contents"
   link, which focuses and targets its Table of Contents link). The ID inside
   :is() gives this rule ID-level specificity in both places, so it outweighs
   the theme's rules. */
:is(#ltic-release-notes-dialog, .ltic-release-notes-layout) :is(nav.ltic-release-notes-toc a, p.back-link > a):not(:focus-visible) {
	box-shadow: none !important;
}

/* The dialog's permalink: on hover and focus, the same background as the
   Table of Contents links (10% white on #111: white text 14.6:1). The theme's
   box-shadow only with visible (keyboard-style) focus, not on hover. */
#ltic-release-notes-dialog > p.ltic-release-notes-dialog-permalink > a:is(:hover, :focus) {
	background-color: color-mix(in srgb, var(--ltic-rn-fg, #fff) 10%, var(--ltic-rn-bg, #111)) !important;
}

#ltic-release-notes-dialog > p.ltic-release-notes-dialog-permalink > a:not(:focus-visible) {
	box-shadow: none !important;
}

/* The dialog's "See all of our past releases" link, after the "Past
   Releases" list: a call to action, styled like the dialog's buttons (a
   bordered box, no underline, bold, with an arrow). On hover and focus, the
   buttons' hover background (12% white on #111: white text 13.7:1). The
   theme's box-shadow only with visible (keyboard-style) focus. */
#ltic-release-notes-dialog .ltic-release-notes-sections > p.ltic-release-notes-past-releases-link {
	/* 28px: the same as the space between note boxes */
	margin-block: 1.75rem 0;
	padding: 0;
	/* 16px */
	font-size: 1rem;
	line-height: 1.5;

	> a {
		display: inline-flex;
		align-items: center;
		/* 8px */
		gap: 0.5rem;
		/* 8px */
		padding-block: 0.5rem;
		/* 16px */
		padding-inline: 1rem;
		/* 1px */
		border: 0.0625rem solid var(--ltic-rn-fg, #fff);
		color: var(--ltic-rn-fg, #fff);
		font-weight: 700;
		text-decoration: none !important;

		/* Decorative arrow: hidden from assistive technologies (empty
		   alternative text after the slash) */
		&::after {
			/* A right arrow (U+2192), escaped so it survives any stylesheet encoding */
			content: "\2192" / "";
		}

		&:is(:hover, :focus) {
			background-color: color-mix(in srgb, var(--ltic-rn-fg, #fff) 12%, var(--ltic-rn-bg, #111)) !important;
		}

		&:not(:focus-visible) {
			box-shadow: none !important;
		}
	}
}
