/* Planreader. The visual idea is a town-planning sheet: pale survey paper, a
   site map of parcels, hatching that means something, and a title block. */

@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("/fonts/alegreya-sans-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url("/fonts/spline-sans-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url("/fonts/spline-sans-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #e4ede8;
  --sheet: #f5f9f6;
  --block: #dae5df;
  --ink: #14312e;
  --ink-2: #47635d;
  --rule: #a9bdb4;
  --street: #f5f9f6;
  --destroy: #c9371f;
  --destroy-deep: #8f2211;
  --destroy-tint: #f7dcd5;
  --create: #0d7a60;
  --create-deep: #095542;
  --create-tint: #cfeadf;
  --update: #d39a12;
  --update-deep: #7a5500;
  --update-tint: #f6e7bd;
  --move: #3f6fa8;
  --move-tint: #d6e3f2;
  --quiet: #c5d3cc;
  --promise-bg: #14312e;
  --promise-ink: #e9f2ed;
  --promise-link: #a8e3cf;
  --focus: #0a58ca;
  --gutter: 16px;
  --sans: "Alegreya Sans", "Gill Sans", "Trebuchet MS", sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #142825;
    --sheet: #1b3531;
    --block: #234440;
    --ink: #e3efea;
    --ink-2: #a6c0b8;
    --rule: #3f625b;
    --street: #142825;
    --destroy: #ee6a50;
    --destroy-deep: #ffb4a4;
    --destroy-tint: #4d221b;
    --create: #3cc39f;
    --create-deep: #93e6cd;
    --create-tint: #143f35;
    --update: #e3b23c;
    --update-deep: #f0cf7e;
    --update-tint: #43371a;
    --move: #7daae0;
    --move-tint: #1f3650;
    --quiet: #33524c;
    --promise-bg: #0d1d1b;
    --promise-ink: #e3efea;
    --promise-link: #93e6cd;
    --focus: #8cc4ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.1875rem/1.42 var(--sans);
  overflow-wrap: break-word;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: .16em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); font-size: .8em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -60px; background: var(--sheet); padding: 8px 12px; z-index: 20; }
.skip:focus { top: 8px; }

/* The promise */
.promise { background: var(--promise-bg); color: var(--promise-ink); }
.promise-inner { display: flex; flex-wrap: wrap; gap: 4px 28px; justify-content: space-between; align-items: baseline; padding: 10px var(--gutter); }
.promise-text { flex: 1 1 420px; }
.promise strong { font-weight: 800; }
.promise a { color: var(--promise-link); white-space: nowrap; }
.meter { font-style: italic; color: var(--promise-link); white-space: nowrap; }

.narrow-only { display: none; }

/* One wide container for the whole page. Text width comes from these columns. */
.promise-inner, .bar, .reader, .after, .foot { max-width: 1560px; margin-inline: auto; }
.prose { max-width: 1560px; margin-inline: auto; }

/* Bar */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding: 14px var(--gutter) 10px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.5rem; letter-spacing: -.005em; text-decoration: none; min-height: 44px; }
.mark-red { fill: var(--destroy); }
.mark-green { fill: var(--create); }
.bar nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
.bar nav a { display: inline-block; padding: 8px 0; }

/* Reader layout */
.reader { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; padding: 6px var(--gutter) 24px; }
.col-read > * + * { margin-top: 20px; }
.col-read > .col-map-slot:empty { display: none; }
h1 { font-weight: 500; font-size: 1.3125rem; line-height: 1.25; }
.lead { color: var(--ink-2); margin-top: 2px !important; }

/* Intake */
.intake { border: 2px dashed var(--ink); background: var(--sheet); }
.intake textarea {
  display: block; width: 100%; resize: vertical; min-height: 64px; border: 0; padding: 12px 14px 8px;
  background: transparent; color: var(--ink); font: 400 .875rem/1.45 var(--mono);
}
.intake textarea::placeholder { color: var(--ink-2); font: italic 400 1.1875rem/1.3 var(--sans); }
.intake textarea:focus-visible { outline-offset: -3px; }
.intake-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 0 12px 12px; }
.intake-hint { font-style: italic; color: var(--ink-2); }
.intake-status { font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border: 1.5px solid var(--ink); border-radius: 2px;
  background: transparent; color: var(--ink); font: 500 1.0625rem/1.15 var(--sans); cursor: pointer;
}
.btn:hover { background: var(--block); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-quiet { border-color: var(--rule); margin-top: 10px; }
.link { background: none; border: 0; padding: 4px 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: .16em; cursor: pointer; }

.problem { border-left: 6px solid var(--destroy); background: var(--destroy-tint); padding: 14px 16px; }
.problem[hidden] { display: none; }
.problem h2 { font-size: 1.3125rem; font-weight: 700; line-height: 1.25; }
.problem p { margin-top: 4px; }
.problem code { overflow-wrap: anywhere; }

/* Verdict */
.verdict { padding-top: 6px; }
.sample-flag { font-style: italic; color: var(--ink-2); margin-bottom: 4px; }
.verdict-headline { font-weight: 800; font-size: clamp(2.125rem, 1.5rem + 2.2vw, 3.25rem); line-height: 1.03; letter-spacing: -.015em; }
.verdict-headline:focus { outline: none; }
.verdict-detail { margin-top: 10px; font-size: 1.3125rem; line-height: 1.3; }
.warnings { margin-top: 12px; border-left: 6px solid var(--update); background: var(--update-tint); padding: 10px 14px; }
.warnings[hidden] { display: none; }
.warnings li + li { margin-top: 6px; }

/* Title block: the legend, the filter and the sheet details share one ruled box. */
.titleblock { border: 2px solid var(--ink); background: var(--sheet); }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.key {
  display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: transparent; color: inherit;
  padding: 8px 10px; text-align: left; font: inherit; cursor: pointer; min-height: 44px;
}
.key:hover { background: var(--block); }
.key[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.key[aria-pressed="true"] .key-label { color: var(--paper); }
.key[disabled] { cursor: default; opacity: .48; }
.key[disabled]:hover { background: transparent; }
.key .swatch { grid-row: 1 / span 2; width: 30px; height: 30px; }
.key-count { font-weight: 800; font-size: 1.375rem; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.key-label { font-size: 1rem; line-height: 1.1; color: var(--ink-2); }
.sheet { display: flex; flex-wrap: wrap; margin: 0; }
.sheet > div { flex: 1 1 auto; padding: 6px 10px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.sheet dt { font-size: .9375rem; font-style: italic; color: var(--ink-2); line-height: 1.15; }
.sheet dd { margin: 0; font-weight: 500; line-height: 1.2; }
.titleblock-actions { padding: 10px; }
.titleblock-actions .btn { width: 100%; justify-content: center; }

/* Hatching swatches. These match the fills drawn on the map in map.js. */
.swatch { display: inline-block; flex: none; width: 16px; height: 16px; border: 1px solid var(--ink); }
.a-destroy { background: repeating-linear-gradient(45deg, var(--destroy) 0 3px, var(--destroy-deep) 3px 4.5px); }
.a-replace { background: linear-gradient(to top right, var(--destroy) 0 49.5%, var(--ink) 49.5% 50.5%, var(--create) 50.5% 100%); }
.a-update { background-color: var(--update-tint); background-image: radial-gradient(var(--update-deep) 1.1px, transparent 1.3px); background-size: 5px 5px; }
.a-create { background: repeating-linear-gradient(0deg, var(--create-tint) 0 3px, var(--create) 3px 4px); }
.a-forget { background: repeating-linear-gradient(-45deg, var(--sheet) 0 3px, var(--destroy) 3px 4px); }
.a-import, .a-move { background: repeating-linear-gradient(90deg, var(--move-tint) 0 3px, var(--move) 3px 4px); }
.a-read { background: var(--sheet); border-style: dashed; }
.a-noop { background: var(--quiet); border-color: var(--rule); }

/* Sections */
.section { padding-top: 12px; }
.section h2, .after-section h2 { font-weight: 800; font-size: 1.625rem; line-height: 1.15; }
.section-note { color: var(--ink-2); margin-top: 2px; }
.section-note:empty { display: none; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 16px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; flex: 1 1 280px; justify-content: flex-end; }
.list-tools input[type="search"] {
  flex: 1 1 150px; min-width: 0; min-height: 44px; border: 1.5px solid var(--ink); border-radius: 2px; padding: 4px 10px; background: var(--sheet); color: var(--ink); font: inherit;
}
.check { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; cursor: pointer; }
.check input, .summary-controls input { accent-color: var(--ink); width: 18px; height: 18px; }

/* Rows */
.rows { margin-top: 10px; border-top: 2px solid var(--ink); }
.row { border-bottom: 1px solid var(--rule); }
.row-head {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 10px; width: 100%; padding: 10px 2px; border: 0;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-head:hover { background: var(--block); }
.row-head[aria-expanded="true"] { background: var(--sheet); }
.row.is-selected > .row-head { box-shadow: inset 4px 0 0 var(--ink); }
.row-head .swatch { margin-top: 5px; }
.addr { font-weight: 500; overflow-wrap: anywhere; line-height: 1.22; }
.addr-mod { font-weight: 400; color: var(--ink-2); }
.row-why { grid-column: 2; color: var(--ink-2); line-height: 1.28; }
.tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 1rem; font-style: italic; }
.tag-data { font-weight: 500; color: var(--destroy-deep); font-style: normal; }
.row-body { padding: 4px 2px 16px 28px; background: var(--sheet); }

/* Diff */
.diff { display: grid; gap: 10px; padding-top: 6px; }
.attr-name { font-weight: 500; overflow-wrap: anywhere; line-height: 1.2; }
.forces { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: .9375rem; font-weight: 500; font-style: italic; color: var(--destroy-deep); border: 1px solid var(--destroy); }
.val { display: grid; grid-template-columns: 1.3em minmax(0, 1fr); font: 400 .8125rem/1.45 var(--mono); padding: 1px 6px; }
.val-sign { user-select: none; }
.val-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22em; overflow-y: auto; }
.val-before { background: var(--destroy-tint); }
.val-after { background: var(--create-tint); }
.val-note { background: var(--block); font-family: var(--sans); font-size: 1rem; font-style: italic; }
.val mark { background: none; color: inherit; font-weight: 500; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.reveal { margin-left: 8px; font-style: normal; }
.fold { color: var(--ink-2); }
.fold summary { cursor: pointer; min-height: 32px; font-style: italic; }
.fold ul { display: grid; gap: 1px; }
.fold li { overflow-wrap: anywhere; }
.body-note { margin-top: 2px; }
.refers { margin-top: 12px; }
.refers h3 { font-size: 1.0625rem; font-weight: 700; }
.refers li { margin-top: 2px; display: flex; gap: 8px; align-items: baseline; }
.refers .link { text-align: left; overflow-wrap: anywhere; }
.refers .swatch { width: 11px; height: 11px; }
.no-detail { color: var(--ink-2); font-style: italic; padding-top: 6px; }

/* Modules */
.module { border-top: 2px solid var(--ink); margin-top: 8px; }
.module-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; width: 100%; padding: 10px 2px 8px; border: 0;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.module-head:hover { background: var(--block); }
.module-name { font-style: italic; font-weight: 500; font-size: 1.25rem; overflow-wrap: anywhere; line-height: 1.2; }
.module-count { color: var(--ink-2); font-size: 1rem; white-space: nowrap; }
.shape { grid-column: 1 / -1; display: flex; height: 9px; gap: 1px; }
.shape > span { display: block; min-width: 3px; height: 100%; border: 0; }
.module .rows { border-top: 1px solid var(--rule); margin-top: 0; }

.outputs li { padding: 6px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.outputs { margin-top: 8px; }
.plain-list { margin-top: 8px; }
.plain-list li { overflow-wrap: anywhere; padding: 3px 0; }

/* Summary */
.summary-box > summary { cursor: pointer; list-style-position: outside; margin-left: 1.1em; }
.summary-box > summary h2 { display: inline; }
.summary-controls { display: flex; gap: 16px; margin: 8px 0; }
.summary-controls label { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; cursor: pointer; }
.summary-text { width: 100%; resize: vertical; border: 1.5px solid var(--ink); border-radius: 2px; padding: 10px; background: var(--sheet); color: var(--ink); font: 400 .8125rem/1.45 var(--mono); }

/* The site map */
.sitemap { margin: 16px 0 0; }
.map-frame { position: relative; height: clamp(310px, 88vw, 520px); background: var(--street); border: 2px solid var(--ink); }
#map { display: block; width: 100%; height: 100%; touch-action: manipulation; cursor: crosshair; }
.map-tip { position: absolute; z-index: 3; pointer-events: none; max-width: 300px; padding: 5px 9px; background: var(--ink); color: var(--paper); font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }
.map-tip[hidden] { display: none; }
figcaption { margin-top: 8px; }
.map-selected { min-height: 2.6em; }
.map-selected strong { font-weight: 700; overflow-wrap: anywhere; }
.map-selected .link { margin-left: 2px; }
.map-note { color: var(--ink-2); font-size: 1.0625rem; line-height: 1.28; margin-top: 4px; }

.ad-slot { display: none; margin-top: 16px; }
.ad-slot.is-filled { display: block; }
.ad-frame { display: block; width: 100%; height: 1px; border: 0; }
/* Off-screen until filled so the frame can still load and measure itself. */
.ad-slot:not(.is-filled):has(.ad-frame) { display: block; position: absolute; left: -9999px; width: 330px; }

/* Explainers below the reader */
.after { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 24px var(--gutter) 36px; border-top: 2px solid var(--ink); }
.after-section > * + * { margin-top: 12px; }
.command { background: var(--sheet); border-left: 4px solid var(--ink); padding: 10px 12px; overflow-x: auto; }
.command code { font-size: .8125rem; line-height: 1.55; }
.policy { white-space: pre-wrap; overflow-wrap: anywhere; }
.steps { counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); }
.steps li::before { content: counter(step); font-weight: 800; }
.steps li > * { grid-column: 2; }
.steps li { display: block; padding-left: 26px; position: relative; }
.steps li::before { position: absolute; left: 0; }
.probe { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 8px; }
#probe-result { font-weight: 500; }

.foot { padding: 18px var(--gutter) 32px; border-top: 2px solid var(--ink); color: var(--ink-2); font-size: 1.0625rem; }
.foot p + p { margin-top: 4px; }

.dropzone { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--ink) 86%, transparent); color: var(--paper); font-size: 1.75rem; font-weight: 700; text-align: center; pointer-events: none; }
.dropzone[hidden] { display: none; }
.dropzone p { border: 3px dashed var(--paper); padding: 32px; }

/* Prose pages */
.prose { padding: 12px var(--gutter) 44px; }
.prose > * + * { margin-top: 12px; }
.prose h1 { font-weight: 800; font-size: clamp(2.125rem, 1.5rem + 2.2vw, 3.25rem); line-height: 1.05; letter-spacing: -.015em; }
.prose h2 { font-weight: 800; font-size: 1.625rem; line-height: 1.15; margin-top: 28px; }
.prose ul { list-style: disc; padding-left: 1.2em; }
.prose ul li + li { margin-top: 6px; }
.prose table { width: 100%; border-collapse: collapse; border: 2px solid var(--ink); background: var(--sheet); }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.prose th { font-weight: 700; border-bottom: 2px solid var(--ink); }
.prose .cta { display: inline-flex; text-decoration: none; }

@media (max-width: 699px) {
  .wide-only, .bar nav a.wide-only { display: none; }
  .narrow-only { display: inline; }
  .promise-inner { padding-block: 8px; }
  .bar { flex-wrap: nowrap; padding-block: 4px 0; }
  .wordmark { font-size: 1.3125rem; gap: 8px; }
  .bar nav { flex-wrap: nowrap; gap: 0 14px; white-space: nowrap; }
  .lead { display: none; }
  .map-selected > .swatch { display: none; }
  .col-read > * + * { margin-top: 12px; }
  .intake textarea { min-height: 46px; padding-block: 10px 2px; }
  .verdict { padding-top: 0; }
}

@media (pointer: coarse) {
  .intake-hint { display: none; }
}

@media (min-width: 700px) {
  :root { --gutter: 28px; }
  .titleblock-actions .btn { width: auto; }
  .after { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; }
  .prose { display: grid; grid-template-columns: minmax(0, 880px) minmax(0, 1fr); }
  .prose > * { grid-column: 1; }
}

@media (min-width: 1060px) {
  .reader { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); align-items: start; }
  .col-map { position: sticky; top: 14px; }
  .col-map-slot { display: none; }
  .sitemap { margin-top: 0; }
  .map-frame { height: calc(100vh - 254px); min-height: 440px; max-height: 860px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .swatch, .key .swatch { forced-color-adjust: none; }
}

@media print {
  .promise, .intake, .titleblock-actions, .foot, .after { display: none; }
  .col-map { position: static; }
}
