:root {
  --bg: #f4f2ea;
  --panel: #fffdf8;
  --ink: #1b1f1d;
  --muted: #54605b;
  --accent: #1f5f4a;
  --warn: #9f2d19;
  --line: #d9d4c8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #ece8db, var(--bg) 40%);
  height: 100%;
  overflow: hidden;
}

main {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  height: 100%;
}

.seasonal-message {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 2rem;
}

.seasonal-message h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(2rem, 6vw, 3rem);
}

.seasonal-message p {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.4;
}

.seasonal-message[hidden] {
  display: none !important;
}

aside {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

bloomville-logo {
  margin-bottom: 0.65rem;
}

section {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

.map-maker-credit {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 1200;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  padding: 0.2rem 0.35rem;
  max-width: min(620px, calc(100% - 1.5rem));
}

.map-maker-credit-link {
  display: inline-flex;
  align-items: center;
  gap: 0rem;
  color: #3c4742;
  text-decoration: none;
}

.map-maker-credit-link:hover {
  text-decoration: none;
}

.map-maker-credit-logo {
  width: 130px;
  height: auto;
  max-width: 55vw;
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
  border-radius: 2px;
  background: #fff;
}

.map-maker-credit-text {
  font-size: 0.74rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.leaflet-popup-content {
  position: relative;
  width: 380px !important;
  font-size: 1.05rem;
  line-height: 1.4;
  margin: 1.25rem !important;
  padding-bottom: 1rem;
}

.geocode-source-popup {
  position: absolute;
  bottom: -0.65rem;
  right: -0.65rem;
  font-size: 0.65rem;
  color: #a3afaa;
  pointer-events: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

.leaflet-popup-content .popup-google-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.leaflet-popup-content .popup-google-link-icon {
  width: 1em;
  height: 1em;
  object-fit: contain;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  main {
    display: block;
    position: relative;
    height: 100%;
  }

  aside {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1000;
    background: transparent;
    border: none;
    padding: 0;
    pointer-events: none;
    display: block;
  }

  aside>bloomville-logo {
    margin: 0;
    max-width: 160px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.6rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
  }

  aside .actions,
  aside [data-sale-list],
  aside .info-panel,
  aside hr {
    display: none;
  }

  section {
    height: 100%;
  }

  .map-maker-credit {
    left: 0.55rem;
    bottom: 0.55rem;
    padding: 0.16rem 0.28rem;
    max-width: calc(100% - 1.1rem);
  }

  .map-maker-credit-logo {
    width: 100px;
    height: auto;
    max-width: 62vw;
  }

  .map-maker-credit-text {
    font-size: 0.66rem;
  }

  .leaflet-popup-content {
    width: 65vw !important;
    font-size: 1.15rem;
    min-height: 30vh;
  }

  .leaflet-popup-content strong {
    font-size: 1.25rem;
  }

  .leaflet-popup-content small {
    font-size: 0.95rem;
  }

  .leaflet-popup-content .popup-items-scroll {
    max-height: 55vh;
  }

  .leaflet-container a.leaflet-popup-close-button {
    width: 44px;
    height: 44px;
    font: 36px/44px Tahoma, Verdana, sans-serif;
    color: #444;
    top: 4px;
    right: 4px;
  }
}

.info-panel {
  margin-top: 0.75rem;
  position: sticky;
  bottom: -1rem;
  left: 0;
  text-align: left;
  background: linear-gradient(to top, var(--panel) 70%, rgba(255, 253, 248, 0));
  padding-top: 1rem;
}

.info-panel summary {
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #b8c3bd;
  background: #fff;
  color: #45524d;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
}

.info-panel summary::-webkit-details-marker {
  display: none;
}

.info-panel summary::before {
  content: "i";
  line-height: 1;
}

.info-panel[open] summary::before {
  content: "x";
}

.info-body {
  margin-top: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.65rem 0.7rem 0.75rem;
  text-align: left;
}

.info-panel[open] summary {
  color: #38443f;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 4.4rem;
  font-size: 0.82rem;
  text-align: center;
  align-items: center;
}

.metric .value {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sale-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  background: #fff;
  cursor: pointer;
  position: relative;
}

.sale-item.outside {
  border-color: #d4a49a;
  background: #fff4f2;
}

.sale-item.hidden-on-map {
  opacity: 1;
  background: #eef2f4;
  border-color: #9aa8ae;
  box-shadow: inset 0 0 0 1px #c3cdd1;
}

.sale-item.hidden-on-map::after {
  content: 'Hidden on map';
  position: absolute;
  left: 0.6rem;
  top: 0.52rem;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  color: #5d6a70;
  background: #dce4e8;
  border: 1px solid #b9c6cc;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}

.sale-item.hidden-on-map>div {
  color: #647177;
}

.sale-item.hidden-on-map>div:nth-of-type(1),
.sale-item.hidden-on-map>div:nth-of-type(2) {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.sale-visibility-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.22rem 0.48rem;
  cursor: pointer;
}

.sale-visibility-toggle:hover {
  border-color: #b5c0c2;
  color: #485459;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.1rem 0.5rem;
  color: var(--muted);
}

.tag.warn {
  color: var(--warn);
  border-color: #cf988d;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

a.button,
button.button {
  border: 0;
  font-family: inherit;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}

button.button[data-open-print-options] {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: 8px;
  box-shadow:
    0 8px 18px rgba(31, 95, 74, 0.22),
    0 2px 5px rgba(14, 18, 16, 0.1);
}

.print-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 2.25rem;
  display: grid;
  place-items: center;
}

.print-modal[hidden] {
  display: none;
}

.print-modal-shell {
  position: relative;
  height: min(900px, 100%);
  width: min(1200px, 100%);
  background: #fff;
  border: 1px solid rgba(27, 31, 29, 0.12);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 10px 30px rgba(14, 18, 16, 0.14),
    0 2px 10px rgba(14, 18, 16, 0.08);
}

.print-options-shell {
  position: relative;
  width: min(700px, 100%);
  background: #fff;
  border: 1px solid rgba(27, 31, 29, 0.12);
  border-radius: 10px;
  padding: 1rem;
  box-shadow:
    0 10px 30px rgba(14, 18, 16, 0.14),
    0 2px 10px rgba(14, 18, 16, 0.08);
}

.print-options-head {
  padding-right: 260px;
}

.print-options-copy {
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}

.print-options-logo {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 240px;
}

.print-options-logo bloomville-logo {
  margin: 0;
}

.print-options-head h2 {
  margin: 1rem 0 0;
  font-size: 1.05rem;
}

.print-options-sub {
  margin: 0.5rem 0 0.9rem;
  padding-right: 260px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 560px) {

  .print-options-head,
  .print-options-sub {
    padding-right: 0;
  }

  .print-options-logo {
    position: static;
    width: 220px;
    margin-top: 0.6rem;
  }
}

.print-options-grid {
  display: grid;
  gap: 0.6rem;
}

.print-option-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: grid;
  gap: 0.2rem;
}

.print-option-card strong {
  font-size: 0.95rem;
}

.print-option-card span {
  font-size: 0.85rem;
  color: var(--muted);
}

.print-option-card.selected {
  border-color: #4a8d77;
  background: #eef8f4;
  box-shadow: inset 0 0 0 1px #4a8d77;
}

.print-options-foot {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.print-options-hint {
  color: #8a5a12;
  font-size: 0.8rem;
  min-height: 1.2em;
}

.print-modal-actions {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 3;
  display: flex;
  gap: 0.45rem;
}

.print-modal-print,
.print-modal-close {
  border: 0;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  color: #fff;
  background: #1f5f4a;
  cursor: pointer;
}

.print-modal-print {
  min-width: 150px;
  padding: 0.85rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow:
    0 8px 18px rgba(31, 95, 74, 0.2),
    0 2px 5px rgba(14, 18, 16, 0.1);
}

.print-modal-frame {
  border: 0;
  width: 100%;
  height: 100%;
}

.status {
  margin: 0.75rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.data-source {
  display: inline-block;
  font-size: 0.8rem;
  color: #184f99;
  background: #eaf2ff;
  border: 1px solid #bfd6ff;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.data-source.fallback {
  color: #7a4a00;
  background: #fff4df;
  border-color: #f0ce8b;
}

.marker-badge {
  background: #1f6feb;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.marker-badge.outside {
  background: #d1242f;
}

.leaflet-popup-content .popup-items-scroll {
  max-height: 8rem;
  overflow-y: auto;
  margin: 0.2rem 0 0.3rem;
  padding-right: 0.2rem;
}

.print-shell {
  padding: 1rem;
}

.print-view-page header {
  padding: 0 1rem;
  margin-top: 1rem;
}

.print-view-page header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 0 0;
  letter-spacing: -0.02em;
}

.print-view-page header .sub {
  font-size: 1.15rem;
  color: var(--muted);
}

.print-map {
  height: 80vh;
  border: 1px solid var(--line);
}

.map-shell {
  width: min(8in, 100%);
  margin: 0 auto;
}

.print-shell.map-shell .print-map {
  height: auto;
  aspect-ratio: 8.5 / 11;
}

.print-list {
  max-width: 900px;
  margin: 0 auto;
}

.print-list table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.print-list th,
.print-list td {
  border: 1px solid var(--line);
  padding: 0.45rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.print-list th:nth-child(1),
.print-list td:nth-child(1) {
  width: 8%;
}

.print-list th:nth-child(2),
.print-list td:nth-child(2) {
  width: 26%;
}

.print-list th:nth-child(3),
.print-list td:nth-child(3) {
  width: 56%;
}

.print-list th:nth-child(4),
.print-list td:nth-child(4) {
  width: 10%;
}

.print-compose-shell {
  max-width: 8in;
  margin: 0 auto;
}

.print-compose-page {
  width: 100%;
  break-after: page;
  page-break-after: always;
  margin-bottom: 0.3in;
  position: relative;
}

.print-compose-page:last-child {
  break-after: auto;
  page-break-after: auto;
  margin-bottom: 0;
}

.print-compose-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.print-compose-meta {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.print-compose-map {
  height: 9.1in;
  border: 1px solid var(--line);
}

.print-page-logo {
  display: none;
}

@media screen and (max-width: 900px) {

  body.mode-print-map,
  body.mode-print-list,
  body.mode-print-compose {
    height: auto;
    overflow: auto;
  }

  body.mode-print-map .print-shell,
  body.mode-print-list .print-shell,
  body.mode-print-compose .print-shell {
    padding: 0.7rem;
  }

  body.mode-print-map .map-shell,
  body.mode-print-compose .print-compose-shell,
  body.mode-print-list .print-list {
    width: 100%;
    max-width: 100%;
  }

  body.mode-print-map .print-map {
    height: 68dvh;
    min-height: 420px;
  }

  body.mode-print-compose .print-compose-page {
    margin-bottom: 0.8rem;
  }

  body.mode-print-compose .print-compose-map {
    height: 68dvh;
    min-height: 420px;
  }

  body.mode-print-list .print-list table {
    table-layout: auto;
    font-size: 0.86rem;
  }

  body.mode-print-list .print-list th,
  body.mode-print-list .print-list td {
    padding: 0.35rem;
  }

  body.mode-print-list .print-list th:nth-child(1),
  body.mode-print-list .print-list td:nth-child(1),
  body.mode-print-list .print-list th:nth-child(2),
  body.mode-print-list .print-list td:nth-child(2),
  body.mode-print-list .print-list th:nth-child(3),
  body.mode-print-list .print-list td:nth-child(3),
  body.mode-print-list .print-list th:nth-child(4),
  body.mode-print-list .print-list td:nth-child(4) {
    width: auto;
  }
}

body.prepare-print-layout .print-shell {
  padding: 0;
  width: 100%;
  max-width: none;
  height: auto;
  box-sizing: border-box;
}

body.prepare-print-layout .print-compose-shell {
  width: 100%;
  max-width: none;
  margin: 0;
}

body.prepare-print-layout .print-compose-page:not(.print-list) {
  width: 100%;
  max-width: none;
  height: calc(11in - 0.7in);
  max-height: calc(11in - 0.7in);
  margin-bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  box-sizing: border-box;
  overflow: hidden;
}

body.prepare-print-layout .print-compose-map {
  height: 100%;
  width: 100%;
  min-height: 0;
  align-self: stretch;
  border: 0;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.35in;
  }

  html,
  body {
    height: 100%;
    width: 100%;
    overflow: visible;
  }

  header,
  .actions {
    display: none;
  }

  .print-page-logo {
    display: block;
    width: 1.8in;
    max-width: 100%;
    height: auto;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
    box-sizing: border-box;
  }

  body.mode-print-compose>.print-page-logo {
    display: none;
  }

  .print-compose-page .print-compose-page-logo {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 9999;
    width: 1.8in;
    max-width: 100%;
    height: auto;
    pointer-events: none;
  }

  body,
  .print-shell {
    background: #fff;
  }

  body {
    margin: 0;
  }

  .print-shell {
    padding: 0;
    width: 100%;
    max-width: none;
    height: auto;
    box-sizing: border-box;
  }

  .print-shell.map-shell {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    height: calc(11in - 0.7in);
    max-height: calc(11in - 0.7in);
    box-sizing: border-box;
    overflow: hidden;
  }

  .print-compose-shell {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .print-compose-page:not(.print-list) {
    width: 100%;
    max-width: none;
    height: calc(11in - 0.7in);
    max-height: calc(11in - 0.7in);
    margin-bottom: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    box-sizing: border-box;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-compose-page+.print-compose-page {
    break-before: page;
    page-break-before: always;
  }

  .print-list table {
    page-break-inside: auto;
  }

  .print-list tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-list thead {
    display: table-header-group;
  }

  .print-shell.print-list {
    padding-top: 0.65in;
  }

  .print-compose-page.print-list {
    padding-top: 0.65in;
    box-sizing: border-box;
  }

  .print-compose-map {
    height: 100%;
    width: 100%;
    min-height: 0;
    align-self: stretch;
    border: 0;
  }

  .print-map {
    height: 100%;
    width: 100%;
    border: 0;
  }

  .leaflet-control-container {
    display: none;
  }
}
