/**
 * Hustadvika Katalog - Kart-stiler
 *
 * Designprinsipper:
 *   - Markørene er typografiske, ikke ikon-suppe
 *   - Popups som visittkort, ikke informasjons-dumping
 *   - Klynger som diskrete tellere, ikke fete bobler
 *   - Sidepanel som lesbar liste, ikke verktøy-panel
 */

/* ============================================================ */
/* Container og layout                                           */
/* ============================================================ */

.hk-kart-wrapper {
	position: relative;
	border-radius: var(--hk-radius);
	overflow: hidden;
	background: var(--hk-color-bg-card);
	border: 1px solid var(--hk-color-border);
	box-shadow: var(--hk-shadow-sm);
}

.hk-kart-wrapper--med-liste {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 0;
}

.hk-kart {
	width: 100%;
	background: var(--hk-color-bg-soft);
	z-index: 1;
}

.hk-kart__noscript {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--hk-color-text-muted);
	padding: var(--hk-space-lg);
	text-align: center;
}

/* ============================================================ */
/* Typografisk markør                                            */
/* ============================================================ */

.hk-marker-wrapper {
	background: transparent !important;
	border: none !important;
}

.hk-marker {
	position: relative;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.hk-marker__prikk {
	position: relative;
	z-index: 2;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--marker-farge, #0a4d7c);
	border: 3px solid #ffffff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
	transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hk-marker__skygge {
	position: absolute;
	z-index: 1;
	bottom: -2px;
	left: 50%;
	transform: translateX(-50%);
	width: 10px;
	height: 4px;
	background: rgba(0, 0, 0, 0.18);
	border-radius: 50%;
	filter: blur(2px);
}

.hk-marker:hover .hk-marker__prikk,
.hk-marker--aktiv .hk-marker__prikk {
	transform: scale(1.35);
}

/* Pulse-animasjon ved fokus */
.hk-marker--aktiv .hk-marker__prikk::after {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 2px solid var(--marker-farge, #0a4d7c);
	opacity: 0;
	animation: hk-marker-pulse 1.4s ease-out infinite;
}

@keyframes hk-marker-pulse {
	0% {
		opacity: 0.6;
		transform: scale(0.8);
	}
	100% {
		opacity: 0;
		transform: scale(1.8);
	}
}

/* ============================================================ */
/* Klynge-ikon                                                   */
/* ============================================================ */

.hk-klynge-wrapper {
	background: transparent !important;
	border: none !important;
}

.hk-klynge {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	color: var(--hk-color-text);
	border-radius: 50%;
	font-weight: 600;
	font-feature-settings: "tnum";
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12),
	            0 0 0 6px rgba(10, 77, 124, 0.12),
	            0 0 0 12px rgba(10, 77, 124, 0.06);
	transition: transform 180ms ease;
}

.hk-klynge:hover {
	transform: scale(1.08);
}

.hk-klynge--sm {
	width: 32px;
	height: 32px;
	font-size: 0.85rem;
}

.hk-klynge--md {
	width: 40px;
	height: 40px;
	font-size: 0.95rem;
}

.hk-klynge--lg {
	width: 48px;
	height: 48px;
	font-size: 1.05rem;
}

/* ============================================================ */
/* Popup - som visittkort                                        */
/* ============================================================ */

.hk-popup-wrapper .leaflet-popup-content-wrapper {
	padding: 0;
	border-radius: var(--hk-radius);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12),
	            0 2px 8px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	border: 1px solid var(--hk-color-border);
}

.hk-popup-wrapper .leaflet-popup-content {
	margin: 0;
	width: 280px !important;
	font-family: inherit;
	line-height: inherit;
}

.hk-popup-wrapper .leaflet-popup-tip {
	background: #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hk-popup-wrapper .leaflet-popup-close-button {
	color: var(--hk-color-text-muted);
	padding: 8px 8px 0 0;
	font-size: 22px;
	font-weight: 300;
}

.hk-popup-wrapper .leaflet-popup-close-button:hover {
	color: var(--hk-color-text);
}

.hk-popup {
	background: #ffffff;
}

.hk-popup__bilde {
	height: 140px;
	background-color: var(--hk-color-primary-light);
	background-size: cover;
	background-position: center;
}

.hk-popup__innhold {
	padding: var(--hk-space-md);
}

.hk-popup__omrade {
	font-size: 0.7rem !important;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--hk-color-text-muted);
	margin-bottom: 4px;
	font-weight: 500;
}

.hk-popup__tittel {
	font-size: 1.05rem !important;
	font-weight: 600;
	margin: 0 0 6px;
	color: var(--hk-color-text);
	line-height: 1.3 !important;
}

.hk-popup__utdrag {
	font-size: 0.85rem !important;
	color: var(--hk-color-text-muted);
	line-height: 1.5 !important;
	margin: 0 0 var(--hk-space-md) !important;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.hk-popup__bunn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--hk-space-sm);
	padding-top: var(--hk-space-sm);
	border-top: 1px solid var(--hk-color-border);
}

.hk-popup__tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.75rem !important;
	font-weight: 500;
	color: var(--marker-farge, var(--hk-color-primary));
}

.hk-popup__tag::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--marker-farge, var(--hk-color-primary));
}

.hk-popup__lenke {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.85rem !important;
	font-weight: 500;
	color: var(--hk-color-text);
	text-decoration: none;
	transition: color var(--hk-transition);
}

.hk-popup__lenke:hover {
	color: var(--hk-color-primary);
}

.hk-popup__lenke svg {
	transition: transform var(--hk-transition);
}

.hk-popup__lenke:hover svg {
	transform: translateX(3px);
}

/* ============================================================ */
/* Sidepanel med liste                                           */
/* ============================================================ */

.hk-kart__sidepanel {
	background: #ffffff;
	border-left: 1px solid var(--hk-color-border);
	overflow-y: auto;
	max-height: 100%;
}

.hk-kart__sidepanel-hode {
	padding: var(--hk-space-md);
	border-bottom: 1px solid var(--hk-color-border);
	position: sticky;
	top: 0;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 2;
}

.hk-kart__sidepanel-tittel {
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--hk-color-text-muted);
	margin: 0;
	letter-spacing: 0.02em;
}

.hk-kart__liste {
	list-style: none;
	padding: 0;
	margin: 0;
}

.hk-kart__liste-item {
	border-bottom: 1px solid var(--hk-color-border);
}

.hk-kart__liste-item:last-child {
	border-bottom: none;
}

.hk-kart__liste-knapp {
	display: flex;
	align-items: stretch;
	gap: var(--hk-space-sm);
	width: 100%;
	padding: var(--hk-space-sm) var(--hk-space-md);
	background: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	color: inherit;
	transition: background-color var(--hk-transition);
	position: relative;
}

.hk-kart__liste-knapp::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background: transparent;
	transition: background-color var(--hk-transition);
}

.hk-kart__liste-knapp:hover {
	background: var(--hk-color-bg-soft);
}

.hk-kart__liste-item--aktiv .hk-kart__liste-knapp {
	background: var(--hk-color-primary-light);
}

.hk-kart__liste-item--aktiv .hk-kart__liste-knapp::before {
	background: var(--hk-color-primary);
}

.hk-kart__liste-bilde {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: var(--hk-radius-sm);
	background-size: cover;
	background-position: center;
	background-color: var(--hk-color-primary-light);
}

.hk-kart__liste-bilde--tom {
	background-image: linear-gradient(135deg,
		var(--hk-color-primary-light) 0%,
		#dde8f0 100%);
}

.hk-kart__liste-tekst {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
	padding-top: 2px;
}

.hk-kart__liste-omrade {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--hk-color-text-muted);
	font-weight: 500;
}

.hk-kart__liste-tittel {
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--hk-color-text);
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hk-kart__liste-kategori {
	font-size: 0.72rem;
	color: var(--hk-color-text-muted);
	margin-top: 2px;
}

/* ============================================================ */
/* Tom-tilstand                                                  */
/* ============================================================ */

.hk-kart__tom {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--hk-space-xl);
	background: rgba(255, 255, 255, 0.94);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	text-align: center;
	color: var(--hk-color-text-muted);
}

.hk-kart__tom p {
	margin: 0 0 var(--hk-space-xs);
}

.hk-kart__tom-hint {
	font-size: 0.85rem;
	opacity: 0.7;
}

/* ============================================================ */
/* Overrides for Leaflet kontroller                              */
/* ============================================================ */

.leaflet-container {
	font-family: inherit !important;
	background: var(--hk-color-bg-soft) !important;
}

.leaflet-control-zoom {
	border: 1px solid var(--hk-color-border) !important;
	border-radius: var(--hk-radius-sm) !important;
	box-shadow: var(--hk-shadow-sm) !important;
	overflow: hidden;
}

.leaflet-control-zoom a {
	background: #ffffff !important;
	color: var(--hk-color-text) !important;
	border: none !important;
	width: 32px !important;
	height: 32px !important;
	line-height: 32px !important;
	font-size: 1.1rem !important;
	transition: background-color var(--hk-transition);
}

.leaflet-control-zoom a:hover {
	background: var(--hk-color-primary-light) !important;
	color: var(--hk-color-primary) !important;
}

.leaflet-control-zoom a:first-child {
	border-bottom: 1px solid var(--hk-color-border) !important;
}

.leaflet-control-attribution {
	background: rgba(255, 255, 255, 0.85) !important;
	font-size: 0.7rem !important;
	padding: 2px 8px !important;
	border-radius: var(--hk-radius-sm) 0 0 0 !important;
}

.leaflet-control-attribution a {
	color: var(--hk-color-text-muted) !important;
}

/* ============================================================ */
/* Responsivt                                                    */
/* ============================================================ */

@media (max-width: 860px) {
	.hk-kart-wrapper--med-liste {
		grid-template-columns: 1fr;
		grid-template-rows: 1fr auto;
	}

	.hk-kart__sidepanel {
		border-left: none;
		border-top: 1px solid var(--hk-color-border);
		max-height: 360px;
	}
}
