[hidden] {
  display: none !important;
}

button[data-email] {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button[data-email]:not(.btn, .email-outline) {
  background: transparent;
  border: 0;
  padding: 0;
  width: fit-content;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: .18em;
}

button[data-email]:not(.btn, .email-outline):hover {
  color: #b5593f;
}

button.btn-solid[data-email] {
  color: #fcfdef;
}

:focus-visible {
  outline: 2px solid #1d3b4f;
  outline-offset: 4px;
}

.site-header > a:first-child {
  flex: none;
}

.pn-label {
  font-size: 13px;
  color: #4a6070;
}

.pn .t {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.pn[rel="next"] {
  margin-left: auto;
  text-align: right;
}

.three > .off {
  margin-top: 80px;
}

@media (max-width: 900px) {
  .site-header {
    gap: 12px !important;
  }

  .site-header .navlinks {
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px !important;
  }

  .three > .off {
    margin-top: 0;
  }

  #hjerner .script {
    font-size: clamp(4.25rem, 15vw, 8rem) !important;
  }

  .strip-wrap {
    overflow-x: auto;
  }

  .rs-motion .strip-wrap .strip {
    animation: none;
    padding-inline: 20px !important;
  }

  .closeup-image {
    height: clamp(320px, 105vw, 700px) !important;
  }

  .closeup-caption {
    left: 32px !important;
    right: 32px;
  }
}

.menu-toggle {
  display: none;
}

@media (max-width: 700px) {
  /* Large section spacing is written as calc(Npx * var(--space, 1)); halve it on phones. */
  :root {
    --space: .5;
  }

  /* Compact header: logo, Instagram and a menu button; the menu opens below. */
  .site-header.has-menu {
    display: grid !important;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 4px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  .site-header > a:first-child {
    width: 84px !important;
    height: 84px !important;
  }

  .site-header.has-menu .menu-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #1d3b4f;
    cursor: pointer;
  }

  /* Two thin lines that turn into a cross while the menu is open. */
  .menu-icon {
    position: relative;
    display: block;
    width: 24px;
    height: 10px;
  }

  .menu-icon::before,
  .menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: currentColor;
    transition: transform .35s cubic-bezier(.65, 0, .35, 1);
  }

  .menu-icon::before {
    top: 0;
  }

  .menu-icon::after {
    top: 9px;
  }

  .menu-open .menu-icon::before {
    transform: translateY(4.5px) rotate(45deg);
  }

  .menu-open .menu-icon::after {
    transform: translateY(-4.5px) rotate(-45deg);
  }

  @media (prefers-reduced-motion: reduce) {
    .menu-icon::before,
    .menu-icon::after {
      transition: none;
    }
  }

  .site-header.has-menu .navlinks {
    display: none !important;
    grid-row: 2;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 0 !important;
    font-size: 16px !important;
    border-top: 1px solid #1d3b4f;
    margin-top: 8px;
  }

  .site-header.has-menu.menu-open .navlinks {
    display: flex !important;
  }

  .site-header.has-menu .navlinks a {
    min-height: 52px;
    padding-inline: 0;
    border-bottom: 1px solid rgba(29, 59, 79, .2);
  }

  /* Previous/next work links stack on phones; keep them close together. */
  #adjacent-works {
    row-gap: 0 !important;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  #adjacent-works .pn {
    padding: 16px 0;
  }

  /* Next work first, previous work below it. */
  #adjacent-works .pn[rel="next"] {
    order: -1;
  }

  /* Work page: main photo, then title, text and contact button, then the other photos. */
  .detail #detail-photos {
    display: contents !important;
  }

  .detail #work-cover {
    order: 1;
  }

  .detail .info {
    order: 2;
  }

  .detail #detail-photos > :not(#work-cover) {
    order: 3;
  }
}

@media (max-width: 560px) {
  .work .more {
    display: none;
  }

  .hero .h1 {
    font-size: clamp(2rem, 9vw, 2.5rem) !important;
  }
}

button.email-outline[data-email] {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid #1d3b4f;
  background: transparent;
  font-family: 'DM Mono', ui-monospace, Menlo, monospace;
  font-size: 14px;
}

button.email-outline[data-email]:hover {
  background: #1d3b4f;
  color: #fcfdef;
}

/* Give small text links a finger-sized tap area without changing how they look. */
a[href="#top"],
a.mono[href^="vaerk.html"] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Line drawings that draw in on load: draw (2.4s), hold 5s, undraw, rest, repeat.
   Each path keeps its own animation-delay, so the stagger repeats every cycle. */
@keyframes rs-draw-loop {
  0% {
    stroke-dashoffset: 1;
    animation-timing-function: cubic-bezier(.45, 0, .2, 1);
  }
  22% {
    stroke-dashoffset: 0;
    animation-timing-function: linear;
  }
  67% {
    stroke-dashoffset: 0;
    animation-timing-function: cubic-bezier(.45, 0, .2, 1);
  }
  89%,
  100% {
    stroke-dashoffset: 1;
  }
}

/* Drawings further down the page run the same loop, starting when they scroll into view
   (index.html adds .in-view). */
@media (prefers-reduced-motion: no-preference) {
  .rs-motion .view-draw path {
    stroke-dashoffset: 1;
  }

  .rs-motion .view-draw.in-view path {
    animation: rs-draw-loop 11s infinite both;
  }
}
