#map .participating-building { cursor: pointer; }
@media (hover: hover) {
  #map .participating-building:hover {
    stroke-width: calc(var(--household-stroke-width, 2px) + .65px);
  }
}

#map .participating-building[aria-pressed="true"],
#map .participating-building:focus-visible {
  stroke-width: calc(var(--household-stroke-width, 2px) + 1.25px);
}

#household-profile {
  --household-portrait-size: 180px;
  --household-exterior-height: 160px;
  position: absolute;
  z-index: 950;
  inset: 4.35rem .65rem .65rem auto;
  width: min(21rem, 38%);
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: #30482d;
  background: var(--paper-grain) #faf3e2;
  border: 1px solid #c6baa0;
  border-radius: .65rem;
  box-shadow: 0 .25rem 1rem #38372b24;
}

#household-profile.household-panel-left { right: auto; left: .65rem; }

#household-profile > .household-close {
  align-self: flex-end;
  margin: .35rem .65rem 0;
}

.household-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid #b9ad93;
  border-radius: .45rem;
  color: inherit;
  background: #fffaf0;
  cursor: pointer;
  font: 400 1.5rem/1 system-ui, sans-serif;
}

.household-content {
  overflow: auto;
  overscroll-behavior: contain;
  padding: .25rem 1rem 1rem;
  display: grid;
  align-content: start;
  gap: 1rem;
}

.household-content:empty { display: none; }
.household-icon { display: inline-flex; width: 1.35rem; height: 1.35rem; color: #4d644a; }
.household-icon svg { width: 100%; height: 100%; }
.household-members { display: grid; width: 100%; margin: 0; padding: 0; list-style: none; }
.household-member { display: grid; justify-items: center; gap: .45rem; min-width: 0; text-align: center; }
.household-member + .household-member { margin-top: .75rem; }
.household-summary + .household-members,
.household-members + .household-gallery:has(.household-thumbnail) { margin-top: -.25rem; }
.household-member + .household-member::before,
.household-summary + .household-members > .household-member:first-child::before,
.household-members + .household-gallery:has(.household-thumbnail)::before {
  content: '';
  width: 76%;
  border-top: 1px solid #dbd2be;
  margin-bottom: .35rem;
}
.household-details { display: grid; justify-items: center; gap: .25rem; width: 100%; min-width: 0; }
.household-name { font-size: .98rem; }
.household-contact { display: flex; align-items: flex-start; max-width: 100%; gap: .35rem; color: #4d5545; font-size: .87rem; }
.household-contact-value { min-width: 0; overflow-wrap: anywhere; }
.household-contact .household-icon { margin-top: .12em; width: .9rem; height: .9rem; flex-shrink: 0; }

.household-thumbnail {
  display: block;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  margin-inline: auto;
  padding: 0;
  border: 0;
  border-radius: .3rem;
  background: transparent;
  cursor: zoom-in;
}

.household-thumbnail img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 14rem;
  border-radius: inherit;
  object-fit: contain;
}

.household-exterior img { max-height: var(--household-exterior-height); }
.household-portrait,
.household-gallery .household-photo { max-width: min(100%, var(--household-portrait-size)); }
.household-portrait img,
.household-gallery img { max-height: var(--household-portrait-size); }
.household-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: .45rem;
}
.household-gallery-heading {
  margin: 0;
  color: #4d5545;
  font-size: .88rem;
  font-weight: 600;
  text-align: center;
}
.household-gallery-photo { min-width: 0; max-width: 100%; margin: 0; }
.household-gallery-photo:has(.household-thumbnail) ~ .household-gallery-photo { margin-top: .55rem; }
.household-photo-caption {
  margin-top: .35rem;
  color: #626858;
  font-size: .83rem;
  font-style: italic;
  font-weight: 400;
  text-align: center;
  overflow-wrap: anywhere;
}
.household-gallery:not(:has(.household-thumbnail)),
.household-gallery-photo:not(:has(.household-thumbnail)) { display: none; }

#household-photo-viewer {
  width: max-content;
  max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - 1rem);
  padding: .6rem;
  border: 1px solid #c6baa0;
  border-radius: .6rem;
  color: #30482d;
  background: var(--paper-grain) #faf3e2;
}

#household-photo-viewer[open] { display: flex; flex-direction: column; }
#household-photo-viewer::backdrop { background: #252d22af; }
.photo-viewer-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.photo-viewer-bar button { min-height: 44px; cursor: pointer; }
.photo-viewer-previous, .photo-viewer-next {
  padding-inline: .65rem;
  border: 1px solid #b9ad93;
  border-radius: .4rem;
  color: inherit;
  background: #fffaf0;
}
.photo-viewer-count { font-size: .85rem; }
.photo-viewer-close { margin-left: auto; }
.photo-viewer-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  min-width: 0;
  margin: 0;
}
.photo-viewer-image {
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}
.photo-viewer-label {
  flex: none;
  max-width: 100%;
  max-height: min(28dvh, 8rem);
  overflow: auto;
  margin-top: .45rem;
  color: #30482d;
  font: 600 1rem/1.25 var(--landmark-serif);
  text-align: center;
  overflow-wrap: anywhere;
}
.photo-viewer-caption { font-style: italic; font-weight: 400; font-size: .92rem; }
.household-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #household-profile, #household-profile.household-panel-left {
    inset: auto env(safe-area-inset-right) calc(1.05rem + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    width: auto;
    max-height: 45%;
    border-radius: .65rem .65rem 0 0;
  }

  .household-content { touch-action: pan-y pinch-zoom; }
  .household-name { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  #household-photo-viewer {
    max-width: calc(100vw - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}
