/**
 * Website Showcase — front-end styles.
 */

.ws-showcase {
	/* Shortcode/settings write the *-desktop/base variables inline. The
	   responsive values below derive from them, so media queries still win. */
	--ws-cols-desktop: 6;
	--ws-cols-tablet: 4;
	--ws-cols-mobile: 3;
	--ws-icon-base: 96px;
	--ws-gap-base: 26px;

	--ws-cols: var(--ws-cols-desktop);
	--ws-icon: var(--ws-icon-base);
	--ws-gap: var(--ws-gap-base);

	--ws-rows: 2;
	--ws-radius: 14px;
	--ws-stage-h: 560px;
	--ws-max-w: 1180px;
	--ws-duration: 480ms;
	--ws-ease: cubic-bezier(0.32, 0.72, 0, 1);
	--ws-label-h: 30px;
	--ws-cell-h: calc(var(--ws-icon) + var(--ws-label-h));

	box-sizing: border-box;
	max-width: var(--ws-max-w);
	margin-inline: auto;
	width: 100%;
}

.ws-showcase.ws-no-labels {
	--ws-label-h: 0px;
}

.ws-showcase *,
.ws-showcase *::before,
.ws-showcase *::after {
	box-sizing: border-box;
}

/* ---------- Theme hardening ----------
   Themes style bare `button` elements (often as `.some-wrapper button:hover`,
   which out-specifies a single class). Every button in the showcase is a
   layout element whose visuals live on a child, so strip theme styling from
   all of them in every state before the plugin paints its own. */

.ws-showcase button,
.ws-showcase button:hover,
.ws-showcase button:focus,
.ws-showcase button:active,
.ws-showcase button:focus-visible,
.ws-showcase button:focus-within {
	border: 0;
	border-radius: 0;
	box-shadow: none;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	text-shadow: none;
	min-width: 0;
	min-height: 0;
	filter: none;
	-webkit-appearance: none;
	appearance: none;
}

/* The icon tiles paint themselves on .ws-icon, so the button stays fully
   transparent — worth !important, since a theme hover background here is
   what shows up as a dark blob behind the tile and its label. */
.ws-showcase button.ws-item,
.ws-showcase button.ws-item:hover,
.ws-showcase button.ws-item:focus,
.ws-showcase button.ws-item:active,
.ws-showcase button.ws-item:focus-visible {
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	color: var(--ws-text);
	outline: none;
	padding: 0;
	margin: 0;
	line-height: inherit;
	transform: none;
}

/* ---------- Theme tokens ---------- */

.ws-theme-dark {
	--ws-chrome: #1b1b1d;
	--ws-chrome-2: #2a2a2d;
	--ws-screen: #202124;
	--ws-tile: #2c2c2f;
	--ws-tile-hover: #3a3a3f;
	--ws-text: #e8eaed;
	--ws-text-dim: #9aa0a6;
	--ws-line: rgba(255, 255, 255, 0.08);
	--ws-accent: #8ab4f8;
	--ws-dot-color: #4c4f55;
	--ws-shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
}

.ws-theme-light {
	--ws-chrome: #dee1e6;
	--ws-chrome-2: #f1f3f4;
	--ws-screen: #ffffff;
	--ws-tile: #f1f3f4;
	--ws-tile-hover: #e4e7ea;
	--ws-text: #202124;
	--ws-text-dim: #5f6368;
	--ws-line: rgba(0, 0, 0, 0.08);
	--ws-accent: #1a73e8;
	--ws-dot-color: #c8ccd0;
	--ws-shadow: 0 26px 60px rgba(60, 64, 67, 0.22);
}

/* ---------- Browser mockup ---------- */

.ws-browser {
	border-radius: 12px;
	overflow: hidden;
	background: var(--ws-chrome);
	box-shadow: var(--ws-shadow);
}

.ws-no-chrome .ws-browser {
	background: var(--ws-screen);
}

.ws-titlebar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px 0;
	background: var(--ws-chrome);
}

.ws-dots {
	display: flex;
	gap: 7px;
	padding: 0 6px 8px 4px;
}

.ws-dots i {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #febc2e;
}

.ws-dots i:first-child {
	background: #ff5f57;
}

.ws-dots i:last-child {
	background: #28c840;
}

.ws-tab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-width: 160px;
	max-width: 240px;
	flex: 1 1 200px;
	height: 34px;
	padding: 0 10px;
	border-radius: 8px 8px 0 0;
	background: var(--ws-chrome-2);
	color: var(--ws-text-dim);
	font-size: 12px;
	line-height: 1;
	overflow: hidden;
}

.ws-tab-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ws-tab-close .ws-svg {
	width: 12px;
	height: 12px;
	flex: none;
}

.ws-newtab {
	color: var(--ws-text-dim);
	font-size: 18px;
	line-height: 1;
	padding-bottom: 10px;
}

.ws-toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	background: var(--ws-chrome-2);
	border-bottom: 1px solid var(--ws-line);
}

.ws-showcase .ws-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	flex: none;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ws-text-dim);
	cursor: pointer;
	transition: background-color 140ms ease, color 140ms ease;
}

.ws-btn-static {
	cursor: default;
	opacity: 0.55;
}

.ws-showcase button.ws-btn:hover,
.ws-showcase button.ws-btn:focus-visible {
	background: rgba(127, 127, 127, 0.18);
	color: var(--ws-text);
	outline: none;
}

.ws-svg {
	width: 17px;
	height: 17px;
	display: block;
}

.ws-omnibox {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
	height: 32px;
	margin: 0 8px;
	padding: 0 14px;
	border-radius: 999px;
	background: rgba(127, 127, 127, 0.22);
	color: var(--ws-text-dim);
	font-size: 13px;
}

.ws-omnibox .ws-svg {
	width: 15px;
	height: 15px;
	flex: none;
}

.ws-omni-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Stage ---------- */

.ws-stage {
	position: relative;
	height: var(--ws-stage-h);
	max-height: 85vh;
	overflow: hidden;
	background: var(--ws-screen);
	isolation: isolate;
}

/* ---------- Home screen ---------- */

.ws-home-screen {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(24px, 5vh, 56px);
	padding: 28px 24px;
	transition: transform var(--ws-duration) var(--ws-ease),
		opacity calc(var(--ws-duration) * 0.6) ease,
		filter var(--ws-duration) var(--ws-ease);
	will-change: transform, opacity;
}

.ws-showcase.is-open .ws-home-screen,
.ws-showcase.is-animating .ws-home-screen {
	transform: scale(1.14);
	opacity: 0;
	filter: blur(4px);
	pointer-events: none;
}

.ws-searchbar {
	display: flex;
	align-items: center;
	gap: 12px;
	width: min(520px, 100%);
	height: 46px;
	padding: 0 18px;
	border-radius: 999px;
	background: rgba(127, 127, 127, 0.28);
	color: var(--ws-text-dim);
	flex: none;
}

.ws-searchbar .ws-svg {
	width: 18px;
	height: 18px;
	flex: none;
}

/* Themes love to add padding/margin/line-height to inputs, which pushes the
   placeholder off-centre inside the pill. Reset it all and let flex centre it. */
.ws-search-input,
.ws-showcase input[type="search"].ws-search-input {
	flex: 1 1 auto;
	min-width: 0;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--ws-text);
	font-size: 15px;
	font-family: inherit;
	line-height: 1.2;
	vertical-align: middle;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.ws-search-input::placeholder {
	color: var(--ws-text-dim);
	opacity: 1;
}

.ws-grid-wrap {
	width: 100%;
	max-width: calc(
		var(--ws-cols) * var(--ws-icon) + (var(--ws-cols) - 1) * var(--ws-gap) + 24px
	);
	min-height: 0;
}

/* The grid pages horizontally, one screenful of icons at a time, exactly like
   an iOS home screen. JS chunks the items into .ws-page wrappers on load and
   whenever the column count changes. The native scrollbar is hidden — the
   liquid dots below are the affordance. */
.ws-grid {
	display: flex;
	align-items: flex-start;

	height: calc(
		var(--ws-rows) * var(--ws-cell-h) + (var(--ws-rows) - 1) * var(--ws-gap) + 8px
	);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	padding: 4px 0;

	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ws-grid::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

.ws-page {
	flex: 0 0 100%;
	width: 100%;
	display: grid;
	grid-template-columns: repeat(var(--ws-cols), minmax(0, 1fr));
	grid-auto-rows: var(--ws-cell-h);
	gap: var(--ws-gap);
	justify-items: center;
	align-content: start;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

/* ---------- Liquid page dots ---------- */

.ws-pager {
	display: flex;
	justify-content: center;
	margin-top: 20px;
	flex: none;
}

.ws-pager[hidden] {
	display: none;
}

.ws-dots {
	--ws-dot: 9px;
	--ws-dot-gap: 14px;

	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 20px;
}

/* No SVG goo filter here on purpose: a compositor-promoted child inside a
   filtered element renders as an opaque black box in Chrome. The liquid read
   comes from the blob stretching far enough to bridge the gap instead. */
.ws-dots-goo {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--ws-dot-gap);
	pointer-events: none;
}

.ws-dot-bg {
	display: block;
	width: var(--ws-dot);
	height: var(--ws-dot);
	flex: none;
	border-radius: 50%;
	background: var(--ws-dot-color);
	transition: background-color 240ms ease;
}

.ws-dot-blob {
	position: absolute;
	left: 0;
	top: 50%;
	width: var(--ws-dot);
	height: var(--ws-dot);
	margin-top: calc(var(--ws-dot) / -2);
	border-radius: 50%;
	background: var(--ws-accent);
	transform-origin: 50% 50%;
	transition: transform var(--ws-duration) var(--ws-ease);
	will-change: transform;
}

/* Unfiltered hit targets sit on top so focus rings stay crisp. */
.ws-dots-hit {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	gap: var(--ws-dot-gap);
}

/* These are invisible hit targets layered over the dots — a theme hover
   background here paints a dark square straight over the blob, so pin every
   state transparent the same way the icon tiles are pinned. */
.ws-showcase .ws-dot,
.ws-showcase .ws-dot:hover,
.ws-showcase .ws-dot:focus,
.ws-showcase .ws-dot:active,
.ws-showcase .ws-dot:focus-visible {
	position: relative;
	display: block;
	width: var(--ws-dot);
	height: var(--ws-dot);
	flex: none;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	cursor: pointer;
}

/* Comfortable tap target without disturbing the dot rhythm. */
.ws-showcase .ws-dot::before {
	content: "";
	position: absolute;
	inset: -7px calc(var(--ws-dot-gap) / -2);
}

.ws-showcase .ws-dot:focus-visible {
	outline: 2px solid var(--ws-accent);
	outline-offset: 4px;
}

.ws-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 100%;
	max-width: calc(var(--ws-icon) + 28px);
	height: var(--ws-cell-h);
	padding: 0;
	border: 0;
	background: none;
	color: var(--ws-text);
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.ws-item[hidden] {
	display: none;
}

.ws-icon {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	/* min() keeps the tile inside its column when the container is narrower
	   than columns x icon size, instead of overlapping its neighbours. */
	width: min(var(--ws-icon), 100%);
	aspect-ratio: 1 / 1;
	height: auto;
	flex: none;
	border-radius: var(--ws-radius);
	background: var(--ws-tile);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	transition: transform 220ms var(--ws-ease), background-color 180ms ease,
		box-shadow 220ms ease;
	will-change: transform;
}

.ws-icon img {
	width: 58%;
	height: 58%;
	object-fit: contain;
	display: block;
	pointer-events: none;
}

.ws-icon-letter {
	font-size: calc(var(--ws-icon) * 0.4);
	font-weight: 600;
	color: var(--ws-text);
	line-height: 1;
}

.ws-item:hover .ws-icon,
.ws-item:focus-visible .ws-icon {
	transform: translateY(-3px) scale(1.04);
	background: var(--ws-tile-hover);
}

.ws-item:active .ws-icon {
	transform: scale(0.94);
}

.ws-item:focus-visible {
	outline: none;
}

.ws-item:focus-visible .ws-icon {
	box-shadow: 0 0 0 3px var(--ws-accent);
}

.ws-label {
	font-size: 13px;
	line-height: 1.4;
	color: var(--ws-text);
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ws-no-results {
	margin: 18px 0 0;
	text-align: center;
	color: var(--ws-text-dim);
	font-size: 14px;
}

/* ---------- Opened website ---------- */

.ws-app {
	position: absolute;
	inset: 0;
	z-index: 3;
	background: var(--ws-screen);
	opacity: 0;
	visibility: hidden;
	transition: opacity 160ms ease, visibility 0s linear 160ms;
}

.ws-app.is-visible {
	opacity: 1;
	visibility: visible;
	transition: opacity 200ms ease, visibility 0s;
}

.ws-frame {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: var(--ws-screen);
}

.ws-external {
	position: absolute;
	right: 16px;
	bottom: 16px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 15px;
	border-radius: 999px;
	background: rgba(20, 20, 22, 0.82);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	text-decoration: none;
	backdrop-filter: blur(6px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
	transition: transform 160ms var(--ws-ease), background-color 160ms ease;
}

.ws-external:hover,
.ws-external:focus-visible {
	transform: translateY(-2px);
	background: rgba(20, 20, 22, 0.95);
	color: #fff;
}

.ws-external .ws-svg {
	width: 15px;
	height: 15px;
}

.ws-hint {
	position: absolute;
	left: 50%;
	bottom: 68px;
	transform: translateX(-50%);
	width: min(420px, calc(100% - 32px));
	padding: 16px 18px;
	border-radius: 14px;
	background: rgba(20, 20, 22, 0.92);
	color: #fff;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(8px);
	font-size: 13.5px;
	line-height: 1.5;
}

.ws-hint[hidden] {
	display: none;
}

.ws-hint p {
	margin: 0 0 6px;
}

.ws-hint-title {
	font-weight: 600;
}

.ws-hint-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 12px 0 0;
}

.ws-hint-open {
	color: #8ab4f8;
	text-decoration: underline;
}

.ws-showcase .ws-hint-dismiss,
.ws-showcase .ws-hint-dismiss:hover,
.ws-showcase .ws-hint-dismiss:focus {
	border: 0;
	background: none;
	padding: 0;
	color: rgba(255, 255, 255, 0.65);
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
}

.ws-showcase .ws-floating-home {
	position: absolute;
	left: 16px;
	top: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(20, 20, 22, 0.82);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(6px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
	transition: transform 160ms var(--ws-ease), background-color 160ms ease;
}

.ws-showcase .ws-floating-home:hover,
.ws-showcase .ws-floating-home:focus-visible {
	transform: scale(1.06);
	background: rgba(20, 20, 22, 0.95);
}

/* ---------- iOS-style morphing layer ---------- */

.ws-morph {
	position: absolute;
	z-index: 5;
	display: none;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: var(--ws-tile);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	transform: translateZ(0);
}

.ws-morph.is-active {
	display: flex;
}

.ws-morph.is-animating {
	transition: left var(--ws-duration) var(--ws-ease),
		top var(--ws-duration) var(--ws-ease),
		width var(--ws-duration) var(--ws-ease),
		height var(--ws-duration) var(--ws-ease),
		border-radius var(--ws-duration) var(--ws-ease),
		background-color var(--ws-duration) var(--ws-ease);
}

.ws-morph-icon {
	width: 58%;
	height: 58%;
	max-width: 160px;
	max-height: 160px;
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	transition: opacity calc(var(--ws-duration) * 0.55) ease,
		transform var(--ws-duration) var(--ws-ease);
}

.ws-morph.is-expanding .ws-morph-icon {
	opacity: 0;
	transform: scale(2.1);
}

.ws-morph.is-collapsing .ws-morph-icon {
	opacity: 1;
	transform: scale(1);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
	.ws-showcase {
		--ws-cols: var(--ws-cols-tablet);
		--ws-icon: calc(var(--ws-icon-base) * 0.82);
		--ws-gap: calc(var(--ws-gap-base) * 0.78);
	}
}

@media (max-width: 600px) {
	.ws-showcase {
		--ws-cols: var(--ws-cols-mobile);
		--ws-icon: calc(var(--ws-icon-base) * 0.68);
		--ws-gap: calc(var(--ws-gap-base) * 0.6);
		--ws-label-h: 26px;
	}

	.ws-stage {
		height: min(var(--ws-stage-h), 70vh);
	}

	.ws-label {
		font-size: 11.5px;
	}

	.ws-toolbar {
		gap: 2px;
		padding: 6px 8px;
	}

	.ws-btn {
		width: 26px;
		height: 26px;
	}

	.ws-omnibox {
		margin: 0 4px;
		height: 28px;
		font-size: 11.5px;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.ws-showcase {
		--ws-duration: 1ms;
	}

	.ws-home-screen,
	.ws-icon,
	.ws-morph,
	.ws-morph-icon,
	.ws-external,
	.ws-floating-home,
	.ws-dot-blob,
	.ws-dot-bg {
		transition-duration: 1ms !important;
	}

	.ws-showcase.is-open .ws-home-screen,
	.ws-showcase.is-animating .ws-home-screen {
		filter: none;
		transform: none;
	}

	.ws-grid {
		scroll-behavior: auto;
	}
}

/* ---------- Admin-only empty notice ---------- */

.ws-empty-notice {
	padding: 14px 18px;
	border-left: 4px solid #dba617;
	background: #fcf9e8;
	color: #1d2327;
}

/* ---------- Screen reader helper (themes usually ship this, but not always) ---------- */

.ws-showcase .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
