/* ============================================================
   Bygglund: omrader.css (06.11.2026), the map scene from the Janis site (omr «Situasjonsplanen»), after Sverre 06.11.2026: «etterlikn janis
   sitt kart, det er bedre og mer oversiktlig». The real Kartverket map stands as a site plan on a framed sheet: a neatline with a coordinate
   band, a faint grid, a north arrow, a true scale bar, Bygglund's address as a survey mark and the municipalities with hairline leaders.
   With the scroll the plan draws itself (js/omrader.js), one canvas for the map and the lines, the names as their own layer.
   Without JS or with reduced motion the sheet is a still: the overview map, the lines, the names and the list (production/kilde/kart/lag_plan.py).
   Everything here starts with omr; its values live in :root as --omr-* in tokens.css.
   ============================================================ */

/* the --omr-* values (and their media overrides) live in css/tokens.css, section 07 */
.omr,
.omr *,
.omr *::before,
.omr *::after {
  box-sizing: border-box;
}

.omr {
  --flate: var(--grafitt);
  --aksent: var(--is);
  --fokus: var(--is);
  position: relative;
  background: var(--flate);
  color: var(--omr-tekst);
}

/* ---- the still sheet: label and title, the legend, the framed map ---- */
.omr-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(1.75rem, 4vw, 2.5rem);
  max-width: var(--maks);
  margin: 0 auto;
  padding: var(--seksjon-luft) var(--marg);
}

.omr-reise {
  display: none;
}

.omr-tittel {
  margin: 0;
  color: var(--omr-tekst);
  font-family: var(--font);
  font-size: var(--str-h2);
  font-weight: var(--vekt-tittel);
  line-height: 1;
  letter-spacing: var(--sporing-tittel);
  text-wrap: balance;
}

/* the legend: the three areas as a ruled list, each with its reference mark and its line on the plan */
.omr-soner {
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--omr-linje-sterk);
}

.omr-sone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.9rem;
  align-items: start;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--omr-linje);
}

.omr-sone-nr {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.12rem;
  border: 1px solid var(--omr-linje-sterk);
  border-radius: 50%;
  color: var(--omr-tekst);
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.omr-sone-tittel {
  margin: 0;
  color: var(--omr-tekst);
  font-family: var(--font);
  font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.omr-sone-steder {
  margin: 0.3rem 0 0;
  color: var(--omr-demp);
  font-size: 1.0625rem;
  line-height: 1.5;
}

/* the sheet: a true frame with a light margin inside (k1), the map in a neatline, the caption under it */
.omr-ark {
  margin: 0;
  padding: var(--omr-innmarg);
  border: 1px solid var(--omr-linje-sterk);
  background: var(--omr-flate);
}

.omr-vindu {
  position: relative;
  padding: var(--omr-band) var(--omr-band-smal) var(--omr-band-smal) var(--omr-band);
}

.omr-kartflate {
  position: relative;
  aspect-ratio: 1566 / 1613;
  overflow: hidden;
  background: var(--omr-dyp);
  box-shadow: 0 0 0 1px var(--omr-linje-sterk);
}

.omr-kart {
  display: none;
}

/* the still map: the canvas tones the layers to the room's cool grey; without it a filter comes close */
.omr-kart-oversikt {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: grayscale(0.9);
}

/* without the script there are no coordinates to write in the band: it closes to a thin margin */
.omr:not(.omr-tegnet) .omr-vindu {
  padding: var(--omr-band-smal);
}

.omr:not(.omr-tegnet) .omr-stille,
.omr:not(.omr-tegnet) .omr-navn {
  inset: var(--omr-band-smal);
}

.omr-lerret {
  display: none;
}

.omr-stille,
.omr-navn {
  position: absolute;
  inset: var(--omr-band) var(--omr-band-smal) var(--omr-band-smal) var(--omr-band);
  pointer-events: none;
}

.omr-navn {
  overflow: hidden;
}

.omr-plan-stille {
  display: block;
  width: 100%;
  height: 100%;
}

.omr-plan-stille path,
.omr-plan-stille circle {
  fill: none;
  stroke: var(--omr-tekst);
  vector-effect: non-scaling-stroke;
}

.omr-s-l1 {
  stroke-width: 1.15px;
  stroke-opacity: 0.88;
}

.omr-s-l2 {
  stroke-width: 0.9px;
  stroke-opacity: 0.62;
}

.omr-s-prikk {
  stroke-linecap: round;
  stroke-width: 5px;
}

.omr-plan-stille .omr-s-p0 {
  stroke-width: 4px;
}

.omr-s-hjem {
  stroke-width: 1.15px;
}

/* the caption line under the window (k1) */
.omr-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--omr-strip-h);
  padding: 0.6rem 0.1rem 0;
  color: var(--omr-demp);
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.omr-strip-hoyre {
  color: var(--omr-tekst);
  font-variant-numeric: tabular-nums;
}

/* ---- the names: small capitals with a hairline leader from the dot (k1 labels on a map, with a halo) ---- */
.omr-sted {
  --omr-tx: 19px;
  --omr-ty: -50%;
  --omr-sh-l: -14px;
  --omr-dg-l: -22.5px;
  --omr-dg-o: right center;
  --omr-dg-r: 0deg;
  --omr-dg-w: 0px;
  position: absolute;
  left: var(--omr-x);
  top: var(--omr-y);
  color: var(--omr-tekst);
  font-family: var(--font);
  font-size: var(--omr-navn-str);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 2px var(--omr-halo), 0 0 7px var(--omr-halo), 0 0 12px var(--omr-halo);
  translate: var(--omr-tx) var(--omr-ty);
}

/* the level part of the leader, and the diagonal that runs to the dot */
.omr-sted::before,
.omr-sted::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 1px;
  background: currentColor;
  opacity: 0.72;
}

.omr-sted::before {
  left: var(--omr-sh-l);
  width: 10px;
}

.omr-sted::after {
  left: var(--omr-dg-l);
  width: var(--omr-dg-w);
  transform-origin: var(--omr-dg-o);
  transform: rotate(var(--omr-dg-r));
}

.omr-l,
.omr-lu,
.omr-ld {
  --omr-sh-l: calc(100% + 4px);
  --omr-dg-l: calc(100% + 14px);
  --omr-dg-o: left center;
}

.omr-l {
  --omr-tx: calc(-100% - 19px);
}

.omr-ru,
.omr-rd,
.omr-lu,
.omr-ld {
  --omr-dg-w: 8.5px;
}

.omr-ru {
  --omr-tx: 22px;
  --omr-ty: calc(-8px - 50%);
  --omr-dg-r: -45deg;
}

.omr-rd {
  --omr-tx: 22px;
  --omr-ty: calc(8px - 50%);
  --omr-dg-r: 45deg;
}

.omr-lu {
  --omr-tx: calc(-100% - 22px);
  --omr-ty: calc(-8px - 50%);
  --omr-dg-r: 45deg;
}

.omr-ld {
  --omr-tx: calc(-100% - 22px);
  --omr-ty: calc(8px - 50%);
  --omr-dg-r: -45deg;
}

/* a longer leader, where the near neighbours crowd each other: 20 px down or up, then level */
.omr-rd2 {
  --omr-tx: 34px;
  --omr-ty: calc(20px - 50%);
  --omr-dg-r: 45deg;
  --omr-dg-w: 25.5px;
  --omr-dg-l: -39.5px;
}

.omr-lu2 {
  --omr-sh-l: calc(100% + 4px);
  --omr-dg-o: left center;
  --omr-tx: calc(-100% - 34px);
  --omr-ty: calc(-20px - 50%);
  --omr-dg-r: 45deg;
  --omr-dg-w: 25.5px;
  --omr-dg-l: calc(100% + 14px);
}

/* the address: the survey mark is wider, so its leader starts further out and the name is larger */
.omr-sted-hjem {
  --omr-tx: 33px;
  --omr-sh-l: -14px;
  font-size: var(--omr-hjem-str);
  letter-spacing: 0.16em;
}

/* phones: the close neighbours would crowd each other; the legend names them all */
@media (max-width: 47.99rem) {
  .omr-sted-smal {
    display: none;
  }

  .omr:not(.omr-styrt) .omr-sted[data-omr-naer] {
    display: none;
  }

  /* Hønefoss keeps its weight but not its width, so the name fits the narrow sheet; its leader starts where the
     east tick of the mark ends */
  .omr-sted-hjem {
    --omr-tx: 29px;
    font-size: var(--omr-navn-str);
    font-weight: 700;
  }

  .omr-m-r,
  .omr-m-l,
  .omr-m-ru,
  .omr-m-rd,
  .omr-m-lu,
  .omr-m-ld {
    --omr-dg-w: 8.5px;
  }

  .omr-m-r,
  .omr-m-ru,
  .omr-m-rd {
    --omr-sh-l: -14px;
    --omr-dg-l: -22.5px;
    --omr-dg-o: right center;
  }

  .omr-m-l,
  .omr-m-lu,
  .omr-m-ld {
    --omr-sh-l: calc(100% + 4px);
    --omr-dg-l: calc(100% + 14px);
    --omr-dg-o: left center;
  }

  .omr-m-r {
    --omr-tx: 19px;
    --omr-ty: -50%;
    --omr-dg-w: 0px;
  }

  .omr-m-l {
    --omr-tx: calc(-100% - 19px);
    --omr-ty: -50%;
    --omr-dg-w: 0px;
  }

  .omr-m-ru {
    --omr-tx: 22px;
    --omr-ty: calc(-8px - 50%);
    --omr-dg-r: -45deg;
  }

  .omr-m-rd {
    --omr-tx: 22px;
    --omr-ty: calc(8px - 50%);
    --omr-dg-r: 45deg;
  }

  .omr-m-lu {
    --omr-tx: calc(-100% - 22px);
    --omr-ty: calc(-8px - 50%);
    --omr-dg-r: 45deg;
  }

  .omr-m-ld {
    --omr-tx: calc(-100% - 22px);
    --omr-ty: calc(8px - 50%);
    --omr-dg-r: -45deg;
  }
}

/* ---- phones and tablets: label and title, the plan, then the legend under it ---- */
@media (max-width: 63.99rem) {
  .omr-tekst {
    display: contents;
  }

  .omr-topp {
    order: 1;
  }

  .omr-ark {
    order: 2;
  }

  .omr-soner {
    order: 3;
    margin-top: 0;
  }
}

/* ---- wide screens, still: text on the left, the sheet on the right ---- */
@media (min-width: 64rem) {
  .omr-scene {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr);
    column-gap: clamp(1.75rem, 3.6vw, 4rem);
    align-items: start;
  }
}

/* ---- with JS: the canvas draws the plan (finished at once, or with the scroll when pinned) ---- */
.omr-tegnet .omr-lerret {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.omr-tegnet .omr-kart-oversikt,
.omr-tegnet .omr-stille {
  display: none;
}

.omr-tegnet .omr-kartflate {
  background: transparent;
  box-shadow: none;
}

/* the script places the names on their dots; until its first frame they wait unseen */
.omr-tegnet .omr-sted {
  left: 0;
  top: 0;
  opacity: 0;
  will-change: transform, opacity;
}

/* ============================================================
   Moving: under html.js-anim, once omr.js has taken the section (omr-styrt), and only on screens tall enough to pin.
   --omr-pin tells omr.js the pinned layout is on.
   ============================================================ */

/* phones and tablets: label and title, the plan in full width, the area in view under it */
@media (min-height: 34rem) and (max-width: 63.99rem) {
  html.js-anim .omr.omr-styrt {
    --omr-pin: 1;
  }

  html.js-anim .omr.omr-styrt .omr-reise {
    display: block;
    height: calc(var(--omr-reise) * 100svh);
  }

  html.js-anim .omr.omr-styrt .omr-scene {
    position: sticky;
    top: 0;
    height: 100svh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    row-gap: clamp(0.6rem, 1.6svh, 1rem);
    padding: calc(var(--meny-h) + clamp(0.5rem, 1.6svh, 0.9rem)) var(--marg) calc(env(safe-area-inset-bottom, 0px) + clamp(0.5rem, 1.6svh, 0.9rem));
  }

  html.js-anim .omr.omr-styrt .omr-tekst {
    display: contents;
  }

  html.js-anim .omr.omr-styrt .omr-topp {
    grid-row: 1;
  }

  html.js-anim .omr.omr-styrt .omr-merke {
    margin-bottom: clamp(0.4rem, 1.2svh, 0.75rem);
  }

  html.js-anim .omr.omr-styrt .omr-tittel {
    font-size: clamp(1.55rem, min(6.6vw, 4.2svh), 2.6rem);
    line-height: 1.02;
  }

  html.js-anim .omr.omr-styrt .omr-ark {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  html.js-anim .omr.omr-styrt .omr-soner {
    grid-row: 3;
    display: grid;
    margin: 0;
  }

  /* the three areas stand in one place; the one the plan is drawing is the one you read */
  html.js-anim .omr.omr-styrt .omr-sone {
    grid-area: 1 / 1;
    padding: 0.7rem 0 0;
    border-bottom: 0;
    opacity: 0;
    transition: opacity 0.4s var(--mykt);
  }

  html.js-anim .omr.omr-styrt .omr-sone.omr-vist {
    opacity: var(--omr-svak);
  }

  html.js-anim .omr.omr-styrt .omr-sone.omr-vist.omr-naadd {
    opacity: 1;
  }

  html.js-anim .omr.omr-styrt .omr-sone-tittel {
    font-size: clamp(1.2rem, 1.05rem + 0.8vw, 1.6rem);
  }
}

/* wide screens: the text on the left (title above, legend below), the sheet takes the height on the right */
@media (min-height: 30rem) and (min-width: 64rem) {
  html.js-anim .omr.omr-styrt {
    --omr-pin: 1;
  }

  html.js-anim .omr.omr-styrt .omr-reise {
    display: block;
    height: calc(var(--omr-reise) * 100svh);
  }

  html.js-anim .omr.omr-styrt .omr-scene {
    position: sticky;
    top: 0;
    height: 100svh;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    padding: calc(var(--meny-h) + clamp(0.5rem, 2svh, 1.25rem)) var(--marg) clamp(0.75rem, 2.4svh, 1.5rem);
  }

  html.js-anim .omr.omr-styrt .omr-tekst {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 0;
  }

  html.js-anim .omr.omr-styrt .omr-tittel {
    font-size: clamp(1.9rem, min(3.7vw, 7svh), 4rem);
  }

  html.js-anim .omr.omr-styrt .omr-soner {
    margin: 0;
  }

  html.js-anim .omr.omr-styrt .omr-sone {
    padding: clamp(0.55rem, 1.6svh, 1.1rem) 0;
    opacity: var(--omr-svak);
    transition: opacity 0.45s var(--mykt);
  }

  html.js-anim .omr.omr-styrt .omr-sone.omr-naadd {
    opacity: 1;
  }

  html.js-anim .omr.omr-styrt .omr-sone-tittel {
    font-size: clamp(1.2rem, min(0.9rem + 0.9vw, 4svh), 1.75rem);
  }

  html.js-anim .omr.omr-styrt .omr-ark {
    display: flex;
    flex-direction: column;
    width: calc((min(100vw, var(--maks)) - 2 * var(--marg)) * var(--omr-ark-andel));
    min-height: 0;
  }
}

/* both pinned layouts: the window fills the sheet, the map rect keeps the bands */
@media (min-height: 34rem) and (max-width: 63.99rem), (min-height: 30rem) and (min-width: 64rem) {
  html.js-anim .omr.omr-styrt .omr-vindu {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
  }

  html.js-anim .omr.omr-styrt .omr-kartflate {
    position: absolute;
    inset: var(--omr-band) var(--omr-band-smal) var(--omr-band-smal) var(--omr-band);
    aspect-ratio: auto;
  }

  /* the reference mark of the area being drawn */
  html.js-anim .omr.omr-styrt .omr-sone-nr {
    transition: background-color 0.45s var(--mykt), color 0.45s var(--mykt), border-color 0.45s var(--mykt);
  }

  html.js-anim .omr.omr-styrt .omr-sone.omr-aktiv .omr-sone-nr {
    border-color: var(--omr-tekst);
    background: var(--omr-tekst);
    color: var(--flate);
  }

  /* start state: the names wait for their lines */
  html.js-anim .omr.omr-styrt .omr-sted {
    opacity: 0;
  }
}

/* phones (mobile pass 08.11.2026): all four areas together in a list under the pinned map (js/omrader.js moves it there) */
@media (max-width: 47.99rem) {
  html.js-anim .omr.omr-styrt > .omr-soner { display: block; margin: 0.5rem var(--marg) 0; padding: 0 0 var(--seksjon-luft); }
  html.js-anim .omr.omr-styrt .omr-sone,
  html.js-anim .omr.omr-styrt .omr-sone.omr-vist { grid-area: auto; padding: 0.9rem 0; border-bottom: 1px solid var(--omr-linje); opacity: 1; }
  /* all four stand together, so none of them looks chosen */
  html.js-anim .omr.omr-styrt .omr-sone.omr-aktiv .omr-sone-nr { border-color: var(--omr-linje-sterk); background: none; color: var(--omr-tekst); }
}
/* a phone on its side: the still sheet, so the list's own space under it is the section's foot, not a second one */
@media (max-width: 47.99rem) and (max-height: 33.99rem) {
  html.js-anim .omr.omr-styrt .omr-scene { padding-bottom: 0; }
}
