/* ============================================================
   WHO REPRESENTS ME — Arizona Legislative District Map Page
   ============================================================ */

/* --- Hero / Intro --- */
.wrm-hero {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 35%, #2a1a28 100%);
  color: var(--color-white);
  padding: 72px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.wrm-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 15% 60%, rgba(178, 34, 52, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 85% 20%, rgba(212, 175, 55, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.wrm-hero .container {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
}

.wrm-hero h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-white);
  margin-bottom: 8px;
}

.wrm-hero h1 .accent {
  color: var(--color-red);
}

.wrm-hero .subtitle {
  font-family: var(--font-accent);
  font-size: 1.1rem;
  color: var(--color-gold);
  margin-bottom: 20px;
  letter-spacing: 0.03em;
}

.wrm-hero .intro-text {
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.82);
  max-width: 700px;
  margin: 0 auto;
}

.wrm-hero .intro-text strong {
  color: var(--color-white);
}

/* --- Education Section --- */
.wrm-education {
  background: var(--color-parchment-dark);
  padding: 56px 0;
}

.wrm-education .container {
  max-width: 960px;
}

.wrm-education h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 8px;
}

.wrm-chambers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

.wrm-chamber-card {
  background: var(--color-white);
  border-radius: 8px;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.08);
  padding: 32px 28px;
  position: relative;
  overflow: hidden;
}

.wrm-chamber-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
}

.wrm-chamber-card.senate::before {
  background: var(--color-blue);
}

.wrm-chamber-card.house::before {
  background: var(--color-red);
}

.wrm-chamber-card .chamber-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.wrm-chamber-card h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.wrm-chamber-card.senate h3 { color: var(--color-blue); }
.wrm-chamber-card.house h3 { color: var(--color-red); }

.wrm-chamber-card p {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.7;
  margin-bottom: 12px;
}

.wrm-chamber-card .chamber-stats {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wrm-chamber-card .chamber-stats li {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  padding: 8px 12px;
  background: rgba(245, 230, 200, 0.5);
  border-radius: 4px;
}

.wrm-chamber-card .chamber-stats li strong {
  display: block;
  font-size: 1.4rem;
  color: var(--color-blue);
  margin-bottom: 2px;
}

.wrm-chamber-card.house .chamber-stats li strong {
  color: var(--color-red);
}

/* --- Party Composition Section --- */
.wrm-composition {
  padding: 56px 0;
  background: var(--color-white);
}

.wrm-composition .container {
  max-width: 800px;
}

.wrm-composition h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 8px;
}

.wrm-comp-bars {
  max-width: 700px;
  margin: 0 auto;
}

.wrm-comp-row {
  margin-bottom: 32px;
}

.wrm-comp-label {
  margin-bottom: 10px;
}

.wrm-comp-label h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-blue);
  margin-bottom: 2px;
}

.wrm-comp-count {
  font-size: 0.78rem;
  color: #888;
}

.wrm-comp-bar-wrap {
  position: relative;
}

.wrm-comp-bar {
  display: flex;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wrm-comp-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 0.04em;
  transition: width 0.6s ease;
}

.wrm-comp-seg.R {
  background: linear-gradient(135deg, #c0392b, #a93226);
}

.wrm-comp-seg.D {
  background: linear-gradient(135deg, #2471a3, #1a5276);
}

.wrm-comp-majority-line {
  position: absolute;
  top: -6px;
  bottom: -18px;
  width: 2px;
  background: var(--color-gold);
  z-index: 2;
}

.wrm-comp-majority-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--color-gold);
  border-radius: 50%;
}

.wrm-majority-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  white-space: nowrap;
}

.wrm-comp-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 8px;
}

.wrm-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}

.wrm-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.wrm-legend-swatch.R { background: #c0392b; }
.wrm-legend-swatch.D { background: #2471a3; }

.wrm-legend-line {
  width: 14px;
  height: 2px;
  background: var(--color-gold);
}

/* --- Committees Section --- */
.wrm-committees {
  padding: 56px 0;
  background: var(--color-parchment-dark);
}

.wrm-committees .container {
  max-width: 1000px;
}

.wrm-committees h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 8px;
}

.wrm-committees-intro {
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: center;
}

.wrm-committees-intro p {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.7;
  margin-bottom: 10px;
}

.wrm-committee-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}

.wrm-committee-tab {
  padding: 12px 28px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid var(--color-blue);
  background: transparent;
  color: var(--color-blue);
  cursor: pointer;
  transition: all 0.2s;
}

.wrm-committee-tab:first-child {
  border-radius: 6px 0 0 6px;
}

.wrm-committee-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.wrm-committee-tab.active {
  background: var(--color-blue);
  color: var(--color-white);
}

.wrm-committee-tab:hover:not(.active) {
  background: rgba(60, 59, 110, 0.08);
}

.wrm-committee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.wrm-committee-card {
  background: var(--color-white);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 20px;
  border-top: 3px solid var(--color-blue);
  transition: transform 0.2s, box-shadow 0.2s;
}

.wrm-committee-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.1);
}

.wrm-committee-card.house {
  border-top-color: var(--color-red);
}

.wrm-committee-card h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-blue);
  margin-bottom: 6px;
  line-height: 1.3;
}

.wrm-committee-card.house h4 {
  color: var(--color-red);
}

.wrm-committee-card .committee-desc {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.6;
  margin-bottom: 10px;
}

.wrm-committee-card .committee-chair {
  font-size: 0.78rem;
  color: #444;
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid #eee;
}

.wrm-committee-card .committee-chair span:first-child {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
}

/* --- Address Search --- */
.wrm-address-search {
  max-width: 700px;
  margin: 0 auto 32px;
}

.wrm-address-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wrm-address-input-wrap {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.wrm-address-input-wrap input {
  flex: 1;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  border: 2px solid #ddd;
  border-right: none;
  border-radius: 6px 0 0 6px;
  outline: none;
  transition: border-color 0.2s;
}

.wrm-address-input-wrap input:focus {
  border-color: var(--color-blue);
}

.wrm-address-btn {
  padding: 14px 24px;
  background: var(--color-red);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.wrm-address-btn:hover {
  background: #8b1a27;
}

.wrm-address-error {
  font-size: 0.82rem;
  color: var(--color-red);
  min-height: 1.2em;
  text-align: center;
}

.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;
}

/* --- Map Section --- */
.wrm-map-section {
  padding: 56px 0;
  position: relative;
}

.wrm-map-section .container {
  max-width: 1200px;
}

.wrm-map-section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 8px;
}

.wrm-map-section .section-desc {
  text-align: center;
  font-size: 0.92rem;
  color: #555;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.wrm-map-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

/* Leaflet map container */
#district-map {
  width: 100%;
  height: 600px;
  border-radius: 8px;
  border: 2px solid #ccc;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  background: #e8e0d0;
  z-index: 1;
}

/* --- District Panel (right side) --- */
.wrm-panel {
  background: var(--color-white);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.wrm-panel-empty {
  padding: 48px 24px;
  text-align: center;
  color: #888;
}

.wrm-panel-empty .panel-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
  display: block;
}

.wrm-panel-empty h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  text-transform: uppercase;
  color: var(--color-blue);
  margin-bottom: 8px;
}

.wrm-panel-empty p {
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Panel header */
.wrm-panel-header {
  background: linear-gradient(135deg, var(--color-blue) 0%, #2a2a5e 100%);
  color: var(--color-white);
  padding: 24px;
  text-align: center;
}

.wrm-panel-header h3 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.wrm-panel-header .panel-subtitle {
  font-family: var(--font-accent);
  font-size: 0.85rem;
  color: var(--color-gold);
}

/* Legislator card inside panel */
.wrm-legislator {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.wrm-legislator:last-child {
  border-bottom: none;
}

.wrm-legislator-photo {
  width: 80px;
  height: 100px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #ddd;
  border: 2px solid #ccc;
}

.wrm-legislator-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 0.04em;
}

.wrm-legislator-info {
  flex: 1;
  min-width: 0;
}

.wrm-legislator-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #222;
  margin-bottom: 2px;
  line-height: 1.2;
}

.wrm-legislator-role {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.wrm-legislator-role.senate {
  color: var(--color-blue);
}

.wrm-legislator-role.house {
  color: var(--color-red);
}

/* Party badge */
.party-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.party-badge.R {
  background: #c0392b;
  color: var(--color-white);
}

.party-badge.D {
  background: #2471a3;
  color: var(--color-white);
}

/* Legislator meta details */
.wrm-legislator-meta {
  list-style: none;
  padding: 0;
  margin: 0;
}

.wrm-legislator-meta li {
  font-size: 0.78rem;
  color: #666;
  padding: 3px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.wrm-legislator-meta li:last-child {
  border-bottom: none;
}

.wrm-legislator-meta li span:first-child {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
}

/* --- Fascist Rating Meter --- */
.fascist-meter {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.fascist-meter-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #999;
  margin-bottom: 6px;
}

.fascist-meter-bar {
  height: 10px;
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.fascist-meter-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.fascist-meter-text {
  font-family: var(--font-accent);
  font-size: 0.72rem;
  margin-top: 4px;
  text-align: right;
}

/* Meter color grades (PolitiFact-style) */
.fascist-meter.level-0 .fascist-meter-fill { background: #27ae60; width: 10%; }
.fascist-meter.level-0 .fascist-meter-text { color: #27ae60; }
.fascist-meter.level-1 .fascist-meter-fill { background: #8bc34a; width: 25%; }
.fascist-meter.level-1 .fascist-meter-text { color: #689f38; }
.fascist-meter.level-2 .fascist-meter-fill { background: #f9a825; width: 50%; }
.fascist-meter.level-2 .fascist-meter-text { color: #f57f17; }
.fascist-meter.level-3 .fascist-meter-fill { background: #ff7043; width: 75%; }
.fascist-meter.level-3 .fascist-meter-text { color: #e64a19; }
.fascist-meter.level-4 .fascist-meter-fill { background: #e53935; width: 90%; }
.fascist-meter.level-4 .fascist-meter-text { color: #c62828; }
.fascist-meter.level-5 .fascist-meter-fill { background: #b71c1c; width: 100%; }
.fascist-meter.level-5 .fascist-meter-text { color: #b71c1c; }

.fascist-meter.pending .fascist-meter-fill {
  background: repeating-linear-gradient(
    -45deg,
    #ddd, #ddd 4px,
    #eee 4px, #eee 8px
  );
  width: 100%;
}
.fascist-meter.pending .fascist-meter-text { color: #aaa; }

/* --- Legislator name link --- */
.wrm-legislator-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--color-blue);
  transition: color 0.2s, border-color 0.2s;
}

.wrm-legislator-link:hover {
  color: var(--color-red);
  border-bottom-color: var(--color-red);
  text-decoration: none;
}

/* --- Email link --- */
.wrm-email-link {
  color: var(--color-blue);
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-decoration: none;
  word-break: break-all;
}

.wrm-email-link:hover {
  color: var(--color-red);
  text-decoration: underline;
}

/* --- Collapsible sections --- */
.wrm-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 8px;
  margin-bottom: 0;
}

.wrm-collapsible-header:hover {
  opacity: 0.85;
}

.wrm-collapse-icon {
  font-size: 0.8rem;
  transition: transform 0.3s;
  color: var(--color-red);
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.wrm-collapsible-header.collapsed .wrm-collapse-icon {
  transform: rotate(-90deg);
}

.wrm-collapsible-body {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 5000px;
  opacity: 1;
}

.wrm-collapsible-body.collapsed {
  max-height: 0;
  opacity: 0;
}

/* --- District Quick List --- */
.wrm-district-list {
  padding: 48px 0;
  background: var(--color-parchment-dark);
}

.wrm-district-list .container {
  max-width: 1200px;
}

.wrm-district-list h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 8px;
}

.wrm-district-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.wrm-district-card {
  background: var(--color-white);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 16px 20px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid var(--color-blue);
}

.wrm-district-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);
}

.wrm-district-card h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-blue);
  margin-bottom: 6px;
}

.wrm-district-card .legislator-line {
  font-size: 0.82rem;
  color: #555;
  padding: 2px 0;
}

.wrm-district-card .legislator-line .chamber-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
  display: inline-block;
  width: 50px;
}

/* --- Mobile panel overlay --- */
.wrm-panel-overlay {
  display: none;
}

/* --- Responsive --- */
@media (max-width: 1023px) {
  .wrm-map-layout {
    grid-template-columns: 1fr;
  }

  .wrm-panel {
    position: static;
    max-height: none;
  }

  .wrm-panel-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
  }

  .wrm-panel-overlay.active {
    display: flex;
  }

  .wrm-panel-overlay .wrm-panel {
    position: static;
    max-height: 80vh;
    width: 100%;
    max-width: 500px;
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.3s ease;
  }

  .wrm-panel-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
  }
}

@media (min-width: 1024px) {
  .wrm-panel-close {
    display: none;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 767px) {
  .wrm-chambers {
    grid-template-columns: 1fr;
  }

  .wrm-hero h1 {
    font-size: 2rem;
  }

  .wrm-hero .subtitle {
    font-size: 0.92rem;
  }

  #district-map {
    height: 400px;
  }

  .wrm-district-grid {
    grid-template-columns: 1fr;
  }

  .wrm-address-input-wrap {
    flex-direction: column;
  }

  .wrm-address-input-wrap input {
    border-right: 2px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
  }

  .wrm-address-btn {
    border-radius: 0 0 6px 6px;
  }

  .wrm-comp-legend {
    flex-wrap: wrap;
    gap: 12px;
  }

  .wrm-committee-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 479px) {
  #district-map {
    height: 320px;
  }
}
