/* ==========================================================================
   NC Land Finder — tool chrome

   Loaded only on the development page. Uses the site's tokens throughout so
   the tool reads as part of the building, not a widget bolted to it.
   ========================================================================== */

.tool { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
/* Grid and flex children default to min-width:auto, which lets the wide lead
   table push the whole page sideways instead of scrolling inside its own box. */
.tool > * { min-width: 0; }

/* --------------------------------------------------------------- panels */
.panel {
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  min-width: 0;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: clamp(1rem, 2vw, 1.4rem) clamp(1.1rem, 2.2vw, 1.75rem);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.panel__title {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}
.panel__hint { font-size: .75rem; color: var(--ink-3); letter-spacing: .02em; }
.panel__body { padding: clamp(1.1rem, 2.4vw, 1.9rem); }

/* ----------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  border-bottom: 1px solid var(--rule);
  padding: 0 clamp(.75rem, 2vw, 1.4rem);
  background: var(--paper-2);
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: .95rem .85rem;
  position: relative;
  transition: color var(--med, .5s) var(--ease, ease);
}
.tab::after {
  content: "";
  position: absolute;
  left: .85rem; right: .85rem; bottom: -1px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform var(--med, .5s) var(--ease, ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

/* --------------------------------------------------------------- fields */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}
.tool-field { display: grid; gap: .45rem; align-content: start; }
.tool-field > label,
.tool-label {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tool-field small { font-size: .75rem; color: var(--ink-4); line-height: 1.5; }

.tool-input, .tool-select, .tool-area {
  font-family: inherit;
  font-size: .9375rem;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  padding: .6rem 0;
  width: 100%;
  transition: border-color var(--fast, .2s) linear;
}
.tool-input:focus, .tool-select:focus, .tool-area:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.tool-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 12px center, right 7px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.75rem;
}
.tool-area {
  border: 1px solid var(--rule-strong);
  padding: .8rem;
  min-height: 9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8125rem;
  line-height: 1.6;
  resize: vertical;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
}

.tool-btn {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 1px solid var(--ink);
  padding: .85rem 1.6rem;
  transition: background var(--med, .5s) var(--ease, ease), color var(--med, .5s) var(--ease, ease);
}
.tool-btn:hover:not([disabled]), .tool-btn:focus-visible:not([disabled]) {
  background: var(--ink);
  color: var(--paper);
}
.tool-btn--quiet { border-color: var(--rule-strong); color: var(--ink-2); }
.tool-btn--quiet:hover:not([disabled]) { background: var(--ink-2); border-color: var(--ink-2); }
.tool-btn[disabled] { opacity: .4; cursor: default; }

.tool-note {
  font-size: .8125rem;
  color: var(--ink-3);
  line-height: 1.65;
  max-width: 46rem;
}
.tool-note + .tool-note { margin-top: .6rem; }

/* A standing caution, not a decorative callout. */
.tool-caution {
  border-left: 2px solid var(--stone);
  padding: .2rem 0 .2rem 1rem;
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 46rem;
}
.tool-caution b { color: var(--ink); font-weight: 500; }

.tool-status {
  font-size: .8125rem;
  color: var(--ink-2);
  min-height: 1.2em;
}
.tool-status[data-tone="error"] { color: #8C3A2B; }
.tool-status[data-tone="busy"] { color: var(--ink-3); }

/* -------------------------------------------------------- column mapping */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem clamp(1rem, 2.5vw, 2rem);
}
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: .75rem; align-items: center; }
.map-row > span {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.map-row select { font-size: .8125rem; padding: .35rem 0; }
.map-row[data-required="true"] > span { color: var(--ink); }

/* -------------------------------------------------------------- results */
.result-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.result-bar > div {
  padding: clamp(1rem, 2vw, 1.4rem) 1rem clamp(1rem, 2vw, 1.4rem) 0;
  border-right: 1px solid var(--rule);
}
.result-bar > div:last-child { border-right: 0; }
.result-bar dt {
  font-size: .625rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.result-bar dd {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1;
  color: var(--ink);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.lead-table { width: 100%; border-collapse: collapse; font-size: .8125rem; min-width: 54rem; }
.lead-table th {
  text-align: left;
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--paper);
}
.lead-table th[data-sort] { cursor: pointer; }
.lead-table th[data-sort]:hover { color: var(--ink); }
.lead-table th[aria-sort] { color: var(--ink); }
.lead-table th[aria-sort="descending"]::after { content: " ↓"; }
.lead-table th[aria-sort="ascending"]::after { content: " ↑"; }
.lead-table td {
  padding: .8rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  vertical-align: top;
}
.lead-table tbody tr { cursor: pointer; transition: background var(--fast, .2s) linear; }
.lead-table tbody tr:hover { background: var(--paper-2); }
.lead-table tbody tr[aria-selected="true"] { background: var(--paper-3); }
.lead-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lead-table .pin { font-variant-numeric: tabular-nums; color: var(--ink); }
.lead-table .cut { color: var(--ink-4); }

.score-cell { display: flex; align-items: baseline; gap: .4rem; justify-content: flex-end; }
.score-cell b {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--ink);
}
.score-cell span { font-size: .6875rem; color: var(--ink-4); }

.chip {
  display: inline-block;
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border: 1px solid var(--rule-strong);
  color: var(--ink-3);
  white-space: nowrap;
}
.chip--pass { border-color: var(--olive); color: var(--olive); }
.chip--fail { border-color: var(--rule-strong); color: var(--ink-4); }
.chip--unknown { border-style: dashed; }

/* ---------------------------------------------------------- lead detail */
.detail { display: grid; gap: clamp(1.25rem, 2.5vw, 1.75rem); }
.detail__head { display: grid; gap: .4rem; }
.detail__addr { font-family: var(--serif); font-size: clamp(1.25rem, 2.4vw, 1.625rem); color: var(--ink); line-height: 1.2; }
.detail__meta { font-size: .8125rem; color: var(--ink-3); }

.breakdown { border-top: 1px solid var(--rule); }
.breakdown__row {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) 4.5rem;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.breakdown__row dt {
  font-size: .6875rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.breakdown__row dd { margin: 0; font-size: .8125rem; color: var(--ink-2); line-height: 1.6; }
.breakdown__pts {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .8125rem;
  color: var(--ink);
  white-space: nowrap;
}
.breakdown__row[data-unknown="true"] .breakdown__pts { color: var(--ink-4); }

.meter { height: 2px; background: var(--rule); position: relative; margin-top: .5rem; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--olive); }
.meter > u { position: absolute; inset: 0 auto 0 0; background: var(--rule-strong); text-decoration: none; }

.play-box { border: 1px solid var(--rule-strong); padding: clamp(1rem, 2vw, 1.4rem); background: var(--paper-2); }
.play-box h4 {
  font-size: .6875rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .5rem;
  font-weight: 500;
}
.play-box p { margin: 0; font-size: .875rem; line-height: 1.7; color: var(--ink-2); }
.play-box strong { color: var(--ink); font-weight: 500; }
.play-box + .play-box { margin-top: .85rem; }

.gap-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
/* These chips carry whole sentences ("Improvement-to-land ratio: 9.4% vs 35%
   max"), so they must wrap. Only the short table chips stay on one line. */
.gap-list .chip { white-space: normal; max-width: 100%; }

.empty {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  text-align: center;
  color: var(--ink-3);
  font-size: .875rem;
}

/* ------------------------------------------------------------ districts */
.district-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.district-table th {
  text-align: left;
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  padding: .6rem .5rem;
  border-bottom: 1px solid var(--rule-strong);
}
.district-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--rule); }
.district-table input[type="number"] {
  width: 6.5rem;
  font-family: inherit;
  font-size: .8125rem;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--ink);
  padding: .25rem 0;
}
.district-table input[type="number"]:hover { border-bottom-color: var(--rule-strong); }
.district-table input[type="number"]:focus { outline: none; border-bottom-color: var(--ink); }
.district-table td:first-child { color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .breakdown__row { grid-template-columns: minmax(0, 1fr) 4rem; }
  .breakdown__row dd { grid-column: 1 / -1; }
  .result-bar > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .result-bar > div:last-child { border-bottom: 0; }
  .map-row { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .tool-btn { width: 100%; text-align: center; }
}

/* The tool needs the page to start sooner than a marketing header does. */
.page-head--short { min-height: 0; padding-block: clamp(7rem, 15vw, 11rem) clamp(3rem, 6vw, 5rem); }

/* Confidence bands. Colour carries meaning here, so each is also labelled. */
.chip--clear    { border-color: var(--olive); color: var(--olive); }
.chip--possible { border-color: var(--stone); color: var(--ink-2); }
.chip--unlikely { border-color: var(--rule-strong); color: var(--ink-4); }
.lead-table .yrs { font-family: var(--serif); font-size: 1.125rem; font-weight: 400; color: var(--ink); }
.lead-table .approx { color: var(--ink-4); font-size: .8125rem; margin-right: .15rem; }
