/* Byggvarsel
   Fargene er hentet fra et situasjonskart i en byggesøknad:
   grått for eksisterende bygg, stiplede eiendomsgrenser, og rødt for det som er nytt.
   Rødt brukes bare til å markere noe nytt, ingen andre steder. */

:root {
  --papir: #ffffff;
  --terreng: #edf1ea;
  --blekk: #1c2b33;
  --blekk-hover: #2d414c;
  --skifer: #52636c;
  --linje: #d3dbd6;
  --kant: #c3ccc7;
  --bygg: #aab5b8;
  --bygg-kant: #7f8d93;
  --grense: #8c9a92;
  --tiltak: #c4271d;
  --tiltak-mork: #8e1a13;
  --tiltak-lys: #fbeceb;
  --fjord: #d4e5ee;
  --fjord-kant: #8db3cb;
  --fokus: var(--tiltak);

  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --bredde: 72rem;
  --marg: clamp(1.25rem, 4vw, 2.5rem);
  --seksjon: clamp(3.5rem, 8vw, 6.5rem);
}

/* ---------- Grunnlag ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--blekk);
  background: var(--papir);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 3px;
}

.wrap {
  width: min(100% - 2 * var(--marg), var(--bredde));
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  left: var(--marg);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--blekk);
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
}

.skip-link:focus {
  top: 0.75rem;
}

.muted {
  color: var(--skifer);
}

/* ---------- Knapper ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1.35rem;
  border: 2px solid var(--blekk);
  border-radius: 4px;
  background: var(--blekk);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--blekk-hover);
  border-color: var(--blekk-hover);
}

.button:disabled {
  cursor: progress;
  opacity: 0.75;
}

.button--small {
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  font-size: 0.9375rem;
}

.button--light {
  background: #fff;
  border-color: #fff;
  color: var(--blekk);
}

.button--light:hover {
  background: #e4eae6;
  border-color: #e4eae6;
}

/* ---------- Topp ---------- */

.site-header {
  border-bottom: 1px solid var(--linje);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--blekk);
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) var(--seksjon);
}

.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero h1 {
  max-width: 16ch;
  font-size: clamp(2.5rem, 1.5rem + 3.4vw, 4rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.028em;
}

.lede {
  max-width: 34rem;
  margin-top: 1.5rem;
  font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  line-height: 1.5;
}

.audience {
  max-width: 34rem;
  margin-top: 1rem;
  color: var(--skifer);
}

.hero-text .button {
  margin-top: 2rem;
}

.hero-map {
  margin: 0;
}

.map-frame {
  aspect-ratio: 680 / 480;
  overflow: hidden;
  border: 1px solid var(--kant);
  background: var(--terreng);
}

.map {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-map figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--skifer);
}

@media (min-width: 60rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

@media (max-width: 40rem) {
  /* Kartet beskjæres fra venstre på smale skjermer, så det nye bygget og merkelappen blir stående */
  .map-frame {
    aspect-ratio: 1 / 1;
  }
}

/* ---------- Kartet ---------- */

.map text {
  font-family: var(--font);
}

.map-land {
  fill: var(--terreng);
}

.map-fjord {
  fill: var(--fjord);
  stroke: var(--fjord-kant);
  stroke-width: 1.5;
}

.map-depth {
  fill: none;
  stroke: var(--fjord-kant);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

.map-road-casing path,
.map-road-casing circle {
  fill: none;
  stroke: var(--kant);
  stroke-linecap: round;
}

.map-road-casing circle {
  fill: var(--kant);
  stroke: none;
}

.map-road path {
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
}

.map-road circle {
  fill: #fff;
}

.map-parcels polygon {
  fill: none;
  stroke: var(--grense);
  stroke-width: 1;
  stroke-dasharray: 8 3 2 3;
}

.map-houses rect {
  fill: var(--bygg);
  stroke: var(--bygg-kant);
  stroke-width: 0.75;
}

.map-grid path {
  stroke: #98a8a1;
  stroke-width: 1;
}

.map-hatch-line {
  stroke: var(--tiltak);
  stroke-width: 2;
}

.map-done {
  fill: #fff;
  stroke: var(--tiltak);
  stroke-width: 2;
}

.map-planned {
  fill: url(#skravur);
  stroke: var(--tiltak);
  stroke-width: 1.5;
}

.map-new {
  fill: var(--tiltak);
  stroke: var(--tiltak-mork);
  stroke-width: 1.5;
  stroke-dasharray: 1;
}

.map-dot {
  fill: var(--blekk);
}

.map-leader {
  fill: none;
  stroke: var(--blekk);
  stroke-width: 1.25;
  stroke-dasharray: 1;
}

.map-label rect {
  fill: #fff;
  stroke: var(--blekk);
  stroke-width: 1.25;
}

.map-label-title {
  font-size: 18px;
  font-weight: 700;
  fill: var(--blekk);
}

.map-label-text {
  font-size: 15px;
  fill: var(--blekk);
}

.map-label-meta {
  font-size: 15px;
  fill: var(--skifer);
}

.map-small {
  font-size: 12px;
  fill: var(--blekk);
}

.map-north path {
  fill: var(--blekk);
}

.map-scale-dark {
  fill: var(--blekk);
}

.map-scale-light {
  fill: #fff;
  stroke: var(--blekk);
  stroke-width: 1;
}

/* Sidens eneste animasjon: det nye bygget tegnes inn, så kommer merkelappen */

@keyframes tegn {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes fyll {
  from { fill-opacity: 0; }
  to { fill-opacity: 1; }
}

@keyframes vis {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.map-new {
  animation: tegn 0.9s ease-out 0.4s both, fyll 0.45s ease-out 1.2s both;
}

.map-dot {
  animation: vis 0.3s ease-out 1.5s both;
}

.map-leader {
  animation: tegn 0.5s ease-out 1.55s both;
}

.map-label {
  animation: vis 0.45s ease-out 1.95s both;
}

/* ---------- Seksjoner ---------- */

.how,
.legend {
  padding-block: var(--seksjon);
}

.how h2,
.example h2,
.legend h2,
.signup h2 {
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.018em;
}

.section-intro {
  max-width: 40rem;
  margin-top: 0.85rem;
  color: var(--skifer);
}

/* Ruten: tre stopp på en stiplet linje, som en planlagt vei på et kart */

.route {
  position: relative;
  display: grid;
  gap: 2rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.route-stop {
  position: relative;
  padding-left: 2.25rem;
}

.route-stop::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--blekk);
  border-radius: 50%;
  background: #fff;
}

.route-stop--last::before {
  background: var(--blekk);
}

/* Stiplet strek fra hvert stopp til det neste */
.route-stop:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.25rem;
  bottom: -2.25rem;
  left: 0.4375rem;
  border-left: 2px dashed var(--grense);
}

.route-stop h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.route-stop p {
  max-width: 30rem;
  margin-top: 0.5rem;
}

@media (min-width: 50rem) {
  .route {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
  }

  .route-stop {
    padding-left: 0;
    padding-top: 2rem;
  }

  .route-stop::before {
    top: 0;
  }

  .route-stop:not(:last-child)::after {
    top: 0.4375rem;
    bottom: auto;
    left: 1rem;
    right: -2.5rem;
    border-left: 0;
    border-top: 2px dashed var(--grense);
  }
}

/* Eksempelet */

.example {
  padding-block: var(--seksjon);
  background: var(--terreng);
}

.example-grid {
  display: grid;
  gap: 2rem;
  margin-top: 2.5rem;
  align-items: start;
}

.example-grid > * {
  min-width: 0;
}

@media (min-width: 60rem) {
  .example-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 2.5rem;
  }
}

.record {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--kant);
  border-radius: 3px;
}

.record-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--linje);
}

.record-head h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.record-fields {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.record-fields div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
}

.record-fields dt {
  color: var(--skifer);
}

.record-fields dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

@media (max-width: 26rem) {
  .record-fields div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

.redacted {
  display: inline-block;
  width: 8.5rem;
  height: 0.95em;
  vertical-align: -0.12em;
  background: var(--blekk);
  border-radius: 1px;
}

.redacted--short {
  width: 5rem;
}

.record-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--linje);
  font-size: 0.9375rem;
  color: var(--skifer);
}

.week table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--kant);
}

.week caption {
  padding-bottom: 0.75rem;
  font-weight: 700;
  text-align: left;
}

.week th,
.week td {
  padding: 0.8rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--linje);
}

.week thead th {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--skifer);
  border-bottom: 2px solid var(--blekk);
}

.week tbody tr:last-child td {
  border-bottom: 0;
}

.week td:first-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.week .is-featured td {
  background: var(--tiltak-lys);
}

.hit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.source {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--skifer);
}

.week {
  overflow-x: auto;
}

@media (max-width: 30rem) {
  .week th,
  .week td {
    padding: 0.7rem 0.6rem;
  }
}

@media (max-width: 22.5rem) {
  .week th,
  .week td {
    padding: 0.6rem 0.45rem;
  }

  .hit {
    white-space: normal;
  }
}

/* Tegnene: samme symboler som i kartet */

.swatch {
  display: inline-block;
  flex: none;
  width: 1.1rem;
  height: 0.8rem;
  border: 1.5px solid var(--tiltak);
  background: #fff;
}

.swatch--start {
  background: var(--tiltak);
  border-color: var(--tiltak-mork);
}

.swatch--new {
  background: repeating-linear-gradient(45deg, var(--tiltak) 0 1.5px, #fff 1.5px 4.5px);
}

.swatch--large {
  width: 2.5rem;
  height: 1.75rem;
  border-width: 2px;
}

.legend-list {
  display: grid;
  gap: 2.25rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.legend-list h3 {
  margin-top: 1rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.legend-status {
  margin-top: 0.2rem;
  font-size: 0.9375rem;
  color: var(--skifer);
}

.legend-status + p {
  max-width: 30rem;
  margin-top: 0.75rem;
}

@media (min-width: 50rem) {
  .legend-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
  }
}

/* ---------- Påmelding ---------- */

.signup {
  --fokus: #ff8f85;
  padding-block: var(--seksjon);
  background: var(--blekk);
  color: #fff;
}

.signup-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 60rem) {
  .signup-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 4rem;
    align-items: start;
  }
}

.signup-text p {
  max-width: 32rem;
  margin-top: 1rem;
  color: #d5dfe3;
}

.honeypot {
  display: none;
}

.field + .field {
  margin-top: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  border: 2px solid #fff;
  border-radius: 4px;
  background-color: #fff;
  color: var(--blekk);
  font: inherit;
}

.field input::placeholder {
  color: #7b8a91;
}

.field select {
  appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%231c2b33' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
}

.field [aria-invalid="true"] {
  border-color: var(--fokus);
}

.field-error {
  margin-top: 0.45rem;
  font-size: 0.9375rem;
  color: #ffb3ac;
}

.signup-form .button {
  margin-top: 1.75rem;
}

.form-status:not(:empty) {
  margin-top: 1rem;
  color: #ffb3ac;
}

.form-note {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: #b8c6cc;
}

.form-note a {
  color: #fff;
}

.signup-success {
  padding: 1.5rem;
  border: 2px solid #fff;
  border-radius: 4px;
}

.signup-success h3 {
  font-size: 1.375rem;
  font-weight: 700;
}

.signup-success h3:focus {
  outline: none;
}

.signup-success p {
  margin-top: 0.5rem;
  color: #d5dfe3;
}

.signup-success strong {
  color: #fff;
  overflow-wrap: anywhere;
}

/* ---------- Bunn ---------- */

.site-footer {
  padding-block: 2rem;
  font-size: 0.875rem;
  color: var(--skifer);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.footer-brand {
  font-weight: 700;
  color: var(--blekk);
}

/* ---------- Tekstsider (personvern, takk) ---------- */

.prose {
  max-width: 42rem;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) var(--seksjon);
}

.prose h1 {
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.prose h2 {
  margin-top: 2.25rem;
  font-size: 1.375rem;
  font-weight: 700;
}

.prose p {
  margin-top: 0.75rem;
}

.prose .lede {
  margin-top: 1.25rem;
}

.prose .back {
  margin-top: 2.5rem;
}

/* ---------- Mindre bevegelse ---------- */

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

  .map-new,
  .map-dot,
  .map-leader,
  .map-label {
    animation: none;
  }
}
