/* Gov Glance Local Data Explorer — visual language from govglanceapps/DESIGN_SYSTEM.md */

:root {
  --background-start: #f0f7ff;
  --background-end: #dbeafe;
  --foreground: #1e293b;
  --foreground-muted: #64748b;
  /* Logo cyan. Bright enough that it reads as the brand and far too bright to
     put text in: 1.9:1 on white. Used for tints and decorative accents only. */
  --accent-primary-rgb: 33, 206, 244;
  --accent-primary: rgb(var(--accent-primary-rgb));
  /* The same hue darkened to 5.2:1 on white, which is what anything a reader has
     to actually make out uses: link text, focus rings, and fills behind white
     text. Splitting the two keeps the brand colour without an unreadable UI. */
  --accent-deep: #0b768e;
  --accent-deeper: #075e73;
  --accent-tint: rgba(var(--accent-primary-rgb), 0.14);
  --card-bg: #ffffff;
  --card-shadow: rgba(37, 99, 235, 0.08);
  --card-hover-shadow: rgba(37, 99, 235, 0.15);
  --badge-bg: #10b981;
  --badge-text: #ffffff;

  --bg: var(--background-start);
  --panel: var(--card-bg);
  --panel-soft: #f8fafc;
  --ink: var(--foreground);
  --ink-soft: var(--foreground-muted);
  --ink-faint: #94a3b8;
  --line: rgba(37, 99, 235, 0.12);
  --line-soft: rgba(37, 99, 235, 0.07);
  --accent: var(--accent-deep);
  --accent-ink: #ffffff;
  --accent-soft: #e0f7fd;
  --good: #059669;
  --good-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --radius: 24px;
  --radius-sm: 12px;
  --shadow: 0 4px 20px var(--card-shadow);
  --shadow-hover: 0 12px 40px var(--card-hover-shadow);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--background-start) 0%, var(--background-end) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  letter-spacing: -0.025em;
  color: var(--ink);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- layout ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}
.brand:hover { text-decoration: none; color: var(--accent); }

nav.main { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav.main a {
  padding: 7px 13px;
  border-radius: 50px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
nav.main a:hover {
  background: var(--accent-tint);
  color: var(--accent);
  text-decoration: none;
}
nav.main a.active {
  background: linear-gradient(135deg, var(--accent-deeper) 0%, var(--accent-deep) 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(11, 118, 142, 0.28);
}
nav.main a.active:hover { color: #ffffff; }

.wrap {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px 90px;
  flex: 1;
  animation: fadeInUp 0.6s ease-out;
}

footer.site {
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.875rem;
  padding: 28px 20px 48px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
footer.site a:not(.donate-button) { font-weight: 500; }

/* ---------- support our mission ---------- */

/* A light blue pill with a red heart, per govglanceapps/DESIGN_SYSTEM.md. It is
   deliberately not the cyan accent or a solid red CTA: an ask for money should
   read as an invitation next to the archive, not compete with it. */
.donate-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 0 26px;
  text-align: center;
}
.donate-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: var(--foreground);
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.12);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.donate-button:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.2);
  text-decoration: none;
}
.heart-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: #ef4444;
}
.donate-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--foreground-muted);
  max-width: 46ch;
}

@media (max-width: 540px) {
  .donate-button { padding: 12px 24px; font-size: 0.95rem; }
  .donate-text { font-size: 0.85rem; }
}

/* ---------- panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.panel h2 { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; }
.panel h3 { margin: 0 0 10px; font-size: 0.95rem; font-weight: 600; }
.panel > p.sub { margin: 0 0 16px; color: var(--ink-soft); }

.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.page-head p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 70ch;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 0.8rem; color: var(--ink-faint); font-weight: 400; }

input, select, textarea, button {
  font: inherit;
  color: var(--ink);
}
input[type="text"], input[type="email"], input[type="search"], input[type="url"], input[type="password"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  background: #ffffff;
}
textarea { min-height: 96px; resize: vertical; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 200px; min-width: 0; }
/* Always wraps a single button. 150px keeps a column of buttons an even width;
   auto basis lets a longer label ("Who represents me") grow instead of clipping. */
.row > .field.narrow { flex: 0 0 auto; min-width: 150px; }

.btn {
  padding: 11px 20px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, var(--accent-deeper) 0%, var(--accent-deep) 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(11, 118, 142, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(11, 118, 142, 0.4);
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px var(--card-shadow);
}
.btn.secondary:hover {
  background: var(--panel-soft);
  box-shadow: 0 6px 18px var(--card-hover-shadow);
}
.btn.small { padding: 6px 12px; font-size: 0.85rem; font-weight: 500; }
.btn.link {
  background: none; border: none; color: var(--accent);
  padding: 0; font-size: 0.85rem; cursor: pointer;
  box-shadow: none;
}
.btn.link:hover { text-decoration: underline; transform: none; box-shadow: none; }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 22px;
}
.stat-n {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.stat-l {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  margin-top: 2px;
}

/* ---------- lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.list > li:first-child { border-top: none; }
.item-title { font-weight: 600; margin: 0 0 3px; }
.item-meta { font-size: 0.8rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.item-body { color: var(--ink-soft); font-size: 0.9rem; margin: 5px 0 0; }
.item-actions { margin-top: 7px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 0.85rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.card {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  width: 100%;
  font: inherit;
  box-shadow: 0 2px 10px var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 16px;
}
.card .name { font-weight: 600; display: block; color: var(--ink); }
.card .meta { font-size: 0.8rem; color: var(--ink-faint); margin-top: 3px; }

/* ---------- chips, tabs, badges ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.chip {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 50px;
  background: #ffffff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  cursor: pointer;
  box-shadow: 0 1px 4px var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.chip.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; flex-wrap: wrap; }
.tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge.critical { background: var(--bad-soft); color: var(--bad); }
.badge.serious { background: var(--warn-soft); color: var(--warn); }
.badge.moderate { background: var(--accent-soft); color: var(--accent); }
.badge.info { background: var(--line-soft); color: var(--ink-soft); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.approved, .badge.applied { background: var(--good-soft); color: var(--good); }
.badge.rejected { background: var(--bad-soft); color: var(--bad); }

/* ---------- notices ---------- */

.notice {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.notice.error { background: var(--bad-soft); border-color: rgba(185, 28, 28, 0.25); color: var(--bad); }
.notice.ok { background: var(--good-soft); border-color: rgba(5, 150, 105, 0.25); color: var(--good); }
.notice.warn { background: var(--warn-soft); border-color: rgba(180, 83, 9, 0.25); color: var(--warn); }

.muted { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 0.85rem; }
.spinner { color: var(--ink-faint); padding: 22px 0; }

.notes { margin: 10px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 0.9rem; }
.notes li { margin-bottom: 5px; }

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

.official {
  display: flex;
  gap: 14px;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
}
.official:first-child { border-top: none; }
.official img {
  width: 52px; height: 62px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--accent-soft);
  flex: none;
  box-shadow: 0 2px 8px var(--card-shadow);
}
.official .who { flex: 1; min-width: 0; }
.official .nm { font-weight: 700; font-size: 0.95rem; }
.official .of { color: var(--ink-soft); font-size: 0.875rem; }
.official .jd { color: var(--ink-soft); font-size: 0.875rem; margin-top: 5px; }
.official .kv { font-size: 0.85rem; color: var(--ink-soft); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 3px 14px; }

/* ---------- dialog ---------- */

dialog {
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  max-width: 620px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 60px -16px rgba(37, 99, 235, 0.28);
  font-family: var(--font-sans);
}
dialog::backdrop { background: rgba(30, 64, 175, 0.28); backdrop-filter: blur(2px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.dialog-head p { margin: 3px 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.dialog-body { padding: 18px 22px; max-height: 65vh; overflow: auto; display: flex; flex-direction: column; gap: 13px; }
.dialog-msg:not(:empty) { padding: 0 22px 4px; }
.dialog-msg .notice { margin-bottom: 10px; }
.dialog-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.dialog-foot .grow { margin-right: auto; font-size: 0.85rem; color: var(--ink-faint); }
.close-x {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: var(--ink-faint); cursor: pointer; margin-left: auto;
  border-radius: 8px;
  padding: 2px 6px;
}
.close-x:hover { color: var(--ink); background: var(--accent-soft); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.pager { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

@media (max-width: 1024px) {
  .page-head h1 { font-size: 2rem; }
}

@media (max-width: 620px) {
  .wrap { padding: 22px 14px 70px; }
  .topbar-inner { padding: 12px 14px; }
  nav.main { margin-left: 0; width: 100%; }
  .brand { font-size: 0.95rem; }
  .page-head h1 { font-size: 1.7rem; }
  .panel { padding: 18px 16px; border-radius: 18px; }
  .row > .field.narrow { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn:hover,
  .card:hover,
  .chip:hover,
  .donate-button:hover {
    transform: none;
  }
  .wrap { animation: none; }
}
