/* Grunnstil: reset, typografi, lenkjer, fokus, knappar, skjema. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  /* Nynorske samansette ord er lange. Utan dette sprekk overskriftene
     ut av skjermen på små breidder. */
  overflow-wrap: break-word;
  hyphens: auto;
}

h1 { font-size: var(--text-h1); letter-spacing: -0.015em; }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); font-family: var(--font-body); font-weight: 600; }

p, ul, ol { margin: 0 0 var(--space-4); }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }

a {
  color: var(--color-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--color-brand-dark); }

/* Fokusmarkering skal alltid vere synleg, og skal ikkje forsvinne på
   element som har eigen bakgrunn. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

img, picture, svg { max-width: 100%; }
img { height: auto; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

blockquote { margin: 0; }

strong { font-weight: 600; }

::selection {
  background: var(--color-brand-tint);
  color: var(--color-text);
}

.skiplink {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-brand);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s;
}
.skiplink:focus { top: var(--space-2); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ knappar */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px er minstemålet for ei trykkflate på mobil. */
  min-height: 44px;
  padding: 0.7rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
  color: #fff;
}

.btn--secondary {
  background: transparent;
  border-color: var(--color-brand);
  color: var(--color-brand);
}
.btn--secondary:hover {
  background: var(--color-brand-tint);
  color: var(--color-brand-dark);
}

.btn--green {
  background: var(--color-green);
  border-color: var(--color-green);
  color: #fff;
}
.btn--green:hover {
  background: var(--color-green-dark);
  border-color: var(--color-green-dark);
  color: #fff;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Lenkje som ser ut som ei lenkje, men peikar vidare i innhaldet. */
.link-more {
  display: inline-block;
  margin-top: var(--space-4);
  font-weight: 600;
}
.link-more::after {
  content: " \2192";
  text-decoration: none;
}

/* -------------------------------------------------------------------- skjema */

label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

input[type="text"], input[type="email"], input[type="tel"],
select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  /* 16px eller meir hindrar at iOS zoomar inn når feltet får fokus. */
  font-size: 1rem;
  line-height: 1.4;
}

textarea { min-height: 9rem; resize: vertical; }

input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--color-focus);
}

.field { margin-bottom: var(--space-4); }

.field__help {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 400;
}

.field__error {
  margin: var(--space-1) 0 0;
  color: var(--color-brand-dark);
  font-size: var(--text-sm);
  font-weight: 600;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--color-brand);
  border-width: 2px;
}

.field--check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-4);
}
.field--check input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; }
.field--check label { font-weight: 400; }

.checkgroup {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  border: 0;
}
.checkgroup > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: center;
}
.checkgroup input { width: 1.15rem; height: 1.15rem; }
.checkgroup label { font-weight: 400; margin: 0; }

fieldset { margin: 0 0 var(--space-4); padding: 0; border: 0; }
legend { padding: 0; font-weight: 600; }

/* Honeypot. Skal vere usynleg for folk, men utfyllbart for robotar.
   Difor ikkje display:none — enkelte robotar hoppar over skjulte felt. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.notice {
  padding: var(--space-4);
  border-left: 4px solid var(--color-green);
  border-radius: var(--radius);
  background: var(--color-green-tint);
  margin-bottom: var(--space-6);
}

.notice--error {
  border-left-color: var(--color-brand);
  background: var(--color-brand-tint);
}
