/* Two questions, one file. Colour is meaning: allowed, withheld, structure. */

:root {
  color-scheme: light dark;

  /* Development Seed's palette: #D04200 orange, #444 charcoal, white.
     The orange carries meaning here rather than decoration -- it is the colour
     of a withheld byte, which is what this page is about -- and it doubles as
     the interactive accent, where the shape (a filled control) keeps the two
     readings apart. */
  --brand: #d04200;
  --brand-ink: #ffffff;

  --paper: #f4f4f4;
  --surface: #ffffff;
  --sunk: #ebebeb;
  --rule: #d8d8d8;
  --ink: #1a1a1a;
  --ink-2: #555555;
  --ink-3: #888888;

  /* Allowed, withheld, and the structure a reader needs to find either. */
  --allow: #1d6996;
  --allow-soft: #d7e7f3;
  --deny: #d04200;
  --deny-soft: #ffe0cf;
  --brand-soft: #ffe8dc;
  --struct: #6a5a8c;
  --struct-soft: #e5dfef;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 6px;
}

/* No published dark palette to copy, so this is built to the same relations:
   the orange lightened enough to hold contrast on a dark ground, and the
   neutrals left neutral so the only colour on the page is carrying
   information. */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ff6b2c;
    --brand-ink: #0d0d0d;

    --paper: #0d0d0d;
    --surface: #171717;
    --sunk: #050505;
    --rule: #2b2b2b;
    --ink: #f2f2f2;
    --ink-2: #a8a8a8;
    --ink-3: #767676;

    --allow: #62a8da;
    --allow-soft: #17374d;
    --deny: #ff6b2c;
    --deny-soft: #42200c;
    --brand-soft: #3a1a08;
    --struct: #a697ce;
    --struct-soft: #302945;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

code { font-family: var(--mono); font-size: 0.875em; overflow-wrap: anywhere; }
a { color: var(--brand); }

/* ---- chrome ------------------------------------------------------------ */

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.brand b { font-size: 15px; }
.brand span { display: block; font-size: 12px; color: var(--ink-3); }
.top-end { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-3); }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tabs button {
  display: block;
  text-align: left;
  padding: 12px 20px;
  border: 0;
  border-top: 2px solid transparent;
  background: var(--sunk);
  color: var(--ink-3);
  font: inherit;
  cursor: pointer;
}

.tabs button b { display: block; font-size: 14px; }
.tabs button span { font-size: 12px; line-height: 1.35; display: block; }
.tabs button[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  border-top-color: var(--brand);
}

.file-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.file-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.file-custom { display: flex; gap: 6px; flex: 1 1 320px; min-width: 240px; }
.file-custom input { flex: 1 1 auto; min-width: 0; }
.file-state { flex-basis: 100%; font-size: 12px; font-family: var(--mono); color: var(--ink-3); }
.file-state.bad { color: var(--deny); }
.file-state.busy::after { content: ' …'; }

main { padding: 20px; max-width: 1200px; margin: 0 auto; }

footer {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 12px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
}

/* ---- cards ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.card h2 { margin: 0; font-size: 14px; }
.sub { margin: 4px 0 14px; font-size: 13px; color: var(--ink-2); max-width: 70ch; }
.note { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.45; max-width: 80ch; }

.lbl {
  margin: 14px 0 6px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---- controls ---------------------------------------------------------- */

input[type="text"], select, textarea {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 9px;
}

textarea { width: 100%; resize: vertical; line-height: 1.45; }
input[type="text"]:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

button { font-family: var(--sans); }

.go {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 4px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.go:disabled { opacity: 0.5; cursor: default; }
.run { padding: 9px 20px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.tight { gap: 4px; }

.chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.chip b { font-size: 12px; font-weight: 600; }
.chip span { font-size: 11px; color: var(--ink-3); }
.chip.on { border-color: var(--brand); background: var(--brand-soft, var(--sunk)); box-shadow: inset 0 0 0 1px var(--brand); }
.chip.on span { color: var(--ink-2); }

span.chip { cursor: default; font-family: var(--mono); }
.chip.gone {
  text-decoration: line-through;
  color: var(--ink-3);
  border-style: dashed;
  background: transparent;
}

.toggle { display: flex; flex-wrap: wrap; gap: 6px; }

.toggle button {
  flex: 1 1 200px;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.toggle button span { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); }
.toggle button[aria-checked="true"] {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.diag { margin-top: 8px; font-size: 12px; font-family: var(--mono); color: var(--ink-3); min-height: 1em; }
.diag.ok { color: var(--allow); }
.diag.bad { color: var(--deny); }
.diag.bad { color: var(--deny); }

.runbar { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.busy { font-size: 12px; color: var(--ink-3); font-family: var(--mono); }

.range-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range-row label { font-size: 12px; color: var(--ink-3); }
.range-row input { flex: 1 1 260px; min-width: 0; }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

/* ---- facts ------------------------------------------------------------- */

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

.fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 130px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--sunk);
}

.fact-label { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.fact-value { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.fact-note { font-size: 11px; color: var(--ink-3); }

/* ---- feature 1 --------------------------------------------------------- */

.suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }

.suggestion {
  display: block;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.suggestion b { display: block; font-size: 12px; }
.suggestion code { display: block; margin: 3px 0 5px; font-size: 11px; color: var(--brand); }
.suggestion span { display: block; font-size: 11px; line-height: 1.4; color: var(--ink-3); }
.suggestion:hover { border-color: var(--brand); }

.regions { max-height: 340px; overflow-y: auto; border: 1px solid var(--rule); border-radius: 4px; }

.region {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) 4.5rem;
  gap: 8px;
  padding: 5px 9px;
  font-size: 12px;
  border-bottom: 1px solid var(--rule);
}

.region:last-child { border-bottom: 0; }
.region-kind { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.region-what { font-family: var(--mono); overflow-wrap: anywhere; }
.region-bytes { font-family: var(--mono); color: var(--ink-3); text-align: right; }
.region.column_chunk .region-kind, .region.tile .region-kind { color: var(--allow); }
.region.metadata .region-kind { color: var(--struct); }
.region.unmapped .region-kind { color: var(--deny); }

.ruler-bar {
  position: relative;
  height: 34px;
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.ruler-region { position: absolute; top: 0; bottom: 0; background: var(--allow-soft); }
.ruler-region.metadata { background: var(--struct-soft); }
.ruler-region.unmapped { background: var(--deny-soft); }
.ruler-ask { position: absolute; top: 0; bottom: 0; border: 2px solid var(--ink); border-radius: 2px; }

.map-wrap { margin-top: 12px; }
#inspect-map { width: 100%; max-width: 320px; height: auto; border: 1px solid var(--rule); border-radius: 4px; }

.raw { margin-top: 12px; }
.raw summary { font-size: 12px; color: var(--ink-3); cursor: pointer; }
.raw pre {
  max-height: 260px;
  overflow: auto;
  font-size: 11px;
  font-family: var(--mono);
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px;
}

.layout { border: 1px solid var(--rule); border-radius: 4px; max-height: 300px; overflow-y: auto; }

.layout-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--rule);
}

.layout-row:last-child { border-bottom: 0; }
.layout-name { font-family: var(--mono); }
.layout-note { color: var(--ink-3); font-size: 11px; text-align: right; }

/* ---- feature 2 --------------------------------------------------------- */

.result-table { border-collapse: collapse; width: 100%; font-size: 12px; font-family: var(--mono); }
.result-table th, .result-table td { text-align: left; padding: 4px 9px; border-bottom: 1px solid var(--rule); }
.result-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.result-image { max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; image-rendering: pixelated; }

@media (max-width: 860px) {
  .split, .two-up { grid-template-columns: minmax(0, 1fr); }
  .tabs { grid-template-columns: minmax(0, 1fr); }
  main, footer, .top, .file-bar { padding-left: 16px; padding-right: 16px; }
}

/* ---- the map view ------------------------------------------------------ */

.map-host {
  position: relative;
  height: 520px;
  margin-top: 10px;
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  /* deck.gl's controller wants the wheel and the drag. */
  touch-action: none;
  cursor: grab;
}

.map-host:active { cursor: grabbing; }
.map-host canvas { border-radius: 3px; }

@media (max-width: 860px) { .map-host { height: 380px; } }

.jump-label {
  align-self: center;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 2px;
}
