:root {
  --bg: #050914;
  --ink: #f8fafc;
  --muted: #a8b3c7;
  --card: rgba(15, 23, 42, 0.55);
  --saffron: #ff9933;
  --green: #138808;
  --green-bright: #22c55e;
  --chakra: #60a5fa;
  --danger: #fca5a5;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(255, 153, 51, 0.5);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, rgba(255, 153, 51, 0.08), transparent 45%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.15;
}

.tricolour {
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--saffron) 0 33.33%,
    var(--ink) 33.33% 66.66%,
    var(--green) 66.66% 100%
  );
}

.page {
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 28px 0 48px;
}

/* Navigation */

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 72px;
}

.nav-brand {
  color: var(--saffron);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-text {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding: 10px 10px;
  transition: color 0.2s ease;
}

.nav-text:hover {
  color: var(--ink);
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  border-color: var(--line-strong);
}

.nav-link--primary,
.nav-link--primary:hover {
  color: var(--bg);
  background: var(--saffron);
  border-color: var(--saffron);
}

/* User menu: a native <details> dropdown; a small script in base.html closes it on Esc or outside click. */
.user-menu {
  position: relative;
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  list-style: none;
}

.user-menu-toggle::-webkit-details-marker {
  display: none;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--saffron);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.85rem;
}

.user-menu-name {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu[open] .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b1120;
  box-shadow: var(--shadow);
}

.user-menu-greeting {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.user-menu-panel form {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--card);
  color: var(--saffron);
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  color: var(--ink);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  gap: 10px;
}

.message {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.message.success {
  border-color: rgba(34, 197, 94, 0.5);
}

/* Hero & headings */

.hero {
  text-align: center;
  margin-bottom: 56px;
}

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

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 30px rgba(255, 153, 51, 0.35);
}

.subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.hero--landing {
  padding-block: 24px;
}

.hero--landing .subtitle {
  max-width: 620px;
  margin: 22px auto 0;
}

.accent {
  background: linear-gradient(90deg, var(--saffron), var(--ink) 55%, var(--green-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.hero--question h1 {
  max-width: 820px;
  margin-inline: auto;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: none;
  text-shadow: none;
}

.info-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 1px solid var(--chakra);
  border-radius: 50%;
  color: var(--chakra);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.section {
  margin-top: 96px;
}

.section-head {
  text-align: center;
  margin-bottom: 32px;
}

.section-head .eyebrow {
  margin: 0 0 8px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

/* Stats: a quiet row of figures between two hairlines. */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.stat-value {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat:first-child .stat-value {
  color: var(--saffron);
}

.stat:nth-child(3) .stat-value {
  color: var(--green-bright);
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Topics */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.category-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.category-card p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 999px;
  color: var(--chakra);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
}

.chip {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip--active,
.chip--active:hover {
  background: var(--saffron);
  border-color: var(--saffron);
  color: var(--bg);
}

/* Poll cards */

.poll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.poll-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.poll-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.poll-number {
  color: var(--muted);
  font-size: 0.85rem;
}

.poll-card h2 {
  margin: 14px 0 22px;
  font-size: 1.4rem;
}

.poll-card p {
  color: var(--saffron);
  font-weight: 600;
}

.poll-meta {
  display: flex;
  align-self: stretch;
  margin-top: auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.poll-meta p {
  margin: 0;
}

.choice-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  text-align: left;
}

.choice-dot {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

/* Green tick for polls the signed-in citizen has voted on. */
.voted-badge {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-bright);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.85rem;
}

.poll-card .voted-badge {
  position: absolute;
  top: 18px;
  right: 18px;
}

.voted-badge + .tag {
  margin-right: 36px;
}

.choice-card--voted {
  border-color: var(--saffron);
}

.choice-card--voted .choice-dot {
  border-color: var(--saffron);
  background: var(--saffron);
  box-shadow: inset 0 0 0 3px var(--bg);
}

/* Votes are final, so cast choices don't react to hover or taps. */
.choice-card:disabled {
  cursor: default;
  transform: none;
}

.error {
  color: var(--danger);
}

/* How it works */

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
}

.step {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.step-number {
  color: var(--saffron);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.step h3 {
  margin: 10px 0 8px;
  font-size: 1.25rem;
}

.step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.cta-band {
  margin-top: 96px;
  padding: 56px 32px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 153, 51, 0.1), rgba(15, 23, 42, 0.6) 50%, rgba(19, 136, 8, 0.12));
}

.cta-band h2 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.cta-band p {
  margin: 0 0 28px;
  color: var(--muted);
}

/* Buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 40px;
}

.actions-note {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
}

.btn {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 28px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--saffron);
}

.btn--primary {
  background: var(--saffron);
  border-color: var(--saffron);
  color: var(--bg);
}

.btn--primary:hover {
  background: #ffa64d;
}

.btn--ghost {
  background: transparent;
}

.btn--block {
  width: 100%;
}

.empty-state {
  text-align: center;
  padding: 48px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

/* History list: compact rows that stay readable as a citizen's history grows. */

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.history-list li + li {
  border-top: 1px solid var(--line);
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease;
}

.history-row:hover {
  background: rgba(15, 23, 42, 0.9);
}

.history-question {
  display: block;
  font-weight: 600;
  line-height: 1.4;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.history-link {
  flex-shrink: 0;
  color: var(--saffron);
  font-weight: 600;
  white-space: nowrap;
}

/* Auth forms */

.auth-card {
  max-width: 440px;
  margin: 0 auto;
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.auth-card .eyebrow {
  margin: 0 0 6px;
}

.auth-title {
  font-size: 2.1rem;
  margin: 0 0 8px;
}

.auth-card .subtitle {
  margin: 0 0 24px;
  font-size: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  font-size: 0.9rem;
  font-weight: 500;
}

.field input {
  font: inherit;
  color: var(--ink);
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.6);
}

.field input:focus {
  outline: 2px solid var(--saffron);
  outline-offset: 1px;
  border-color: transparent;
}

.field--error input {
  border-color: var(--danger);
}

.field-help {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.field-help ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.field-error,
.form-errors p {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.form-errors {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
}

.auth-card .btn {
  margin-top: 8px;
}

.auth-switch {
  margin: 24px 0 0;
  text-align: center;
  color: var(--muted);
}

.field .code-input {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  text-align: center;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--saffron);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* "Continue with Google" button and the "or" divider above the password form. */

.btn--google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn--google:hover {
  background: #ffffff;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

/* Sign-in popup for signed-out voters (native popover, no JS). */
.auth-popup {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  color: var(--ink);
  background: #0b1120;
}

.auth-popup::backdrop {
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

/* Long-form text pages (privacy). */

.prose {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.7;
}

.prose h2 {
  margin: 36px 0 10px;
  font-size: 1.25rem;
  color: var(--ink);
}

.prose ul {
  padding-left: 22px;
}

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

.prose strong {
  color: var(--ink);
}

/* Footer */

.site-footer {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 6px 0;
}

.footer-meta {
  font-size: 0.8rem;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .nav {
    justify-content: center;
    margin-bottom: 48px;
  }

  .nav-links {
    justify-content: center;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .section,
  .cta-band,
  .site-footer {
    margin-top: 64px;
  }

  .cta-band {
    padding: 40px 20px;
  }

  .auth-card {
    padding: 28px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Draft polls: the owner's review page the weekly research email points to. */

.draft-list {
  display: grid;
  gap: 16px;
}

.draft {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.draft h2 {
  margin: 12px 0 12px;
  font-size: 1.4rem;
}

.draft-choices {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.7;
}

.draft-reason {
  margin: 0 0 8px;
}

.draft-source {
  margin: 0 0 22px;
  font-size: 0.9rem;
  color: var(--muted);
}

.draft .btn {
  padding: 12px 24px;
}
