/* Real land-map workspace. Load after styles.css and Leaflet's stylesheet. */

.real-map-wrap {
  position: relative;
  z-index: 0;
  isolation: isolate;
  min-width: 0;
  width: 100%;
  background: #e7ebdf;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#land-map {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  min-width: 0;
  height: 600px;
  background: #e7ebdf;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  line-height: 1.5;
}

/* Keep Leaflet's own geometry independent of page-wide image rules. */
#land-map .leaflet-pane > svg,
#land-map .leaflet-overlay-pane svg,
#land-map .leaflet-tile,
#land-map .leaflet-image-layer,
#land-map .leaflet-marker-icon,
#land-map .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}
#land-map .leaflet-control { font: inherit; }
#land-map .leaflet-control a { transition: background-color .16s, color .16s; }
#land-map .leaflet-control-zoom {
  overflow: visible;
  border: 1px solid #c1cbb4;
  border-radius: 8px;
  box-shadow: 0 3px 13px rgb(28 58 38 / 12%);
}
#land-map .leaflet-control-zoom a {
  display: block;
  width: 39px;
  height: 39px;
  line-height: 37px;
  background: #fffef9;
  color: var(--forest);
  font-size: 24px;
  font-weight: 400;
  text-align: center;
}
#land-map .leaflet-control-zoom a:first-child { border-radius: 7px 7px 0 0; border-bottom: 1px solid #dbe1d1; }
#land-map .leaflet-control-zoom a:last-child { border-radius: 0 0 7px 7px; }
#land-map .leaflet-control-zoom a:hover { background: #eaf0df; }
#land-map .leaflet-control-zoom a.leaflet-disabled { color: #9ca594; background: #f1f3ea; }
#land-map .leaflet-control a:focus-visible { outline: 3px solid #aa7427; outline-offset: 3px; }
#land-map .leaflet-control-scale-line {
  padding: 2px 5px;
  border-color: #627657;
  color: #354b2e;
  background: rgb(255 254 249 / 90%);
  font-size: 10px;
  font-weight: 550;
}
#land-map .leaflet-control-attribution {
  display: block !important;
  visibility: visible !important;
  max-width: min(620px, calc(100% - 10px));
  margin: 0;
  padding: 4px 7px;
  border-radius: 4px 0 0 0;
  background: rgb(255 254 249 / 96%);
  color: #44543e;
  font-size: 10px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 1;
}
#land-map .leaflet-control-attribution a { color: #1d5d4e; text-decoration: underline; text-underline-offset: 2px; }
#land-map .leaflet-bottom.leaflet-right { max-width: 100%; }
#land-map .leaflet-control-attribution svg { display: inline; width: auto; max-width: 16px; vertical-align: baseline; }
#land-map .leaflet-popup-content-wrapper {
  color: var(--ink);
  background: var(--white);
  border: 1px solid #d2dcc4;
  border-radius: 11px;
  box-shadow: 0 6px 24px rgb(24 51 32 / 15%);
}
#land-map .leaflet-popup-content { max-width: min(290px, calc(100vw - 95px)); margin: 17px 23px 17px 17px; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
#land-map .leaflet-popup-content p { margin: 8px 0; }
#land-map .leaflet-popup-content strong { color: var(--forest); }
#land-map .leaflet-popup-tip { background: var(--white); }
#land-map .leaflet-popup-close-button { width: 32px; height: 32px; color: #627558; font-size: 23px; line-height: 29px; }
#land-map .leaflet-interactive:focus-visible { outline: none; stroke: #9b6d26; stroke-width: 4px; }
#land-map .leaflet-marker-icon:focus-visible { outline: 3px solid #9b6d26; outline-offset: 4px; }
.real-map-label,
#land-map .leaflet-tooltip.real-map-label {
  padding: 2px 5px;
  border: 1px solid rgb(151 172 129 / 40%);
  border-radius: 3px;
  background: rgb(255 254 246 / 89%);
  color: #3f5b32;
  box-shadow: 0 1px 3px rgb(36 68 28 / 6%);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: .015em;
  pointer-events: none;
  white-space: nowrap;
}
#land-map .leaflet-tooltip.real-map-label::before { display: none; }

.real-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  min-width: 0;
  padding: 16px 20px;
  background: var(--white);
}
.real-map-toolbar > div { min-width: 0; }
.real-map-toolbar select {
  max-width: 100%;
  min-height: 44px;
  padding: 9px 30px 9px 12px;
  border: 1px solid #d1dbc3;
  border-radius: 7px;
  background: #f4f7ed;
  font-size: 12px;
  font-weight: 550;
}
.real-map-toolbar > button:not(.button),
.land-tools > button:not(.button),
.land-selection-actions > button:not(.button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid #d0dac2;
  border-radius: 7px;
  background: #fafbf4;
  color: #3e6037;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.real-map-toolbar > button:not(.button):hover,
.land-tools > button:not(.button):hover,
.land-selection-actions > button:not(.button):hover { background: #e8efdc; }
.real-map-toolbar button[aria-pressed='true'],
.real-map-toolbar button.active,
.land-tools button[aria-pressed='true'] { background: var(--forest); color: #fffef9; border-color: var(--forest); }
.real-search { display: flex; align-items: center; flex: 1 1 270px; gap: 8px; width: 100%; min-width: 0; max-width: 100%; margin: 0; }
.real-search > label { display: block; flex: 1; min-width: 0; }
.real-search input {
  display: block;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d1dbc3;
  border-radius: 7px;
  background: #f7f9f0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}
.real-search input::placeholder { color: #78846e; }
.real-search button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--forest);
  border-radius: 7px;
  background: var(--forest);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
}
.real-search button:hover:not(:disabled) { background: #245849; border-color: #245849; }
.search-results { display: grid; gap: 0; flex-basis: 100%; width: 100%; min-width: 0; max-height: 240px; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #d6dfca; border-radius: 8px; background: #fffef9; scrollbar-width: thin; scrollbar-color: #bbc9aa #f3f6ec; }
.search-results:empty { display: none; }
.search-results button { display: block; width: 100%; min-height: 46px; padding: 12px 14px; border-bottom: 1px solid #e6ebdd; color: #3a5d34; font-size: 12px; line-height: 1.5; text-align: left; overflow-wrap: anywhere; }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover, .search-results button:focus-visible { background: #eaf1df; }
.search-results button small, .search-results button span { display: block; color: #67795c; font-size: 10px; margin-top: 3px; }

.map-status { display: flex; align-items: flex-start; gap: 8px; min-height: 38px; padding: 10px 18px; color: #556b49; background: #edf2e5; border-bottom: 1px solid #dce5d0; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.map-status:empty { display: none; }
.map-status::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; margin-top: 5px; border-radius: 50%; background: #6f8f55; }
.map-status.error { color: #8c4a35; background: #f6e9df; border-color: #e8cbbb; }
.map-status.error::before { background: #ad6346; }
.map-status.loading { color: #756033; background: #f5efdf; border-color: #e7dcc0; }
.map-status.loading::before { width: 11px; height: 11px; flex-basis: 11px; margin-top: 3px; border: 2px solid #dbcba7; border-top-color: #9b7b36; background: transparent; animation: land-map-loading .9s linear infinite; }
@keyframes land-map-loading { to { transform: rotate(360deg); } }
.map-source-note { padding: 12px 18px; color: #68785e; font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.map-source-note p { margin-bottom: 7px; }
.map-source-note > :last-child { margin-bottom: 0; }
.map-source-note strong { color: #4e6743; }
.map-source-note a { color: #2d6654; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.map-source-note a:hover { color: #163f35; }
.real-layer-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 17px; min-width: 0; padding: 10px 18px 5px; border-bottom: 1px solid #e8ecdf; }
.real-layer-controls label { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: #4d6742; font-size: 11px; line-height: 1.45; cursor: pointer; }
.real-layer-controls input { width: 15px; height: 15px; flex: 0 0 15px; margin: 0; accent-color: var(--forest); }
.real-layer-controls button { min-height: 44px; padding: 7px 9px; border-radius: 6px; font-size: 11px; }
.real-layer-controls button:hover { background: #edf2e4; }
.real-layer-controls select { max-width: 100%; min-height: 44px; padding: 8px 25px 8px 10px; border: 1px solid #d8e0cd; border-radius: 6px; background: #f8faf1; font-size: 11px; }
.map-key { display: flex; flex-wrap: wrap; gap: 9px 17px; align-items: center; padding: 12px 18px; color: #63765a; font-size: 10px; line-height: 1.5; }
.map-key > span, .map-key > div { display: inline-flex; align-items: center; gap: 7px; }
.map-key i, .map-key .swatch, .map-key .boundary-swatch { display: inline-block; width: 18px; height: 12px; flex: 0 0 18px; border: 1.5px solid #5e8351; border-radius: 2px; background: rgb(119 157 88 / 9%); }
.map-key .selected, .map-key .selected-swatch, .map-key .swatch-selected { border: 2px solid #153e35; background: rgb(71 127 75 / 28%); }
.map-key .township, .map-key .township-swatch { border-color: #99804a; background: rgb(182 155 96 / 9%); }
.map-key .section, .map-key .section-swatch { border-color: #779360; background: rgb(119 157 88 / 9%); }
.map-key .quarter, .map-key .quarter-swatch { border-color: #547b69; background: rgb(84 123 105 / 8%); }
.map-key .unknown, .map-key .unknown-swatch { border-color: #8d917e; border-style: dashed; background: #eef0e6; }

.live-data-pill { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 5px 9px; border: 1px solid #cbdabb; border-radius: 5px; background: #eaf1df; color: #3e6536; font-size: 10px; font-weight: 650; line-height: 1.5; }
.live-data-pill::before { content: ''; display: block; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #628a48; }
.map-selection-summary { margin: 18px 0; padding: 15px; border: 1px solid #d3dfc5; border-radius: 9px; background: #edf3e3; }
.map-selection-summary h3, .map-selection-summary strong { color: #365d33; }
.map-selection-summary p { color: #5c7450; font-size: 12px; margin: 8px 0 0; line-height: 1.65; }
.map-selection-summary .land-area { margin-top: 8px; }
.land-area { display: block; color: #42643b; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.6; }
.land-area small { color: #708262; font-size: 10px; font-weight: 400; }
.land-selected-list { display: flex; flex-direction: column; gap: 8px; max-height: 310px; margin: 14px 0; padding: 2px; list-style: none; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b6c7a7 #f2f5eb; }
.land-selected-item { display: flex; align-items: flex-start; gap: 4px; min-width: 0; border: 1px solid #d6e0ca; border-radius: 8px; background: #f3f7ec; }
.land-item-main { display: block; flex: 1; min-width: 0; min-height: 47px; padding: 11px 12px; border-radius: 7px 0 0 7px; font-size: 12px; line-height: 1.6; text-align: left; overflow-wrap: anywhere; }
.land-item-main:hover { background: #e7efdb; }
.land-item-main strong { display: block; color: #345b31; font-size: 12px; }
.land-item-main small, .land-item-main > span { display: block; margin-top: 3px; color: #687e5b; font-size: 10px; }
.land-item-remove { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; width: 42px; min-height: 44px; margin: 2px 2px 0 0; border-radius: 6px; color: #7c836d; font-size: 20px; line-height: 1; }
.land-item-remove .icon { width: 15px; height: 15px; flex-basis: 15px; }
.land-item-remove:hover { color: #8b4c34; background: #f0e7db; }
.land-empty { margin: 16px 0; padding: 23px 16px; border: 1px dashed #bdcdb0; border-radius: 9px; background: #f3f7eb; color: #697f5d; font-size: 12px; line-height: 1.75; text-align: center; }
.land-empty .icon { display: block; width: 27px; height: 27px; margin: 0 auto 12px; color: #829b6b; }
.land-empty p { margin: 0; }
.land-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; margin: 14px 0; }
.land-tools .button { min-width: 0; padding: 10px 13px; font-size: 11px; }
.land-selection-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; margin-top: 17px; }
.land-selection-actions > button, .land-selection-actions > a { flex: 1 1 115px; min-width: 0; }
.land-selection-actions > .wide { flex-basis: 100%; }
.selection-note { margin: 11px 0 0; color: #6a7a60; font-size: 11px; line-height: 1.7; }
.selection-note a { color: #3d6a45; text-decoration: underline; text-underline-offset: 2px; }
.map-rights-note { margin: 18px 0; padding: 15px 16px; border: 1px solid #e0d7b9; border-radius: 8px; background: #f3eedf; color: #766336; font-size: 11px; line-height: 1.7; }
.map-rights-note strong { display: block; color: #715a2b; margin-bottom: 5px; font-size: 11px; }
.map-rights-note p { margin: 5px 0 0; }
.map-rights-note .icon { color: #927a40; }
.map-unavailable { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; height: 100%; padding: 35px 28px; color: #5e7051; background: #eef2e6; text-align: center; }
.map-unavailable > .icon { width: 35px; height: 35px; color: #8da178; margin-bottom: 18px; }
.map-unavailable h2, .map-unavailable h3 { max-width: 450px; color: #4d6841; }
.map-unavailable p { max-width: 480px; font-size: 12px; line-height: 1.8; }
.map-unavailable .button { margin-top: 6px; }
.real-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 15px; min-width: 0; margin: 25px 0; }
.real-summary-card { min-width: 0; padding: 20px; border: 1px solid #d7e0cc; border-radius: 11px; background: #fbfcf5; }
.real-summary-card > .eyebrow { margin-bottom: 11px; }
.real-summary-card > strong { display: block; color: var(--forest); font-family: Georgia, serif; font-size: 28px; font-weight: 400; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.real-summary-card h3 { color: #3e5d34; font-size: 14px; }
.real-summary-card p { margin: 9px 0 0; color: #697a60; font-size: 11px; line-height: 1.7; }
.map-data-details { margin: 18px 0; padding: 15px 18px; border: 1px solid #dae2cf; border-radius: 9px; background: #f5f8ee; color: #63775a; font-size: 11px; line-height: 1.75; }
.map-data-details summary { min-height: 35px; color: #44623b; font-size: 12px; font-weight: 600; line-height: 1.7; cursor: pointer; }
.map-data-details summary::marker { color: #789262; }
.map-data-details p { margin: 9px 0; }
.map-data-details > :last-child { margin-bottom: 0; }
.map-data-details a { color: #28634e; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.map-data-details dl { margin: 11px 0 0; }
.map-data-details dl > div { display: flex; flex-wrap: wrap; gap: 6px 17px; border-top: 1px solid #e1e7d8; padding: 8px 0; }
.map-data-details dt { min-width: 135px; color: #5e7552; font-weight: 600; }
.map-data-details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.map-data-details ul { padding-left: 18px; }
.map-data-details li { margin-bottom: 6px; }

/* Selection content is a vertical flow, including on the tablet layout. */
.selection-panel:has(.land-selected-list),
.selection-panel:has(.map-selection-summary),
.selection-panel:has(.land-empty) { display: block; }
.selection-panel:has(.land-selected-list) > .divider,
.selection-panel:has(.map-selection-summary) > .divider,
.selection-panel:has(.land-empty) > .divider { display: block; }
.real-map-toolbar :focus-visible,
.land-tools :focus-visible,
.land-selection-actions :focus-visible,
.land-item-main:focus-visible,
.land-item-remove:focus-visible,
.search-results button:focus-visible,
.map-data-details summary:focus-visible { outline: 3px solid #ae792c; outline-offset: 2px; }

@media (max-width: 1190px) {
  .real-map-toolbar { padding: 14px 16px; gap: 10px; }
  .real-map-toolbar .region-control { flex: 1 1 150px; }
  .real-search { flex-basis: 100%; }
  .land-selected-list { max-height: 285px; }
  .real-summary-card { padding: 18px; }
}
@media (max-width: 930px) {
  .real-map-toolbar { padding: 16px 20px; }
  .real-search { flex-basis: 270px; }
  .land-selected-list { max-height: 260px; }
  .selection-panel:has(.land-selected-list) .interest-options,
  .selection-panel:has(.land-empty) .interest-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-source-note { font-size: 11px; }
}
@media (max-width: 650px) {
  #land-map { height: 440px; }
  .real-map-toolbar { padding: 13px; gap: 10px; }
  .real-map-toolbar > .region-control { width: 100%; }
  .real-map-toolbar .live-data-pill { font-size: 9px; }
  .real-map-toolbar > button:not(.button), .land-tools > button:not(.button) { font-size: 10px; }
  .real-search { flex-basis: 100%; gap: 7px; }
  .real-search input { padding: 10px; font-size: 16px; }
  .real-search input::placeholder { font-size: 11px; }
  .real-search button { padding: 10px 12px; font-size: 11px; }
  .search-results { max-height: 220px; }
  .search-results button { padding: 12px; font-size: 12px; }
  .map-status { padding: 10px 13px; font-size: 10px; }
  .map-source-note { padding: 12px 13px; font-size: 10px; }
  .map-key { gap: 8px 13px; padding: 11px 13px; font-size: 10px; }
  .real-layer-controls { gap: 2px 14px; padding: 6px 13px; }
  .real-layer-controls label { font-size: 11px; }
  #land-map .leaflet-control-zoom a { width: 43px; height: 43px; line-height: 41px; }
  #land-map .leaflet-control-attribution { max-width: calc(100% - 6px); padding: 4px 6px; font-size: 9px; }
  #land-map .leaflet-control-scale-line { font-size: 9px; }
  #land-map .leaflet-popup-close-button { width: 38px; height: 38px; line-height: 35px; }
  #land-map .leaflet-popup-content { margin-right: 30px; font-size: 12px; }
  .real-map-label, #land-map .leaflet-tooltip.real-map-label { font-size: 9px; padding: 2px 4px; }
  .selection-panel:has(.land-selected-list) .interest-options,
  .selection-panel:has(.land-empty) .interest-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-selection-summary { margin-top: 16px; }
  .land-selected-list { max-height: 280px; }
  .land-item-main { min-height: 52px; padding: 12px; }
  .land-item-remove { flex-basis: 44px; width: 44px; min-height: 46px; }
  .land-selection-actions > button, .land-selection-actions > a { min-height: 46px; }
  .selection-note { font-size: 11px; }
  .map-rights-note { padding: 15px; font-size: 11px; }
  .real-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
  .real-summary-card { padding: 17px 15px; }
  .real-summary-card > strong { font-size: 25px; }
  .real-summary-card h3 { font-size: 13px; }
  .real-summary-card p { font-size: 10px; }
  .map-data-details { padding: 14px 15px; }
  .map-data-details summary { min-height: 44px; font-size: 12px; }
  .map-unavailable { min-height: 440px; padding: 30px 22px; }
}
@media (max-width: 370px) {
  .real-map-toolbar { padding: 11px; }
  .real-search input { padding-left: 8px; }
  .real-search button { padding-left: 10px; padding-right: 10px; }
  .real-summary-grid { grid-template-columns: minmax(0, 1fr); }
  .map-key { column-gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-status.loading::before { animation: none; }
}
@media print {
  .real-map-toolbar, .real-search, .search-results, .real-layer-controls,
  .land-tools, .land-selection-actions, .land-item-remove,
  #land-map .leaflet-control-zoom { display: none !important; }
  .real-map-wrap { break-inside: avoid; }
  #land-map { height: 400px; print-color-adjust: exact; }
  #land-map .leaflet-control-attribution { display: block !important; visibility: visible !important; font-size: 7pt; }
  .map-source-note, .map-status, .map-rights-note, .selection-note { font-size: 8pt; }
  .land-selected-list { max-height: none; overflow: visible; }
  .land-selected-item { break-inside: avoid; }
  .land-item-main { color: #20392b; }
  .real-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .real-summary-card { padding: 13px; break-inside: avoid; }
  .real-summary-card > strong { font-size: 20pt; }
  .map-data-details { break-inside: avoid; }
}

/* Public-demo analysis outline controls. */
.land-draw-controls { padding: 14px 18px; border-bottom: 1px solid #dce5d0; background: #f5f8ed; }
.land-draw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.land-draw-actions button { min-height: 44px; padding: 9px 14px; border: 1px solid #b7c8a8; border-radius: 7px; background: #fffef9; color: #365a35; font-size: 12px; font-weight: 650; }
.land-draw-actions button:first-child, .land-draw-actions [data-land-draw='finish']:not(:disabled) { background: #184b3e; border-color: #184b3e; color: white; }
.land-draw-actions button:hover:not(:disabled) { filter: brightness(.94); }
.land-draw-actions button:disabled { opacity: .45; cursor: default; }
.land-draw-actions button:focus-visible { outline: 3px solid #ae792c; outline-offset: 2px; }
.land-draw-help { margin: 8px 0 0; color: #5a7050; font-size: 11px; line-height: 1.65; }
#land-map.land-drawing, #land-map.land-drawing .leaflet-container { cursor: crosshair; }
#land-map.land-drawing .leaflet-interactive,
#land-map.land-drawing .leaflet-pane canvas,
#land-map.land-drawing .leaflet-marker-icon { pointer-events: none !important; }
@media (max-width: 650px) { .land-draw-controls { padding: 13px; } .land-draw-actions button { flex: 1 1 auto; } }
@media print { .land-draw-controls { display: none !important; } }
