/* ==========================================================================
   Erätiedot — julkinen eräkoodihaku (hajupala-eratiedot)
   Käyttää teeman tokeneita; varafallbackit brändin arvoilla.
   ========================================================================== */

.hpe-haku {
	--hpe-bg: var(--hp-surface, #fff);
	--hpe-text: var(--hp-text, #3a3f43);
	--hpe-heading: var(--hp-heading, #0f3439);
	--hpe-line: var(--hp-border, #e5e8e9);
	--hpe-deep: var(--hp-teal-deep, #1e5964);
	--hpe-muted: #6b7175;
	--hpe-track: #eceff0;
	--hpe-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

	max-width: 820px;
	margin-inline: auto;
	color: var(--hpe-text);
}

/* --- Hakulomake --------------------------------------------------------- */

.hpe-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: 1rem;
	align-items: end;
	background: var(--hpe-bg);
	border: 1px solid var(--hpe-line);
	border-radius: var(--hp-radius, 16px);
	padding: 1.25rem;
	margin: 0 0 .75rem;
}

.hpe-kentta {
	display: flex;
	flex-direction: column;
	gap: .35rem;
	min-width: 0;
}

.hpe-kentta label {
	font-size: .8125rem;
	color: var(--hpe-muted);
}

/* Kenttäkohtainen tarkennus: kuka saa syöttää minkä osoitteen. */
.hpe-kentta .hpe-vihje {
	font-size: .75rem;
	line-height: 1.4;
	color: var(--hpe-muted);
	margin-top: -.2rem;
}

.hpe-form input[type="text"] {
	width: 100%;
	min-width: 0;
	font-size: 1.0625rem;
	padding: .7rem .9rem;
	border: 1px solid var(--hpe-line);
	border-radius: var(--hp-radius-sm, 8px);
	background: #fff;
	color: var(--hpe-heading);
}

.hpe-form input.hpe-koodi {
	font-family: var(--hpe-mono);
	letter-spacing: .08em;
	text-transform: uppercase;
}

.hpe-form input[type="text"]:focus {
	outline: 2px solid var(--hpe-deep);
	outline-offset: 1px;
	border-color: var(--hpe-deep);
}

/* Hunajapurkki: piilotettu ihmisiltä, houkuttelee lomakerobotteja. */
.hpe-hunaja {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.hpe-form button {
	font-family: var(--hp-font-head, inherit);
	font-size: 1rem;
	font-weight: 600;
	background: var(--hpe-deep);
	color: #fff;
	border: 0;
	border-radius: var(--hp-radius-sm, 8px);
	padding: .75rem 1.6rem;
	cursor: pointer;
	grid-column: 1 / -1;
	justify-self: start;
}

.hpe-form button:hover,
.hpe-form button:focus {
	background: var(--hp-teal-dark, #0f3439);
	color: #fff;
}

.hpe-tietosuoja,
.hpe-vinkki {
	font-size: .8125rem;
	color: var(--hpe-muted);
	margin: 0 0 1rem;
}

.hpe-vinkki {
	margin-bottom: 2rem;
}

.hpe-vinkki code,
.hpe-ohje code {
	font-family: var(--hpe-mono);
	font-size: .875em;
	background: var(--hpe-track);
	padding: .1em .4em;
	border-radius: 4px;
	white-space: nowrap;
}

/* --- Esimerkkiraportin varoitus ---------------------------------------- */

.hpe-kortti-esimerkki {
	border-style: dashed;
}

.hpe-esimerkki-huomio {
	background: #fbf4e9;
	border-left: 3px solid #c98a5e;
	padding: .9rem 1.1rem;
	margin: 0 0 1.5rem;
}

.hpe-esimerkki-otsikko {
	font-family: var(--hp-font-head, inherit);
	font-weight: 700;
	color: var(--hpe-heading);
	margin: 0 0 .3rem;
}

.hpe-esimerkki-huomio p:last-child {
	margin: 0;
	font-size: .875rem;
}

/* --- Ohje ja virheet ---------------------------------------------------- */

.hpe-ohje h2 {
	font-size: 1.25rem;
	margin: 0 0 .5rem;
}

.hpe-ohje p {
	margin: 0 0 .9rem;
}

.hpe-ohje code {
	font-family: var(--hpe-mono);
	background: var(--hpe-track);
	padding: .1em .4em;
	border-radius: 4px;
}

.hpe-virhe {
	background: var(--hpe-bg);
	border: 1px solid var(--hpe-line);
	border-left: 3px solid #c98a5e;
	padding: 1.1rem 1.35rem;
}

.hpe-virhe-otsikko {
	font-family: var(--hp-font-head, inherit);
	font-weight: 700;
	color: var(--hpe-heading);
	margin: 0 0 .3rem;
}

.hpe-virhe p:last-child {
	margin: 0;
	font-size: .9375rem;
}

/* --- Tuloskortti -------------------------------------------------------- */

.hpe-kortti {
	background: var(--hpe-bg);
	border: 1px solid var(--hpe-line);
	border-radius: var(--hp-radius, 16px);
	padding: 1.75rem;
	margin: 0 0 1.5rem;
}

.hpe-monta {
	font-size: .8125rem;
	color: var(--hpe-muted);
	margin: 0 0 .75rem;
	text-transform: uppercase;
	letter-spacing: .08em;
}

.hpe-otsikko {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	flex-wrap: wrap;
	border-bottom: 1px solid var(--hpe-line);
	padding-bottom: 1.25rem;
	margin-bottom: 1.25rem;
}

.hpe-merkki {
	display: inline-block;
	font-size: .75rem;
	background: #e1efef;
	color: var(--hpe-heading);
	padding: .25rem .7rem;
	border-radius: 999px;
	margin-bottom: .55rem;
}

.hpe-otsikko h2 {
	font-size: 1.4rem;
	margin: 0 0 .15rem;
}

.hpe-latina {
	font-size: .875rem;
	color: var(--hpe-muted);
	margin: 0;
}

.hpe-latina em {
	font-style: italic;
}

.hpe-erakoodi {
	text-align: right;
}

.hpe-erakoodi-otsikko {
	font-size: .75rem;
	color: var(--hpe-muted);
	margin: 0 0 .15rem;
}

.hpe-erakoodi-arvo {
	font-family: var(--hpe-mono);
	font-size: 1.0625rem;
	color: var(--hpe-heading);
	letter-spacing: .06em;
	margin: 0;
}

/* --- Perustiedot -------------------------------------------------------- */

.hpe-tiedot {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: .9rem 1.25rem;
	margin: 0 0 1.5rem;
}

.hpe-tiedot dt {
	font-size: .75rem;
	color: var(--hpe-muted);
	margin: 0 0 .1rem;
	font-weight: 400;
}

.hpe-tiedot dd {
	font-size: .9375rem;
	color: var(--hpe-heading);
	margin: 0;
}

.hpe-tiedot .hpe-mono {
	font-family: var(--hpe-mono);
	font-size: .875rem;
}

/* --- Koostumus ---------------------------------------------------------- */

.hpe-alaotsikko {
	font-size: 1.0625rem;
	margin: 0 0 .25rem;
}

.hpe-selite {
	font-size: .8125rem;
	color: var(--hpe-muted);
	margin: 0 0 1.1rem;
}

.hpe-kaavio {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.25rem;
	font-size: .875rem;
}

.hpe-kaavio th,
.hpe-kaavio td {
	border: 0;
	padding: .28rem .5rem .28rem 0;
	vertical-align: middle;
	background: none;
}

.hpe-kaavio th {
	font-weight: 400;
	text-align: left;
	color: var(--hpe-heading);
	width: 34%;
	max-width: 190px;
	overflow-wrap: anywhere;
}

.hpe-kaavio tr:first-child th,
.hpe-kaavio tr:nth-child(2) th {
	font-weight: 600;
}

.hpe-palkki-solu {
	width: auto;
	padding-right: .75rem;
}

.hpe-palkki {
	display: block;
	height: 16px;
	background: var(--hpe-track);
	border-radius: 3px;
}

.hpe-palkki > span {
	display: block;
	height: 16px;
	background: var(--hpe-deep);
	border-radius: 3px;
}

.hpe-osuus {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	text-align: right;
	width: 1%;
}

.hpe-muut th,
.hpe-muut .hpe-osuus {
	color: var(--hpe-muted);
}

.hpe-muut .hpe-palkki > span {
	background: #b9c6c7;
}

/* --- Koko analyysi ------------------------------------------------------ */

.hpe-koko {
	border-top: 1px solid var(--hpe-line);
	padding-top: .9rem;
	margin-bottom: .5rem;
}

.hpe-koko summary {
	font-size: .9375rem;
	font-weight: 500;
	color: var(--hpe-deep);
	cursor: pointer;
	list-style: none;
}

.hpe-koko summary::-webkit-details-marker {
	display: none;
}

.hpe-koko summary::after {
	content: " ▾";
}

.hpe-koko[open] summary::after {
	content: " ▴";
}

.hpe-taulukko {
	width: 100%;
	border-collapse: collapse;
	margin: .9rem 0 0;
	font-size: .875rem;
}

.hpe-taulukko th,
.hpe-taulukko td {
	text-align: left;
	padding: .35rem .5rem .35rem 0;
	border: 0;
	border-bottom: 1px solid #f0f2f2;
	background: none;
}

.hpe-taulukko thead th {
	font-size: .75rem;
	font-weight: 500;
	color: var(--hpe-muted);
	border-bottom: 1px solid var(--hpe-line);
}

.hpe-taulukko .hpe-oikea {
	text-align: right;
}

.hpe-alkuperainen {
	color: var(--hpe-muted);
	font-size: .8125rem;
}

.hpe-allerg {
	color: var(--hpe-muted);
	text-decoration: none;
	border: 0;
	cursor: help;
}

.hpe-spec-taulukko tbody th {
	font-weight: 400;
	color: var(--hpe-heading);
	width: 34%;
}

/* --- Alaviitteet ja lataus ---------------------------------------------- */

.hpe-alaviite,
.hpe-summa,
.hpe-lahde,
.hpe-lataus-koko,
.hpe-ei-pdf {
	font-size: .75rem;
	color: var(--hpe-muted);
	margin: .75rem 0 0;
}

.hpe-summa {
	border-top: 1px solid var(--hpe-line);
	padding-top: .9rem;
	margin-top: 1.1rem;
}

.hpe-huomiot {
	font-size: .9375rem;
	margin: 1rem 0 0;
}

.hpe-lataus {
	margin: 1.25rem 0 0;
}

.hpe-nappi {
	display: inline-block;
	font-family: var(--hp-font-head, inherit);
	font-size: 1rem;
	font-weight: 600;
	background: var(--hpe-deep);
	color: #fff;
	text-decoration: none;
	border-radius: var(--hp-radius-sm, 8px);
	padding: .75rem 1.4rem;
}

.hpe-nappi:hover,
.hpe-nappi:focus {
	background: var(--hp-teal-dark, #0f3439);
	color: #fff;
}

/* --- Kapea näyttö ------------------------------------------------------- */

@media (max-width: 600px) {
	.hpe-kortti {
		padding: 1.25rem;
	}

	.hpe-erakoodi {
		text-align: left;
	}

	.hpe-kaavio th {
		max-width: 130px;
		font-size: .8125rem;
	}

	.hpe-alkuperainen {
		display: none;
	}
}

/* --- Tulostus ----------------------------------------------------------- */

@media print {
	.hpe-form,
	.hpe-lataus,
	.hpe-lataus-koko {
		display: none;
	}

	.hpe-kortti {
		border: 0;
		padding: 0;
	}

	.hpe-koko[open] summary,
	.hpe-koko summary {
		display: none;
	}

	.hpe-koko > table {
		display: table;
	}
}
