/* One ink on cool paper, like a duplicated research handout, plus a highlighter. */
:root {
  color-scheme: light;
  --paper: #e9ebf5;
  --sheet: #f9fafe;
  --ink: #2e2a7a;
  --ink-soft: #5f5ca3;
  --rule: #c5c7e3;
  --marker: #f4ee6b;
  --correction: #a1224b;

  --type: "Courier Prime", "Courier New", monospace;
  --read: "Literata", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--read);
}

main, .top {
  width: min(100% - 32px, 58rem);
  margin-inline: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  font-family: var(--type);
  font-size: 0.9375rem;
}

.mark { font-weight: 700; }

a { color: inherit; text-underline-offset: 0.18em; }

h1, h2, h3, h4, label, button, .quiet, .log, .sources, .notice {
  font-family: var(--type);
}

h1 {
  margin: 2.5rem 0 1.25rem;
  max-width: 17ch;
  font-size: clamp(2.5rem, 7.2vw, 4.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 36rem;
  margin: 0 0 2.5rem;
  font-size: 1.1875rem;
}

.ask .hint { margin: 0.5rem 0 0.75rem; font-size: 0.875rem; }

.quiet {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 700;
}

textarea, input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}

textarea { display: block; resize: vertical; }
textarea::placeholder { color: var(--ink-soft); opacity: 0.75; }

.ask-foot, .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
}

button {
  padding: 0.625rem 1.125rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--sheet);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

button.plain { background: transparent; color: var(--ink); }
button:hover:not(:disabled) { background: var(--marker); color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

:focus-visible { outline: 3px solid var(--ink-soft); outline-offset: 2px; }

.notice {
  margin: 1.5rem 0 0;
  padding: 0.875rem 1rem;
  background: var(--marker);
  font-weight: 700;
  line-height: 1.45;
}

.notice.error { background: transparent; border: 1.5px solid var(--correction); color: var(--correction); }

.sheet, .log, #result { margin-top: 2.5rem; }

.sheet {
  padding: 1.5rem;
  background: var(--sheet);
  border: 1.5px solid var(--ink);
}

.plan-items {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: item;
}

.plan-items li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  align-items: center;
  margin-top: 0.5rem;
  counter-increment: item;
}

.plan-items li::before {
  content: counter(item);
  font-family: var(--type);
  font-weight: 700;
}

.log ol {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.log li { padding: 0.25rem 0; overflow-wrap: anywhere; }
.log li::before { content: "> "; color: var(--ink-soft); }

.log.working li:last-child::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.3em;
  vertical-align: -0.12em;
  background: var(--ink);
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* A report: the text, with its sources beside it. */
.report {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 0 2.5rem;
  padding: 1.75rem;
  background: var(--sheet);
  border: 1.5px solid var(--ink);
}

.report h3 {
  grid-column: 1 / -1;
  margin: 0 0 1.25rem;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.report-body { min-width: 0; }
.report-body > :first-child { margin-top: 0; }
.report-body > :last-child { margin-bottom: 0; }
.report-body p, .report-body ul, .report-body ol { margin: 0 0 1em; }
.report-body ul, .report-body ol { padding-left: 1.25em; }
.report-body li { margin-bottom: 0.4em; }
.report-body h4 { margin: 1.5em 0 0.4em; font-size: 1.0625rem; }

.report-body code {
  font-family: var(--type);
  font-size: 0.9375em;
  overflow-wrap: anywhere;
}

.cite {
  font-family: var(--type);
  font-size: 0.8125em;
  font-weight: 700;
  text-decoration: none;
}

/* The highlighter: it swipes across a claim from left to right. */
.claim, .source {
  background-image: linear-gradient(var(--marker), var(--marker));
  background-repeat: no-repeat;
  background-position: 0 58%;
  background-size: 0% 82%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 220ms ease-out;
}

.claim.marked, .source.marked { background-size: 100% 82%; }

.sources {
  margin: 0;
  padding: 0 0 0 1.25rem;
  border-left: 1.5px solid var(--rule);
  list-style: none;
  font-size: 0.875rem;
  line-height: 1.4;
}

.source {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  padding: 0.25rem 0.25rem 0.25rem 0;
  margin-bottom: 0.625rem;
}

.source-number { font-weight: 700; }
.source a { overflow-wrap: anywhere; }
.source-host { display: block; color: var(--ink-soft); font-size: 0.8125rem; overflow-wrap: anywhere; }

.cost { margin-top: 0.875rem; }
#again { margin-top: 1rem; }

.example { margin-block: 4.5rem 3.5rem; }
.example .quiet { max-width: 40rem; margin-bottom: 1rem; }

@media (max-width: 760px) {
  body { font-size: 1rem; }
  h1 { margin-top: 1.25rem; }
  .sheet, .report { padding: 1.125rem; }
  .report { grid-template-columns: minmax(0, 1fr); }
  .sources {
    margin-top: 1.25rem;
    padding: 1rem 0 0;
    border-left: 0;
    border-top: 1.5px solid var(--rule);
  }
}

@media (prefers-reduced-motion: reduce) {
  .claim, .source { transition: none; }
  .log.working li:last-child::after { animation: none; }
}
