/* Perturb product styles: the home page, the describe page and the app.
   Tokens and rules: BRAND.md. Cobalt means act here (the dot, primary buttons,
   links, focus). Evidence grades use the slate scale on the record, never cobalt.
   Source Serif 4 for headlines and reading; Source Sans 3 for the application. */

:root {
  --ground: #faf9f6;
  --paper: #ffffff;
  --ink: #141b2d;
  --soft: #566079;
  --faint: #8a90a0;
  --rule: #e2e3e6;
  --rule-strong: #b9bdc6;
  --wash: #f1f2f5;
  --cobalt: #2443d6;
  --cobalt-hover: #1b34ae;
  --cobalt-dark: #6f86ff;
  --cobalt-mist: #eef1fc;
  --ok: #2f6b3a;
  --warn: #8a5a00;
  --bad: #9b2c2c;
  --serif: 'Source Serif 4', Charter, 'Iowan Old Style', Georgia, serif;
  --sans: 'Source Sans 3', 'Source Sans Pro', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--serif);
       font-size: 17px; line-height: 1.55; }
a { color: var(--cobalt); text-underline-offset: 3px; text-decoration-color: rgba(36, 67, 214, .35); }
a:hover { text-decoration-color: var(--cobalt); }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-family: var(--serif); letter-spacing: -0.01em; }
/* The application and forms read in Source Sans 3; editorial and legal pages stay in the serif. */
.app-main { font-family: var(--sans); }
.app-main h1, .legal { font-family: var(--serif); }
p { margin: 0 0 1rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 42rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.muted { color: var(--soft); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* ---- top bar ---- */
.topbar { border-bottom: 1px solid var(--rule); background: var(--ground); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 8px 24px; min-height: 60px; flex-wrap: wrap; }
/* The wordmark: the bracketed dot, then "Perturb" in the serif. */
.mark { display: inline-flex; align-items: center; gap: 0.4em; font-family: var(--serif); font-weight: 600; font-size: 1.32rem;
        color: var(--ink); text-decoration: none; }
.mark::before { content: ''; width: 1.2em; height: 1.2em; flex: none; background: url('/assets/brand/mark.svg') center / contain no-repeat; }
.topbar .mark { margin-right: auto; }
.topbar nav { display: flex; align-items: center; gap: 6px 20px; flex-wrap: wrap; font-family: var(--sans); font-size: 0.97rem; }
.topbar nav a { color: var(--ink); text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { border-bottom-color: var(--ink); }
.topbar nav a.btn { color: #fff; border-bottom: 0; padding: 8px 14px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
       font-family: var(--sans); font-size: 0.97rem; font-weight: 600; line-height: 1; text-decoration: none;
       padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--cobalt);
       background: var(--cobalt); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--cobalt-hover); border-color: var(--cobalt-hover); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); font-weight: 500; }
.btn.secondary:hover { background: var(--wash); border-color: var(--ink); }
.btn.small { padding: 6px 10px; font-size: 0.85rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.55; cursor: progress; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--cobalt); text-decoration: underline;
           text-decoration-color: rgba(36, 67, 214, .35); text-underline-offset: 3px; cursor: pointer; }

/* ---- forms ---- */
label { display: block; font-size: 0.9rem; font-weight: 600; margin: 0 0 4px; }
.hint { display: block; font-size: 0.85rem; color: var(--soft); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"],
select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 9px 11px; }
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 5px 10px;
        border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); cursor: pointer; user-select: none; }
.chip input { accent-color: var(--cobalt); margin: 0; }
.chip.on, .chip:has(input:checked) { border-color: var(--ink); background: var(--wash); }

/* ---- surfaces ---- */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.15rem; margin-bottom: 10px; }
.card h3 { font-size: 1rem; margin-bottom: 6px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.split { display: grid; gap: 24px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
.split > *, .grid > * { min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.list > li:last-child { border-bottom: 0; }
.empty { color: var(--soft); padding: 18px; border: 1px dashed var(--rule-strong); border-radius: 10px; text-align: center; }
.notice { font-size: 0.92rem; padding: 10px 14px; border-radius: var(--radius); background: var(--wash); border-left: 3px solid var(--ink); margin: 0 0 16px; }
.notice.warn { border-left-color: var(--warn); }
/* The one place in the app that carries the dot: a decision is waiting. */
.decision-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; margin: 0 0 16px; border: 1px solid #c9d2f5; border-radius: var(--radius); background: var(--cobalt-mist); }
.decision-banner strong { display: inline-flex; align-items: center; gap: 9px; }
.decision-banner strong::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--cobalt); flex: none; }
.decision-banner span { padding-left: 18px; }
.decision-banner span { display: block; color: var(--soft); font-size: 0.92rem; margin-top: 2px; }
.notice.bad { border-left-color: var(--bad); background: #fbf1f1; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--soft); margin-bottom: 6px; }

/* provenance badges on brief fields */
.src { font-family: var(--mono); font-size: 11px; line-height: 1.2; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--rule-strong); color: var(--soft); white-space: nowrap;
       display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.src.user { border-color: var(--ink); color: var(--ink); }
.src.document { border-style: dashed; border-color: var(--ink); color: var(--ink); }
.src.ai { background: var(--wash); }
.src.confirmed { background: var(--ink); border-color: var(--ink); color: #fff; }

/* status pills */
.pill { font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--rule-strong); white-space: nowrap; }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.warn { border-color: var(--warn); color: var(--warn); }

/* ---- app shell ---- */
.app-main { padding: 28px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.8rem; }
.loading { color: var(--soft); padding: 40px 0; }
.loading::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--rule-strong); border-top-color: var(--cobalt); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; font-family: var(--sans);
  padding: 10px 16px; border-radius: var(--radius); font-size: 0.92rem; max-width: 90vw; z-index: 50; }
#toast.bad { background: var(--bad); }
.auth-box { max-width: 420px; margin: 40px auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.plain th, table.plain td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); }
table.plain th { font-size: 0.85rem; color: var(--soft); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* ---- home page ---- */
.hero { padding: 72px 0 56px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -0.015em; margin-bottom: 20px; }
.hero h1 .pt { display: inline; color: var(--cobalt); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (min-width: 861px) { .hero-art { margin-left: -70px; width: calc(100% + 70px); align-self: center; } }
.hero-art { width: 100%; height: auto; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { max-width: 520px; } }
.hero h1 span { display: block; }
@media (min-width: 861px) { .hero h1 span { white-space: nowrap; } }
.hero p.lede { font-size: 1.2rem; color: var(--soft); max-width: 29rem; text-wrap: balance; margin-bottom: 28px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.cta .btn { padding: 13px 20px; font-size: 1rem; }
.band { padding: 56px 0; border-top: 1px solid var(--rule); }
.band h2 { font-size: 1.6rem; margin-bottom: 24px; }
.three { display: grid; gap: 28px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .three { grid-template-columns: 1fr; } }
.three h3 { font-size: 1.1rem; margin-bottom: 8px; }
.three p { color: var(--soft); margin: 0; }
.step-n { font-family: var(--mono); font-size: 12px; color: var(--soft); display: block; margin-bottom: 8px; }
.preview { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) auto 440px; align-items: start; }
.match-arrow { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--cobalt, #2443D6); }
.match-arrow span { font-size: 72px; line-height: 0.8; }
.match-arrow small { font-family: var(--mono); font-size: 11px; color: var(--soft); white-space: nowrap; }
.shortlist-row { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.shortlist-row:last-child { border-bottom: 0; }
.shortlist-row .grade { font-family: var(--mono); font-size: 11px; color: var(--cobalt, #2443D6); margin-left: 6px; }
@media (max-width: 860px) { .preview { grid-template-columns: 1fr; } .match-arrow span { transform: rotate(90deg); } }
.shot { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 1px 0 var(--rule), 0 12px 32px -18px rgba(20,27,45,.25); overflow: hidden; }
.shot-bar { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 11.5px; color: var(--soft); }
.shot-bar i { display: none; }
.shot-body { font-family: var(--sans); }
.shot-body { padding: 16px 18px; font-size: 0.92rem; }
.shot-field { position: relative; padding: 9px 128px 9px 0; border-bottom: 1px solid var(--rule); }
.shot-field .k .src { position: absolute; right: 0; top: 9px; }
.shot-field:last-child { border-bottom: 0; }
.shot-field .k { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; color: var(--soft); font-weight: 600; margin-bottom: 2px; }
.footer { border-top: 1px solid var(--rule); padding: 28px 0 48px; font-size: 0.9rem; color: var(--soft); }
.footer nav { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.footer { font-family: var(--sans); }
.footer a { color: var(--soft); }
.secondary-work { font-size: 0.95rem; color: var(--soft); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 6px; }
.field-tools { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.save-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(560px, calc(100vw - 32px));
  background: var(--paper); border: 1px solid var(--ink); border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 12px 32px -12px rgba(20,27,45,.35); }
.row > .btn, .row > button, .row > a.btn, .row > .linkish { flex: 0 0 auto; }
.title-input { display: block; width: 100%; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; line-height: 1.25;
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; padding: 4px 0; background: transparent; resize: none; overflow: hidden; min-height: 0; }
.thread { margin-top: 8px; padding: 6px 0 4px 12px; border-left: 2px solid var(--rule); }
.thread-form textarea { min-height: 3rem; }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 40; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); box-shadow: 0 8px 24px -12px rgba(20,27,45,.3); }
.ac-list li { padding: 7px 11px; cursor: pointer; font-size: 0.95rem; }
.ac-list li:hover, .ac-list li[aria-selected="true"] { background: var(--wash); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 26px; }
.stat { display: flex; flex-direction: column; gap: 4px; text-decoration: none; padding: 14px 16px; }
.stat-n { font-family: var(--mono); font-size: 1.6rem; font-weight: 500; }
.stat-l { font-size: 0.85rem; color: var(--soft); }
.legal h1 { font-size: 2rem; margin-bottom: 6px; }
.legal h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.legal li { margin-bottom: 6px; }
.funnel { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.funnel-step { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-left: 2px solid var(--rule-strong); }

/* Dense tables stay calm: links read in ink and turn cobalt on hover (BRAND.md). */
table.plain a { color: var(--ink); text-decoration-color: var(--rule-strong); }
table.plain a:hover { color: var(--cobalt); text-decoration-color: var(--cobalt); }

.head-actions { display: inline-flex; align-items: center; gap: 22px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary .hint { margin: 0; color: var(--cobalt); }
details.fold[open] > summary .hint { color: var(--soft); }

/* The home page carries a larger wordmark. */
.home .topbar .wrap { min-height: 72px; }
.home .topbar .mark { font-size: 1.65rem; }

.early { max-width: 36rem; margin: 22px 0 0; font-family: var(--sans); font-size: 0.95rem; color: var(--soft); }
.early b { color: var(--ink); }
/* Buttons keep their own text colour inside any block that colours its links (tables, footers, notices). */
a.btn, a.btn:visited, a.btn:hover { color: #fff !important; text-decoration: none; }
a.btn.secondary, a.btn.secondary:visited, a.btn.secondary:hover { color: var(--ink) !important; }
a.btn.danger { color: var(--bad) !important; }

/* Tables on reading pages: ruled, banded rows, header in ink. */
.legal table { width: 100%; border-collapse: collapse; margin: 12px 0 10px; font-family: var(--sans); font-size: 0.95rem;
               background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.legal th { text-align: left; font-weight: 600; color: #fff; background: var(--ink); padding: 10px 14px; }
.legal td { padding: 10px 14px; border-top: 1px solid var(--rule); vertical-align: top; }
.legal tbody tr:nth-child(even) td { background: var(--wash); }
.legal table.compare td:first-child { color: var(--soft); }
.legal h3 { font-size: 1.05rem; margin: 22px 0 6px; }
@media (max-width: 560px) { .legal th, .legal td { padding: 8px 10px; } }

/* Homepage: compact six-step strip, facility preview details. */
.steps { list-style: none; margin: 8px 0 18px; padding: 0; display: grid; gap: 0; grid-template-columns: repeat(6, 1fr);
         border-top: 2px solid var(--ink); }
.steps li { padding: 14px 16px 6px 0; display: flex; flex-direction: column; gap: 4px; }
.steps li + li { padding-left: 16px; border-left: 1px solid var(--rule); }
.steps b { font-size: 1.05rem; }
.steps li > span:last-child { color: var(--soft); font-family: var(--sans); font-size: 0.92rem; line-height: 1.35; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); } .steps li:nth-child(4) { border-left: 0; padding-left: 0; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } .steps li + li { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); } }
.mock-search { font-family: var(--sans); font-size: 0.88rem; color: var(--faint); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 7px 14px; margin-bottom: 10px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips-row span { font-family: var(--sans); font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: var(--wash); color: var(--ink); }

/* A table that breaks out of the narrow reading column (price tables). */
.legal .table-wide { position: relative; left: 50%; transform: translateX(-50%); width: min(1072px, calc(100vw - 48px)); overflow-x: auto; }
.legal .table-wide td:last-child { min-width: 18rem; }

/* Coverage band on the homepage: one link per method, with the facility count. */
.four { display: grid; gap: 28px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .four { grid-template-columns: 1fr; } }
.four h3 { font-size: 1.05rem; margin-bottom: 10px; }
.cover { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.cover a { font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; background: var(--wash); color: var(--ink); text-decoration: none; }
.cover a:hover { background: var(--rule); }
.cover a span { font-family: var(--mono, ui-monospace, monospace); font-size: 0.75rem; color: var(--soft); margin-left: 2px; }

.orcid-entry { margin: 14px 0 6px; max-width: 30rem; }
.orcid-entry label { display: block; font-size: 0.92rem; color: var(--soft); margin-bottom: 6px; }
.orcid-entry div { display: flex; gap: 8px; }
.orcid-entry input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--rule-strong); border-radius: 8px; font: inherit; }
