:root {
  color-scheme: light;
  --bg: #f4efe3;
  --surface: rgba(255, 252, 246, 0.88);
  --surface-border: rgba(74, 58, 39, 0.12);
  --text: #1f2430;
  --muted: #586071;
  --accent: #0d5c63;
  --accent-strong: #08454a;
  --secondary: #ffffff;
  --shadow: 0 20px 45px rgba(31, 36, 48, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(13, 92, 99, 0.14), transparent 32%),
    linear-gradient(180deg, #faf7ef 0%, var(--bg) 100%);
}

.page {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.intro {
  max-width: 700px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 24px;
}

.card + .card {
  margin-top: 20px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.lookup-copy {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(88, 96, 113, 0.2);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
}

.field span {
  font-size: 0.95rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(88, 96, 113, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(13, 92, 99, 0.22);
  border-color: rgba(13, 92, 99, 0.45);
}

textarea {
  margin-top: 8px;
  resize: vertical;
  min-height: 240px;
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 12px;
  margin: 20px 0 8px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

#generate-button {
  background: var(--accent);
  color: #ffffff;
}

#generate-button:hover {
  background: var(--accent-strong);
}

.secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid rgba(88, 96, 113, 0.2);
}

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--accent-strong);
  font-weight: 600;
}

.info h2 {
  margin-bottom: 16px;
}

.results-card {
  margin-top: 20px;
}

.results {
  margin-top: 18px;
}

.district-block + .district-block {
  margin-top: 28px;
}

.district-heading {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(88, 96, 113, 0.16);
}

.district-heading h2 {
  font-size: 1.2rem;
}

.office-block + .office-block {
  margin-top: 18px;
}

.office-block h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--muted);
}

.rep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.rep-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 96, 113, 0.14);
}

.rep-media {
  flex: 0 0 80px;
}

.rep-image {
  display: block;
  width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: #d6d9de;
}

.rep-image-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--accent-strong);
}

.rep-body {
  min-width: 0;
}

.rep-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rep-topline h4 {
  margin: 0;
  font-size: 1.05rem;
}

.party-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(13, 92, 99, 0.12);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 700;
}

.rep-office {
  margin: 10px 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.rep-contact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 12px;
}

.rep-contact-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.rep-email {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.rep-email:hover {
  text-decoration: underline;
}

.rep-email-muted {
  color: var(--muted);
  font-weight: 500;
}

.rep-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.rep-link:hover {
  text-decoration: underline;
}

.resource-list {
  margin: 0 0 20px;
  padding-left: 20px;
}

.resource-list li + li {
  margin-top: 8px;
}

.resource-list a {
  color: var(--accent);
}

@media (max-width: 720px) {
  .page {
    padding-top: 32px;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
