/**
 * MY AI FASHION STUDIO — Virtual Try-On storefront.
 *
 * Ported from Noemi Customer Portal Pro (assets/frontend/css/tryon.css).
 *
 * This sheet runs inside an UNKNOWN theme, so it plays by three rules:
 *   1. every selector is prefixed `aifg-vto-` and nothing here styles a bare
 *      element, a theme class or a global — no resets, no `*`, no `body`;
 *   2. it is self-sufficient: the storefront is not inside `.aifg-app`, so the
 *      design tokens are declared locally on our own roots;
 *   3. direction comes from logical properties only, so Hebrew RTL and English
 *      LTR share one rule set.
 *
 * `!important` appears in three places only, each justified in a comment where
 * it is used, and all three are the same fight: a theme's rules for `a` and
 * `button` are several classes deep, so they beat a single-class selector of
 * ours on specificity alone. It is confined to the entry point's `display`, the
 * on-image overlay's geometry and colour, and the modal buttons' colour and
 * text-decoration. Nothing else, and never for layout inside our own markup.
 *
 * @package MyAIStudio
 * @since   3.6.0
 */

/* ============================================================
 * Tokens — declared on our own roots, never on :root
 * ============================================================ */
.aifg-vto-modal,
.aifg-vto-panel,
.aifg-vto-size,
.aifg-vto-open {
	--aifg-vto-ink: #1f2430;
	--aifg-vto-ink-soft: #5c6474;
	--aifg-vto-line: #e2e6ee;
	--aifg-vto-surface: #ffffff;
	--aifg-vto-surface-2: #f7f8fb;
	--aifg-vto-accent: #3c50e0;
	--aifg-vto-accent-ink: #ffffff;
	--aifg-vto-accent-soft: #eef1fd;
	--aifg-vto-good: #16794f;
	--aifg-vto-danger: #b3261e;
	--aifg-vto-radius: 14px;
	--aifg-vto-radius-sm: 10px;
	--aifg-vto-shadow: 0 18px 44px -18px rgba(20, 25, 40, .38);
	--aifg-vto-font: inherit;
	box-sizing: border-box;
}

.aifg-vto-modal *,
.aifg-vto-panel *,
.aifg-vto-size *,
.aifg-vto-host > .aifg-vto-open * {
	box-sizing: border-box;
}

.aifg-vto-i {
	display: inline-block;
	flex: 0 0 auto;
	vertical-align: -0.18em;
}

.aifg-vto-sr {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ============================================================
 * Entry point on the product page
 * ============================================================ */
.aifg-vto-open {
	/* `display` is forced, and nothing else in this rule is. A storefront theme
	   reliably sets `display: block` on links inside the product gallery — in
	   WooCommerce's own stylesheet it is
	   `.woocommerce div.product div.images .woocommerce-product-gallery__image a`,
	   four classes deep — and the sign-in variant of this entry point IS a link.
	   Without this the pill collapses into a full-width block and the icon sits
	   on its own line. One property, measured, not a blanket override. */
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-block: 10px;
	padding: 12px 20px;
	border: 1.5px solid var(--aifg-vto-ink);
	border-radius: 999px;
	background: var(--aifg-vto-ink);
	color: #fff;
	font: inherit;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}

.aifg-vto-open:hover,
.aifg-vto-open:focus-visible {
	background: #343c4e;
	border-color: #343c4e;
	color: #fff;
	text-decoration: none;
}

.aifg-vto-open:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 2px;
}

.aifg-vto-open:active {
	transform: scale(.985);
}

.aifg-vto-open--outline {
	background: transparent;
	color: var(--aifg-vto-ink);
}

.aifg-vto-open--outline:hover,
.aifg-vto-open--outline:focus-visible {
	background: var(--aifg-vto-ink);
	color: #fff;
}

.aifg-vto-open--ai {
	border: 0;
	background: linear-gradient(120deg, #3c50e0, #7c3aed, #c026d3);
	background-size: 220% 220%;
	color: #fff;
	animation: aifg-vto-shift 5s ease infinite;
}

/* On-image overlay pill. The JS anchors the button into the largest product
   image's container and adds `.aifg-vto-host`; with no reliable host it strips
   the modifier and the button stays a normal in-flow pill. */
.aifg-vto-host {
	position: relative;
}

/* The overlay sits INSIDE the theme's gallery markup, where theme rules are
   several classes deep and reliably clobber a link's box. The source module hit
   the same wall and solved it the same way; the overrides are confined to this
   one variant's geometry and colour, and layout stays logical (no top/left). */
.aifg-vto-host > .aifg-vto-open--onimage {
	position: absolute !important;
	/* The nine placements below set the offsets; these two are the fallback for
	   a page rendered by a build older than 3.14.0, where no axis class exists. */
	inset-block-start: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-bs, 0px));
	inset-inline-start: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-is, 0px));
	z-index: 5;
	margin: 0 !important;
	padding: 10px 16px !important;
	max-inline-size: calc(100% - 84px); /* stay clear of a theme's zoom control */
	overflow: hidden;
	border: 1.5px solid rgba(31, 36, 48, .14) !important;
	border-radius: 999px !important;
	background: rgba(255, 255, 255, .95) !important;
	color: var(--aifg-vto-ink) !important;
	font-size: 13px;
	white-space: nowrap;
	text-overflow: ellipsis;
	box-shadow: 0 8px 22px -10px rgba(20, 25, 40, .4);
	backdrop-filter: blur(6px);
}

.aifg-vto-host > .aifg-vto-open--onimage:hover,
.aifg-vto-host > .aifg-vto-open--onimage:focus-visible {
	background: var(--aifg-vto-ink) !important; /* see the note above */
	border-color: var(--aifg-vto-ink) !important;
	color: #fff !important;
}

.aifg-vto-host > .aifg-vto-open--onimage.aifg-vto-open--ai {
	border: 0 !important; /* see the note above */
	background: linear-gradient(120deg, #3c50e0, #7c3aed, #c026d3) !important;
	color: #fff !important;
}

/* ---- The nine placements ------------------------------------------------
   Three inline positions × three block positions, each measured against the
   PHOTO rather than against the host box. A theme routinely makes that box
   taller or wider than the picture — an AI-disclosure strip, a thumbnail rail,
   a caption, letterboxing — and offsetting from the host would drop the pill
   onto the band instead of onto the garment. The script publishes the slack at
   each of the four edges and the stylesheet adds its own gap to it.

   Centring is done with `inset-inline: … ; margin-inline: auto` and not with a
   translate, because `translateX` is physical: the sign that centres a box in
   an English shop pushes it off the photo in a Hebrew one. Both offsets and a
   `fit-content` size centre correctly in either direction, with no arithmetic
   that has to know which way the page runs. ---------------------------- */

.aifg-vto-host > .aifg-vto-open--x-start {
	inset-inline-start: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-is, 0px));
	inset-inline-end: auto;
}

.aifg-vto-host > .aifg-vto-open--x-end {
	inset-inline-start: auto;
	inset-inline-end: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-ie, 0px));
}

.aifg-vto-host > .aifg-vto-open--x-center {
	inset-inline-start: var(--aifg-vto-slack-is, 0px);
	inset-inline-end: var(--aifg-vto-slack-ie, 0px);
	inline-size: fit-content;
	margin-inline: auto !important;
}

.aifg-vto-host > .aifg-vto-open--y-top {
	inset-block-start: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-bs, 0px));
	inset-block-end: auto;
}

.aifg-vto-host > .aifg-vto-open--y-bottom {
	inset-block-start: auto;
	inset-block-end: calc(var(--aifg-vto-onimage-gap, 25px) + var(--aifg-vto-slack-be, 0px));
}

.aifg-vto-host > .aifg-vto-open--y-middle {
	inset-block-start: var(--aifg-vto-slack-bs, 0px);
	inset-block-end: var(--aifg-vto-slack-be, 0px);
	block-size: fit-content;
	margin-block: auto !important;
}

/* Away from the top edge there is no zoom control to avoid, so the pill may
   use the full width between the gutters. */
.aifg-vto-host > .aifg-vto-open--onimage:not(.aifg-vto-open--y-top) {
	max-inline-size: calc(100% - 28px);
}

@media (max-width: 782px) {
	.aifg-vto-host > .aifg-vto-open--onimage {
		--aifg-vto-onimage-gap: 14px;
		padding: 8px 13px !important; /* see the note on the base rule */
		font-size: 12.5px;
	}

	.aifg-vto-host > .aifg-vto-open--onimage:not(.aifg-vto-open--y-top) {
		max-inline-size: calc(100% - 20px);
	}
}

/* ============================================================
 * Size advisor above add-to-cart
 * ============================================================ */
.aifg-vto-size {
	display: flex;
	align-items: center;
	gap: 11px;
	margin-block: 10px 16px;
	padding: 12px 15px;
	border: 1.5px solid var(--aifg-vto-line);
	border-radius: var(--aifg-vto-radius);
	background: var(--aifg-vto-surface-2);
	color: var(--aifg-vto-ink);
	font-size: 14px;
	line-height: 1.4;
}

.aifg-vto-size > .aifg-vto-i {
	color: var(--aifg-vto-accent);
}

.aifg-vto-size__chip {
	display: inline-grid;
	place-items: center;
	min-inline-size: 36px;
	block-size: 34px;
	padding-inline: 9px;
	border-radius: var(--aifg-vto-radius-sm);
	background: var(--aifg-vto-ink);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
}

.aifg-vto-size__text {
	display: grid;
	gap: 1px;
	min-inline-size: 0;
}

.aifg-vto-size__text > span {
	color: var(--aifg-vto-ink-soft);
	font-size: .86em;
}

/* ============================================================
 * Modal
 * ============================================================ */
.aifg-vto-modal {
	position: fixed;
	inset: 0;
	z-index: 99990;
	display: grid;
	place-items: center;
	padding: 16px;
	font: var(--aifg-vto-font);
	color: var(--aifg-vto-ink);
	line-height: 1.5;
}

.aifg-vto-modal[hidden] {
	display: none;
}

.aifg-vto-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(18, 22, 33, .55);
	backdrop-filter: blur(3px);
}

.aifg-vto-dialog {
	position: relative;
	inline-size: min(460px, 100%);
	max-block-size: min(88vh, 860px);
	overflow: hidden; /* the body below is the scroll container, not this */
	padding: 24px 22px 20px;
	border-radius: 18px;
	background: var(--aifg-vto-surface);
	box-shadow: var(--aifg-vto-shadow);
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: center;
	text-align: center;
}

/* Only the body scrolls, so the title and the close button never scroll out of
   reach. The page itself never gains a scrollbar from this. */
.aifg-vto-dialog__body {
	inline-size: 100%;
	min-block-size: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: grid;
	gap: 14px;
	justify-items: center;
	padding-block-end: 2px;
}

.aifg-vto-x {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-end: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 36px;
	block-size: 36px;
	padding: 0;
	border: 1px solid var(--aifg-vto-line);
	border-radius: 50%;
	background: var(--aifg-vto-surface);
	color: var(--aifg-vto-ink);
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}

.aifg-vto-x:hover {
	background: var(--aifg-vto-surface-2);
}

.aifg-vto-x:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 2px;
}

.aifg-vto-dialog__head {
	flex: 0 0 auto;
	display: grid;
	gap: 6px;
	justify-items: center;
	padding-inline-end: 34px; /* room for the close button in both directions */
	inline-size: 100%;
}

.aifg-vto-dialog__title {
	margin: 0;
	font-size: 1.22em;
	font-weight: 700;
	line-height: 1.25;
	color: var(--aifg-vto-ink);
}

/* A product name and the customer's own note are real mixed-direction data: a
   Hebrew shop has English brand names in it and vice versa. `plaintext` lets
   each of those runs take its direction from its own first strong character.
   Translated UI strings are deliberately NOT in this list — they must follow
   the document direction, which is the locale's. */
.aifg-vto-card__note,
.aifg-vto-card__name {
	unicode-bidi: plaintext;
}

.aifg-vto-quota {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--aifg-vto-accent-soft);
	color: var(--aifg-vto-accent);
	font-size: 12.5px;
	font-weight: 600;
}

.aifg-vto-step {
	display: grid;
	gap: 12px;
	justify-items: center;
	inline-size: 100%;
}

.aifg-vto-step[hidden] {
	display: none;
}

.aifg-vto-lead {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}

.aifg-vto-hint {
	margin: 0;
	color: var(--aifg-vto-ink-soft);
	font-size: 12.5px;
	font-weight: 400;
}

.aifg-vto-status {
	margin: 0;
	min-block-size: 1.2em;
	color: var(--aifg-vto-danger);
	font-size: 13px;
	font-weight: 600;
}

.aifg-vto-status:empty {
	min-block-size: 0;
}

.aifg-vto-status.is-ok {
	color: var(--aifg-vto-good);
}

.aifg-vto-person {
	inline-size: 132px;
	block-size: 176px;
	object-fit: cover;
	border-radius: var(--aifg-vto-radius);
	background: var(--aifg-vto-surface-2);
}

/* --- Buttons: self-contained, because a theme styles `button` and `a` and
   wins on specificity inside our dialog. The `!important` below is limited to
   the properties a theme link/button reliably overrides (colour, decoration)
   and never to layout. --- */
.aifg-vto-modal .aifg-vto-btn,
.aifg-vto-panel .aifg-vto-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 12px 18px;
	border: 1.5px solid var(--aifg-vto-ink);
	border-radius: 12px;
	background: var(--aifg-vto-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}

.aifg-vto-modal a.aifg-vto-btn,
.aifg-vto-panel a.aifg-vto-btn,
.aifg-vto-modal a.aifg-vto-btn:visited,
.aifg-vto-panel a.aifg-vto-btn:visited {
	text-decoration: none !important; /* theme link underline reaches inside */
}

.aifg-vto-modal .aifg-vto-btn--primary,
.aifg-vto-panel .aifg-vto-btn--primary {
	color: #fff !important; /* theme `a`/`button` colour wins otherwise */
	background: var(--aifg-vto-ink);
	border-color: var(--aifg-vto-ink);
}

.aifg-vto-modal .aifg-vto-btn--primary:hover,
.aifg-vto-panel .aifg-vto-btn--primary:hover {
	background: #343c4e;
	border-color: #343c4e;
}

.aifg-vto-modal .aifg-vto-btn--ghost,
.aifg-vto-panel .aifg-vto-btn--ghost {
	color: var(--aifg-vto-ink) !important; /* same reason as above */
	background: var(--aifg-vto-surface);
}

.aifg-vto-modal .aifg-vto-btn--ghost:hover,
.aifg-vto-panel .aifg-vto-btn--ghost:hover {
	background: var(--aifg-vto-surface-2);
}

.aifg-vto-modal .aifg-vto-btn--sm,
.aifg-vto-panel .aifg-vto-btn--sm {
	padding: 8px 14px;
	font-size: 13px;
	border-radius: 10px;
}

.aifg-vto-modal .aifg-vto-btn:focus-visible,
.aifg-vto-panel .aifg-vto-btn:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 2px;
}

.aifg-vto-modal .aifg-vto-btn:active,
.aifg-vto-panel .aifg-vto-btn:active {
	transform: scale(.985);
}

.aifg-vto-modal .aifg-vto-btn[disabled],
.aifg-vto-panel .aifg-vto-btn[disabled] {
	opacity: .55;
	cursor: default;
}

.aifg-vto-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	inline-size: 100%;
}

.aifg-vto-actions--grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 9px;
}

/* Narrower padding than a standalone button, and the label is allowed to wrap:
   an ellipsis on a primary action ("Save to my war…") is worse than two lines. */
.aifg-vto-actions--grid .aifg-vto-btn {
	inline-size: 100%;
	min-inline-size: 0;
	padding-inline: 12px;
	line-height: 1.25;
	text-align: center;
}

.aifg-vto-actions--grid .aifg-vto-btn > span {
	min-inline-size: 0;
	overflow-wrap: break-word;
}

/* ============================================================
 * Generation stage
 * ============================================================ */
.aifg-vto-stage {
	position: relative;
	inline-size: min(220px, 72%);
	min-block-size: 60px;
	margin-block: 4px;
	border-radius: 16px;
	overflow: hidden;
	background: var(--aifg-vto-surface-2);
	box-shadow: 0 14px 32px -16px rgba(20, 25, 40, .38);
}

.aifg-vto-stage img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	animation: aifg-vto-breathe 3.2s ease-in-out infinite;
}

.aifg-vto-stage__beam {
	position: absolute;
	inset-inline: -12%;
	inset-block-start: -40%;
	block-size: 34%;
	background: linear-gradient(180deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(224, 231, 255, .55) 42%,
		rgba(60, 80, 224, .7) 50%,
		rgba(224, 231, 255, .55) 58%,
		rgba(255, 255, 255, 0) 100%);
	mix-blend-mode: screen;
	filter: blur(1px);
	animation: aifg-vto-scan 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
}

.aifg-vto-stage__glow {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	box-shadow: inset 0 0 0 2px rgba(60, 80, 224, .45), inset 0 0 24px rgba(60, 80, 224, .22);
	animation: aifg-vto-glow 2.4s ease-in-out infinite;
}

.aifg-vto-bar {
	inline-size: min(220px, 72%);
	block-size: 4px;
	border-radius: 999px;
	background: var(--aifg-vto-accent-soft);
	overflow: hidden;
}

.aifg-vto-bar > span {
	display: block;
	inline-size: 38%;
	block-size: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--aifg-vto-accent), #8fa0ff);
	animation: aifg-vto-slide 1.5s ease-in-out infinite;
}

@keyframes aifg-vto-scan {
	from { inset-block-start: -40%; }
	to { inset-block-start: 110%; }
}

@keyframes aifg-vto-breathe {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.03); }
}

@keyframes aifg-vto-glow {
	0%, 100% { opacity: .45; }
	50% { opacity: 1; }
}

@keyframes aifg-vto-slide {
	from { margin-inline-start: -40%; }
	to { margin-inline-start: 104%; }
}

@keyframes aifg-vto-shift {
	0%, 100% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
}

/* ============================================================
 * Result
 * ============================================================ */
.aifg-vto-result {
	inline-size: 100%;
	max-block-size: 48vh;
	object-fit: contain;
	border-radius: var(--aifg-vto-radius);
	background: var(--aifg-vto-surface-2);
}

.aifg-vto-reco {
	margin: 0;
	padding: 8px 14px;
	border-radius: 999px;
	background: rgba(22, 121, 79, .08);
	color: var(--aifg-vto-good);
	font-size: 13.5px;
	font-weight: 700;
}

.aifg-vto-reco[hidden] {
	display: none;
}

.aifg-vto-angles {
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

.aifg-vto-angles[hidden] {
	display: none;
}

.aifg-vto-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 16px;
	border: 1.5px solid var(--aifg-vto-ink);
	border-radius: 999px;
	background: var(--aifg-vto-surface);
	color: var(--aifg-vto-ink);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background .15s ease, color .15s ease, opacity .15s ease;
}

.aifg-vto-chip.is-on {
	background: var(--aifg-vto-ink);
	color: #fff;
}

.aifg-vto-chip[disabled] {
	opacity: .45;
	cursor: default;
}

.aifg-vto-chip__status {
	font-weight: 400;
}

/* Note editor, shared by the modal and the gallery cards */
.aifg-vto-noteform {
	display: grid;
	gap: 8px;
	inline-size: 100%;
	text-align: start;
}

.aifg-vto-noteform[hidden] {
	display: none;
}

.aifg-vto-noteform__label {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--aifg-vto-ink-soft);
}

.aifg-vto-noteform textarea {
	inline-size: 100%;
	padding: 9px 11px;
	border: 1.5px solid var(--aifg-vto-line);
	border-radius: var(--aifg-vto-radius-sm);
	background: var(--aifg-vto-surface);
	color: var(--aifg-vto-ink);
	font: inherit;
	font-size: 13.5px;
	line-height: 1.45;
	resize: vertical;
}

.aifg-vto-noteform textarea:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 1px;
}

.aifg-vto-noteform__actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* Inline destructive affordance — never window.confirm() */
.aifg-vto-danger {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	inline-size: 100%;
	padding-block-start: 4px;
	border-block-start: 1px solid var(--aifg-vto-line);
}

.aifg-vto-link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 4px;
	border: 0;
	background: none;
	color: var(--aifg-vto-ink-soft);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.aifg-vto-link:hover {
	color: var(--aifg-vto-ink);
}

.aifg-vto-link--danger {
	color: var(--aifg-vto-danger);
}

.aifg-vto-link:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 2px;
}

.aifg-vto-confirm {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12.5px;
	color: var(--aifg-vto-ink-soft);
}

.aifg-vto-confirm[hidden] {
	display: none;
}

/* ============================================================
 * Customer gallery (shortcode + My Account tab)
 * ============================================================ */
.aifg-vto-panel {
	display: grid;
	gap: 14px;
	color: var(--aifg-vto-ink);
	font-size: 15px;
	line-height: 1.5;
}

.aifg-vto-panel__title {
	margin: 0;
	font-size: 1.4em;
	font-weight: 700;
}

.aifg-vto-panel__hint {
	margin: 0;
	color: var(--aifg-vto-ink-soft);
	font-size: 13px;
}

.aifg-vto-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(168px, 100%), 1fr));
	gap: 14px;
}

.aifg-vto-card {
	display: grid;
	/* The name below is line-clamped with `-webkit-box`, whose min-content
	   contribution equals its max-content — so an implicit `auto` column is
	   floored at the untruncated title's width and the card clips its own
	   contents. An explicit `minmax(0, …)` lets the column shrink. */
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	gap: 0;
	margin: 0;
	border: 1.5px solid var(--aifg-vto-line);
	border-radius: var(--aifg-vto-radius);
	background: var(--aifg-vto-surface);
	overflow: hidden;
}

.aifg-vto-card.is-fav {
	border-color: var(--aifg-vto-accent);
	box-shadow: 0 0 0 1px var(--aifg-vto-accent-soft);
}

.aifg-vto-card__media {
	position: relative;
	aspect-ratio: 3 / 4;
	background: var(--aifg-vto-surface-2);
}

.aifg-vto-card__media img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.aifg-vto-card__angle {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(31, 36, 48, .82);
	color: #fff;
	font-size: 10.5px;
	font-weight: 600;
}

.aifg-vto-card__body {
	display: grid;
	gap: 6px;
	padding: 11px 12px 12px;
	text-align: start;
	min-inline-size: 0;
}

.aifg-vto-card__name {
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.aifg-vto-card__date {
	color: var(--aifg-vto-ink-soft);
	font-size: 11.5px;
}

.aifg-vto-card__note {
	margin: 0;
	color: var(--aifg-vto-ink);
	font-size: 12.5px;
	font-style: italic;
	overflow-wrap: anywhere;
}

.aifg-vto-card__note.is-empty {
	display: none;
}

.aifg-vto-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-block-start: 2px;
}

.aifg-vto-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 32px;
	block-size: 32px;
	padding: 0;
	border: 1.5px solid var(--aifg-vto-line);
	border-radius: 9px;
	background: var(--aifg-vto-surface);
	color: var(--aifg-vto-ink-soft);
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.aifg-vto-iconbtn:hover {
	background: var(--aifg-vto-surface-2);
	color: var(--aifg-vto-ink);
}

.aifg-vto-iconbtn:focus-visible {
	outline: 2px solid var(--aifg-vto-accent);
	outline-offset: 2px;
}

.aifg-vto-iconbtn[aria-pressed="true"] {
	border-color: var(--aifg-vto-accent);
	background: var(--aifg-vto-accent-soft);
	color: var(--aifg-vto-accent);
}

.aifg-vto-iconbtn--danger:hover {
	border-color: var(--aifg-vto-danger);
	color: var(--aifg-vto-danger);
}

.aifg-vto-card__status {
	min-block-size: 0;
	color: var(--aifg-vto-good);
	font-size: 11.5px;
	font-weight: 600;
}

.aifg-vto-card__status.is-error {
	color: var(--aifg-vto-danger);
}

.aifg-vto-card.is-gone {
	opacity: .35;
	pointer-events: none;
	transition: opacity .25s ease;
}

.aifg-vto-empty {
	display: grid;
	gap: 8px;
	justify-items: center;
	padding: 30px 20px;
	border: 1.5px dashed var(--aifg-vto-line);
	border-radius: var(--aifg-vto-radius);
	background: var(--aifg-vto-surface-2);
	text-align: center;
}

.aifg-vto-empty > .aifg-vto-i {
	color: var(--aifg-vto-ink-soft);
	opacity: .7;
}

.aifg-vto-empty__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

.aifg-vto-empty__text {
	margin: 0;
	max-inline-size: 42ch;
	color: var(--aifg-vto-ink-soft);
	font-size: 13.5px;
}

.aifg-vto-empty .aifg-vto-btn {
	margin-block-start: 4px;
}

/* ============================================================
 * Small screens — no horizontal page scroll at 390px
 * ============================================================ */
@media (max-width: 480px) {
	.aifg-vto-modal {
		padding: 10px;
		place-items: end center;
	}

	.aifg-vto-dialog {
		inline-size: 100%;
		max-block-size: 92vh;
		padding: 20px 16px 16px;
		border-radius: 16px;
	}

	.aifg-vto-actions--grid {
		grid-template-columns: 1fr;
	}

	.aifg-vto-result {
		max-block-size: 44vh;
	}

	.aifg-vto-grid {
		/* Two 144px tracks left the row of four 32px actions 4px short of
		   fitting, so the delete button dropped to a second row under every
		   card. One card per row at phone width. */
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
	}

	.aifg-vto-iconbtn {
		inline-size: 44px;
		block-size: 44px;
	}

	.aifg-vto-card__angle,
	.aifg-vto-card__date,
	.aifg-vto-card__status {
		font-size: 12px;
	}

	.aifg-vto-size {
		padding: 10px 12px;
		font-size: 13.5px;
	}
}

/* ============================================================
 * Reduced motion
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.aifg-vto-open,
	.aifg-vto-open--ai,
	.aifg-vto-stage img,
	.aifg-vto-stage__glow,
	.aifg-vto-bar > span,
	.aifg-vto-card.is-gone,
	.aifg-vto-modal .aifg-vto-btn,
	.aifg-vto-panel .aifg-vto-btn,
	.aifg-vto-chip,
	.aifg-vto-x,
	.aifg-vto-iconbtn {
		animation: none;
		transition: none;
	}

	.aifg-vto-stage__beam {
		display: none;
	}

	.aifg-vto-open:active,
	.aifg-vto-modal .aifg-vto-btn:active,
	.aifg-vto-panel .aifg-vto-btn:active {
		transform: none;
	}
}

/* ===== Block-theme fallback wrapper ======================================
   A block template has no `.summary` column, so the injected entry point
   carries its own spacing and never inherits the overlay geometry meant for
   the classic gallery. ================================================== */
.aifg-vto-blockfix {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-block: 14px 0;
}
.aifg-vto-blockfix .aifg-vto-open--onimage {
	position: static;
	inset: auto;
	align-self: flex-start;
}
