/* Build a map: the neighborhood picker. Loaded after site.css. */
.pk-label { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; display: block; }
.pk-h { font: 700 17px/1.3 var(--body); letter-spacing: 0; margin: 0 0 6px; }
.pk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pk-small { padding: 6px 12px; font-size: 14px; }

.pk-start { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: end; margin-bottom: 20px; }
.pk-startnote { margin: 0 0 6px; color: var(--muted); font-size: 15px; flex: 1 1 320px; max-width: 62ch; }

/* Headline numbers */
.pk-headline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.pk-tile { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.pk-tile.lead { background: var(--deep-2); border-color: var(--deep-2); color: #fff; }
.pk-tile .n { font: 500 clamp(28px, 3.4vw, 42px)/1 var(--serif); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pk-tile .l { font-size: 13.5px; line-height: 1.4; color: var(--muted); margin-top: 6px; }
.pk-tile.lead .l { color: #cfdcd5; }
.pk-tile .d { font: 650 13px var(--body); margin-top: 6px; }
.pk-tile .d.up { color: var(--clay); } .pk-tile .d.down { color: var(--accent); }
.pk-tile.lead .d.up { color: #ffc2a3; } .pk-tile.lead .d.down { color: var(--lime); }

.pk-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.pk-mapcol { min-width: 0; }
.pk-side { display: grid; gap: 16px; min-width: 0; }

/* School chips: the brush above the map and the assign buttons */
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chip { display: inline-flex; align-items: center; gap: 7px; font: 600 14px var(--body); color: var(--ink); background: var(--sheet);
  border: 1.5px solid var(--rule); border-radius: 999px; padding: 6px 12px 6px 9px; cursor: pointer; }
.pk-chip i { width: 12px; height: 12px; border-radius: 50%; background: var(--c, #999); flex: none; }
.pk-chip:hover { border-color: #8fa39a; }
.pk-chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--raise); }
.pk-chip.plain { padding-left: 12px; }
.pk-brush { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: end; justify-content: space-between; }
.pk-drag button { padding: 6px 12px; font-size: 14px; }
.pk-or { align-self: center; font-size: 13.5px; color: var(--muted); padding: 0 4px; }
.pk-mapcol > .card { margin-top: 16px; }

.pk-map { position: relative; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--map); }
.pk-map canvas { display: block; width: 100%; cursor: pointer; touch-action: pan-y; }
.pk-map canvas.zoomed { touch-action: none; }
.pk-map canvas.drag { cursor: grabbing; }
.pk-map canvas.boxing { cursor: crosshair; }
.pk-zoom { position: absolute; right: 10px; top: 10px; display: grid; gap: 4px; }
.pk-zoom button { width: 36px; height: 34px; font: 650 17px/1 var(--body); color: var(--ink); background: var(--sheet); border: 1px solid var(--edge); border-radius: 8px; cursor: pointer; }
.pk-zoom button:last-child { font-size: 12.5px; }
.pk-zoom button:hover { background: var(--raise); border-color: var(--ink); }
.pk-tip { position: absolute; pointer-events: none; background: var(--deep); color: #fff; font-size: 13px; line-height: 1.35; padding: 7px 10px; border-radius: 8px; max-width: 240px; z-index: 2; box-shadow: 0 4px 14px rgba(20, 41, 43, .25); }
.pk-tip b { display: block; font-size: 14px; }
.pk-hint { position: absolute; left: 10px; bottom: 8px; margin: 0; font-size: 12.5px; color: var(--muted); background: var(--hintbg); padding: 3px 8px; border-radius: 6px; }
.pk-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); margin-top: 10px; }
.pk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pk-legend i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); }
.pk-legend .ring i { background: none; border: 2px solid var(--ink); }
.pk-legend .dash i { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed var(--ink); background: none; }

/* Selected neighborhood */
.pk-pick input[type="search"] { width: 100%; padding: 9px 10px; font-size: 15.5px; }
.pk-empty { color: var(--muted); font-size: 14.5px; margin: 14px 0 0; }
.pk-namerow { margin: 16px 0 4px; flex-wrap: nowrap; align-items: start; }
.pk-name { font: 500 24px/1.15 var(--serif); letter-spacing: -.015em; margin: 0; }
.pk-clear { flex: none; font: 600 13px var(--body); color: var(--accent); background: none; border: 1px solid var(--rule); border-radius: 7px; padding: 4px 10px; cursor: pointer; }
.pk-clear:hover { border-color: var(--accent); }
.pk-picked { font-size: 13.5px; margin: 0 0 6px; }
.pk-meta { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.pk-where { list-style: none; margin: 0 0 14px; padding: 0; font-size: 14.5px; border-top: 1px solid var(--rule); }
.pk-where li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.pk-where li span:first-child { color: var(--muted); }
.pk-where li.mine { font-weight: 650; }
.pk-where b { display: inline-flex; align-items: center; gap: 7px; font-weight: inherit; }
.pk-where b i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.pk-assign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pk-assign button { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 2px 8px; align-items: center; text-align: left; font: 600 14px var(--body); color: var(--ink);
  background: var(--sheet); border: 1.5px solid var(--rule); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.pk-assign button i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.pk-assign button small { grid-column: 2; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.pk-assign button:hover { border-color: #8fa39a; }
.pk-assign button[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); background: var(--raise); }
.pk-parts { font-size: 13.5px; color: var(--muted); margin: 12px 0 0; }
.pk-parts label { display: flex; gap: 8px; align-items: baseline; color: var(--ink); margin-top: 4px; cursor: pointer; }
.pk-parts input { accent-color: var(--accent); }

/* School bars */
.pk-bar { padding: 10px 0 9px; border-top: 1px solid var(--rule); }
.pk-bar:first-child { border-top: 0; }
.pk-bar .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 14.5px; }
.pk-bar .top b { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.pk-bar .top b i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pk-bar .top span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-bar .top span.over { color: var(--clay); font-weight: 650; }
.pk-track { position: relative; height: 14px; background: var(--track); border-radius: 4px; margin: 6px 0 4px; overflow: hidden; }
.pk-track i { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 4px 0 0 4px; transition: width .25s; }
.pk-track::before, .pk-track::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 1; }
.pk-track::before { left: 64%; border-left: 2px dashed var(--ink); }
.pk-track::after { left: 80%; border-left: 2px solid var(--ink); }
.pk-bar small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.pk-bar small b.up { color: var(--clay); } .pk-bar small b.down { color: var(--accent); }
.pk-barkey { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
.pk-barkey span::before { content: ""; display: inline-block; height: 12px; margin-right: 6px; vertical-align: -2px; border-left: 2px dashed var(--ink); }
.pk-barkey span + span::before { border-left-style: solid; }

.pk-changes { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14.5px; }
.pk-changes li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--rule); }
.pk-changes li.none { display: block; color: var(--muted); }
.pk-changes small { grid-column: 1; color: var(--muted); font-size: 13px; }
.pk-changes button { grid-row: 1 / span 2; grid-column: 2; font: 600 13px var(--body); color: var(--accent); background: none; border: 1px solid var(--rule); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.pk-changes button:hover { border-color: var(--accent); }
.pk-changes .to { font-weight: 650; }
.pk-share .actions { margin-top: 12px; }
.pk-saveform { display: flex; gap: 8px; margin-top: 10px; }
.pk-saveform input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 15px; color: inherit; background: var(--sheet); border: 1px solid var(--edge); border-radius: 8px; padding: 7px 10px; }
.pk-saveform .btn { flex: none; }
.pk-saves .small { margin: 8px 0 0; }
.pk-saved { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14.5px; }
.pk-saved li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rule); }
.pk-saved li.none { display: block; color: var(--muted); }
.pk-saved li.on b::after { content: " · open now"; font-weight: 400; color: var(--accent); font-size: 13px; }
.pk-saved small { display: block; color: var(--muted); font-size: 12.5px; }
.pk-saved button { font: 600 13px var(--body); color: var(--accent); background: none; border: 1px solid var(--rule); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.pk-saved button:hover { border-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Theme and window controls */
#tool { --map: #edf0e8; --raise: #fff; --edge: #b7c3b8; --hintbg: rgba(247, 246, 241, .88); --track: #e5e9df; padding-bottom: clamp(32px, 5vw, 56px); }
.pk-view { display: flex; gap: 6px; margin-left: auto; }
.pk-tool { font: 600 14px var(--body); color: var(--ink); background: var(--sheet); border: 1px solid var(--edge); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.pk-tool:hover { border-color: var(--ink); }

#tool[data-theme="dark"] {
  --paper: #0f1d1e; --sheet: #162a2b; --ink: #edf3ee; --muted: #a3b6ae; --rule: #2b4344; --accent: #8fd3bf; --accent-soft: #1f3d3b;
  --deep: #070f10; --deep-2: #d7e8b9; --clay: #ff9d76; --gold-soft: #3b3413; --map: #0d1a1a; --raise: #1f393a; --edge: #3a5757;
  --hintbg: rgba(13, 26, 26, .86); --track: #24403f;
  background: var(--paper); color: var(--ink); color-scheme: dark;
}
#tool[data-theme="dark"] .card { box-shadow: none; }
#tool[data-theme="dark"] .seg { background: #1b3233; }
#tool[data-theme="dark"] .seg button:hover { background: #264445; }
#tool[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--lime); color: #14292b; }
#tool[data-theme="dark"] .pk-tile.lead { background: var(--lime); border-color: var(--lime); color: #14292b; }
#tool[data-theme="dark"] .pk-tile.lead .l { color: #33484a; }
#tool[data-theme="dark"] .pk-tile.lead .d.up { color: #9a3d14; }
#tool[data-theme="dark"] .pk-tile.lead .d.down { color: #175248; }
#tool[data-theme="dark"] .btn { background: var(--lime); border-color: var(--lime); color: #14292b; box-shadow: none; }
#tool[data-theme="dark"] .btn.ghost { background: transparent; color: var(--lime); border-color: var(--edge); }
#tool[data-theme="dark"] .btn.ghost:hover { background: var(--raise); }
#tool[data-theme="dark"] .pk-saveform input { background: #0f1d1e; }
#tool[data-theme="dark"] input[type="search"] { background: #0f1d1e; color: var(--ink); border: 1px solid var(--edge); border-radius: 8px; }
#tool[data-theme="dark"] .tag.est { color: #f0dc8c; }
#tool[data-theme="dark"] .src a, #tool[data-theme="dark"] a { color: var(--accent); }
#tool[data-theme="dark"] .pk-tip { background: #f1f5f0; color: #14292b; }
#tool[data-theme="dark"] .fold summary { color: var(--ink); }

/* Full window: the tool covers the page and the map fills the height. */
html.pk-lock { overflow: hidden; }
#tool.pk-full { position: fixed; inset: 0; z-index: 9999; overflow-y: auto; padding: 14px 0 24px; margin: 0; background: var(--paper); }
#tool.pk-full > .wrap { max-width: none; padding-inline: 18px; }
#tool.pk-full .pk-start { margin-bottom: 12px; }
#tool.pk-full .pk-headline { margin-bottom: 12px; gap: 10px; }
@media (min-width: 981px) {
  #tool.pk-full .pk-tile { padding: 10px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; align-items: center; }
  #tool.pk-full .pk-tile .n { font-size: 28px; grid-row: 1 / span 2; }
  #tool.pk-full .pk-tile .l { margin: 0; font-size: 13px; }
  #tool.pk-full .pk-tile .d { margin: 0; grid-column: 2; }
  #tool.pk-full .pk-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 16px; }
  #tool.pk-full .pk-side { position: sticky; top: 0; max-height: calc(100vh - 28px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
  #tool.pk-full .pk-side .card { padding: 16px 18px; }
}

@media (max-width: 980px) {
  .pk-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* One column: the neighborhood panel follows the map, ahead of the change list. */
  .pk-mapcol, .pk-side { display: contents; }
  .pk-brush, .pk-mapcol > .card { margin: 0; }
  .pk-view { margin-left: 0; }
  .pk-legend { margin-top: -6px; }
  .pk-pick { order: 1; } .pk-schools { order: 2; } #pk-changes-card { order: 3; } .pk-saves { order: 4; } .pk-share { order: 5; }
  .pk-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .pk-tile { padding: 12px 14px; }
  .pk-assign { grid-template-columns: minmax(0, 1fr); }
  .pk-hint { display: none; }
}
@media print { .pk-brush, .pk-zoom, .pk-share, .pk-hint, .pk-view { display: none; } }
