/* ============================================================
   large, high-contrast, plain design.
   Designed for comfortable reading.
   ============================================================ */

:root {
  --ink: #1c2430;
  --ink-soft: #45505f;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #d8d3c8;
  --navy: #123a63;
  --navy-dark: #0c2b4b;
  --navy-soft: #e8eef5;
  --gold: #b3541e;
  --for-bg: #1e7d3e;
  --against-bg: #b3261e;
  --none-bg: #5f6b7a;
  --focus: #b3541e;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.25rem; /* 20px base */
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 1.5rem;
  margin: 1.4rem 0 0.7rem;
}

h3 {
  font-size: 1.25rem;
  margin: 1rem 0 0.5rem;
}

p {
  margin: 0.5rem 0;
}

a {
  color: var(--navy);
}

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Header ---------- */

.app-header {
  background: var(--navy);
  color: #fff;
  padding: 0.9rem 1rem 0.7rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  width: max-content;
  padding: 0.2rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 800;
}

.brand-name {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-accent {
  color: #ffd9a8;
}

.tagline {
  margin: 0.15rem 0 0 3rem;
  font-size: 1rem;
  color: #cfe0f2;
}

/* ---------- Navigation ---------- */

.main-nav {
  display: flex;
  background: var(--navy-dark);
  position: sticky;
  top: 0;
  z-index: 20;
}

.main-nav button {
  flex: 1 1 0;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: #dbe7f4;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.3rem;
  cursor: pointer;
}

.main-nav button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.main-nav button[aria-current="true"] {
  background: var(--paper);
  color: var(--navy);
  box-shadow: inset 0 -5px 0 var(--gold);
}

/* ---------- Layout ---------- */

#main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

#main:focus {
  outline: none;
}

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.9rem 0;
}

.note {
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 54px;
  padding: 0.55rem 1.4rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--navy-dark);
}

.btn.secondary {
  color: var(--navy);
  background: #fff;
}

.btn.secondary:hover {
  background: var(--navy-soft);
}

.btn.danger {
  color: #fff;
  background: var(--against-bg);
  border-color: var(--against-bg);
}

.btn.big {
  font-size: 1.35rem;
  padding: 0.8rem 1.8rem;
}

/* ---------- Member cards (Home / Find) ---------- */

.member-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.8rem 0;
}

.avatar {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.member-card .who {
  flex: 1 1 auto;
  min-width: 0;
}

.member-card .who .name {
  font-size: 1.3rem;
  font-weight: 800;
}

.member-card .who .desc {
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.party-tag {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.7rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.party-R {
  background: #fdecec;
  color: #8f1d15;
  border: 1.5px solid #e5b1ae;
}

.party-D {
  background: #e9eff8;
  color: #173e6b;
  border: 1.5px solid #b7c8e2;
}

.party-I {
  background: #f0f0f0;
  color: #4a4a4a;
  border: 1.5px solid #cfcfcf;
}

.member-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.member-actions .btn {
  min-height: 48px;
}

/* ---------- Forms ---------- */

label.field-label {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 1rem 0 0.3rem;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 54px;
  font: inherit;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--ink-soft);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

/* ---------- Vote list ---------- */

.vote {
  border: 2px solid var(--line);
  border-left-width: 10px;
  border-radius: 12px;
  background: var(--card);
  padding: 0.9rem 1rem;
  margin: 0.9rem 0;
}

.vote.for {
  border-left-color: var(--for-bg);
}

.vote.against {
  border-left-color: var(--against-bg);
}

.vote.none {
  border-left-color: var(--none-bg);
}

.vote .vote-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.9rem;
}

.vote .date {
  color: var(--ink-soft);
  font-size: 1.05rem;
  white-space: nowrap;
}

.vote .title {
  font-size: 1.2rem;
  font-weight: 800;
}

.vote .what {
  margin: 0.5rem 0 0.2rem;
}

.vote-line {
  margin: 0.55rem 0 0.2rem;
}

.vote-toggle {
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.3rem 0;
}

/* Collapsible list of a bill’s earlier votes (amendments, procedural) */
.vote-group {
  margin: 0.15rem 0 0.9rem;
}

.vote-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 52px;
  background: var(--navy-soft);
  color: var(--navy);
  border: 2px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 0.35rem 1rem;
  cursor: pointer;
}

.vote-group-toggle:hover {
  border-color: var(--navy);
}

.vg-caret {
  display: inline-block;
  font-size: 1.05rem;
  transition: transform 0.15s ease;
}

.vote-group-toggle[aria-expanded="true"] .vg-caret {
  transform: rotate(90deg);
}

.vote-group-body {
  margin: 0.3rem 0 0 0.9rem;
}

.vote-group-body .vote {
  margin: 0.55rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .vg-caret {
    transition: none;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 1rem;
}

.badge .glyph {
  font-size: 1.3rem;
  line-height: 1;
}

.badge.for {
  background: var(--for-bg);
}

.badge.against {
  background: var(--against-bg);
}

.badge.none {
  background: var(--none-bg);
}

/* Tag that names the motion a vote was actually on (table, previous
   question, cloture, …) so a FOR/AGAINST badge can’t be misread as a vote
   on the bill itself. Neutral on purpose — it is not a FOR/AGAINST marker. */
.motion-tag {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--navy-soft);
  border: 1.5px solid #b7c8e2;
  border-radius: 999px;
  padding: 0.02rem 0.7rem;
  margin-right: 0.55rem;
  vertical-align: middle;
  white-space: nowrap;
}

.tallies {
  color: var(--ink-soft);
  font-size: 1.02rem;
  margin-top: 0.45rem;
}

.issue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0 0.2rem;
}

.chip {
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
}

.chip[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}

/* ---------- Issue breakdown (member page) ---------- */

.issue-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 58px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  font: inherit;
  text-align: left;
  padding: 0.4rem 1rem;
  margin: 0.45rem 0;
  cursor: pointer;
}

.issue-row:hover {
  border-color: var(--navy);
}

.issue-row .issue-name {
  flex: 1 1 auto;
  font-weight: 700;
  font-size: 1.15rem;
}

.issue-row .issue-counts {
  font-size: 1rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.bar {
  flex: 0 0 110px;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: #e5e0d5;
}

.bar .b-for {
  background: var(--for-bg);
}

.bar .b-against {
  background: var(--against-bg);
}

/* ---------- Compare table ---------- */

.compare-wrap {
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

table.compare {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  background: #fff;
}

table.compare th,
table.compare td {
  border: 2px solid var(--line);
  padding: 0.5rem 0.6rem;
  text-align: center;
  font-size: 1.05rem;
}

table.compare th {
  background: var(--navy-soft);
  vertical-align: bottom;
}

table.compare th .rep-name {
  font-size: 1.05rem;
  font-weight: 800;
}

table.compare td.bill-cell {
  text-align: left;
  max-width: 26rem;
}

table.compare td.bill-cell .bill-title {
  font-weight: 700;
}

table.compare td.bill-cell .bill-date {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

table.compare tr.total-row td {
  font-weight: 800;
  background: var(--navy-soft);
}

.dot {
  display: inline-block;
  min-width: 2.6rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.15rem 0.6rem;
}

.dot.for {
  background: var(--for-bg);
}

.dot.against {
  background: var(--against-bg);
}

.dot.none {
  background: #c9c4b8;
  color: #4c5560;
}

/* ---------- Conduct ---------- */

.conduct-entry {
  border-left: 6px solid var(--against-bg);
}

.conduct-entry .c-date {
  color: var(--ink-soft);
  font-size: 1rem;
}

.conduct-entry .c-allegation {
  font-weight: 800;
  font-size: 1.15rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.tag {
  font-size: 0.95rem;
  font-weight: 700;
  background: #f0ece4;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.7rem;
}

.tag.unresolved {
  background: #fff3e2;
  border-color: #e2b877;
  color: #7a4b00;
}

/* ---------- Misc ---------- */

.loading {
  text-align: center;
  padding: 3rem 1rem;
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border: 6px solid var(--navy-soft);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.banner {
  background: #fff3e2;
  border: 2px solid #e2b877;
  color: #5c3c05;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-size: 1.1rem;
  margin: 0.8rem 0;
}

.app-footer {
  background: var(--navy-dark);
  color: #c9d8e8;
  font-size: 1rem;
  line-height: 1.5;
  padding: 1.2rem 1rem 1.6rem;
  max-width: 52rem;
  margin: 0 auto;
}

.app-footer p {
  margin: 0.4rem 0;
}

.app-footer .data-date {
  color: #9fb6cf;
}

.empty-state {
  text-align: center;
  padding: 2.2rem 1rem;
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  margin: 1rem 0;
}

.empty-state .big-glyph {
  font-size: 3rem;
}

.section-hint {
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 48px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
  text-decoration: none;
  margin-top: 0.4rem;
}

@media (max-width: 480px) {
  body {
    font-size: 1.2rem;
  }

  .main-nav button {
    font-size: 1.02rem;
  }

  .member-card {
    flex-wrap: wrap;
  }

  .member-actions {
    flex-direction: row;
    width: 100%;
  }

  .member-actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- PWA install prompt (sticky bottom bar) ---------- */

.install-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--navy);
  color: #fff;
  border-top: 2px solid var(--navy-dark);
  box-shadow: 0 -3px 10px rgba(12, 43, 75, 0.25);
  /* On a real phone, clear the home-indicator area */
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.install-bar.leaving {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Centered like the rest of the layout on wide screens */
.install-bar-inner {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
}

.install-bar img.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: block;
}

.install-bar .ib-text {
  flex: 1 1 auto;
  min-width: 0;
}

.install-bar .ib-title {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.2;
}

.install-bar .ib-sub {
  display: block;
  font-size: 0.95rem;
  color: #cfe0f2;
  line-height: 1.25;
}

.install-bar .ib-install {
  flex: 0 0 auto;
  background: #fff;
  color: var(--navy);
  border-color: #fff;
  min-height: 48px;
  padding: 0.4rem 1.2rem;
  white-space: nowrap;
}

.install-bar .ib-install:hover {
  background: var(--navy-soft);
}

.install-bar .ib-close {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.install-bar .ib-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* On very narrow phones drop the tagline line so the bar stays compact */
@media (max-width: 420px) {
  .install-bar .ib-sub {
    display: none;
  }
}

/* Keep the last lines of content readable above the fixed bar */
body.install-bar-visible .app-footer {
  padding-bottom: calc(1.6rem + 8.5rem + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
  .install-bar {
    transition: none;
  }
}

/* ---------- Install instructions dialog ---------- */

.install-help {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.install-help[hidden] {
  display: none;
}

.install-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 43, 75, 0.55);
}

.install-help-card {
  position: relative;
  width: min(26rem, 100%);
  background: var(--card);
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(12, 43, 75, 0.35);
  padding: 1.2rem 1.3rem;
}

.install-help-card .help-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 1.05rem;
  cursor: pointer;
}

.install-help-card .help-close:hover {
  background: var(--navy);
  color: #fff;
}

.help-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 0.4rem;
}

.help-head img.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: block;
}

.help-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.help-head .note {
  margin: 0.1rem 0 0;
}

.help-steps {
  margin: 0.7rem 0 1rem;
  padding-left: 1.5rem;
}

.help-steps li {
  margin: 0.55rem 0;
}

.help-steps .share-icon {
  vertical-align: -0.2em;
  margin: 0 0.15em;
}

.install-help-card .btn {
  width: 100%;
}

/* ---------- Print ---------- */
@media print {

  .main-nav,
  .app-header,
  .member-actions,
  .vote-toggle,
  .back-link,
  .skip-link,
  .vote-group-toggle,
  .install-bar,
  .install-help {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .card,
  .vote {
    break-inside: avoid;
    border-color: #999;
  }

  .vote-summary {
    display: block !important;
  }

  .vote-truncated {
    display: none !important;
  }

  .vote-group-body {
    display: block !important;
    margin-left: 0;
  }
}