/* Shared styles for the /co lookup, its town and county pages, and the embedded lookup. */
:root {
  --blue: #0d3dbe;
  --ink: #1b2430;
  --muted: #5f6b7a;
  --line: #e3e7ec;
  --soft: #f5f7fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: #fff; color: var(--ink); font-family: 'Source Sans 3', Arial, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: var(--blue); }
.logo { display: inline-flex; align-items: center; min-height: 44px; }
.logo img { display: block; height: auto; }

/* Home: the logo and one search box, centered. */
.home { display: flex; flex-direction: column; align-items: center; padding: 24vh 16px 40px; }
.home .logo img { width: min(340px, 78vw); }
.home .logo { margin-bottom: 32px; }

.search { position: relative; width: 100%; max-width: 584px; }
.box { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 6px 0 16px; border: 1px solid #dfe1e5; border-radius: 24px; background: #fff; transition: box-shadow .15s; }
.box:hover, .box:focus-within { box-shadow: 0 1px 6px rgba(32,33,36,.24); border-color: transparent; }
.search.open .box { border-radius: 24px 24px 0 0; box-shadow: 0 1px 6px rgba(32,33,36,.24); border-color: transparent; }
.box svg { flex: none; color: #9aa0a6; }
.box input { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); }
.clear { display: none; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.clear:hover { background: var(--soft); }
.search.has-text .clear { display: block; }
.suggest { display: none; position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 0; padding: 4px 0 10px; list-style: none; background: #fff; border-radius: 0 0 24px 24px; box-shadow: 0 4px 6px rgba(32,33,36,.24); overflow: hidden; }
.suggest::before { content: ""; display: block; height: 1px; margin: 0 16px 4px; background: #e8eaed; }
.search.open .suggest { display: block; }
.suggest li { display: flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 10px 20px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: #eef0f3; }
.suggest .s-name { font-weight: 600; }
.suggest .s-meta { color: var(--muted); font-size: 14px; }
.buttons { display: flex; justify-content: center; margin-top: 28px; }
.btn { min-height: 44px; padding: 0 20px; border: 1px solid var(--soft); border-radius: 6px; background: var(--soft); color: #3c4043; font: inherit; font-size: 15px; cursor: pointer; }
.btn:hover { border-color: #dadce0; }
.btn:focus-visible, .clear:focus-visible, .choice:focus-visible, .logo:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Results: logo and box move to a top row, facts below. */
.top { display: none; align-items: center; gap: 28px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.top .logo img { width: 150px; }
.top .search { max-width: 640px; }
body.results .home { display: none; }
body.results .top { display: flex; }
.out { width: 80%; max-width: 1400px; margin: 0 auto; padding: 20px 0 64px; }
body:not(.results) .out { display: none; }

.msg { color: var(--muted); }
.town { margin: 4px 0 0; font-size: 26px; font-weight: 600; line-height: 1.25; }
.meta { margin: 2px 0 20px; color: var(--muted); font-size: 15px; }
.status { display: inline-block; margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.status.req { color: var(--blue); }
.status.no { color: #1e7a3c; }
.status.unsure { color: #9a6700; }
section.part { margin: 0 0 28px; padding-top: 18px; border-top: 1px solid var(--line); }
section.part:first-of-type { border-top: 0; padding-top: 0; }
/* CO and Smoke/CO alarm side by side on wide screens. */
.cols { display: grid; grid-template-columns: 1fr; }
@media (min-width: 901px) {
  .cols { grid-template-columns: 1fr 1fr; gap: 0 48px; }
  .cols section.part { border-top: 0; padding-top: 0; }
}
section.part h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.sub { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
dl.facts { margin: 10px 0 0; }
dl.facts dt { margin-top: 14px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dl.facts dd { margin: 4px 0 0; }
ul.items { margin: 0; padding-left: 20px; }
ul.items li { margin: 3px 0; }
.fees { width: 100%; border-collapse: collapse; font-size: 15px; }
.fees td { padding: 6px 0; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.fees td.amt { width: 1%; padding-left: 16px; font-weight: 600; white-space: nowrap; text-align: right; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 22px; text-decoration: none; font-weight: 600; }
.links a:hover { background: var(--soft); }
.authority { margin-top: 16px; }
.authority h3 { margin: 0; font-size: 16px; font-weight: 600; }
.fine { margin-top: 8px; color: var(--muted); font-size: 14px; }
.fine summary { min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }
.fine ol { margin: 0; padding-left: 20px; word-break: break-all; }
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice { display: flex; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; text-align: left; cursor: pointer; }
.choice:hover { background: var(--soft); }
.choice span { color: var(--muted); }
.add { display: inline-flex; align-items: center; min-height: 44px; margin-top: 10px; padding: 0 18px; border: 0; border-radius: 22px; background: var(--blue); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.add:hover { background: #0a2f94; }
.fix { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.fix:hover { color: var(--ink); }
.add:focus-visible, .fix:focus-visible, dialog button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 12px 40px rgba(16,24,40,.25); color: var(--ink); }
dialog::backdrop { background: rgba(16,24,40,.45); }
.dlg { padding: 22px 22px 18px; }
.dlg h2 { margin: 0; font-size: 20px; font-weight: 600; }
.dlg .sub { margin: 2px 0 14px; }
.dlg label { display: block; margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.dlg label small { font-weight: 400; color: var(--muted); }
.dlg input:not([type=file]), .dlg textarea, .dlg select { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid #cfd6de; border-radius: 10px; font: inherit; font-weight: 400; color: var(--ink); background: #fff; }
.dlg input[type=file] { display: block; margin-top: 6px; font: inherit; font-weight: 400; max-width: 100%; }
.dlg textarea { min-height: 90px; resize: vertical; }
.dlg [hidden] { display: none; }
.dlg .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.dlg .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.dlg .formstatus { min-height: 22px; margin: 12px 0 0; font-size: 14px; }
.dlg .formstatus.error { color: #b42318; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.dlg .actions button { min-height: 44px; padding: 0 18px; border-radius: 22px; font: inherit; font-weight: 600; cursor: pointer; }
.dlg .send { border: 0; background: var(--blue); color: #fff; }
.dlg .send:disabled { opacity: .6; cursor: default; }
.dlg .cancel { border: 1px solid var(--line); background: #fff; color: var(--ink); }
@media (max-width: 480px) { .dlg .two { grid-template-columns: 1fr; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 901px) { .top { padding-left: max(24px, calc((100% - min(80%, 1400px)) / 2)); } }
@media (max-width: 900px) { .out { width: auto; padding: 20px 24px 64px; } }
@media (max-width: 640px) {
  .home { padding-top: 18vh; }
  .top { flex-direction: column; align-items: center; gap: 10px; padding: 12px 16px; }
  .top .logo img { width: 130px; }
  .out { padding: 16px 16px 48px; }
  .town { font-size: 23px; }
}

/* Town and county pages: the results layout is always on. */
.crumbs { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span { margin: 0 6px; }

/* Share, client checklist and votes: one quiet row of small buttons. */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 22px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.chip:hover { background: var(--soft); }
.chip .ic { flex: none; color: var(--muted); }
.chip.icon { width: 44px; padding: 0; justify-content: center; }
.chip:focus-visible, .vote:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.chip[hidden] { display: none; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 18px; border-radius: 22px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 6px 20px rgba(16,24,40,.25); }
.toast[hidden] { display: none; }

/* Helpful votes, Reddit-style, next to the town name. Buttons look small but keep a 44px tap area. */
.head { display: flex; align-items: flex-start; gap: 14px; }
.votes { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 34px; margin-top: 6px; padding: 0 4px; border-radius: 17px; background: #eef0f3; }
.vote { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.vote::before { content: ""; position: absolute; inset: -8px; }
.vote .ic { width: 18px; height: 18px; }
.vote:hover { background: #e0e4ea; }
.vote.up:hover, .vote.up[aria-pressed="true"] { color: var(--blue); }
.vote.down:hover, .vote.down[aria-pressed="true"] { color: #6a3fc7; }
.vote[aria-pressed="true"] .ic path { fill: currentColor; }
.score { min-width: 14px; font-size: 14px; font-weight: 600; text-align: center; }

.nearby { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.nearby h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.townlist { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.townlist a { display: inline-flex; align-items: center; min-height: 36px; }
.townlist .off { color: var(--muted); }
.more { margin-top: 18px; font-size: 15px; }
/* Very small tip line at the very bottom. */
.tip { margin: 28px 0 0; font-size: 12px; }
.tip a { color: var(--muted); }
.tip a:hover { color: var(--ink); }

/* County pages and the "Browse by county" list on /co. */
.countylist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 16px; margin: 8px 0 0; padding: 0; list-style: none; }
.countylist a { display: inline-flex; align-items: center; min-height: 40px; }
.browse { width: 100%; max-width: 584px; margin-top: 44px; font-size: 15px; }
.browse summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); cursor: pointer; }
.browse-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; font-size: 14px; }
.browse-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

/* Embedded lookup (inside an iframe on someone else's site). */
body.embed { min-height: 0; }
body.embed .top { gap: 16px; padding: 10px 14px; }
body.embed .top .logo img { width: 110px; }
body.embed .out { width: auto; max-width: none; margin: 0; padding: 16px 16px 12px; }
body.embed .home { padding: 28px 14px 18px; }
body.embed .home .logo img { width: min(220px, 60vw); }
body.embed .home .logo { margin-bottom: 18px; }
.embed-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 10px 16px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.embed-foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
@media (max-width: 640px) { body.embed .top { flex-direction: row; } body.embed .top .logo img { width: 90px; } }

@media print { .top, .home, .links, .tools, .votes, .fix, .nearby, .more, .tip, .crumbs, .toast, .embed-foot { display: none !important; } .out { padding: 0; } }
