/* Brand values come from the theme's design system; the literals are its own fallbacks. */
#gem-tutorial-dock {
	--help-edge: 16px;
	--help-bottom: calc(var(--help-edge) + env(safe-area-inset-bottom, 0px));
	--help-ink: var(--gem-ink, #01010C);
	--help-body: var(--gem-slate, #61616B);
	--help-gold: var(--gem-gold-grad, linear-gradient(180deg, #EAC66E, #D39700));
	--help-ease: var(--gem-ease, cubic-bezier(.16, 1, .3, 1));
	position: fixed;
	z-index: 1090;
	inset-inline-end: max(var(--help-edge), env(safe-area-inset-right, 0px));
	bottom: var(--help-bottom);
	font-family: "GAV Quasimoda", Quasimoda, system-ui, sans-serif;
	line-height: 1.5;
	color: var(--help-body);
}

#gem-tutorial-dock *, #gem-tutorial-dock *::before { box-sizing: border-box; }
#gem-tutorial-dock [hidden] { display: none !important; }
#gem-tutorial-dock button { margin: 0; font-family: inherit; letter-spacing: 0; text-transform: none; cursor: pointer; }
#gem-tutorial-dock :is(button, a):focus-visible {
	outline: 2px solid var(--help-ink);
	outline-offset: 3px;
}
#gem-tutorial-dock ::selection { background: #F3DFA6; color: var(--help-ink); }

/* The bubble (2026-11-25, Treyson: "like the popup pill"): one gold pill, the same gradient as the
   store's "Mystery discount" pill, with the play mark, the word, a hairline and the small "x" inside it.
   The gold and the shadow are on the dock itself, so both buttons sit in one shape. */
#gem-tutorial-dock {
	border-radius: 999px;
	background: var(--help-gold);
	box-shadow: 0 4px 16px rgb(211 151 0 / 35%);
	transition: translate .22s var(--help-ease), box-shadow .22s var(--help-ease);
}
#gem-tutorial-dock:has(> .gem-help-toggle[aria-expanded="false"]:hover),
#gem-tutorial-dock:has(> .gem-help-dismiss:hover) {
	translate: 0 -2px;
	box-shadow: 0 10px 26px rgb(211 151 0 / 45%);
}
#gem-tutorial-dock .gem-help-toggle {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 46px;
	padding: 0 18px 0 8px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	transition: background-color .2s;
	-webkit-tap-highlight-color: transparent;
}
#gem-tutorial-dock .gem-help-toggle:hover { color: #fff; }
#gem-tutorial-dock .gem-help-toggle[aria-expanded="true"] { background: rgb(1 1 12 / 10%); }
#gem-tutorial-dock .gem-help-mark {
	display: grid;
	place-items: center;
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #fff;
}
#gem-tutorial-dock .gem-help-mark svg { display: block; margin-inline-start: 2px; fill: #D39700; }

/* The bubble can be put away (2026-11-23, customer hole 33). The small "x" is added by the script, so it
   is only there when it works. It is the right end of the same pill, after a white hairline, and a full
   44 by 46 px so a tap meant for one button does not land on the other (PK5). */
#gem-tutorial-dock[hidden] { display: none !important; }
#gem-tutorial-dock.gem-help-closable { display: flex; align-items: stretch; }
#gem-tutorial-dock.gem-help-closable .gem-help-toggle { padding-inline-end: 14px; border-radius: 999px 0 0 999px; }
#gem-tutorial-dock .gem-help-dismiss {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	min-height: 46px;
	padding: 0 4px 0 0;
	border: 0;
	border-inline-start: 1px solid rgb(255 255 255 / 45%);
	border-radius: 0 999px 999px 0;
	background: transparent;
	color: #fff;
	opacity: .9;
	transition: opacity .2s, background-color .2s;
	-webkit-tap-highlight-color: transparent;
}
#gem-tutorial-dock .gem-help-dismiss:hover { opacity: 1; background: rgb(1 1 12 / 8%); }
#gem-tutorial-dock .gem-help-dismiss svg { display: block; }

/* The window: a light card, raised by shadow alone. */
#gem-help-window {
	position: absolute;
	inset-inline-end: 0;
	bottom: calc(100% + 12px);
	width: min(360px, calc(100vw - 2 * var(--help-edge) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
	max-height: calc(100vh - var(--help-bottom) - 82px);
	max-height: calc(100dvh - var(--help-bottom) - 82px);
	overflow: auto;
	overscroll-behavior: contain;
	overflow-wrap: anywhere;
	padding: 22px 22px 20px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 2px 6px rgb(1 1 12 / 8%), 0 28px 60px -18px rgb(1 1 12 / 42%);
	text-align: start;
	font-size: 15px;
	transform-origin: 100% 100%;
	animation: gem-help-in .28s var(--help-ease);
}
/* Movement only: the window is fully visible from its first frame. */
@keyframes gem-help-in {
	from { transform: translateY(10px) scale(.96); }
}
#gem-help-window h2 {
	margin: 0 0 6px;
	padding: 0 40px 0 0;
	color: var(--help-ink);
	font: 700 19px/1.25 "GAV Quasimoda", Quasimoda, system-ui, sans-serif;
	letter-spacing: -.01em;
	text-transform: none;
	text-wrap: balance;
}
#gem-help-window p { margin: 0 0 16px; padding: 0; color: var(--help-body); line-height: 1.5; }
#gem-help-window [data-help-close] {
	position: absolute;
	top: 14px;
	inset-inline-end: 14px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--help-body);
	transition: background-color .2s, color .2s;
}
#gem-help-window [data-help-close]:hover { background: #F1F1F4; color: var(--help-ink); }
#gem-help-window [data-help-close] svg { display: block; }
/* The one action in the window uses the site's gold button. */
#gem-help-window .gem-help-primary {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 46px;
	padding: 0 20px;
	border: 0;
	border-radius: 999px;
	background: var(--help-gold);
	box-shadow: 0 3px 12px -3px rgb(211 151 0 / 45%);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: transform .35s var(--help-ease), box-shadow .35s var(--help-ease);
}
#gem-help-window .gem-help-primary:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 22px -8px rgb(211 151 0 / 60%);
	color: #fff;
}
#gem-help-window .gem-help-primary:active { transform: none; }
#gem-help-window p:last-child { margin-bottom: 0; }
/* A signed-in visitor on the landing page gets a second action; it takes the outlined pill. */
#gem-help-window .gem-help-primary + .gem-help-primary,
#gem-help-window .gem-help-primary + .gem-help-primary:hover {
	margin-top: 10px;
	background: #fff;
	box-shadow: inset 0 0 0 1.5px #D39700;
	color: var(--help-ink);
}
#gem-help-window > :last-child { margin-bottom: 0; }

/* 2026-11-23 (customer hole 13a): on a template's own page the right column ends with "Enter names
   or upload a CSV" right where the bubble sits on a laptop screen (1280 wide), so there the bubble
   goes to the bottom left, over the template's picture, and its window opens to the right. */
@media (min-width: 1001px) {
	body:has(.sh-dz-side) #gem-tutorial-dock { inset-inline-end: auto; inset-inline-start: max(var(--help-edge), env(safe-area-inset-left, 0px)); }
	body:has(.sh-dz-side) #gem-help-window { inset-inline-end: auto; inset-inline-start: 0; }
}

@media (max-width: 1000px) {
	body.gav-sh-on #gem-tutorial-dock {
		/* The Vault's fixed mobile navigation occupies 62px plus the safe area. */
		--help-bottom: calc(64px + var(--help-edge) + env(safe-area-inset-bottom, 0px));
	}
}
@media (max-width: 600px) {
	#gem-tutorial-dock { --help-edge: 10px; }
	#gem-help-window { padding: 18px 18px 16px; }
}
@media (prefers-reduced-motion: reduce) {
	#gem-help-window { animation: none; }
	#gem-tutorial-dock, #gem-tutorial-dock .gem-help-toggle, #gem-help-window .gem-help-primary { transition: none; }
	#gem-tutorial-dock:has(> .gem-help-toggle:hover), #gem-tutorial-dock:has(> .gem-help-dismiss:hover) { translate: none; }
}

/* 2026-11-23 (PK16, PK17): on a short screen (a phone held sideways, or with its keyboard up) the
   Tutorial button is put away so the page and its forms get the room. */
@media (max-height: 480px) {
	#gem-tutorial-dock { display: none !important; }
}

/* The store menu or another slide-out panel is open: the Tutorial button steps aside so it never sits on top of the menu (2026-11-24). */
html.r6-nav-on #gem-tutorial-dock, body[data-panel] #gem-tutorial-dock { display: none; }
