/**
 * The account dialog.
 *
 * Everything here is drawn from the tokens the rest of the store already uses,
 * so the dialog inherits dark mode for free and cannot drift out of step with
 * the theme. Only two things are new: the held-piece strip, and the sheet
 * behaviour on small screens.
 *
 * The strip is the one place this file spends any boldness. It is the reason
 * the interruption reads as service rather than obstruction, so it gets the
 * gold hairline and the warm ground, and every other element stays quiet.
 */

.jk-gate {
	position: fixed;
	inset: 0;
	/* Above the cart drawer (191) and the search overlay, below the toast
	   layer, so a confirmation can still be seen over the dialog. */
	z-index: 1200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.jk-gate[hidden] {
	display: none;
}

.jk-gate__scrim {
	position: absolute;
	inset: 0;
	background: var(--scrim);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity .28s ease;
}

.jk-gate.is-open .jk-gate__scrim {
	opacity: 1;
}

.jk-gate__card {
	position: relative;
	width: min(430px, 100%);
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 22px;
	box-shadow: var(--shadow-lift);
	padding: 34px 30px 26px;
	opacity: 0;
	transform: translateY(14px) scale(.985);
	transition: opacity .28s ease, transform .28s cubic-bezier(.2, .7, .2, 1);
}

.jk-gate.is-open .jk-gate__card {
	opacity: 1;
	transform: none;
}

.jk-gate__card:focus {
	outline: none;
}

.jk-gate__x {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}

.jk-gate__x:hover {
	background: var(--surface-3);
	color: var(--text);
}

/* ------------------------------------------------------------ held piece */

.jk-gate__held {
	display: flex;
	align-items: center;
	gap: 13px;
	margin-bottom: 22px;
	padding: 11px 13px;
	border: 1px solid var(--line);
	border-left: 3px solid var(--gold);
	border-radius: 14px;
	background: var(--surface-3);
}

.jk-gate__held[hidden] {
	display: none;
}

.jk-gate__held-img {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--surface-2);
}

.jk-gate__held-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.jk-gate__held-txt {
	flex: 1 1 auto;
	min-width: 0;
}

.jk-gate__held-name {
	margin: 0;
	font-family: var(--serif);
	font-size: 15px;
	line-height: 1.25;
	color: var(--text-strong);
	/* Two lines then ellipsis: a long name should not push the price out of
	   the row, and truncating at one line loses too much of it. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.jk-gate__held-meta {
	margin: 3px 0 0;
	font-size: 12.5px;
	color: var(--muted);
}

.jk-gate__held-price {
	margin: 0;
	flex: 0 0 auto;
	align-self: flex-start;
	font-size: 14px;
	font-weight: 700;
	color: var(--burgundy);
	white-space: nowrap;
}

body.dark .jk-gate__held-price {
	color: var(--gold);
}

/* ----------------------------------------------------------------- panes */

.jk-gate__pane[hidden] {
	display: none;
}

.jk-gate__title {
	margin: 0 0 7px;
	font-family: var(--serif);
	font-size: 25px;
	line-height: 1.15;
	color: var(--burgundy);
}

body.dark .jk-gate__title {
	color: var(--text-strong);
}

.jk-gate__sub {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--muted);
	/* Keeps the two-line measure comfortable in the 430px card. */
	max-width: 42ch;
}

.jk-gate__hint {
	margin: 7px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--muted);
}

.jk-gate__note {
	margin: 0 0 18px;
	font-size: 13.5px;
}

.jk-gate__note[hidden] {
	display: none;
}

.jk-gate__google {
	margin-bottom: 16px;
}

/*
 * The Google button.
 *
 * These rules normally ride along inside the shortcode's own <style> block, and
 * the dialog does not use the shortcode — it links to the store's hand-off
 * endpoint instead, so that no OAuth state is written on every page render.
 * The declarations are repeated here rather than shared, because the shortcode
 * still has to stand alone anywhere else it is dropped.
 *
 * White ground and dark text in both themes: this is Google's mark, and it
 * stops being recognisable the moment it is restyled to match a palette.
 */
.jk-gate__google .jk-google-btn {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 13px 22px;
	border: 1px solid var(--line, #dcdcde);
	border-radius: 999px;
	background: #fff;
	color: #1f1a18;
	font-family: var(--sans);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	transition: box-shadow .25s ease, transform .25s ease;
}

.jk-gate__google .jk-google-btn svg {
	flex: none;
}

.jk-gate__google .jk-google-btn:hover {
	box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .4);
	transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
	.jk-gate__google .jk-google-btn:hover {
		transform: none;
	}
}

.jk-gate__or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
	font-size: 12px;
	color: var(--muted);
}

.jk-gate__or::before,
.jk-gate__or::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--line);
}

.jk-gate__form {
	gap: 15px;
}

.jk-gate__cta {
	width: 100%;
	justify-content: center;
	margin-top: 4px;
}

.jk-gate__cta[disabled] {
	opacity: .6;
	cursor: progress;
}

.jk-gate__mark {
	width: 48px;
	height: 48px;
	margin-bottom: 16px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--surface-3);
	color: var(--burgundy);
}

body.dark .jk-gate__mark {
	color: var(--gold);
}

/* Off-screen rather than hidden, so a password manager leaves it alone. */
.jk-gate__trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ------------------------------------------------------------- footings */

.jk-gate__foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 10px;
	margin-top: 18px;
	font-size: 13px;
	color: var(--muted);
}

.jk-gate__foot a {
	color: var(--burgundy);
	font-weight: 600;
}

body.dark .jk-gate__foot a {
	color: var(--gold);
}

.jk-gate__link {
	padding: 0;
	border: none;
	background: none;
	font: inherit;
	font-weight: 600;
	color: var(--burgundy);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

body.dark .jk-gate__link {
	color: var(--gold);
}

.jk-gate__escape {
	margin: 20px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--line-soft);
	font-size: 12.5px;
	line-height: 1.6;
	color: var(--muted);
	text-align: center;
}

.jk-gate__escape span {
	display: block;
	margin-top: 3px;
}

/* -------------------------------------------------------------- focus */

.jk-gate :focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 2px;
	border-radius: 6px;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 560px) {
	.jk-gate {
		padding: 0;
		align-items: flex-end;
	}

	/* A sheet, not a shrunken dialog. It arrives from the thumb's end of the
	   screen, and the drag handle says it can be sent back the same way. */
	.jk-gate__card {
		width: 100%;
		max-height: 92vh;
		border-radius: 22px 22px 0 0;
		border-bottom: none;
		padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px));
		transform: translateY(100%);
		transition: transform .34s cubic-bezier(.2, .7, .2, 1), opacity .2s ease;
	}

	.jk-gate__card::before {
		content: "";
		position: absolute;
		top: 9px;
		left: 50%;
		transform: translateX(-50%);
		width: 38px;
		height: 4px;
		border-radius: 99px;
		background: var(--line-strong);
	}

	.jk-gate__title {
		font-size: 22px;
	}

	.jk-gate__x {
		top: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jk-gate__card,
	.jk-gate__scrim {
		transition: none;
	}

	.jk-gate__card {
		transform: none;
	}
}
