/*
	Moderniserande tillägg för Sveriges Kompassjusterareförbund.
	Läggs efter style.css och skriver över äldre fasta bredder utan att kräva ny plattform.
*/

html {
	font-size: 16px;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(circle at 20% 0%, rgba(255,255,255,0.95), rgba(244,246,248,0.92) 48%, rgba(231,235,239,0.92) 100%);
	color: #24303a;
	font-family: Arial, Helvetica, sans-serif;
	line-height: 1.6;
}

body::before {
	content: "";
	position: fixed;
	right: -190px;
	top: 90px;
	width: 680px;
	height: 680px;
	background: url("bilder/compass-rose-bg.svg") no-repeat center center;
	background-size: contain;
	opacity: 0.065;
	pointer-events: none;
	z-index: 0;
	transform: translate3d(0,0,0);
}

body::after {
	content: "";
	position: fixed;
	left: -260px;
	bottom: -260px;
	width: 520px;
	height: 520px;
	border-radius: 50%;
	background: rgba(30, 70, 105, 0.055);
	pointer-events: none;
	z-index: 0;
}

#page {
	position: relative;
	z-index: 1;
	width: min(1480px, calc(100% - 32px));
	max-width: 1480px;
	margin: 22px auto;
	background: rgba(255,255,255,0.96);
	border: 1px solid rgba(40,60,80,0.10);
	border-radius: 14px;
	box-shadow: 0 18px 48px rgba(25, 40, 55, 0.14);
	overflow: hidden;
}

#head {
	padding: 22px 28px 0 28px;
	background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,249,251,0.98));
}

#head img {
	max-width: 100%;
	height: auto;
	margin-bottom: 14px;
}

/* Huvudmeny */
#menu {
	display: flex;
	align-items: center;
	height: auto;
	min-height: 48px;
	padding: 0;
	margin: 0 -28px;
	background: #1d4265;
	background-image: none;
	text-align: left;
}

#menu ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	align-items: center;
	margin: 0;
	padding: 0 18px;
	list-style: none;
}

#menu li {
	display: flex;
	align-items: center;
	margin: 0;
	list-style-type: none;
	font-weight: bold;
}

#menu a,
#menu a:link,
#menu a:visited {
	display: flex;
	align-items: center;
	min-height: 42px;
	padding: 0.55rem 14px;
	color: #ffffff;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border-bottom: 3px solid transparent;
	box-sizing: border-box;
}

#menu a:hover,
#menu a:focus {
	background: rgba(255,255,255,0.12);
	border-bottom-color: rgba(255,255,255,0.8);
	text-decoration: none;
	outline: none;
}

/* Grundlayout */
#mid {
	float: none;
	width: 100%;
	box-sizing: border-box;
	padding: 0 28px 34px 28px;
}

#mid::after {
	content: "";
	display: block;
	clear: both;
}

#bread {
	padding: 16px 0 6px 0;
	font-size: 0.82rem;
	color: #65727e;
}

#content,
#wcontent {
	width: auto;
	max-width: none;
	margin: 0;
}

#sidebar {
	width: 270px;
	float: right;
	margin: 4px 0 24px 32px;
}

#sidebar-background {
	padding: 18px;
	margin: 18px 0 0 0;
	background: #f3f6f8;
	border: 1px solid #dfe7ed;
	border-radius: 10px;
}

/* Stabil tvåkolumnslayout för sidor med #content + #sidebar */
@media (min-width: 821px) {
	#mid {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 220px;
		column-gap: 32px;
		align-items: start;
	}

	#bread {
		grid-column: 1 / -1;
	}

	#content {
		grid-column: 1;
		grid-row: 2;
		width: auto;
		max-width: none;
		float: none;
		clear: none;
		min-width: 0;
		margin: 0;
	}

	#sidebar {
		grid-column: 2;
		grid-row: 2;
		width: auto;
		max-width: none;
		float: none;
		clear: none;
		margin: 0;
	}

	#sidebar-background {
		margin-top: 0;
	}

	.clearfloats,
	#foot {
		grid-column: 1 / -1;
	}
}

/* Typografi */
h1, h2, h3, h4, h5,
div, p, table, ul, li {
	font-family: Arial, Helvetica, sans-serif;
	color: #24303a;
}

h1, h2, h3 {
	font-family: Georgia, "Times New Roman", Times, serif;
	line-height: 1.2;
}

h1 {
	margin: 28px 0 16px 0;
	font-size: 2.0rem;
	color: #173955;
}

h2 {
	margin: 30px 0 12px 0;
	font-size: 1.45rem;
	color: #1d4265;
}

h3 {
	margin: 22px 0 10px 0;
	font-size: 1.18rem;
	color: #24303a;
}

p {
	margin: 0 0 14px 0;
	font-size: 1rem;
}

li {
	margin-bottom: 8px;
}

a:link,
a:visited {
	color: #0b5c93;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover,
a:focus {
	color: #063f66;
	text-decoration-thickness: 2px;
}

table {
	max-width: 100%;
	border-collapse: collapse;
}

iframe {
	max-width: 100%;
	border: 0;
}

img {
	max-width: 100%;
	height: auto;
}

div.links {
	height: auto;
	min-height: 95px;
	margin: 0 0 18px 0;
	padding: 14px 0;
	border-bottom: 1px solid #d7dee5;
}

.links img {
	float: right;
	margin-left: 18px;
	max-width: 160px;
}

div.block {
	font-size: 1rem;
	margin-bottom: 18px;
}

#foot {
	clear: both;
	margin-top: 26px;
	padding: 18px 28px;
	border-top: 1px solid #c9d6e2;
	background: #1d4265;
}

#foot p {
	margin: 0 0 6px 0;
	font-size: 0.85rem;
	color: #ffffff;
	text-align: center;
}

#foot a:link,
#foot a:visited,
#foot a:hover,
p.cred,
p.cred a:link,
p.cred a:visited,
p.cred a:hover {
	color: #ffffff;
}

#box {
	position: fixed;
	top: 110px;
	left: 50%;
	transform: translateX(-50%);
	width: min(420px, calc(100vw - 48px));
	max-height: calc(100vh - 150px);
	overflow: auto;
	padding: 20px;
	background: #ffffff;
	border: 1px solid #b9c7d2;
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(20,30,40,0.25);
	font-size: 0.95rem;
	z-index: 20;
	visibility: hidden;
}

span.rubrik {
	font-size: 1.15rem;
	color: #173955;
}

/* Startsida och allmänna innehållssidor */
#content > p:first-of-type,
#wcontent > p:first-of-type {
	font-size: 1.08rem;
}

#content h1[style],
#wcontent h1[style],
#content h2[style],
#wcontent h2[style] {
	border-left: 5px solid #b62424;
	padding-left: 12px;
}

/* Medlemssidor */
.member-index {
	margin: 18px 0 28px 0;
	padding: 18px;
	background: #f3f6f8;
	border: 1px solid #dfe7ed;
	border-radius: 10px;
}

.member-index h2 {
	margin-top: 0;
}

.member-index p {
	margin-bottom: 16px;
}

.member-index a {
	display: inline-block;
	margin: 0 6px 8px 0;
	padding: 6px 10px;
	background: #ffffff;
	border: 1px solid #d7e1e8;
	border-radius: 999px;
	text-decoration: none;
}

.map-section,
.map-layout {
	width: 100%;
	margin: 18px 0 34px 0;
}

.map-section {
	display: grid;
	grid-template-columns: minmax(320px, 2fr) minmax(240px, 1fr);
	gap: 24px;
	align-items: start;
}

.map-section iframe,
.map-layout iframe {
	width: 100%;
	min-height: 520px;
	border: 1px solid #cbd8e2;
	border-radius: 10px;
}

.map-card,
.map-info {
	padding: 18px;
	background: #f7f9fb;
	border: 1px solid #dfe7ed;
	border-radius: 10px;
}

.map-layout td {
	display: block;
	vertical-align: top;
}

.map-layout tr {
	display: grid;
	grid-template-columns: minmax(320px, 2fr) minmax(240px, 1fr);
	gap: 24px;
}

.member-area {
	margin: 34px 0 42px 0;
	padding-top: 18px;
	border-top: 2px solid #cbd8e2;
}

.member-area > h3 {
	margin: 0 0 20px 0;
	padding: 0 0 8px 0;
	font-size: 1.55rem;
	color: #173955;
	border-bottom: 1px solid #e4ebf1;
}

.member-town {
	margin: 24px 0 30px 0;
	padding-top: 18px;
	border-top: 1px solid #dfe7ed;
}

.member-town:first-of-type {
	border-top: 0;
	padding-top: 0;
}

.member-town > h4 {
	margin: 0 0 14px 0;
	font-size: 1.25rem;
	color: #334e62;
}

.member-list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px;
}

.member {
	margin: 0 0 16px 0;
	padding: 16px 18px;
	background: #ffffff;
	border: 1px solid #dfe7ed;
	border-left: 5px solid #8fa9be;
	border-radius: 10px;
	box-shadow: 0 6px 18px rgba(25,40,55,0.05);
}

.member h4,
.member h5 {
	margin: 0 0 8px 0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1.06rem;
	line-height: 1.3;
	color: #24303a;
}

.member p {
	margin: 0 0 8px 0;
	line-height: 1.5;
}

.member em {
	color: #4c5b66;
}

/* Interna sidan */
body.internal #page {
	border-color: rgba(183, 38, 35, 0.24);
}

body.internal #menu {
	background: #7c2323;
}

body.internal #foot {
	background: #7c2323;
	border-top-color: #7c2323;
}

body.internal #content h1:first-child::after {
	content: "Intern sida";
	display: inline-block;
	margin-left: 10px;
	padding: 4px 8px;
	border-radius: 999px;
	background: #f8e8e8;
	color: #7c2323;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 0.82rem;
	font-weight: bold;
	vertical-align: middle;
}

/* Mobil */
@media (max-width: 820px) {
	body {
		background: #ffffff;
	}

	body::before {
		width: 320px;
		height: 320px;
		right: -150px;
		top: 160px;
		opacity: 0.04;
	}

	#page {
		width: 100%;
		max-width: none;
		margin: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	#head {
		padding: 16px 18px 0 18px;
	}

	#menu {
		display: block;
		min-height: 0;
		margin: 0 -18px;
	}

	#menu ul {
		display: block;
		padding: 0;
	}

	#menu li {
		display: block;
		border-top: 1px solid rgba(255,255,255,0.12);
	}

	#menu a,
	#menu a:link,
	#menu a:visited {
		min-height: 44px;
		padding: 0.7rem 18px;
		font-size: 1.05rem;
		border-bottom: 0;
	}

	#mid {
		display: block;
		padding: 0 18px 24px 18px;
	}

	#content,
	#wcontent {
		max-width: none;
		width: auto;
		float: none;
		clear: both;
		margin-left: 0;
		margin-right: 0;
	}

	#sidebar {
		float: none;
		width: auto;
		max-width: none;
		clear: both;
		margin: 22px 0 0 0;
	}

	h1 {
		font-size: 1.65rem;
	}

	h2 {
		font-size: 1.28rem;
	}

	.map-section,
	.map-layout tr {
		display: block;
	}

	.map-section iframe,
	.map-layout iframe {
		min-height: 360px;
		margin-bottom: 16px;
	}

	.map-info {
		padding-left: 18px;
	}

	.member-list {
		display: block;
	}

	.links img {
		float: none;
		display: block;
		margin: 0 0 12px 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto !important;
	}

	body::before {
		position: absolute;
	}
}

/* Expanderbara dokumentlistor på medlemssidan */
.document-tree {
	margin: 20px 0 28px 0;
}

.document-group {
	margin: 0 0 12px 0;
	border: 1px solid #dfe7ed;
	border-radius: 10px;
	background: #ffffff;
	overflow: hidden;
}

.document-group summary {
	cursor: pointer;
	padding: 12px 16px;
	font-weight: 700;
	color: #173955;
	background: #f3f6f8;
	list-style-position: inside;
}

.document-group summary:hover,
.document-group summary:focus {
	background: #e9f0f5;
	outline: none;
}

.document-group ul {
	margin: 0;
	padding: 12px 18px 14px 34px;
}

.document-group li {
	margin-bottom: 8px;
	line-height: 1.45;
}

/* Intern sida: håll dokumentträdet högst upp i högerlisten */
@media (min-width: 821px) {
	body.internal #sidebar {
		align-self: start;
		margin-top: 0 !important;
	}

	body.internal #sidebar > *:first-child {
		margin-top: 0 !important;
	}

	body.internal .document-tree,
	body.internal .document-group:first-child {
		margin-top: 0 !important;
	}
}

/* Mobilmeny: låt det blå fältet växa med menyraderna */
@media (max-width: 820px) {
	#menu {
		display: block !important;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow: visible !important;
		background: #1d4265 !important;
		background-image: none !important;
		margin: 0 -18px !important;
		padding: 0 !important;
	}

	body.internal #menu {
		background: #7c2323 !important;
		background-image: none !important;
	}

	#menu ul {
		display: block !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: inherit !important;
	}

	#menu li {
		display: block !important;
		float: none !important;
		clear: both !important;
		width: auto !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: inherit !important;
		border-top: 1px solid rgba(255,255,255,0.14);
	}

	#menu a,
	#menu a:link,
	#menu a:visited {
		display: block !important;
		width: auto !important;
		height: auto !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 12px 18px !important;
		color: #ffffff !important;
		background: transparent !important;
		border-bottom: 0 !important;
		line-height: 1.25 !important;
		box-sizing: border-box !important;
	}

	#menu a:hover,
	#menu a:focus {
		background: rgba(255,255,255,0.12) !important;
	}
}

/* Mobilmeny: vänsterjustera menytexterna */
@media (max-width: 820px) {
	#menu a,
	#menu a:link,
	#menu a:visited {
		text-align: left !important;
		justify-content: flex-start !important;
		align-items: center !important;
	}
}

/* Mobil: anpassa loggan, men begränsa maxbredden */
@media (max-width: 820px) {
	#head a:first-child {
		display: block;
		width: 100%;
		text-align: left;
	}

	#head img {
		display: block;
		width: calc(100% - 16px);
		max-width: 500px;
		height: auto;
		margin: 0 8 14px 0;
	}
}

/* Mobil startsida:
   Meny till vänster, snabbval/devtabell till höger, texten under i full bredd */
#mobile-home-panel {
	display: none;
}

@media (max-width: 820px) {
	html,
	body {
		width: 100%;
		max-width: 100%;
		overflow-x: hidden;
	}

	body.home #page {
		width: 100%;
		max-width: none;
		margin: 0;
	}

	body.home #head {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 42%;
		grid-template-areas:
			"logo logo"
			"menu mobilepanel";
		column-gap: 10px;
		align-items: start;
		padding: 14px 14px 0 14px;
	}

	body.home #head > a:first-child {
		grid-area: logo;
		display: block;
		width: 100%;
		text-align: left;
	}

	body.home #head > a:first-child img {
		display: block;
		width: calc(100% - 20px);
		max-width: 500px;
		height: auto;
		margin: 0 0 14px 0;
	}

	body.home #menu {
		grid-area: menu;
		margin: 0;
		width: auto;
		background: #1d4265 !important;
		border-radius: 0;
		overflow: visible;
	}

	body.home #menu ul {
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body.home #menu li {
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body.home #menu a,
	body.home #menu a:link,
	body.home #menu a:visited {
		display: block !important;
		padding: 11px 10px !important;
		font-size: 0.95rem !important;
		line-height: 1.2 !important;
		text-align: left !important;
		justify-content: flex-start !important;
	}

	body.home #mobile-home-panel {
		grid-area: mobilepanel;
		display: block;
		min-width: 0;
	}

	body.home #mobile-home-links {
		padding: 10px;
		background: #f3f6f8;
		border: 1px solid #dfe7ed;
		border-radius: 8px;
	}

	body.home #mobile-home-links span.rubrik {
		display: block;
		margin: 0 0 6px 0;
		font-size: 0.95rem;
		font-weight: bold;
	}

	body.home #mobile-home-links ul {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	body.home #mobile-home-links li {
		margin: 0 0 7px 0;
		font-size: 0.82rem;
		line-height: 1.2;
	}

	body.home #mobile-home-links a {
		display: block;
	}

	body.home #mobile-home-image {
		margin-top: 10px;
	}

	body.home #mobile-home-image img {
		display: block;
		width: 100%;
		max-width: 100%;
		height: auto;
		border-radius: 8px;
	}

	/* Dölj den vanliga högerkolumnen på mobil, eftersom den nu visas uppe vid menyn */
	body.home #mid > #sidebar {
		display: none !important;
	}

	/* Huvudtexten fyller hela bredden under sidhuvudet */
	body.home #mid {
		display: block !important;
		width: 100%;
		padding: 0 14px 24px 14px;
		box-sizing: border-box;
	}

	body.home #content {
		width: 100% !important;
		max-width: none !important;
		float: none !important;
		clear: both !important;
		margin: 0 !important;
	}
}

