.field-masthead {
  --field-bg: var(--surface-2);
  --field-ink: var(--ink);
  --field-caption: var(--ink2);
  --field-accent: var(--link);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  min-height: 182px;
  margin: 12px 0 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--field-bg);
  color: var(--field-ink);
}

.field-masthead[hidden] { display: none; }

.field-xray,
.field-sell,
.field-analyzer,
.field-browse {
  --field-bg: #142b23;
  --field-ink: #fffcf0;
  --field-caption: #e0e9dc;
  --field-accent: #e0fa79;
  border-color: transparent;
}

.field-xray { --field-bg: #142218; }
.field-analyzer { --field-bg: #172b2b; }

.field-prices {
  --field-bg: light-dark(#eee8d7, #2d3026);
  --field-accent: light-dark(#514d30, #e9dca7);
}

.field-sales {
  --field-bg: light-dark(#eee1d2, #302721);
  --field-accent: light-dark(#68432c, #f3cdb4);
}

.field-research {
  --field-bg: light-dark(#e9ece0, #26342a);
  --field-accent: light-dark(#305747, #c4e5be);
}

.field-masthead-copy {
  align-self: center;
  min-width: 0;
  padding: clamp(22px, 3.25vw, 46px);
}

.atlas-site .field-masthead h1,
.atlas-site .field-area-heading h1 {
  margin: 0 0 10px;
  color: inherit;
  font-size: clamp(2.8rem, 5vw, 5.15rem);
  line-height: .94;
  text-wrap: balance;
}

.field-masthead .lede {
  max-width: 49ch;
  margin: 0;
  color: var(--field-caption);
  font-size: clamp(.98rem, 1.3vw, 1.12rem);
  line-height: 1.55;
}

.field-masthead > img {
  display: block;
  align-self: stretch;
  width: 100%;
  height: 100%;
  max-height: 280px;
  object-fit: cover;
}

.field-xray > img { object-position: 70% 56%; }
.field-analyzer > img { object-position: 68% 52%; }
.field-research > img { object-position: 63% center; }

.field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px 18px;
  margin-top: 15px;
}

.field-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-block: 3px;
  color: var(--field-accent);
  font-weight: 700;
  text-decoration-thickness: 1px;
}

.field-action-link::after {
  width: .42em;
  height: .42em;
  margin-left: .14em;
  border: solid currentColor;
  border-width: 1px 1px 0 0;
  transform: rotate(45deg);
  content: "";
}

.field-action-link:hover { color: inherit; }

.field-area-heading,
.field-record-heading {
  margin: 12px 0 18px;
  padding: clamp(18px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.field-area-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 3.5vw, 42px);
  background: var(--atlas-pine) url("./home/contour-paper.webp") right 56% / cover no-repeat;
  color: var(--atlas-cream);
}

.field-area-heading .lede,
.field-area-heading p {
  max-width: 73ch;
  margin: 0;
  color: #dfeade;
}

.field-area-heading p + p { margin-top: 8px; }
.field-area-heading .lede strong { color: inherit; }
.field-area-heading a { color: var(--atlas-lime); }

.field-area-heading .state-icon {
  flex: 0 0 clamp(42px, 12vw, 143px);
  width: clamp(42px, 12vw, 143px);
  height: clamp(42px, 12vw, 143px);
  color: #c8e396;
  opacity: .87;
}

.atlas-site .field-record-heading h1 {
  max-width: 31ch;
  margin: 0;
  font-size: clamp(2.7rem, 4.65vw, 4.8rem);
  overflow-wrap: anywhere;
}

.field-guide-heading {
  border-top: 3px solid var(--forest);
}

.field-guide-heading .lede { margin: 12px 0 0; }

.field-source-summary {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink2);
}

.field-source-summary summary { cursor: pointer; font-weight: 700; }
.field-source-summary p { margin: 8px 0 0; }

.field-parcel-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 22px;
}

.field-parcel-jumps a {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink2);
  font-weight: 700;
  text-decoration: none;
}

.field-parcel-jumps a:hover {
  border-color: var(--forest);
  background: var(--forest-soft);
}

.atlas-site #main .leaflet-container { background: var(--surface-2); }
.atlas-site #main :where(form[id], article[id], .xray-section[id]) { scroll-margin-top: 87px; }

.atlas-site #main :is(.dossier-card, .info-card, .xray-section, .chart-card, .worksheet) {
  border-radius: 12px;
  box-shadow: none;
}

.atlas-site #main :is(.dossier-card, .xray-section) > .xray-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.atlas-site #main .dossier-card > h2,
.atlas-site #main .xray-header h2,
.atlas-site #main .prose h2,
.atlas-site #main [role="tabpanel"] > h2 {
  font: 400 clamp(1.95rem, 3vw, 2.85rem)/1.08 var(--atlas-serif);
  letter-spacing: -.012em;
}

.atlas-site #main .kpi-grid { gap: clamp(7px, 1.25vw, 17px); }

.atlas-site #main .kpi-card {
  min-width: 0;
  border-radius: 8px;
  border-top: 2px solid var(--atlas-rule);
  box-shadow: none;
}

.atlas-site #main .kpi-card strong {
  font-family: var(--atlas-serif);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.atlas-site #main .xray-tile {
  border-radius: 9px;
  box-shadow: none;
}

.atlas-site #main .xray-val {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.atlas-site #main .xray-search-bar {
  border-color: var(--atlas-rule);
  border-radius: 10px;
  box-shadow: none;
}

.atlas-site #main .xray-search-bar input,
.atlas-site #main .worksheet input,
.atlas-site #main .worksheet select {
  font-size: 16px;
  min-width: 0;
}

.atlas-site #main :is(.mode-btn, .pill-btn, .tab-bar button, .atlas-controls input, .atlas-controls select) {
  min-height: 35px;
  border-radius: 6px;
  font-family: var(--font-sans);
}

.atlas-site #main .tab-bar { gap: 6px; }

.atlas-site #main .tab-bar button[aria-selected="true"] {
  border-color: var(--forest);
  background: var(--forest-soft);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--forest);
}

.atlas-site #main .atlas-controls {
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.atlas-site #main .atlas-region-row { padding-block: 4px; }

.atlas-site #main .state-tile {
  border-radius: 7px;
  box-shadow: none;
}

.atlas-site #main .state-tile-copy strong { overflow-wrap: anywhere; }

.atlas-site #main .state-icon { filter: none; }

.atlas-site #main .data th {
  background: var(--surface-2);
  color: var(--ink2);
}

.atlas-site #main .prose {
  max-width: 74ch;
  margin-inline: auto;
  font-size: 16px;
  line-height: 1.69;
}

@media (max-width: 640px) {
  .field-masthead { grid-template-columns: minmax(0, 1fr); margin-top: 9px; margin-bottom: 17px; }
  .field-masthead-copy { padding: 19px 17px; }
  .atlas-site .field-masthead h1,
  .atlas-site .field-area-heading h1 { font-size: clamp(2.35rem, 9vw, 3.4rem); }
  .field-masthead > img { height: 115px; }
  .field-area-heading, .field-record-heading { padding: 15px; }
  .atlas-site #main .tab-bar > button { text-align: left; }
  .atlas-site #main .kpi-card { padding: 9px 10px; }
  table.state-county-values th,
  table.state-county-values td { padding-inline: 8px; }
  table.state-county-values thead th.n { white-space: normal; }
  table.state-rankings,
  table.state-rankings thead,
  table.state-rankings tbody { display: block; }
  table.state-rankings thead tr { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
  table.state-rankings thead th {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    white-space: normal;
    text-align: left;
    font: 600 12px/1.4 var(--font-sans);
    text-transform: none;
    letter-spacing: 0;
  }
  table.state-rankings tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  table.state-rankings tbody tr:last-child { border-bottom: 0; }
  table.state-rankings tbody td,
  table.state-rankings tbody th {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  table.state-rankings tbody th { grid-area: 1 / 1; }
  table.state-rankings tbody td:first-child { grid-area: 1 / 2; text-align: right; }
  table.state-rankings tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font: 600 11.5px/1.3 var(--font-sans);
  }
}

@media print {
  .field-masthead, .field-area-heading, .field-record-heading {
    display: block;
    border: 0;
    padding: 0;
    background: #fff;
    color: #000;
  }
  .field-masthead .lede, .field-area-heading .lede { color: #111; }
  .field-masthead > img, .field-area-heading > .state-icon, .field-actions { display: none; }
}
