/* The domain name search of a page, its results in place (Zion_Portal_Domain_Live, 0.8.7): the
   look of the block « Domain availability check » of LRob Toolkit (blocks/domain-picker/style.css,
   the reference chosen), its classes renamed; added: the price, « Added » and
   « Remove », the cart's line, the waiting cards. Theme-aware: colours from currentColor, the
   theme's buttons. */

.zion-portal-picker {
	--zion-portal-picker-border: color-mix(in srgb, currentColor 25%, transparent);
	--zion-portal-picker-faint: color-mix(in srgb, currentColor 8%, transparent);
	--zion-portal-picker-surface: color-mix(in srgb, currentColor 4%, transparent);
	--zion-portal-picker-success: #28a745;
	--zion-portal-picker-danger: #e5484d;
	--zion-portal-picker-muted: color-mix(in srgb, currentColor 60%, transparent);
	box-sizing: border-box;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	color: inherit;
	position: relative;
}
.zion-portal-picker *, .zion-portal-picker *::before, .zion-portal-picker *::after { box-sizing: border-box; }
.zion-portal-picker.alignwide, .zion-portal-picker.alignfull { max-width: none; }

/* ---- intro + form ---- */
.zion-portal-picker-intro { margin: 0 0 16px; font-size: 1.05em; text-align: center; color: var(--zion-portal-picker-muted); }
.zion-portal-picker-form { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 0 0 24px; }
.zion-portal-picker .zion-portal-picker-input {
	flex: 1 1 320px;
	max-width: 480px;
	padding: 12px 16px;
	border: 2px solid var(--zion-portal-picker-border);
	border-radius: 6px;
	font-size: 16px;
	background: transparent;
	color: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.zion-portal-picker .zion-portal-picker-input:focus { outline: none; border-color: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
/* The small cross that empties the field (assets/search-clear.js): inside it, on its right, while it holds something. */
.zion-portal-search-clear { position: absolute; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -14px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: 0.65; cursor: pointer; }
.zion-portal-search-clear:hover, .zion-portal-search-clear:focus-visible { background: color-mix(in srgb, currentColor 12%, transparent); opacity: 1; }
.zion-portal-search-clear[hidden] { display: none; }
.zion-portal-picker .zion-portal-picker-input.has-clear { padding-right: 40px; }
.zion-portal-picker-button { cursor: pointer; }

/* ---- error + results ---- */
.zion-portal-picker-error {
	background: color-mix(in srgb, #dc3545 12%, transparent);
	border: 1px solid color-mix(in srgb, #dc3545 50%, transparent);
	border-radius: 6px;
	padding: 16px;
	margin: 16px 0;
	color: #dc3545;
	text-align: center;
}
.zion-portal-picker-results-title { margin: 0 0 6px; font-size: 1.05em; }

/* The cart a line away (0.8.5): how many names, the way to the cart. */
.zion-portal-picker .zion-portal-picker-cart-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 8px 0 12px;
	padding: 10px 14px;
	border: 1px solid var(--zion-portal-picker-success);
	border-radius: 8px;
	background: var(--zion-portal-picker-surface);
}
.zion-portal-picker-cart-line > span:not(.wp-block-button) { flex: 1 1 12rem; font-weight: 600; }
.zion-portal-picker-cart-line > .zion-portal-icon { color: var(--zion-portal-picker-success); flex: none; }

/* ---- card grid (unified vertical stacked layout) ---- */
.zion-portal-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 8px; }
/* The groups (searched, free, other names, taken) keep their order; their cards share the grid. */
.zion-portal-picker-group { display: contents; }
.zion-portal-picker-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 14px 12px;
	border: 1px solid var(--zion-portal-picker-border);
	border-radius: 8px;
	background: var(--zion-portal-picker-surface);
	transition: transform 0.15s ease-out, border-color 0.15s ease-out, box-shadow 0.15s ease-out;
	min-width: 0;
	animation: zion-portal-picker-open 0.24s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
/* A card given again (added, removed): no opening. */
.zion-portal-picker-card.is-settled { animation: none; }
.zion-portal-picker-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, currentColor 45%, transparent); box-shadow: 0 3px 10px color-mix(in srgb, currentColor 8%, transparent); }
.zion-portal-picker-card.is-added { border-color: var(--zion-portal-picker-success); }

/* The name searched: the same structure, the whole width and a bit larger. */
.zion-portal-picker-card.is-searched {
	grid-column: 1 / -1;
	gap: 8px;
	padding: 18px 16px;
	border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
	background: color-mix(in srgb, currentColor 4%, var(--zion-portal-picker-surface));
}
.zion-portal-picker-card.is-searched.is-added { border-color: var(--zion-portal-picker-success); }

.zion-portal-picker-head { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.5em; font-weight: 700; line-height: 1.1; flex-wrap: wrap; }
.zion-portal-picker-card.is-searched .zion-portal-picker-head { font-size: 2em; gap: 12px; }
.zion-portal-picker-status { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; }
/* Thin pictograms of the site (0.8.8): green when free, red when taken. */
.zion-portal-picker-status .zion-portal-icon { width: 0.95em; height: 0.95em; stroke-width: 1.6; }
.zion-portal-picker-card.is-available .zion-portal-picker-status { color: var(--zion-portal-picker-success); }
.zion-portal-picker-card.is-taken .zion-portal-picker-status { color: var(--zion-portal-picker-danger); }
.zion-portal-picker-card.is-unknown .zion-portal-picker-status { color: var(--zion-portal-picker-muted); }
.zion-portal-picker-ext { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.zion-portal-picker-state { font-size: 0.9em; font-weight: 600; }
.zion-portal-picker-card.is-searched .zion-portal-picker-state { font-size: 1.05em; }
.zion-portal-picker-card.is-available .zion-portal-picker-state { color: var(--zion-portal-picker-success); }
.zion-portal-picker-card.is-taken .zion-portal-picker-state, .zion-portal-picker-card.is-waiting .zion-portal-picker-state { color: var(--zion-portal-picker-muted); }
.zion-portal-picker-domain-full { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8em; opacity: 0.7; word-break: break-all; }
.zion-portal-picker-price { font-size: 0.95em; font-variant-numeric: tabular-nums; }
.zion-portal-picker-card.is-searched .zion-portal-picker-price { font-size: 1.1em; font-weight: 600; }
.zion-portal-picker-card.is-taken .zion-portal-picker-price { color: var(--zion-portal-picker-muted); }

/* « Your search »: a pill centred above the head. */
.zion-portal-picker-tag {
	align-self: center;
	padding: 3px 12px;
	background: color-mix(in srgb, currentColor 14%, transparent);
	color: inherit;
	border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
	font-size: 0.7em;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	border-radius: 999px;
	white-space: nowrap;
	width: max-content;
	margin: 0 auto 2px;
}

/* The action: the theme's button (Button block markup), left as the theme draws it. */
.zion-portal-picker-card > .wp-block-button { margin-top: 4px; }
.zion-portal-picker-action { cursor: pointer; white-space: nowrap; }
.zion-portal-picker-added { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; margin-top: 4px; }
.zion-portal-picker-added-label { display: inline-flex; align-items: center; gap: 4px; color: var(--zion-portal-picker-success); font-weight: 600; }
.zion-portal-picker .zion-portal-picker-remove { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.zion-portal-picker [aria-busy="true"].zion-portal-picker-action, .zion-portal-picker [aria-busy="true"].zion-portal-picker-remove { opacity: 0.6; cursor: progress; }

/* Waiting: a card per name asked, until its answer. */
.zion-portal-picker-spinner {
	display: inline-block;
	width: 0.8em;
	height: 0.8em;
	border: 3px solid var(--zion-portal-picker-border);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: zion-portal-picker-spin 1s linear infinite;
}
.zion-portal-picker-card.is-waiting { opacity: 0.75; }
.zion-portal-picker-card.is-waiting:hover { transform: none; box-shadow: none; border-color: var(--zion-portal-picker-border); }
@keyframes zion-portal-picker-spin { to { transform: rotate(360deg); } }

/* ---- animations ----
   A card opens softly as it arrives (its delay set by the script when several arrive
   together); the results' height follows them (assets/domain-live.js). */
@keyframes zion-portal-picker-open { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

/* The page's cover behind the search (0.8.8): once results show, its image keeps the
   height it had before them, faded at its foot, instead of stretching with the box. */
.wp-block-cover[data-zion-picker-frozen] > :is(.wp-block-cover__image-background, .wp-block-cover__video-background) {
	bottom: auto;
	height: var(--zion-portal-cover-height, 100%);
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 160px), transparent);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 160px), transparent);
}

@media (prefers-reduced-motion: reduce) {
	.zion-portal-picker-card { animation: none; }
	.zion-portal-picker-card, .zion-portal-picker-card:hover { transition: none; transform: none; box-shadow: none; }
	.zion-portal-picker-spinner { animation: none; }
}

/* ---- responsive ---- */
@media (max-width: 768px) {
	.zion-portal-picker { padding: 15px; }
	.zion-portal-picker-form { flex-direction: column; align-items: stretch; }
	.zion-portal-picker .zion-portal-picker-input { flex: initial; width: 100%; max-width: none; padding: 10px 12px; }
	.zion-portal-picker-form > .wp-block-button > button { width: 100%; }
	.zion-portal-picker-grid { grid-template-columns: 1fr; }
	.zion-portal-picker-card > .wp-block-button, .zion-portal-picker-card > .wp-block-button > button { width: 100%; }
}
