/* Where Do I Stand? NI
   Visual idea: a Northern Ireland STV ballot paper. White paper on a grey desk, black ink,
   heavy ruled rows with a box on the right, and pencil marks for the voter's choices.
   One handwritten face (Caveat) is used only for pencil marks. */

/* Fonts are hosted here rather than on Google Fonts, so visitors' browsers never contact Google. */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Arimo"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/arimo-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Arimo"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/arimo-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Caveat"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/caveat-latin-600-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --desk: #e4e6e9;
  --paper: #ffffff;
  --ink: #000000;
  --muted: #53575d;
  --hair: #c8ccd2;
  --graphite: #3d4146;
  --pen: #c4161c;
  --wash: #f1f2f4;
  --error: #a4161a;
  --ballot: "Arimo", Arial, Helvetica, sans-serif;
  --pencil: "Caveat", "Bradley Hand", "Segoe Print", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font: 17px/1.55 "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
}
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 4.6vw, 1.85rem); }
h3 { font-size: 1.12rem; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Masthead: a small ballot box with a pencil cross is the mark */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; padding: 18px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none; }
.brand::before {
  content: "X"; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink);
  background: var(--paper); font: 600 24px/1 var(--pencil); color: var(--graphite); padding-top: 2px;
}
.brand span { color: inherit; }
.toplinks { display: flex; gap: 16px; }
.toplink { font-size: .92rem; color: var(--ink); }

/* The sheet */
main { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; }
.screen {
  position: relative; background: var(--paper); border: 2px solid var(--ink);
  padding: 44px clamp(18px, 5vw, 40px) clamp(22px, 5vw, 36px);
}
/* Perforated counterfoil line across the top of every sheet */
.screen::before {
  content: ""; position: absolute; left: 0; right: 0; top: 18px;
  border-top: 2px dashed var(--ink); opacity: .55;
}
.eyebrow { font-size: .92rem; font-weight: 700; color: var(--muted); margin: 0 0 .6em; }
.lede { font-size: 1.08rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; color: var(--muted); }
.facts { padding-left: 1.1em; margin: 1.2em 0; }
.facts li { margin: .45em 0; }

.check { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--ink); padding: 14px; font-size: .95rem; margin: 1.4em 0; cursor: pointer; }
.check input { margin: 2px 0 0; width: 22px; height: 22px; flex: none; accent-color: var(--ink); }

.btn { font: inherit; font-weight: 700; border-radius: 0; padding: 12px 22px; border: 2px solid var(--ink); cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:disabled { background: var(--hair); border-color: var(--hair); color: var(--muted); cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { background: var(--wash); }
a.btn { display: inline-block; text-decoration: none; }
.row { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.row-right { display: flex; gap: 10px; }

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 700; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; font-size: .95rem; background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 0; padding: 7px 12px; cursor: pointer;
}
.chips button:hover { background: var(--wash); }
.chips button.on { background: var(--ink); color: var(--paper); }
.select { font: inherit; width: 100%; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); }

/* Ballot rows: used for the answer scale and the vote question */
.scale, .chips.stack { display: block; border: 2px solid var(--ink); margin: 22px 0; }
.scale button, .chips.stack button {
  display: flex; width: 100%; align-items: stretch; justify-content: space-between;
  font: inherit; font-size: 1.02rem; text-align: left; color: var(--ink); background: var(--paper);
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 0; cursor: pointer;
}
.scale button:last-child, .chips.stack button:last-child { border-bottom: 0; }
.scale button > span, .chips.stack button > span { padding: 14px 16px; align-self: center; }
.scale button:hover, .chips.stack button:hover { background: var(--wash); }
.chips.stack button.on { background: var(--wash); color: var(--ink); }
.box {
  flex: none; width: 58px; border-left: 2px solid var(--ink); display: grid; place-items: center;
  font: 600 34px/1 var(--pencil); color: var(--graphite); font-style: normal;
}
.scale button.on, .chips.stack button.on { background: var(--wash); }


.progress { height: 8px; border: 2px solid var(--ink); margin-bottom: 22px; }
.bar { height: 100%; background: var(--ink); width: 0; transition: width .3s; }
.statement { min-height: 3.6em; font-size: clamp(1.35rem, 4.6vw, 1.75rem); }

/* Importance: a ruled scale with three ticks */
.imp { padding: 4px 0 0; }
.imp label { display: block; font-weight: 700; margin-bottom: 12px; }
#imp {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 0; cursor: pointer; background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 50% / 2px 14px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 50% 50% / 2px 14px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 100% 50% / 2px 14px no-repeat;
}
#imp::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; background: var(--ink); border: 3px solid var(--paper); outline: 2px solid var(--ink); }
#imp::-moz-range-thumb { width: 16px; height: 16px; background: var(--ink); border: 3px solid var(--paper); outline: 2px solid var(--ink); border-radius: 0; }
.imp-labels { display: grid; grid-template-columns: 1fr auto 1fr; font-size: .88rem; color: var(--muted); margin-top: 6px; }
.imp-labels span { cursor: pointer; }
.imp-labels span:nth-child(2) { text-align: center; }
.imp-labels span:last-child { text-align: right; }
.imp-labels span.on { color: var(--ink); font-weight: 700; }

.error { color: var(--error); font-weight: 700; }

/* Results: a completed ballot, preferences pencilled into the boxes */
.rank-head { margin-top: 18px; }
.results { list-style: none; padding: 0; margin: 14px 0 22px; border: 2px solid var(--ink); }
.results li { border-bottom: 2px solid var(--ink); }
.results li:last-child { border-bottom: 0; }
.res {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 0; padding: 0; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: 1fr auto 58px; grid-template-rows: auto auto; column-gap: 12px;
}
.res:hover { background: var(--wash); }
.res .name { grid-column: 1; padding: 12px 0 4px 16px; display: flex; align-items: center; gap: 9px; font-weight: 700; }
.res .name i { width: 12px; height: 12px; flex: none; border: 1px solid rgba(0, 0, 0, .35); }
.res .pct { grid-column: 2; padding-top: 12px; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.res .track { grid-column: 1 / 3; margin: 4px 0 14px 16px; height: 6px; background: var(--wash); }
.res .track span { display: block; height: 100%; }
.res .box { grid-column: 3; grid-row: 1 / 3; }
.res .box.mark { font-size: 36px; }
.results li:first-child .res .box.mark { font-size: 44px; }
.detail { padding: 6px 16px 14px; border-top: 1px solid var(--hair); }
.trow { display: grid; grid-template-columns: 9.5em 1fr 3em; gap: 10px; align-items: center; font-size: .9rem; margin: 7px 0; }
.tbar { height: 6px; background: var(--wash); }
.tbar span { display: block; height: 100%; background: var(--ink); }
.trow b { text-align: right; font-variant-numeric: tabular-nums; }

.share { margin: 0 0 24px; }
.share .small { margin: 6px 0 0; }
.diffs { border-top: 2px solid var(--ink); padding: 16px 0 6px; margin: 0 0 20px; font-size: .97rem; }
.diffs ul { margin: 0; padding-left: 1.1em; }
.diffs li { margin: .4em 0; }
.note { border-left: 4px solid var(--ink); padding: 4px 0 4px 16px; margin: 24px 0; font-size: .95rem; }
.note p { margin: 0; }

.foot { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; font-size: .84rem; color: var(--muted); }
.foot a { color: var(--muted); }

/* Methodology and positions pages */
.method table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 10px 0 30px; border: 2px solid var(--ink); }
.method th, .method td { text-align: left; padding: 8px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.method th { border-bottom: 2px solid var(--ink); }
.method td.pos { white-space: nowrap; font-weight: 700; }
.conf { font-size: .74rem; padding: 0 5px; border: 1px solid var(--muted); color: var(--muted); font-weight: 400; }
.conf.low { border-style: dashed; }
.qblock { margin-top: 30px; }

@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }
@media (max-width: 480px) {
  body { font-size: 16px; }
  .box { width: 50px; }
  .res { grid-template-columns: 1fr auto 50px; }
  .trow { grid-template-columns: 7.5em 1fr 3em; }
}
.brand, .toplink { white-space: nowrap; }
@media (max-width: 420px) {
  .top { padding: 14px 16px; }
  .brand { font-size: 1rem; gap: 8px; }
  .brand::before { width: 22px; height: 22px; font-size: 20px; }
  .toplinks { gap: 12px; }
  .toplink { font-size: .85rem; }
}
.top { flex-wrap: wrap; row-gap: 8px; }

/* ---- Red pen marks ----
   The X is two hand-drawn strokes (an SVG), not a letter, so it sits dead centre in its box.
   Numbers are red pen handwriting, nudged so the glyph's visual centre lines up with the box. */
.box { position: relative; line-height: 1; color: var(--pen); }
.scale button.on .box::after,
.brand::before {
  content: ""; width: 34px; height: 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M8.5 8.5C15 15.5 22.5 24 31.5 32' fill='none' stroke='%23c4161c' stroke-width='4.2' stroke-linecap='round'/%3E%3Cpath d='M31 8C24.5 14.5 16.5 23.5 9 31.5' fill='none' stroke='%23c4161c' stroke-width='4.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand::before { width: 26px; height: 26px; background-color: var(--paper); background-size: 18px 18px; font-size: 0; padding: 0; }
.chips.stack button.on .box::after { content: "1"; }
.chips.stack .box, .res .box.mark { font: 600 40px/1 var(--pencil); color: var(--pen); padding: 0 0 6px; }
.res .box.mark.two { font-size: 32px; letter-spacing: -.04em; }
.results li:first-child .res .box.mark { font-size: 48px; }
@media (max-width: 420px) { .brand::before { width: 22px; height: 22px; background-size: 15px 15px; } }

/* Ballot type: anything that sits in a ballot row is set like a real ballot paper,
   a bold Arial-style name with the registered name smaller underneath. */
.scale button > span, .chips.stack button > span, .res .name { font-family: var(--ballot); font-weight: 700; font-size: 1.06rem; letter-spacing: 0; }
.party-full { display: block; font-family: var(--ballot); font-weight: 400; font-size: .84rem; color: var(--muted); margin-top: 1px; }
.res .name { align-items: flex-start; }
.res .name i { margin-top: 5px; }
.res .name .nm { display: block; }
.res .pct { font-family: var(--ballot); }
/* Name gets the full width; the match % sits at the end of its bar */
.res .name { grid-column: 1 / 3; grid-row: 1; padding-right: 8px; }
.res .track { grid-column: 1; grid-row: 2; align-self: center; margin: 6px 0 14px 16px; }
.res .pct { grid-column: 2; grid-row: 2; align-self: center; padding: 0 0 8px; font-size: .88rem; }
.party-full { line-height: 1.3; margin-top: 3px; }

/* ---- Typography pass ----
   Base: 17px on a 1.5 line (25.5px). Vertical spacing uses multiples of that line,
   paragraphs and lists are held to a readable measure, headings are set tight. */
body { line-height: 1.5; font-kerning: normal; text-rendering: optimizeLegibility; }
p, li, legend, label, .check { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.08; letter-spacing: -.022em; margin: 0 0 .55em; }
h2 { line-height: 1.15; letter-spacing: -.015em; margin: 0 0 .6em; }
h3 { line-height: 1.25; margin: 0 0 .5em; }
.statement { line-height: 1.2; }
p { margin: 0 0 1em; }
.screen p, .screen ul, .screen .check, .imp, .note, .diffs { max-width: 34em; }
.eyebrow { line-height: 1.35; margin: 0 0 .9em; }
.lede { font-size: 1.12rem; line-height: 1.5; margin-bottom: 1.25em; }
/* Bullets hang in the margin so the text lines up with the paragraph above */
.facts { list-style: none; padding: 0; margin: 0 0 1.5em; }
.facts li { position: relative; padding-left: 1.1em; margin: 0 0 .7em; line-height: 1.45; }
.facts li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; background: var(--ink); }
.diffs ul { list-style: none; padding: 0; }
.diffs li { position: relative; padding-left: 1.1em; margin: 0 0 .6em; line-height: 1.45; }
.diffs li::before { content: ""; position: absolute; left: 0; top: .6em; width: 5px; height: 5px; background: var(--ink); }
/* Consent box: the tick box sits on the first line of text */
.check { gap: 14px; padding: 16px 18px; line-height: 1.45; margin: 1.6em 0 1.5em; }
.check input { margin-top: .12em; }
.small { line-height: 1.45; }
.screen > .small:last-child, .screen > p:last-child { margin-bottom: 0; }
.btn { line-height: 1.2; }
#start { margin-bottom: 1.4em; }
.foot { line-height: 1.45; max-width: 720px; }
.foot a { white-space: nowrap; }
.muted { line-height: 1.5; }
.party-full { line-height: 1.3; }
.legend, .imp-labels { line-height: 1.3; }
/* One measure for every text block, set in rem so right edges line up */
.screen p, .screen ul, .screen .check, .imp, .note, .diffs { max-width: 34rem; }
.eyebrow { text-wrap: balance; }
.check input { margin-top: 0; }
.nowrap { white-space: nowrap; }
.foot { max-width: calc(34rem + 32px); }
@media (max-width: 480px) {
  .lede { font-size: 1.04rem; line-height: 1.45; }
  h1 { font-size: 1.95rem; }
  .facts li { margin-bottom: .8em; }
  .check { padding: 14px 16px; }
}
/* Progress: a quiet rule that fills in, rather than an empty outlined box */
.progress { height: 4px; border: 0; background: var(--hair); margin-bottom: 26px; }
/* The importance scale spans the full width of the ballot above it; footer aligns with the sheet */
.imp { max-width: none; }
.foot { max-width: 720px; }
