/* One stylesheet, no build step. Ink on security-print paper; two signal
   colours, each with exactly one meaning. */

:root {
  --ink: #141b2e;
  --paper: #e9ece5;
  --paper-2: #f4f6f1;
  --guilloche: #1f6f6a;   /* funding secured */
  --stamp: #b4253a;       /* a closing deadline */
  --mute: #5a6473;
  --rule: #c3c9bd;

  --measure: 34rem;
  --step: clamp(2rem, 5.2vw, 3.125rem);
  --gap: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ece5;
    --paper: #141b2e;
    --paper-2: #1b2235;
    --guilloche: #5ec3b8;
    --stamp: #ef7a86;
    --mute: #9aa4b2;
    --rule: #333c54;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.wordmark {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 900;
  letter-spacing: -0.015em;
  color: var(--ink);
  cursor: pointer;
}

.shortlist-toggle {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.shortlist-toggle[aria-pressed="true"] { font-weight: 600; }

.tally {
  display: inline-block;
  min-width: 1.6em;
  margin-left: 0.2em;
  padding: 0 0.4em;
  border: 1px solid var(--rule);
  border-radius: 1em;
  text-align: center;
  font-size: 0.8125rem;
}

/* ---------- the question views ---------- */

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
}

.step-count {
  margin: 0 0 1.75rem;
  color: var(--mute);
  font-size: 0.8125rem;
}

.question {
  margin: 0 0 0.75rem;
  max-width: 24ch;
  font-size: var(--step);
  font-weight: 900;
  line-height: 1.03;
  letter-spacing: -0.025em;
}

.headline {
  margin: 0 0 0.35rem;
  max-width: 22ch;
  font-size: clamp(1.75rem, 4vw, 2.3125rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.note {
  margin: 0 0 1.5rem;
  max-width: var(--measure);
  color: var(--mute);
}

.hint {
  margin: 0.75rem 0 0;
  min-height: 1.55em;
  color: var(--stamp);
}

/* The answer carries as much weight as the question. */

.answer { display: block; margin-bottom: 2.25rem; }

.answer-control {
  width: 100%;
  max-width: var(--measure);
  background: var(--paper-2);
  color: var(--ink);
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 0.5rem 0.25rem;
  font: inherit;
  font-size: clamp(1.3125rem, 2.6vw, 1.75rem);
  font-weight: 600;
}

.sub { border: 0; margin: 0 0 2rem; padding: 0; }

.sub-question {
  padding: 0;
  margin-bottom: 0.85rem;
  font-size: 1.3125rem;
  font-weight: 600;
}

/* Options read as a list of answers, separated by hairlines rather than boxed. */

.options { display: flex; flex-direction: column; }

.options .option {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
  font-size: 1.125rem;
  cursor: pointer;
}

.options .option:last-child { border-bottom: 1px solid var(--rule); }
.options .option input { margin: 0; flex: none; accent-color: var(--guilloche); }
.options .option .label { flex: 1 1 auto; }

.options .option .count {
  flex: none;
  color: var(--mute);
  font-size: 0.875rem;
}

.options-inline {
  flex-flow: row wrap;
  gap: 0.25rem 1.25rem;
}

.options-inline .option {
  border: 0;
  padding: 0.25rem 0;
  font-size: 1rem;
}

.options-inline .option:last-child { border-bottom: 0; }

/* ---------- optional extras, on both steps and results ---------- */

.optional, .drawer {
  margin: 0 0 2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.optional > summary, .drawer > summary {
  padding: 0.85rem 0;
  font-weight: 600;
  cursor: pointer;
}

.optional-body, .drawer-body { padding: 0.25rem 0 1.25rem; }

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field { display: block; flex: 1 1 9rem; border: 0; margin: 0; padding: 0; }

.field-label {
  display: block;
  padding: 0;
  margin-bottom: 0.3rem;
  color: var(--mute);
  font-size: 0.8125rem;
}

.field input[type="number"], .drawer-body select {
  width: 100%;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.5rem;
  font: inherit;
}

.drawer-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.5rem;
}

.drawer-group > h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.drawer-group .options { max-height: 11rem; overflow: auto; }

.drawer-group .options .option {
  padding: 0.3rem 0;
  border: 0;
  font-size: 0.9375rem;
}

.drawer-group .options .option:last-child { border-bottom: 0; }

/* ---------- buttons ---------- */

.step-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
}

.primary, .ghost {
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.primary { background: var(--ink); color: var(--paper); }
.ghost { background: transparent; color: var(--ink); }

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.file-button { position: relative; overflow: hidden; display: inline-block; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- results ---------- */

.answers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1.5rem;
  color: var(--mute);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.chip {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 1.4em;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.chip-select {
  appearance: none;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 1.4em;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
}

/* A result is a row of type between hairlines, not a card. */

.rows { display: flex; flex-direction: column; }

.row {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.rows .row:last-child { border-bottom: 1px solid var(--rule); }

.row h2 {
  margin: 0 0 0.2rem;
  max-width: 38ch;
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1.25;
}

.row h2 a { color: var(--ink); text-decoration: none; }
.row h2 a:hover { text-decoration: underline; }

.row-where { margin: 0 0 0.15rem; }
.row-where a { color: var(--ink); }
.row-facts { margin: 0; color: var(--mute); }

.row-scheme { margin-top: 1rem; }

.row-scheme > summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.row-scheme > summary::-webkit-details-marker { display: none; }
.row-scheme > summary::after { content: " — more about this scheme"; color: var(--mute); font-weight: 400; }
.row-scheme[open] > summary::after { content: " — less"; }

.scheme-line { margin: 0.2rem 0 0; }
.scheme-detail { margin: 0.6rem 0 0; max-width: var(--measure); color: var(--mute); }

.funded { color: var(--guilloche); font-weight: 600; }
.deadline { color: var(--stamp); }
.bond { color: var(--stamp); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.1rem;
}

.row-actions a { color: var(--ink); }

/* The one action worth pressing on a row reads as a button; the rest stay links. */
.row-actions .ask {
  background: var(--paper-2);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 2px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.row-actions .ask:hover {
  background: var(--ink);
  color: var(--paper);
}

.row-actions .ask[disabled] {
  cursor: progress;
  opacity: 0.65;
}
.verified { margin: 0.9rem 0 0; color: var(--mute); font-size: 0.8125rem; }

.shortlist-tools { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.empty { margin: 2rem 0; max-width: var(--measure); color: var(--mute); }

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

.footer {
  border-top: 1px solid var(--rule);
}

.footer p {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  max-inline-size: 68ch;
  color: var(--mute);
  font-size: 0.8125rem;
}

/* ---------- the AI application guide ---------- */

.guide {
  margin-top: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  max-width: var(--measure);
}

.guide-caveat, .guide-status, .guide-source {
  margin: 0;
  color: var(--mute);
  font-size: 0.8125rem;
}

.guide-caveat a { color: var(--mute); }
.guide-source { margin-top: 1.25rem; }
.guide-error { margin: 0 0 0.5rem; color: var(--stamp); }

.guide-part { margin-top: 1.1rem; }

.guide-part h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.guide-text { margin: 0; }

.guide-list, .guide-steps {
  margin: 0;
  padding-left: 1.25rem;
}

.guide-list li, .guide-steps li { margin-bottom: 0.35rem; }
.guide-list.watch li { color: var(--stamp); }
.guide-steps .step-title { font-weight: 600; }
.guide-steps .step-detail { color: var(--mute); }
.guide-part.unknowns { color: var(--mute); }

/* ---------- motion: one moment, and it answers an action ---------- */

@keyframes advance {
  from { opacity: 0; transform: translateX(1.25rem); }
  to { opacity: 1; transform: none; }
}

.advancing { animation: advance 220ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .advancing { animation: none; }
}
