/*
 * refresh/css/curve-panel.css (ReInk)
 *
 * The curve controls, grouped (refresh/js/curve-panel.js): the words, the three everyday settings,
 * then folded sections for placement, fit, more curves and separators. It uses the redesign's
 * tokens (premium.css, facelift.css), with the same colours written out in case either is missing.
 * Loads after text-curve.css.
 */

/* Hidden because this page's engine does not wire it (the CDN's engine today) */
.reinkCurveOff {
	display: none !important;
}

/* Words a screen reader still reads */
.reinkCurveSr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ===== The words ===== */
.reinkCurveHost > .reinkCurveWords {
	margin-bottom: 6px;
}
.reinkCurveHost > .reinkCurveWords input {
	width: 100%;
	box-sizing: border-box;
}
/* What the fit rule is doing ("Letters condensed to 86%"), right under the words it is about */
.reinkCurveStatus {
	margin: -2px 0 8px;
	font-size: 12px;
	line-height: 1.35;
	color: var(--sp-ink-3, rgb(76 82 94));
}
.reinkCurveStatus:empty {
	display: none;
}
/* ... in red when the words do not fit (the engine marks the box .fieldTextOverflow) */
.reinkCurveWords:has(.fieldTextOverflow) + .reinkCurveStatus {
	color: var(--sp-red-text, rgb(207 0 36));
}
/* The Curved Text tab: Add Curved Text and Delete side by side */
.reinkCurveAddRow {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 10px;
}
.reinkCurveAddRow > .mui-btn {
	flex: 1 1 auto;
	margin: 0;
}

/* ===== Rows: a small label over the row's controls ===== */
.reinkCurveField {
	margin: 0 0 12px;
}
.reinkCurveLabel {
	display: block;
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--sp-ink-3, rgb(76 82 94));
}
/* The slider rows' own flex line: slider, number box, unit, Reset */
.reinkCurveField > div[style*="flex"] {
	align-items: center;
	gap: 8px;
}
.reinkCurveField input[type="range"] {
	min-width: 0;
}
.reinkCurveField .curveUnitLabel {
	font-size: 12px;
	color: var(--sp-ink-4, rgb(100 107 120));
}
.reinkCurveEssentials {
	margin: 12px 0 4px;
}
.reinkCurveDirection {
	margin-bottom: 14px;
}
.reinkCurveDirection #curveSwitchInputLbl {
	margin: 0;
}

/* Inline groups: "Centre X [ ] Centre Y [ ] in", "Gap [ ] in", "inside [ ] [Apply]" */
.reinkCurveInline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
}
/* site.app.css gives .specInputLabel a 50px width, which breaks "Centre X" over two lines */
.reinkCurveInline .specInputLabel {
	width: auto;
	margin: 0;
	padding: 0;
	white-space: nowrap;
}
.reinkCurveInline .mui-btn {
	margin: 0;
}
/* Centre X [ ] Centre Y [ ] in: one line at any panel width */
.reinkCurveCentre > .reinkCurveInline {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto;
	margin-bottom: 8px;
}
.reinkCurveCentre > .reinkCurveInline > input {
	width: 100% !important;   /* over Designer.cfm's inline 70px, so the two boxes share the line */
	min-width: 0;
	box-sizing: border-box;
}
.reinkCurveCentre #curveCentreOnStamp {
	margin: 0;
}
.reinkCurvePut .reinkCurveInline select {
	flex: 1 1 0;
	min-width: 0;
}
/* Inside, Outside, Opposite: three equal buttons */
.reinkCurveButtons {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
	margin: 0 0 8px;
}
.reinkCurveButtons > .mui-btn {
	margin: 0;
	padding: 0 6px;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* Keep the text between two angles: From / To, then the arc, under the tick box */
.reinkCurveStops > label {
	margin-left: 4px;
}
.reinkCurveStops #curveStopsBox {
	margin: 8px 0 0 24px;
}
.reinkCurveStop {
	display: inline-flex;
	margin: 0 10px 6px 0;
}
.reinkCurveFit select {
	width: 100%;
	box-sizing: border-box;
}

/* ===== Buttons: outlined, as the redesign's secondaries (premium.css 2.4) ===== */
.mui-btn--primary.reinkCurveQuiet,
.mui-btn--primary.reinkCurveQuiet:focus {
	background-color: var(--sp-surface, rgb(255 255 255));
	color: var(--sp-ink-2, rgb(24 26 31));
	border-image: var(--sp-bi-line-gap) 8 / 8px / 0 stretch;
}
.mui-btn--primary.reinkCurveQuiet:hover {
	background-color: var(--sp-fill-hover, rgb(241 242 245));
	color: var(--sp-ink, rgb(4 0 0));
	border-image: var(--sp-bi-line-gap-hover) 8 / 8px / 0 stretch;
}
.mui-btn--primary.reinkCurveQuiet:active {
	background-color: var(--sp-fill-press, rgb(229 231 235));
}
.mui-btn--primary.reinkCurveQuiet:focus-visible {
	outline: none;
	border-image: var(--sp-bi-line-gap-focus) 8 / 8px / 0 stretch;
}
.mui-btn--primary.reinkCurveQuiet .mui-ripple {
	background-color: rgb(4 0 0 / 0.16);
}
.mui-btn--primary.reinkCurveQuiet:disabled {
	background-color: var(--sp-surface, rgb(255 255 255));
	color: var(--sp-ink-4, rgb(100 107 120));
}
/* Reset: a small square icon button at the end of its slider */
.mui-btn.reinkCurveReset {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 34px;
	min-width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	line-height: 1;
}
.reinkCurveIcon {
	display: inline-flex;
}

/* ===== The gate: "Click here for advanced curve tools" =====
   A quiet row with a chevron, as the sections behind it have: one red button per panel stays the rule. Only
   Sterling's own network gets it, on the stripes below. */
.reinkCurveToolsToggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	min-height: 40px;
	margin: 4px 0 0;
	padding: 0 2px;
	border: 0;
	border-top: 1px solid var(--sp-hairline, rgb(231 233 237));
	background: none;
	color: var(--main-color, rgb(1 104 176));
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}
.reinkCurveToolsText {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}
.reinkCurveToolsText::before {
	content: "";
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	margin: 0 4px 0 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform var(--sp-ease, 150ms ease);
}
.reinkCurveToolsToggle[aria-expanded="true"] .reinkCurveToolsText::before {
	transform: rotate(45deg) translate(-2px, -1px);
}
.reinkCurveToolsToggle:hover .reinkCurveToolsText {
	text-decoration: underline;
}
.reinkCurveToolsToggle:focus {
	outline: none;
}
.reinkCurveToolsToggle:focus-visible {
	outline: 2px solid var(--sm-focus, rgb(4 0 0));
	outline-offset: -2px;
	border-radius: 6px;
}
.reinkCurveToolsToggle[aria-expanded="true"] + .reinkCurveSections {
	margin-top: 0;
}

/* Sterling's own: the red and white stripes the site shows its staff-only parts on (newsite.css's .sterlingOnly,
   #ff6969 and white at 45 degrees), drawn here at the gate's size (12 px stripes, not the site's 40 px, on a bar
   44 px high) and with the words on white, so they read. Two classes, so the site's own .sterlingOnly (an
   inline-block padded 20 px) does not reshape the gate. */
.reinkCurveToolsToggle.sterlingOnly {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	min-height: 44px;
	margin: 8px 0 0;
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background-color: rgb(255 255 255);
	background-image: linear-gradient(45deg, rgb(255 105 105) 25%, rgb(255 255 255) 25% 50%, rgb(255 105 105) 50% 75%, rgb(255 255 255) 75%);
	background-size: 33.94px 33.94px;
	box-shadow: inset 0 0 0 1px rgb(4 0 0 / 0.08);
}
.reinkCurveToolsToggle.sterlingOnly .reinkCurveToolsText {
	flex: 1 1 auto;
}
.reinkCurveToolsToggle.sterlingOnly .reinkCurveToolsText,
.reinkCurveToolsTag {
	padding: 6px 10px;
	border-radius: 6px;
	background: rgb(255 255 255);
	box-shadow: 0 0 0 1px rgb(4 0 0 / 0.08);
}
/* "Sterling only": for a screen reader and a screenshot, as the stripes are for the eye */
.reinkCurveToolsTag {
	flex: 0 0 auto;
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	color: rgb(176 0 31);
}
.reinkCurveToolsToggle.sterlingOnly:focus-visible {
	outline-offset: 2px;
	border-radius: 8px;
}
.reinkCurveToolsToggle.sterlingOnly[aria-expanded="true"] + .reinkCurveSections {
	margin-top: 8px;
}

/* Opened: the tools behind the gate, with the bar down their side (it was down the whole curve panel) */
.reinkCurvePanel > .reinkCurveSections {
	padding: 8px 0 4px 12px;
	border-left: 3px solid var(--main-color, rgb(1 104 176));
}
.reinkCurvePanel > .reinkCurveSections > .reinkCurveEssentials {
	margin-top: 0;
}
/* The radius as a number, its slider out of sight: the box and its unit together, Reset at the end */
.reinkCurvePanel .reinkCurveRadius > div[style*="flex"] {
	justify-content: flex-start !important; /* over Designer.cfm's inline space-between, made for the slider */
}
.reinkCurvePanel .reinkCurveRadius .reinkCurveReset {
	margin-left: auto;
}

/* ===== The folded sections ===== */
.reinkCurveSections {
	margin: 4px 0 8px;
	border-bottom: 1px solid var(--sp-hairline, rgb(231 233 237));
}
.reinkCurveSections > #curveGeometry {
	margin: 0;
}
.reinkCurveSection {
	border-top: 1px solid var(--sp-hairline, rgb(231 233 237));
}
.reinkCurveSummary {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 2px;
	box-sizing: border-box;
	list-style: none;
	cursor: pointer;
	user-select: none;
	color: var(--sp-ink-2, rgb(24 26 31));
	font-weight: 600;
}
.reinkCurveSummary::-webkit-details-marker {
	display: none;
}
.reinkCurveSummary::marker {
	content: "";
}
/* The chevron: right when folded, down when open */
.reinkCurveSummary::before {
	content: "";
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	margin: 0 4px 0 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform var(--sp-ease, 150ms ease);
}
.reinkCurveSection[open] > .reinkCurveSummary::before {
	transform: rotate(45deg) translate(-2px, -1px);
}
.reinkCurveSummary:hover {
	color: var(--sp-ink, rgb(4 0 0));
}
.reinkCurveSummary:focus {
	outline: none;
}
.reinkCurveSummary:focus-visible {
	outline: 2px solid var(--sm-focus, rgb(4 0 0));
	outline-offset: -2px;
	border-radius: 6px;
}
.reinkCurveSummaryTitle {
	flex: 0 0 auto;
}
/* What the section is set to, at the right: "0°", "Condense it to fit", "None" */
.reinkCurveSummaryValue {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-align: right;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12px;
	font-weight: 400;
	color: var(--sp-ink-4, rgb(100 107 120));
}
.reinkCurveSectionBody {
	padding: 4px 0 6px 18px;
}
.reinkCurveSectionBody > .reinkCurveField:last-child {
	margin-bottom: 8px;
}
/* Separators: the rows from Designer.cfm, a little more air */
.reinkCurveSectionBody > #curveSeparators .curveSeparatorRow {
	margin: 0 0 8px;
}
.reinkCurveSectionBody > #curveSeparators .mui-btn {
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	.reinkCurveSummary::before,
	.reinkCurveToolsText::before {
		transition: none;
	}
}
@media (forced-colors: active) {
	.mui-btn--primary.reinkCurveQuiet {
		border: 1px solid ButtonBorder;
	}
	.reinkCurveSummary:focus-visible,
	.reinkCurveToolsToggle:focus-visible {
		outline-color: Highlight;
	}
	.reinkCurveToolsToggle {
		color: LinkText;
	}
	/* no stripes where the system sets the colours: a dashed edge says "not for everyone" instead */
	.reinkCurveToolsToggle.sterlingOnly {
		background-image: none;
		border: 2px dashed CanvasText;
	}
}
