/**
 * LikeInk Designer — application layer
 *
 * Built on the tokens and component classes in design-system.css. This file
 * only lays out the editor: nav, sidebar, stage, rulers, toolbar, overlays.
 *
 * Everything is scoped under .likeink-designer-app. There is deliberately no
 * global reset and no bare element selector here — the previous version of
 * this file styled `*`, `body` and `header h1` and leaked into the theme.
 */

.likeink-designer-app {
	height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;

	/* Read by scaleCanvas() so the ruler gutter is defined in exactly one
	   place. It used to be a hardcoded `30 + 5` in the JS. */
	--ruler-size: 34px;
	--ruler-gap: 5px;

	/* The rail the ticks stand on and the ticks themselves are one mark, so
	   they share a weight and a colour. Anything thinner is lost in the
	   stage's 10px graph paper — but a mark this thick reads as a hard black
	   line at full strength, so the ink is a grey from the neutral ramp, not
	   a tint of --color-text. */
	--ruler-mark: 2px;
	--ruler-ink: var( --color-neutral-500 );

	/* Vertical room reserved for the floating toolbar; see .designer-stage-scroll. */
	--toolbar-clearance: 76px;

	/* Which layout is live. Read back by isMobileLayout() in designer.js: a
	   custom property cannot be used inside a media query, so this is how the
	   breakpoint stays defined once, in CSS, instead of being duplicated as a
	   matchMedia string in the view layer. */
	--layout: desktop;

	/* Bottom drawer, mobile only. The peek is the always-visible tool-switch
	   row — it is what opens the drawer, so no second control is needed. */
	--drawer-peek: 64px;
	--drawer-max: min( 55dvh, 480px );
}

/* The view layer toggles visibility with the `hidden` attribute; this makes it
   win against the display rules below, so there is one mechanism, not two. */
.likeink-designer-app [hidden] { display: none !important; }

/* ── nav ──────────────────────────────────────────────────────────────── */

.likeink-designer-app .designer-nav {
	flex: 0 0 auto;
	flex-wrap: wrap;
	row-gap: var( --space-2 );
	background: var( --color-bg );
	z-index: 60;

	/* The containing block the mobile order bar anchors to (top: 100%), so it
	   sits exactly below the nav's real rendered height without that height
	   being a literal anywhere. No effect on its own layout. */
	position: relative;
}

.likeink-designer-app .designer-logo-link { display: inline-flex; align-items: center; }
.likeink-designer-app .designer-logo { height: 20px; width: auto; }

/* Same hover/focus/active treatment as .designer-order-bar-close (see the
   "theme paints every bare control" trap): each state restates what the
   control already looks like, at a weight Flatsome's own rules cannot tie. */
.likeink-designer-app .designer-back-link {
	display: inline-flex;
	align-items: center;
	gap: var( --space-1 );
	font-size: 13px;
	color: var( --color-text );
	text-decoration: none;
}
.likeink-designer-app .designer-back-link svg { flex: none; }
/* The short wording is for narrow phones only; see the max-width: 480px block. */
.likeink-designer-app .designer-back-short { display: none; }
/* The underline belongs to the text, not the arrow, so it is scoped to the
   span rather than the whole link. */
.likeink-designer-app .designer-back-link:is( :hover, :focus ) {
	color: var( --color-text );
}
.likeink-designer-app .designer-back-link:is( :hover, :focus ) span {
	text-decoration: underline;
}

.likeink-designer-app .designer-nav-tags { display: flex; gap: var( --space-2 ); }

/* The phone-only shortcut to the order bar. On desktop the real Add to
   cart is already in this row, two inches from the stepper. */
.likeink-designer-app .designer-nav-cart { display: none; }

/* The order bar and its backdrop are phone-only; on desktop the controls
   #designer-order would otherwise hold never leave .designer-nav-actions,
   so there is nothing here to show. */
.likeink-designer-app .designer-order-bar,
.likeink-designer-app .designer-order-backdrop { display: none; }

.likeink-designer-app .designer-nav-actions {
	margin-left: auto;
	display: flex;
	gap: var( --space-3 );
	align-items: center;

	/* One row on desktop, as designed. The price block is the only flexible
	   part, so it is the one allowed to shrink. */
	flex-wrap: nowrap;
}

.likeink-designer-app .designer-nav-actions > .btn,
.likeink-designer-app .designer-qty {
	flex: 0 0 auto;
}

.likeink-designer-app .designer-qty {
	display: flex;
	align-items: center;
	gap: var( --space-2 );
	font-size: 12px;
}

/* Stepper: the two buttons and the field share one border, so the three read
   as a single control the way the quantity on a product page does. */
.likeink-designer-app .designer-qty-stepper {
	display: flex;
	align-items: stretch;
	background: #fff;
	border: 1px solid var( --color-divider );
	border-radius: var( --radius-md );
	overflow: hidden;
}

.likeink-designer-app .designer-qty-stepper:hover { border-color: color-mix( in srgb, var( --color-text ) 45%, transparent ); }
.likeink-designer-app .designer-qty-stepper:focus-within { border-color: var( --color-accent ); }

.likeink-designer-app .designer-qty-step {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	padding: 0;
	cursor: pointer;
	color: var( --color-text );
	background: transparent;
	border: 0;
}

.likeink-designer-app .designer-qty-step svg { display: block; }
.likeink-designer-app .designer-qty-step:is( :hover, :focus ):not( :disabled ) { background: color-mix( in srgb, var( --color-text ) 7%, transparent ); }
.likeink-designer-app .designer-qty-step:active:not( :disabled ) { background: color-mix( in srgb, var( --color-text ) 14%, transparent ); }
.likeink-designer-app .designer-qty-step:disabled { opacity: 0.35; cursor: not-allowed; }

/* The field carries the group's border, not its own, and drops the native
   spinner: it duplicates the buttons and eats the width they need. */
.likeink-designer-app .designer-qty .input {
	width: 44px;
	min-height: 34px;
	padding-inline: 0;
	text-align: center;
	border: 0;
	border-radius: 0;
	-moz-appearance: textfield;
	appearance: textfield;
}

.likeink-designer-app .designer-qty .input:hover,
.likeink-designer-app .designer-qty .input:focus-visible {
	border-color: transparent;
	outline: none;
}

.likeink-designer-app .designer-qty .input::-webkit-outer-spin-button,
.likeink-designer-app .designer-qty .input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* The live per-sheet price rendered by the likeink-sheet-pricing calculator. */
.likeink-designer-app .likeink-sheet-pricing__calculator {
	font-size: 12px;
	line-height: 1.3;
	flex: 0 1 auto;
	min-width: 0;
}

/* Tags duplicated below the nav on narrow screens, hidden on desktop. */
.likeink-designer-app .designer-nav-tags-mobile { display: none; }

/* ── main row ─────────────────────────────────────────────────────────── */

.likeink-designer-app .designer-main {
	flex: 1;
	display: flex;
	flex-direction: row;
	overflow: hidden;
	min-height: 0;
}

/* ── sidebar ──────────────────────────────────────────────────────────── */

.likeink-designer-app .designer-sidebar {
	width: 320px;
	flex: 0 0 320px;
	position: relative;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var( --color-divider );
	background: var( --color-bg );
	overflow: visible;
	transition: width 0.18s ease, flex-basis 0.18s ease;
}

.likeink-designer-app .designer-sidebar.is-collapsed {
	width: 0;
	flex-basis: 0;
	border-right: none;
}

.likeink-designer-app .designer-sidebar-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

.likeink-designer-app .designer-sidebar.is-collapsed .designer-sidebar-body { display: none; }

/* The chevron flap that hangs off the sidebar's outer edge. */
.likeink-designer-app .designer-sidebar-flap {
	position: absolute;
	top: 50%;
	right: -28px;
	transform: translateY( -50% );
	width: 28px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var( --color-bg );
	border: 1px solid var( --color-divider );
	border-left: none;
	border-radius: 0 6px 6px 0;
	cursor: pointer;
	z-index: 10;
	padding: 0;
	color: var( --color-text );

	/* Belt and braces alongside the reset in design-system.css: this button's
	   width must never be clamped against its containing block, which is 0px
	   wide whenever the sidebar is collapsed — exactly when the flap is the
	   only way to get the sidebar back. */
	max-width: none;
	flex: none;
}

.likeink-designer-app .designer-sidebar-flap:is( :hover, :focus, :active ) {
	background: var( --color-bg );
	color: var( --color-text );
}

.likeink-designer-app .designer-sidebar-flap svg {
	transition: transform 0.18s ease;
	transform: rotate( 180deg );
}

.likeink-designer-app .designer-sidebar.is-collapsed .designer-sidebar-flap svg { transform: rotate( 0deg ); }

.likeink-designer-app .designer-tool-switch { padding: var( --space-4 ) var( --space-4 ) var( --space-3 ); }
.likeink-designer-app .designer-tool-switch .seg { width: 100%; }
.likeink-designer-app .designer-tool-switch .seg-opt { flex: 1; justify-content: center; }

.likeink-designer-app .designer-sidebar-scroll {
	flex: 1;
	overflow: auto;
	padding: 0 var( --space-4 ) var( --space-4 );
}

.likeink-designer-app .designer-panel { display: none; flex-direction: column; gap: var( --space-3 ); }
.likeink-designer-app .designer-panel.is-active { display: flex; }

/* Uploaded-image thumbnails. */
.likeink-designer-app .designer-thumbs {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: var( --space-2 );
}

.likeink-designer-app .designer-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	background: #fff;
	border: 1px solid var( --color-divider );
	border-radius: 10px;
	cursor: pointer;
	padding: 0;
	overflow: hidden;
}

.likeink-designer-app .designer-thumb:is( :hover, :focus ) { border-color: var( --color-accent ); background: #fff; }
.likeink-designer-app .designer-thumb.is-selected { border-color: var( --color-accent ); border-width: 2px; }
/* contain, not cover: these thumbnails exist to identify an upload, and a wide
   image cropped to a square shows only its middle. */
.likeink-designer-app .designer-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }

/* Colour swatches. */
.likeink-designer-app .designer-swatches { display: flex; gap: 6px; flex-wrap: wrap; }

.likeink-designer-app .designer-swatch {
	width: 28px;
	height: 28px;
	border: 2px solid var( --color-divider );
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
}

.likeink-designer-app .designer-swatch.is-selected { border-color: var( --color-text ); }

/* Custom colour. An <input type="color"> is a replaced element, so it cannot
   carry a pseudo-element of its own — the colour wheel is a sibling <svg> laid
   over a wrapper that the input fills, and it has to stay pointer-events:none
   or it would swallow the click that opens the picker. */
.likeink-designer-app .designer-swatch-custom {
	position: relative;
	overflow: hidden;
	display: inline-flex;
}

.likeink-designer-app .designer-swatch-custom input[type="color"] {
	position: absolute;
	/* Oversized so the input's own inset swatch covers the round wrapper
	   edge-to-edge instead of leaving a ring of its default chrome. */
	inset: -25%;
	width: 150%;
	height: 150%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.likeink-designer-app .designer-swatch-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.likeink-designer-app .designer-swatch-custom input[type="color"]::-webkit-color-swatch { border: 0; }
.likeink-designer-app .designer-swatch-custom input[type="color"]::-moz-color-swatch { border: 0; }

/* The wheel is a ring, not a disc: it fills the swatch and leaves its middle
   open so the input's own colour reads through as the current choice. */
.likeink-designer-app .designer-swatch-wheel {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.likeink-designer-app input[type="file"] { display: none; }

.likeink-designer-app input[type="range"] { width: 100%; accent-color: var( --color-accent ); }

/* Selected-element properties, pinned to the bottom of the sidebar. */
.likeink-designer-app .designer-selection {
	padding: var( --space-4 );
	border-top: 1px solid var( --color-divider );
	flex: 0 0 auto;
	max-height: 55%;
	overflow: auto;
}

.likeink-designer-app .designer-selection-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var( --space-3 );
}

.likeink-designer-app .designer-selection-arrange { display: flex; gap: var( --space-2 ); margin-bottom: var( --space-3 ); }
.likeink-designer-app .designer-selection-arrange .btn { flex: 1; }

/* Full width, because it is the one action on an image worth spelling out —
   the arrange row beside it is icon-sized on purpose. */
.likeink-designer-app .designer-remove-bg-btn,
.likeink-designer-app .designer-crop-btn { width: 100%; justify-content: center; margin-bottom: var( --space-3 ); }
.likeink-designer-app .designer-remove-bg-btn.is-busy,
.likeink-designer-app .fab-btn.is-busy { opacity: 0.55; cursor: progress; }
.likeink-designer-app .designer-remove-bg-btn.is-unavailable,
.likeink-designer-app .fab-btn.is-unavailable { opacity: 0.4; cursor: not-allowed; }

/* On while the cut-out is showing, so the button reads as a state and not just
   a thing that happened once. */
.likeink-designer-app .fab-btn.is-active { border-color: var( --color-accent ); color: var( --color-accent ); }

.likeink-designer-app .designer-delete-btn { color: #dc2626; font-weight: 400; }
.likeink-designer-app .designer-delete-btn:is( :hover, :focus ) { background: transparent; color: var( --color-text ); }

.likeink-designer-app .designer-field { margin-bottom: var( --space-2 ); }

/* ── stage ────────────────────────────────────────────────────────────── */

.likeink-designer-app .designer-stage {
	flex: 1;
	position: relative;
	overflow: hidden;
	min-height: 0;
	background-color: #fff;

	/* Panning affordances. is-pannable means there is somewhere to pan to;
	   the grab cursors are only shown while space is held or a drag is live. */
	cursor: default;

	/* Graph paper, drawn rather than shipped as an image so it stays crisp
	   at any size. Mirrors ClaudeDesign/assets/sheet-grid-overlay.png. */
	background-image:
		repeating-linear-gradient( to right, rgba( 20, 20, 20, 0.06 ) 0 1px, transparent 1px 10px ),
		repeating-linear-gradient( to bottom, rgba( 20, 20, 20, 0.06 ) 0 1px, transparent 1px 10px ),
		repeating-linear-gradient( to right, rgba( 20, 20, 20, 0.1 ) 0 1px, transparent 1px 50px ),
		repeating-linear-gradient( to bottom, rgba( 20, 20, 20, 0.1 ) 0 1px, transparent 1px 50px );
}

.likeink-designer-app .designer-stage-scroll {
	position: absolute;
	inset: 0;
	overflow: auto;
	display: flex;

	/* Centring is done with auto margins on .canvas-container, not with
	   justify-content/align-items. Flex centring pushes overflow past the
	   start edge where scrolling cannot reach it, which would strand the top
	   and left of the sheet the moment anyone zoomed in. */

	/* The extra room at the bottom keeps the sheet clear of the floating
	   toolbar. scaleCanvas() subtracts this padding, so the sheet is fitted to
	   the space that is actually visible rather than sliding under the pill. */
	padding: var( --space-6 ) var( --space-6 ) var( --toolbar-clearance );

	/* Reserve the scrollbar track so the stage's client width does not change
	   when a scrollbar appears — scaleCanvas() measures this element, and a
	   width that moved with the scrollbar could oscillate. */
	scrollbar-gutter: stable;
}

.likeink-designer-app .canvas-container { margin: auto; }

.likeink-designer-app .canvas-wrapper {
	display: grid;
	grid-template-areas:
		". top-ruler"
		"left-ruler canvas";
	grid-template-columns: auto 1fr;
	grid-template-rows: auto 1fr;
	align-items: center;

	/* Sized by the canvas, never by the stage: scaleCanvas() measures the
	   stage instead, so a percentage width here would be circular. */
	width: max-content;
}

/* ── rulers ───────────────────────────────────────────────────────────── */

/* Deliberately no background: the rulers sit straight on the stage's graph
   paper, and --ruler-mark / --ruler-ink are what separate the two. */
.likeink-designer-app .ruler-top,
.likeink-designer-app .ruler-left {
	position: relative;
}

.likeink-designer-app .ruler-top {
	grid-area: top-ruler;
	display: flex;
	align-items: flex-end;
	height: var( --ruler-size );
	border-bottom: var( --ruler-mark ) solid var( --ruler-ink );
	margin-bottom: var( --ruler-gap );
}

/* No vertical offset here. The wrapper centres both cells of the canvas row,
   and the ruler is sized to the canvas, so they line up on their own — an
   offset only pushes 0mm above the top edge of the sheet. */
.likeink-designer-app .ruler-left {
	grid-area: left-ruler;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	width: var( --ruler-size );
	border-right: var( --ruler-mark ) solid var( --ruler-ink );
	margin-right: var( --ruler-gap );
}

.likeink-designer-app .ruler-tick { position: absolute; background: var( --ruler-ink ); }
.likeink-designer-app .ruler-top .ruler-tick { height: 6px; width: var( --ruler-mark ); bottom: 0; }
.likeink-designer-app .ruler-top .ruler-tick.major { height: 12px; }
.likeink-designer-app .ruler-left .ruler-tick { width: 6px; height: var( --ruler-mark ); right: 0; }
.likeink-designer-app .ruler-left .ruler-tick.major { width: 12px; }

.likeink-designer-app .ruler-label {
	position: absolute;
	font-family: var( --font-body );
	font-size: 10px;
	line-height: 1;
	/* A step darker than the marks: small type needs more contrast than a
	   rule does to read at the same weight. */
	color: var( --color-neutral-600 );
	white-space: nowrap;
}

/* Centred on the tick with a transform rather than a fixed pixel nudge in
   designer.js, which only happened to look right at one font size. */
.likeink-designer-app .ruler-top .ruler-label { top: 3px; transform: translateX( -50% ); }

.likeink-designer-app .ruler-left .ruler-label {
	left: 3px;
	writing-mode: vertical-rl;
	transform: translateY( -50% ) rotate( 180deg );
}

/* ── canvas ───────────────────────────────────────────────────────────── */

/* Must stay position:relative — it is the offset parent for the overlays and
   for the FAB cluster, which designer.js positions in raw pixels. */
.likeink-designer-app .canvas-area {
	grid-area: canvas;
	position: relative;
	line-height: 0;
}

.likeink-designer-app #designer-canvas { box-shadow: var( --shadow-lg ); }
.likeink-designer-app .canvas-container .canvas-container { position: relative; }

/* ── floating pill toolbar ────────────────────────────────────────────── */

.likeink-designer-app .designer-toolbar {
	position: absolute;
	z-index: 50;
	bottom: var( --space-6 );
	left: 50%;
	transform: translateX( -50% );
	display: flex;
	align-items: center;
	background: #fff;
	border: 1px solid var( --color-divider );
	border-radius: 999px;
	box-shadow: var( --shadow-sm );
	overflow: hidden;
	max-width: calc( 100% - var( --space-6 ) );
	overflow-x: auto;
	transition: opacity 0.15s ease;
}

/* Visually out of the way while a rotate/resize gesture is in progress, so a
   handle passing under it mid-drag isn't hidden by its opaque background. */
.likeink-designer-app .designer-toolbar.is-dimmed {
	opacity: 0.35;
	pointer-events: none;
}

.likeink-designer-app .designer-toolbar button {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	font-family: var( --font-body );
	font-size: 12px;
	font-weight: 500;
	color: var( --color-text );
	background: transparent;
	border: none;
	border-right: 1px solid var( --color-divider );
	cursor: pointer;
	white-space: nowrap;
}

.likeink-designer-app .designer-toolbar button:last-child { border-right: none; }

.likeink-designer-app .designer-toolbar-sep {
	width: 1px;
	align-self: stretch;
	background: var( --color-divider );
	flex: none;
}

/* The separators already divide the groups, so the zoom cluster drops its own
   borders and sits tighter than the labelled buttons. */
.likeink-designer-app .designer-toolbar #zoom-out,
.likeink-designer-app .designer-toolbar #zoom-reset,
.likeink-designer-app .designer-toolbar #zoom-in {
	border-right: none;
	padding: 8px 10px;
}

.likeink-designer-app .designer-toolbar #zoom-reset {
	min-width: 52px;
	justify-content: center;
	font-variant-numeric: tabular-nums;
}
.likeink-designer-app .designer-toolbar button:is( :hover, :focus ):not( :disabled ) { background: color-mix( in srgb, var( --color-text ) 6%, transparent ); }
.likeink-designer-app .designer-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }
.likeink-designer-app .designer-toolbar button svg { flex-shrink: 0; }

/* ── selection FABs ───────────────────────────────────────────────────── */

.likeink-designer-app .fab-container {
	position: absolute;
	display: none;
	gap: 6px;
	z-index: 10;
	pointer-events: none;
}

.likeink-designer-app .fab-container.is-visible { display: flex; }

/* The selection's size in cm. Purely informational, so it never takes the
   pointer: it sits where a handle might otherwise be reached. */
.likeink-designer-app .selection-size {
	position: absolute;
	z-index: 10;
	/* 4px over 0 rather than 2px over 2px: the face sits high in its line box,
	   so equal padding reads as text hugging the top. Same 20px height. */
	padding: 4px 8px 0;
	border-radius: var( --radius-md );
	/* Translucent so the artwork under it still reads; the blur keeps the
	   white text legible over dark pixels. */
	background: color-mix( in srgb, var( --color-text ) 55%, transparent );
	-webkit-backdrop-filter: blur( 4px );
	backdrop-filter: blur( 4px );
	color: #fff;
	font-size: 11px;
	line-height: 16px;
	white-space: nowrap;
	pointer-events: none;
}
.likeink-designer-app .selection-size[hidden] { display: none; }

.likeink-designer-app .fab-btn {
	pointer-events: auto;
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: 50%;
	background: #fff;
	border: 1px solid var( --color-divider );
	box-shadow: var( --shadow-sm );
	color: var( --color-text );
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.likeink-designer-app .fab-btn:is( :hover, :focus ) { border-color: var( --color-accent ); color: var( --color-accent ); background: var( --color-bg ); }
.likeink-designer-app .fab-btn.fab-danger:is( :hover, :focus ) { border-color: #dc2626; color: #dc2626; }

/* Apply-crop is the affirmative half of the pair, so it is filled rather than
   outlined. Its hover/focus rule restates the fill instead of inheriting the
   one above: Flatsome paints every bare button #c36 on BOTH :hover and :focus
   at (0,2,0), and on a touchscreen focus arrives with the tap. */
.likeink-designer-app .fab-btn.fab-confirm { background: var( --color-accent ); border-color: var( --color-accent ); color: #fff; }
.likeink-designer-app .fab-btn.fab-confirm:is( :hover, :focus ) { background: var( --color-accent-600 ); border-color: var( --color-accent-600 ); color: #fff; }

/* While a crop is open the sidebar's actions on the same object are off, for
   the same reason the keyboard is: they would fight a mode that is waiting for
   an answer. The FAB pair is the way out. */
.likeink-designer-app.is-cropping .designer-selection-head,
.likeink-designer-app.is-cropping .designer-selection-arrange,
.likeink-designer-app.is-cropping .designer-remove-bg-btn { opacity: 0.45; pointer-events: none; }
.likeink-designer-app.is-cropping .designer-crop-btn { border-color: var( --color-accent ); color: var( --color-accent ); }

/* ── overlays ─────────────────────────────────────────────────────────── */

.likeink-designer-app #empty-canvas-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 20;
	line-height: 1.55;
	pointer-events: none;
}

.likeink-designer-app .designer-empty-hint {
	text-align: center;
	font-size: 13px;
	max-width: 260px;
	color: color-mix( in srgb, var( --color-text ) 55%, transparent );
}

.likeink-designer-app .designer-empty-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var( --space-3 );
	padding: var( --space-3 );
}

/* The overlay stays pointer-transparent — it covers the whole sheet, and a
   click anywhere on the sheet has to reach Fabric. Only the buttons take
   pointer events back. */
.likeink-designer-app .designer-empty-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var( --space-2 );
	pointer-events: auto;
}

/* The sheet is white, so the component's transparent background would leave
   these reading as text rather than as controls. This sits at (0,3,0), which
   puts it above the theme's magenta (0,2,0) bare-button hover and focus rules
   and below .btn-secondary's own (0,4,0) ones — so the button still lights up
   the way every other one does. */
.likeink-designer-app .designer-empty-actions .btn {
	background: var( --color-bg );
	min-height: 40px;
}

.likeink-designer-app #likeink-upload-overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: color-mix( in srgb, #fff 78%, transparent );
	z-index: 9999;
	line-height: 1.55;
}

.likeink-designer-app .likeink-upload-overlay-inner { text-align: center; }

.likeink-designer-app .likeink-overlay-spinner {
	width: 32px;
	height: 32px;
	margin: 0 auto var( --space-2 );
	border: 3px solid var( --color-divider );
	border-top-color: var( --color-accent );
	border-radius: 50%;
	animation: likeink-spin 0.8s linear infinite;
}

@keyframes likeink-spin { to { transform: rotate( 360deg ); } }

.likeink-designer-app .likeink-upload-overlay-text { font-size: 13px; }

.likeink-designer-app .disabled-by-upload { opacity: 0.5 !important; pointer-events: none !important; }

/* Non-blocking, dismissible notice (e.g. low print-quality warning) shown
   over the canvas. Uses the same hidden-attribute toggle convention as the
   rest of the editor rather than a JS-driven display style. */
.likeink-designer-app .designer-notice {
	position: absolute;
	top: var( --space-2 );
	left: 50%;
	transform: translateX( -50% );
	z-index: 40;
	display: flex;
	align-items: center;
	gap: var( --space-2 );
	max-width: calc( 100% - var( --space-4 ) );
	padding: var( --space-2 ) var( --space-3 );
	background: #fff8e6;
	border: 1px solid #f0c36d;
	border-radius: var( --radius-sm );
	box-shadow: var( --shadow-sm );
	font-size: 13px;
	line-height: 1.4;
	color: #6b4c00;
}

.likeink-designer-app .designer-notice-choice {
	flex-wrap: wrap;
	justify-content: center;
	background: #fff;
	border-color: var( --color-border, #d0d0d0 );
	color: inherit;
}

.likeink-designer-app .designer-notice-dismiss {
	flex: none;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0 var( --space-1 );
}

/* Drag-and-drop feedback on the stage. */
.likeink-designer-app .designer-stage.is-drag-over { background-color: var( --color-accent-100 ); }

.likeink-designer-app .designer-stage.is-pannable { cursor: grab; }
.likeink-designer-app .designer-stage.is-grab-ready,
.likeink-designer-app .designer-stage.is-grab-ready * { cursor: grab; }
.likeink-designer-app .designer-stage.is-grabbing,
.likeink-designer-app .designer-stage.is-grabbing * { cursor: grabbing; }

/* The sheet itself keeps Fabric's own cursors — dragging there moves objects. */
.likeink-designer-app .designer-stage.is-pannable .canvas-area { cursor: default; }

/* ── touch gestures ───────────────────────────────────────────────────── */

/* Who owns a touch. Without these the browser owns every one of them: a
   two-finger pinch zooms the whole page rather than the sheet, and the
   scroller can steal a drag Fabric had already begun. One-finger scrolling of
   the stage stays with the browser on purpose — the stage's own overflow *is*
   the pan surface, so scrolling already is panning. That only reaches as far as
   there is stage left to touch, though: zoom in and the sheet covers the
   scroller, so panning from there is the two-finger gesture in
   handlePinchPointerMove(). Not scoped to the mobile
   breakpoint: these are inert without touch input, and correct on a
   touchscreen laptop at any width. */
.likeink-designer-app .designer-stage-scroll { touch-action: pan-x pan-y; }
.likeink-designer-app .canvas-area { touch-action: none; }

/* ── order block ──────────────────────────────────────────────────────── */

/* Where the quantity stepper, Add to cart and the shop link live once they
   have been moved in on a phone. Empty on desktop, where they stay in the
   nav — hence :empty rather than a breakpoint. */
.likeink-designer-app .designer-order { display: flex; flex-direction: column; gap: var( --space-2 ); }
.likeink-designer-app .designer-order:empty { display: none; }

/* ── responsive ───────────────────────────────────────────────────────── */

/* One breakpoint, kept at 900px rather than the design source's 760px: 760 to
   900 is exactly the band where the old stacked layout was worst, and a bottom
   drawer is a perfectly good tablet-portrait pattern. Custom properties cannot
   be used in a media query, so the literal lives here and nowhere else — JS
   reads --layout instead. */
@media ( max-width: 900px ) {

	.likeink-designer-app {
		--layout: mobile;
		--ruler-size: 26px;

		/* The sheet has to fit the band that is actually visible, and
		   everything below the stage is peek + safe area + grab handle +
		   floating toolbar. scaleCanvas() subtracts this padding via
		   getComputedStyle, so raising it here re-fits the sheet with no JS
		   change at all. 108px = 44 handle + 44 toolbar + 20 of gaps. */
		--toolbar-clearance: calc( var( --drawer-peek ) + env( safe-area-inset-bottom ) + 108px );
	}

	/* ── nav: one row, and it must never wrap ─────────────────────────── */

	/* The rule that used to live here stretched the buttons with flex:1,
	   which is precisely what produced the three-row nav that ate the stage.
	   Nothing stretches now; the commerce controls leave the row entirely
	   (designer.js moves them into the drawer) and the nav keeps identity,
	   the element count and the live price. */
	.likeink-designer-app .designer-nav {
		flex-wrap: nowrap;
		gap: var( --space-2 );
		padding: var( --space-2 ) var( --space-3 );
		padding-top: calc( var( --space-2 ) + env( safe-area-inset-top ) );
	}

	.likeink-designer-app .designer-logo { height: 16px; flex: none; }

	/* The count and the order shortcut never shrink; this is what gives if a
	   translation runs long, same reasoning as .designer-nav-tags .tag-outline.
	   The ellipsis is on the span, not the flex link itself, since text-overflow
	   has no effect on a flex container. */
	.likeink-designer-app .designer-back-link { min-width: 0; }
	.likeink-designer-app .designer-back-link span {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.likeink-designer-app .designer-nav-actions {
		flex-wrap: nowrap;
		width: auto;
		margin-left: auto;
		gap: var( --space-2 );
	}

	/* The A5 dimensions are decorative; the element count is feedback. */
	.likeink-designer-app .designer-nav-tags { margin-left: auto; min-width: 0; }

	.likeink-designer-app .designer-nav-tags .tag-neutral { display: none; }

	/* The count is what gives if a translation runs long: the CTA never
	   shrinks, and an ellipsis is a better failure than a wrapped nav. */
	.likeink-designer-app .designer-nav-tags .tag-outline {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* On a narrow phone the back link gives up its words instead: "Back to
	   Like Ink" is the widest thing in the row, and the count should always
	   get the room its text needs ("1 element" was being clipped). Both
	   spans stay in the DOM so the link's name is never empty. */
	@media ( max-width: 480px ) {
		.likeink-designer-app .designer-back-full { display: none; }
		.likeink-designer-app .designer-back-short { display: inline; }
		.likeink-designer-app .designer-nav-tags { flex: none; }
		.likeink-designer-app .designer-nav-tags .tag-outline { overflow: visible; }
	}

	/* The one-tap route to the drawer's order block. The nav outranks the
	   drawer (z-index 60 against 55), so it stays tappable with the drawer
	   open — there is nothing to hide or restore on a toggle.

	   Sized to the element count beside it rather than to a 44px touch target:
	   the two read as one pair on the right of the bar, and the button that
	   actually takes the money is the 48px one in the drawer this opens. Same
	   font-size and radius as .tag already, so only the padding and the line
	   box have to be restated — keep these in step with .tag in
	   design-system.css. */
	.likeink-designer-app .designer-nav-cart {
		display: inline-flex;
		flex: none;
		line-height: 0.5;
		white-space: nowrap;
	}

	/* Everything that lived here is in the drawer on a phone. Keyed on the
	   order block actually being populated rather than on :empty, for two
	   reasons: the template leaves indentation whitespace inside the nav row,
	   so :empty never matches once the elements are gone; and this way the
	   controls stay visible in the nav if the move has not run, instead of
	   the row being hidden with them still inside it. */
	.likeink-designer-app:has( #designer-order > * ) .designer-nav-actions { display: none; }

	/* ── sidebar becomes a bottom drawer ──────────────────────────────── */

	/* Out of flow, deliberately. An in-flow drawer takes its height from
	   .designer-main, which is overflow:hidden — so every open would shrink
	   the stage and re-fit the sheet, which is the bug this whole layout
	   exists to fix. Fixed, the stage's client box never changes, the
	   ResizeObserver never fires on a toggle, and the drawer overlays the
	   sheet instead of squeezing it. */
	.likeink-designer-app .designer-sidebar {
		position: fixed;
		inset: auto 0 0 0;
		width: auto;
		flex: none;
		max-height: var( --drawer-max );
		border-right: none;
		border-top: 1px solid var( --color-divider );

		/* Square-topped on purpose. The flap above is the drawer's visual cap
		   and carries the 16px itself; rounding the drawer as well only cut a
		   notch out of each top corner, a few pixels below the flap's square
		   bottom ones, for the stage behind to show through. */
		border-radius: 0;
		box-shadow: 0 -12px 32px color-mix( in srgb, #2d2b2b 18%, transparent );
		padding-bottom: env( safe-area-inset-bottom );
		z-index: 55;
		transform: translateY( 0 );
		transition: transform 0.22s ease;
	}

	/* Every property the desktop .is-collapsed sets is restated rather than
	   left to be shadowed by source order, which is how the old block
	   happened to work. */
	.likeink-designer-app .designer-sidebar.is-collapsed {
		width: auto;
		flex-basis: auto;
		border-right: none;
		border-top: 1px solid var( --color-divider );
		/* Show exactly the drawer's 1px top border plus the tool-switch row and
		   nothing else. The row carries the safe-area inset itself when
		   collapsed (below), because the drawer's own bottom padding is off
		   screen with the rest of the content — reserving room for it here
		   pulled that much of the panel underneath into view instead, which
		   is how the "Text" label came to be peeking out along the bottom. */
		transform: translateY( calc( 100% - var( --drawer-peek ) - env( safe-area-inset-bottom ) - 1px ) );
	}

	/* The peek keeps the tool switch on screen, so unlike desktop the body
	   stays displayed while collapsed. */
	.likeink-designer-app .designer-sidebar.is-collapsed .designer-sidebar-body { display: flex; }

	/* flex: none is load-bearing. The drawer's content is taller than its
	   max-height, so as an ordinary flex child this row shrinks below its own
	   height — measured 57px against the 64 it declares — and the collapsed
	   transform, which works off --drawer-peek, then left the difference
	   showing as a strip of the panel underneath. */
	.likeink-designer-app .designer-tool-switch {
		height: var( --drawer-peek );
		flex: none;
		display: flex;
		align-items: center;
		padding: 0 var( --space-3 );
	}

	/* Collapsed, this row is the only thing on screen, so the clearance for
	   the home indicator has to live here rather than on the drawer — the
	   drawer's own padding-bottom is below the scroll panel and off screen.
	   The height grows by the same inset the padding adds, so the segmented
	   control stays centred on the peek and the row still ends exactly where
	   the transform above expects it to. */
	.likeink-designer-app .designer-sidebar.is-collapsed .designer-tool-switch {
		height: calc( var( --drawer-peek ) + env( safe-area-inset-bottom ) );
		padding-bottom: env( safe-area-inset-bottom );
	}

	/* ── the flap becomes the grab handle ─────────────────────────────── */

	/* This is the fix for the layout's worst defect: the old block hid the
	   flap outright, leaving toggleSidebar() with no trigger at all below
	   900px and the panel welded open over 38vh of the stage. Restyled
	   instead of hidden, so the binding at designer.js init still drives it
	   and no new id enters the contract. */
	.likeink-designer-app .designer-sidebar-flap {
		top: -44px;
		right: auto;
		left: 0;
		width: 100%;
		height: 44px;
		transform: none;
		border: 0;
		border-radius: 16px 16px 0 0;
		background: var( --color-bg );
		box-shadow: 0 -6px 16px color-mix( in srgb, #2d2b2b 6%, transparent );
	}

	.likeink-designer-app .designer-sidebar-flap svg { transform: rotate( 90deg ); }
	.likeink-designer-app .designer-sidebar.is-collapsed .designer-sidebar-flap svg { transform: rotate( -90deg ); }

	/* ── drawer: one panel at a time ──────────────────────────────────── */

	/* Desktop has height to spare, so the tool panel and a selection's
	   properties sit stacked, each scrolling on its own (.designer-selection's
	   own max-height: 55% further up). The drawer does not: a text selection's
	   properties alone can fill it, and splitting the remaining sliver with the
	   upload/text panel left both scrolling in a strip too narrow to use. A
	   selection now takes the drawer over completely — hiding the tool panel
	   rather than shrinking it — and getting back to it is what the tool switch
	   already does on a tap: deselect, then show its panel. has-selection is
	   set by updateToolbarState(), the same place that toggles #selection-panel
	   itself. */
	.likeink-designer-app .designer-sidebar.has-selection .designer-sidebar-scroll { display: none; }

	.likeink-designer-app .designer-sidebar.has-selection .designer-selection {
		flex: 1;
		max-height: none;
	}

	/* Neither tab reads as active while its panel is hidden behind the
	   properties — a checked radio with no visible panel would be a control
	   that appears to do something it no longer does. */
	.likeink-designer-app .designer-sidebar.has-selection .seg-opt:has( input:checked ) {
		background: none;
		color: inherit;
	}

	/* design-system.css's own hover rule is scoped to :not(:has(input:checked)),
	   so without this the tab that was active before the selection took over
	   stayed checked underneath and never got its hover/focus feedback back —
	   it looked identical to the other tab but did not respond the same way.
	   :is(:hover, :focus) outweighs the plain rule above by one pseudo-class,
	   so this wins regardless of source order. */
	.likeink-designer-app .designer-sidebar.has-selection .seg-opt:has( input:checked ):is( :hover, :focus ) {
		background: color-mix( in srgb, var( --color-text ) 7%, transparent );
	}

	/* ── order bar: the buying half, collapsed under the nav ──────────── */

	/* Absolutely positioned against .designer-nav (position: relative there),
	   starting exactly at its bottom edge — the nav's real height carries the
	   safe-area inset and is not a literal anywhere, so anchoring beats
	   guessing at a pixel value. Collapsed by clipping its own height rather
	   than a translateY slide: the bar starts at the nav's edge already, so
	   there is nothing to hide it behind — it only has to grow downward. */
	.likeink-designer-app .designer-order-bar {
		display: block;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		max-height: 0;
		overflow: hidden;
		background: var( --color-bg );
		border-top: 1px solid var( --color-divider );
		box-shadow: 0 12px 32px color-mix( in srgb, #2d2b2b 18%, transparent );
		transition: max-height 0.22s ease;
		z-index: 1;
	}

	/* Generous rather than exact: the real content height moves with the
	   sheet-pricing calculator's own string length (currency, decimal
	   places), and max-height only has to clear it, not match it. */
	.likeink-designer-app .designer-order-bar.is-open { max-height: 260px; }

	/* An in-flow row under the order content, not a corner overlay — it is
	   the last child of .designer-order-bar, so it always sits on the bar's
	   own bottom edge regardless of how tall the content above it is. */
	.likeink-designer-app .designer-order-bar-close {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 32px;
		padding: 0;
		border: 0;
		border-top: 1px solid var( --color-divider );
		background: transparent;
		color: var( --color-text );
	}

	/* Same rotation trick as .designer-sidebar-flap: one chevron path, turned
	   to face the direction this control collapses toward. */
	.likeink-designer-app .designer-order-bar-close svg { transform: rotate( -90deg ); }

	/* Restated per-state, not reset with :where() — the theme's own
	   [type="button"]:hover ties our specificity and wins on load order, so
	   each state has to say what this control looks like at a weight the
	   theme cannot tie. See the "theme paints every bare control" trap. */
	.likeink-designer-app .designer-order-bar-close:is( :hover, :focus ):not( :disabled ) {
		background: color-mix( in srgb, var( --color-text ) 7%, transparent );
		color: var( --color-text );
	}
	.likeink-designer-app .designer-order-bar-close:active:not( :disabled ) {
		background: color-mix( in srgb, var( --color-text ) 14%, transparent );
		color: var( --color-text );
	}

	.likeink-designer-app .designer-order {
		display: flex;
		flex-direction: column;
		gap: var( --space-3 );
		padding: var( --space-4 );
	}

	.likeink-designer-app .designer-order .designer-qty { justify-content: space-between; width: 100%; }

	/* "Sheets" is redundant once the live price sits in its place, and the
	   price says "/sheet" itself. */
	.likeink-designer-app .designer-order .designer-qty > label { display: none; }

	.likeink-designer-app .designer-order .likeink-sheet-pricing__calculator {
		flex: 1 1 auto;
		min-width: 0;
		font-size: 13px;
		line-height: 1.35;
	}

	.likeink-designer-app .designer-order .likeink-sheet-pricing__calculator-price { font-size: 15px; }

	.likeink-designer-app .designer-order .designer-qty-stepper { flex: none; }
	.likeink-designer-app .designer-order .designer-qty-step { width: 44px; }
	.likeink-designer-app .designer-order .designer-qty .input { min-height: 44px; }
	.likeink-designer-app .designer-order .btn { width: 100%; }
	.likeink-designer-app .designer-order .btn-cart { min-height: 48px; }

	/* Tapping outside the order bar closes it, the way tapping outside a
	   bottom sheet usually does. Always in the DOM, at zero opacity and
	   pointer-events: none, rather than [hidden] — the drawer's own overlay
	   trick would kill the transition. z-index sits below the nav's own
	   stacking context (60), inside which the order bar itself paints, and
	   above the drawer (55) so the backdrop reaches it too. */
	.likeink-designer-app .designer-order-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: color-mix( in srgb, #2d2b2b 45%, transparent );
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.22s ease;
		z-index: 57;
	}

	.likeink-designer-app .designer-order-backdrop.is-visible {
		opacity: 1;
		pointer-events: auto;
	}

	/* ── stage ────────────────────────────────────────────────────────── */

	/* The pinch already zooms and pans the sheet, so the zoom cluster is not
	   worth its width here; that room goes to Auto fill sheet, which keeps its
	   label because an icon alone does not say what it will do to the sheet.
	   With the middle group gone the separators would only double up the
	   buttons' own borders, so they go too. */
	.likeink-designer-app .designer-toolbar :is( #zoom-out, #zoom-reset, #zoom-in ),
	.likeink-designer-app .designer-toolbar-sep { display: none; }

	.likeink-designer-app .designer-toolbar button:not( #fill-sheet-btn ) .designer-toolbar-label { display: none; }

	.likeink-designer-app .designer-toolbar {
		bottom: calc( var( --drawer-peek ) + env( safe-area-inset-bottom ) + 52px );
	}

	.likeink-designer-app .designer-stage-scroll {
		padding: var( --space-3 ) var( --space-3 ) var( --toolbar-clearance );
	}
}

/* A phone held sideways has ~390px of height, and the nav, the peek, the grab
   handle and the floating toolbar together leave the sheet less room than its
   own 0.1 minimum scale — so it overflowed the stage instead of shrinking.
   Keyed on height rather than orientation, because height is the actual
   constraint: a landscape tablet at 900x600 needs none of this.

   Three things are reclaimed: the rulers (31px off a very short axis, and the
   least useful thing on screen at this size), a tighter peek, and the toolbar,
   which moves out of the vertical budget altogether into the empty stage
   beside the sheet — there is a couple of hundred pixels of graph paper either
   side of a landscape A5 at this width. */
@media ( max-width: 900px ) and ( max-height: 480px ) {

	.likeink-designer-app {
		--ruler-size: 0px;
		--ruler-gap: 0px;
		--drawer-peek: 48px;
		--toolbar-clearance: calc( var( --drawer-peek ) + env( safe-area-inset-bottom ) + 52px );
	}

	/* getRulerGutter() already reads 0 from the properties above; this is what
	   stops the empty rails from drawing. */
	.likeink-designer-app .ruler-top,
	.likeink-designer-app .ruler-left { display: none; }

	.likeink-designer-app .designer-toolbar {
		top: var( --space-2 );
		right: var( --space-2 );
		bottom: auto;
		left: auto;
		transform: none;
		max-width: calc( 100% - var( --space-4 ) );
	}

	.likeink-designer-app .designer-stage-scroll {
		padding: var( --space-2 ) var( --space-2 ) var( --toolbar-clearance );
	}
}

@media ( hover: none ) and ( pointer: coarse ) {
	.likeink-designer-app .fab-btn { width: 44px; height: 44px; }
	.likeink-designer-app .designer-toolbar button { padding: 12px 14px; }
	.likeink-designer-app .designer-empty-actions .btn { min-height: 44px; }
}
