/* Municipal Code Generator: the browser shell. Plain CSS, no framework. */
:root {
  --ink: #1b1f24;
  --muted: #57606a;
  --rule: #d8dee4;
  --paper: #ffffff;
  --wash: #f5f6f4;
  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --warn-bg: #fff8e1;
  --warn-rule: #e0b100;
  --error: #a4262c;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }      /* a `display` rule below must not show what the script hid */
html { font-size: 17px; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--wash); line-height: 1.5; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

header.site { background: var(--paper); border-bottom: 1px solid var(--rule); padding: 28px 0 22px; }
.kicker { margin: 0 0 4px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.15; }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 62ch; }
.preview-flag { margin: 14px 0 0; padding: 8px 12px; background: var(--warn-bg); border-left: 4px solid var(--warn-rule); font-size: 0.9rem; }

main { padding-top: 22px; padding-bottom: 48px; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 14px; padding: 0; font-size: 0.92rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps span { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper); font-size: 0.85em; }
.steps li.current { color: var(--ink); font-weight: 600; }
.steps li.current span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.done span { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.engine { margin: 0 0 14px; font-size: 0.88rem; color: var(--muted); }
.engine.ready { color: #1a6b3c; }
.engine.failed { color: var(--error); }

.screen { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 24px 26px 26px; }
h2 { margin: 0 0 14px; font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
h3 { margin: 28px 0 6px; font-size: 1.05rem; }
.intro { margin: 0 0 16px; max-width: 68ch; }
.hint, small { color: var(--muted); font-size: 0.88rem; }
.hint { margin: 2px 0 8px; max-width: 68ch; }

.field { margin: 0 0 18px; }
.field.narrow input { max-width: 14em; }
label, legend { font-weight: 600; }
label small { font-weight: 400; }
input[type="text"], input[type="number"], select {
  width: 100%; font: inherit; color: inherit; padding: 9px 11px; border: 1px solid #8c959f; border-radius: 6px; background: var(--paper);
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, .preview:focus-visible {
  outline: 3px solid #8ab4e8; outline-offset: 2px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }

.combo { position: relative; }
.results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--paper); border: 1px solid #8c959f; border-radius: 6px; max-height: 320px; overflow-y: auto; box-shadow: 0 8px 24px rgba(27, 31, 36, 0.12); }
.results li { padding: 7px 10px; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.results li[aria-selected="true"], .results li:hover { background: #e7eef6; }
.results .meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.results .none { color: var(--muted); cursor: default; }

.picked { margin: 0 0 18px; padding: 12px 14px; background: var(--wash); border-left: 4px solid var(--accent); }
.picked strong { font-family: var(--serif); font-size: 1.15rem; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 8px 0; }
.check input { margin-top: 5px; width: 1.05em; height: 1.05em; flex: none; }

.question { padding: 16px 0; border-top: 1px solid var(--rule); }
.question:first-child { border-top: 0; padding-top: 4px; }
.question .ask { font-weight: 600; margin: 0 0 4px; max-width: 68ch; }
.question .help { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; max-width: 68ch; }
.question .note { margin: 8px 0 0; padding: 7px 11px; background: var(--warn-bg); border-left: 4px solid var(--warn-rule); font-size: 0.92rem; max-width: 68ch; }
.question .tag { display: inline-block; margin-left: 6px; padding: 0 7px; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.75rem; font-weight: 400; color: var(--muted); vertical-align: 1px; }
.yn { display: flex; gap: 22px; }
.yn label, .pick label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.pick label { padding: 3px 0; }
.sub { margin-left: 22px; }

.guard { margin: 0 0 14px; padding: 8px 12px; background: #eef4fa; border-left: 4px solid var(--accent); font-size: 0.92rem; }
.always { margin: 8px 0 0; padding: 10px 0; border-top: 1px solid var(--rule); }
.always summary, #checksBox summary { cursor: pointer; font-weight: 600; }
.always ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }

.numbers { display: grid; grid-template-columns: 1fr; gap: 0; }
.number { display: grid; grid-template-columns: 1fr 9em; gap: 4px 18px; align-items: center; padding: 9px 0; border-top: 1px solid var(--rule); }
.number label { font-weight: 400; }
.number .limit { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.85rem; }
.number .unit { color: var(--muted); font-size: 0.85rem; }
.number input.bad { border-color: var(--error); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }
button { font: inherit; padding: 10px 16px; border-radius: 6px; border: 1px solid #8c959f; background: var(--paper); color: var(--ink); cursor: pointer; }
button:hover { background: var(--wash); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: #173b5c; }
button:disabled { opacity: 0.55; cursor: progress; }
.error { margin: 14px 0 0; padding: 9px 12px; color: var(--error); background: #fdf3f4; border-left: 4px solid var(--error); }
.error ul { margin: 0; padding-left: 18px; }

.handoff { margin: 6px 0 0; padding-left: 22px; max-width: 72ch; }
.handoff li { margin: 0 0 8px; }
.handoff b { font-weight: 600; }
#checksBox { margin: 16px 0 0; padding: 10px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.checks { margin: 8px 0 0; padding-left: 20px; font-size: 0.9rem; color: var(--muted); max-width: 72ch; }
.checks li { margin: 0 0 6px; }

.preview { margin-top: 8px; padding: 26px 30px; border: 1px solid var(--rule); border-radius: 6px; background: #fffefb;
  font-family: var(--serif); font-size: 1rem; line-height: 1.5; max-height: 640px; overflow-y: auto; }
.preview p { margin: 0 0 0.75em; }
.preview .note { font-style: italic; color: #4a5560; }
.preview .head { font-weight: 700; margin-top: 1.2em; }
.preview .title { font-weight: 700; text-align: center; }
.preview .item { margin-left: 2em; text-indent: -1.4em; }

footer.site { border-top: 1px solid var(--rule); background: var(--paper); padding: 18px 0 28px; color: var(--muted); font-size: 0.85rem; }
footer.site p { margin: 0; max-width: 76ch; }

@media (max-width: 640px) {
  html { font-size: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .screen { padding: 18px 16px 20px; }
  .number { grid-template-columns: 1fr 7em; }
  .preview { padding: 16px; }
}
@media print {
  header.site, footer.site, .steps, .engine, .actions, .downloads, #checksBox { display: none; }
  .screen { border: 0; padding: 0; }
  .preview { max-height: none; border: 0; padding: 0; }
}
