/**
 * Card layout for the `customize.php` control panes.
 *
 * Scoped throughout to `.aureon-cz` — a class `src/customize-controls/index.js`
 * puts on `#customize-theme-controls` — and, within that, to the two classes the
 * same script adds by *shape* rather than by name: `.aureon-cz-list` on any pane
 * that holds navigation rows, and `.aureon-cz-bar` on the bar at the top of a
 * pane the user has drilled into. Nothing here names a panel or a section, so
 * every level of the tree gets the same treatment — the root list, the Aureon
 * panel, core's Menus and Widgets panels, and a section's own header — and a
 * surface a plugin registers is covered the moment it appears.
 *
 * Every selector here targets markup verified against core's own templates
 * (`WP_Customize_Panel::render_template()`,
 * `WP_Customize_Section::render_template()`,
 * `WP_Customize_Themes_Panel::render_template()`) rather than assumed: each row
 * is `<li><h3 class="accordion-section-title"><button class="accordion-trigger">`,
 * except the themes panel, which has no trigger and carries its own Change
 * button.
 */

@use "../shared/intro-card" as *;

$cz-ink: #0f172a;
$cz-muted: #64748b;
$cz-surface: #fff;
$cz-ground: #f6f8f8;
$cz-border: #e6ebeb;
$cz-brand: #d4a017;
$cz-brand-tint: #f6e6b8;
// Gold dark enough to read as text on white (palette-aureon 600/700).
$cz-brand-ink: #b8860b;
$cz-brand-ink-strong: #926d0c;
$cz-subtle: #94a3b8;
$cz-radius: 10px;
$cz-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);

// Moved up from the "Notice icons" section below (see its own docblock for
// why these are URL-encoded SVG rather than dashicon glyphs) — the Publish
// Settings tray's own preview-link notice needs `$cz-icon-info` ahead of
// where that section is defined.
$cz-icon-info: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E";

/**
 * 320px, twenty past core's 300px default and the same width Blocksy settles on:
 * enough that the row descriptions ("Set your homepage and posts page") hold one
 * line, and no more. The pane stays a pane — it never widens for a section, so
 * the preview beside it keeps the room it started with.
 */
.wp-full-overlay > .wp-full-overlay-sidebar {
	width: 320px;
}

/**
 * Where the preview starts. Core offsets the whole overlay by the width of *its*
 * sidebar — `300px`, `18%` above 1667px wide, `600px` above 3333px — while the
 * sidebar itself is `position: fixed` at the left edge, so any pane wider than
 * core's left the preview's first pixels underneath it (12px at this viewport,
 * where 18% comes to 308). One value, matching the pane above.
 *
 * The doubled class takes this to (0,3,0), enough to outrank core's own
 * `.wp-full-overlay.expanded` (0,2,0) in each of its three viewport bands.
 */
.wp-full-overlay.expanded.expanded {
	margin-left: 320px;
}

/**
 * The preview, framed: a bordered, rounded sheet inset on a soft ground, on
 * every device — desktop fills the space, tablet and mobile keep core's own
 * sizes centred in it. Core draws the desktop preview edge to edge and the
 * smaller devices as a bare box, so the page being edited never read as a
 * page.
 *
 * `--aureon-preview-bottom` is the gap under the frame; the header builder's
 * dock raises it to its own height while it's open (see admin/style.scss).
 *
 * Above core's small-screen band only: below 641px the pane and the preview
 * take turns filling the screen, and there's no room for a frame.
 */
@media (min-width: 641px) {

	.wp-full-overlay.wp-full-overlay {
		--aureon-preview-gap: 14px;
		--aureon-preview-bottom: var(--aureon-preview-gap);
		background: #eef0f3;

		> .wp-full-overlay-main {
			top: var(--aureon-preview-gap);
			bottom: var(--aureon-preview-bottom);
			height: auto;
			box-sizing: border-box;
			border: 1px solid #e3e6ea;
			border-radius: 12px;
			background: #fff;
			box-shadow:
				0 1px 2px rgba(15, 23, 42, 0.04),
				0 8px 24px rgba(15, 23, 42, 0.05);
			overflow: hidden;
		}

		&.preview-desktop > .wp-full-overlay-main {
			left: var(--aureon-preview-gap);
			right: var(--aureon-preview-gap);
			width: auto;
		}

		// Core's fixed device sizes, capped to the framed space. `margin: auto`
		// (core's) centres them vertically between `top` and `bottom`.
		&.preview-tablet > .wp-full-overlay-main,
		&.preview-mobile > .wp-full-overlay-main {
			max-width: calc(100% - 2 * var(--aureon-preview-gap));
			max-height: calc(100% - var(--aureon-preview-gap) - var(--aureon-preview-bottom));
			border-radius: 18px;
		}

		&.preview-tablet > .wp-full-overlay-main {
			height: 1080px;
		}

		&.preview-mobile > .wp-full-overlay-main {
			height: 480px;
		}
	}
}

// Core sets an explicit `width` on both bars *and* leaves them `content-box`,
// so any horizontal padding of ours would push them wider than the pane.
#customize-header-actions.aureon-cz-header,
#customize-footer-actions.aureon-cz-footer {
	box-sizing: border-box;
}

/**
 * The scrolling area between the two bars. Core insets it by `top: 45px;
 * bottom: 45px` — the height of its own header and footer — so the taller
 * header this design uses (56px) was overlapped by the top of the list, and the
 * shorter footer (44px) left a 1px band of ground below it. Restated to match
 * the two bars as drawn here.
 */
.wp-full-overlay-sidebar .wp-full-overlay-sidebar-content {
	top: 56px;
	bottom: 44px;
}

/**
 * The card row itself — icon tile, title, description, centred chevron —
 * shared by the root list and the Aureon panel's own list one level down.
 * Only how the cards are grouped differs between the two (see each scope
 * below), so only that is written twice.
 */
@mixin cz-card-rows {

	> .aureon-cz-row {
		border: 0;
		background: $cz-surface;
	}

	> .aureon-cz-row + .aureon-cz-row {
		// The rows read as a single card, so only the seams between them show.
		border-top: 1px solid $cz-border;
	}

	// The title element only positions things; the button inside it is the
	// click target and carries the padding, so the whole card row is clickable.
	> .aureon-cz-row > .accordion-section-title {
		position: relative;
		margin: 0;
		padding: 0;
		border: 0;
		background: transparent;

		// Core pins its chevron to `top: 12px` (see wp-admin/css/common.css),
		// which sits near the top of a row this tall. Centre it instead.
		&::after {
			top: 50%;
			right: 12px;
			transform: translateY(-50%);
			color: $cz-subtle;
			font-size: 16px;
		}
	}

	> .aureon-cz-row > .accordion-section-title > .accordion-trigger {
		display: flex;
		align-items: center;
		gap: 11px;
		width: 100%;
		// Right padding leaves room for core's absolutely-positioned chevron.
		padding: 9px 36px 9px 12px;
		border: 0;
		background: transparent;
		color: $cz-ink;
		font-size: 13px;
		font-weight: 600;
		line-height: 1.35;
		text-align: left;
		cursor: pointer;

		&:hover,
		&:focus {
			background: rgba($cz-brand, 0.06);
			color: $cz-ink;
		}
	}

	.aureon-cz-label {
		display: flex;
		flex-direction: column;
		gap: 1px;
		min-width: 0;
	}

	.aureon-cz-desc {
		color: $cz-muted;
		font-size: 11px;
		font-weight: 400;
		line-height: 1.35;
	}

	.aureon-cz-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		width: 30px;
		height: 30px;
		border-radius: 7px;
		background: $cz-brand-tint;
		color: $cz-brand;

		svg {
			width: 16px;
			height: 16px;
			stroke-width: 1.9;
		}
	}

	// Which rows are the card's two ends moves as rows come and go — a module
	// switched off, a section that doesn't apply to the previewed page — so the
	// script marks them (see `markEdges()`) rather than CSS guessing with
	// `:first-child`/`:last-child`, which count hidden rows too.
	> .aureon-cz-first {
		border-top: 0;
		border-radius: $cz-radius $cz-radius 0 0;
	}

	> .aureon-cz-last {
		border-radius: 0 0 $cz-radius $cz-radius;
		box-shadow: $cz-shadow;
	}

	> .aureon-cz-first.aureon-cz-last {
		border-radius: $cz-radius;
	}

	// The Blocksy-style group headings (`decorateGroupTitle()` in index.js) —
	// a label between cards, not a row of one. No surface, no chevron, no
	// hover state: `markEdges()` already excludes these from the card runs,
	// so this only has to make them look the part.
	> .aureon-cz-group-title {
		margin: 16px 0 4px;
		padding: 0 12px;

		&:first-child {
			margin-top: 0;
		}

		> .accordion-section-title {
			margin: 0;
			padding: 0;
			border: 0;
			background: transparent;

			&::after {
				display: none;
			}
		}

		> .accordion-section-title > .accordion-trigger {
			display: block;
			width: 100%;
			padding: 0;
			border: 0;
			background: transparent;
			color: $cz-muted;
			font-size: 11px;
			font-weight: 700;
			letter-spacing: 0.04em;
			text-transform: uppercase;
			text-align: left;
			cursor: default;

			&:hover,
			&:focus {
				background: transparent;
				color: $cz-muted;
			}
		}

		// The line under a heading that carries one (WooCommerce's panel; see
		// `decorateGroupTitle()`). Sentence case against the heading's caps,
		// so the pair reads as title + explanation rather than as two labels.
		.aureon-cz-group-desc {
			display: block;
			margin-top: 3px;
			color: $cz-muted;
			font-size: 12px;
			font-weight: 400;
			letter-spacing: 0;
			text-transform: none;
			line-height: 1.35;
		}
	}
}

/**
 * Every pane that holds navigation rows, at any depth — the root list, a panel's
 * section list, a nested one. The class is added by `paintPane()` to whichever
 * panes turn out to have rows, so this reaches core's Menus and Widgets panels
 * and any plugin's panel without naming one.
 *
 * `#customize-theme-controls .customize-pane-parent` (1,1,0) is core's own, so
 * the scope needs its id too — `.aureon-cz` alone (0,2,0) loses to it and the
 * card insets silently don't apply.
 */
#customize-theme-controls#customize-theme-controls.aureon-cz
.aureon-cz-list {
	padding: 12px;
	background: $cz-ground;

	@include cz-card-rows;

	// The rows are inset as a card; the bar above them spans the pane, so it
	// breaks back out of that inset.
	> .aureon-cz-bar,
	> .section-meta {
		margin: -12px -12px 12px;
	}
}

// The themes row, which only ever appears in the root list.
#customize-theme-controls#customize-theme-controls.aureon-cz
.customize-pane-parent {
	// One card for the themes row, one for the stack of everything below it.
	> .aureon-cz-theme {
		margin-bottom: 12px;
		border-radius: $cz-radius;
		box-shadow: $cz-shadow;
	}

	// The themes row has no trigger button, so its title is the flex row.
	// Core hides its chevron already and absolutely positions the Change
	// button; both are undone here so it can sit in the flow.
	> .aureon-cz-theme > .accordion-section-title {
		display: flex;
		align-items: center;
		gap: 11px;
		padding: 9px 12px;
		color: $cz-ink;
		font-size: 13px;
		font-weight: 600;
		cursor: default;

		.customize-action {
			display: block;
			color: $cz-muted;
			font-size: 10px;
			font-weight: 600;
			letter-spacing: 0.04em;
			text-transform: uppercase;
		}

		.change-theme {
			position: static;
			min-height: 0;
			height: 28px;
			margin: 0 0 0 auto;
			padding: 0 10px;
			border-color: $cz-brand;
			border-radius: 6px;
			background: $cz-surface;
			color: $cz-brand;
			font-size: 12px;
			line-height: 26px;
		}
	}

	/**
	 * The "Search settings…" box `mountSearch()` inserts right after the
	 * themes card — a plain `<li>` outside the `aureon-cz-row` card system
	 * (see `cz-card-rows`), styled as its own standalone field instead.
	 */
	> .aureon-cz-search {
		position: relative;
		display: flex;
		align-items: center;
		margin: 0 0 16px;
		list-style: none;
	}

	// A grandchild of the pane (nested inside `.aureon-cz-search` above), not
	// a direct child — no `>` here, unlike every sibling rule in this block.
	.aureon-cz-search-icon {
		position: absolute;
		left: 11px;
		display: flex;
		color: $cz-subtle;
		pointer-events: none;

		svg {
			width: 15px;
			height: 15px;
			stroke-width: 2;
		}
	}

	.aureon-cz-search-input {
		width: 100%;
		height: 34px;
		padding: 0 12px 0 33px;
		border: 1px solid $cz-border;
		border-radius: 8px;
		background: $cz-surface;
		color: $cz-ink;
		font-size: 12px;
		box-shadow: none;

		&::placeholder {
			color: $cz-subtle;
		}

		&:focus {
			border-color: $cz-brand;
			box-shadow: 0 0 0 3px rgba($cz-brand, 0.15);
		}
	}

	// The "No settings found." line `filterRows()` shows once a query
	// matches nothing — plain text, not a row, so it stays outside the card
	// system too.
	> .aureon-cz-search-empty {
		padding: 20px 12px;
		color: $cz-muted;
		font-size: 12px;
		text-align: center;
		list-style: none;
	}
}

/**
 * The "Publish Settings" tray — core's `api.OuterSection` (`publish_settings`,
 * opened from the gear icon beside Publish/Schedule), a JS-only section
 * living in its own `#customize-outer-theme-controls` pane rather than the
 * accordion. Its *bar* is covered already: `PANE_SELECTOR` in index.js
 * folds this pane into the same `panes()`/`decorateBar()` pass every other
 * section's bar gets, since core builds it from the identical
 * `Container.getContent()` markup. This reaches only its *controls* — the
 * changeset status radios, Discard Changes, and Share Preview Link — which
 * `decoratePublishSettings()` in index.js decorates to match.
 */

/**
 * Pin the tray to the sidebar's width.
 *
 * Core sizes this pane `min-width: 100%; width: auto` — absolutely positioned
 * with only a `left`, so `auto` is shrink-to-fit and the pane grows to its
 * widest child's *max-content*. One child has no upper bound: core renders the
 * Share Preview Link as a `white-space: nowrap` span holding the whole
 * changeset URL, which in the fixed-width sidebar merely ellipsises but here
 * sets the width — so the tray opened at ~700px, twice the pane it slides out
 * of, the longer the site URL the wider it got. `100%` resolves against
 * `#customize-controls`, i.e. exactly the sidebar, and the nowrap span goes
 * back to ellipsising inside it.
 */
#customize-sidebar-outer-content {
	width: 100%;
	max-width: 100%;
}

#customize-outer-theme-controls .accordion-section-content {
	padding: 12px;
	background: $cz-ground;
}

#customize-outer-theme-controls .customize-control {
	margin: 0 0 12px;
	padding: 0;
	border: 0;

	&:last-child {
		margin-bottom: 0;
	}
}

// One icon tile, restated for this pane — the generic `.aureon-cz-icon` rule
// above is scoped to `#customize-theme-controls`, a different DOM tree.
//
// Muted by default (matches an *unselected* changeset-status choice); the
// solid brand-filled look right below is reserved for whichever choice row
// is actually checked, so only one tile reads as "this one" at a time.
#customize-outer-theme-controls .aureon-cz-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 7px;
	background: $cz-border;
	color: $cz-muted;

	svg {
		width: 16px;
		height: 16px;
		stroke-width: 1.9;
	}
}

// The synthetic "Publish Options"/"Danger Zone"/"Schedule date & time"
// headings `publishGroupHeading()` prepends inside a control this tray has
// no real section boundary for (see that function's own docblock) — a card
// header at the top of whatever card the control below already is, rather
// than a label floating above a separate card, which is what letting it
// travel with the control as a true child buys back.
#customize-outer-theme-controls .aureon-cz-publish-heading {
	margin: 0;
	padding: 12px 12px 4px;
}

#customize-outer-theme-controls .aureon-cz-publish-heading-title {
	margin: 0;
	color: $cz-ink;
	font-size: 13px;
	font-weight: 700;
}

#customize-outer-theme-controls .aureon-cz-publish-heading-desc {
	margin: 2px 0 0;
	color: $cz-muted;
	font-size: 11px;
}

// The changeset status radios (Publish / Save Draft / Schedule): each choice
// row cards up like an ordinary settings row — icon tile, core's own label
// as the title, and the description `decorateStatusControl()` adds.
#customize-control-changeset_status {
	background: $cz-surface;
	border-radius: $cz-radius;
	box-shadow: $cz-shadow;
	overflow: hidden;

	.customize-inside-control-row {
		box-sizing: border-box;
		display: flex;
		align-items: center;
		gap: 11px;
		margin: 0;
		padding: 9px 12px;
		border: 0;
		cursor: pointer;

		// Content-box (the browser default core leaves this) would add this
		// border on top of the row's own padding-box width instead of eating
		// into it, nudging every row 1px wider than its sibling above it —
		// `box-sizing: border-box` above keeps all of them the same width.
		+ .customize-inside-control-row {
			border-top: 1px solid $cz-border;
		}

		&:has(input:checked) {
			background: rgba($cz-brand, 0.08);

			.aureon-cz-icon {
				background: $cz-brand;
				color: $cz-surface;
			}
		}
	}

	// `accent-color` alone does nothing here: core's own forms.css paints a
	// checked radio itself — `input[type="radio"]:checked { background:
	// var(--wp-admin-theme-color); border-color: … }` — which overrides the
	// native accent-color rendering with a hard-coded admin-blue fill. Match
	// that same property, at higher specificity (this control's own ID),
	// rather than relying on a browser feature core's CSS already defeats.
	input[type="radio"] {
		flex: 0 0 auto;
		margin: 0;

		&:checked {
			background: $cz-brand;
			border-color: $cz-brand;
		}
	}

	label {
		display: flex;
		flex-direction: column;
		gap: 1px;
		min-width: 0;
		color: $cz-ink;
		font-size: 13px;
		font-weight: 600;
		cursor: pointer;
	}
}

#customize-outer-theme-controls .aureon-cz-desc {
	color: $cz-muted;
	font-size: 11px;
	font-weight: 400;
}

// Discard Changes, restyled as a plain card with a tinted inner row — "Danger
// Zone" itself reads as a normal card header, only the button's own row is
// warning-coloured, matching the mockup. Core's own control is a bare
// `<button>` (see `decorateDangerZone()`'s own docblock in index.js for why
// it's a `<button>` despite `type: 'button'` sounding like an `<input>`),
// moved into that inner row but deliberately never itself the target of a
// CSS rule here: doing so — under any of several unrelated-looking
// declarations tried while chasing this down, not any one property in
// particular — reproducibly left the button visually and hit-test ghosted
// near the top of the tray, well away from its real (and correctly
// reported, per `getBoundingClientRect()`) position in this card. Left
// untargeted, core's own `.button-link.button-link-delete` look (a small
// red text link with its own dashicon) is what shows instead — plainer
// than the rest of this card, but correctly positioned and clickable,
// which a broken custom look isn't.
$cz-danger: #c0392b;

#customize-control-trash_changeset.aureon-cz-danger {
	background: $cz-surface;
	border-radius: $cz-radius;
	box-shadow: $cz-shadow;
	overflow: hidden;

	.aureon-cz-danger-row {
		display: flex;
		align-items: center;
		gap: 11px;
		margin: 4px 12px 12px;
		padding: 10px 11px;
		background: rgba($cz-danger, 0.06);
		border: 1px solid rgba($cz-danger, 0.2);
		border-radius: 8px;
		// The click target is really just the button text inside (see
		// `decorateDangerZone()`'s own docblock in index.js for why the
		// button itself is never touched by a CSS rule) — index.js proxies a
		// click anywhere in this row to that button, so the whole card
		// should read as clickable rather than only its one line of text.
		cursor: pointer;
	}

	.aureon-cz-danger-icon {
		background: rgba($cz-danger, 0.12);
		color: $cz-danger;
	}

	.aureon-cz-label {
		display: flex;
		flex-direction: column;
		gap: 1px;
		min-width: 0;
	}

	.aureon-cz-desc {
		color: rgba($cz-danger, 0.75);
	}

	// The redundant half of core's own icon: `#customize-control-
	// trash_changeset .button-link` reserves 24px on the left for a
	// `:before` trash dashicon of its own — meant for a bare button with no
	// icon of its own, but this row already carries one in its own tinted
	// tile, so left alone the button rendered a second, smaller trash glyph
	// immediately before its own text. Unlike the button's box itself (see
	// this control's own docblock in index.js), this targets a purely
	// cosmetic pseudo-element core paints on top of it, not anything
	// touching the button's own layout box — verified live to carry none of
	// that regression: the button's `getBoundingClientRect()` and its hit
	// area still land exactly on the tinted row it visually sits in.
	.button-link {
		padding-left: 0 !important;

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

// Share Preview Link — core's own markup already carries a title,
// description and notice. Core still decides which of the link/input/button
// trio is visible at any moment (a JS state machine — see
// `PreviewLinkControl` in core's own `customize-controls.js`); what changes
// here is how those three look and sit together, not that logic. Core's own
// look leans on absolute positioning (the button floats over the input, a
// white fade masks the seam) because it never lets the input's raw text show
// — `text-indent: -999px` in core's own CSS pushes it off-screen, the `<a>`
// carries the visible text instead. Flexed into one bordered pill here
// instead, with the button un-floated back into the flow (`position:
// static`, `!important` since core's own rule for it carries one too).
#customize-control-changeset_preview_link {
	// Core hands every `.customize-control` `width: 100%` (see
	// `#customize-control-changeset_status .customize-inside-control-row`'s
	// own rule in `customize-controls.css`, which sets it on this control
	// too) but leaves box-sizing at its content-box default — left alone,
	// this card's own 12px padding below would land on top of that 100%
	// instead of inside it, overflowing the sidebar exactly like the
	// schedule date card's fields did before its own box-sizing fix.
	box-sizing: border-box;
	background: $cz-surface;
	border-radius: $cz-radius;
	box-shadow: $cz-shadow;
	// `!important`: same fight as `#customize-control-changeset_scheduled_date`'s
	// own padding (see that rule's own comment) — the tray-wide
	// `#customize-outer-theme-controls .customize-control` reset is
	// ID+class, which beats this plain-ID selector on specificity alone
	// regardless of source order.
	padding: 12px !important;

	.customize-control-title {
		margin: 0 0 2px;
		color: $cz-ink;
		font-size: 13px;
		font-weight: 700;
	}

	.customize-control-description {
		margin: 0 0 10px;
		color: $cz-muted;
		font-size: 11px;
		font-style: normal;
	}

	.preview-link-wrapper {
		display: flex;
		align-items: stretch;
		border: 1px solid $cz-border;
		border-radius: 8px;
		overflow: hidden;
		background: $cz-surface;
	}

	// The pill's visible half. Core's own CSS floats this `<a>` absolutely
	// (`position: absolute; bottom: 14px; width: 90%`) over the `<input>`
	// below, its own way of stacking the two — never overridden before, so
	// it stayed absolutely positioned and floated on top of the flexed
	// layout below rather than joining it, overlapping the input and button
	// it was meant to sit beside.
	a {
		display: flex;
		align-items: center;
		position: static !important;
		bottom: auto !important;
		width: auto !important;
		flex: 1 1 auto;
		min-width: 0;
		height: 36px;
		padding: 0 10px;
		border: 0;
		background: transparent;
		color: $cz-ink;
		font-size: 12px;
		text-decoration: none;

		.preview-control-element {
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}
	}

	// The real copy source `PreviewLinkControl.ready()` selects and
	// `execCommand( 'copy' )`s — never the `<a>` above, which only mirrors
	// the same value for display. Core already pushes its own text off-
	// screen (`text-indent: -999px`) rather than hiding the element, since
	// its own layout stacks this *under* the `<a>`; flexed side by side
	// instead, that leaves a second, blank-looking flex item the width of
	// the `<a>` next to it unless collapsed out of the row entirely here.
	input {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		border: 0;
		opacity: 0;
	}

	.customize-copy-preview-link {
		position: static !important;
		top: auto !important;
		right: auto !important;
		transform: none !important;
		flex: 0 0 auto;
		height: 36px !important;
		min-height: 36px !important;
		margin: 0 !important;
		padding: 0 14px;
		border: 0;
		border-left: 1px solid $cz-border;
		border-radius: 0;
		background: $cz-ground !important;
		color: $cz-brand !important;
		font-size: 12px;
		font-weight: 600;

		// Core's own disabled state (before the changeset is saved, per
		// `updatePreviewLink()`) repaints this with its own `!important`
		// greyscale — `.wp-core-ui .button-secondary:disabled` et al, in
		// `common.css` — which otherwise wins over the plain `color` above
		// despite this selector's own higher (ID-scoped) specificity: an
		// `!important` declaration always beats a non-`!important` one
		// regardless of specificity, so matching it here is the only way to
		// keep this button legible while the changeset is unsaved.
		&:disabled {
			color: $cz-brand !important;
		}

		// Core's own "fade the input out from under the floating button"
		// trick — moot once the button sits in flow instead of on top.
		&::before,
		&::after {
			content: none;
		}
	}

	// Core's own info notice ("Please save your changes before sharing…") —
	// a compact version of the icon-tinted notice style used for the global
	// notifications area (see `cz-notice-icon` below), scoped to this one
	// control's own notifications container instead.
	.customize-control-notifications-container .notice {
		display: flex;
		align-items: flex-start;
		gap: 8px;
		margin: 0 0 10px;
		padding: 9px 10px;
		border: 0;
		border-radius: 8px;
		background: #eef6fb;
		color: $cz-ink;
		font-size: 11px;
		line-height: 1.45;

		&::before {
			content: "";
			flex: 0 0 auto;
			width: 14px;
			height: 14px;
			margin-top: 1px;
			background-color: #1971a8;
			-webkit-mask: url($cz-icon-info) center / 14px 14px no-repeat;
			mask: url($cz-icon-info) center / 14px 14px no-repeat;
		}
	}
}

// The schedule date/time control — visible only once "Schedule" is chosen
// (see `decorateDateControl()`'s own docblock in index.js). Restyles core's
// day/hour number inputs and month/meridian selects into the same
// bordered-box language as the rest of this tray, moves its timezone note
// into an info box, and styles the live "Scheduled to publish" preview and
// footnote `decorateDateControl()` appends.
#customize-control-changeset_scheduled_date {
	background: $cz-surface;
	border-radius: $cz-radius;
	box-shadow: $cz-shadow;
	// `!important`: the tray-wide `#customize-outer-theme-controls
	// .customize-control` reset above zeroes every control's own padding
	// to lay out its own 12px gaps between cards, and — despite coming
	// first in the file — beats a plain ID selector like this one on
	// specificity alone (that reset also carries a class, so it's
	// ID+class vs. this rule's ID-only), silently winning regardless of
	// source order and collapsing this card's own padding back to 0.
	padding: 12px !important;

	// Every fixed size below (the 52/62px day/hour/meridian boxes, the 90px
	// month field, the 34px trailing icon) is a *total* box size, but core
	// leaves box-sizing at its content-box default — left alone, each one's
	// own padding and border would land on top of that width/height instead
	// of inside it, so the 320px-wide sidebar this tray lives in wraps the
	// day/time fields a box or two earlier than it needs to.
	&,
	* {
		box-sizing: border-box;
	}

	// Core's own generic copy ("This will be published at the specified
	// date and time") — the heading `decorateDateControl()` inserts already
	// says as much.
	.customize-control-description {
		display: none;
	}

	.title-day,
	.title-time {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0 0 8px;
		color: $cz-ink;
		font-size: 12px;
		font-weight: 700;
	}

	.aureon-cz-field-icon {
		width: 24px;
		height: 24px;

		svg {
			width: 13px;
			height: 13px;
		}
	}

	.day-fields,
	.time-fields {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		gap: 6px;
	}

	// The `,` between day and year, the `:` between hour and minute — see
	// `decorateDateControl()`'s own docblock for why these need wrapping at
	// all rather than a plain CSS rule.
	.aureon-cz-date-sep {
		color: $cz-muted;
		font-weight: 600;
	}

	.time-row {
		margin-top: 14px;
		padding-top: 14px;
		border-top: 1px solid $cz-border;
	}

	select.date-input,
	input.date-input {
		height: 34px;
		margin: 0;
		padding: 0 8px;
		border: 1px solid $cz-border;
		border-radius: 8px;
		background: $cz-surface;
		color: $cz-ink;
		font-size: 12px;

		&:focus {
			border-color: $cz-brand;
			box-shadow: 0 0 0 3px rgba($cz-brand, 0.15);
			outline: none;
		}
	}

	// A visible chevron for the two real `<select>` fields (month, meridian)
	// — core's own arrow is whatever the platform draws by default, easy to
	// miss against a bordered box that otherwise looks like plain text.
	// `appearance: none` drops that native arrow so this replaces rather
	// than duplicates it; the hour/minute/day/year boxes are genuine number
	// inputs, not dropdowns, so they're left without one rather than
	// faking a control they aren't.
	select.date-input {
		appearance: none;
		padding-right: 26px;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: right 8px center;
		background-size: 13px 13px;
	}

	select.date-input.month {
		flex: 1 1 auto;
		min-width: 90px;
	}

	// The trailing calendar glyph after the year field — decorative only
	// (see `decorateDateControl()`'s own docblock in index.js), styled as
	// an outline box matching the other fields' height rather than one of
	// this tray's usual tinted tiles, since it isn't a live-preview icon
	// for anything, just a visual echo of "this is a date."
	.aureon-cz-date-trailing-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 34px;
		border: 1px solid $cz-border;
		border-radius: 8px;
		color: $cz-subtle;

		svg {
			width: 15px;
			height: 15px;
		}
	}

	input.date-input.day,
	input.date-input.year,
	input.date-input.hour,
	input.date-input.minute {
		width: 52px;
		text-align: center;

		// Hides the native up/down spinner so these read as plain boxes, like
		// the mockup — a typed or pasted value doesn't need it.
		-moz-appearance: textfield;

		&::-webkit-inner-spin-button,
		&::-webkit-outer-spin-button {
			appearance: none;
			margin: 0;
		}
	}

	select.date-input.meridian {
		width: 62px;
	}

	.aureon-cz-timezone-note {
		display: flex;
		align-items: flex-start;
		gap: 8px;
		width: 100%;
		margin: 12px 0 0;
		padding: 9px 10px;
		border-radius: 8px;
		background: #eef0fb;
		color: $cz-ink;
		font-size: 11px;
		line-height: 1.45;
	}

	.aureon-cz-timezone-icon {
		width: 24px;
		height: 24px;
		border-radius: 50%;
		background: rgba(#4c51bf, 0.12);
		color: #4c51bf;

		svg {
			width: 13px;
			height: 13px;
		}
	}

	.aureon-cz-schedule-confirm {
		display: flex;
		align-items: center;
		gap: 11px;
		margin-top: 14px;
		padding: 10px 12px;
		border-radius: 8px;
		background: rgba(#16a34a, 0.08);
	}

	.aureon-cz-schedule-icon {
		width: 30px;
		height: 30px;
		border-radius: 50%;
		background: rgba(#16a34a, 0.15);
		color: #16a34a;
	}

	// Three stacked lines — "Scheduled to publish", the bold date, the
	// timezone offset — not the single run-together line plain inline
	// `<span>`/`<strong>` siblings default to.
	.aureon-cz-schedule-confirm .aureon-cz-label {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.aureon-cz-schedule-confirm .aureon-cz-desc {
		font-size: 11px;
		font-weight: 400;
	}

	.aureon-cz-schedule-confirm strong {
		color: $cz-ink;
		font-size: 13px;
		font-weight: 700;
	}

	.aureon-cz-schedule-footnote {
		display: flex;
		align-items: flex-start;
		gap: 6px;
		margin: 8px 0 0;
		color: $cz-muted;
		font-size: 11px;
		line-height: 1.4;
	}

	.aureon-cz-footnote-icon {
		flex: 0 0 auto;
		width: 14px;
		height: 14px;
		margin-top: 1px;
		color: $cz-subtle;

		svg {
			width: 14px;
			height: 14px;
			stroke-width: 1.75;
		}
	}
}

/**
 * The bar at the top of any pane the user has drilled into: a panel's "You are
 * customizing Aureon" and a section's "Customizing ▸ Aureon / Colors" alike
 * (see `decorateBar()`, which marks both with this one class).
 *
 * Core renders the two with different nesting — a panel wraps its notice in
 * `.accordion-section-title` and keeps the help toggle inside it, a section puts
 * the eyebrow in a `.customize-action` span inside a bare `<h3>` and the toggle
 * beside it — so both shapes are written out here. That is the whole cost of
 * having the bar look the same at every depth.
 *
 * `flex-direction: column`, not `flex-wrap: wrap` on a single row — this bar
 * has two kinds of content that both need their own full-width line if
 * `wrap` is what's providing it: the back-button+title row, and (when
 * present) the description/notifications area below. `wrap` doesn't
 * distinguish "this child ran out of room, wrap the *rest* of its text" from
 * "this child ran out of room, push the *whole thing* to a new line" — it
 * only does the latter, so a long breadcrumb ("Customizing ▸ Aureon ▸
 * Content Templates" is longer than "… ▸ Wishlist") could push the title
 * wider than the space next to the back button and wrap the *entire title
 * block* onto its own line below the button, instead of truncating in
 * place. `decorateBar()` in index.js groups the back button, title, and
 * help toggle into one `.aureon-cz-bar__head` row (nowrap, so it can only
 * ever truncate, never wrap) — any description/notifications area is left
 * as a sibling of that row, and stacks below it for free under `column`
 * without needing a `flex: 0 0 100%` trick.
 */
// Scoped to `#customize-controls`, not `#customize-theme-controls`: the root
// screen's own bar is `#customize-info`, which is a *sibling* of the control tree
// rather than a pane inside it, so a scope on the tree would miss it entirely.
// The id is doubled to outrank core's own `#customize-controls .customize-info
// .accordion-section-title` (1,2,0) — two ids beat one, whatever the classes.
#customize-controls#customize-controls .aureon-cz-bar {
	display: flex;
	flex-direction: column;
	padding: 0;
	border: 0;
	border-bottom: 1px solid $cz-border;
	background: $cz-surface;

	> .aureon-cz-bar__head {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		// The panel and section bars take their height from the back tile; the
		// root's has no back button, so it needs the height stating to match them.
		min-height: 56px;
	}

	// Core positions both of these absolutely over the bar's left padding and
	// draws the arrow as a dashicon; here it's a tile in the flow instead.
	> .aureon-cz-bar__head > .customize-panel-back,
	> .aureon-cz-bar__head > .customize-section-back {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		position: static;
		width: 45px;
		height: 56px;
		// Core reserves this padding for the dashicon it draws as `::before`.
		padding: 0;
		border: 0;
		border-right: 1px solid $cz-border;
		border-left: 3px solid $cz-brand;
		background: $cz-brand-tint;
		color: $cz-brand;

		&::before {
			content: none;
		}

		&:hover {
			background: $cz-brand;
			color: $cz-surface;
		}

		// Core moves focus here as soon as the pane expands, so `:focus` alone
		// would paint the pressed look on arrival; the ring shows for keyboard
		// use, which is what it's for.
		&:focus-visible {
			box-shadow: inset 0 0 0 2px $cz-brand;
			outline: 2px solid transparent;
		}
	}

	.aureon-cz-back-icon svg {
		display: block;
		width: 17px;
		height: 17px;
	}

	// A panel's title block is a row (notice, then the help toggle); a section's
	// is the `<h3>` itself, with the toggle as its sibling.
	//
	// `overflow: hidden` here and on `.preview-notice`/`> h3` below is load-
	// bearing, not decorative: `min-width: 0` alone only *permits* this flex
	// item to shrink past its content's natural width — some engines (Safari
	// in particular) don't reliably propagate that shrink through a nested
	// `flex-direction: column` child down to `.customize-action`'s own
	// `text-overflow: ellipsis`. Without it the title could force `.aureon-
	// cz-bar__head` wider than its content — harmless now that the head row
	// is `nowrap` (it'd just overflow the header rather than wrap), but this
	// keeps the ellipsis actually doing its job.
	> .aureon-cz-bar__head > .accordion-section-title {
		display: flex;
		align-items: center;
		gap: 8px;
		flex: 1 1 auto;
		min-width: 0;
		overflow: hidden;
		margin: 0;
		// Core reserves 62px of left padding for the back button it absolutely
		// positions; the button is in the flow here.
		padding: 0 12px;
		border: 0;
		background: transparent;
	}

	.preview-notice,
	> .aureon-cz-bar__head > h3 {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-width: 0;
		overflow: hidden;
		margin: 0;
		color: $cz-ink;
		font-size: 15px;
		font-weight: 700;
		line-height: 1.25;
	}

	> .aureon-cz-bar__head > h3 {
		padding: 0 12px;
	}

	// The eyebrow: wrapped by `eyebrow()` for a panel, already a span of core's
	// own for a section.
	.aureon-cz-eyebrow,
	.customize-action {
		display: block;
		color: $cz-muted;
		font-size: 11px;
		font-weight: 400;
		line-height: 1.35;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.panel-title {
		font-weight: 700;
	}

	// `relative`, not `static`: core absolutely positions the dashicon glyph
	// itself (`.customize-help-toggle:before`, `top: 5px; left: 6px`) and counts
	// on the button being a containing block for it. Take that away and the glyph
	// anchors to the bar instead, landing on top of the title.
	// The Menus panel's Screen Options gear is built the same way, and core pins
	// it to `top: 30px; right: 0` of a bar that used to be 74px tall — in a bar
	// this height it floated out over the list below. It joins the toggle as a
	// flex item instead.
	.customize-help-toggle,
	.customize-screen-options-toggle {
		flex: 0 0 auto;
		position: relative;
		width: 28px;
		height: 28px;
		// `relative` keeps core's own offsets in play (`top: 4px` on the help
		// toggle, `top: 30px` on the gear), which would now nudge a box that's
		// already where it belongs.
		top: 0;
		right: auto;
		margin: 0;
		padding: 0;
		color: $cz-muted;

		&:hover,
		&:focus {
			background: transparent;
			color: $cz-brand;
		}
	}

	// No `flex: 0 0 100%` needed: these sit outside `.aureon-cz-bar__head`, as
	// plain siblings of it in the outer `column`-direction bar, so they're
	// full width by default.
	//
	// `.no-widget-areas-rendered-notice` is the Widgets panel's "Your theme has
	// N other widget areas…" message — core appends it to this same bar after
	// the panel embeds (see `BAR_FULL_WIDTH_CHILDREN` in index.js for why it has
	// to stay out of the head row). Styled the same as the description blocks
	// so it reads as one more line of the bar rather than bare browser text.
	.customize-panel-description,
	.customize-section-description,
	.no-widget-areas-rendered-notice {
		margin: 0;
		padding: 12px;
		border: 0;
		background: $cz-ground;
		color: $cz-muted;
		font-size: 12px;
		font-style: normal;
	}


}

/**
 * A panel lede (see `decorateLede()` in index.js) — the same tinted
 * icon-and-text card a *section* opens with, for a panel that has no mount
 * control to render one. Core keeps a panel description hidden until the "?"
 * toggle is pressed; this one is always shown, so it's `display: flex` here
 * rather than relying on that toggle's inline style.
 *
 * It is scoped to the pane, not to `.aureon-cz-bar`: `decorateLede()` lifts the
 * card out of the bar into a row of its own beneath it, so that it scrolls with
 * the list it introduces instead of sitting inside the navigation header.
 */
#customize-controls#customize-controls {

	// The shared intro card (see `src/shared/_intro-card.scss`) — the same
	// card every React section opens with, so a panel and a section read alike.
	.customize-panel-description.aureon-cz-lede-card {

		@include intro-card($cz-surface, $cz-brand, $cz-shadow);
		display: flex !important;
		// Flush with the row cards below it rather than inset past them.
		margin: 0 0 4px;
	}

	.aureon-cz-lede-icon {

		@include intro-card-icon($cz-brand, #fff);

		svg {
			stroke-width: 1.9;
		}
	}

	// The optional title, the text and its optional "Learn more" link (see
	// `Customizer::set_panel_lede()`), stacked.
	.aureon-cz-lede {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 3px;
	}

	.aureon-cz-lede-title {

		@include intro-card-title($cz-ink);
	}

	.aureon-cz-lede-text {

		@include intro-card-text($cz-muted);
	}

	.aureon-cz-lede-link {
		margin-top: 3px;
		color: $cz-brand-ink;
		font-size: 12px;
		font-weight: 600;
		text-decoration: none;

		&:hover,
		&:focus {
			color: $cz-brand-ink-strong;
			text-decoration: underline;
		}
	}
}

/**
 * WooCommerce's panel: each row its own card rather than one card per group,
 * with a roomier icon tile and title — the panel is a short, grouped menu of
 * destinations, and separate cards make each read as one.
 */
#customize-theme-controls#customize-theme-controls.aureon-cz
#sub-accordion-panel-woocommerce.aureon-cz-list {

	> .aureon-cz-row,
	> .aureon-cz-row.aureon-cz-first,
	> .aureon-cz-row.aureon-cz-last {
		border: 1px solid $cz-border;
		border-radius: 12px;
		box-shadow: $cz-shadow;
		transition: border-color 0.12s ease;

		&:hover,
		&:focus-within {
			border-color: $cz-brand;
		}
	}

	> .aureon-cz-row + .aureon-cz-row {
		margin-top: 8px;
		border-top: 1px solid $cz-border;

		&:hover,
		&:focus-within {
			border-top-color: $cz-brand;
		}
	}

	> .aureon-cz-row > .accordion-section-title > .accordion-trigger {
		gap: 14px;
		padding: 12px 38px 12px 12px;
		border-radius: 11px;
		font-size: 14px;
		font-weight: 700;

		&:hover,
		&:focus {
			background: color-mix(in srgb, $cz-brand 5%, $cz-surface);
		}
	}

	.aureon-cz-label {
		gap: 2px;
	}

	.aureon-cz-desc {
		font-size: 12px;
	}

	.aureon-cz-icon {
		width: 42px;
		height: 42px;
		border-radius: 10px;
		background: color-mix(in srgb, $cz-brand-tint 55%, $cz-surface);
		color: $cz-brand-ink;

		svg {
			width: 20px;
			height: 20px;
		}
	}

	> .aureon-cz-group-title {
		margin: 22px 0 10px;
	}
}

/**
 * The Menus panel (see `decorateMenusPanel()` in index.js): a header over the
 * menu list with the create action in it, a status line and badge on each
 * menu, and the locations row as a card of its own.
 *
 * Three ids deep so it outranks both the list's card rules above and core's
 * own `customize-nav-menus.css`.
 */
#customize-theme-controls#customize-theme-controls.aureon-cz
#sub-accordion-panel-nav_menus {

	> .aureon-cz-menus-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		margin: 4px 0 10px;
		padding: 0 2px;
		border: 0;
		background: transparent;
		font-weight: 400;
	}

	.aureon-cz-menus-head__text {
		display: flex;
		flex-direction: column;
		gap: 2px;
		min-width: 0;
	}

	.aureon-cz-menus-head__title {
		color: $cz-ink;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.3;
	}

	.aureon-cz-menus-head__desc {
		color: $cz-muted;
		font-size: 12px;
		line-height: 1.35;
	}

	.aureon-cz-menus-head__add {
		display: inline-flex;
		flex: 0 0 auto;
		align-items: center;
		gap: 5px;
		height: 30px;
		padding: 0 11px 0 9px;
		border: 1px solid $cz-brand;
		border-radius: 8px;
		background: $cz-surface;
		color: $cz-brand-ink;
		font-size: 12px;
		font-weight: 600;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		transition:
			background-color 0.12s ease,
			color 0.12s ease;

		&:hover {
			background: $cz-brand;
			color: #fff;
		}

		&:focus-visible {
			outline: 2px solid $cz-brand;
			outline-offset: 2px;
		}
	}

	.aureon-cz-menus-head__add-icon {
		display: flex;

		svg {
			width: 14px;
			height: 14px;
			stroke-width: 2.25;
		}
	}

	// Menu rows sit a little taller than the root list's, with room for a
	// name, a badge and a status line.
	> .aureon-cz-menu-row > .accordion-section-title > .accordion-trigger {
		gap: 12px;
		padding-top: 11px;
		padding-bottom: 11px;
	}

	> .aureon-cz-menu-row .aureon-cz-icon {
		width: 36px;
		height: 36px;
		border-radius: 8px;
	}

	.aureon-cz-menu-name {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px 6px;
		overflow-wrap: anywhere;
	}

	.aureon-cz-menu-badge {
		display: inline-flex;
		align-items: center;
		height: 18px;
		padding: 0 7px;
		border-radius: 999px;
		background: #dcfce7;
		color: #15803d;
		font-size: 10px;
		font-weight: 600;
		line-height: 1;
	}

	> .aureon-cz-menu-row .aureon-cz-desc {
		margin-top: 2px;
	}

	// Core's "(Currently set to: …)" — the status line says it instead.
	.menu-in-location {
		display: none;
	}

	// Core's own Create New Menu section. Its button is replaced by the
	// header's (which expands this same section), so only its notices stay:
	// core shows those only while the site has no menus at all.
	> #accordion-section-add_menu {
		margin: 0;
		padding: 0;
		border: 0;
		background: transparent;

		> h3 {
			display: none;
		}

		.add-new-menu-notice {
			margin: 0 0 10px;
			padding: 12px;
			border: 1px dashed $cz-border;
			border-radius: $cz-radius;
			background: $cz-surface;
			color: $cz-muted;
			font-size: 12px;
			line-height: 1.45;

			&[hidden] {
				display: none;
			}

			// Two notices, one card.
			+ .add-new-menu-notice:not([hidden]) {
				margin-top: -10px;
				border-top: 0;
				border-radius: 0 0 $cz-radius $cz-radius;
				padding-top: 0;
			}
		}
	}

	// The locations row: core prepends its heading and paragraph into the
	// row itself, so the row becomes the card and its button a row inside it.
	> .aureon-cz-locations {
		margin-top: 16px;
		padding: 14px;
		border: 0;
		border-radius: $cz-radius;
		background: $cz-surface;
		box-shadow: $cz-shadow;

		.customize-section-title-menu_locations-heading {
			display: block;
			margin: 0;
			color: $cz-ink;
			font-size: 14px;
			font-weight: 700;
			line-height: 1.3;
		}

		.customize-section-title-menu_locations-description {
			margin: 2px 0 12px;
			color: $cz-muted;
			font-size: 12px;
			font-style: normal;
			line-height: 1.35;
		}

		> .accordion-section-title {
			border: 1px solid $cz-border;
			border-radius: 8px;
			overflow: hidden;
		}
	}
}

/**
 * The root screen's bar, where core styles the same parts again through
 * `.customize-info` — a 20px/200 title in grey, and 20px of padding on the help
 * toggle. Restated at this specificity so all three bars read alike.
 */
#customize-controls#customize-controls #customize-info.aureon-cz-bar {

	.preview-notice {
		font-size: 15px;
		font-weight: 700;
		line-height: 1.25;
	}

	.panel-title {
		display: block;
		color: $cz-ink;
		font-size: 15px;
		font-weight: 700;
		line-height: 1.25;
	}

	.customize-help-toggle {
		padding: 0;

		&::before {
			padding: 0;
		}
	}
}

// A section's description sits outside the bar, in the `<li>` core wraps both in.
#customize-controls#customize-controls
.section-meta > .customize-section-description {
	margin: 0;
	padding: 12px;
	border: 0;
	background: $cz-ground;
	color: $cz-muted;
	font-size: 12px;
}

/**
 * Header bar — the close button and the Publish pill, on one row (see
 * `decorateHeader()`). It carries no title: which screen you're on is what the
 * bar *below* it says, and only one of those is ever on screen at a time.
 *
 * `#customize-header-actions` is core's own element; only its own layout is
 * restyled here, and every child keeps its class and handler.
 */
#customize-header-actions.aureon-cz-header {
	display: flex;
	align-items: center;
	gap: 0;
	height: auto;
	min-height: 56px;
	padding: 0 12px 0 0;
	border-bottom: 1px solid $cz-border;
	background: $cz-surface;

	// Core absolutely positions both the close link and the save wrapper, which
	// would take them straight out of this flex row.
	.customize-controls-close,
	.customize-save-button-wrapper {
		position: static;
	}

	.customize-controls-close {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 46px;
		height: 56px;
		border: 0;
		border-right: 1px solid $cz-border;
		background: $cz-surface;
		color: $cz-ink;

		// Core draws its own icon as dashicons `::before` content; the injected
		// SVG replaces it.
		&::before {
			content: none;
		}

		&:hover,
		&:focus {
			background: $cz-ground;
			color: $cz-brand;
		}
	}

	.aureon-cz-close-icon svg {
		width: 17px;
		height: 17px;
	}

	/**
	 * The pill, which is one shape around three of core's own things: the check,
	 * the (translated) label, and the scheduling gear.
	 *
	 * Its two states are core's, not invented here: `saved` means there is
	 * nothing to publish, and core has already relabelled `#save` to "Published"
	 * and disabled it by the time this paints. So saved reads as a finished,
	 * quiet state — grey, with a check — and the brand fill is spent only on the
	 * state that actually wants a click.
	 */
	.customize-save-button-wrapper {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		gap: 5px;
		margin-left: auto;
		padding: 0 0 0 10px;
		border-radius: 8px;
		background: $cz-brand;
		color: $cz-surface;
	}

	.customize-save-button-wrapper.is-saved {
		padding-right: 8px;
		background: $cz-ground;
		color: $cz-muted;
	}

	// The check belongs to the finished state only; core's `saved` observable is
	// what decides (see `decorateSaveButton()`).
	.aureon-cz-save-icon {
		display: none;

		svg {
			display: block;
			width: 15px;
			height: 15px;
		}
	}

	.customize-save-button-wrapper.is-saved .aureon-cz-save-icon {
		display: block;
	}

	// The pill's shape and fill come from the wrapper, so the input itself is
	// transparent and inherits. `!important` is not decoration here: WordPress
	// styles `.wp-core-ui .button-primary` and `.button:disabled` with
	// `!important` of its own, and `#save` is disabled in exactly the saved state
	// — without it the pill renders grey-on-grey.
	#save {
		padding: 0;
		border: 0;
		background: transparent !important;
		font-size: 12px;
		font-weight: 600;
	}

	/**
	 * Core's scheduling gear, which shares the pill.
	 *
	 * No `display` here on purpose: core sets that inline as the changeset's
	 * status changes (hidden while there is nothing to schedule), and a rule of
	 * ours would either override that or need `!important` to be overridden by
	 * it. Only the look is ours.
	 */
	#publish-settings {
		width: 32px;
		padding: 0;
		border: 0 !important;
		border-radius: 0 8px 8px 0 !important;
		background: #b08412 !important;
		box-shadow: none !important;
		color: $cz-surface !important;
		line-height: 26px;

		&::before {
			font-size: 15px;
			line-height: 26px;
		}

		&:hover,
		&:focus {
			background: rgba(255, 255, 255, 0.28) !important;
		}
	}
}

/**
 * Footer bar — "Hide Controls" with an eye icon, and the device switcher with
 * the active device underlined.
 */
#customize-footer-actions.aureon-cz-footer {
	display: flex;
	align-items: center;
	// Core sizes this bar off the *viewport*, not the pane it sits in:
	// `.expanded .wp-full-overlay-footer` is `width: calc(18% - 1px)` with
	// `max-width: 599px`. Those only ever lined up with the sidebar by
	// coincidence at its default width, and stop lining up the moment the pane
	// is a fixed px width.
	// Switching to absolute makes `#customize-controls` (fixed, so a containing
	// block, and confirmed as this element's offsetParent) do the sizing, so the
	// bar tracks the pane at any width. `max-width` has to be released too, or
	// core's 599px cap silently clamps it back.
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	width: auto;
	max-width: none;
	height: 44px;
	padding: 0 12px;
	border-top: 1px solid $cz-border;
	background: $cz-surface;

	.collapse-sidebar {
		display: flex;
		align-items: center;
		gap: 8px;
		position: static;
		width: auto;
		height: auto;
		padding: 0;
		border: 0;
		background: transparent;
		box-shadow: none;
		color: $cz-ink;

		&:hover,
		&:focus {
			color: $cz-brand;
		}
	}

	.collapse-sidebar-arrow {
		display: flex;
		width: auto;
		height: auto;
		margin: 0;
		background: none;

		// Core's own arrow is dashicons `::before` content.
		&::before {
			content: none;
		}

		svg {
			display: block;
			width: 16px;
			height: 16px;
		}
	}

	.collapse-sidebar-label {
		font-size: 12px;
		font-weight: 600;
	}

	.devices-wrapper {
		flex: 0 0 auto;
		margin-left: auto;
	}

	.devices {
		display: flex;
		align-items: center;
		gap: 4px;
		border-radius: 6px;
	}

	.devices button {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 32px;
		padding: 0;
		border: 0;
		background: transparent;
		color: $cz-muted;

		&::before {
			content: none;
		}

		// Core renders `.devices__preview-label` as a visible 10px caption
		// (not the screen-reader-only text it used to be) — crammed next to
		// our 17px SVG in a 36px button it just reads as garbled text, so
		// it's removed entirely, leaving the icon to speak for itself like
		// every other icon-only control in this admin.
		.devices__preview-label {
			display: none;
		}

		svg {
			display: block;
			width: 17px;
			height: 17px;
			margin-top: 2px;
		}

		&:hover,
		&:focus {
			color: $cz-ink;
		}

		// Core marks the current device with `.active`; the gold fill is the
		// design's own indicator for it.
		&.active {
			background-color: #d4a017;
			border-radius: 6px;
			color: #fff;
		}
	}
}

// Core sets a hard-coded `min-width` on `.wp-full-overlay-footer .devices
// button` of its own; restated here at the design's own 36px so the buttons
// don't shrink narrower than the icon they carry.
.wp-full-overlay-footer .devices button {
	min-width: 36px;
}

/**
 * Collapsed pane ("Hide Controls"), which core sizes for its own sidebar.
 *
 * Core slides the pane out of view with a hard-coded `margin-left: -300px`
 * (`-18%` above 1667px wide, `-600px` above 3333px) — every one of them a
 * restatement of the width core gives the sidebar itself. This stylesheet gives
 * it a different width, so those values left a strip of the pane on screen with
 * the section chevrons still showing in it. Restated here to match.
 *
 * `margin`, not `transform`: the collapse button below is `position: fixed`, and
 * a transformed ancestor would become its containing block and drag it
 * off-screen along with the pane — the exact bug being fixed.
 */
.wp-full-overlay.collapsed > .wp-full-overlay-sidebar {
	margin-left: -320px;
}

/**
 * The collapsed state's way back in.
 *
 * Core's own answer is to leave the button pinned at the very edge of the
 * viewport with its label hidden, showing just the flipped arrow — but that
 * relies on the button sitting inside a bar it positions from the viewport, and
 * this design lays the footer bar out inside the pane instead, so collapsing
 * took the button off-screen with everything else and left no way back but the
 * keyboard. It becomes a floating pill here: still core's own button, its own
 * class and its own handler, just lifted out of the bar while collapsed. Its
 * label follows suit and reads "Show Controls" (see `labelPaneToggle()`).
 *
 * `!important` on four properties only: core sets each of them with
 * `!important` of its own on `.wp-core-ui .wp-full-overlay .collapse-sidebar`,
 * so nothing but a matching `!important` can reach them.
 */
// The id is in the selector because the bar's own `position: static` rule above
// carries one (1,2,0); without it this (0,4,0) loses and the button stays in the
// bar, which is exactly what takes it off-screen.
.wp-full-overlay.collapsed
#customize-footer-actions.aureon-cz-footer
.collapse-sidebar {
	position: fixed;
	bottom: 16px;
	left: 16px;
	gap: 7px;
	height: 36px;
	padding: 0 15px !important;
	border-radius: 999px !important;
	background-color: $cz-surface !important;
	box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18) !important;
	color: $cz-ink;

	&:hover,
	&:focus {
		color: $cz-brand;
	}
}

// Core hides the label whenever the pane is collapsed — the one state where
// this design needs it most, since the pill is all that's on screen.
.wp-full-overlay.collapsed
#customize-footer-actions.aureon-cz-footer
.collapse-sidebar-label {
	display: block;
}

/**
 * Notice icons, as URL-encoded SVG for `mask` rather than dashicons glyphs.
 *
 * The glyph route looked cheaper — `content: "\f321"` and the dashicons family,
 * no markup needed for a notice core creates at any moment — but the minifier
 * rewrites those escapes into the literal characters they stand for, the build
 * declares no `@charset` (an `@charset` of ours doesn't survive it either), and
 * the server sends `text/css` with no charset. The bytes were being decoded as
 * cp1252, so the clock rendered as "ïŒ¡". A mask is plain ASCII all the way
 * through and takes its colour from `background-color`, so each type still tints
 * itself.
 */
// $cz-icon-info now lives with the other tokens at the top of this file.
$cz-icon-warning: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E";
$cz-icon-error: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6'/%3E%3Cpath d='m9 9 6 6'/%3E%3C/svg%3E";
$cz-icon-restore: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E";

@mixin cz-notice-icon($icon) {
	// Both spellings: Safari still needs the prefix for `mask`.
	-webkit-mask: url($icon) center / 15px 15px no-repeat;
	mask: url($icon) center / 15px 15px no-repeat;
}

/**
 * The global notification area — the autosave prompt, a locked changeset, a
 * failed save.
 *
 * Core positions it at `top: 46px`, its own header height, and gives each notice
 * a full-bleed band with a 4px status border. It becomes a card here, inset to
 * match the lists below it, with the status colour carried by a round icon tile
 * instead of an edge. The icon is a dashicon (`content` + the dashicons family,
 * already loaded on this screen) rather than an injected SVG, because these
 * notices are created and destroyed by core at any time and CSS needs no hook to
 * catch a new one.
 *
 * Core measures this element's height and offsets the pane below it by that much
 * (`updateSidebarTop()`), reading the pane's own `top` first — so a taller card
 * here simply pushes the pane down, with nothing to keep in sync.
 */
#customize-controls #customize-notifications-area {
	// Core gives this `width: 100%` and leaves it `content-box`, so the padding
	// added below made it 24px wider than the pane and it spilled over the edge —
	// the same trap the two bars are already guarded against at the top of this
	// file.
	box-sizing: border-box;
	top: 56px;
	padding: 12px;
	border: 0;
	background: $cz-ground;

	.notice {
		display: flex;
		align-items: flex-start;
		gap: 10px;
		position: relative;
		// A pane that has widened for a section builder is no reason for one
		// sentence to run 1100px; the card keeps its own measure and stays where
		// the pane's own content starts.
		max-width: 560px;
		margin: 0;
		padding: 11px 12px;
		border: 0;
		border-radius: $cz-radius;
		background: $cz-surface;
		box-shadow: $cz-shadow;
		color: $cz-ink;
		font-size: 12px;
		line-height: 1.45;

		// The status tile. `flex: 0 0 auto` on a pseudo-element works the same as
		// on any other flex item, so no wrapper element is needed for it.
		// The status tile, and the glyph inside it: the tile is the `::before`
		// box, painted with the type's tint, and the icon is that box's own
		// `::after` masked to shape — `flex: 0 0 auto` on a pseudo-element works
		// like any other flex item, so neither needs a wrapper of its own.
		&::before {
			display: flex;
			align-items: center;
			justify-content: center;
			flex: 0 0 auto;
			width: 26px;
			height: 26px;
			border-radius: 999px;
			background: $cz-brand-tint;
			content: "";
		}

		&::after {
			position: absolute;
			top: 16px;
			left: 18px;
			width: 15px;
			height: 15px;
			background-color: $cz-brand;
			content: "";

			@include cz-notice-icon($cz-icon-info);
		}

		a {
			color: $cz-brand;
			font-weight: 600;
		}
	}

	// Core reserves `padding-right: 38px` on a dismissible notice for the button
	// it absolutely positions in that space. The button is a flex item here, so
	// the reservation is just an empty column at the card's end.
	.notice.is-dismissible {
		padding-right: 12px;
	}

	.notice + .notice {
		margin-top: 8px;
	}

	// Amber for a warning, red for an error — the same distinction core draws
	// with its left border, moved onto the tile.
	.notice-warning::before {
		background: #fdf3e3;
	}

	.notice-warning::after {
		background-color: #b26a00;

		@include cz-notice-icon($cz-icon-warning);
	}

	.notice-error::before {
		background: #fdeaea;
	}

	.notice-error::after {
		background-color: #c0392b;

		@include cz-notice-icon($cz-icon-error);
	}

	// The autosave prompt is the one notice with a specific enough meaning to
	// name: it offers to restore a version, so it gets the clock.
	.notice[data-code="autosave_available"]::after {

		@include cz-notice-icon($cz-icon-restore);
	}

	.notification-message {
		flex: 1 1 auto;
		min-width: 0;
	}

	// Core absolutely positions the dismiss button against the band's own top
	// right; the card's padding is smaller, so it's placed again here.
	.notice-dismiss {
		position: static;
		flex: 0 0 auto;
		width: 24px;
		height: 24px;
		padding: 0;
		color: $cz-subtle;

		&::before {
			width: 24px;
			height: 24px;
			padding: 0;
			font-size: 16px;
			line-height: 24px;
		}

		&:hover,
		&:focus {
			color: $cz-ink;
		}
	}

	// Core's own overlay notices (a changeset locked by another user) cover the
	// whole pane and carry their own layout; none of the card treatment applies.
	.notice.notification-overlay {
		display: block;
		padding: 25px;
		border-radius: 0;
		box-shadow: none;

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

// Every Typography tab (see Customizer::TYPOGRAPHY_SUBSECTIONS) is a real
// section, so navigating into one drills the Customizer's own breadcrumb
// ("Customizing ▸ Aureon ▸ Typography ▸ …" — see `bindSubsections()` in
// index.js), but none of them is a surface of its own: each is reached only
// via its own row inside Typography, so its accordion row in the Aureon
// panel's own list is hidden here. The sections themselves are untouched —
// still real, still focusable — only their rows in the list are gone.
// Same treatment for Performance's and Content Templates' own tabs (see
// Customizer::PERFORMANCE_SUBSECTIONS / TEMPLATES_SUBSECTIONS) —
// real sections, reached only via their hub's own row.
//
// WooCommerce's four views (WOOCOMMERCE_VIEW_SUBSECTIONS) are deliberately
// NOT in this list any more: when WooCommerce's own panel exists,
// Customizer::register_sections() skips the "WooCommerce" hub row entirely
// and registers those four directly inside that panel instead, so they show
// as real top-level rows — merged flat next to core's own Store Notice /
// Product Catalog / Product Images / Checkout rows rather than nested one
// level deeper behind a same-named hub. Only their own further tabs (one
// level deeper still) stay hidden here, reached via each view's own row.
// Shop's own two tabs (General/Product Card) aren't in this list at all —
// they're not real sections any more, just an inline segmented toggle inside
// Shop's own row (see `ShopSection`).
#accordion-section-aureon_font_pairings,
#accordion-section-aureon_typography_headings,
#accordion-section-aureon_typography_body,
#accordion-section-aureon_typography_links,
#accordion-section-aureon_typography_buttons,
#accordion-section-aureon_typography_misc,
#accordion-section-aureon_performance_caching,
#accordion-section-aureon_performance_uploads,
#accordion-section-aureon_templates_archive,
#accordion-section-aureon_templates_post,
#accordion-section-aureon_templates_page,
#accordion-section-aureon_templates_search,
#accordion-section-aureon_woocommerce_product_summary,
#accordion-section-aureon_woocommerce_product_layout,
#accordion-section-aureon_woocommerce_product_cart_button,
#accordion-section-aureon_woocommerce_product_related,
#accordion-section-aureon_woocommerce_checkout_layout,
#accordion-section-aureon_woocommerce_checkout_form {
	display: none !important;
}

// While a subsection (Font Pairings) is open, its parent (Typography) is
// given the panel list's own resting spot instead of core's default —
// `bindSubsections()` in index.js toggles this class on and off as the
// subsection expands and collapses. Specificity (one id, one class) beats
// core's own `#customize-theme-controls .customize-pane-child` (one id, one
// class) because `:not(.open)` counts as a second class, so no `!important`
// is needed — and `:not(.open)` is what keeps this from fighting core's own
// `.open { transform: none }` on the way back.
#customize-theme-controls .customize-pane-child.aureon-cz-recede:not(.open) {
	transform: translateX(-100%);
}

/**
 * The "Discard changes" confirmation — `confirmDialog()` in index.js builds
 * this in place of the browser's own `confirm()`, so it reads as part of
 * this tray's own chrome rather than a native interruption. Appended to
 * `document.body` (outside `#customize-controls` entirely) so one `z-index`
 * clears every layer of the customizer at once — the sidebar, its header/
 * footer bars, and the preview `<iframe>` beside it — rather than needing to
 * out-rank each individually.
 */
.aureon-cz-confirm-overlay {
	position: fixed;
	inset: 0;
	z-index: 600000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 42, 0.45);
}

.aureon-cz-confirm {
	box-sizing: border-box;
	width: 100%;
	max-width: 340px;
	padding: 20px;
	border-radius: $cz-radius;
	background: $cz-surface;
	box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
}

.aureon-cz-confirm-title {
	margin: 0 0 6px;
	color: $cz-ink;
	font-size: 14px;
	font-weight: 700;
}

.aureon-cz-confirm-desc {
	margin: 0 0 18px;
	color: $cz-muted;
	font-size: 12px;
	line-height: 1.5;
}

.aureon-cz-confirm-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.aureon-cz-confirm-cancel,
.aureon-cz-confirm-danger {
	height: 34px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

.aureon-cz-confirm-cancel {
	background: $cz-ground;
	border-color: $cz-border;
	color: $cz-ink;

	&:hover,
	&:focus {
		background: $cz-border;
	}
}

.aureon-cz-confirm-danger {
	background: $cz-danger;
	color: $cz-surface;

	&:hover,
	&:focus {
		background: #a33025; // $cz-danger, ~8% darker.
	}
}

// Header Image: core's own control stays in the page, because its JS runs the
// crop step and the uploaded-images list that the Aureon card drives (see
// `override_header_image()` and `HeaderImageSection`) — it just isn't shown.
#customize-control-header_image {
	display: none !important;
}

// While the Themes browser is open core slides the Publish button up by 46px, the
// height of its own header bar, which hides it. This header is taller, so the
// same offset left the button half cut off at the top. It stays in place.
.in-themes-panel #customize-header-actions.aureon-cz-header #customize-save-button-wrapper {
	margin-top: 0;
}
