/* Hagtøl í fjøllunum – arver temaets tekstfarve og skrift. */
.hagtol {
	--hg-accent: #f39200;
	--hg-line: rgba(128, 128, 128, 0.28);
	margin: 0 0 2em;
}

.hagtol__title {
	margin: 0 0 0.75em;
}

/* Miðal pr. stað */
.hagtol__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 0 0 1.25em;
	padding: 0;
}

.hagtol__stats > div {
	flex: 1 1 140px;
	padding: 0.7em 0.9em;
	border: 1px solid var(--hg-line);
	border-top: 3px solid var(--hg-color, var(--hg-accent));
	border-radius: 4px;
}

.hagtol__stats dt {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 0.9em;
	font-weight: 700;
}

.hagtol__swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 3px;
	background: var(--hg-color, var(--hg-accent));
	flex: none;
}

.hagtol__stats dd {
	margin: 0.2em 0 0;
	font-size: 1.4em;
	font-weight: 700;
}

.hagtol__stat-label {
	font-size: 0.55em;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.75;
}

/* Graf */
.hagtol__chart {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 0 1.5em;
}

.hagtol__svg {
	display: block;
	width: 100%;
	height: auto;
	font-family: inherit;
}

.hagtol__svg text {
	fill: currentColor;
}

.hagtol__axis {
	font-size: 11px;
	opacity: 0.75;
}

.hagtol__legend {
	font-size: 12px;
}

.hagtol__end {
	font-size: 11px;
	font-weight: 700;
}

.hagtol__grid {
	stroke: var(--hg-line);
	stroke-width: 1;
}

.hagtol__baseline {
	stroke: currentColor;
	stroke-opacity: 0.6;
	stroke-width: 1;
}

.hagtol__line {
	fill: none;
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.hagtol__bar path,
.hagtol__dot {
	transition: opacity 0.15s ease;
}

.hagtol__bar:hover path {
	opacity: 0.7;
}

.hagtol__point:hover .hagtol__dot {
	r: 6;
}

/* Tabel */
.hagtol__table-wrap {
	overflow-x: auto;
	max-width: 640px;
}

.hagtol__table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-variant-numeric: tabular-nums;
}

.hagtol__table th,
.hagtol__table td {
	padding: 0.4em 0.75em;
	border: 0;
	border-bottom: 1px solid var(--hg-line);
	text-align: right;
	background: none;
	white-space: nowrap;
}

.hagtol__table th:first-child {
	text-align: left;
}

.hagtol__table thead th {
	border-bottom: 2px solid var(--hg-accent);
	font-weight: 700;
}

.hagtol__table tbody th {
	font-weight: 400;
}

.hagtol__table tfoot th,
.hagtol__table tfoot td {
	font-weight: 700;
	border-top: 2px solid var(--hg-line);
	border-bottom: 0;
}

.hagtol__table tbody tr:hover > * {
	background-color: rgba(128, 128, 128, 0.1);
}

/* Værktøjslinje over grafen: vælg stað + "Vís størri" */
.hagtol__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 0 0 10px;
}

.hagtol__filter {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.hagtol__filter[hidden],
.hagtol__view[hidden] {
	display: none;
}

.hagtol__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font: inherit;
	font-size: 0.85em;
	line-height: 1.2;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(128, 128, 128, 0.45);
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hagtol__chip:hover {
	background-color: rgba(128, 128, 128, 0.15);
}

.hagtol__chip:focus-visible {
	outline: 2px solid var(--hg-accent);
	outline-offset: 2px;
}

.hagtol__chip[aria-pressed="true"] {
	font-weight: 700;
	border-color: var(--hg-color, var(--hg-accent));
	background-color: rgba(128, 128, 128, 0.18);
	box-shadow: inset 0 0 0 1px var(--hg-color, var(--hg-accent));
}

.hagtol__value {
	font-size: 11px;
	font-weight: 700;
}

.hagtol__stats > div {
	transition: opacity 0.2s ease;
}

.hagtol__stats > div.is-dim {
	opacity: 0.4;
}

.hagtol__dialog-filter:not(:empty) {
	padding: 12px 16px 0;
}

/* Knap: "Vís størri" */
.hagtol__zoom {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 0 auto;
	padding: 6px 12px;
	font: inherit;
	font-size: 0.85em;
	font-weight: 700;
	line-height: 1.2;
	color: inherit;
	background: transparent;
	border: 1px solid var(--hg-accent);
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.hagtol__zoom[hidden] {
	display: none;
}

.hagtol__zoom:hover,
.hagtol__zoom:focus-visible {
	background: var(--hg-accent);
	color: #fff;
}

/* Pop-up-vindue */
.hagtol__dialog {
	width: min(96vw, 1600px);
	max-width: none;
	max-height: 94vh;
	padding: 0;
	border: 1px solid rgba(128, 128, 128, 0.35);
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	overflow: hidden;
}

.hagtol__dialog::backdrop {
	background: rgba(0, 0, 0, 0.75);
}

.hagtol__dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 2px solid var(--hg-accent);
}

.hagtol__dialog-title {
	font-size: 1.15em;
}

.hagtol__close {
	width: 36px;
	height: 36px;
	padding: 0;
	font: inherit;
	font-size: 26px;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(128, 128, 128, 0.4);
	border-radius: 4px;
	cursor: pointer;
}

.hagtol__close:hover,
.hagtol__close:focus-visible {
	border-color: var(--hg-accent);
	color: var(--hg-accent);
}

.hagtol__dialog-body {
	padding: 16px;
	max-height: calc(94vh - 110px);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

.hagtol__dialog-body .hagtol__svg {
	width: 100%;
	height: auto;
	max-height: calc(94vh - 150px);
}

@media (max-width: 700px) {
	.hagtol__dialog-body .hagtol__svg {
		min-width: 800px;
		max-height: none;
	}
}

html.hagtol-open {
	overflow: hidden;
}
