/* Matheasy — shared styles for legal pages (vilkaar, personvern).
   Same visual language as for-skoler.html. */
:root {
  --bg-0: #1a1a2e;
  --bg-1: #16213e;
  --surface: oklch(1 0 0 / 0.035);
  --ink: oklch(0.97 0.01 80);
  --ink-soft: oklch(0.82 0.02 260);
  --ink-muted: oklch(0.65 0.02 260);
  --ink-faint: oklch(0.48 0.015 260);
  --rule: oklch(1 0 0 / 0.09);
  --rule-strong: oklch(1 0 0 / 0.16);
  --accent: oklch(0.76 0.14 50);

  --display: 'Gambarino', 'Times New Roman', serif;
  --body: 'Satoshi', system-ui, sans-serif;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 4.5vw, 2.6rem);

  --ease-out: cubic-bezier(0.2, 0.7, 0.15, 1);
  --ease-elegant: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(16px, 0.95rem + 0.18vw, 18px);
  line-height: 1.65;
  font-weight: 400;
  font-feature-settings: 'ss01', 'ss02', 'cv11', 'calt';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
  opacity: 0.55;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 90vw 60vh at 18% 8%, oklch(0.76 0.14 50 / 0.07) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

main, .topbar, footer { position: relative; z-index: 1; }

/* ---- Topbar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1.2rem, 2.8vw, 1.8rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(6px);
}
.logo {
  font-family: var(--display);
  font-size: 1.4rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: transform 160ms var(--ease-out);
}
.logo-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
}
.logo:active { transform: scale(0.97); }

.topbar nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 1.8rem);
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.topbar nav a {
  color: inherit;
  text-decoration: none;
  position: relative;
  padding-bottom: 3px;
  transition: color 220ms var(--ease-soft);
}
.topbar nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 380ms var(--ease-out);
}
.topbar nav a[aria-current="page"] { color: var(--ink); }
.topbar nav a[aria-current="page"]::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) {
  .topbar nav a:hover { color: var(--ink); }
  .topbar nav a:hover::after { transform: scaleX(1); }
}

/* ---- Shell ---- */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 5vw, 4rem);
  padding: clamp(3.5rem, 9vw, 7rem) var(--gutter) clamp(4rem, 9vw, 7rem);
  max-width: 1180px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .shell {
    grid-template-columns: 130px 1fr;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }
}

/* ---- Masthead ---- */
.masthead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
@media (min-width: 900px) {
  .masthead {
    grid-template-columns: 130px 1fr;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }
}
.masthead-label {
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  padding-top: 0.55rem;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}
.masthead-label::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-4px);
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5.5vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
  color: var(--ink);
  max-width: 16ch;
}
.masthead h1 em {
  font-style: italic;
  color: var(--accent);
}
.masthead .lede {
  font-family: var(--body);
  font-weight: 300;
  font-size: clamp(1.05rem, 1.4vw, 1.18rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 56ch;
  margin-top: 1.5rem;
  letter-spacing: -0.003em;
}
.meta-line {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 1.2rem;
  letter-spacing: 0.02em;
  max-width: var(--measure);
}

/* ---- Legal article ---- */
.legal {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3rem);
}
@media (min-width: 900px) {
  .legal {
    grid-template-columns: 130px 1fr;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }
}

section.block {
  display: contents;
}
@media (min-width: 900px) {
  section.block {
    display: grid;
    grid-template-columns: 130px 1fr;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
    grid-column: 1 / -1;
  }
}

.section-meta {
  font-family: var(--body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.7rem;
}
.section-meta .num {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  font-size: 1.8rem;
  color: var(--accent);
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.section-body {
  max-width: var(--measure);
  padding-top: 0.3rem;
}
.section-body h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  max-width: 24ch;
  color: var(--ink);
}
.section-body h3.sub {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  margin: 1.6rem 0 0.7rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--accent);
}
.section-body p {
  margin-bottom: 1rem;
  color: var(--ink-soft);
}
.section-body p.soft { color: var(--ink-muted); }
.section-body p.note {
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--rule-strong);
  background: var(--surface);
  font-size: 0.95rem;
  margin-top: 1.2rem;
}
.section-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 220ms var(--ease-soft);
}
.section-body a:hover { color: var(--accent); }
.section-body strong { color: var(--ink); font-weight: 500; }

/* Bulleted lists */
.bullets {
  list-style: none;
  margin: 0.6rem 0 1.2rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.bullets li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--ink-soft);
}
.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

/* ---- Facts ---- */
.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
@media (min-width: 600px) {
  .facts { grid-template-columns: minmax(180px, auto) 1fr; column-gap: 2rem; }
}
.facts dt {
  padding: 0.9rem 0 0.2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  font-weight: 500;
}
.facts dd {
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.98rem;
  font-weight: 400;
}
@media (min-width: 600px) {
  .facts dt {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.9rem;
    display: flex;
    align-items: flex-start;
    white-space: normal;
  }
}

/* ---- Contact ---- */
.contact {
  grid-column: 1 / -1;
  background: var(--surface);
  padding: clamp(2rem, 4vw, 3rem);
  margin-top: clamp(1.5rem, 3vw, 2.2rem);
  display: grid;
  gap: 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.contact::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  opacity: 0.6;
}
@media (min-width: 900px) {
  .contact {
    grid-template-columns: 1fr auto;
    align-items: end;
    column-gap: 3rem;
  }
}
.contact .eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.contact .eyebrow::before {
  content: '';
  width: 18px; height: 1px;
  background: var(--accent);
  transform: translateY(-3px);
}
.contact h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
  max-width: 22ch;
  color: var(--ink);
}
.contact p {
  color: var(--ink-muted);
  max-width: 46ch;
  font-weight: 300;
}
.contact a.email {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding-bottom: 6px;
  letter-spacing: -0.008em;
  transition: color 220ms var(--ease-soft), transform 160ms var(--ease-out);
}
.contact a.email::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--accent);
}
@media (hover: hover) and (pointer: fine) {
  .contact a.email:hover { color: var(--accent); }
}
.contact a.email:active { transform: scale(0.97); }

/* ---- Footer ---- */
footer {
  padding: clamp(2rem, 4vw, 2.8rem) var(--gutter);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
  max-width: 1180px;
  margin: 0 auto;
}
footer .mark {
  font-family: var(--display);
  font-style: italic;
  color: var(--ink-muted);
  letter-spacing: -0.005em;
}
.foot-links {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}
footer a {
  color: var(--ink-muted);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 220ms var(--ease-soft);
}
footer a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0.3);
  transform-origin: left;
  transition: transform 380ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  footer a:hover { color: var(--ink); }
  footer a:hover::after { transform: scaleX(1); }
}

/* ---- Focus + selection ---- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection { background: var(--accent); color: var(--bg-0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}
