/* ============================================================================
 * parcel-card.css: the Survey Number card on the live map (1AC-782)
 * ---------------------------------------------------------------------------
 * The card, and the screens behind it, ported from the survey-layer-map
 * prototype onto the live Leaflet map. Self-contained on purpose: it carries
 * the handful of 1acre tokens it needs rather than pulling in the whole
 * tokens.css, so index.html gains one stylesheet and nothing else on the page
 * changes. Every value below is a token, never a raw hex in a rule.
 * ========================================================================= */
.pcard-scope {
  --acre-yellow-125:#FFFBEA; --acre-yellow-500:#FFEFAC;
  --acre-yellow-800:#FFE57A; --acre-yellow-1000:#FFDE59;
  --acre-neutral-0:#FFFFFF;  --acre-neutral-2-5:#F9F9F9; --acre-neutral-5:#F3F3F3;
  --acre-neutral-25:#EEEEEE; --acre-neutral-50:#E8E8E8;  --acre-neutral-100:#DBDBDB;
  --acre-neutral-200:#C3C3C3; --acre-neutral-400:#929292;
  --acre-neutral-500:#727272; --acre-neutral-600:#626262; --acre-neutral-800:#313131;
  --acre-warning:#E69500;

  --fg-1:var(--acre-neutral-800); --fg-2:var(--acre-neutral-500); --fg-3:var(--acre-neutral-400);
  --bg-1:var(--acre-neutral-0);   --bg-2:var(--acre-neutral-2-5);  --bg-3:var(--acre-neutral-5);
  --border-1:var(--acre-neutral-50); --border-strong:var(--acre-neutral-200);

  --font-ui:"Inter",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-heading:"Poppins","Inter",ui-sans-serif,system-ui,sans-serif;
  --h9-size:20px; --h10-size:18px;
  --l1-size:16px; --l2-size:14px; --l2-lh:20px; --l3-size:12px; --l3-lh:16px; --l4-size:10px;

  --radius-sm:8px; --radius-md:12px; --radius-lg:16px; --radius-pill:44px; --radius-full:999px;
  --shadow-3:0 0 1px 0 rgba(33,37,41,0.32), 0 12px 28px 0 rgba(33,37,41,0.24);
  --ease-standard:cubic-bezier(0.2,0.0,0,1.0); --dur-base:200ms; --dur-slow:320ms;
}

/* Leaflet owns z-index up to 1000 for its panes and controls; the card sits
   above them and stops its own clicks reaching the map underneath. */
#parcelCard {
  position: absolute; z-index: 1200;
  top: 12px; right: 12px; width: 360px;
  max-width: calc(100vw - 24px); max-height: calc(100vh - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  font-family: var(--font-ui); color: var(--fg-1);
  background: var(--bg-1); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
#parcelCard[hidden] { display: none; }
.pcard { padding: 18px 18px 16px; }

.pcard-x {
  flex: none; width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  color: var(--fg-3); background: var(--bg-2); border: 0;
  border-radius: var(--radius-full); cursor: pointer;
}
.pcard-x:hover { color: var(--fg-1); }
.pcard-x svg { width: 14px; height: 14px; }
.pcard .lu { width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sd-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}
.sd-h { margin: 0; font-size: var(--l2-size); line-height: var(--l2-lh); font-weight: 600; }

/* The answer to the question the page asks, so it takes the hero. Label and
   number highlighted together as one block: the note-box recipe, yellow-125
   field on a yellow-500 hairline, because this is a highlight on white and not
   a button. */
.sd-no {
  display: flex; align-items: baseline; gap: 8px; padding: 13px 14px;
  background: var(--acre-yellow-125); border: 1px solid var(--acre-yellow-500);
  border-radius: var(--radius-md);
}
.sd-no-k { font-family: var(--font-heading); font-weight: 500; font-size: var(--h9-size); line-height: 1.1; }
.sd-no-v { font-family: var(--font-heading); font-weight: 700; font-size: var(--h9-size); line-height: 1.1; }
.sd-no--row { justify-content: space-between; }
.sd-no--row .sd-no-k { font-size: var(--l2-size); font-weight: 500; color: var(--fg-2); }
.sd-no--row .sd-no-v { font-size: var(--l1-size); }
/* A parcel the cadastral did not number: state that, rather than labelling an
   absent value, and drop to neutral so it does not read as a failed load. */
.sd-no--none { background: var(--bg-2); border-color: var(--border-1); }
.sd-no--none .sd-no-k { font-size: var(--h10-size); color: var(--fg-2); }

.sd-rows { margin: 4px 0 0; }
.sd-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 11px 2px; border-bottom: 1px solid var(--border-1);
}
.sd-row dt { flex: none; font-size: var(--l2-size); color: var(--fg-2); }
.sd-row dd { margin: 0; min-width: 0; text-align: right;
  font-size: var(--l2-size); line-height: var(--l2-lh); font-weight: 600; }

.sd-note { margin: 14px 0 10px; text-align: center;
  font-size: var(--l3-size); line-height: var(--l3-lh); color: var(--fg-2); }

.sd-acts { display: flex; flex-direction: column; gap: 9px; }
.sd-primary, .sd-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px;
  font-family: var(--font-ui); font-size: var(--l2-size); font-weight: 600; color: var(--fg-1);
  border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--dur-base) var(--ease-standard);
}
.sd-primary { background: var(--acre-yellow-800); border: 1px solid var(--acre-yellow-800); }
.sd-primary:hover { background: var(--acre-yellow-1000); border-color: var(--acre-yellow-1000); }
.sd-primary[disabled] { opacity: 0.45; cursor: not-allowed; }
.sd-secondary { background: var(--bg-1); border: 1px solid var(--border-strong); }
.sd-secondary:hover { background: var(--bg-2); }

.sd-coin { display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--l2-size); font-weight: 700; }
.sd-coin i { width: 15px; height: 15px; border-radius: var(--radius-full);
  background: var(--acre-yellow-1000); border: 1px solid var(--acre-warning); }

.sd-more-h { margin: 18px 0 2px; font-size: var(--l2-size); font-weight: 600; }
.sd-more { display: flex; flex-direction: column; }
/* Rows, not buttons: each leads to its own screen, which is what the chevron
   says and why they are banded by hairlines rather than boxed. */
.sd-more-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 13px 2px; text-align: left;
  font-family: var(--font-ui); font-size: var(--l2-size); font-weight: 500; color: var(--fg-1);
  background: none; border: 0; border-bottom: 1px solid var(--border-1); cursor: pointer;
  transition: background var(--dur-base) var(--ease-standard);
}
.sd-more-row:last-child { border-bottom: 0; }
.sd-more-row:hover { background: var(--bg-2); }
.sd-more-row > span { flex: 1 1 auto; min-width: 0; }
.sd-more-row .lu { flex: none; color: var(--fg-2); }
.sd-more-row .lu:last-child { width: 15px; height: 15px; color: var(--fg-3); }

/* ── the screens behind the card ─────────────────────────────────────────── */
.sc-nav { display: grid; grid-template-columns: 26px 1fr 26px; align-items: center;
  gap: 8px; margin-bottom: 16px; }
.sc-back { width: 26px; height: 26px; padding: 0; display: grid; place-items: center;
  color: var(--fg-1); background: none; border: 0; border-radius: var(--radius-full); cursor: pointer; }
.sc-back:hover { background: var(--bg-2); }
.sc-title { margin: 0; text-align: center;
  font-size: var(--l2-size); line-height: var(--l2-lh); font-weight: 600; }

/* ── Measure ─────────────────────────────────────────────────────────────── */
.ms-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0 4px; }
.ms-fig { display: flex; flex-direction: column; gap: 3px; padding: 12px 13px;
  background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--radius-sm); }
.ms-k { display: flex; align-items: center; gap: 6px;
  font-size: var(--l4-size); font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--fg-3); }
.ms-k .lu { width: 13px; height: 13px; }
.ms-fig b { font-family: var(--font-heading); font-weight: 600;
  font-size: var(--h10-size); line-height: 1.2; }
.ms-sub { font-size: var(--l3-size); color: var(--fg-2); }
/* Side lengths, drawn on the map itself the way a surveyor writes them. */
.ms-dim {
  font-family: var(--font-ui); font-size: 11px; font-weight: 600; color: var(--acre-neutral-800);
  white-space: nowrap; text-shadow:
    0 0 4px #FFF, 0 0 4px #FFF, 0 0 4px #FFF, 0 0 4px #FFF;
}

/* ── Land Details ────────────────────────────────────────────────────────── */
.ld-h { margin: 16px 0 8px; font-size: var(--l2-size); font-weight: 600; }
.ld-opts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 4px; }
.ld-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  font-size: var(--l2-size); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-standard); }
.ld-opt.is-on { border-color: var(--fg-1); }
.ld-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ld-dot { flex: none; width: 16px; height: 16px; border-radius: var(--radius-full);
  border: 1.5px solid var(--acre-neutral-200); }
.ld-opt.is-on .ld-dot { border-color: var(--fg-1); border-width: 5px; }

/* ── mobile: the card becomes a bottom sheet ─────────────────────────────── */
@media (max-width: 900px) {
  #parcelCard {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none;
    height: 54vh; max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transition: height var(--dur-slow) var(--ease-standard);
  }
  #parcelCard.is-full { height: 92vh; }
  .sheet-grab { display: block; position: sticky; top: 0; z-index: 3;
    padding: 9px 0 5px; background: var(--bg-1);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: grab; touch-action: none; }
  .sheet-grab::before { content: ""; display: block; width: 38px; height: 4px;
    margin: 0 auto; background: var(--acre-neutral-100); border-radius: var(--radius-full); }
  .pcard { padding-top: 4px; }
}
.sheet-grab { display: none; }
@media (prefers-reduced-motion: reduce) { #parcelCard { transition: none; } }

/* ── Survey Number Report ────────────────────────────────────────────────── */
.rp-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.rp-badge {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--acre-yellow-125); border: 1px solid var(--acre-yellow-500);
  border-radius: var(--radius-sm);
}
.rp-headtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-h { font-family: var(--font-heading); font-weight: 600; font-size: var(--h10-size); line-height: 1.15; }
.rp-sub { font-size: var(--l3-size); line-height: var(--l3-lh); color: var(--fg-2); }
/* A still picture of a fixed extent, drawn from the geometry the API returned -
   not a second slippy map inside a card that scrolls. */
.rp-map {
  position: relative; height: 210px; margin-bottom: 14px;
  background: var(--bg-3); border: 1px solid var(--border-1);
  border-radius: var(--radius-md); overflow: hidden;
}
.rp-skel {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 9px; font-size: var(--l3-size); color: var(--fg-2); background: var(--bg-3);
}
.rp-skel span {
  width: 13px; height: 13px; border-radius: var(--radius-full);
  border: 2px solid var(--acre-yellow-500); border-top-color: var(--acre-neutral-400);
  animation: rp-spin 700ms linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }
.rp-num {
  font-family: var(--font-ui); font-size: 9px; font-weight: 600; fill: var(--fg-1);
  text-anchor: middle; paint-order: stroke; stroke: var(--bg-1); stroke-width: 3px;
}

/* ── Export KML ──────────────────────────────────────────────────────────── */
.kx-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; font-size: var(--l2-size); color: var(--fg-2);
}
.kx-row b { font-weight: 600; color: var(--fg-1); }
.kx-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  background: var(--acre-neutral-100); border-radius: var(--radius-full); cursor: pointer;
}
.kx-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px;
  background: var(--bg-1); border: 2px solid var(--fg-1);
  border-radius: var(--radius-full); cursor: pointer;
}
.kx-slider::-moz-range-thumb {
  width: 17px; height: 17px; background: var(--bg-1); border: 2px solid var(--fg-1);
  border-radius: var(--radius-full); cursor: pointer;
}
/* Ticks sit at their true positions on the scale, so the reading and the handle
   cannot disagree. */
.kx-ticks { position: relative; height: 18px; margin: 7px 0 4px; }
.kx-ticks span {
  position: absolute; transform: translateX(-50%);
  font-size: var(--l4-size); color: var(--fg-3); white-space: nowrap;
}
.kx-ticks span:first-child { transform: none; }
.kx-ticks span:last-child { transform: translateX(-100%); }
.kx-h {
  margin: 16px 0 6px; font-size: var(--l4-size); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3);
}
.kx-inc {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  font-size: var(--l2-size); cursor: pointer;
}
.kx-inc > span { flex: 1 1 auto; }
.kx-inc input { width: 15px; height: 15px; accent-color: var(--fg-1); cursor: pointer; }
.kx-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px 0 12px; padding-top: 11px; border-top: 1px solid var(--border-1);
  font-size: var(--l3-size); color: var(--fg-2);
}
.kx-foot .sd-coin { font-size: var(--l3-size); }
