/* NSW firearms — email your local member.
   Restrained, civic, readable. Light and dark. */

:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --ink: #1b1d21;
  --ink-soft: #55595f;
  --ink-faint: #83878d;
  --line: #dedbd4;
  --line-soft: #ebe8e2;
  --accent: #7a2718;
  --accent-ink: #ffffff;
  --accent-soft: #f3e6e2;
  --warn-bg: #fdf4e3;
  --warn-line: #e2c98d;
  --focus: #1f5fa8;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a;
    --panel: #1d1f24;
    --ink: #eceef1;
    --ink-soft: #b2b7bf;
    --ink-faint: #868c96;
    --line: #33363d;
    --line-soft: #282b31;
    --accent: #e0836c;
    --accent-ink: #1b1d21;
    --accent-soft: #33241f;
    --warn-bg: #2c2517;
    --warn-line: #6b5729;
    --focus: #7fb2ec;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--ui);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---- header / footer ---- */

header.site {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 44px 0 34px;
}
.kicker {
  margin: 0 0 8px;
  font: 600 12px/1 var(--ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0 0 18px;
  font: 700 clamp(30px, 5.5vw, 42px)/1.12 var(--sans);
  letter-spacing: -.015em;
}
.lede { margin: 0 0 12px; color: var(--ink-soft); font-size: 17px; max-width: 60ch; }
.lede strong { color: var(--ink); }

footer.site {
  margin-top: 56px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 13.5px;
}
footer.site p { margin: 0; }

/* ---- steps ---- */

main.wrap { padding-top: 32px; }

.step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.step[hidden] { display: none; }
.step.muted { background: none; border-style: dashed; color: var(--ink-soft); }
.step.muted p { font-size: 14.5px; }
.step.muted strong { color: var(--ink); }

h2 {
  margin: 0 0 16px;
  font: 600 20px/1.3 var(--sans);
  display: flex;
  align-items: center;
  gap: 11px;
}
.num {
  flex: none;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 13px/27px var(--ui);
  text-align: center;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14.5px;
}
.req, .opt {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.req { color: var(--accent); }

.help { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-faint); }
.help a, .step a, .notice a { color: var(--focus); }

input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}
textarea { resize: vertical; line-height: 1.6; }
#letter { font: 15px/1.7 var(--ui); min-height: 340px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.field { min-width: 0; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-weight: 400;
  font-size: 14.5px;
}
.check input { margin-top: 3px; flex: none; }

/* ---- autocomplete ---- */

.combo { position: relative; }
.suggestions {
  position: absolute;
  z-index: 20;
  left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(0,0,0,.13);
  max-height: 300px;
  overflow-y: auto;
}
.suggestions[hidden] { display: none; }
.suggestions li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
.suggestions li.active, .suggestions li:hover { background: var(--accent-soft); }
.suggestions .pc { color: var(--ink-faint); font: 13px var(--mono); }

/* ---- MP cards ---- */

.mp-card {
  display: grid;
  width: 100%;
  text-align: left;
  gap: 2px;
  padding: 15px 17px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.mp-card:hover { border-color: var(--ink-faint); }
.mp-card.chosen {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.mp-name { font: 600 17px/1.3 var(--sans); }
.mp-meta { font-size: 13px; color: var(--accent); font-weight: 600; }
.mp-elec { font-size: 14px; color: var(--ink-soft); }
.mp-share { font-size: 12.5px; color: var(--ink-faint); font-style: italic; }
.mp-office { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }

/* ---- letter ---- */

.to-line {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  font-size: 14px;
}
.lbl {
  display: inline-block;
  min-width: 58px;
  color: var(--ink-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}
.mono { font-family: var(--mono); font-size: 13.5px; word-break: break-all; }

.notice {
  padding: 13px 15px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--focus);
  border-radius: 7px;
  background: var(--bg);
  font-size: 14px;
  color: var(--ink-soft);
}
.notice[hidden] { display: none; }
.notice strong { color: var(--ink); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn-line); }

.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.btn {
  padding: 11px 17px;
  font: 600 14.5px var(--ui);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; color: var(--ink-soft); }

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

.status { min-height: 20px; margin: 12px 0 0; font-size: 14px; color: var(--accent); font-weight: 600; }
.status:empty { margin: 0; }

/* ---- running totals ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0 10px;
  padding: 18px 20px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stats[hidden] { display: none; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-num {
  font: 700 clamp(22px, 3.6vw, 30px)/1.1 var(--sans);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-label { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; }
.stats-note { margin: 0; font-size: 12.5px; color: var(--ink-faint); max-width: 62ch; }
.stats-note[hidden] { display: none; }

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .stat { flex-direction: row; align-items: baseline; gap: 9px; }
  .stat-label { font-size: 13.5px; }
}

/* ---- updates signup ---- */

.signup { display: grid; gap: 14px; }
.signup .btn { justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- privacy policy ---- */

ul.plain { margin: 10px 0; padding-left: 20px; color: var(--ink-soft); font-size: 15px; }
ul.plain li { margin-bottom: 6px; }
ul.plain strong { color: var(--ink); }

/* Consent sits with the other details and must not read as fine print. */
.consent-check {
  margin-top: 18px;
  padding: 13px 15px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.consent-check a { color: var(--focus); }

/* ---- admin dashboard ---- */

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
  border-bottom-color: var(--line);
}
td.figure, th.figure { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--accent-soft); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag.on { background: var(--accent-soft); color: var(--accent); }
.tag.off { background: var(--line-soft); color: var(--ink-faint); }

/* Visible to screen readers only. */
.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;
}
