/* ============ AI Protections Map — design system ============ */
:root {
  --fed: #1e40af; --fed-soft: #dbeafe;
  --state: #7c3aed; --state-soft: #ede9fe;
  --county: #0d9488; --county-soft: #ccfbf1;
  --city: #16a34a; --city-soft: #dcfce7;
  --dc: #f97316; --dc-soft: #ffedd5;
  --bio: #dc2626; --bio-soft: #fee2e2;
  --img: #ec4899; --img-soft: #fce7f3;
  --emp: #ca8a04; --emp-soft: #fef9c3;
  --priv: #0891b2; --priv-soft: #cffafe;
  --pub: #4f46e5; --pub-soft: #e0e7ff;
  --ink: #0f172a; --ink-2: #334155; --ink-3: #64748b;
  --bg: #f8fafc; --card: #ffffff; --line: #e2e8f0;
  --accent: #2563eb;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.07);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.1), 0 16px 48px rgba(15,23,42,.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', var(--font);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 16px; line-height: 1.55;
}
img, svg { vertical-align: middle; }
a { color: var(--accent); }
h1,h2,h3,h4 { font-family: var(--display); line-height: 1.2; }
.skip-link { position: absolute; left: -9999px; top: 0; background:#fff; padding:.6rem 1rem; z-index: 3000; border-radius: 0 0 8px 0;}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- top nav ---- */
.topnav {
  position: sticky; top: 0; z-index: 1200; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem; background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
.brand-mark { font-size: 1.5rem; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }
.brand-name em { font-style: normal; background: linear-gradient(90deg,var(--fed),var(--state),var(--img)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .92rem;
  padding: .45rem .7rem; border-radius: 999px; transition: background .15s;
}
.nav-links a:hover { background: var(--bg); }
.nav-links a.active { background: var(--ink); color: #fff; }
.nav-links a.nav-cta { background: var(--accent); color: #fff; }
.nav-toggle { display: none; margin-left: auto; font-size: 1.4rem; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .2rem .6rem; cursor: pointer; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; padding: .8rem; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .7rem 1rem; font-size: 1rem; }
}

/* ---- hero ---- */
.hero {
  position: relative; padding: 2.6rem 1.2rem 1.6rem; text-align: center;
  background:
    radial-gradient(1100px 420px at 15% -10%, rgba(124,58,237,.14), transparent 60%),
    radial-gradient(900px 420px at 85% -10%, rgba(37,99,235,.16), transparent 60%),
    radial-gradient(700px 380px at 50% 110%, rgba(236,72,153,.10), transparent 60%);
}
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.7rem); margin: 0 0 .4rem; letter-spacing: -.02em; }
.hero p.sub { color: var(--ink-2); max-width: 640px; margin: 0 auto 1.4rem; font-size: 1.05rem; }
.search-wrap { max-width: 720px; margin: 0 auto; position: relative; }
.search-bar {
  display: flex; gap: .5rem; background: #fff; padding: .5rem; border-radius: 999px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.search-bar input {
  flex: 1; border: none; font-size: 1.05rem; padding: .65rem 1rem; border-radius: 999px;
  font-family: var(--font); min-width: 0;
}
.search-bar input:focus { outline: none; background: var(--bg); }
.search-bar button {
  background: linear-gradient(135deg, var(--accent), var(--state)); color: #fff; border: none;
  padding: .65rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: 1rem; cursor: pointer;
  font-family: var(--font); white-space: nowrap;
}
.search-bar button:hover { filter: brightness(1.08); }
.search-bar button:disabled { opacity: .6; cursor: wait; }
.search-hint { font-size: .85rem; color: var(--ink-3); margin-top: .55rem; }
.demo-chips { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: center; margin-top: .8rem; }
.demo-chips button {
  border: 1px solid var(--line); background: rgba(255,255,255,.8); padding: .35rem .8rem; border-radius: 999px;
  font-size: .83rem; cursor: pointer; color: var(--ink-2); font-family: var(--font);
}
.demo-chips button:hover { border-color: var(--accent); color: var(--accent); }
.search-status { margin-top: .8rem; font-size: .92rem; min-height: 1.4em; }
.search-status.err { color: #b91c1c; font-weight: 500; }

/* ---- topic chips ---- */
.topic-chip-bar { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: center; padding: .9rem 1.2rem 0; max-width: 1100px; margin: 0 auto; }
.tchip {
  display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .34rem .8rem;
  font-size: .84rem; font-weight: 500; cursor: pointer; border: 1.5px solid transparent; font-family: var(--font);
  transition: transform .12s;
}
.tchip:hover { transform: translateY(-1px); }
.tchip[aria-pressed="true"] { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }

/* ---- map layout ---- */
.map-shell {
  display: grid; grid-template-columns: minmax(0,1fr) 420px; gap: 1rem;
  max-width: 1380px; margin: 1.1rem auto 2rem; padding: 0 1.2rem; align-items: start;
}
@media (max-width: 980px) { .map-shell { grid-template-columns: 1fr; } }
.map-card { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: #fff; }
#map { height: 560px; width: 100%; }
@media (max-width: 980px) { #map { height: 420px; } }
.map-note { padding: .5rem .9rem; font-size: .8rem; color: var(--ink-3); border-top: 1px solid var(--line); background: #fff; }

/* layer toggle panel */
.layer-panel {
  position: absolute; top: 12px; right: 12px; z-index: 800; background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .6rem .7rem;
  max-width: 210px; font-size: .82rem; border: 1px solid var(--line);
}
.layer-panel h4 { margin: 0 0 .35rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.layer-panel label { display: flex; align-items: center; gap: .45rem; padding: .17rem 0; cursor: pointer; }
.layer-panel .swatch { width: 13px; height: 13px; border-radius: 4px; flex: none; }

/* legend */
.legend-card {
  margin-top: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.2rem;
}
.legend-card h3 { margin: 0 0 .6rem; font-size: 1rem; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: .4rem .9rem; font-size: .86rem; }
.legend-item { display: flex; align-items: center; gap: .5rem; color: var(--ink-2); }
.legend-item .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.legend-strength { display:flex; gap:.9rem; flex-wrap:wrap; margin-top:.8rem; padding-top:.8rem; border-top:1px dashed var(--line); font-size:.84rem;}
.legend-strength span { display:inline-flex; align-items:center; gap:.4rem; }
.dot { width:11px; height:11px; border-radius:50%; display:inline-block; }

/* ---- result panel ---- */
.result-panel { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.panel-card {
  background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem;
}
.panel-card h2 { margin: 0 0 .2rem; font-size: 1.22rem; }
.panel-card .addr { color: var(--ink-3); font-size: .9rem; margin: 0 0 .8rem; }
.juris-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; }
.jbadge {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600;
  padding: .28rem .7rem; border-radius: 999px; color: #fff;
}
.level-section { margin-top: 1rem; }
.level-section > h3 {
  display: flex; align-items: center; gap: .5rem; font-size: .95rem; margin: 0 0 .5rem;
  padding-bottom: .35rem; border-bottom: 2px solid var(--line);
}
.level-section > h3 .count { margin-left: auto; font-size: .78rem; color: var(--ink-3); font-weight: 500; }
.level-dot { width: 12px; height: 12px; border-radius: 4px; }
.level-empty { font-size: .86rem; color: var(--ink-3); font-style: italic; margin: .2rem 0 .4rem; }

/* protection cards */
.pcard {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem .85rem; margin-bottom: .55rem;
  background: #fff; transition: box-shadow .15s;
}
.pcard:hover { box-shadow: var(--shadow); }
.pcard-head { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; }
.pcard-head h4 { margin: 0; font-size: .95rem; font-family: var(--font); font-weight: 600; flex: 1; }
.pcard-head h4 a { color: var(--ink); text-decoration: none; }
.pcard-head h4 a:hover { color: var(--accent); }
.pcard-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .45rem; }
.badge {
  font-size: .7rem; font-weight: 600; padding: .16rem .55rem; border-radius: 999px; letter-spacing: .015em;
  display: inline-flex; align-items: center; gap: .25rem;
}
.badge.outline { background: transparent; border: 1px solid currentColor; }
.pcard-summary { font-size: .87rem; color: var(--ink-2); margin: .5rem 0 0; }
.pcard-foot { display: flex; gap: .8rem; align-items: center; margin-top: .55rem; font-size: .78rem; color: var(--ink-3); flex-wrap: wrap; }
.pcard-foot a { font-weight: 500; }
.stale-warn { color: #b45309; font-weight: 600; }

/* detail drawers */
details.cite-drawer { margin-top: .55rem; border-top: 1px dashed var(--line); padding-top: .5rem; }
details.cite-drawer summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--accent); }
details.cite-drawer[open] summary { margin-bottom: .45rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .25rem .8rem; font-size: .84rem; }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink); }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: .35rem; } }

/* ---- generic page shells ---- */
.page { max-width: 1180px; margin: 0 auto; padding: 1.8rem 1.2rem 3rem; }
.page-head { margin-bottom: 1.4rem; }
.page-head h1 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin: 0 0 .3rem; letter-spacing: -.02em; }
.page-head p { color: var(--ink-2); max-width: 760px; margin: 0; }
.grad-band { height: 5px; border-radius: 99px; background: linear-gradient(90deg, var(--fed), var(--state), var(--county), var(--city), var(--dc), var(--img)); margin-bottom: 1.1rem; max-width: 260px; }

/* directory filters */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow); margin-bottom: 1.1rem;
}
.filter-bar select, .filter-bar input[type="search"] {
  font-family: var(--font); font-size: .88rem; padding: .45rem .6rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); max-width: 100%;
}
.filter-bar input[type="search"] { flex: 1; min-width: 160px; }
.view-toggle { margin-left: auto; display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle button { border: none; background: #fff; padding: .42rem .8rem; cursor: pointer; font-family: var(--font); font-size: .85rem; }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.result-count { font-size: .85rem; color: var(--ink-3); margin: 0 0 .8rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: .9rem; }
@media (max-width: 700px) { .card-grid { grid-template-columns: 1fr; } }

/* table view */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.dir-table { border-collapse: collapse; width: 100%; font-size: .86rem; min-width: 760px; }
.dir-table th, .dir-table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.dir-table th { background: var(--bg); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); position: sticky; top: 0; }
.dir-table tbody tr:hover { background: #f1f5f9; }

/* timeline */
.timeline { position: relative; margin: 1rem 0 0; padding-left: 1.4rem; border-left: 3px solid var(--line); }
.tl-item { position: relative; margin-bottom: 1.1rem; }
.tl-item::before { content: ""; position: absolute; left: -1.78rem; top: .35rem; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl-date { font-size: .78rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

/* topic hubs */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: .9rem; }
.hub-card {
  border-radius: var(--radius); padding: 1.1rem 1.2rem; border: 1px solid var(--line); background: #fff;
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; transition: transform .15s, box-shadow .15s;
  border-top: 4px solid var(--accent);
}
.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.hub-card .hub-icon { font-size: 1.6rem; }
.hub-card h3 { margin: .4rem 0 .25rem; font-size: 1.05rem; }
.hub-card p { margin: 0; font-size: .85rem; color: var(--ink-2); }
.hub-card .hub-count { display: inline-block; margin-top: .6rem; font-size: .76rem; font-weight: 700; color: var(--ink-3); }

/* stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: .8rem; margin: 1.2rem 0; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow);
}
.stat .num { font-family: var(--display); font-size: 1.7rem; font-weight: 700; }
.stat .lbl { font-size: .8rem; color: var(--ink-3); }

/* forms */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; max-width: 720px; }
.form-card label { display: block; font-weight: 600; font-size: .9rem; margin: .9rem 0 .3rem; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; font-family: var(--font); font-size: .95rem; padding: .6rem .7rem; border-radius: 8px; border: 1px solid var(--line);
}
.form-card textarea { min-height: 120px; resize: vertical; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none; padding: .65rem 1.3rem;
  border-radius: 999px; font-weight: 600; font-size: .95rem; cursor: pointer; font-family: var(--font); text-decoration: none;
}
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.07); }

/* callouts */
.callout { border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .9rem; margin: 1rem 0; border: 1px solid; }
.callout.info { background: var(--fed-soft); border-color: #bfdbfe; color: #1e3a8a; }
.callout.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.callout.danger { background: var(--bio-soft); border-color: #fecaca; color: #991b1b; }
.callout.ok { background: var(--city-soft); border-color: #bbf7d0; color: #166534; }

/* empty states */
.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--ink-3); }
.empty-state .glyph { font-size: 2.4rem; display: block; margin-bottom: .5rem; }
.empty-state h3 { color: var(--ink-2); margin: .2rem 0 .35rem; }
.empty-state p { max-width: 460px; margin: 0 auto; font-size: .9rem; }

/* footer */
.site-footer { background: var(--ink); color: #cbd5e1; padding: 2.2rem 1.4rem 1.2rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.6rem; max-width: 1180px; margin: 0 auto; }
.site-footer h3 { color: #fff; font-size: 1rem; margin: 0 0 .5rem; }
.site-footer a { color: #93c5fd; display: block; text-decoration: none; padding: .15rem 0; font-size: .9rem; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .tagline { font-size: .88rem; margin: .2rem 0; }
.site-footer .freshness { font-size: .78rem; color: #94a3b8; }
.site-footer .privacy-note { font-size: .76rem; color: #94a3b8; margin-top: .6rem; }
.legal-disclaimer {
  max-width: 1180px; margin: 1.6rem auto 0; border-top: 1px solid #334155; padding-top: 1rem;
  font-size: .8rem; color: #94a3b8;
}
.legal-disclaimer strong { color: #e2e8f0; }

/* leaflet popup font */
.leaflet-popup-content { font-family: var(--font); font-size: .86rem; }
.leaflet-popup-content h4 { margin: 0 0 .3rem; font-family: var(--display); }
.leaflet-container { font-family: var(--font); }

/* compare mode */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .compare-grid { grid-template-columns: 1fr; } }

/* admin */
.queue-item { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .2rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.queue-item .flag { font-size: 1.1rem; }

/* watch button */
.watch-btn {
  font-family: var(--font); font-size: .78rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: .2rem .6rem; border-radius: 999px; transition: all .15s;
}
.watch-btn:hover { border-color: #f59e0b; color: #b45309; }
.watch-btn[aria-pressed="true"] { background: #fef3c7; border-color: #f59e0b; color: #92400e; }

/* misc */
.muted { color: var(--ink-3); font-size: .85rem; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.spinner { display:inline-block; width: 16px; height: 16px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
