/* Grabado gratis (grabado.php, assets/grabado.js). */

/*
 * Emoji del grabado: Noto Emoji (Google, licencia OFL, fonts/OFL-noto-emoji.txt), el mismo dibujo de
 * líneas que Apple usa en su configurador de grabado. Solo trae los emoji de HG_ENGRAVING_EMOJI
 * (unicode-range), así las letras y los números siguen saliendo en la letra de Apple.
 * Letras: SF Pro, la de Apple. En iPhone, iPad y Mac viene en el equipo (-apple-system); la licencia
 * de Apple no deja subirla a la web, así que en Windows o Android sale una parecida.
 * La vista previa grande es la foto de apple.com (.hg-eng__photo); el dibujo propio queda de respaldo.
 */
@font-face {
	font-family: "HG Grabado Emoji";
	font-style: normal;
	font-weight: 400 700;
	font-display: block;
	src: url("fonts/noto-emoji-grabado.woff2") format("woff2"), url("fonts/noto-emoji-grabado.woff") format("woff");
	unicode-range: U+2605, U+2665, U+26bd-26be, U+270c, U+2728, U+1f3c0, U+1f3c8, U+1f407, U+1f409, U+1f40d, U+1f40f, U+1f414, U+1f416, U+1f42d-1f42f, U+1f431, U+1f434-1f436, U+1f43b, U+1f44a, U+1f44d, U+1f47b, U+1f47d-1f47e, U+1f480, U+1f495, U+1f4a9, U+1f600, U+1f602, U+1f606, U+1f60a, U+1f60d-1f60e, U+1f618, U+1f61c, U+1f62c, U+1f916, U+1f91f, U+1f923, U+1f929, U+1f970, U+1f984;
}

.hg-eng,
.hg-engraving {
	--hg-eng-font: "HG Grabado Emoji", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* En la ficha */
.hg-engraving {
	flex: 1 1 100%;
	margin: 0 0 0.25rem;
}

.hg-engraving__label {
	display: block;
	margin: 0 0 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
}

.hg-engraving__label small {
	font-weight: 400;
	opacity: 0.6;
}

.hg-engraving__input {
	box-sizing: border-box;
	width: 100%;
	padding: 0.85rem 1rem;
	border: 1.5px solid rgba(0, 0, 0, 0.15);
	border-radius: 12px;
	font: inherit;
}

.hg-engraving__summary {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding: 0.875rem 1rem;
	border: 1.5px solid rgba(0, 0, 0, 0.12);
	border-radius: 16px;
	cursor: pointer;
}

.hg-engraving__summary[hidden] {
	display: none;
}

.hg-engraving__icon {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: #f5f5f7;
	color: #1d1d1f;
}

.hg-engraving__icon svg {
	width: 1.2rem;
	height: 1.2rem;
}

.hg-engraving__copy {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.hg-engraving__title {
	font-size: 0.9375rem;
	font-weight: 600;
}

.hg-engraving__current {
	overflow: hidden;
	font-size: 0.875rem;
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: 0.6;
}

.hg-engraving__current.is-set {
	font-family: var(--hg-eng-font);
	font-size: 1rem;
	letter-spacing: 0.04em;
	opacity: 1;
}

.hg-engraving__open {
	flex: 0 0 auto;
	padding: 0.5rem 1rem;
	border: 0;
	border-radius: 999px;
	background: #f5f5f7;
	color: #0066cc;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
}

/* Ventana */
.hg-eng {
	box-sizing: border-box;
	width: min(620px, calc(100vw - 24px));
	max-height: calc(100dvh - 24px);
	padding: 0;
	overflow: auto;
	border: 0;
	border-radius: 28px;
	background: #fff;
	color: #1d1d1f;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
	overscroll-behavior: contain;
}

.hg-eng::backdrop {
	background: rgba(0, 0, 0, 0.45);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.hg-eng__close {
	position: sticky;
	top: 14px;
	z-index: 2;
	display: grid;
	float: right;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	margin: 14px 14px -50px 0;
	border: 0;
	border-radius: 50%;
	background: #e8e8ed;
	color: #424245;
	cursor: pointer;
}

.hg-eng__close svg {
	width: 1rem;
	height: 1rem;
}

.hg-eng__title {
	margin: 0;
	padding: 2.75rem 1.5rem 0;
	font-size: clamp(1.75rem, 5vw, 2.5rem);
	font-weight: 700;
	line-height: 1.08;
	letter-spacing: -0.025em;
	text-align: center;
}

.hg-eng__lead {
	margin: 0.75rem auto 1.5rem;
	padding: 0 1.5rem;
	max-width: 30em;
	font-size: 1.0625rem;
	line-height: 1.4;
	text-align: center;
	color: #424245;
}

/* Escenario gris con el producto */
.hg-eng__stage {
	display: grid;
	place-items: center;
	min-height: 15rem;
	padding: 2rem 0;
	overflow: hidden;
	background: #f5f5f7;
}

/* Foto de Apple con el grabado: reemplaza al dibujo propio cuando carga. */
.hg-eng__photo {
	display: block;
	width: 100%;
	height: auto;
}

.hg-eng__photo[hidden],
.hg-eng__stage.has-photo > :not(.hg-eng__photo) {
	display: none;
}

.hg-eng__stage.has-photo {
	min-height: 0;
	padding: 0;
}

.hg-eng[data-kind="airtag"] .hg-eng__photo {
	margin: 0 auto;
	width: min(100%, 22rem);
}

/* Grabado: gris, hundido y sin color, como lo muestra Apple. */
.hg-eng__text {
	color: #a1a1a6;
	font-family: var(--hg-eng-font);
	font-weight: 400;
	white-space: nowrap;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 -0.5px 0 rgba(0, 0, 0, 0.12);
}

.hg-eng__airtag {
	display: grid;
	place-items: center;
	width: 13rem;
	height: 13rem;
	border-radius: 50%;
	background: radial-gradient(circle at 36% 28%, #fff 0%, #fbfbfc 40%, #ececef 72%, #d6d6da 100%);
	box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.07), inset 0 4px 6px rgba(255, 255, 255, 0.95), 0 18px 34px rgba(0, 0, 0, 0.16);
}

.hg-eng__airtag {
	overflow: hidden;
}

/* AirTag: letras gruesas y grandes ("LETR" en Apple). */
.hg-eng__airtag .hg-eng__text {
	font-size: 3.4rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #c3c3c7;
}

.hg-eng__pencil {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 2rem;
	box-sizing: border-box;
	width: 112%;
	height: 4.25rem;
	margin-left: -14%;
	padding: 0 2.25rem 0 0;
	border-radius: 0 999px 999px 0;
	background: linear-gradient(180deg, #fafafa 0%, #fff 22%, #f1f1f3 58%, #dcdcdf 100%);
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
}

.hg-eng__pencil .hg-eng__text {
	font-size: 1.2rem;
	letter-spacing: 0.06em;
}

.hg-eng__pencil-label {
	font-family: var(--hg-eng-font);
	font-size: 1.5rem;
	font-weight: 500;
	letter-spacing: -0.01em;
	color: #a1a1a6;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
	white-space: nowrap;
}

/* Campo, emoji y botones */
.hg-eng__body {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.5rem 1.5rem 1.75rem;
}

.hg-eng__field {
	position: relative;
	padding: 0.6rem 2.75rem 0.55rem 1rem;
	border: 1.5px solid #86868b;
	border-radius: 14px;
}

.hg-eng__field:focus-within {
	border-color: #0071e3;
	box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.hg-eng__field.is-invalid {
	border-color: #e30000;
	box-shadow: none;
}

.hg-eng__field-label {
	display: block;
	font-size: 0.75rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #6e6e73;
}

.hg-eng__field.is-invalid .hg-eng__field-label {
	color: #e30000;
}

/* Paquete de 4: botones "AirTag 1…4" (con punto azul si ya tiene grabado) y "Usar en los 4". */
.hg-eng__units {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.25rem;
	padding: 0.25rem;
	border-radius: 14px;
	background: #f5f5f7;
}

.hg-eng__units[hidden],
.hg-eng__copy[hidden] {
	display: none;
}

.hg-eng__unit {
	position: relative;
	padding: 0.55rem 0.25rem;
	border: 0;
	border-radius: 11px;
	background: none;
	color: #1d1d1f;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	cursor: pointer;
}

.hg-eng__unit[aria-selected="true"] {
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	font-weight: 600;
}

.hg-eng__unit.is-set::after {
	content: "";
	position: absolute;
	top: 0.4rem;
	right: 0.45rem;
	width: 0.4rem;
	height: 0.4rem;
	border-radius: 50%;
	background: #0071e3;
}

.hg-eng__copy {
	align-self: flex-start;
	margin-top: -0.25rem;
	padding: 0.25rem 0;
	border: 0;
	background: none;
	color: #0066cc;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
}

/* !important: el tema le pone borde y marco azul a todos los campos; aquí el marco es .hg-eng__field. */
.hg-eng .hg-eng__input {
	box-sizing: border-box;
	width: 100%;
	height: auto;
	margin: 0;
	padding: 0.1rem 0 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	font-family: var(--hg-eng-font);
	font-size: 1.1875rem;
	letter-spacing: 0.02em;
	color: #1d1d1f;
	-webkit-appearance: none;
	appearance: none;
}

.hg-eng__clear {
	position: absolute;
	top: 50%;
	right: 0.75rem;
	width: 1.35rem;
	height: 1.35rem;
	padding: 0;
	border: 0;
	background: none;
	color: #86868b;
	transform: translateY(-50%);
	cursor: pointer;
}

.hg-eng__clear[hidden] {
	display: none;
}

.hg-eng__error {
	margin: -0.25rem 0 0;
	font-size: 0.875rem;
	color: #e30000;
}

.hg-eng__error:empty {
	display: none;
}

.hg-eng__tabs {
	display: flex;
	gap: 0.375rem;
	overflow-x: auto;
	scrollbar-width: none;
}

.hg-eng__tabs::-webkit-scrollbar {
	display: none;
}

.hg-eng__tabs[hidden] {
	display: none;
}

/* AirTag: la foto va como tarjeta redondeada sobre blanco (su gris no casa con el del escenario). */
.hg-eng[data-kind="airtag"] .hg-eng__stage.has-photo {
	padding: 0 1.5rem;
	background: none;
}

.hg-eng[data-kind="airtag"] .hg-eng__photo {
	border-radius: 22px;
}

/* Apple Pencil: la foto de Apple es muy ancha; se acerca a la parte del grabado (23 % a 82 %). */
.hg-eng[data-kind="pencil"] .hg-eng__photo {
	width: 170%;
	max-width: none;
	margin-left: -40%;
}

.hg-eng__tab {
	flex: 0 0 auto;
	padding: 0.45rem 0.9rem;
	border: 0;
	border-radius: 999px;
	background: #f5f5f7;
	color: #1d1d1f;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
}

.hg-eng__tab[aria-selected="true"] {
	background: #1d1d1f;
	color: #fff;
}

.hg-eng__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(2.9rem, 1fr));
	gap: 0.25rem;
	max-height: 12.5rem;
	overflow-y: auto;
}

.hg-eng__key {
	aspect-ratio: 1;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: none;
	color: #1d1d1f;
	font-family: var(--hg-eng-font);
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.hg-eng__key:hover,
.hg-eng__key:focus-visible {
	background: #f5f5f7;
}

.hg-eng__note {
	margin: 0.25rem 0 0;
	font-size: 0.8125rem;
	color: #6e6e73;
	text-align: center;
}

.hg-eng__save {
	padding: 1rem;
	border: 0;
	border-radius: 14px;
	background: #0071e3;
	color: #fff;
	font: inherit;
	font-size: 1.0625rem;
	font-weight: 600;
	cursor: pointer;
}

.hg-eng__save:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.hg-eng__cancel {
	align-self: center;
	padding: 0.25rem 0.5rem;
	border: 0;
	background: none;
	color: #0066cc;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

@media (max-width: 600px) {
	.hg-eng {
		width: 100vw;
		max-width: 100vw;
		max-height: 94dvh;
		margin: auto 0 0;
		border-radius: 24px 24px 0 0;
	}

	.hg-eng__stage {
		min-height: 12rem;
		padding: 1.5rem 0;
	}

	.hg-eng__airtag {
		width: 10.5rem;
		height: 10.5rem;
	}

	.hg-eng__airtag .hg-eng__text {
		font-size: 2.5rem;
	}

	.hg-eng__pencil {
		height: 3.5rem;
		gap: 1.25rem;
		padding-right: 1.5rem;
	}

	.hg-eng__pencil .hg-eng__text {
		font-size: 0.95rem;
	}

	.hg-eng__pencil-label {
		font-size: 1.1rem;
	}
}
