/**
 * Engraving Studio — design stage + controls (IMPLEMENTATION.md PR 20).
 *
 * Critical-path CSS: everything the server-rendered static stage needs before
 * any JavaScript runs. Zero-CLS rules: the stage sits in an aspect-ratio box
 * (inline style from PHP), every control row carries a min-height, and the
 * interactive module only ever mutates INSIDE those boxes.
 *
 * The three engraving fonts ship in ../fonts/ of THIS plugin (OFL 1.1 — see
 * ../fonts/README.md). latin + latin-ext subsets: full Romanian diacritic
 * coverage (ăâîșțĂÂÎȘȚ) in all three faces.
 */

/* --- Bundled engraving fonts (OFL 1.1, self-hosted in this plugin) --- */
@font-face {
	font-family: "ES Inter";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/inter-400-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "ES Inter";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/inter-400-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "ES Fraunces";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/fraunces-600-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "ES Fraunces";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/fraunces-600-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "ES Dancing Script";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/dancing-script-600-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "ES Dancing Script";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/dancing-script-600-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.es-font-modern {
	font-family: "ES Inter", sans-serif;
	font-weight: 400;
}

.es-font-clasic {
	font-family: "ES Fraunces", serif;
	font-weight: 600;
}

.es-font-caligrafic {
	font-family: "ES Dancing Script", cursive;
	font-weight: 600;
}

/* --- Stage --- */
.es {
	margin: 0 0 1.25em;
}

.es-stage {
	position: relative;
	width: 100%;
	max-width: 600px;
	overflow: hidden;
	border-radius: 8px;
	background: #f3f2f0;
	/* aspect-ratio comes inline from PHP (image ratio) => the box is fully
	   reserved before image/SVG/JS arrive: zero CLS. */
}

.es-stage__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.es-stage__svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	/* Scoped gesture ownership: page must not scroll/zoom from stage gestures
	   (mobile-first slider/preset UX — no drag handles anywhere). */
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.es-stage__backdrop {
	fill: #d8d5d0;
}

.es-zone {
	fill: none;
	stroke: rgba(255, 255, 255, 0.55);
	stroke-width: 1.5;
	stroke-dasharray: 6 6;
}

/* --- Engraved look per material --- */
.es-design {
	fill: currentColor;
}

.es-material-steel .es-design {
	color: #33363b; /* fiber-laser dark mark on steel */
	mix-blend-mode: multiply;
	opacity: 0.92;
}

.es-material-wood .es-design {
	color: #54301a; /* burn-brown on wood */
	mix-blend-mode: multiply;
	opacity: 0.9;
}

.es-design--ghost {
	opacity: 0.45;
}

.es-text {
	letter-spacing: 0.02em;
}

/* --- Controls --- */
.es-controls {
	margin-top: 0.9em;
	max-width: 600px;
}

.es-field {
	margin: 0 0 0.85em;
	min-height: 2.4em; /* reserved even while JS swaps content: zero CLS */
	border: 0;
	padding: 0;
}

.es-field__label {
	display: block;
	font-size: 0.85em;
	font-weight: 600;
	margin-bottom: 0.25em;
}

.es-field__input,
.es-field__font {
	width: 100%;
	max-width: 24em;
	min-height: 2.4em;
	padding: 0.35em 0.6em;
	border: 1px solid #c8c4bd;
	border-radius: 6px;
	font-size: 1em;
}

.es-field__count {
	display: inline-block;
	min-width: 3.5em;
	margin-left: 0.5em;
	font-size: 0.8em;
	opacity: 0.7;
}

/* Chips (layout + arc presets) */
.es-chips {
	display: block;
}

.es-chip {
	display: inline-block;
	margin: 0 0.4em 0.4em 0;
	cursor: pointer;
}

.es-chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.es-chip span {
	display: inline-block;
	min-height: 2.4em;
	line-height: 1.3;
	padding: 0.5em 0.9em;
	border: 1px solid #c8c4bd;
	border-radius: 999px;
	font-size: 0.9em;
	background: #fff;
}

.es-chip input:checked + span {
	border-color: #1e1c1a;
	background: #1e1c1a;
	color: #fff;
}

.es-chip input:focus-visible + span {
	outline: 2px solid #1e1c1a;
	outline-offset: 2px;
}

/* Symbol picker */
.es-symbol-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-height: 2.6em;
	padding: 0.4em 0.9em;
	border: 1px solid #c8c4bd;
	border-radius: 6px;
	background: #fff;
	color: #1e1c1a; /* explicit: themes often style button text white */
	cursor: pointer;
	font-size: 0.95em;
}

.es-symbol-toggle__preview {
	display: inline-block;
	width: 1.5em;
	height: 1.5em;
	color: #1e1c1a;
}

.es-symbol-toggle__preview svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.es-symbol-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
	gap: 6px;
	margin-top: 0.6em;
	padding: 0.6em;
	border: 1px solid #e0ddd7;
	border-radius: 8px;
	background: #faf9f7;
	max-height: 16em;
	overflow-y: auto;
}

.es-symbol-grid button {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	padding: 8px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: #fff;
	color: #1e1c1a;
	cursor: pointer;
	min-height: 44px; /* tap target */
}

.es-symbol-grid button svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.es-symbol-grid button[aria-selected="true"] {
	border-color: #1e1c1a;
	box-shadow: 0 0 0 1px #1e1c1a;
}

.es-symbol-grid button:focus-visible {
	outline: 2px solid #1e1c1a;
	outline-offset: 1px;
}

.es-symbol-grid .es-symbol-none {
	font-size: 0.7em;
	line-height: 1.2;
}

/* Sliders */
.es-sliders {
	min-height: 3em;
}

.es-field--range input[type="range"] {
	width: 100%;
	max-width: 24em;
	min-height: 2em;
	accent-color: #1e1c1a;
	touch-action: none; /* Pointer Events own the slider gesture on touch */
}

/* Error + price */
.es-error {
	min-height: 0;
	margin: 0.5em 0;
	padding: 0.6em 0.8em;
	border-left: 3px solid #b3261e;
	background: #fdeceb;
	color: #7a1a14;
	font-size: 0.9em;
}

.es-price {
	margin: 0.5em 0 0;
	font-size: 0.95em;
}

.es-price strong {
	display: block;
}

/* Keep author display rules from defeating the hidden attribute. */
.es [hidden] {
	display: none !important;
}

.es-noscript {
	margin: 0.75em 0;
	padding: 0.6em 0.8em;
	border-left: 3px solid #8a6d1d;
	background: #fbf3dd;
	font-size: 0.9em;
}

@media (max-width: 480px) {
	.es-symbol-grid {
		grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
	}
}

/* --- Photo engraving mode (PR 22) --- */
.es-photo {
	/* Reserve height so revealing the crop controls does not shift layout. */
	min-height: 3em;
}

.es-photo__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.es-photo__btn {
	display: inline-block;
	cursor: pointer;
	margin: 0.2em 0;
}

.es-photo__status {
	display: block;
	min-height: 1.2em;
	margin: 0.35em 0;
	font-size: 0.9em;
	color: #7a1a14;
}

.es-photo__crop {
	margin-top: 0.5em;
}

.es-photo__hint {
	margin: 0.4em 0 0;
	font-size: 0.85em;
	opacity: 0.8;
}

/* The engraved-look photo sits under the text/symbol, clipped to the zone. */
.es-stage__svg [data-es-photo] {
	image-rendering: auto;
}

/* --- "Verifică designul final" confirmation (PR 21) ---
   The overlay SVG inside the modal reuses .es-stage__svg + .es-material-*
   + .es-design, so the outlined confirmation renders with the exact same
   engraved-look styling as the live stage. */
.es-confirm {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
	background: rgba(0, 0, 0, 0.55);
}

.es-confirm__dialog {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
	max-width: 420px;
	width: 100%;
	max-height: 92vh;
	overflow: auto;
	padding: 1em 1.1em;
}

.es-confirm__title {
	margin: 0 0 0.5em;
	font-size: 1.1em;
}

.es-confirm__stage {
	position: relative;
	width: 100%;
	background: #d8d5d0;
	border-radius: 6px;
	overflow: hidden;
}

.es-confirm__stage img,
.es-confirm__stage svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.es-confirm__hint {
	margin: 0.7em 0;
	font-size: 0.9em;
	color: #444;
}

.es-confirm__actions {
	display: flex;
	gap: 0.6em;
	justify-content: flex-end;
	margin: 0;
}

.es-confirm__back {
	background: none;
	border: 1px solid #c9c9c9;
	border-radius: 4px;
	padding: 0.55em 0.9em;
	cursor: pointer;
}

.es-confirm__ok {
	cursor: pointer;
}

.es-confirm__ok[disabled] {
	opacity: 0.6;
	cursor: wait;
}

.es-confirm__back,
.es-confirm__hint {
	color: #333;
}

/* --- Procedural medallion model picker + base (PR 23) --- */

/* Fixed SQUARE stage: switching bone <-> round <-> heart <-> wood is zero-CLS
   because every model ships the same 600x600 viewBox (aspect-ratio 1/1). */
.es-stage--medallion {
	max-width: 480px;
	margin: 0 auto;
	background: #f1eadd;
}

.es-medallion .es-stage__backdrop {
	fill: #f1eadd;
}

/* The dashed engrave-zone guide is hidden on the medallion — the blank is the
   guide. (It stays for legacy single-area products.) */
.es-stage--medallion .es-zone {
	display: none;
}

/* Bevel: a full-size dark EDGE silhouette shows a thin ring behind the inset
   gradient face (two fills, never a stroke — a stroked compound bone path would
   reveal its bar/lobe seams). Edge colour is per finish/material. */
.es-base-edge {
	fill: #7c5a24;
}

.es-finish-silver .es-base-edge {
	fill: #767c84;
}

.es-finish-black .es-base-edge {
	fill: #0d0d0f;
}

.es-material-wood .es-base-edge {
	fill: #7a4e24;
}

.es-hole-ring {
	stroke: rgba(70, 55, 32, 0.55);
	stroke-width: 5;
}

.es-finish-black .es-hole-ring {
	stroke: rgba(180, 180, 186, 0.45);
}

/* Engraved-look tint per finish (overrides the material default so gold/silver
   stay a warm dark multiply mark, and black flips to a light screen mark). */
.es-finish-gold .es-design {
	color: #3a2a12;
}

.es-finish-silver .es-design {
	color: #2f3236;
}

.es-finish-black .es-design {
	color: #e8e8ec;
	mix-blend-mode: screen;
}

/* Photographed base: a REAL photo of the blank replaces the procedural
   silhouette (see get_default_models() photo_base). Each finish is a separate
   pre-tinted photo (build-model-photos.mjs recolors ONLY the metal, never the
   backdrop), so no CSS filter runs here — studio.js swaps the href. PREVIEW
   ONLY — the laser export never sees this. The engrave-zone guide is hidden on
   medallions, so text/symbols read as engraved straight onto the face.

   The Față/Spate toggle mirrors the photographed blank (the customer is
   turning the tag over); the engraving itself is hidden by the existing
   .es-stage--back design rule further down. */
.es-base-photo {
	transform-box: view-box;
	transform-origin: 50% 50%;
	transition: transform 0.45s cubic-bezier(0.35, 0.1, 0.25, 1);
}

.es-stage--back .es-base-photo {
	transform: scaleX(-1);
}

@media (prefers-reduced-motion: reduce) {
	.es-base-photo {
		transition: none;
	}
}

/* Picker */
.es-picker {
	max-width: 480px;
	margin: 0 auto 0.9em;
}

.es-picker__title {
	display: block;
	font-weight: 700;
	font-size: 1.02em;
}

.es-picker__hint {
	display: block;
	font-size: 0.82em;
	opacity: 0.72;
	margin-bottom: 0.7em;
}

.es-model-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
	gap: 8px;
}

.es-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 4px 6px;
	border: 2px solid transparent;
	border-radius: 14px;
	background: #f5f1ea;
	cursor: pointer;
	transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.es-tile:hover {
	border-color: #d8c9ae;
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(74, 54, 30, 0.12);
}

.es-tile[aria-checked="true"] {
	border-color: #33473a;
	background: #e3ede4;
	box-shadow: 0 6px 16px rgba(36, 51, 42, 0.18);
}

.es-tile:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(51, 71, 58, 0.4);
}

.es-tile__art {
	display: block;
	width: 100%;
}

.es-tile__svg {
	display: block;
	width: 100%;
	height: auto;
}

/* Photographed picker tiles: the real blank photo, softly rounded. The art
   box is fixed-aspect so a finish-swap (src change) can never reflow. */
.es-tile__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 10px;
}

.es-tile--photo {
	padding: 6px 6px 8px;
}

.es-tile__label {
	font-size: 0.72em;
	font-weight: 600;
	color: #4a4038;
	line-height: 1.2;
}

/* Finish segmented control */
.es-finish {
	margin-top: 0.85em;
	display: flex;
	align-items: center;
	gap: 0.6em;
	flex-wrap: wrap;
}

.es-finish__label {
	font-size: 0.85em;
	font-weight: 600;
}

.es-finish__opts {
	display: inline-flex;
	background: #f1eadd;
	border-radius: 999px;
	padding: 3px;
	gap: 2px;
}

.es-finish__opt {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 0;
	background: transparent;
	color: #4a4038;
	font-weight: 600;
	font-size: 0.82em;
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
}

.es-finish__opt[aria-checked="true"] {
	background: #fff;
	color: #24332a;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.es-finish__opt:focus-visible {
	outline: 2px solid #33473a;
	outline-offset: 1px;
}

.es-finish__dot {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.15);
}

@media (max-width: 420px) {
	.es-tile__label {
		font-size: 0.64em;
	}

	.es-model-grid {
		gap: 6px;
	}
}

/* =========================================================================
 * PR 24 — storefront token mapping.
 *
 * Re-colour the studio's UI chrome onto the theme's green-and-cream design
 * tokens so the control panel matches the reskinned storefront: green
 * selected/arc chips + symbol selection, green slider accent, sage
 * selected-tile wash, gold prices. Every value carries a fallback equal to
 * the previous standalone colour, so the plugin still looks correct with the
 * theme absent — and it inherits the theme's warm espresso-green dark mode
 * automatically when [data-theme="dark"] flips the tokens.
 *
 * The stage tray + engraved marks + finish gradients are the PHYSICAL
 * medallion (metal / wood / burn-brown) and are deliberately NOT tokenised.
 * ========================================================================= */

.es-field__input,
.es-field__font {
	border-color: var(--store-color-line, #c8c4bd);
	background: var(--store-color-surface, #fff);
	color: var(--store-color-ink, #1e1c1a);
	border-radius: var(--store-radius-xs, 8px);
}

.es-field__input:focus,
.es-field__font:focus {
	border-color: var(--store-color-primary, #33473a);
	outline: none;
	box-shadow: var(--store-ring, 0 0 0 3px rgba(51, 71, 58, 0.4));
}

.es-chip span {
	border-color: var(--store-color-line, #c8c4bd);
	background: var(--store-color-surface, #fff);
	color: var(--store-color-ink, #1e1c1a);
}

.es-chip input:checked + span {
	border-color: var(--store-color-primary, #33473a);
	background: var(--store-color-primary, #33473a);
	color: var(--store-color-primary-ink, #fff);
}

.es-chip input:focus-visible + span {
	outline-color: var(--store-color-primary, #33473a);
}

.es-symbol-toggle {
	border-color: var(--store-color-line, #c8c4bd);
	background: var(--store-color-surface, #fff);
	color: var(--store-color-ink, #1e1c1a);
	border-radius: var(--store-radius-xs, 8px);
}

.es-symbol-toggle__preview {
	color: var(--store-color-ink, #1e1c1a);
}

.es-symbol-grid {
	border-color: var(--store-color-line, #e0ddd7);
	background: var(--store-color-paper-alt, #faf9f7);
}

.es-symbol-grid button {
	background: var(--store-color-surface, #fff);
	color: var(--store-color-ink, #1e1c1a);
}

.es-symbol-grid button[aria-selected="true"] {
	border-color: var(--store-color-primary, #33473a);
	box-shadow: 0 0 0 1px var(--store-color-primary, #33473a);
}

.es-symbol-grid button:focus-visible {
	outline-color: var(--store-color-primary, #33473a);
}

.es-field--range input[type="range"] {
	accent-color: var(--store-color-primary, #33473a);
}

.es-tile {
	background: var(--store-color-paper-alt, #f5f1ea);
}

.es-tile:hover {
	border-color: var(--store-color-line-strong, #d8c9ae);
}

.es-tile[aria-checked="true"] {
	border-color: var(--store-color-primary, #33473a);
	background: var(--store-color-primary-tint, #e3ede4);
}

.es-tile__label {
	color: var(--store-color-ink-soft, #4a4038);
}

.es-finish__opts {
	background: var(--store-color-paper-alt, #f1eadd);
}

.es-finish__opt {
	color: var(--store-color-ink-soft, #4a4038);
}

.es-finish__opt[aria-checked="true"] {
	background: var(--store-color-surface, #fff);
	color: var(--store-color-primary-strong, #24332a);
}

.es-picker__title,
.es-finish__label,
.es-field__label {
	color: var(--store-color-ink, #1e1c1a);
}

/* Prices in the studio panel are gold, matching the storefront. */
.es-price strong {
	color: var(--store-color-gold, #8a6730);
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
}

/* =========================================================================
 * PR 26 — dedicated full-width medallion STUDIO layout.
 *
 * Reproduces docs/prototypes/medallion-studio.html: on a medallion product
 * the plugin takes over the whole product content column (the class-side
 * PHP drops the empty gallery + stock title/price/excerpt), and the
 * add-to-cart form becomes a 3-column grid — Pasul 1 model picker (left),
 * a big STICKY procedural preview (center), Pasul 2 controls + add-to-cart
 * (right). `.es` is display:contents so the picker/stage/controls cards and
 * WooCommerce's own quantity + add-to-cart button all lay out as siblings in
 * the form grid. Everything is scoped under `.es-studio-page` /`.es-studio`
 * so non-medallion products keep the stock in-summary stack untouched.
 *
 * All colour/shape values map onto the theme's green-and-cream tokens with
 * standalone fallbacks (plugin still correct with the theme absent).
 * ========================================================================= */

/* Reclaim the full content width: no product gallery (procedural base), so
   the summary column spans everything. Higher specificity than the
   WooCommerce core `div.product div.summary { float; width:48% }` rule. */
.woocommerce div.product.es-studio-page > .woocommerce-product-gallery {
	display: none;
}

.woocommerce div.product.es-studio-page div.summary.entry-summary {
	float: none;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

/* Lede — the product title (first word accented) + short description, styled
   like the prototype heading, replacing the stock stacked chrome. */
.es-studio-page .es-lede {
	max-width: 62ch;
	margin: 0 0 1.6rem;
}

.es-studio-page .es-lede__title {
	margin: 0;
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.01em;
	font-size: clamp(1.9rem, 4.5vw, 2.9rem);
}

.es-studio-page .es-lede__accent {
	color: var(--store-color-primary-text, #2e4636);
}

.es-studio-page .es-lede__sub {
	margin: 0.5rem 0 0;
	color: var(--store-color-ink-soft, #4a4038);
	font-size: var(--store-fs-md, 1.125rem);
}

.es-studio-page .es-lede__sub p {
	margin: 0;
}

/* The 3-column grid lives on the add-to-cart FORM (so qty + button post
   normally); `.es` is transparent so its cards join the grid directly. A
   trailing 1fr spacer row keeps the right column pinned to the top even when
   the picker is the tallest column. */
.es-studio-page form.cart {
	display: grid;
	grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
	grid-template-rows: auto auto auto 1fr;
	grid-template-areas:
		"visual picker"
		"visual controls"
		"visual buy"
		"visual .";
	gap: 22px 34px;
	align-items: start;
}

.es-studio-page form.cart .es {
	display: contents;
}

.es-studio-page form.cart .es-visual {
	grid-area: visual;
	position: sticky;
	top: 1.25rem;
	align-self: start;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.es-studio-page form.cart .es-picker {
	grid-area: picker;
}

/* On the narrow mobile stack, nothing pins — the columns collapse to one. */
@media ( max-width: 1080px ) {
	.es-studio-page form.cart .es-visual {
		position: static;
	}
}

/* The live-preview card sits inside the sticky .es-visual column, beneath the
   product photo — no longer its own grid cell. */
.es-studio-page form.cart .es-stage-card {
	margin: 0;
}

.es-studio-page form.cart .es-controls {
	grid-area: controls;
}

/* Buy bar: price + quantity + add-to-cart button on one row, the total leading
   beside the button (the approved "zona de adăugare în coș, cu prețul lângă"). */
.es-studio-page form.cart .es-buybar {
	grid-area: buy;
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	margin: 4px 0 0;
}

.es-studio-page form.cart .es-buybar__price {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
}

.es-studio-page form.cart .es-buybar__price strong {
	font-family: var(--store-font-heading, inherit);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--store-color-ink, #211c15);
	font-variant-numeric: tabular-nums;
}

.es-studio-page form.cart .es-buybar__price span {
	font-size: 0.78rem;
	color: var(--store-color-ink-faint, #8a7e6e);
}

.es-studio-page form.cart .es-buybar .quantity {
	margin: 0;
}

.es-studio-page form.cart .es-buybar .single_add_to_cart_button {
	flex: 1 1 auto;
	min-width: 180px;
	margin: 0;
	padding: 14px 22px;
	font-size: 1.05rem;
}

/* --- Pasul 2: visual mode cards ("Ce gravăm?") --- */
.es-studio .es-modes {
	border: 0;
	margin: 0 0 0.4rem;
	padding: 0;
}

.es-modes__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-top: 0.5rem;
}

.es-mode {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 12px 12px 13px;
	cursor: pointer;
	background: var(--store-color-paper, #faf7f2);
	border: 1.5px solid var(--store-color-line, #e6dccb);
	border-radius: var(--store-radius-md, 18px);
	transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.es-mode:hover {
	border-color: var(--store-color-line-strong, #d8c9ae);
}

.es-mode input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 1px;
	height: 1px;
}

.es-mode__thumb {
	width: 100%;
	aspect-ratio: 4 / 3;
	border-radius: 12px;
	overflow: hidden;
	background: var(--store-color-paper-alt, #f1eadd);
	border: 1px solid var(--store-color-line, #e6dccb);
}

.es-mode__svg {
	display: block;
	width: 100%;
	height: 100%;
}

.es-mode__txt {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.es-mode__t {
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
	font-size: 0.95rem;
	line-height: 1.1;
	color: var(--store-color-ink, #211c15);
}

.es-mode__d {
	font-size: 0.76rem;
	line-height: 1.3;
	color: var(--store-color-ink-faint, #8a7e6e);
}

.es-mode__price {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 2px 9px;
	border-radius: var(--store-radius-pill, 999px);
	background: var(--store-color-surface, #fff);
	border: 1px solid var(--store-color-line, #e6dccb);
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
	font-size: 0.72rem;
	color: var(--store-color-primary-text, #2e4636);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	box-shadow: var(--store-shadow-sm, 0 1px 2px rgba(74, 54, 30, 0.06));
}

.es-mode:has( input:checked ) {
	border-color: var(--store-color-primary, #33473a);
	background: var(--store-color-primary-tint, #e3ede4);
	box-shadow: inset 0 0 0 1px var(--store-color-primary, #33473a);
}

.es-mode:has( input:checked ) .es-mode__price {
	background: var(--store-color-primary, #33473a);
	border-color: var(--store-color-primary, #33473a);
	color: var(--store-color-primary-ink, #faf7f2);
}

.es-mode:has( input:checked ) .es-mode__d {
	color: var(--store-color-primary-text, #2e4636);
}

.es-mode input:focus-visible + .es-mode__thumb {
	outline: 2px solid var(--store-color-primary, #33473a);
	outline-offset: 2px;
}

/* Fine-tuning collapsible (font, text shape, sizes) — hidden by default so the
   default Pasul 2 view stays as clean as the approved concept. */
.es-advanced {
	margin: 0.5rem 0 0;
	border-top: 1px solid var(--store-color-line, #e6dccb);
	padding-top: 0.5rem;
}

.es-advanced__summary {
	cursor: pointer;
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
	font-size: 0.9rem;
	color: var(--store-color-primary-text, #2e4636);
	list-style: none;
	padding: 4px 0;
}

.es-advanced__summary::-webkit-details-marker {
	display: none;
}

.es-advanced__summary::before {
	content: "▸ ";
	color: var(--store-color-ink-faint, #8a7e6e);
}

.es-advanced[open] .es-advanced__summary::before {
	content: "▾ ";
}

@media (max-width: 420px) {
	.es-modes__grid {
		grid-template-columns: 1fr;
	}

	.es-mode {
		flex-direction: row;
		align-items: center;
	}

	.es-mode__thumb {
		width: 84px;
		flex: none;
	}
}

/* Cards */
.es-studio .es-card {
	margin: 0;
	padding: 18px;
	background: var(--store-color-surface, #fff);
	border: 1px solid var(--store-color-line, #e6dccb);
	border-radius: var(--store-radius-lg, 26px);
	box-shadow: var(--store-shadow-md, 0 6px 20px rgba(74, 54, 30, 0.1));
}

/* Pasul 1 / Pasul 2 eyebrow */
.es-studio .es-step {
	margin: 0 0 0.5rem;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--store-color-ink-faint, #8a7e6e);
}

.es-studio .es-step__n {
	color: var(--store-color-primary-text, #2e4636);
}

/* --- Picker card (left / Pasul 1) --- */
.es-studio .es-picker {
	max-width: none;
	margin: 0;
}

.es-studio .es-picker__title {
	font-family: var(--store-font-heading, inherit);
	font-size: 1.05rem;
}

.es-studio .es-picker .es-model-grid {
	grid-template-columns: repeat(3, 1fr);
}

.es-studio .es-grp {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 14px 0 8px;
	font-family: var(--store-font-heading, inherit);
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--store-color-ink, #211c15);
}

.es-studio .es-grp::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--store-color-line, #e6dccb);
}

.es-studio .es-finish {
	margin-top: 0.85em;
}

/* --- Stage card (center, sticky) --- */
.es-studio .es-stage-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.es-studio .es-stage-name {
	font-family: var(--store-font-heading, inherit);
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--store-color-ink, #211c15);
}

.es-studio .es-side {
	display: inline-flex;
	flex: none;
	gap: 2px;
	padding: 3px;
	background: var(--store-color-paper-alt, #f1eadd);
	border: 1px solid var(--store-color-line, #e6dccb);
	border-radius: var(--store-radius-pill, 999px);
}

.es-studio .es-side__btn {
	padding: 6px 13px;
	border: 0;
	border-radius: var(--store-radius-pill, 999px);
	background: transparent;
	color: var(--store-color-ink-soft, #4a4038);
	font-weight: 600;
	font-size: 0.8rem;
	cursor: pointer;
}

.es-studio .es-side__btn[aria-pressed="true"] {
	background: var(--store-color-primary-tint, #e3ede4);
	color: var(--store-color-primary-text, #2e4636);
}

/* The big centered preview fills the card (drop the standalone 480px cap). */
.es-studio .es-stage-card .es-stage {
	max-width: none;
	margin: 0;
}

.es-studio .es-stage-hint {
	margin: 11px 0 0;
	font-size: 0.78rem;
	color: var(--store-color-ink-faint, #8a7e6e);
	text-align: center;
}

/* Press-hold / "Spate" reveal: hide the engraving to show the bare blank. */
.es-stage--back [data-es-design],
.es-stage--reveal [data-es-design] {
	display: none;
}

/* --- Controls card (right / Pasul 2) --- */
.es-studio .es-controls {
	max-width: none;
	margin: 0;
}

/* --- Mobile (the primary platform): stack the controls, then DOCK the live
   preview to the bottom of the screen so it stays visible while you design.
   The product photo is hidden on mobile — the catalog thumbnail covers it and
   the live medallion is what matters here. Order: picker → Pasul 2 → preview
   dock → add-to-cart. --- */
@media (max-width: 1080px) {
	.es-studio-page form.cart {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		grid-template-areas:
			"picker"
			"controls"
			"visual"
			"buy";
	}

	.es-studio-page form.cart .es-visual {
		position: sticky;
		bottom: 0;
		top: auto;
		z-index: 30;
		margin: 12px 0 0;
		padding: 10px 0 8px;
		background: var(--store-color-paper, #faf7f2);
		border-top: 1px solid var(--store-color-line, #e6dccb);
		box-shadow: 0 -10px 26px rgba(74, 54, 30, 0.14);
	}

	.es-studio-page form.cart .es-stage-card {
		border: 0;
		box-shadow: none;
		padding: 2px 12px 4px;
	}

	.es-studio .es-stage-card .es-stage {
		max-width: 210px;
		margin-inline: auto;
	}

	.es-studio .es-stage-hint {
		display: none;
	}
}
