:root {
  color-scheme: light;      /* always light, whatever the system prefers */
  --bg: #fbfbf8;
  --fg: #1f1d1a;
  --muted: #6b6560;
  --line: #e4e3dc;
  --row: #ffffff;
  --row-alt: #f5f6f0;
  --accent: #65a30d;        /* lime green: buttons, links, markers */
  --accent-soft: #edf6dc;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 24px 48px;
  background: var(--bg); color: var(--fg);
  font: 15.5px/1.5 "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; padding: 28px 0 16px; }
.top h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.top h1 a.home { display: inline-block; color: var(--fg); padding: 2px 8px; margin-left: -8px; border-radius: 8px; transition: background 0.12s, color 0.12s; }
.top h1 a.home:hover, .top h1 a.home:focus-visible { background: var(--accent-soft); color: var(--accent); text-decoration: none; outline: none; }
.top h1 a.home:active { transform: translateY(1px); }
.tag { margin: 2px 0 0; color: var(--muted); }
.top .nav { display: flex; gap: 14px; align-items: flex-end; padding-bottom: 4px; }
.top .nav a { color: var(--muted); font-weight: 600; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.top .nav a.current { color: var(--fg); border-bottom-color: var(--accent); }
.top .nav a:hover { text-decoration: none; color: var(--fg); }
.stats { display: flex; gap: 24px; color: var(--muted); }
.stats .num { display: block; font-size: 26px; font-weight: 800; color: var(--fg); line-height: 1.1; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filters select[name=shelter] { flex: 1 1 220px; max-width: 360px; }
.filters input[type=search] { flex: 0 1 160px; }
.filters input, .filters select, .filters button {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--row); color: var(--fg);
}
.filters button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
/* "Has photo" / "Has description": checkboxes styled as toggle buttons. */
.filters .toggle { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--row); cursor: pointer; user-select: none; }
.filters .toggle input { margin: 0; accent-color: var(--accent); }
.filters .toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.filters .clear { margin-left: 4px; color: var(--muted); }
.filters .age-range { display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; border: 1px dashed var(--line); border-radius: 6px; }
.filters .age-range[hidden] { display: none; }
.filters .age-range input[type=number] { width: 64px; }
.filters .age-range .to { color: var(--muted); }

.filters details.multi { position: relative; flex: 1 1 200px; max-width: 320px; }
.filters details.multi summary {
  list-style: none; cursor: pointer; padding: 8px 30px 8px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filters details.multi summary::-webkit-details-marker { display: none; }
.filters details.multi summary::after { content: "\25BE"; position: absolute; right: 10px; top: 8px; color: var(--muted); }
.filters details.multi summary.set { border-color: var(--accent); font-weight: 600; }
.filters details.multi .menu {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: 320px; max-width: 90vw;
  background: var(--row); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); padding: 8px;
}
.filters details.multi .menu-filter { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.filters details.multi .menu-actions { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.filters details.multi .menu-actions button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.filters details.multi .menu-list { max-height: 320px; overflow-y: auto; }
.filters details.multi .menu-list label { display: block; padding: 3px 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters details.multi .menu-list label input { margin: 0 6px 0 0; vertical-align: -1px; }
.filters details.multi .menu-list label:hover { background: var(--accent-soft); }
.filters details.multi .menu-list label[hidden] { display: none; }

.count { color: var(--muted); margin: 14px 0 8px; }
.count .warn { display: block; color: var(--accent); margin-bottom: 4px; }

.table-wrap { overflow-x: auto; }
table.dogs { width: 100%; border-collapse: collapse; background: var(--row); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.dogs th, table.dogs td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
table.dogs th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--row-alt); }
table.dogs tbody tr:hover { background: var(--accent-soft); }
table.dogs tr:last-child td { border-bottom: 0; }
.photo-col { width: 112px; }
.photo-col img, .no-photo {
  display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--row-alt);
}
.no-photo { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
td.name a { font-weight: 700; font-size: 16px; color: var(--fg); }
.sub.links { text-transform: none; }
.sub.links a, td.name .sub.links a { color: var(--muted); font-size: 12px; font-weight: 400; }
.sub { display: block; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.num-col { text-align: right !important; }
.unknown { color: var(--muted); font-size: 12px; }
.floor { cursor: help; }
a.shelter, a.breed { color: var(--fg); }
.sub.phone { text-transform: none; }
.sub.phone a { color: var(--muted); }
.adopt-col { width: 1%; white-space: nowrap; }
a.adopt {
  display: inline-block; padding: 8px 14px; border-radius: 6px; font-weight: 600;
  background: var(--accent); color: #fff; text-decoration: none;
}
a.adopt:hover { filter: brightness(1.08); text-decoration: none; }

.pager { display: flex; gap: 20px; justify-content: center; align-items: center; margin: 20px 0; color: var(--muted); }
footer { margin-top: 36px; color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  body { padding: 0 12px 32px; }
  table.dogs th:nth-child(5), table.dogs td:nth-child(5),
  table.dogs th:nth-child(6), table.dogs td:nth-child(6),
  table.dogs th:nth-child(8), table.dogs td:nth-child(8) { display: none; }
}

/* photo lightbox */
a.photo { display: block; cursor: zoom-in; }
#lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.82); padding: 24px; cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: min(92vw, 1100px); cursor: default; text-align: center; }
#lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 10px; background: #000; }
#lightbox figcaption { color: #fff; margin-top: 10px; }
#lightbox figcaption strong { display: block; font-size: 18px; }
#lightbox figcaption span { color: rgba(255,255,255,0.7); font-size: 13px; }
#lightbox .close {
  position: absolute; top: 14px; right: 18px; font-size: 32px; line-height: 1;
  background: none; border: 0; color: #fff; cursor: pointer;
}
body.no-scroll { overflow: hidden; }

/* shelter map */
.map-controls { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 12px 0 8px; border-top: 1px solid var(--line); color: var(--muted); }
.map-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.map-controls input[name=zip] { font: inherit; padding: 6px 8px; width: 90px; border: 1px solid var(--line); border-radius: 6px; background: var(--row); color: var(--fg); }
.map-controls button { font: inherit; padding: 6px 10px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1.5px solid #fff; }
.legend .dot.has-dogs { background: var(--accent); }
.legend .dot.no-dogs { background: #9a938b; }
#map { position: relative; z-index: 0; /* own stacking context so Leaflet panes (z 400+) stay under page menus */ height: calc(100vh - 230px); min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: var(--row-alt); }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--row); color: var(--fg); box-shadow: 0 3px 14px rgba(0,0,0,0.3); }
.leaflet-popup-content { margin: 12px 16px; line-height: 1.4; }
.leaflet-popup-content strong { font-size: 15px; }
.leaflet-popup-content .sub { text-transform: none; }
.leaflet-popup-content .links { margin-top: 6px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { background: var(--row); color: var(--fg); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--row-alt); }
.leaflet-control-attribution { background: rgba(255,255,255,0.85); color: #333; }
.leaflet-control-attribution a { color: #0078a8; }

/* inline dog details */
tr.dog.open td { border-bottom: 0; background: var(--accent-soft); }
tr.details-row td { background: var(--row-alt); padding: 16px 18px 22px; }
.details { display: grid; grid-template-columns: minmax(220px, 420px) 1fr; gap: 24px; align-items: start; }
.details .gallery img.big, .details .gallery .no-photo.big {
  width: 100%; height: auto; max-height: 420px; object-fit: cover; border-radius: 10px; cursor: zoom-in;
}
.details .gallery .no-photo.big { height: 260px; cursor: default; }
.details .thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.details .thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: 0.7; border: 2px solid transparent; }
.details .thumbs img.on, .details .thumbs img:hover { opacity: 1; border-color: var(--accent); }
.details .text h2 { margin: 0 0 2px; font-size: 22px; }
.details .text .sub { margin: 0 0 12px; font-size: 13px; }
.details .desc { white-space: pre-line; line-height: 1.5; max-width: 70ch; }
.details .text p:last-child { margin-top: 16px; }
.muted { color: var(--muted); }
a.photo.no-photo { text-decoration: none; }
@media (max-width: 700px) { .details { grid-template-columns: 1fr; } }

/* home page */
.hero { padding: 22px 0 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick label { font-weight: 600; margin-right: 4px; }
.quick input, .quick select, .quick button { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--row); color: var(--fg); }
.quick input { width: 130px; }
.quick button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
.quick .all { margin-left: 6px; color: var(--muted); }
.section-title { margin: 26px 0 12px; font-size: 20px; font-weight: 800; }
.section-title .sub { display: inline; margin-left: 8px; font-size: 13px; font-weight: 400; text-transform: none; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { background: var(--row); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--row-alt); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { margin: 0; font-size: 21px; font-weight: 800; }
.card-body h3 a { color: var(--fg); }
.card-body .meta { margin: 0; color: var(--muted); font-size: 13px; }
.card-body .meta a { color: var(--muted); }
.card-body .blurb { margin: 8px 0 0; line-height: 1.5; flex: 1; }
.card-body .actions { margin: 14px 0 0; display: flex; gap: 12px; align-items: center; }
.card-body .actions .more { color: var(--muted); font-size: 13px; }

/* favorites */
button.fav {
  font: inherit; font-size: 20px; line-height: 1; width: 38px; height: 38px; margin-left: 6px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 50%; background: var(--row); color: var(--muted); cursor: pointer;
}
button.fav:hover { border-color: var(--accent); color: var(--accent); }
button.fav.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.card-body .actions button.fav { margin-left: 0; }
.nav .badge { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; vertical-align: 1px; }
.nav .badge[hidden] { display: none; }
.gone { display: block; color: var(--accent); font-size: 12px; font-weight: 600; }
tr.dog.gone-row td { opacity: 0.75; }
button.linklike { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* card grid everywhere */
.card-no-photo { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: 0; }
.card-photo { display: block; cursor: zoom-in; }
.card.expanded .card-photo { cursor: zoom-in; }
.card-body h3 .gone { display: inline; margin-left: 8px; font-size: 12px; }
.card.gone-card { opacity: 0.8; }
.card-body .meta a.breed { color: var(--muted); }
.card-body .blurb .thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.card-body .blurb .thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: 0.7; border: 2px solid transparent; }
.card-body .blurb .thumbs img.on, .card-body .blurb .thumbs img:hover { opacity: 1; border-color: var(--accent); }
.card-body .blurb .desc { white-space: pre-line; line-height: 1.5; }
.card-body .blurb .collapse { margin: 8px 0 0; font-size: 13px; }
.card-body .actions .sub.links { flex-basis: 100%; margin-top: 2px; }
.card-body .actions { flex-wrap: wrap; }

/* cards / table switch */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-right: 12px; vertical-align: middle; font-size: 13px; }
.view-toggle a { padding: 4px 10px; color: var(--muted); background: var(--row); }
.view-toggle a:hover { text-decoration: none; color: var(--fg); }
.view-toggle a.on { background: var(--accent); color: #fff; }
.section-title .view-toggle { font-weight: 400; margin-left: 10px; }


/* a dog's own page */
.crumbs { margin: 10px 0 14px; color: var(--muted); font-size: 14px; }
.profile { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.profile-gallery a.big-photo { display: block; cursor: zoom-in; }
.profile-gallery img.big { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--row-alt); }
.profile-gallery .no-photo.big { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 1px solid var(--line); background: var(--row-alt); color: var(--muted); }
.profile-gallery .thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.profile-gallery .thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: 0.7; border: 2px solid transparent; }
.profile-gallery .thumbs img.on, .profile-gallery .thumbs img:hover { opacity: 1; border-color: var(--accent); }
.profile-body h2 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.profile-body h2 .gone { display: inline; margin-left: 10px; font-size: 13px; vertical-align: middle; }
.profile-body .lead { margin: 4px 0 0; font-size: 17px; color: var(--muted); }
.profile-body .lead a { color: var(--muted); }
.profile-body .actions { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px; }
.profile-body .actions .share { color: var(--muted); font-size: 14px; }
.profile-body .facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; padding: 14px 16px; background: var(--row); border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; }
.profile-body .facts dt { color: var(--muted); }
.profile-body .facts dd { margin: 0; }
.profile-body .about { margin-top: 22px; }
.profile-body h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.profile-body .desc { white-space: pre-line; line-height: 1.6; }
.profile-body .muted { color: var(--muted); }
.shelter-box { margin-top: 22px; padding: 14px 16px; background: var(--row-alt); border: 1px solid var(--line); border-radius: 10px; }
.shelter-box h3 a { color: var(--fg); }
.shelter-box p { margin: 4px 0; }
.shelter-box .sub { font-size: 13px; color: var(--muted); }
.profile-missing { padding: 40px 0; }
@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; gap: 18px; }
  .profile-body h2 { font-size: 28px; }
}
