/* The application, wearing the same clothes as the site that sold it.
   ──────────────────────────────────────────────────────────────────────────
   Tokens, type and spacing are mole-landing's, deliberately: somebody arrives
   here from a page with a voice, and an application in system fonts at 15px
   reads as a different company's back office. What is NOT copied is the
   marketing rhythm — a landing page can spend 116px between sections; a
   dashboard that makes you scroll to find four rows is wasting your time.

   The three typefaces are carried in web/fonts rather than fetched, because
   this server sends default-src 'self' with no exception. See that directory's
   README for why that is the right way round. */

/* ── typefaces ───────────────────────────────────────────────────────────── */
/* One variable file per family, covering every weight the UI asks for, so the
   rules below name ranges and a font update needs no CSS change. */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root {
  /* ground — blue-black, not neutral black */
  --ground: #0c0f14;
  --ground-2: #10141b;
  --panel: #171c25;
  --panel-2: #1d232e;

  --ink: #e9ecf2;
  --muted: #98a1b2;
  --faint: #667082;

  --line: rgba(233, 236, 242, 0.09);
  --line-2: rgba(233, 236, 242, 0.16);

  /* the document, which is the only light surface here */
  --paper: #fbfbf8;
  --paper-ink: #14171d;

  /* The mark's hue. This was #f2b23e — seven degrees of hue off the logo's
     #c9a227, which is close enough to look like a mistake rather than a choice
     once the site and the application are open in two tabs. The landing fixed
     it and this had not; #dab43f is the logo hue exactly, lightened for a dark
     ground. */
  --accent: #dab43f;
  --accent-ink: #201705;
  --accent-hover: #ffc65a;
  --accent-wash: rgba(218, 180, 63, 0.13);
  --accent-line: rgba(218, 180, 63, 0.34);

  /* the three things a pack can be */
  --confirm: #59c39b;
  --warn: #e0a03c;
  --bad: #e0705c;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1040px;
  --pad: 24px;
  --radius: 14px;
}

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

body {
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1.08;
  text-wrap: balance;
}

::selection {
  background: var(--accent-wash);
  color: var(--ink);
}

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

[hidden] {
  display: none !important;
}

/* ── shell ───────────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* The bar carries the mark and nothing else it does not have to. An
   application header is not a navigation: there is one place to be. */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  /* The page's own colour, opaque, with no rule under it.
     It was translucent over a blur, which reads as a grey band sitting on the
     page rather than part of it — most visible on the sign-in screen, where
     there is nothing behind it to justify the effect, and in browsers that
     ship backdrop-filter off, where the blur never arrives and only the wash
     is left. */
  background: var(--ground);
}
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}
header .mark {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 6px;
}
header h1 {
  font-size: 23px;
  letter-spacing: -0.02em;
  line-height: 1;
}
header .sub {
  color: var(--faint);
  font-size: 13px;
  letter-spacing: 0.01em;
  padding-left: 2px;
}
header .spacer {
  flex: 1;
}

/* main.wrap, not main. The element also carries .wrap, whose
   `padding: 0 var(--pad)` expands to a padding-top of zero AT THE CLASS'S
   specificity — so an element selector loses to it whether it writes the
   shorthand or the longhand, and the first heading sat underneath the sticky
   header. */
main.wrap {
  padding-top: 76px;
  padding-bottom: 104px;
}

/* Heading on the left, the screen's one action on the right. */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 40px;
}
.head .lede {
  margin-bottom: 0;
}
.head > button {
  flex: none;
  margin-top: 6px;
}

/* ── headings ────────────────────────────────────────────────────────────── */
/* The kicker is the landing's: mono, wide, accent. It is what tells you which
   of five screens you are on without a second heading to read. */
.kicker {
  display: block;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

h2 {
  font-size: clamp(28px, 3.6vw, 38px);
}

p.lede {
  color: var(--muted);
  margin: 14px 0 28px;
  max-width: 62ch;
}

/* ── buttons ─────────────────────────────────────────────────────────────── */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 15px/1 var(--sans);
  letter-spacing: 0.005em;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}
button:hover {
  background: var(--accent-hover);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
  background: var(--accent);
}
button.quiet,
.btn.quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
button.quiet:hover,
.btn.quiet:hover {
  background: transparent;
  border-color: var(--ink);
}
button.small {
  padding: 9px 14px;
  font-size: 13.5px;
}

/* ── forms ───────────────────────────────────────────────────────────────── */
label {
  display: block;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 10px;
}
input[type="email"],
textarea {
  width: 100%;
  background: var(--ground-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 13px 15px;
  font: 400 17px/1.5 var(--sans);
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}
input[type="email"]::placeholder,
textarea::placeholder {
  color: var(--faint);
}
textarea {
  min-height: 128px;
  resize: vertical;
}
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--panel);
}

/* ── sign in ─────────────────────────────────────────────────────────────── */
/* The one screen that is not a dashboard, so it is centred and small: there is
   nothing else to look at and a full-width form would pretend otherwise. */
#view-signin,
#view-sent {
  max-width: 460px;
  margin: clamp(12px, 6vh, 64px) auto 0;
  padding: 34px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
#view-signin p.lede,
#view-sent p.lede {
  margin-bottom: 26px;
}
#form-signin button {
  width: 100%;
}

/* ── buying ──────────────────────────────────────────────────────────────── */
/* The screen somebody is on when they decide to spend money, so the whole
   decision is on it: three tiers, each with its price, what it is for, what is
   already available, and its own button. */
.buy {
  margin-bottom: 44px;
}
h3 {
  font-size: 24px;
}
.buy .sub,
.list-head + .panel {
  margin-top: 0;
}
.buy .sub {
  color: var(--muted);
  font-size: 15.5px;
  margin: 8px 0 20px;
}
.list-head {
  margin: 0 0 18px;
}

.tier .price {
  font: 400 34px/1 var(--serif);
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.tier .price span {
  font: 500 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-left: 8px;
}
.tier .blurb {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-top: 12px;
}
/* Pushed to the bottom so the three buttons line up across cards of unequal
   text — a row of buy buttons at three different heights reads as three
   different controls. */
.tier .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: auto;
  padding-top: 18px;
}
/* Set like the tier name above it, in the same accent: it is the number that
   decides whether the button beside it is worth pressing, and at --confirm
   green on a dark panel it was the faintest thing on the card. */
.tier .held {
  font: 500 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.tier .held.zero {
  color: var(--muted);
}

/* The row between owning a credit and spending one. Given the accent's edge
   rather than a filled panel: it is the one thing on the screen asking to be
   acted on, and a second block of colour beside three tier cards would just be
   a fourth card. */
.ready {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 52px;
  padding: 20px 24px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(218, 180, 63, 0.07), transparent 70%),
    var(--panel);
}
.ready p {
  font-size: 16.5px;
  color: var(--ink);
}
.ready button {
  flex: none;
}

/* ── the pack list ───────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font: 500 10.5px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 16px 18px;
  background: var(--ground-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 18px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:first-child td {
  border-top: 0;
}
tbody tr {
  transition: background 0.14s ease;
}
tbody tr:hover {
  background: var(--panel-2);
}
td.q {
  width: 100%;
}
td.q a {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  transition: color 0.14s ease;
}
tbody tr:hover td.q a {
  color: var(--accent);
}
td.t-tier {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ── status and grade ────────────────────────────────────────────────────── */
/* The landing's tag: a dot and a word, not a coloured box. A row of boxes in
   four colours reads as an alert panel; this reads as a state. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.pill.running {
  color: var(--ink);
  border-color: var(--accent-line);
}
.pill.running i {
  background: var(--accent);
  animation: breathe 1.8s ease-in-out infinite;
}
.pill.done i {
  background: var(--confirm);
}
.pill.failed {
  color: var(--bad);
  border-color: rgba(224, 112, 92, 0.4);
}
.pill.failed i {
  background: var(--bad);
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.grade {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.grade.pass {
  color: var(--confirm);
}
.grade.caveat {
  color: var(--warn);
}
.grade.refund {
  color: var(--bad);
}

/* ── ordering ────────────────────────────────────────────────────────────── */
.tiers {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}
.tier {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 22px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  color: var(--ink);
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}
button.tier:hover {
  background: var(--panel-2);
  border-color: var(--line-2);
}
.tier[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(218, 180, 63, 0.07), transparent 62%),
    var(--panel);
}
.tier .name {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
/* The clock is a promise, so it is the number on the card. Somebody choosing
   Deep is buying twenty-five minutes and should see that before they wait. */
.tier .mins {
  font: 400 36px/1 var(--serif);
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.tier .mins span {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 6px;
}
.tier .meta {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.04em;
  color: var(--faint);
  margin-top: 14px;
}
button.tier .meta {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 8px;
}

.field {
  margin-bottom: 26px;
}

/* The sign-in honeypot. Off-screen, not display:none: a bot that skips hidden
   inputs fills one that is only somewhere else. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#form-new .row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

/* ── one pack ────────────────────────────────────────────────────────────── */
.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  margin-bottom: 26px;
}
.back:hover {
  background: none;
  color: var(--accent);
}

#pack-question {
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.16;
  /* A measure, not the container's width. The question is the largest thing on
     the screen and a single line 55 characters long at this size is a line you
     lose your place in. */
  max-width: 38ch;
}
.pack-state {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Why a pack is graded what it is. One per row, the kind on the left in mono,
   which is the shape the pack's own §3 uses — the application should not
   describe a document in a different visual language than the document. */
.reasons {
  list-style: none;
  margin: 26px 0 0;
  border-top: 1px solid var(--line);
}
.reasons li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.55;
}
.reasons .kind {
  font: 500 10.5px var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 5px;
}
.reasons .kind.caveat {
  color: var(--warn);
}
.reasons .kind.refund {
  color: var(--bad);
}

/* The document, lit the way the landing lights it: paper lifted off the dark
   ground rather than a bordered rectangle cut into it. */
.doc {
  width: 100%;
  height: 78vh;
  min-height: 520px;
  margin-top: 28px;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 40px 70px -30px rgba(0, 0, 0, 0.7),
    0 2px 8px rgba(0, 0, 0, 0.4);
}
#pack-download {
  margin-top: 20px;
}
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.downloads-note {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 10px;
  max-width: 62ch;
}

/* ── notes ───────────────────────────────────────────────────────────────── */
.note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 15px 18px;
  color: var(--muted);
  font-size: 15.5px;
  margin-top: 22px;
}
.err {
  border-left-color: var(--bad);
  color: var(--bad);
}
#error {
  margin: 0 0 24px;
}
.empty {
  color: var(--faint);
  padding: 40px 18px;
  text-align: center;
}

/* ── narrow ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root {
    --pad: 18px;
  }
  body {
    font-size: 16px;
  }
  main {
    padding: 32px 0 72px;
  }
  .tiers {
    grid-template-columns: 1fr;
  }
  /* The action goes under the heading rather than beside it: at this width
     "beside" means a heading three words wide down the left of the screen. */
  .head {
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
  }
  .head > button {
    margin-top: 0;
  }
  /* The tier and grade columns go: on a phone the question and its state are
     what a row is for, and four columns at this width is four wrapped words. */
  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }
  td,
  th {
    padding: 14px;
  }
  header .sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* When the research happened, in the table and beside the status. Set like
   the tier beside it: a date is reference, not headline. */
.t-when,
#pack-when {
  font: 500 12px var(--mono);
  color: var(--faint);
  white-space: nowrap;
}

/* ── a run in progress ───────────────────────────────────────────────────── */
/* Shown only while a report is being made. The bar is the tier's clock, not a
   completeness figure: a run has no total to be a fraction of, since the
   planner adds leads as it learns. */
.progress {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 20px;
  margin: 20px 0 26px;
}
.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.prog-stage {
  font: 500 11.5px var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
.prog-clock {
  font: 500 11.5px var(--mono);
  color: var(--muted);
}
/* prog-track, NOT .bar: the page header is <div class="wrap bar">, and a
   second .bar rule here painted the header with this track's wash and clipped
   it to this track's height. A layout class and a component class sharing a
   four-letter name is a collision waiting for whoever adds the second one. */
.prog-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  margin: 12px 0 0;
  overflow: hidden;
}
.prog-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  /* Matched to the poll, so the fill glides between readings instead of
     stepping every five seconds. */
  transition: width 0.6s linear;
}
.prog-caption {
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 62ch;
}
/* The sub-question being read right now — mole's words, and the one line on
   this panel that shows the run is thinking about THIS question. */
.prog-lead {
  margin: 14px 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 62ch;
}
/* A claim is somebody else's sentence; a sub-question is mole's. The rule
   marks the difference without a second type size. */
.prog-lead.quoted {
  border-left: 2px solid var(--accent-line);
  padding-left: 12px;
  color: var(--muted);
}
.prog-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 16px 0 0;
}
.prog-counts dt {
  font: 500 10.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.prog-counts dd {
  margin: 4px 0 0;
  font: 600 19px var(--sans);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.prog-age {
  margin: 14px 0 0;
  font: 500 11px var(--mono);
  color: var(--faint);
}

/* ── footer ──────────────────────────────────────────────────────────────── */
/* Two links on every screen, because the sign-in screen says that signing in
   accepts what they point at. */
.foot {
  display: flex;
  gap: 22px;
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.foot a {
  color: var(--faint);
}
.foot a:hover {
  color: var(--muted);
}

p.fine {
  color: var(--faint);
  font-size: 13.5px;
  margin-top: 18px;
  max-width: 62ch;
}

/* ── terms and privacy ───────────────────────────────────────────────────── */
/* A document to read, so a reading measure, not the dashboard's width. */
header .home {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.legal {
  max-width: 70ch;
}
.legal h1 {
  font-size: clamp(32px, 4.2vw, 44px);
  margin-bottom: 18px;
}
.legal h2 {
  font-size: 24px;
  margin: 44px 0 12px;
}
.legal h3 {
  font-size: 19px;
  margin: 28px 0 10px;
}
.legal p,
.legal ul {
  color: var(--muted);
  margin-bottom: 14px;
}
.legal ul {
  padding-left: 22px;
}
.legal li {
  margin-bottom: 6px;
}
.legal strong {
  color: var(--ink);
  font-weight: 600;
}
.legal .table {
  overflow-x: auto;
  margin: 18px 0 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.legal th {
  white-space: normal;
  padding: 12px 14px;
}
.legal td {
  padding: 12px 14px;
  font-size: 15px;
  color: var(--muted);
  vertical-align: top;
}
.legal tbody tr:hover {
  background: none;
}
/* The dashboard's narrow-screen rule drops its table's second and fourth
   columns. A policy's columns are all the point — "why" is the column a reader
   came for — so they stay, and the table scrolls inside its frame instead. */
.legal th:nth-child(n),
.legal td:nth-child(n) {
  display: table-cell;
}
