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

:root {
  --blue:       #0d47a1;
  --red:        #b71c1c;
  --indep:      #555;
  --bg:         #f4f6f9;
  --card-bg:    #ffffff;
  --border:     #dde1e8;
  --text:       #1a1a1a;
  --muted:      #666;
  --header-h:   72px;
  --tabs-h:     54px;
  --radius:     10px;
  --shadow:     0 2px 10px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.18);
}

html { font-size: 18px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; line-height: 1.5; }

/* ── Header ───────────────────────────────────────────────────────────────── */
#site-header {
  position: sticky; top: 0; z-index: 100;
  background: #0a2240; color: #fff;
  height: var(--header-h);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 20px;
  height: 100%; display: flex; align-items: center; gap: 20px;
}
.header-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { font-size: 1.6rem; color: #f0c040; }
.brand-title { font-size: 1.4rem; font-weight: 700; letter-spacing: .02em; }
.brand-sub { font-size: 0.9rem; opacity: .75; white-space: nowrap; }

.header-search { flex: 1; max-width: 480px; }
#search-input {
  width: 100%; padding: 10px 18px;
  font-size: 1.05rem; border: none; border-radius: 30px;
  background: rgba(255,255,255,.15); color: #fff;
  outline: none; transition: background .2s;
}
#search-input::placeholder { color: rgba(255,255,255,.6); }
#search-input:focus { background: rgba(255,255,255,.25); }

.member-count { font-size: 0.85rem; opacity: .7; white-space: nowrap; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
#chamber-tabs {
  position: sticky; top: var(--header-h); z-index: 99;
  background: #fff; border-bottom: 2px solid var(--border);
  display: flex; gap: 0; padding: 0 20px;
  height: var(--tabs-h); align-items: flex-end;
}
.tab {
  padding: 10px 24px; font-size: 1rem; font-weight: 600;
  border: none; background: none; cursor: pointer;
  color: var(--muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
  min-height: 48px;
}
.tab:hover { color: var(--text); }
.tab.active { color: #0a2240; border-bottom-color: #0a2240; }

/* ── Grid ─────────────────────────────────────────────────────────────────── */
#grid-container { max-width: 1400px; margin: 0 auto; padding: 24px 20px 60px; }

#member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.member-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  border: 2px solid transparent;
  display: flex; flex-direction: column;
}
.member-card:hover, .member-card:focus-visible {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: #0a2240; outline: none;
}
.card-photo {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: top;
  display: block; background: #e8edf3;
}
.card-photo-placeholder {
  width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(135deg, #c8d6e8 0%, #e2e8f0 100%);
  display: flex; align-items: center; justify-content: center;
}
.card-photo-placeholder svg { width: 56px; height: 56px; color: #93a8c0; }

.card-body { padding: 12px 14px 14px; flex: 1; }
.card-name { font-size: 1rem; font-weight: 700; line-height: 1.25; margin-bottom: 6px; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.party-badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.party-D { background: var(--blue); }
.party-R { background: var(--red); }
.party-I { background: var(--indep); }

.card-location { font-size: 0.82rem; color: var(--muted); }
.card-bills {
  margin-top: 8px; font-size: 0.8rem; font-weight: 600;
  color: #2e7d32;
}

.no-results { text-align: center; padding: 60px 20px; font-size: 1.2rem; color: var(--muted); }
.hidden { display: none !important; }

/* ── Profile View (full page) ─────────────────────────────────────────────── */
#profile-view {
  min-height: 100vh; background: var(--bg);
}

#profile-topbar {
  position: sticky; top: 0; z-index: 100;
  background: #0a2240; padding: 0 24px;
  height: 60px; display: flex; align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.back-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 1rem; font-weight: 700; padding: 10px 20px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
  min-height: 44px;
}
.back-btn:hover { background: rgba(255,255,255,.28); }

.print-btn-top {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 0.9rem; font-weight: 600; padding: 8px 18px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
}
.print-btn-top:hover { background: rgba(255,255,255,.28); }

#profile-content {
  max-width: 900px; margin: 0 auto;
  padding: 32px 24px 80px; background: #fff;
  min-height: calc(100vh - 60px);
}

/* ── Profile: Header Bar ──────────────────────────────────────────────────── */
.prof-header {
  padding: 32px 32px 28px; border-radius: 10px; margin-bottom: 6px;
  color: #fff; display: flex; gap: 24px; align-items: flex-start;
}
.prof-photo {
  width: 100px; height: 125px; object-fit: cover; object-position: top;
  border-radius: 6px; border: 3px solid rgba(255,255,255,.4); flex-shrink: 0;
}
.prof-photo-placeholder {
  width: 100px; height: 125px; border-radius: 6px;
  border: 3px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.prof-info { flex: 1; min-width: 0; }
.prof-name { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.prof-party-badge {
  display: inline-block; padding: 3px 12px; border-radius: 14px;
  background: rgba(255,255,255,.2); font-size: 0.85rem; font-weight: 700;
  margin-bottom: 10px;
}
.prof-title { font-size: 1rem; opacity: .9; margin-bottom: 4px; }
.prof-meta-row {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px;
  font-size: 0.85rem; opacity: .85;
}
.prof-meta-item { display: flex; align-items: center; gap: 5px; }
.prof-meta-item svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Profile: Section ─────────────────────────────────────────────────────── */
.prof-section { padding: 24px 0; border-bottom: 1px solid var(--border); }
.prof-section:last-child { border-bottom: none; }
.section-title {
  font-size: 1.05rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: #0a2240; margin-bottom: 14px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border);
}

/* ── Bill Grid ────────────────────────────────────────────────────────────── */
.bill-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.bill-grid {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
  min-width: 560px;
}
table.bill-grid th, table.bill-grid td {
  border: 1px solid var(--border); text-align: center; padding: 6px 4px;
  vertical-align: middle;
}
table.bill-grid .member-col { width: 80px; font-weight: 600; background: #f8f9fb; }
table.bill-grid .group-header {
  font-weight: 700; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: .08em; color: #fff; padding: 5px 4px;
}
.group-israel       { background: #1565c0; }
.group-iran         { background: #4a148c; }
.group-antisemitism { background: #e65100; }

.bill-num   { font-weight: 700; font-size: 0.72rem; }
.bill-title { font-size: 0.65rem; color: var(--muted); margin-top: 2px; }
.bill-total { font-size: 0.6rem; color: #555; margin-top: 3px; }
.bill-split { font-size: 0.58rem; color: #777; }

td.favorable   { background: #e8f5e9; }
td.unfavorable { background: #fff; }
td.col-na      { background: #f5f5f5; color: #bbb; }

.check   { color: #2e7d32; font-size: 1rem; font-weight: 900; }
.x-mark  { color: #c62828; font-size: 1rem; }
.abstain { color: #f57c00; font-size: 1rem; }
.dash    { color: #bbb; font-size: 1rem; }
.na      { font-size: 0.7rem; color: #bbb; }
.vote-tag { font-size: 0.62rem; font-style: italic; }

/* ── Bill Detail ──────────────────────────────────────────────────────────── */
.detail-category-header {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: #555; margin: 12px 0 6px;
  padding-bottom: 3px; border-bottom: 1px solid var(--border);
}
.bill-detail-item {
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.bill-detail-item:last-child { border-bottom: none; }
.bill-detail-header {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.bill-num-inline { font-weight: 700; font-size: 0.85rem; color: #0a2240; }
.bill-title-inline { font-size: 0.85rem; flex: 1; min-width: 0; }
.role-tag {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 10px;
  background: #e8f5e9; color: #2e7d32; font-weight: 600; white-space: nowrap;
}
.friction-tag { background: #fff3e0; color: #e65100; }
.cosponsor-count { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.vote-note { font-size: 0.78rem; color: #555; margin-top: 5px; padding: 4px 8px; background: #f8f9fb; border-radius: 4px; border-left: 3px solid #0a2240; }
.vote-note.thank-you { border-left-color: #2e7d32; color: #1b5e20; background: #f1f8e9; }
.vote-note.friction-note { border-left-color: #e65100; color: #bf360c; background: #fff3e0; }
.no-data { color: var(--muted); font-style: italic; font-size: 0.9rem; }

/* ── Nonlegislative Asks ──────────────────────────────────────────────────── */
.nl-asks { font-size: 0.95rem; color: #333; display: flex; flex-direction: column; gap: 14px; }
.nl-item { padding: 12px 16px; background: #f8f9fb; border-radius: 8px; border-left: 4px solid #0a2240; }
.nl-heading { font-weight: 800; color: #0a2240; margin-bottom: 5px; font-size: 1rem; }
.nl-text { line-height: 1.5; margin-bottom: 4px; }
.nl-sub { line-height: 1.5; padding-left: 16px; margin-top: 4px; color: #444; }

/* ── Social links ─────────────────────────────────────────────────────────── */
.prof-social-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.prof-social-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px;
  background: rgba(255,255,255,.2); color: #fff;
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
  transition: background .15s; white-space: nowrap;
}
.prof-social-link:hover { background: rgba(255,255,255,.35); }

/* ── Statements ──────────────────────────────────────────────────────────── */
.statements-stack { display: flex; flex-direction: column; gap: 16px; }
.statements-grid { display: flex; flex-direction: column; gap: 16px; }
.statement-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 10px 16px; font-weight: 700; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: .06em; background: #0a2240; color: #fff;
}
.statement-item { padding: 12px 16px; border-top: 1px solid var(--border); }
.stmt-meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.stmt-text { font-size: 0.88rem; line-height: 1.5; }
.no-statements { padding: 14px 16px; color: var(--muted); font-style: italic; font-size: 0.88rem; }

/* ── Print ────────────────────────────────────────────────────────────────── */
.print-btn {
  display: block; margin: 0 auto 0; padding: 10px 24px;
  background: #0a2240; color: #fff; border: none; border-radius: 6px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.print-btn:hover { background: #163a6a; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .header-inner { gap: 12px; }
  .brand-sub { display: none; }
  #member-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .prof-header { padding: 18px 16px; gap: 14px; }
  .prof-name { font-size: 1.3rem; }
  .prof-section { padding: 16px; }
  .profile-panel { width: 100vw; }
}


@media print {
  #site-header, #chamber-tabs, .profile-close, .print-btn { display: none; }
  .profile-overlay { position: static; background: none; display: block !important; }
  .profile-panel { width: 100%; height: auto; box-shadow: none; overflow: visible; }
  #grid-container { display: none; }
}
