/* ─── Design tokens ─────────────────────────────────────── */
:root {
  --primary:       #1e40af;
  --primary-light: #dbeafe;
  --mla-accent:    #7c3aed;
  --accent:        #16a34a;
  --warning:       #d97706;
  --bg:            #ffffff;
  --bg-2:          #f8fafc;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --shadow:        0 1px 2px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.04);

  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-lg:   20px;
  --fs-xl:   24px;
  --fs-2xl:  32px;

  --radius:    8px;
  --radius-lg: 16px;
  --tap-min:   44px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ─── Focus visible ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Utilities ─────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════
   INDEX PAGE
═══════════════════════════════════════════════════════════ */

/* ─── Landing layout ────────────────────────────────────── */
.landing-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wordmark {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.wordmark-dot {
  color: var(--accent);
}

/* ─── Hero ──────────────────────────────────────────────── */
.hero {
  padding: 56px 24px 48px;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.hero-heading {
  font-size: clamp(var(--fs-xl), 5vw, var(--fs-2xl));
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-sub {
  font-size: var(--fs-base);
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 9999px;
  min-height: var(--tap-min);
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn-hero:hover {
  background: #1d3a9f;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-hero:active { transform: translateY(0); }

.trust-line {
  margin-top: 16px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ─── Value props ───────────────────────────────────────── */
.value-props {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 48px 24px;
}

.value-props-inner {
  max-width: 840px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 600px) {
  .value-props-inner {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

.prop-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prop-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

.prop-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.prop-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Landing footer ────────────────────────────────────── */
.landing-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.landing-footer strong { color: var(--text); }


/* ═══════════════════════════════════════════════════════════
   FINDER PAGE
═══════════════════════════════════════════════════════════ */

/* ─── Finder layout ─────────────────────────────────────── */
.finder-root {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Top bar */
.top-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  position: sticky;
  top: 0;
}

.top-bar-wordmark {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.top-bar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: var(--tap-min); height: var(--tap-min);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: none;
  transition: background 0.12s;
}

.btn-icon:hover { background: var(--bg-2); }

/* Search bar strip */
.search-strip {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 90;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-family: inherit;
  font-size: var(--fs-sm);
  background: var(--bg-2);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--bg);
}

.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
  display: none;
}

.search-dropdown.open { display: block; }

.search-result-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  min-height: var(--tap-min);
  line-height: 1.3;
  font-family: inherit;
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item[aria-selected="true"] { background: var(--primary-light); }

/* ─── Map + panel wrapper ───────────────────────────────── */
.map-panel-wrap {
  flex: 1 1 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

#map {
  flex: 1 1 0;
  min-height: 0;
}

/* ─── Side panel (desktop) ──────────────────────────────── */
.side-panel {
  display: none;
  width: 320px;
  flex: 0 0 320px;
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 16px;
}

.side-panel-hint {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.side-panel-hint svg {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.35;
}

@media (min-width: 769px) {
  .side-panel { display: flex; flex-direction: column; }
}

/* ─── FAB / Find My Reps button ─────────────────────────── */
.fab-find {
  position: absolute;
  bottom: 20px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0 20px;
  height: var(--tap-min);
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(30,64,175,0.35);
  z-index: 50;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.fab-find:hover {
  background: #1d3a9f;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,64,175,0.4);
}

.fab-find:active { transform: translateY(0); }

/* ─── Spinner overlay ───────────────────────────────────── */
.spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 300;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.spinner-overlay.hidden { display: none; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Error banner ──────────────────────────────────────── */
.error-banner {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  background: #fef2f2;
  border-bottom: 1px solid #fca5a5;
  padding: 10px 16px;
  font-size: var(--fs-sm);
  color: #991b1b;
  z-index: 400;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.error-banner.visible { display: flex; }

.btn-retry {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  padding: 4px 0;
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
}


/* ═══════════════════════════════════════════════════════════
   REP CARDS
═══════════════════════════════════════════════════════════ */

.cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rep-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  /* party color stripe as left border — set via JS */
  border-left: 4px solid var(--primary);
}

/* Badge row */
.card-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-badge--mp  { background: var(--primary-light); color: var(--primary); }
.card-badge--mla { background: #ede9fe; color: var(--mla-accent); }

.card-constituency {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

/* Rep identity row */
.card-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-photo {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  flex: 0 0 80px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.card-photo-placeholder {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--border);
  flex: 0 0 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}

.card-info {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.card-party {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* Contact row */
.card-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--primary);
  padding: 4px 10px;
  border: 1px solid var(--primary-light);
  border-radius: 9999px;
  min-height: var(--tap-min);
  text-decoration: none;
  transition: background 0.1s;
  white-space: nowrap;
}

.contact-link:hover {
  background: var(--primary-light);
  text-decoration: none;
}

/* Verification chip */
.card-verify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  width: fit-content;
}

.card-verify--ok {
  background: #dcfce7;
  color: #15803d;
}

.card-verify--warn {
  background: #fef3c7;
  color: #92400e;
}

/* Card footer */
.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.card-footer-link {
  color: var(--primary);
  font-size: var(--fs-xs);
  font-weight: 500;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

/* Empty card state */
.card-empty-heading {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}

.card-empty-body {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-contribute {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0 16px;
  height: var(--tap-min);
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  width: fit-content;
  transition: background 0.12s;
}

.btn-contribute:hover { background: #15803d; text-decoration: none; }


/* ═══════════════════════════════════════════════════════════
   BOTTOM SHEET
═══════════════════════════════════════════════════════════ */

.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 500;
}

.sheet-backdrop.open { display: block; }

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 510;
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle-bar {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 9999px;
  margin: 10px auto 4px;
  flex: 0 0 auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
}

.sheet-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.sheet-close {
  width: var(--tap-min); height: var(--tap-min);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
}

.sheet-close:hover { background: var(--bg-2); }

.sheet-body {
  padding: 0 16px 24px;
}

/* Hide sheet elements on desktop */
@media (min-width: 769px) {
  .sheet-backdrop,
  .bottom-sheet { display: none !important; }
}
