#arbeider.vestlys-works-live {
  --vestlys-overlap: clamp(32px, 8svh, 82px);
  margin-block-start: calc(-1 * var(--vestlys-overlap));
  padding: 0 0 clamp(16px, 2vw, 32px);
  background: linear-gradient(180deg, transparent, #102229 var(--vestlys-overlap), #172e35 48%, #10262d);
}

#arbeider.vestlys-works-live:focus-visible { outline: none; }

#arbeider > .site-cases {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem clamp(1.5rem, 4vw, 4rem);
  inline-size: min(calc(100% - 2 * var(--gutter)), 71.5rem);
  margin: clamp(1rem, 2vw, 1.75rem) auto clamp(1rem, 2vw, 1.5rem);
  scroll-margin-block-start: 6.25rem;
}

.site-case {
  display: grid;
  grid-template:
    "image heading"
    "image description"
    "image link" 1fr / clamp(6rem, 10vw, 9rem) minmax(0, 1fr);
  align-items: start;
  gap: .55rem clamp(.85rem, 1.75vw, 1.5rem);
}

.site-case__image {
  grid-area: image;
  display: block;
  inline-size: 100%;
  block-size: auto;
  border-radius: 8px;
}

.site-case__heading { grid-area: heading; }
.site-case__heading h3 {
  margin: 0;
  font-size: clamp(1.125rem, 1.65vw, 1.625rem);
  line-height: 1.2;
  letter-spacing: -.02em;
}
.site-case__status { margin: .3rem 0 0; color: #dfbf82; font-size: .8125rem; }
.site-case__description {
  grid-area: description;
  align-self: start;
  max-inline-size: 58ch;
  margin: 0;
  color: #cbd7d6;
  font-size: .9375rem;
  line-height: 1.55;
}
.site-case__link { grid-area: link; justify-self: start; align-self: end; }

@media (max-width: 859px) {
  #arbeider > .site-cases {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .site-case + .site-case {
    margin-block-start: 1.15rem;
    padding-block-start: 1.15rem;
    border-block-start: 1px solid #cbd7d640;
  }
  .site-case {
    grid-template:
      "image heading"
      "image description"
      "image link" / clamp(4.25rem, 22vw, 6.25rem) minmax(0, 1fr);
    gap: .6rem .9rem;
  }
}

#arbeider.vestlys-works-live + .testimonials {
  padding-block-start: clamp(68px, 10svh, 108px);
  background-image: linear-gradient(#10262d, transparent 130px), radial-gradient(ellipse at 85% 35%, #39535844, transparent 62%);
}

.vestlys-scrollbar {
  --vestlys-thumb-color: #d4ac73;
  position: sticky;
  z-index: 5;
  bottom: max(4px, env(safe-area-inset-bottom));
  display: grid;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  margin: 0;
  cursor: ew-resize;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-touch-callout: none;
}

.vestlys-scrollbar[hidden] { display: none; }
.vestlys-scrollbar:is(:hover, :focus-visible, :active) { --vestlys-thumb-color: #f1d09d; }
.vestlys-scrollbar:active { cursor: grabbing; }

.vestlys-scrollbar-rail {
  display: block;
  position: relative;
  height: 5px;
  overflow: hidden;
  background: linear-gradient(#677c7f, #677c7f) center / 100% 2px no-repeat;
  pointer-events: none;
}

.vestlys-scrollbar-thumb,
.vestlys-scrollbar-thumb::before,
.vestlys-scrollbar-thumb::after {
  position: absolute;
  top: 0;
  width: var(--vestlys-thumb-width, 48px);
  height: 100%;
  border-radius: inherit;
  background: var(--vestlys-thumb-color);
}

.vestlys-scrollbar-thumb {
  left: 0;
  border-radius: 999px;
  transform: translateX(var(--vestlys-thumb-left, 0px));
}

.vestlys-scrollbar-thumb::before, .vestlys-scrollbar-thumb::after { content: ''; }
.vestlys-scrollbar-thumb::before { left: calc(-1 * var(--vestlys-rail-width)); }
.vestlys-scrollbar-thumb::after { left: var(--vestlys-rail-width); }
.vestlys-scrollbar:focus-visible { outline: 2px solid #f9e2b8; outline-offset: -3px; }
.vestlys-scrollbar[aria-disabled="true"] { cursor: default; }

@media (forced-colors: active) {
  .vestlys-scrollbar-rail {
    forced-color-adjust: none;
    background-image: linear-gradient(CanvasText, CanvasText);
  }
  .vestlys-scrollbar-thumb, .vestlys-scrollbar-thumb::before, .vestlys-scrollbar-thumb::after { background: Highlight; }
}

.vestlys-works-live .vestlys-wall-viewport {
  --vestlys-angle: -15deg;
  --vestlys-edge-inset: 10px;
  --vestlys-gap: clamp(8px, 1vw, 12px);
  --vestlys-tile: clamp(310px, 30vw, 540px);
  --vestlys-wall-width: calc(var(--vestlys-tile) * var(--vestlys-wall-columns) + var(--vestlys-gap) * (var(--vestlys-wall-columns) - 1));
  --vestlys-wall-height: calc((var(--vestlys-tile) * 2 / 3 + var(--vestlys-gap)) * var(--vestlys-wall-rows) - var(--vestlys-gap));
  --vestlys-edge-height: clamp(136px, 19vw, 300px);
  --vestlys-pair-height: min(var(--vestlys-edge-height), calc(var(--vestlys-tile) * 2 / 3));
  --vestlys-pair-space: calc(var(--vestlys-pair-height) + var(--vestlys-gap));
  --vestlys-full-height: calc(var(--vestlys-wall-height) + 2 * (var(--vestlys-edge-height) + var(--vestlys-gap)) + var(--vestlys-pair-space));
  --vestlys-crossing-width: min(100vw, var(--vestlys-wall-width));
  padding: 0;
  overflow: auto hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8a36a78 transparent;
  touch-action: pan-x pan-y pinch-zoom;
}

.vestlys-wall-heading {
  position: absolute;
  z-index: 1;
  inset-inline-start: var(--gutter);
  /* Align the heading with the top edge at the page gutter. */
  inset-block-start: calc(var(--vestlys-edge-inset) + (var(--gutter) - var(--vestlys-crossing-width)) * tan(var(--vestlys-angle)) - clamp(12px, 1.75vw, 26px));
  transform: translateY(-100%) rotate(var(--vestlys-angle));
  transform-origin: left bottom;
  max-inline-size: calc(100% - 2 * var(--gutter));
  pointer-events: none;
}

.vestlys-wall-title {
  margin: 0;
  font-size: clamp(1.45rem, 3.85vw, 3.75rem);
  font-weight: 630;
  line-height: .95;
  letter-spacing: -.04em;
  text-transform: uppercase;
}

.vestlys-wall-subtitle {
  margin: .45em 0 0;
  color: #cbd7d6;
  font-size: clamp(.6875rem, 1.05vw, .875rem);
  font-weight: 500;
  line-height: 1.35;
}

.vestlys-wall-track {
  position: relative;
  width: max(100%, calc(var(--vestlys-wall-width) + var(--vestlys-full-height) * .28 + clamp(42px, 6vw, 112px)));
  /* Keep the outer rows visible through the full rise of the rotated wall. */
  height: calc(var(--vestlys-full-height) / cos(var(--vestlys-angle)) - var(--vestlys-crossing-width) * tan(var(--vestlys-angle)) + 2 * var(--vestlys-edge-inset));
  overflow: clip;
}

.lenis .vestlys-wall-viewport[data-lenis-prevent-horizontal] { overscroll-behavior: contain auto; }
.vestlys-wall-strip { display: contents; }

.vestlys-works-live .vestlys-collage {
  position: absolute;
  top: calc(50% - var(--vestlys-pair-space) / cos(var(--vestlys-angle)) / 2);
  left: 50%;
  grid-template-columns: minmax(0, 1fr);
  width: var(--vestlys-wall-width);
  gap: var(--vestlys-gap);
  margin: 0;
  transform: translate(-50%, -50%) rotate(var(--vestlys-angle));
}

.vestlys-works-live .vestlys-wall-viewport[data-vestlys-loop] {
  --vestlys-crossing-width: 100vw;
  --vestlys-wall-width: max(calc(var(--vestlys-tile) * var(--vestlys-wall-columns) + var(--vestlys-gap) * (var(--vestlys-wall-columns) - 1)), 65vw);
  overflow: clip;
  overflow-anchor: none;
  touch-action: pan-y pinch-zoom;
}

[data-vestlys-loop] .vestlys-wall-track { width: 100%; }

/* Sidebevegelsen tilhører stripen. Kort og bilder trenger ikke arve hver nye posisjon. */
@property --vestlys-loop-x {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

[data-vestlys-loop] .vestlys-wall-strip {
  position: absolute;
  top: calc(50% - var(--vestlys-pair-space) / cos(var(--vestlys-angle)) / 2);
  left: 50%;
  display: flex;
  align-items: center;
  gap: var(--vestlys-gap);
  width: max-content;
  transform: translate(-50%, -50%) rotate(var(--vestlys-angle)) translateX(var(--vestlys-loop-x, 0px));
}

.vestlys-works-live [data-vestlys-loop] .vestlys-collage {
  position: relative;
  inset: auto;
  flex: 0 0 var(--vestlys-wall-width);
  transform: none;
}

.vestlys-wall-row {
  display: grid;
  grid-template-columns: var(--vestlys-row-columns);
  gap: var(--vestlys-gap);
}

.vestlys-wall-row[data-vestlys-edge] {
  position: absolute;
  inset-inline: 0;
}

.vestlys-wall-row[data-vestlys-edge="top"] {
  /* Shorten the images inside the existing wall so the project row keeps its position. */
  --vestlys-edge-poster-height: calc(var(--vestlys-edge-height) * .68);
  bottom: calc(100% + var(--vestlys-gap));
  mask-image: linear-gradient(to bottom, transparent, #000 clamp(20px, 4svh, 44px));
}
.vestlys-wall-row[data-vestlys-edge="bottom"] { top: calc(100% + var(--vestlys-gap)); }

.vestlys-project-pair {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + var(--vestlys-edge-height) + 2 * var(--vestlys-gap));
  grid-template-columns: repeat(2, minmax(0, var(--vestlys-tile)));
  justify-content: center;
}

.vestlys-works-live .vestlys-project-pair .vestlys-poster {
  height: var(--vestlys-pair-height);
  aspect-ratio: auto;
}

.vestlys-project-pair .vestlys-poster > :is(img, video) { object-fit: cover; }
.vestlys-project-pair [data-work="tredjetrykk"] .vestlys-poster > :is(img, video) { object-position: center 64%; }

.vestlys-works-live .vestlys-card {
  --vestlys-weight: .65;
  --vestlys-direction: -1;
  grid-column: auto;
  width: auto;
  justify-self: stretch;
  transform: translateX(calc(var(--vestlys-pointer) * var(--vestlys-weight) + var(--vestlys-exit) * var(--vestlys-direction)));
}

.vestlys-wall-row:nth-child(even) .vestlys-card {
  --vestlys-weight: 1;
  --vestlys-direction: 1;
}

.vestlys-works-live [data-vestlys-loop] .vestlys-card {
  transform: none;
  opacity: 1;
}

.vestlys-works-live .vestlys-card .vestlys-poster {
  aspect-ratio: var(--vestlys-ratio);
  border-radius: 4px;
  background: #09171e;
  box-shadow: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.vestlys-works-live [data-vestlys-edge] .vestlys-card .vestlys-poster {
  height: var(--vestlys-edge-poster-height, var(--vestlys-edge-height));
  aspect-ratio: auto;
}

.vestlys-hover-frame {
  position: absolute;
  inset: 0 auto auto 0;
  max-width: none;
  border: 0;
  pointer-events: none;
  transform-origin: top left;
  opacity: 0;
  transition: opacity .18s ease;
}
.vestlys-hover-frame[data-playing] { opacity: 1; }
.vestlys-poster[data-vestlys-contact] .vestlys-open {
  outline: 1px solid #f4cf8d;
  outline-offset: -2px;
}

.vestlys-hover-exhibition { overflow: hidden; background: #fff; }
.vestlys-hover-exhibition > img { height: auto; }

.vestlys-works-live [data-work="pulsformen"] .vestlys-poster { background: #080a12; }

.vestlys-works-live [data-vestlys-display] .vestlys-poster > :is(img, video) {
  position: absolute;
  top: var(--vestlys-image-top, 0);
  left: var(--vestlys-image-left, 0);
  width: var(--vestlys-image-width, 100%);
  height: var(--vestlys-image-height, 100%);
  max-width: none;
  object-fit: cover;
}

.vestlys-image-region {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  aspect-ratio: 3 / 2;
  transform: translateY(-50%);
  overflow: hidden;
}

.vestlys-works-live [data-work="nattspor"] .vestlys-poster {
  background: radial-gradient(ellipse at 48% 44%, #35463d, #13241d 76%);
}
.vestlys-works-live [data-work="foliefall"] .vestlys-poster { background: #e2e5e3; }
.vestlys-works-live :is([data-work="nattspor"], [data-work="foliefall"]) .vestlys-poster > :is(img, video) { object-fit: contain; }
.vestlys-works-live [data-work="horisont-sunnmorsalpene"] :is(.vestlys-poster, .vestlys-flight-poster) > img {
  object-fit: cover;
  object-position: center top;
}
.vestlys-works-live [data-work="tribune-vinter"] :is(.vestlys-poster, .vestlys-flight-poster) { background: #e9e9e9; }
.vestlys-works-live [data-work="horisont-sunnmorsalpene"] .vestlys-hover-layer { object-fit: cover; object-position: center top; }
.vestlys-works-live [data-work="norway-westie-fest"] .vestlys-poster > :is(img, video) { object-position: center 37%; }
.vestlys-works-live [data-work="sykkylvsfjorden"] .vestlys-poster > img { object-position: center 67%; }
.vestlys-works-live [data-work="lysrom-1"] :is(.vestlys-poster, .vestlys-flight-poster) > :is(img, video) {
  object-fit: cover;
  object-position: 8% center;
}
.vestlys-works-live [data-work="platearkivet"] .vestlys-poster > :is(img, video),
.vestlys-preview[data-work="platearkivet"] .vestlys-flight-poster > img {
  object-fit: cover;
  object-position: center top;
}
.vestlys-works-live [data-work="lysrom-portrett"] :is(.vestlys-poster, .vestlys-flight-poster) > :is(img, video) {
  object-fit: cover;
  object-position: center 30%;
}
.vestlys-works-live :is([data-work="lysrom-portrett"], [data-work="fjordlys"], [data-work="byspor"],
  [data-work="morkevann"], [data-work="tredjetrykk"]) .vestlys-hover-layer[data-playing] {
  transition-duration: 0s;
}
.vestlys-works-live [data-work="fjordlys"] .vestlys-poster > :is(img, video),
.vestlys-preview[data-work="fjordlys"] .vestlys-flight-poster > img { object-fit: cover; }
:is(.vestlys-fjordlys-title, .vestlys-row-card-title) {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  margin: 0;
  padding: 1.6em .7em .5em;
  background: linear-gradient(transparent, #071720d9);
  color: #fff5db;
  font: 630 clamp(1.15rem, 2vw, 1.85rem)/1 Hanken, sans-serif;
  pointer-events: none;
}
.vestlys-works-live [data-vestlys-edge="bottom"] [data-work="nattvyr-v2"] .vestlys-poster > :is(img, video) { object-fit: cover; }
.vestlys-works-live [data-work="bok"] .vestlys-poster { aspect-ratio: 800 / 1080; }

.vestlys-card:has(> .vestlys-hover-book) { z-index: 2; }

.vestlys-hover-book {
  inset: 0 0 auto;
  height: auto;
  aspect-ratio: 800 / 1080;
  perspective: 860px;
  perspective-origin: left center;
}

.vestlys-hover-book[data-playing] { transition-duration: 0s; }

.vestlys-book-leaf,
.vestlys-book-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.vestlys-book-leaf {
  transform-origin: left center;
  transform-style: preserve-3d;
}

.vestlys-book-face {
  display: block;
  border-radius: 4px;
  backface-visibility: hidden;
}

.vestlys-book-left {
  border-radius: 4px 0 0 4px;
  box-shadow: 0 12px 32px #030a10a8;
  transform: rotateY(180deg);
}

.vestlys-book-right { border-radius: 0 4px 4px 0; }

.vestlys-works-live .vestlys-poster[data-book-open] .vestlys-open:hover:not(:focus-visible) { outline-color: transparent; }

.vestlys-works-live .vestlys-open {
  display: block;
  min-height: 0;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-touch-callout: none;
}

.vestlys-works-live .vestlys-open:is(:hover, :focus-visible) {
  outline: 2px solid #f4d5a4;
  outline-offset: -3px;
}

.vestlys-wall-viewport[data-vestlys-pannable] .vestlys-wall-track { cursor: grab; }
.vestlys-wall-viewport[data-vestlys-dragging] :is(.vestlys-wall-track, .vestlys-open) { cursor: grabbing; }

.vestlys-works-live .vestlys-flight { z-index: 2; }
.vestlys-works-live .vestlys-preview-top { z-index: 3; }
.vestlys-works-live .vestlys-preview { width: 100vw; overflow: hidden; }

.vestlys-preview[data-vestlys-site] .vestlys-preview-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.vestlys-preview[data-vestlys-site] .vestlys-preview-top { flex-shrink: 0; }

.vestlys-preview-details { flex: 0 0 100%; }

.vestlys-preview-details :is(.vestlys-preview-description, .vestlys-preview-about) {
  max-width: 92ch;
  font-size: clamp(.84rem, .9vw, .98rem);
  line-height: 1.35;
}

.vestlys-preview-details .vestlys-preview-description { margin-bottom: .24rem; }
.vestlys-preview-details .vestlys-preview-about { font-size: .8rem; }

.vestlys-preview[data-vestlys-site] .vestlys-preview-content {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0;
}

[data-vestlys-site="loading"] .vestlys-flight,
[data-vestlys-site="unavailable"] .vestlys-flight { opacity: 0; }
[data-vestlys-site="ready"] .vestlys-flight { pointer-events: auto; }

.vestlys-flight-poster {
  position: absolute;
  inset: 0;
  background: #09171e;
}

.vestlys-site-window {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--vestlys-page-scale, 1));
  background: #f8f7f4;
  opacity: 0;
}

.vestlys-site-window iframe { display: block; width: 100%; height: 100%; border: 0; }
.vestlys-site-window[data-vestlys-native-size] { transform: translate(-50%, -50%); }
.vestlys-preview:not([data-vestlys-still]) .vestlys-site-window[data-vestlys-native-size] { transition: opacity .18s ease; }
.vestlys-preview[data-work="horisont-sunnmorsalpene"] .vestlys-site-window { background: #101a23; }

.vestlys-site-status {
  position: absolute;
  z-index: 3;
  bottom: 16px;
  left: var(--gutter);
  max-width: min(48ch, calc(100% - 2 * var(--gutter)));
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #f4d5a45e;
  border-radius: 5px;
  background: #0b1922f2;
  color: var(--vestlys-paper);
  font-size: .94rem;
  pointer-events: none;
}

[data-vestlys-site="loading"]:not([data-vestlys-still]) .vestlys-site-status {
  animation: vestlys-show-status .16s .42s both;
}

@keyframes vestlys-show-status {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 760px), (max-height: 650px) {
  #arbeider.vestlys-works-live { --vestlys-overlap: 32px; }
}

@media (min-width: 761px) {
  .vestlys-works-live .vestlys-wall-viewport {
    /* Leave room for the heading and scrollbar as the window gets shorter. */
    --vestlys-tile: clamp(260px, min(30vw, calc((100svh - 280px) * .62)), 540px);
  }
}

@media (max-width: 720px) {
  .vestlys-works-live .vestlys-wall-viewport {
    --vestlys-tile: clamp(200px, 77vw, 505px);
    --vestlys-pair-height: 26vw;
  }
  .vestlys-project-pair {
    grid-template-columns: repeat(2, minmax(0, 40vw));
    /* Offset the horizontal drift from the angled wall so both posters fit at its starting position. */
    --vestlys-pair-offset: calc(var(--vestlys-wall-height) + var(--vestlys-edge-height) + 2 * var(--vestlys-gap) + (var(--vestlys-pair-height) - var(--vestlys-tile) * 2 / 3) / 2);
    transform: translateX(calc(var(--vestlys-pair-offset) * tan(var(--vestlys-angle))));
  }
}

@media (max-width: 360px) {
  .vestlys-preview-top:has(.vestlys-preview-details:not([hidden])) .vestlys-action {
    padding-inline: .7em;
  }
}
