/* Colours and type follow nixos.org: the "Afghani blue" scale, Route159 for
   headings and buttons, rounded light-blue cards. */

@font-face {
  font-family: Route159;
  src: url("fonts/route159/Route159-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Route159;
  src: url("fonts/route159/Route159-SemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Route159;
  src: url("fonts/route159/Route159-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --blue-15: oklch(15% 0.03 264);
  --blue-25: oklch(25% 0.05 264);
  --blue-35: oklch(35% 0.07 264);
  --blue-45: oklch(45% 0.09 264);
  --blue-55: oklch(55% 0.11 264);
  --blue-75: oklch(75% 0.12 264);
  --blue-85: oklch(85% 0.07 264);
  --blue-95: oklch(95% 0.02 264);

  --bg: oklch(100% 0 0);
  --text: oklch(15% 0 0);
  --muted: oklch(45% 0.02 264);
  --heading: var(--blue-25);
  --card: var(--blue-95);
  --card-border: oklch(90% 0.04 264);
  --line: oklch(88% 0.03 264);
  --link: var(--blue-45);
  --primary: var(--blue-45);
  --primary-hover: var(--blue-25);
  --primary-text: oklch(100% 0 0);
  --secondary: var(--blue-95);
  --secondary-hover: var(--blue-85);
  --secondary-text: var(--blue-15);
  --track: oklch(90% 0.03 264);
  --focus: oklch(65% 0.17 54);
  --band: var(--blue-45);
  --band-text: oklch(100% 0 0);
  --band-accent: var(--blue-85);

  --agree: oklch(45% 0.09 152);
  --agree-soft: oklch(95% 0.03 152);
  --neutral: oklch(45% 0.09 54);
  --neutral-soft: oklch(95% 0.03 54);
  --disagree: oklch(50% 0.13 16);
  --disagree-soft: oklch(95% 0.02 16);
  --warning: oklch(45% 0.09 54);
  --warning-soft: oklch(95% 0.03 54);

  --radius: 1rem;
  --heading-font:
    Route159, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", Arial, sans-serif;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--blue-15);
    --text: oklch(95% 0.01 264);
    --muted: oklch(78% 0.04 264);
    --heading: oklch(100% 0 0);
    --card: var(--blue-25);
    --card-border: var(--blue-35);
    --line: var(--blue-35);
    --link: var(--blue-75);
    --primary: var(--blue-75);
    --primary-hover: var(--blue-85);
    --primary-text: var(--blue-15);
    --secondary: var(--blue-35);
    --secondary-hover: var(--blue-45);
    --secondary-text: oklch(100% 0 0);
    --track: var(--blue-35);
    --focus: oklch(80% 0.14 54);
    --band: var(--blue-25);
    --band-accent: var(--blue-75);

    --agree: oklch(80% 0.12 152);
    --agree-soft: oklch(30% 0.05 152);
    --neutral: oklch(82% 0.11 54);
    --neutral-soft: oklch(32% 0.05 54);
    --disagree: oklch(78% 0.11 16);
    --disagree-soft: oklch(32% 0.06 16);
    --warning: oklch(85% 0.1 54);
    --warning-soft: oklch(30% 0.05 54);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.wrap {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

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

[data-autofocus]:focus {
  outline: none;
}

h1,
h2,
h3 {
  font-family: var(--heading-font);
  font-weight: 700;
  color: var(--heading);
  line-height: 1.2;
}

h1 {
  font-size: 2.2rem;
  margin: 0.25rem 0 1rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

code {
  font-size: 0.9em;
  background: var(--card);
  padding: 0.1em 0.35em;
  border-radius: 0.35rem;
}

/* Header and footer */

.site-header {
  background: var(--band);
  color: var(--band-text);
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  gap: 0.25rem 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--band-text);
  text-decoration: none;
}

.brand span {
  color: var(--band-accent);
}

.tagline {
  color: var(--band-accent);
  font-size: 0.95rem;
}

.site-footer {
  background: var(--band);
  color: var(--band-text);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
  padding: 1.25rem 0;
}

/* Buttons */

button {
  font-family: var(--heading-font);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--secondary-text);
  background: var(--secondary);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  min-height: 2.75rem;
  transition: background-color 0.15s;
}

button:hover {
  background: var(--secondary-hover);
}

button.primary {
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
}

button.primary:hover {
  background: var(--primary-hover);
}

button.link-button {
  background: none;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

button.link-button:hover {
  background: none;
  color: var(--heading);
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

.actions,
.quiz-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0;
}

/* Start page */

.kicker {
  margin: 0;
  color: var(--muted);
  font-family: var(--heading-font);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
}

.lead {
  font-size: 1.15rem;
}

.warning {
  background: var(--warning-soft);
  border-left: 6px solid var(--warning);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.warning h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.warning p {
  margin: 0.25rem 0;
}

.disclaimer {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.25rem 1.5rem 0.75rem;
}

.disclaimer h2 {
  margin-top: 1.25rem;
}

.disclaimer li + li {
  margin-top: 0.5rem;
}

/* Quiz */

.progress-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-family: var(--heading-font);
  font-weight: 600;
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--track);
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
}

.statement {
  font-size: 1.3rem;
  margin: 0 0 1rem;
}

.background {
  margin: 0 0 1.5rem;
}

.background summary,
.scoring summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
}

.links {
  padding-left: 1.25rem;
}

.answers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.75rem 0 0.75rem;
}

.answers .answer-skip {
  grid-column: 1 / -1;
  justify-self: center;
  background: none;
  color: var(--link);
  border: 2px dashed var(--line);
}

.answers.compact {
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.answers.compact .answer-skip {
  grid-column: auto;
}

.answer {
  min-height: 3.5rem;
  font-size: 1.15rem;
}

.answers.compact .answer {
  min-height: 2.5rem;
  padding: 0.3rem 0.9rem;
  font-size: 1rem;
}

/* Inside light-blue cards, unselected answers sit on the page background. */
.answers.compact .answer[aria-pressed="false"] {
  background: var(--bg);
  border-color: var(--line);
}

.answers.compact .answer[aria-pressed="false"]:hover {
  background: var(--secondary-hover);
}

.answers.compact .answer-skip[aria-pressed="false"] {
  border-style: dashed;
}

.answer-agree[aria-pressed="true"] {
  background: var(--agree-soft);
  border-color: var(--agree);
  color: var(--agree);
}

.answer-neutral[aria-pressed="true"] {
  background: var(--neutral-soft);
  border-color: var(--neutral);
  color: var(--neutral);
}

.answer-disagree[aria-pressed="true"] {
  background: var(--disagree-soft);
  border-color: var(--disagree);
  color: var(--disagree);
}

.answers .answer-skip[aria-pressed="true"] {
  border-style: solid;
  border-color: var(--link);
}

.current-answer {
  color: var(--muted);
  text-align: center;
  margin: 0;
}

/* Result views navigation */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tabs a {
  font-family: var(--heading-font);
  font-weight: 600;
  padding: 0.45rem 1rem;
  text-decoration: none;
  color: var(--secondary-text);
  background: var(--secondary);
  border-radius: var(--radius);
}

.tabs a:hover {
  background: var(--secondary-hover);
}

.tabs a[aria-current="page"] {
  background: var(--primary);
  color: var(--primary-text);
}

/* Weighting */

.weight-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.weight-list li {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 0.5rem;
}

input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: none;
  accent-color: var(--primary);
}

.weight-info {
  display: flex;
  flex-direction: column;
  flex: 1 1 16rem;
}

.weight-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.35rem 0;
}

.weight-title {
  font-weight: 600;
}

.weight-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Results */

.notice {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
}

.notice p {
  margin-top: 0;
}

.ranking,
.rows,
.thesis-list,
.stances {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ranking {
  margin: 1rem 0 1.5rem;
}

.candidate,
.thesis {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.candidate > summary,
.thesis > summary {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}

.candidate > summary::-webkit-details-marker,
.thesis > summary::-webkit-details-marker {
  display: none;
}

.candidate > summary::after,
.thesis > summary::after {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--link);
  border-bottom: 2px solid var(--link);
  transform: rotate(45deg);
  margin: 0 0.25rem 0.25rem 0.5rem;
}

.candidate[open] > summary::after,
.thesis[open] > summary::after {
  transform: rotate(-135deg);
  margin-bottom: -0.25rem;
}

.rank,
.thesis-number {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 1.75rem;
  color: var(--heading);
}

.avatar {
  --hue: 264;
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1rem;
  background: oklch(85% 0.07 var(--hue));
  color: oklch(25% 0.05 var(--hue));
}

@media (prefers-color-scheme: dark) {
  .avatar {
    background: oklch(40% 0.08 var(--hue));
    color: oklch(95% 0.02 var(--hue));
  }
}

/* The image covers the initials, which stay as the fallback. The outline keeps
   light or card-coloured avatars from blending into the background. */
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  outline: 1px solid color-mix(in oklch, var(--text) 15%, transparent);
  outline-offset: -1px;
}

.candidate-main,
.thesis-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.candidate-name {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--heading);
}

.candidate-score {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.bar {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--primary);
}

.coverage,
.thesis-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.thesis-title {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--heading);
}

.candidate-body,
.thesis-body {
  padding: 0 1.25rem 1rem;
  border-top: 1px solid var(--card-border);
}

.row,
.stance {
  padding: 1rem 0;
  border-bottom: 1px solid var(--card-border);
}

.row:last-child,
.stance:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.compare {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 0.5rem;
}

.compare dt {
  color: var(--muted);
}

.compare dd {
  margin: 0;
}

.summary {
  margin: 0.5rem 0;
}

.quote {
  margin: 0.5rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--blue-75);
  color: var(--muted);
  font-style: italic;
}

.quote p {
  margin: 0;
  white-space: pre-line;
}

.source {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-agree {
  background: var(--agree-soft);
  color: var(--agree);
  border-color: var(--agree);
}

.badge-neutral {
  background: var(--neutral-soft);
  color: var(--neutral);
  border-color: var(--neutral);
}

.badge-disagree {
  background: var(--disagree-soft);
  color: var(--disagree);
  border-color: var(--disagree);
}

.badge-unknown {
  color: var(--muted);
  border: 1px dashed var(--muted);
  font-weight: 500;
}

.stance-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stance-head .avatar {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.85rem;
}

.stance-head .candidate-name {
  font-size: 1rem;
}

.important-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.important-toggle input:disabled + label {
  color: var(--muted);
}

.scoring {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
}

.scoring[open] summary {
  margin-bottom: 0.5rem;
}

.bonus {
  --yellow: oklch(88% 0.17 95);
  --bonus-soft: oklch(97% 0.05 95);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--bonus-soft);
  border: 2px dashed var(--yellow);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

@media (prefers-color-scheme: dark) {
  .bonus {
    --bonus-soft: oklch(30% 0.05 95);
  }
}

.bonus-swatch {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: inset 0 0 0 1px oklch(0% 0 0 / 0.15);
}

.bonus h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.bonus p {
  margin: 0.25rem 0;
}

.bonus-note {
  color: var(--muted);
}

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

@media (max-width: 30rem) {
  h1 {
    font-size: 1.7rem;
  }

  .statement {
    font-size: 1.15rem;
  }

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

  .answers .answer-skip {
    justify-self: stretch;
  }

  .answers.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .candidate > summary,
  .thesis > summary {
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .rank {
    min-width: 1.25rem;
  }
}
