/*
 * Tokens de tema — claro/escuro só por variáveis.
 * Cores de marca da instalação: --color-primary / --color-primary-contrast
 * (injetadas no leiaute a partir de Preferencia).
 */

:root {
	color-scheme: light dark;

	/* marca (defaults; override no layout) */
	--color-primary: #007fff;
	--color-primary-contrast: #ffffff;

	/* superfície / texto */
	--color-bg: rgba(245, 246, 246, 1);
	--color-fg: rgba(63, 66, 66, 1);
	--color-bg-solid: #d9dbdb;
	--color-sep: #979898;

	/* transparências sobre o fg */
	--color-muted-20: rgba(63, 66, 66, 0.2);
	--color-muted-15: rgba(63, 66, 66, 0.15);
	--color-muted-10: rgba(63, 66, 66, 0.1);
	--color-muted-05: rgba(63, 66, 66, 0.05);

	/* aliases usados pelo style.css legado */
	--bg-color: var(--color-bg);
	--tx-color: var(--color-fg);
	--bg-solid: var(--color-bg-solid);
	--sep-color: var(--color-sep);
	--bg-trans-dobro: var(--color-muted-20);
	--bg-trans-mais: var(--color-muted-15);
	--bg-trans: var(--color-muted-10);
	--bg-trans-meio: var(--color-muted-05);
	--cor-bolinha: var(--color-primary);
	--themecolor: var(--color-primary);
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-bg: rgba(63, 66, 66, 1);
		--color-fg: rgba(235, 236, 236, 1);
		--color-bg-solid: #515353;
		--color-sep: #808080;

		--color-muted-20: rgba(235, 236, 236, 0.2);
		--color-muted-15: rgba(235, 236, 236, 0.15);
		--color-muted-10: rgba(235, 236, 236, 0.1);
		--color-muted-05: rgba(235, 236, 236, 0.05);
	}
}

/* utilitários de marca */
.btn-primary,
a.button.primary {
	background-color: var(--color-primary);
	color: var(--color-primary-contrast);
	border-color: var(--color-primary);
}

a {
	color: var(--color-primary);
}

.site-header__nav {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-left: auto;
	font-size: 0.9rem;
}

.site-header__nav a {
	opacity: 0.9;
	font-weight: 700;
}

.site-header__nav a:hover {
	opacity: 1;
	text-decoration: underline;
}

.site-header {
	/* herda position:fixed de `header` em style.css */
	display: flex;
	align-items: center;
	gap: var(--def-pad, 4px);
	padding: var(--def-pad, 4px) var(--def-esp, 14px);
	min-height: var(--header-height, 40px);
	height: var(--header-height, 40px);
	box-sizing: border-box;
	border-bottom: var(--sep-border, 1px solid var(--color-sep));
	background: var(--color-bg);
	z-index: 1000;
}

.site-header a {
	text-decoration: none;
	color: var(--color-fg);
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.site-header__brand {
	font-weight: 700;
	/* Não encolher no flex do header — senão o nome quebra em 2 linhas com espaço livre ao lado */
	flex: 0 0 auto;
	min-width: max-content;
	white-space: nowrap;
}

.site-header__name {
	white-space: nowrap;
	/* evita quebra em espaços “estranhos” de alguns nomes de marca */
	display: inline-block;
}

.site-header__logo {
	/* preenche a altura útil da barra (padding já no header; ícone costuma ter padding no arquivo) */
	height: calc(var(--header-height, 40px) - 2 * var(--def-pad, 4px));
	width: auto;
	max-width: min(280px, 45vw);
	object-fit: contain;
	flex-shrink: 0;
	display: block;
}

.site-header__avatar-link {
	opacity: 1;
	text-decoration: none !important;
	border-radius: 50%;
	line-height: 0;
}

.site-header__avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--color-muted-10, rgba(0, 0, 0, 0.12));
	display: block;
	background: var(--bg-trans, #eee);
}

.site-header__avatar--placeholder {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--color-primary-contrast, #fff);
	background: var(--color-primary, #007fff);
	border: none;
	box-sizing: border-box;
}

.site-footer {
	margin-top: auto;
	padding: var(--def-esp, 14px) var(--def-pad, 4px);
	font-size: 0.85em;
	opacity: 0.75;
	text-align: center;
}

.catalog-card {
	display: flex;
	align-items: center;
	gap: 0.75em;
	padding: 0.5em;
	border: 1px solid var(--color-muted-10);
	border-radius: 8px;
	text-decoration: none;
	color: var(--color-fg);
	background: var(--color-muted-05);
}

.catalog-card:hover {
	background: var(--color-muted-10);
	border-color: var(--color-primary);
}

.catalog-card__img {
	width: 60px;
	height: 60px;
	object-fit: contain;
	flex-shrink: 0;
}

.catalog-card__meta {
	font-size: 0.85em;
	opacity: 0.8;
}

.product-hero {
	max-width: 100%;
	max-height: 280px;
	object-fit: contain;
	display: block;
	margin: 0 auto 1em;
}

.product-drawing {
	max-width: 120px;
	max-height: 120px;
	object-fit: contain;
}
