/* ==========================================================
   Kollektivspleis.no - globale stiler
   ========================================================== */

:root {
	--primary: #3b3ef0;
	--primary-dark: #2a2bc4;
	--primary-soft: #ecebff;
	--accent: #ff6b4a;
	--accent-soft: #fff0eb;
	--mint: #12b886;
	--mint-soft: #e3f8f0;
	--sun: #ffb020;
	--sun-soft: #fff5e0;
	--ink: #15163a;
	--muted: #5d6183;
	--line: #e7e6f0;
	--bg: #fbfaf7;
	--card: #ffffff;
	--danger: #e03131;
	--radius: 18px;
	--radius-sm: 12px;
	--shadow-sm: 0 2px 8px rgba(21, 22, 58, .06);
	--shadow: 0 10px 30px rgba(21, 22, 58, .08);
	--shadow-lg: 0 24px 60px rgba(21, 22, 58, .16);
	--topbar-h: 68px;
	--font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
section { padding: 96px 0; position: relative; }
.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head p { color: var(--muted); font-size: 1.1rem; }

.eyebrow {
	display: inline-flex; align-items: center; gap: 8px;
	font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
	color: var(--primary); background: var(--primary-soft);
	padding: 6px 14px; border-radius: 99px; margin-bottom: 18px;
}

/* ---------- Knapper ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	font: inherit; font-weight: 700; font-size: 1rem;
	padding: 14px 24px; border-radius: 99px; border: 2px solid transparent;
	text-decoration: none; cursor: pointer; white-space: nowrap;
	transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(59, 62, 240, .3); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 12px 28px rgba(59, 62, 240, .38); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(255, 107, 74, .3); }
.btn-accent:hover { box-shadow: 0 12px 28px rgba(255, 107, 74, .4); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-white { background: #fff; color: var(--ink); }
.btn-sm { padding: 9px 18px; font-size: .92rem; }
.btn-block { width: 100%; }

/* ---------- Topplinje ---------- */
.topbar {
	position: fixed; top: 0; left: 0; right: 0; z-index: 900;
	height: var(--topbar-h); width: 100%;
	background: rgba(251, 250, 247, .82);
	backdrop-filter: saturate(160%) blur(14px);
	-webkit-backdrop-filter: saturate(160%) blur(14px);
	border-bottom: 1px solid transparent;
	transition: box-shadow .25s ease, border-color .25s ease, background .25s ease;
}
.topbar.scrolled { border-color: var(--line); box-shadow: 0 6px 24px rgba(21, 22, 58, .07); background: rgba(255, 255, 255, .92); }
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; margin-right: auto; }
.brand em { font-style: normal; color: var(--primary); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-size: .58em; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-top: 2px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 10px; }
.topnav { display: flex; gap: 4px; margin-right: 8px; }
.topnav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 14px; border-radius: 99px; transition: background .2s; }
.topnav a:hover { background: var(--primary-soft); color: var(--primary); }

.hamburger {
	width: 46px; height: 46px; flex: none; border: 0; border-radius: 14px; cursor: pointer;
	background: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
	transition: background .2s, transform .2s;
}
.hamburger:hover { background: var(--primary); transform: scale(1.04); }
.hamburger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: #fff; transition: transform .3s ease, opacity .2s ease; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hamburgermeny ---------- */
.menu-backdrop {
	position: fixed; inset: 0; z-index: 880; background: rgba(21, 22, 58, .35);
	opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.menu-backdrop.open { opacity: 1; visibility: visible; }
.sidemenu {
	position: fixed; z-index: 890; right: 12px; top: calc(var(--topbar-h) + 10px);
	width: min(340px, calc(100% - 24px)); max-height: calc(100vh - var(--topbar-h) - 22px); overflow-y: auto;
	background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); padding: 14px;
	transform: translateX(calc(100% + 24px)); transition: transform .38s cubic-bezier(.2, .9, .3, 1.05);
}
.sidemenu.open { transform: translateX(0); }
.sidemenu nav a {
	display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
	color: var(--ink); text-decoration: none; font-weight: 600; transition: background .2s, transform .2s;
}
.sidemenu nav a i { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: .95rem; }
.sidemenu nav a:hover { background: var(--bg); transform: translateX(-3px); }
.sidemenu .menu-label { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 14px 4px; }
.sidemenu .menu-actions { display: grid; gap: 8px; padding: 12px 6px 6px; border-top: 1px solid var(--line); margin-top: 10px; }
.sidemenu.open nav a { animation: menuItemIn .4s ease both; }
.sidemenu.open nav a:nth-child(2) { animation-delay: .03s; }
.sidemenu.open nav a:nth-child(3) { animation-delay: .06s; }
.sidemenu.open nav a:nth-child(4) { animation-delay: .09s; }
.sidemenu.open nav a:nth-child(5) { animation-delay: .12s; }
.sidemenu.open nav a:nth-child(6) { animation-delay: .15s; }
.sidemenu.open nav a:nth-child(7) { animation-delay: .18s; }
@keyframes menuItemIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #c9cae0; padding: 72px 0 32px; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer .brand { color: #fff; margin-bottom: 14px; }
.footer .brand em { color: #9fa1ff; }
.footer .brand-text small { color: #9a9cbc; }
.footer h4 { color: #fff; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer a { color: #c9cae0; text-decoration: none; transition: color .2s; }
.footer a:hover { color: #fff; }
.footer-note { font-size: .85rem; color: #8f91b3; max-width: 380px; }
.footer-bottom { margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; color: #8f91b3; font-size: .85rem; }
.footer-social { display: flex; gap: 10px; }
.footer-social a { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .08); transition: background .2s, transform .2s; }
.footer-social a:hover { background: var(--primary); transform: translateY(-3px); }

/* ---------- Skjema ---------- */
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 700; font-size: .9rem; }
.field .req { color: var(--accent); }
.input, .select {
	font: inherit; font-size: 1rem; width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
	border: 2px solid var(--line); background: #fff; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.choice-group { display: flex; gap: 10px; flex-wrap: wrap; }
.choice { position: relative; flex: 1 1 140px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
	display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 14px;
	border: 2px solid var(--line); border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; background: #fff;
	transition: border-color .2s, background .2s, color .2s;
}
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.choice input:focus-visible + span { box-shadow: 0 0 0 4px var(--primary-soft); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--muted); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.reveal.visible { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }

/* ==========================================================
   showError / showInfo
   ========================================================== */
.msgbox-backdrop {
	position: fixed; inset: 0; z-index: 2000; background: rgba(21, 22, 58, .4);
	opacity: 0; transition: opacity .25s ease;
}
.msgbox-backdrop.show { opacity: 1; }
.msgbox {
	position: fixed; z-index: 2001; left: 50%;
	width: calc(100% - 50px); max-width: 500px; min-height: 100px;
	background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
	padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 16px;
	opacity: 0; transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
.msgbox-error { bottom: 24px; transform: translate(-50%, 40px); border-top: 6px solid var(--danger); }
.msgbox-error.show { opacity: 1; transform: translate(-50%, 0); }
.msgbox-info { top: 50%; transform: translate(-50%, -50%) scale(.9); border-top: 6px solid var(--primary); }
.msgbox-info.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.msgbox-body { display: flex; gap: 18px; align-items: center; padding-right: 30px; }
.msgbox-icon { font-size: 52px; line-height: 1; flex: none; min-height: 52px; display: flex; align-items: center; }
.msgbox-error .msgbox-icon { color: var(--danger); }
.msgbox-info .msgbox-icon { color: var(--primary); }
.msgbox-text { font-size: 1.02rem; font-weight: 600; color: var(--ink); word-break: break-word; }
.msgbox-timer { position: absolute; top: 16px; right: 16px; width: 24px; height: 24px; }
.msgbox-timer .ring { fill: none; stroke: var(--line); stroke-width: 2; }
.msgbox-timer .pie { fill: none; stroke-width: 10; stroke-dasharray: 31.416; stroke-dashoffset: 31.416; transform: rotate(-90deg); transform-origin: 12px 12px; }
.msgbox-error .msgbox-timer .pie { stroke: rgba(224, 49, 49, .35); }
.msgbox-info .msgbox-timer .pie { stroke: rgba(59, 62, 240, .3); }
.msgbox-timer .hand { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.msgbox-timer.run .pie { animation: msgPieFill linear forwards; }
@keyframes msgPieFill { to { stroke-dashoffset: 0; } }
.msgbox-close { width: 100%; }
.msgbox-error .msgbox-close { background: var(--danger); box-shadow: none; }

/* ---------- Juridiske sider (vilkar, personvern) ---------- */
.legal-hero { padding: calc(var(--topbar-h) + 64px) 0 40px; overflow: hidden; }
.legal-hero::before {
	content: ""; position: absolute; width: 640px; height: 640px; right: -200px; top: -260px; border-radius: 50%;
	background: radial-gradient(circle, rgba(59, 62, 240, .14), rgba(59, 62, 240, 0) 65%); pointer-events: none;
}
.legal-hero h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: 14px; }
.legal-hero p { color: var(--muted); font-size: 1.1rem; max-width: 680px; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 20px; font-size: .9rem; color: var(--muted); }
.legal-meta span { display: inline-flex; align-items: center; gap: 8px; }
.legal-meta i { color: var(--primary); }

section.legal { padding: 16px 0 96px; }
.legal-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; align-items: start; }
.legal-toc { position: sticky; top: calc(var(--topbar-h) + 24px); }
.legal-toc h4 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.legal-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-left: 2px solid var(--line); }
.legal-toc li { counter-increment: toc; }
.legal-toc a {
	display: block; padding: 6px 0 6px 16px; margin-left: -2px; border-left: 2px solid transparent;
	color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; line-height: 1.4;
	transition: color .2s, border-color .2s;
}
.legal-toc a::before { content: counter(toc) ". "; font-weight: 700; }
.legal-toc a:hover, .legal-toc a.active { color: var(--primary); border-left-color: var(--primary); }

.legal-body {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	box-shadow: var(--shadow-sm); padding: 48px 56px;
}
.legal-body > section { padding: 0; margin: 0 0 40px; scroll-margin-top: calc(var(--topbar-h) + 24px); }
.legal-body > section:last-child { margin-bottom: 0; }
.legal-body h2 { font-size: 1.45rem; margin-bottom: 14px; display: flex; gap: 12px; align-items: baseline; }
.legal-body h2 .num { color: var(--primary); font-size: 1rem; min-width: 1.6em; }
.legal-body h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.legal-body p, .legal-body li { color: #34375c; }
.legal-body ul { margin: 0 0 1em; padding-left: 1.3em; }
.legal-body li { margin-bottom: 6px; }
.legal-body a { color: var(--primary); }
.legal-note {
	display: flex; gap: 14px; align-items: flex-start; margin: 0 0 40px; padding: 18px 20px;
	background: var(--primary-soft); border-radius: var(--radius-sm); font-size: .95rem;
}
.legal-note i { color: var(--primary); margin-top: 4px; }
.legal-note p { margin: 0; color: var(--ink); }
.legal-table { width: 100%; border-collapse: collapse; margin: 8px 0 1em; font-size: .93rem; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.legal-table th { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg); }
.legal-table-wrap { overflow-x: auto; }

@media (max-width: 960px) {
	.legal-grid { grid-template-columns: 1fr; gap: 24px; }
	.legal-toc { position: static; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
}
@media (max-width: 640px) {
	.legal-hero { padding: calc(var(--topbar-h) + 40px) 0 24px; }
	section.legal { padding: 8px 0 72px; }
	.legal-body { padding: 28px 20px; }
	.legal-table thead { display: none; }
	.legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; width: 100%; }
	.legal-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
	.legal-table td { border: 0; padding: 4px 0; }
	.legal-table td::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
}

/* ---------- Responsivt (globalt) ---------- */
@media (max-width: 960px) {
	.topnav { display: none; }
	.footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
	body { font-size: 16px; }
	section { padding: 72px 0; }
	.wrap { padding: 0 16px; }
	.topbar-inner { padding: 0 16px; gap: 8px; }
	.topbar-login { display: none; }
	.footer-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 400px) {
	.brand { font-size: 1.05rem; gap: 8px; }
	.brand-logo { width: 32px; height: 32px; }
	.topbar-cta { padding: 8px 12px; font-size: .8rem; }
	.msgbox-body { gap: 14px; }
}
