/*
 * refresh/css/reink-look.css (ReInk)
 *
 * ReInk's own adjustments to the redesign's look, for the real page. Loaded after the redesign's
 * stylesheets, so the copies in refresh/css stay exactly as the prototype has them.
 */

/* The top bar shows the site family's own logo (moved there from the side panel by js/page.js),
   not the prototype's Sterling SVG: keep its proportions instead of forcing Sterling's 113 x 34. */
header#smTopBar a.sterlingLogo > img {
	width: auto;
	max-width: 200px;
	height: 34px;
	object-fit: contain;
}

/*
 * Real corners under the painted ones.
 *
 * facelift.css keeps every control's click area square (MUI's 2px radius), so it never rounds a
 * control with border-radius. It paints the rounded corners instead: a 9-slice border-image whose
 * white corner pieces cover the square corners of the fill underneath. At 100% that is exact. At
 * the display scalings Windows laptops use (125%, 150%, 175%) the fill and the corner pieces land
 * on the pixel grid differently, and the fill's square edge shows round the rounded shape as a pink
 * hairline on a red button, a grey one on a hover tile.
 *
 * So each of those controls also gets a real border-radius, the same as its painted corners: the
 * fill itself is cut to the rounded shape, and there is nothing left to show. The images stay, so
 * the rings they draw (keyboard focus, pushed, the outlined buttons' edge) are untouched.
 * The redesign already does this for the top bar's Add to Cart (workspace.css).
 *
 * The cost: the corners' few square pixels outside the curve stop taking clicks, which the
 * facelift's square-click-area rule existed to avoid. Fine for a button with 8px corners.
 */
.mui-btn--primary,
.mui-btn--accent,
.modalEl .previewResultLinks button.mui-btn,
#previewDiv .previewAddToCartButton,
aside input[type="image"][onclick^="deleteObject"],
#borderSwitchInputLbl,
#pageSelectButtonContainer > label,
#saveBar ul li button {
	border-radius: 8px;
}
/* The icon tools: a 40px tile with 8px corners inside a transparent 5px border (the fill stops at the
   padding box), so 13px outside gives the tile its 8px */
aside input[type="image"].iconButtonBig,
aside label.iconButton.iconButtonBig {
	border-radius: 13px;
}
/* 6px painted corners: the simple designer's line-clear button, and the save bar with the panel closed */
#textBoxes .btn_x,
body.sm-panel-collapsed #saveBar ul li button {
	border-radius: 6px;
}

/*
 * The side panel and its scrollbar.
 *
 * The side panel scrolls when a tab is taller than the window (site.app.css: aside { overflow: auto }), and
 * site.app.css sizes what is in it in fixed pixels: the tabs 400px, the 60px rail and a 340px pane. Windows'
 * scrollbars take 15 to 17px of that width, so once the Text tab outgrew the window (it does with Curve on)
 * the pane's right edge went under the scrollbar and a sideways scrollbar appeared.
 *
 * So the scrollbar's room is kept aside whether or not it is needed, and nothing jumps when a section opens
 * and the tab grows past the window; and the tabs fill what is left of the panel instead of a fixed 400px,
 * the pane beside the rail the way panel-collapse.css already does on a phone. Where scrollbars take no
 * room (macOS, phones) the gutter is nothing and the pane is still 340px. The closed panel keeps
 * panel-collapse.css's own fixed widths (its sm-panel-clip rules are more specific).
 */
/*
 * B / I / U and the three alignments: six 50px tools on one row. site.app.css spaces them with a 5px gap and
 * lets the row wrap, which needs exactly 325px: the pane's whole width beside a Windows scrollbar, so a
 * fraction of a pixel sent the last one to a line of its own. Each tool already has 5px of clear border round
 * its tile, so the gap goes and space-around shares out what room there is.
 */
#fontBX .flexBoxCenterAlign,
#fontBX-curve .flexBoxCenterAlign {
	flex-wrap: nowrap;
	gap: 0;
}

@media not all and (max-width: 700px) {
	aside {
		scrollbar-gutter: stable;
	}
	.ui-tabs-vertical {
		width: auto;
	}
	.ui-tabs-vertical .ui-tabs-panel {
		width: calc(100% - var(--sm-rail-w, 60px));
	}
}

/*
 * The zoom bar's Scale group, and the warning that the selected object is scaled.
 *
 * SMPdesigner.js (updateScaleControls) shades the whole group rgb(255 243 205), inline, whenever the selected
 * object is not at 100%, and titles it "This object is scaled" (data-scaled). In the redesign's glass pill that
 * read as a flat yellow block. Here the group sits in the pill like the page chips do, its fields rounded like the
 * side panel's, and the warning is an amber chip: the redesign's warning ink (premium.css, 6.5:1) on an amber tint,
 * with a dot, and its 100% button standing out as the way back. The engine's colour is overridden, not removed:
 * the state still comes from the engine, through the title it sets (or its inline colour).
 */
/* Not in production (decision 0021): out of sight unless Designer.cfm says to show it (data-scale-shown, its
   showObjectScale), so it stays hidden on a Designer.cfm that predates the setting too. The engine still fills it. */
#floatingMenu #objectScaleGroup:not([data-scale-shown]) {
	display: none !important;
}
/* ...and the room Designer.cfm makes for it in the bar (wrapping upwards, narrower on a phone) is not made: one row,
   as in the prototype. Its own rule is in the page, after this stylesheet; the :has() outweighs it. */
#floatingMenu:not(:has(#objectScaleGroup[data-scale-shown])) {
	flex-wrap: nowrap;
	max-width: none;
}
#floatingMenu #objectScaleGroup {
	gap: 4px;
	min-height: 28px;
	margin-left: 6px;
	padding: 2px 4px 2px 10px;
	box-sizing: border-box;
	border-radius: 15px;
	background-color: transparent;
	color: var(--sp-ink-3, rgb(76 82 94));
	font: 13px/1 Arial, Helvetica, sans-serif;
	transition: background-color 120ms ease, box-shadow 120ms ease;
}
#floatingMenu #objectScaleGroup label {
	margin: 0;
	color: inherit;
	cursor: default;
}
#floatingMenu #objectScaleGroup input[type="number"] {
	box-sizing: border-box;
	height: 22px;
	margin: 0;
	padding: 0 6px;
	border: 1px solid var(--sp-field, rgb(128 135 148));
	border-radius: 6px;
	background-color: rgb(255 255 255);
	color: var(--sp-ink-2, rgb(24 26 31));
	font: inherit;
}
#floatingMenu #objectScaleGroup input[type="number"]:hover:not(:disabled) {
	border-color: var(--sm-border-strong, rgb(84 87 92));
}
#floatingMenu #objectScaleGroup input[type="number"]:focus {
	border-color: var(--sm-red, rgb(234 0 41));
	outline: 1px solid var(--sm-red, rgb(234 0 41));
	outline-offset: -2px;
}
#floatingMenu #objectScaleGroup input[type="number"]:disabled {
	border-color: var(--sp-line, rgb(218 220 224));
	color: var(--sp-ink-4, rgb(100 107 120));
}
#floatingMenu #objectScaleGroup input[type="checkbox"] {
	width: 14px;
	height: 14px;
	margin: 0 0 0 4px;
	accent-color: var(--sm-red, rgb(234 0 41));
}
#floatingMenu #objectScaleGroup .material-icons {
	color: inherit;
	vertical-align: middle;
}
/* 100%: a small quiet pill button */
#floatingMenu #objectScaleGroup #objectScaleReset {
	height: 22px;
	min-width: 0;
	margin: 0 0 0 2px;
	padding: 0 9px;
	border-radius: 11px;
	border-image: none;
	background-color: transparent;
	box-shadow: none;
	color: var(--sp-ink-3, rgb(76 82 94));
	font: 600 12px/22px Arial, Helvetica, sans-serif;
	text-transform: none;
}
#floatingMenu #objectScaleGroup #objectScaleReset:hover:not(:disabled) {
	background-color: rgb(4 0 0 / 0.06);
}
#floatingMenu #objectScaleGroup #objectScaleReset:focus-visible {
	outline: 2px solid var(--sm-focus, rgb(4 0 0));
	outline-offset: 1px;
}
#floatingMenu #objectScaleGroup #objectScaleReset:disabled {
	color: var(--sp-ink-4, rgb(100 107 120));
	opacity: 0.6;
	cursor: default;
}

/* Scaled: the amber chip */
#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"]) {
	background-color: rgb(255 244 214) !important;   /* over the engine's inline rgb(255 243 205) */
	box-shadow: inset 0 0 0 1px rgb(236 190 100);
	color: var(--sm-warning, rgb(138 80 0));
}
#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"])::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	margin-right: 2px;
	border-radius: 50%;
	background-color: rgb(214 138 0);
}
#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"]) input[type="number"] {
	border-color: rgb(214 160 64);
}
#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"]) #objectScaleReset:not(:disabled) {
	background-color: rgb(255 255 255);
	box-shadow: inset 0 0 0 1px rgb(214 160 64);
	color: var(--sm-warning, rgb(138 80 0));
}
#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"]) #objectScaleReset:not(:disabled):hover {
	background-color: rgb(255 250 236);
}

@media (prefers-reduced-motion: reduce) {
	#floatingMenu #objectScaleGroup {
		transition: none;
	}
}
@media (forced-colors: active) {
	#floatingMenu #objectScaleGroup:is([title]:not([title=""]), [style*="background-color"]) {
		outline: 1px solid Highlight;
	}
}

/*
 * The simple designer's lines: a box and its clear (X) button on one row. site.app.css gives the box a fixed 278px;
 * with the list's 30px indent and the 20px button that is 328px, which fit the old 340px pane but not the 325px it
 * has beside a Windows scrollbar (above), so every X dropped below its box. The box keeps its 278px where they fit
 * and gives up the difference where they do not.
 */
#textBoxes .simpleTextBox {
	width: min(278px, calc(100% - 28px));
	box-sizing: border-box;
}

/*
 * The font row: the font list, the size box and its unit on one line. The size box is a fixed 65px (inline in
 * Designer.cfm) holding its spin buttons, and the curve's box a suggestions arrow as well, so a size such as
 * 64.5 was cut off; and the list would not shrink below its longest font name, which pushed the "pt" after the
 * box off the end of the row. The list now gives way, the box is wide enough, and the unit (a span in
 * Designer.cfm) is a quiet label. The simple designer of a page with one mode has no size box (its input is
 * hidden), so no unit either; where Simple and Advanced share the page (decision 0010) the box shows the size
 * Best Fit chose, read-only, with its unit.
 */
#fontBX > div:first-child,
#fontBX-curve > div:first-child {
	align-items: center;
	gap: 6px;
}
#fontDropDown,
#fontDropDown-curve {
	flex: 1 1 auto;
	min-width: 0;
}
#textSize,
#textSize-curve {
	flex: none;
	width: 80px !important;   /* over Designer.cfm's inline 65px */
}
.textSizeUnit {
	flex: none;
	font-size: 12px;
	color: var(--sp-ink-3, rgb(76 82 94));
}
#textSize[type="hidden"] + .textSizeUnit {
	display: none;
}

/* No Tools tab (page.js step 8): in the compact layout (a phone held sideways) workspace.css hides the frame's chips,
   and the Tools tab used to stand in for them. Now the Snap chip and the Guides / Finished switch stay there too, above
   the design, just right of the unit switch (above its top-left), running to the right: a design that small can be
   narrower than the chips. (Five classes: over workspace.css's rule.) */
html.sm-ws main.sm-ws-compact #smDesignFrame > .smChips.smChips.smChips {
	display: flex;
	top: -32px;
	bottom: auto;
	left: 48px;
	right: auto;
}
html.sm-ws main.sm-ws-compact #smDesignFrame.sm-finished > .smChips.smChips.smChips {
	top: calc(var(--sm-bleed-top, 0px) - 32px);
	left: calc(var(--sm-bleed-left, 0px) + 48px);
}
/* Border, moved to the Shapes tab under the shape buttons */
#shapesMenu .reinkBorderRow {
	margin: 4px 0 10px;
}
