/* Oxagile brand core (tools/brand/core.json): one accent, red, spent sparingly. Ink, slate, steel for text. */
@font-face {
  font-family: "Montserrat";
  src: url("/assets/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --red: #C1272D;
  --ink: #141414;
  --graphite: #4D4E50;
  --slate: #5C5D62;
  --steel: #8A8C91;
  --silver: #A8A9AC;
  --mist: #D9DADC;
  --fog: #F4F4F4;
  --white: #FFFFFF;
  --font: "Montserrat", "Segoe UI", Arial, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

.top {
  background: var(--white);
  border-bottom: 1px solid var(--mist);
}
.top-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top img { display: block; height: 26px; width: auto; }
.top .context { font-size: 13px; color: var(--slate); text-align: right; }

.progress {
  height: 3px;
  background: var(--mist);
}
.progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 300ms ease;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.sheet {
  background: var(--white);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 40px 44px 36px;
}

.kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 14px;
}
.kicker::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  background: var(--red);
  margin-bottom: 14px;
}

h1 {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 0 0 18px;
}
h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px;
}
p { margin: 0 0 14px; }
.lede p { color: var(--graphite); font-size: 17px; }
.section-intro { color: var(--slate); margin: 4px 0 0; }
.step-count { font-size: 13px; color: var(--steel); margin: 0 0 6px; }

.question { margin: 28px 0 0; min-width: 0; }
.question + .question { border-top: 1px solid var(--mist); padding-top: 28px; }
.question.lead { border-top: 0; padding-top: 0; }
.question .label {
  display: block;
  padding: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 4px;
}
.hint { font-size: 14px; color: var(--steel); margin: 0 0 14px; }
.question .label + .options, .question .label + .matrix, .question .label + textarea, .question .label + .fields { margin-top: 14px; }

.options { display: grid; gap: 8px; }
.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.option:hover { border-color: var(--silver); }
.option input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--silver);
  border-radius: 50%;
  background: var(--white);
  display: grid;
  place-content: center;
  cursor: pointer;
}
.option input[type="checkbox"] { border-radius: 4px; }
.option input::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  transform: scale(0);
  transition: transform 120ms ease;
}
.option input[type="checkbox"]::before { border-radius: 2px; }
.option input:checked { border-color: var(--ink); }
.option input:checked::before { transform: scale(1); }
.option:has(input:checked) { border-color: var(--ink); background: #FAFAFA; }
.option:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.option input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.option span { font-size: 15px; line-height: 1.4; }

.other-text { margin: 8px 0 0 46px; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%;
  font: 400 15px/1.5 var(--font);
  color: var(--ink);
  padding: 11px 13px;
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  background: var(--white);
}
textarea { resize: vertical; min-height: 88px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.fields { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 12px; }

/* Matrix: a grid of radio pills on wide screens, stacked rows on phones. */
.matrix { display: grid; gap: 0; }
.matrix-head, .matrix-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.8fr) repeat(var(--cols), minmax(0, 1fr));
  align-items: center;
  gap: 6px;
}
.matrix-head { padding: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--slate); text-align: center; }
.matrix-row { padding: 10px 0; border-top: 1px solid var(--fog); }
.matrix-row .row-label { font-size: 15px; line-height: 1.35; padding-right: 8px; }
.pill { display: flex; justify-content: center; position: relative; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 6px 4px;
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  font-size: 0;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.pill span::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--silver);
}
.pill:hover span { border-color: var(--silver); }
.pill input:checked + span { border-color: var(--ink); background: #FAFAFA; }
.pill input:checked + span::after { background: var(--red); border-color: var(--red); }
.pill input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--mist);
}
.btn {
  font: 600 15px/1 var(--font);
  padding: 14px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: #2a2a2d; }
.btn:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--mist); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.small { padding: 9px 14px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--mist); }
.spacer { flex: 1; }
.note { font-size: 13px; color: var(--steel); }
.error-msg { color: var(--red); font-size: 14px; margin: 12px 0 0; }

.foot { max-width: 760px; margin: 0 auto; padding: 0 20px 40px; font-size: 12px; color: var(--steel); }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  main { padding: 20px 12px 56px; }
  .sheet { padding: 28px 20px 24px; border-radius: 4px; }
  h1 { font-size: 25px; }
  h2 { font-size: 20px; }
  .lede p { font-size: 16px; }
  .top-inner { padding: 14px 16px; }
  .top img { height: 22px; }
  .fields { grid-template-columns: 1fr; }
  .other-text { margin-left: 0; }
  .matrix-head { display: none; }
  .matrix-row { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); padding: 14px 0; }
  .matrix-row .row-label { grid-column: 1 / -1; font-weight: 600; padding: 0 0 8px; }
  .pill span { font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--slate); min-height: 44px; text-align: center; }
  .pill span::after { display: none; }
  .pill input:checked + span { color: var(--white); background: var(--ink); border-color: var(--ink); }
  .actions .btn { padding: 14px 18px; }
}

/* ---------- Results pages (admin) ---------- */
.wide { max-width: 1100px; }
.admin h1 { font-size: 26px; }
.admin .sheet { padding: 28px 30px; margin-bottom: 20px; }
.admin a { color: var(--ink); }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th { text-align: left; font-size: 12px; font-weight: 600; color: var(--slate); padding: 8px 10px; border-bottom: 1px solid var(--mist); }
.admin td { padding: 10px; border-bottom: 1px solid var(--fog); vertical-align: top; }
.admin td.num, .admin th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin .link-cell { display: flex; gap: 6px; align-items: center; }
.admin .link-cell input { font-size: 12px; padding: 6px 8px; min-width: 180px; }
.admin .tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--fog); color: var(--slate); }
.admin .stat { font-size: 34px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; }
.admin .stat-label { font-size: 12px; color: var(--slate); margin-top: 6px; }
.admin .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.admin .qblock { padding: 22px 0; border-top: 1px solid var(--fog); }
.admin .qblock:first-of-type { border-top: 0; padding-top: 0; }
.admin .qtitle { font-weight: 600; font-size: 15px; margin: 0 0 2px; }
.admin .qn { font-size: 12px; color: var(--steel); margin: 0 0 10px; }
.bar-row { display: grid; grid-template-columns: minmax(160px, 2fr) 3fr 64px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.bar { height: 10px; background: var(--fog); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--graphite); }
.bar-row.most .bar span { background: var(--red); }
.bar-row .count { text-align: right; color: var(--slate); font-variant-numeric: tabular-nums; }
.stack { display: flex; height: 12px; border-radius: 2px; overflow: hidden; background: var(--fog); }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--slate); margin: 0 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.mrow { display: grid; grid-template-columns: minmax(180px, 2fr) 3fr 40px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.mrow .count { text-align: right; color: var(--slate); }
.quote { background: var(--fog); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; font-size: 14px; white-space: pre-wrap; }
.quote .src { display: block; font-size: 12px; color: var(--steel); margin-top: 4px; white-space: normal; }
.answers dt { font-size: 13px; font-weight: 600; margin-top: 12px; }
.answers dd { margin: 2px 0 0; font-size: 14px; color: var(--graphite); white-space: pre-wrap; }
.admin form.inline { display: inline; }
.admin .newform { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.admin .flash { background: var(--white); border: 1px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.admin .top nav a { color: var(--ink); font-size: 14px; margin-left: 18px; text-decoration: none; }
.admin .top nav a:hover { text-decoration: underline; }
.admin .top-inner { max-width: 1100px; }
@media (max-width: 640px) {
  .admin .sheet { padding: 20px 16px; overflow-x: auto; }
  .bar-row, .mrow { grid-template-columns: 1fr 1fr 44px; }
  .admin .top nav a { margin-left: 10px; font-size: 13px; }
}
