/* =========================================================
   Husmannsplasser – felles CSS for kartside og enkeltsider
   ---------------------------------------------------------
   Dette er nå hovedfilen for prosjektet.
   - Kartreglene er beholdt fra husmann-kart.css.
   - Dupliserte regler fra style.css er ikke tatt med.
   - Enkeltside-regler ligger i egen seksjon lenger ned.
   ========================================================= */

:root {
  --bg: #F1EADF;
  --paper: #fffbfb;
  --ink: #24211c;
  --muted: #6c6256;
  --warning: #ff3700;
  --line: #ccc3b5;
  --accent: var(--theme-palette-color-1);
  --accent-dark: #7d3f22;
  --soft: #FFFDF8;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  --radius: 8px;
  --marker-ikon: #FF5C00;

  /* Alias brukt av noen enkeltside-regler */
  --husmann-paper: var(--paper);
  --husmann-ink: var(--ink);
  --husmann-muted: var(--muted);
  --husmann-line: var(--line);
  --husmann-accent: var(--accent);
  --husmann-accent-dark: var(--accent-dark);
  --husmann-soft: var(--soft);
  --husmann-shadow: var(--shadow);
  --husmann-radius: var(--radius);
}


* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

/* a { color: inherit; } */


/* Grunnlayout for kart og enkeltsider
-------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  min-height: calc(100vh - 78px);
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: clamp(18px, 3vw, 32px);
  padding-top: 10px;
  overflow: auto;
  z-index: 2;
}

.sidebar h1,
.content h1 {
  margin: 1rem 0 1rem;
  font-size: clamp(1.7rem, 3vw, 2.55rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

/* Venstre plass-liste: lås toppinnholdet, la bare resultatlisten scrolle */
.map-page .places-sidebar > h1,
.map-page .places-sidebar > .map-help,
.map-page .places-sidebar > .search-box {
  flex: 0 0 auto;
}

/* Selve hjelpeblokken skal ha naturlig høyde etter innholdet */
.map-page .map-help {
  height: auto;
  min-height: 0;
  flex-shrink: 0;
}

/* Summary skal ikke presses lavere/høyere av flex-layouten */
.map-page .map-help summary {
  box-sizing: border-box;

  height: 40px;
  min-height: 40px;
  max-height: 40px;

  padding: 5px 14px 7px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  line-height: 1;
  flex: 0 0 60px;
}

/* Innholdet i details skal følge teksten, ikke skjermhøyden */
.map-page .map-help-content {
  height: auto;
  min-height: 0;
  max-height: none;
  flex: 0 0 auto;
}

/* Kun listen skal ta resten av høyden og scrolle */
.map-page .places-sidebar > .result-list {
  /* flex: 1 1 auto; */
  min-height: 0;
  overflow-y: auto;
}

.intro,
.lead {
  margin: 0 0 1.4rem;
  color: var(--muted);
  max-width: 52rem;
}

.search-box {
  display: flex;
  gap: 0.6rem;
  margin: 15px 0 10px;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: 0.18s ease;
  font-size: 0.95rem;
}

.button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.button.secondary {
  background: #eee5d6;
  color: var(--ink);
}

.button.secondary:hover { background: #e2d5c2; }

.result-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.result-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  transition: 0.18s ease;
}

.result-card:hover,
.result-card.active {
  border-color: rgba(125, 63, 34, 0.5);
  box-shadow: 0 10px 24px rgba(83, 40, 23, 0.12);
  transform: translateY(-1px);
}

.result-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.meta {
  /* display: flex; */
  display: none;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.chip {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--soft);
  color: #5c4c3d;
  white-space: nowrap;
  text-decoration: none;
}

.map-wrap {
  position: relative;
  /* min-height: calc(100vh - 78px); */
  min-height: 100vh;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-hint {
  position: absolute;
  z-index: 2;
  right: 24px;
  top: 22px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  color: var(--warning);
  font-size: 0.9rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.detail-image,
.hero-image,
.gallery-image {
  background:
    linear-gradient(150deg, transparent 0 38%, rgba(50,35,20,.22) 38.5% 40%, transparent 40.5%),
    linear-gradient(20deg, rgba(255,255,255,.35), transparent 42%),
    linear-gradient(135deg, #6f7c56, #d7c2a0);
  position: relative;
  overflow: hidden;
}

.detail-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  margin: 1rem 0;
  object-fit: cover;
}

.detail-image::before,
.hero-image::before,
.gallery-image::before {
  content: "";
  position: absolute;
  inset: 20% 0 0;
  background: #c9b08b;
  clip-path: polygon(0 70%, 22% 43%, 42% 62%, 62% 35%, 100% 67%, 100% 100%, 0 100%);
  opacity: 0.9;
}

.detail-grid,
.fact-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}

.fact {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: #fff;
}

.fact strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}

.detail-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin-top: 1.2rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

.leaflet-popup-content {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

.popup-title {
  display: block;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.popup-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.65rem;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.popup-link-secondary {
  background: #eee5d6;
  color: var(--ink) !important;
}

.popup-link-secondary:hover {
  background: #e2d5c2;
}

/* Høyre offcanvas detaljpanel */

.detail-panel.offcanvas-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 2000;

  width: min(700px, calc(100vw - 44px));
  height: 100dvh;
  max-width: none;
  max-height: none;

  margin: 0;
  padding: 0;

  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;

  background: var(--paper);
  color: var(--ink);
  box-shadow: -18px 0 44px rgba(0, 0, 0, 0.22);
  backdrop-filter: none;

  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;

  transition:
    transform 0.28s ease,
    opacity 0.28s ease;
}

.detail-panel.offcanvas-panel:popover-open {
  transform: translateX(0);
  opacity: 1;
}

.detail-panel.offcanvas-panel.is-visible {
  transform: translateX(0);
  opacity: 1;
}

/* .detail-panel.offcanvas-panel::backdrop {
  background: rgba(36, 33, 28, 0.35);
} */

.offcanvas-inner {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(20px, 4vw, 34px);
}

.offcanvas-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.offcanvas-title {
  margin: 0;
}

.offcanvas-close,
.sidebar-close-button {
  position: absolute;
  top: -100px;
  right: 30px;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;

  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);

  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition: 0.18s ease;
}

.offcanvas-close:hover,
.sidebar-close-button:hover {
  background: var(--soft);
  transform: translateY(-1px);
}

.detail-panel.offcanvas-panel h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.detail-panel.offcanvas-panel .place {
  color: var(--muted);
  margin: 0 0 1rem;
}

/* Detail pages */

.page-shell {
  width: min(1600px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(110px, 5vw, 56px) 0;
}

.content {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(83, 40, 23, 0.09);
  padding: clamp(20px, 4vw, 46px);
}

.hero {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: clamp(20px, 4vw, 42px);
}

.hero-image {
  min-height: 340px;
  border-radius: var(--radius);
}

.article-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(20px, 4vw, 42px);
  margin-top: clamp(28px, 5vw, 54px);
}

.prose p {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.aside-card {
  background: #fffafa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.gallery {
  margin-top: clamp(28px, 5vw, 54px);
}

.gallery h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  letter-spacing: -0.04em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}
/* Bildegalleri på enkeltsider – trekkes ut mot kantene 
.gallery {
  margin-left: calc(clamp(20px, 4vw, 46px) * -1);
  margin-right: calc(clamp(20px, 4vw, 46px) * -1);
}*/

.gallery h2 {
  padding-left: 0;
  padding-right: clamp(20px, 4vw, 46px);
}


.gallery-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0;
}

.gallery-image {
  aspect-ratio: 4 / 3;
}

.gallery-caption {
  padding: 0.75rem;
  background: var(--accent-dark);
  color: white;
  font-size: 0.9rem;

}

/* Knapper og venstre offcanvas */

.sidebar-open-button,
.sidebar-close-button {
  display: none;
}

/* Fast kartlayout kun på desktop */
@media (min-width: 921px) {
  body.map-page {
    overflow: hidden;
  }

  .map-page .site-header {
    position: fixed;
    inset: 0 0 auto 0;
    
    z-index: 1000;
  }

  .map-page .layout {
    position: fixed;
    inset: 0;
    display: grid;    
    grid-template-columns: clamp(600px, 40vw, 800px) 1fr;
    min-height: 0;
    height: 100vh;
    overflow: hidden;
  }

  .map-page .sidebar {
    position: relative;
    height: 100vh;
    padding-top: 100px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .map-page .result-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 1px;
    padding-right: 0.35rem;
    padding-bottom: 1rem;
    scrollbar-width: thin;
  }

  .map-page .map-wrap {
    position: relative;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .map-page #map {
    position: absolute;
    inset: 0;
  }

  .map-page .leaflet-top.leaflet-right {
    right: -20px;
    top: 90px;
  }

  .leaflet-container .leaflet-control-attribution {
    bottom: 0;
    right: 0;
  }

  .leaflet-bottom .leaflet-control {
    margin-bottom: 20px;
  }

  .leaflet-right .leaflet-control {
  margin-right: 20px;
  }

 .leaflet-container .leaflet-control-attribution {
    bottom: 0;
    right: -20px;
  }

  .leaflet-right {
    margin-right: 20px;
  }

  .leaflet-bottom {
    right: -20px;
    bottom: -20px;
  }
}

/* Mobil og mellomstor skjerm */
@media (max-width: 920px) {
  body.map-page {
    overflow: hidden;
  }

  .map-hint {
    display: none;
  }

  .map-page .site-header {
    position: fixed;
    inset: 0 0 auto 0;
    height: 78px;
    z-index: 1000;
    display: block;
  }

  .header-note {
    margin-top: 0.3rem;
  }

  .map-page .layout {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .map-page .map-wrap {
    position: relative;
    /* height: calc(100dvh - 78px); */
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .map-page #map {
    position: absolute;
    inset: 0;
  }

  .leaflet-bottom {
    right: 0px;
    bottom: 90px;
  }
  
  /* .map-page .leaflet-bottom .leaflet-control {
    right: 20px;
    top: 10px;
  } */



  .sidebar-open-button {
    position: fixed;
    z-index: 1500;
    left: 0;
    top: 100px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;

    border: 1px solid var(--line);
    border-radius: 0 999px 999px 0;
    background: var(--theme-button-background-initial-color);
    color: white;

    padding: 0 0 0 1rem;
    font-weight: 800;
    font-size: 0.95rem;

    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    & svg#Layer_1 {
      height: 2.5rem;
    }
  }

  .gspb-buttonbox-icon svg path {
      fill: var(--wp--preset--color--palette-color-8, var(--theme-palette-color-8, #ffffff)) !important;
  }

  .sidebar h1 {
    margin-top: 0;
  }
  .sidebar-close-button {
    display: inline-flex;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
  }

  .placeSidebar_hamburger {
    font-size: 3rem;
  }

  .places-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 2000;

    width: min(800%, calc(100vw - 44px));
    height: 100dvh;
    max-width: none;
    max-height: none;

    margin: 0;
    padding: clamp(18px, 4vw, 32px);

    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink);
    box-shadow: 18px 0 44px rgba(0, 0, 0, 0.22);

    overflow-y: auto;
    overscroll-behavior: contain;

    transform: translateX(-100%);
    opacity: 0;

    transition:
      transform 0.28s ease,
      opacity 0.28s ease;
  }

  .places-sidebar:popover-open,
  .places-sidebar.is-open {
    transform: translateX(0);
    opacity: 1;
  }

  .places-sidebar::backdrop {
    background: rgba(36, 33, 28, 0.28);
  }

  .places-sidebar h1 {
    padding-right: 52px;
  }

  .hero,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .aside-card {
    position: static;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

    .places-sidebar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .places-sidebar .result-list {
    /* flex: 1 1 auto; */
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 1px;
    padding-right: 0.35rem;
    padding-bottom: 1rem;
    scrollbar-width: thin;
  }
}

@media (max-width: 720px) {
  .detail-panel.offcanvas-panel {
    width: min(420px, calc(100vw - 44px));
    border-left: 1px solid var(--line);
  }

  .offcanvas-inner {
    padding: 20px;
  }
}

@media (max-width: 560px) {
  .search-box {
    flex-direction: column;
  }

  .detail-grid,
  .fact-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .hero-image {
    min-height: 240px;
  }

  .sidebar-open-button {
    top: 100px;
    left: 0;
  }

  .places-sidebar {
    width: min(390px, calc(100vw - 38px));
  }
  
  .map-page .layout {
    inset: 0;    
    height: 100vh;
  }  
  .map-page .map-wrap {
    height: 100vh;
  } 
  .logo img {
    height: 60px;
  }
  .content {
    border: none;
    border-radius: 0;
    padding: 30px clamp(20px, 4vw, 46px);
  }
}


/* Glide-animasjon for begge offcanvas-paneler */

.detail-panel.offcanvas-panel,
.places-sidebar[popover] {
  transition:
    transform 0.28s ease,
    opacity 0.28s ease,
    overlay 0.28s ease allow-discrete,
    display 0.28s ease allow-discrete;
}

/* Høyre detaljpanel: lukket utgangspunkt */
.detail-panel.offcanvas-panel {
  transform: translateX(100%);
  opacity: 0;
}

/* Høyre detaljpanel: åpen */
.detail-panel.offcanvas-panel:popover-open,
.detail-panel.offcanvas-panel.is-visible {
  transform: translateX(0);
  opacity: 1;
}

/* Venstre listepanel: lukket utgangspunkt */
.places-sidebar[popover] {
  transform: translateX(-100%);
  opacity: 0;
}

/* Venstre listepanel: åpen */
.places-sidebar[popover]:popover-open,
.places-sidebar[popover].is-open {
  transform: translateX(0);
  opacity: 1;
}

/* Startposisjon når popover åpnes */
@starting-style {
  .detail-panel.offcanvas-panel:popover-open {
    transform: translateX(100%);
    opacity: 0;
  }

  .places-sidebar[popover]:popover-open {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* Fast bunnfelt i høyre detaljpanel */

.detail-panel.offcanvas-panel {
  display: flex;
  flex-direction: column;
}

.detail-panel.offcanvas-panel .offcanvas-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;

  /*
    Litt ekstra luft nederst, slik at siste tekst/fakta
    ikke føles klemt mot knappefeltet.
  */
  padding-bottom: 1.4rem;
}

.offcanvas-actionbar {
  flex: 0 0 auto;

  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;

  padding: 1rem clamp(20px, 4vw, 34px);
  border-top: 1px solid var(--line);

  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.08);

  z-index: 2;
}

.offcanvas-actionbar .button {
  flex: 1 1 auto;
  min-width: 150px;
}

/* På smale skjermer: knappene blir ekstra tydelige */
@media (max-width: 560px) {
  .offcanvas-actionbar {
    padding: 0.5rem 1rem;
    flex-wrap: nowrap;
  }

  .offcanvas-actionbar .button {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
    white-space: nowrap;
  }
}

.leaflet-control-layers {
  border: 1px solid rgba(83, 40, 23, 0.18);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 24px rgba(83, 40, 23, 0.16);
  overflow: hidden;
}


/* Når menyen er åpnet */
.leaflet-control-layers-expanded {
  padding: 12px 14px;
  min-width: 220px;
}

.leaflet-control-layers-list {
  margin: 0;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.leaflet-control-layers-base label:hover,
.leaflet-control-layers-overlays label:hover {
  background: rgba(83, 40, 23, 0.06);
}

.leaflet-control-layers input {
  margin-right: 8px;
  accent-color: var(--accent, #fc9465);
}
.map-links {
  display: flex;
  /*/  flex-wrap: wrap;  */
  gap: 0.65rem;
  margin: 0 0 1.5rem;
}

.map-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(83, 40, 23, 0.18);
  border-radius: 999px;
  background: #fffdf8;
  color: #24211c;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(83, 40, 23, 0.08);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.map-link:hover,
.map-link:focus-visible {
  transform: translateY(-1px);
  background: #f8f1e6;
  border-color: rgba(83, 40, 23, 0.32);
  box-shadow: 0 12px 28px rgba(83, 40, 23, 0.13);
}

.map-link:focus-visible {
  outline: 3px solid rgba(252, 148, 101, 0.45);
  outline-offset: 3px;
}

.map-link-icon {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: #f1eadf;
  color: #532817;
  font-size: 0.82rem;
  font-weight: 800;
}

.map-link span {
  white-space: nowrap;
}

.offcanvas-header .map-links {
  margin-bottom: 0;
}

.hero > div > .map-links:first-child {
  margin-top: 0;
}

.hero-image {
  width: 100%;
  /* height: min(52vh, 520px); */
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.gallery-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.offcanvas-image {
  width: 100%;
  /* max-height: 240px; */
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* Mobil: vis kartlagslisten som egen boks under kartlagsknappen */
@media (max-width: 920px) {

  .map-page .leaflet-control-layers {
    position: relative;
    overflow: visible;
  }

  .map-page .leaflet-top.leaflet-right {
    right: 10px;
    top: 90px;
  }

  .map-page .leaflet-control-layers-toggle {
    display: block;
  }

  .map-page .leaflet-control-layers-expanded {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    overflow: visible;
  }

  .map-page .leaflet-control-layers-expanded .leaflet-control-layers-list {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;

    display: block;
    width: min(260px, calc(100vw - 20px));
    padding: 12px 14px;

    background: rgba(255, 253, 248, 0.98);
    border: 1px solid rgba(83, 40, 23, 0.18);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);

    z-index: 2000;
  }
}

@media (min-width: 571px) and (max-width: 920px) {  
  [class*="ct-toggle"] {
    padding: 5px 15px !important;
  }

  .mid-screen-top-container {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1rem;
  }

  .mid-screen-QR-container {
    position: relative;
  }

  .mid-screen-QR-code {
    position: absolute;
    bottom: 0;
    right: -7px;
  }
  .small-screen-QR-container {
    display: none;
  }
}

@media (min-width: 921px) {
  .mid-screen-QR-code {
    margin: 2rem 0 -16px -10px;
    padding: 0;
  }
}

@media (max-width: 570px) {
  .mid-screen-top-container {
    display: block;
  }
  .mid-screen-QR-container {
    display: none;
  }
  .small-screen-QR-container {
    display: block;
    text-align: center;
  }
  .page-shell {
    width: 100%;
    margin: 0;
    padding: 60px 0 0 0;
  }
}

@media (min-width: 921px) {  
  .small-screen-QR-container {
    display: none;
  }
}

.detail-grid .mid-screen-QR-code {
  position: relative;
  margin: 0;
}

@media (min-width: 921px) {
  body.map-page #header [data-column="start"] [data-items="primary"] > :first-child {
    position: absolute;
    left: 33px;
  }
  .hero {
    align-items: stretch;
    margin-bottom: 8rem;
  }

  .mid-screen-top-container {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .mid-screen-top-container > div:first-child {
    flex: 0 0 auto;
  }

  .mid-screen-QR-container {
    margin-top: auto;
  }

  .hero-image-link {
    display: flex;
    height: 100%;
    min-height: 100%;
  }

  .hero-image-link .hero-image {
    height: 100%;
    min-height: 340px;
    object-fit: cover;
  }
}

.hero figcaption {
  margin-top: 10px;
  text-align: center;
}

.hero-image-link figure {
  margin: 0;
}




.leaflet-top .leaflet-left {
  display: none;
}



/* =========================================================
   Enkeltsider for husmannsplasser
   Brukes av single-husmannsplass.php
   ========================================================= */

.place-article {
  width: 100%;
  margin: 0 auto;
}

.place-featured-image-link {
  display: block;
  position: relative;
  min-height: 360px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--soft);
  border: 1px solid var(--line);
  text-decoration: none;
}

.place-featured-image-link figure {
  height: 100%;
  margin: 0;
}

.place-featured-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.place-featured-image-link:hover .place-featured-image {
  transform: scale(1.035);
}

.place-featured-image-link figcaption,
.hero figcaption {
  margin-top: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

.place-gallery-grid,
.gallery-grid.place-gallery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.5vw, 1rem);
}

.place-gallery-item,
.gallery-item.place-gallery-item {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(83, 40, 23, 0.08);
}

.place-gallery-item .gallery-link {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--soft);
}

.place-gallery-item .gallery-image {
  height: 100%;
  transition: transform 0.45s ease;
}

.place-gallery-item .gallery-link:hover .gallery-image {
  transform: scale(1.045);
}

.place-gallery-item figcaption {
  padding: 0.75rem 0.85rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}


/* WordPress/Blocksy-tilpasninger
-------------------------------------------------- */

/*
  På kartmalen skal Blocksy-headeren brukes.
  Prototypen hadde egen .site-header. Disse justeringene gjør at kartflaten
  fortsatt kan oppføre seg som en app-lignende fullskjermsløsning.
*/

body.map-page .ct-container-full,
body.map-page .site-main,
body.map-page #main,
body.map-page .entry-content {
  margin: 0;
  padding: 0;
  max-width: none;
}

body.map-page .entry-content > * {
  max-width: none;
}

/* Hvis Blocksy bruker #header i stedet for .site-header 
@media (min-width: 921px) {
  body.map-page .layout {
    inset: var(--husmann-map-header-height, 80px) 0 0 0;
    height: calc(100vh - var(--husmann-map-header-height, 80px));
  }

  body.map-page .sidebar,
  body.map-page .map-wrap {
    height: calc(100vh - var(--husmann-map-header-height, 80px));
  }*/

@media (max-width: 920px) {
  /* body.map-page .layout {
    inset: var(--husmann-map-header-height-mobile, 78px) 0 0 0;
    height: calc(100dvh - var(--husmann-map-header-height-mobile, 78px));
  } */

  body.map-page .map-wrap {
    height: 100vh;
  }
}

@media (max-width: 560px) {
  /* body.map-page .layout {
    inset: var(--husmann-map-header-height-small, 60px) 0 0 0;
    height: calc(100dvh - var(--husmann-map-header-height-small, 60px));
  } 

  body.map-page .map-wrap {
    height: calc(100dvh - var(--husmann-map-header-height-small, 60px));
  }

  body.map-page .sidebar-open-button {
    top: calc(var(--husmann-map-header-height-small, 60px) + 18px);
  } */
}


/* Enkeltsider: responsiv galleri- og hero-tilpasning */
@media (max-width: 920px) {
  .place-featured-image-link {
    min-height: clamp(260px, 58vw, 460px);
  }

  .place-gallery-grid,
  .gallery-grid.place-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .place-gallery-grid,
  .gallery-grid.place-gallery-grid {
    grid-template-columns: 1fr;
  }

  .place-gallery-item .gallery-link {
    aspect-ratio: 4 / 3;
  }
}




.leaflet-control-layers-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: rgba(255, 253, 248, 0.96);
  background-size: 22px 22px;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2324211c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'>\
<polygon points='12 3 21 8 12 13 3 8 12 3'/>\
<polygon points='12 9 21 14 12 19 3 14 12 9'/>\
<polygon points='12 15 21 20 12 25 3 20 12 15' transform='translate(0,-3)'/>\
</svg>");
}